diff --git a/Common/Network/FileTransporter/filetransporter.pri b/Common/Network/FileTransporter/filetransporter.pri index c3cd23ee2c..448806977e 100644 --- a/Common/Network/FileTransporter/filetransporter.pri +++ b/Common/Network/FileTransporter/filetransporter.pri @@ -1,9 +1,14 @@ HEADERS += \ $$PWD/include/FileTransporter.h \ + $$PWD/include/manager.h \ $$PWD/src/FileTransporter_private.h \ - $$PWD/src/transport_external.h + $$PWD/src/transport_external.h \ + $$PWD/src/Session.h -SOURCES += $$PWD/src/FileTransporter.cpp +SOURCES += \ + $$PWD/src/FileTransporter.cpp \ + $$PWD/src/Session.cpp \ + $$PWD/src/manager.cpp core_windows { SOURCES += $$PWD/src/FileTransporter_win.cpp @@ -31,9 +36,7 @@ core_mac { } core_ios { - OBJECTIVE_SOURCES += \ - $$PWD/src/FileTransporter_mac.mm - + OBJECTIVE_SOURCES += $$PWD/src/FileTransporter_mac.mm LIBS += -framework Foundation } diff --git a/Common/Network/FileTransporter/include/FileTransporter.h b/Common/Network/FileTransporter/include/FileTransporter.h index 42a08b1a02..3e8d266877 100644 --- a/Common/Network/FileTransporter/include/FileTransporter.h +++ b/Common/Network/FileTransporter/include/FileTransporter.h @@ -37,103 +37,121 @@ namespace NSNetwork { - namespace NSFileTransport - { - //typedef void (*CFileTransporter_OnComplete)(int error); - // cancel: 1, else 0 - //typedef int (*CFileTransporter_OnProgress)(int percent); + namespace NSFileTransport + { + class CSession_private; + class KERNEL_DECL CSession + { + public: + CSession(); + ~CSession(); - class KERNEL_DECL IFileTransporter - { - public: - IFileTransporter() {} - virtual ~IFileTransporter() {} + void SetProperty(const std::string& name, const std::string& value); + void Initialize(); - public: - // thread - virtual void Start(int lPriority) = 0; - virtual int GetPriority() = 0; - virtual void Suspend() = 0; - virtual void Resume() = 0; - virtual void Stop() = 0; - virtual void StopNoJoin() = 0; - virtual void Cancel() = 0; - virtual int IsRunned() = 0; + private: + CSession_private* m_pInternal; + }; - //events - virtual void SetEvent_OnProgress(std::function) = 0; - virtual void SetEvent_OnComplete(std::function) = 0; - }; + class KERNEL_DECL IFileTransporter + { + public: + IFileTransporter() {} + virtual ~IFileTransporter() {} + + public: + // manager must release. FileTransporter save link only + virtual void SetSession(CSession* session) = 0; + + public: + // thread + virtual void Start(int lPriority) = 0; + virtual int GetPriority() = 0; + virtual void Suspend() = 0; + virtual void Resume() = 0; + virtual void Stop() = 0; + virtual void StopNoJoin() = 0; + virtual void Cancel() = 0; + virtual int IsRunned() = 0; + + //events + virtual void SetEvent_OnProgress(std::function) = 0; + virtual void SetEvent_OnComplete(std::function) = 0; + }; #ifdef _MAC - KERNEL_DECL void SetARCEnabled(const bool& enabled); - KERNEL_DECL bool GetARCEnabled(); + KERNEL_DECL void SetARCEnabled(const bool& enabled); + KERNEL_DECL bool GetARCEnabled(); #endif - class CFileTransporter_private; + class CFileTransporter_private; - class KERNEL_DECL CFileDownloader: public IFileTransporter - { - public: - CFileDownloader(std::wstring sFileUrl, bool bDelete = true); - virtual ~CFileDownloader(); + class KERNEL_DECL CFileDownloader: public IFileTransporter + { + public: + CFileDownloader(std::wstring sFileUrl, bool bDelete = true); + virtual ~CFileDownloader(); - void SetFilePath(const std::wstring& sFilePath); - std::wstring GetFilePath(); + virtual void SetSession(CSession* session); - bool IsFileDownloaded(); + void SetFilePath(const std::wstring& sFilePath); + std::wstring GetFilePath(); - void SetFileUrl(const std::wstring &sFileUrl, bool bDelete = true); + bool IsFileDownloaded(); - bool DownloadSync(); - void DownloadAsync(); + void SetFileUrl(const std::wstring &sFileUrl, bool bDelete = true); - public: - virtual void Start(int lPriority); - virtual int GetPriority(); - virtual void Suspend(); - virtual void Resume(); - virtual void Stop(); - virtual void StopNoJoin(); - virtual void Cancel(); - virtual int IsRunned(); - virtual void SetEvent_OnProgress(std::function); - virtual void SetEvent_OnComplete(std::function); + bool DownloadSync(); + void DownloadAsync(); - private: - CFileTransporter_private* m_pInternal; - }; + public: + virtual void Start(int lPriority); + virtual int GetPriority(); + virtual void Suspend(); + virtual void Resume(); + virtual void Stop(); + virtual void StopNoJoin(); + virtual void Cancel(); + virtual int IsRunned(); + virtual void SetEvent_OnProgress(std::function); + virtual void SetEvent_OnComplete(std::function); - class KERNEL_DECL CFileUploader: public IFileTransporter - { - public: - CFileUploader(std::wstring sUrl, const unsigned char* cData, const int nSize); - CFileUploader(std::wstring sUrl, std::wstring sFilePath); - virtual ~CFileUploader(); + private: + CFileTransporter_private* m_pInternal; + }; - void SetUrl(const std::wstring& sUrl); - void SetBinaryData(const unsigned char* data, const int size); - void SetFilePath(const std::wstring &sFilePath); + class KERNEL_DECL CFileUploader: public IFileTransporter + { + public: + CFileUploader(std::wstring sUrl, const unsigned char* cData, const int nSize); + CFileUploader(std::wstring sUrl, std::wstring sFilePath); + virtual ~CFileUploader(); - bool UploadSync(); - void UploadAsync(); + virtual void SetSession(CSession* session); - std::wstring GetResponse(); + void SetUrl(const std::wstring& sUrl); + void SetBinaryData(const unsigned char* data, const int size); + void SetFilePath(const std::wstring &sFilePath); - public: - virtual void Start(int lPriority); - virtual int GetPriority(); - virtual void Suspend(); - virtual void Resume(); - virtual void Stop(); - virtual void StopNoJoin(); - virtual void Cancel(); - virtual int IsRunned(); - virtual void SetEvent_OnProgress(std::function); - virtual void SetEvent_OnComplete(std::function); + bool UploadSync(); + void UploadAsync(); - private: - CFileTransporter_private* m_pInternal; - }; - } + std::wstring GetResponse(); + + public: + virtual void Start(int lPriority); + virtual int GetPriority(); + virtual void Suspend(); + virtual void Resume(); + virtual void Stop(); + virtual void StopNoJoin(); + virtual void Cancel(); + virtual int IsRunned(); + virtual void SetEvent_OnProgress(std::function); + virtual void SetEvent_OnComplete(std::function); + + private: + CFileTransporter_private* m_pInternal; + }; + } } diff --git a/Common/Network/FileTransporter/include/manager.h b/Common/Network/FileTransporter/include/manager.h new file mode 100644 index 0000000000..6c8326bd1b --- /dev/null +++ b/Common/Network/FileTransporter/include/manager.h @@ -0,0 +1,86 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +#ifndef APPLICATION_DOWNLOAD_MANAGER_H +#define APPLICATION_DOWNLOAD_MANAGER_H + +#include +#include +#include "./FileTransporter.h" + +namespace ASC +{ + enum DownloadStatus + { + Error = 0, + Success = 1 + }; + + class IDownloadTask + { + public: + IDownloadTask(); + virtual ~IDownloadTask(); + + public: + virtual std::wstring GetPath() = 0; + virtual DownloadStatus GetStatus() = 0; + }; + + class CDownloadManager_private; + class KERNEL_DECL CDownloadManager + { + public: + CDownloadManager(); + ~CDownloadManager(); + + public: + NSNetwork::NSFileTransport::CSession* GetSession(); + void SetMaxConcurrentDownloadCount(const int& count); + + void AddTask(const std::wstring& url, + const std::wstring& directory, + const std::wstring& filename, + void* observer, + std::function handler); + + void OnDestroyObserver(void* observer); + void Clear(); + + static bool DownloadExternal(const std::wstring& url, const std::wstring& path); + + private: + CDownloadManager_private* m_internal; + }; +} + +#endif // APPLICATION_DOWNLOAD_MANAGER_H diff --git a/Common/Network/FileTransporter/src/FileTransporter.cpp b/Common/Network/FileTransporter/src/FileTransporter.cpp index d0775671ce..debfc16b16 100644 --- a/Common/Network/FileTransporter/src/FileTransporter.cpp +++ b/Common/Network/FileTransporter/src/FileTransporter.cpp @@ -33,150 +33,165 @@ #include "./FileTransporter_private.h" #include "../include/FileTransporter.h" +#include "./Session.h" namespace NSNetwork { - namespace NSFileTransport - { + namespace NSFileTransport + { #ifdef _MAC - bool m_bIsARCEnabled = false; - - void SetARCEnabled(const bool& enabled) - { - m_bIsARCEnabled = enabled; - } - bool GetARCEnabled() - { - return m_bIsARCEnabled; - } +#ifdef _IOS + bool m_bIsARCEnabled = true; +#else + bool m_bIsARCEnabled = false; #endif - } + + void SetARCEnabled(const bool& enabled) + { + m_bIsARCEnabled = enabled; + } + bool GetARCEnabled() + { + return m_bIsARCEnabled; + } +#endif + } } namespace NSNetwork { - namespace NSFileTransport - { - // DOWNLOADER - CFileDownloader::CFileDownloader(std::wstring sFileUrl, bool bDelete) - { - m_pInternal = new CFileTransporter_private(sFileUrl, bDelete); - } - CFileDownloader::~CFileDownloader() - { - Stop(); - delete m_pInternal; - } + namespace NSFileTransport + { + // DOWNLOADER + CFileDownloader::CFileDownloader(std::wstring sFileUrl, bool bDelete) + { + m_pInternal = new CFileTransporter_private(sFileUrl, bDelete); + } + CFileDownloader::~CFileDownloader() + { + Stop(); + delete m_pInternal; + } - void CFileDownloader::SetFilePath(const std::wstring &sFilePath) - { - m_pInternal->SetDownloadFilePath(sFilePath); - } - std::wstring CFileDownloader::GetFilePath() - { - return m_pInternal->GetDownloadFilePath(); - } + void CFileDownloader::SetSession(CSession* session) + { + m_pInternal->SetSession(session); + } - bool CFileDownloader::IsFileDownloaded() - { - return m_pInternal->IsFileDownloaded(); - } + void CFileDownloader::SetFilePath(const std::wstring &sFilePath) + { + m_pInternal->SetDownloadFilePath(sFilePath); + } + std::wstring CFileDownloader::GetFilePath() + { + return m_pInternal->GetDownloadFilePath(); + } - void CFileDownloader::SetFileUrl(const std::wstring &sFileUrl, bool bDelete) - { - m_pInternal->SetDownloadFileUrl(sFileUrl, bDelete); - } + bool CFileDownloader::IsFileDownloaded() + { + return m_pInternal->IsFileDownloaded(); + } - bool CFileDownloader::DownloadSync() - { - return m_pInternal->TransferSync(); - } - void CFileDownloader::DownloadAsync() - { - m_pInternal->TransferAsync(); - } + void CFileDownloader::SetFileUrl(const std::wstring &sFileUrl, bool bDelete) + { + m_pInternal->SetDownloadFileUrl(sFileUrl, bDelete); + } - void CFileDownloader::Start(int lPriority) { m_pInternal->Start(lPriority); } - int CFileDownloader::GetPriority() { return m_pInternal->GetPriority(); } - void CFileDownloader::Suspend() { m_pInternal->Suspend(); } - void CFileDownloader::Resume() { m_pInternal->Resume(); } - void CFileDownloader::Stop() { m_pInternal->Stop(); } - void CFileDownloader::StopNoJoin() { m_pInternal->StopNoJoin(); } - void CFileDownloader::Cancel() { m_pInternal->Cancel(); } - int CFileDownloader::IsRunned() { return m_pInternal->IsRunned(); } + bool CFileDownloader::DownloadSync() + { + return m_pInternal->TransferSync(); + } + void CFileDownloader::DownloadAsync() + { + m_pInternal->TransferAsync(); + } - void CFileDownloader::SetEvent_OnProgress(std::function func) - { - m_pInternal->GetInternal()->m_func_onProgress = func; - } - void CFileDownloader::SetEvent_OnComplete(std::function func) - { - m_pInternal->GetInternal()->m_func_onComplete = func; - } - } + void CFileDownloader::Start(int lPriority) { m_pInternal->Start(lPriority); } + int CFileDownloader::GetPriority() { return m_pInternal->GetPriority(); } + void CFileDownloader::Suspend() { m_pInternal->Suspend(); } + void CFileDownloader::Resume() { m_pInternal->Resume(); } + void CFileDownloader::Stop() { m_pInternal->Stop(); } + void CFileDownloader::StopNoJoin() { m_pInternal->StopNoJoin(); } + void CFileDownloader::Cancel() { m_pInternal->Cancel(); } + int CFileDownloader::IsRunned() { return m_pInternal->IsRunned(); } + + void CFileDownloader::SetEvent_OnProgress(std::function func) + { + m_pInternal->GetInternal()->m_func_onProgress = func; + } + void CFileDownloader::SetEvent_OnComplete(std::function func) + { + m_pInternal->GetInternal()->m_func_onComplete = func; + } + } } namespace NSNetwork { - namespace NSFileTransport - { - CFileUploader::CFileUploader(std::wstring sUrl, const unsigned char* cData, const int nSize) - { - m_pInternal = new CFileTransporter_private(sUrl, cData, nSize); - } - CFileUploader::CFileUploader(std::wstring sUrl, std::wstring sFilePath) - { - m_pInternal = new CFileTransporter_private(sUrl, sFilePath); - } - CFileUploader::~CFileUploader() - { - Stop(); - delete m_pInternal; - } + namespace NSFileTransport + { + CFileUploader::CFileUploader(std::wstring sUrl, const unsigned char* cData, const int nSize) + { + m_pInternal = new CFileTransporter_private(sUrl, cData, nSize); + } + CFileUploader::CFileUploader(std::wstring sUrl, std::wstring sFilePath) + { + m_pInternal = new CFileTransporter_private(sUrl, sFilePath); + } + CFileUploader::~CFileUploader() + { + Stop(); + delete m_pInternal; + } - void CFileUploader::SetUrl(const std::wstring& sUrl) - { - m_pInternal->SetUploadUrl(sUrl); - } - void CFileUploader::SetBinaryData(const unsigned char* data, const int size) - { - m_pInternal->SetUploadBinaryDara(data, size); - } - void CFileUploader::SetFilePath(const std::wstring &sFilePath) - { - m_pInternal->SetUploadFilePath(sFilePath); - } + void CFileUploader::SetSession(CSession* session) + { + m_pInternal->SetSession(session); + } - bool CFileUploader::UploadSync() - { - return m_pInternal->TransferSync(); - } - void CFileUploader::UploadAsync() - { - m_pInternal->TransferAsync(); - } + void CFileUploader::SetUrl(const std::wstring& sUrl) + { + m_pInternal->SetUploadUrl(sUrl); + } + void CFileUploader::SetBinaryData(const unsigned char* data, const int size) + { + m_pInternal->SetUploadBinaryDara(data, size); + } + void CFileUploader::SetFilePath(const std::wstring &sFilePath) + { + m_pInternal->SetUploadFilePath(sFilePath); + } - std::wstring CFileUploader::GetResponse() - { - return m_pInternal->GetResponse(); - } + bool CFileUploader::UploadSync() + { + return m_pInternal->TransferSync(); + } + void CFileUploader::UploadAsync() + { + m_pInternal->TransferAsync(); + } - void CFileUploader::Start(int lPriority) { m_pInternal->Start(lPriority); } - int CFileUploader::GetPriority() { return m_pInternal->GetPriority(); } - void CFileUploader::Suspend() { m_pInternal->Suspend(); } - void CFileUploader::Resume() { m_pInternal->Resume(); } - void CFileUploader::Stop() { m_pInternal->Stop(); } - void CFileUploader::StopNoJoin() { m_pInternal->StopNoJoin(); } - void CFileUploader::Cancel() { m_pInternal->Cancel(); } - int CFileUploader::IsRunned() { return m_pInternal->IsRunned(); } + std::wstring CFileUploader::GetResponse() + { + return m_pInternal->GetResponse(); + } - void CFileUploader::SetEvent_OnProgress(std::function func) - { - m_pInternal->GetInternal()->m_func_onProgress = func; - } - void CFileUploader::SetEvent_OnComplete(std::function func) - { - m_pInternal->GetInternal()->m_func_onComplete = func; - } - } + void CFileUploader::Start(int lPriority) { m_pInternal->Start(lPriority); } + int CFileUploader::GetPriority() { return m_pInternal->GetPriority(); } + void CFileUploader::Suspend() { m_pInternal->Suspend(); } + void CFileUploader::Resume() { m_pInternal->Resume(); } + void CFileUploader::Stop() { m_pInternal->Stop(); } + void CFileUploader::StopNoJoin() { m_pInternal->StopNoJoin(); } + void CFileUploader::Cancel() { m_pInternal->Cancel(); } + int CFileUploader::IsRunned() { return m_pInternal->IsRunned(); } + + void CFileUploader::SetEvent_OnProgress(std::function func) + { + m_pInternal->GetInternal()->m_func_onProgress = func; + } + void CFileUploader::SetEvent_OnComplete(std::function func) + { + m_pInternal->GetInternal()->m_func_onComplete = func; + } + } } diff --git a/Common/Network/FileTransporter/src/FileTransporter_curl.cpp b/Common/Network/FileTransporter/src/FileTransporter_curl.cpp index 4c9b327dcf..925201f7cc 100644 --- a/Common/Network/FileTransporter/src/FileTransporter_curl.cpp +++ b/Common/Network/FileTransporter/src/FileTransporter_curl.cpp @@ -51,235 +51,235 @@ namespace NSNetwork { - namespace NSFileTransport - { - class CFileTransporterBaseCURL : public CFileTransporterBase - { - public : - CFileTransporterBaseCURL(const std::wstring &sDownloadFileUrl, bool bDelete = true) - : CFileTransporterBase(sDownloadFileUrl, bDelete) - { - } - CFileTransporterBaseCURL(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) - : CFileTransporterBase(sUploadUrl, cData, nSize) - { - } - CFileTransporterBaseCURL(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) - : CFileTransporterBase(sUploadUrl, sUploadFilePath) - { + namespace NSFileTransport + { + class CFileTransporterBaseCURL : public CFileTransporterBase + { + public : + CFileTransporterBaseCURL(const std::wstring &sDownloadFileUrl, bool bDelete = true) + : CFileTransporterBase(sDownloadFileUrl, bDelete) + { + } + CFileTransporterBaseCURL(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) + : CFileTransporterBase(sUploadUrl, cData, nSize) + { + } + CFileTransporterBaseCURL(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) + : CFileTransporterBase(sUploadUrl, sUploadFilePath) + { - } - virtual ~CFileTransporterBaseCURL() - { - if (m_bDelete && !m_sDownloadFilePath.empty()) - { - std::string sFilePath = U_TO_UTF8(m_sDownloadFilePath); - unlink(sFilePath.c_str()); - } - } + } + virtual ~CFileTransporterBaseCURL() + { + if (m_bDelete && !m_sDownloadFilePath.empty()) + { + std::string sFilePath = U_TO_UTF8(m_sDownloadFilePath); + unlink(sFilePath.c_str()); + } + } - #ifndef USE_EXTERNAL_TRANSPORT - static size_t write_data(void *ptr, size_t size, size_t nmemb, int fd) { - size_t written = write(fd, ptr, size * nmemb); - return written; - } +#ifndef USE_EXTERNAL_TRANSPORT + static size_t write_data(void *ptr, size_t size, size_t nmemb, int fd) { + size_t written = write(fd, ptr, size * nmemb); + return written; + } - /*int progress_func(void* ptr, double TotalToDownload, double NowDownloaded, double TotalToUpload, double NowUploaded) - { - // It's here you will write the code for the progress message or bar - int percent = static_cast((100.0 * NowDownloaded) / TotalToDownload); + /*int progress_func(void* ptr, double TotalToDownload, double NowDownloaded, double TotalToUpload, double NowUploaded) + { + // It's here you will write the code for the progress message or bar + int percent = static_cast((100.0 * NowDownloaded) / TotalToDownload); - if(CFileTransporterBase::m_func_onProgress) - CFileTransporterBase::m_func_onProgress(percent); - return 0; - } - */ + if(CFileTransporterBase::m_func_onProgress) + CFileTransporterBase::m_func_onProgress(percent); + return 0; + } + */ - static size_t write_data_to_string(char *contents, size_t size, size_t nmemb, void *userp) - { - ((std::string*)userp)->append((char*)contents, size * nmemb); - return size * nmemb; - } + static size_t write_data_to_string(char *contents, size_t size, size_t nmemb, void *userp) + { + ((std::string*)userp)->append((char*)contents, size * nmemb); + return size * nmemb; + } - virtual int DownloadFile() override - { - CURL *curl; - int fp; - CURLcode res; - std::string sUrl = U_TO_UTF8(m_sDownloadFileUrl); - std::string sOut; - const char *url = sUrl.c_str(); - curl = curl_easy_init(); - if (curl) - { - fp = createUniqueTempFile(sOut); - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); - //curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE); - // Install the callback function - //curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_func); - #if defined(__linux__) - //в linux нет встроенных в систему корневых сертификатов, поэтому отключаем проверку - //http://curl.haxx.se/docs/sslcerts.html - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - #endif - /* tell libcurl to follow redirection(default false) */ - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - /* some servers don't like requests that are made without a user-agent field, so we provide one */ - curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0"); - res = curl_easy_perform(curl); - /* always cleanup */ - curl_easy_cleanup(curl); - close(fp); - } + virtual int DownloadFile() override + { + CURL *curl; + int fp; + CURLcode res; + std::string sUrl = U_TO_UTF8(m_sDownloadFileUrl); + std::string sOut; + const char *url = sUrl.c_str(); + curl = curl_easy_init(); + if (curl) + { + fp = createUniqueTempFile(sOut); + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); + //curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE); + // Install the callback function + //curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_func); +#if defined(__linux__) + //в linux нет встроенных в систему корневых сертификатов, поэтому отключаем проверку + //http://curl.haxx.se/docs/sslcerts.html + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); +#endif + /* tell libcurl to follow redirection(default false) */ + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + /* some servers don't like requests that are made without a user-agent field, so we provide one */ + curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0"); + res = curl_easy_perform(curl); + /* always cleanup */ + curl_easy_cleanup(curl); + close(fp); + } - m_bComplete = (CURLE_OK == res); - if (m_bComplete) - { - if (m_sDownloadFilePath.empty()) - m_sDownloadFilePath = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sOut.c_str(), sOut.length()); - else - NSFile::CFileBinary::Move(UTF8_TO_U(sOut), m_sDownloadFilePath); - } - //int nRes = execl("/usr/bin/wget", stringWstingToUtf8String (m_sFileUrl).c_str(), "-P", stringWstingToUtf8String (m_sDownloadFilePath).c_str(), (char *)NULL); - //m_bComplete = nRes >= 0; + m_bComplete = (CURLE_OK == res); + if (m_bComplete) + { + if (m_sDownloadFilePath.empty()) + m_sDownloadFilePath = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sOut.c_str(), sOut.length()); + else + NSFile::CFileBinary::Move(UTF8_TO_U(sOut), m_sDownloadFilePath); + } + //int nRes = execl("/usr/bin/wget", stringWstingToUtf8String (m_sFileUrl).c_str(), "-P", stringWstingToUtf8String (m_sDownloadFilePath).c_str(), (char *)NULL); + //m_bComplete = nRes >= 0; - return m_bComplete ? 0 : 1; - } + return m_bComplete ? 0 : 1; + } - virtual int UploadData() override - { - CURL *curl; - CURLcode res; - std::string sUrl = U_TO_UTF8(m_sUploadUrl); - const char *url = sUrl.c_str(); - struct curl_slist *headerlist = NULL; - std::string readBuffer; + virtual int UploadData() override + { + CURL *curl; + CURLcode res; + std::string sUrl = U_TO_UTF8(m_sUploadUrl); + const char *url = sUrl.c_str(); + struct curl_slist *headerlist = NULL; + std::string readBuffer; - /* get a curl handle */ - curl = curl_easy_init(); - if(curl) { + /* get a curl handle */ + curl = curl_easy_init(); + if(curl) { - headerlist = curl_slist_append(headerlist, "Content-Type: application/octet-stream"); + headerlist = curl_slist_append(headerlist, "Content-Type: application/octet-stream"); - curl_easy_setopt(curl, CURLOPT_POST, true); - curl_easy_setopt(curl, CURLOPT_HEADER, true); - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); - /* First set the URL that is about to receive our POST. This URL can - just as well be a https:// URL if that is what should receive the - data. */ - curl_easy_setopt(curl, CURLOPT_URL, url); - /* Now specify the POST data */ - /* size of the POST data */ - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, m_nSize); - /* binary data */ - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, m_cData); + curl_easy_setopt(curl, CURLOPT_POST, true); + curl_easy_setopt(curl, CURLOPT_HEADER, true); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); + /* First set the URL that is about to receive our POST. This URL can + just as well be a https:// URL if that is what should receive the + data. */ + curl_easy_setopt(curl, CURLOPT_URL, url); + /* Now specify the POST data */ + /* size of the POST data */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, m_nSize); + /* binary data */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, m_cData); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data_to_string); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data_to_string); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); - #if defined(__linux__) - //в linux нет встроенных в систему корневых сертификатов, поэтому отключаем проверку - //http://curl.haxx.se/docs/sslcerts.html - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); - #endif +#if defined(__linux__) + //в linux нет встроенных в систему корневых сертификатов, поэтому отключаем проверку + //http://curl.haxx.se/docs/sslcerts.html + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); +#endif - /* Perform the request, res will get the return code */ - res = curl_easy_perform(curl); + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); - long http_code = 0; - curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); + long http_code = 0; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); - if (res == CURLE_OK) - { - if (http_code == 200 || http_code == 1223) - { - size_t startLenghtPos = readBuffer.find("Content-Length:") + sizeof("Content-Length:"); - size_t endLenghtPos = readBuffer.substr(startLenghtPos, readBuffer.length()).find("\r"); - std::string dataSize = readBuffer.substr(startLenghtPos, endLenghtPos); - readBuffer = readBuffer.substr(readBuffer.length() - std::stoi(dataSize)); - NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)readBuffer.c_str(), (LONG)readBuffer.length(), m_sResponse); - } - else - { - res = CURLE_HTTP_RETURNED_ERROR; - } - } + if (res == CURLE_OK) + { + if (http_code == 200 || http_code == 1223) + { + size_t startLenghtPos = readBuffer.find("Content-Length:") + sizeof("Content-Length:"); + size_t endLenghtPos = readBuffer.substr(startLenghtPos, readBuffer.length()).find("\r"); + std::string dataSize = readBuffer.substr(startLenghtPos, endLenghtPos); + readBuffer = readBuffer.substr(readBuffer.length() - std::stoi(dataSize)); + NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)readBuffer.c_str(), (LONG)readBuffer.length(), m_sResponse); + } + else + { + res = CURLE_HTTP_RETURNED_ERROR; + } + } - /* always cleanup */ - curl_easy_cleanup(curl); - } - m_bComplete = (CURLE_OK == res); + /* always cleanup */ + curl_easy_cleanup(curl); + } + m_bComplete = (CURLE_OK == res); - return m_bComplete ? 0 : 1; - } + return m_bComplete ? 0 : 1; + } - virtual int UploadFile() override - { - //stub - return -1; - } + virtual int UploadFile() override + { + //stub + return -1; + } - protected: - int createUniqueTempFile (std::string &filename) - { - std::string sTempPath = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(NSDirectory::GetTempPath()); - sTempPath += "/fileXXXXXX"; - int fd = mkstemp(const_cast (sTempPath.c_str())); - if (-1 != fd) - filename = sTempPath; - return fd; - } - #else - virtual int DownloadFile() override - { - if (m_sDownloadFilePath.empty()) - { - m_sDownloadFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"DW"); - if (NSFile::CFileBinary::Exists(m_sDownloadFilePath)) - NSFile::CFileBinary::Remove(m_sDownloadFilePath); - } - return download_external(m_sDownloadFileUrl, m_sDownloadFilePath, m_func_onProgress, m_check_aborted); - } - virtual int UploadData() override - { - if (!m_sUploadUrl.empty() && m_cData != NULL && m_nSize != 0) - { - return uploaddata_external(m_sUploadUrl, m_cData, m_nSize); - } - return -1; - } - virtual int UploadFile() override - { - if (!m_sUploadUrl.empty() && !m_sUploadFilePath.empty()) - { - return uploadfile_external(m_sUploadUrl, m_sUploadFilePath); - } - return -1; - } + protected: + int createUniqueTempFile (std::string &filename) + { + std::string sTempPath = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(NSDirectory::GetTempPath()); + sTempPath += "/fileXXXXXX"; + int fd = mkstemp(const_cast (sTempPath.c_str())); + if (-1 != fd) + filename = sTempPath; + return fd; + } +#else + virtual int DownloadFile() override + { + if (m_sDownloadFilePath.empty()) + { + m_sDownloadFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"DW"); + if (NSFile::CFileBinary::Exists(m_sDownloadFilePath)) + NSFile::CFileBinary::Remove(m_sDownloadFilePath); + } + return download_external(m_sDownloadFileUrl, m_sDownloadFilePath, m_func_onProgress, m_check_aborted); + } + virtual int UploadData() override + { + if (!m_sUploadUrl.empty() && m_cData != NULL && m_nSize != 0) + { + return uploaddata_external(m_sUploadUrl, m_cData, m_nSize); + } + return -1; + } + virtual int UploadFile() override + { + if (!m_sUploadUrl.empty() && !m_sUploadFilePath.empty()) + { + return uploadfile_external(m_sUploadUrl, m_sUploadFilePath); + } + return -1; + } - #endif - }; +#endif + }; - CFileTransporter_private::CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete) - : m_pInternal(new CFileTransporterBaseCURL(sDownloadFileUrl, bDelete)) + CFileTransporter_private::CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete) + : m_pInternal(new CFileTransporterBaseCURL(sDownloadFileUrl, bDelete)) - { - m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); - } + { + m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); + } - CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) - : m_pInternal(new CFileTransporterBaseCURL(sUploadUrl, cData, nSize)) - { - m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); - } + CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) + : m_pInternal(new CFileTransporterBaseCURL(sUploadUrl, cData, nSize)) + { + m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); + } - CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) - : m_pInternal(new CFileTransporterBaseCURL(sUploadUrl, sUploadFilePath)) - { - m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); - } - } + CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) + : m_pInternal(new CFileTransporterBaseCURL(sUploadUrl, sUploadFilePath)) + { + m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); + } + } } diff --git a/Common/Network/FileTransporter/src/FileTransporter_mac.mm b/Common/Network/FileTransporter/src/FileTransporter_mac.mm index 4bafc55927..98de6a916e 100644 --- a/Common/Network/FileTransporter/src/FileTransporter_mac.mm +++ b/Common/Network/FileTransporter/src/FileTransporter_mac.mm @@ -32,141 +32,228 @@ #include "FileTransporter_private.h" #include "../include/FileTransporter.h" +#include "Session.h" #ifdef USE_EXTERNAL_TRANSPORT #include "transport_external.h" #endif #if _IOS - #import +#import #else - #include +#include #endif namespace NSNetwork { - namespace NSFileTransport - { - static NSString* StringWToNSString ( const std::wstring& Str ) - { - NSString* pString = [ [ NSString alloc ] - initWithBytes : (char*)Str.data() - length : Str.size() * sizeof(wchar_t) - encoding : CFStringConvertEncodingToNSStringEncoding ( kCFStringEncodingUTF32LE ) ]; - return pString; - } - class CFileTransporterBaseCocoa : public CFileTransporterBase - { - public : - CFileTransporterBaseCocoa(const std::wstring &sDownloadFileUrl, bool bDelete = true) - : CFileTransporterBase(sDownloadFileUrl, bDelete) - { - } - CFileTransporterBaseCocoa(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) - : CFileTransporterBase(sUploadUrl, cData, nSize) - { - } - CFileTransporterBaseCocoa(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) - : CFileTransporterBase(sUploadUrl, sUploadFilePath) - { + namespace NSFileTransport + { + class CSessionMAC : public CSession_private + { + public: + NSURLSession* m_session; - } - virtual ~CFileTransporterBaseCocoa() - { - } + public: + CSessionMAC() + { + m_session = nil; + } + ~CSessionMAC() + { + m_session = nil; + } - virtual int DownloadFile() override - { - if (m_sDownloadFilePath.empty()) - { - m_sDownloadFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"DWD"); - if (NSFile::CFileBinary::Exists(m_sDownloadFilePath)) - NSFile::CFileBinary::Remove(m_sDownloadFilePath); - } + void Create() + { + NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; - #ifdef USE_EXTERNAL_TRANSPORT - int nExternalTransport = download_external(m_sDownloadFileUrl, m_sDownloadFilePath); - if (0 == nExternalTransport) - return 0; - #endif + std::map::iterator iter; - NSString* stringURL = StringWToNSString(m_sDownloadFileUrl); - NSString *escapedURL = [stringURL stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; - NSURL *url = [NSURL URLWithString:escapedURL]; - NSData *urlData = [NSData dataWithContentsOfURL:url]; - if ( urlData ) - { - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = [paths objectAtIndex:0]; + iter = m_props.find("timeoutIntervalForResource"); + if (iter != m_props.end()) + configuration.timeoutIntervalForResource = std::stoi(iter->second); - NSString *filePath = StringWToNSString ( m_sDownloadFilePath ); - [urlData writeToFile:filePath atomically:YES]; + iter = m_props.find("HTTPMaximumConnectionsPerHost"); + if (iter != m_props.end()) + configuration.HTTPMaximumConnectionsPerHost = std::stoi(iter->second); - #if defined(_IOS) - return 0; - #else - #ifndef _ASC_USE_ARC_ - if (!GetARCEnabled()) - { - [stringURL release]; - //[url release]; - [urlData release]; - } - #endif - #endif - return 0; - } + iter = m_props.find("allowsCellularAccess"); + if (iter != m_props.end()) + configuration.allowsCellularAccess = (std::stoi(iter->second) == 1) ? YES : NO; - #if defined(_IOS) - return 1; - #else - #ifndef _ASC_USE_ARC_ - if (!GetARCEnabled()) - { - [stringURL release]; - //[url release]; - } - #endif - #endif - return 1; - } + iter = m_props.find("allowsCellularAccess"); + if (iter != m_props.end()) + { + if ("NSURLRequestUseProtocolCachePolicy" == iter->second) + configuration.requestCachePolicy = NSURLRequestUseProtocolCachePolicy; + } - virtual int UploadData() override - { - #ifdef USE_EXTERNAL_TRANSPORT - int nExternalTransport = uploaddata_external(m_sUploadUrl, m_cData, m_nSize); - if (0 == nExternalTransport) - return 0; - #endif - //stub - return -1; - } + m_session = [NSURLSession sessionWithConfiguration:configuration]; + } + }; - virtual int UploadFile() override - { - #ifdef USE_EXTERNAL_TRANSPORT - int nExternalTransport = uploadfile_external(m_sUploadUrl, m_sUploadFilePath); - if (0 == nExternalTransport) - return 0; - #endif - //stub - return -1; - } - }; - - CFileTransporter_private::CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete) - { - m_pInternal = new CFileTransporterBaseCocoa(sDownloadFileUrl, bDelete); - } - - CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) - { - m_pInternal = new CFileTransporterBaseCocoa(sUploadUrl, cData, nSize); - } - - CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) - { - m_pInternal = new CFileTransporterBaseCocoa(sUploadUrl, sUploadFilePath); - } - } + CSession_private* CreateSession() + { + return new CSessionMAC(); + } + } +} + +namespace NSNetwork +{ + namespace NSFileTransport + { + static NSString* StringWToNSString ( const std::wstring& Str ) + { + NSString* pString = [ [ NSString alloc ] + initWithBytes : (char*)Str.data() length : Str.size() * sizeof(wchar_t) + encoding : CFStringConvertEncodingToNSStringEncoding ( kCFStringEncodingUTF32LE ) ]; + return pString; + } + class CFileTransporterBaseCocoa : public CFileTransporterBase + { + public : + CFileTransporterBaseCocoa(const std::wstring &sDownloadFileUrl, bool bDelete = true) + : CFileTransporterBase(sDownloadFileUrl, bDelete) + { + } + CFileTransporterBaseCocoa(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) + : CFileTransporterBase(sUploadUrl, cData, nSize) + { + } + CFileTransporterBaseCocoa(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) + : CFileTransporterBase(sUploadUrl, sUploadFilePath) + { + + } + virtual ~CFileTransporterBaseCocoa() + { + } + + virtual int DownloadFile() override + { + if (m_sDownloadFilePath.empty()) + { + m_sDownloadFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"DWD"); + if (NSFile::CFileBinary::Exists(m_sDownloadFilePath)) + NSFile::CFileBinary::Remove(m_sDownloadFilePath); + } + +#ifdef USE_EXTERNAL_TRANSPORT + int nExternalTransport = download_external(m_sDownloadFileUrl, m_sDownloadFilePath); + if (0 == nExternalTransport) + return 0; +#endif + + NSString* stringURL = StringWToNSString(m_sDownloadFileUrl); + NSString* escapedURL = [stringURL stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + + int nResult = 1; + + if (m_pSession) + { + NSURLRequest* urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:escapedURL]]; + + __block NSData* result = nil; + dispatch_semaphore_t sem = dispatch_semaphore_create(0); + + [[((CSessionMAC*)m_pSession)->m_session dataTaskWithRequest:urlRequest + completionHandler:^(NSData *data, NSURLResponse* response, NSError *error) { + if (error == nil) + result = data; + + dispatch_semaphore_signal(sem); + }] resume]; + + dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); + + if (result) + { + NSString* filePath = StringWToNSString(m_sDownloadFilePath); + [result writeToFile:filePath atomically:YES]; + + nResult = 0; + } + + nResult = 1; + + return nResult; + } + else + { + NSURL* url = [NSURL URLWithString:escapedURL]; + NSData* urlData = [NSData dataWithContentsOfURL:url]; + if ( urlData ) + { + NSString* filePath = StringWToNSString(m_sDownloadFilePath); + [urlData writeToFile:filePath atomically:YES]; + + #if defined(_IOS) + return 0; + #else + #ifndef _ASC_USE_ARC_ + if (!GetARCEnabled()) + { + [stringURL release]; + //[url release]; + [urlData release]; + } + #endif + #endif + return 0; + } + + #if defined(_IOS) + return 1; + #else + #ifndef _ASC_USE_ARC_ + if (!GetARCEnabled()) + { + [stringURL release]; + //[url release]; + } + #endif + #endif + return 1; + } + } + + virtual int UploadData() override + { +#ifdef USE_EXTERNAL_TRANSPORT + int nExternalTransport = uploaddata_external(m_sUploadUrl, m_cData, m_nSize); + if (0 == nExternalTransport) + return 0; +#endif + //stub + return -1; + } + + virtual int UploadFile() override + { +#ifdef USE_EXTERNAL_TRANSPORT + int nExternalTransport = uploadfile_external(m_sUploadUrl, m_sUploadFilePath); + if (0 == nExternalTransport) + return 0; +#endif + //stub + return -1; + } + }; + + CFileTransporter_private::CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete) + { + m_pInternal = new CFileTransporterBaseCocoa(sDownloadFileUrl, bDelete); + } + + CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) + { + m_pInternal = new CFileTransporterBaseCocoa(sUploadUrl, cData, nSize); + } + + CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) + { + m_pInternal = new CFileTransporterBaseCocoa(sUploadUrl, sUploadFilePath); + } + } } diff --git a/Common/Network/FileTransporter/src/FileTransporter_private.h b/Common/Network/FileTransporter/src/FileTransporter_private.h index df0489aa73..1cfc2f7b67 100644 --- a/Common/Network/FileTransporter/src/FileTransporter_private.h +++ b/Common/Network/FileTransporter/src/FileTransporter_private.h @@ -37,218 +37,231 @@ namespace NSNetwork { - namespace NSFileTransport - { - class CFileTransporterBase - { - public : - CFileTransporterBase(const std::wstring &sDownloadFileUrl, bool bDelete) - { - m_sDownloadFilePath = L""; - m_sDownloadFileUrl = sDownloadFileUrl; - m_sUploadFilePath = L""; - m_sUploadUrl = L""; + namespace NSFileTransport + { + class CFileTransporterBase + { + public : + CFileTransporterBase(const std::wstring &sDownloadFileUrl, bool bDelete) + { + m_sDownloadFilePath = L""; + m_sDownloadFileUrl = sDownloadFileUrl; + m_sUploadFilePath = L""; + m_sUploadUrl = L""; - m_bComplete = false; - m_bDelete = bDelete; - m_eLoadType = DOWNLOADFILE; + m_bComplete = false; + m_bDelete = bDelete; + m_eLoadType = DOWNLOADFILE; - m_cData = NULL; - m_nSize = 0; + m_cData = NULL; + m_nSize = 0; -// m_bIsExit = nullptr; - } + m_pSession = NULL; - CFileTransporterBase(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) - { - m_sDownloadFilePath = L""; - m_sDownloadFileUrl = L""; - m_sUploadFilePath = L""; - m_sUploadUrl = sUploadUrl; + // m_bIsExit = nullptr; + } - m_bComplete = false; - m_bDelete = true; - m_eLoadType = UPLOADDATA; + CFileTransporterBase(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) + { + m_sDownloadFilePath = L""; + m_sDownloadFileUrl = L""; + m_sUploadFilePath = L""; + m_sUploadUrl = sUploadUrl; - m_cData = cData; - m_nSize = nSize; + m_bComplete = false; + m_bDelete = true; + m_eLoadType = UPLOADDATA; -// m_bIsExit = nullptr; - } + m_cData = cData; + m_nSize = nSize; - CFileTransporterBase(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) - { - m_sDownloadFilePath = L""; - m_sDownloadFileUrl = L""; - m_sUploadFilePath = sUploadFilePath; - m_sUploadUrl = sUploadUrl; + m_pSession = NULL; - m_bComplete = false; - m_bDelete = true; - m_eLoadType = UPLOADFILE; + // m_bIsExit = nullptr; + } - m_cData = NULL; - m_nSize = 0; + CFileTransporterBase(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) + { + m_sDownloadFilePath = L""; + m_sDownloadFileUrl = L""; + m_sUploadFilePath = sUploadFilePath; + m_sUploadUrl = sUploadUrl; -// m_bIsExit = nullptr; - } + m_bComplete = false; + m_bDelete = true; + m_eLoadType = UPLOADFILE; - virtual ~CFileTransporterBase () - { - if ( m_sDownloadFilePath.length() > 0 && m_bDelete ) - { - NSFile::CFileBinary::Remove(m_sDownloadFilePath); - m_sDownloadFilePath = L""; - } -// m_bIsExit = nullptr; - } + m_cData = NULL; + m_nSize = 0; - virtual int DownloadFile() = 0; - virtual int UploadFile() = 0; - virtual int UploadData() = 0; + m_pSession = NULL; - public: - std::wstring m_sDownloadFilePath; // Путь к сохраненному файлу на диске - std::wstring m_sDownloadFileUrl;// Ссылка на скачивание файла - std::wstring m_sUploadFilePath; // Путь к файлу для выгрузки на сервер - std::wstring m_sUploadUrl; // URL для выгрузки данных + // m_bIsExit = nullptr; + } - bool m_bComplete; // Закачался файл или нет - bool m_bDelete; // Удалять ли файл в деструкторе + virtual ~CFileTransporterBase () + { + if ( m_sDownloadFilePath.length() > 0 && m_bDelete ) + { + NSFile::CFileBinary::Remove(m_sDownloadFilePath); + m_sDownloadFilePath = L""; + } + // m_bIsExit = nullptr; + } - typedef enum LoadType - { - DOWNLOADFILE, - UPLOADFILE, - UPLOADDATA - } LoadType; + virtual int DownloadFile() = 0; + virtual int UploadFile() = 0; + virtual int UploadData() = 0; - LoadType m_eLoadType; // Тип загрузки/выгрузки данных/файла + public: + std::wstring m_sDownloadFilePath; // Путь к сохраненному файлу на диске + std::wstring m_sDownloadFileUrl;// Ссылка на скачивание файла + std::wstring m_sUploadFilePath; // Путь к файлу для выгрузки на сервер + std::wstring m_sUploadUrl; // URL для выгрузки данных - const unsigned char* m_cData; // Данные в сыром виде для выгрузки - int m_nSize; // Размер данных + bool m_bComplete; // Закачался файл или нет + bool m_bDelete; // Удалять ли файл в деструкторе - std::wstring m_sResponse = L""; // Ответ сервера + typedef enum LoadType + { + DOWNLOADFILE, + UPLOADFILE, + UPLOADDATA + } LoadType; - std::function m_func_onComplete = nullptr; - std::function m_func_onProgress = nullptr; - std::function m_check_aborted = nullptr; + LoadType m_eLoadType; // Тип загрузки/выгрузки данных/файла -// std::atomic* m_bIsExit; // Для остановки и выхода потока - }; + const unsigned char* m_cData; // Данные в сыром виде для выгрузки + int m_nSize; // Размер данных - class CFileTransporter_private : public NSThreads::CBaseThread - { - protected: - // создаем в зависимости от платформы - CFileTransporterBase* m_pInternal; + std::wstring m_sResponse = L""; // Ответ сервера - public: - CFileTransporterBase* GetInternal() - { - return m_pInternal; - } + std::function m_func_onComplete = nullptr; + std::function m_func_onProgress = nullptr; + std::function m_check_aborted = nullptr; - public: - CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete = true); - CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize); - CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath); + CSession* m_pSession; - virtual ~CFileTransporter_private() - { - Stop(); - if (NULL != m_pInternal) - delete m_pInternal; - } + // std::atomic* m_bIsExit; // Для остановки и выхода потока + }; - void SetDownloadFileUrl(const std::wstring &sDownloadFileUrl, bool bDelete = true) - { - m_pInternal->m_sDownloadFileUrl = sDownloadFileUrl; - m_pInternal->m_bDelete = bDelete; - m_pInternal->m_eLoadType = m_pInternal->DOWNLOADFILE; - } + class CFileTransporter_private : public NSThreads::CBaseThread + { + protected: + // создаем в зависимости от платформы + CFileTransporterBase* m_pInternal; - void SetDownloadFilePath(const std::wstring& sDownloadFilePat) - { - m_pInternal->m_sDownloadFilePath = sDownloadFilePat; - } + public: + CFileTransporterBase* GetInternal() + { + return m_pInternal; + } - std::wstring GetDownloadFilePath() - { - return m_pInternal->m_sDownloadFilePath; - } + public: + CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete = true); + CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize); + CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath); - bool IsFileDownloaded() - { - return m_pInternal->m_bComplete; - } + virtual ~CFileTransporter_private() + { + Stop(); + if (NULL != m_pInternal) + delete m_pInternal; + } - void SetUploadUrl(const std::wstring &sUploadUrl) - { - m_pInternal->m_sUploadUrl = sUploadUrl; - } + void SetDownloadFileUrl(const std::wstring &sDownloadFileUrl, bool bDelete = true) + { + m_pInternal->m_sDownloadFileUrl = sDownloadFileUrl; + m_pInternal->m_bDelete = bDelete; + m_pInternal->m_eLoadType = m_pInternal->DOWNLOADFILE; + } - void SetUploadBinaryDara(const unsigned char* cData, const int nSize) - { - m_pInternal->m_cData = cData; - m_pInternal->m_nSize = nSize; - m_pInternal->m_eLoadType = m_pInternal->UPLOADDATA; - } + void SetDownloadFilePath(const std::wstring& sDownloadFilePat) + { + m_pInternal->m_sDownloadFilePath = sDownloadFilePat; + } - void SetUploadFilePath(const std::wstring &sUploadFilePath) - { - m_pInternal->m_sUploadFilePath = sUploadFilePath; - m_pInternal->m_eLoadType = m_pInternal->UPLOADFILE; - } + std::wstring GetDownloadFilePath() + { + return m_pInternal->m_sDownloadFilePath; + } - std::wstring& GetResponse() - { - return m_pInternal->m_sResponse; - } + bool IsFileDownloaded() + { + return m_pInternal->m_bComplete; + } - bool TransferSync() - { - this->Start( 1 ); - while ( this->IsRunned() ) - { - NSThreads::Sleep( 10 ); - } - return IsFileDownloaded(); - } + void SetUploadUrl(const std::wstring &sUploadUrl) + { + m_pInternal->m_sUploadUrl = sUploadUrl; + } - void TransferAsync() - { - this->Start( 1 ); - } + void SetUploadBinaryDara(const unsigned char* cData, const int nSize) + { + m_pInternal->m_cData = cData; + m_pInternal->m_nSize = nSize; + m_pInternal->m_eLoadType = m_pInternal->UPLOADDATA; + } - protected : + void SetUploadFilePath(const std::wstring &sUploadFilePath) + { + m_pInternal->m_sUploadFilePath = sUploadFilePath; + m_pInternal->m_eLoadType = m_pInternal->UPLOADFILE; + } - virtual DWORD ThreadProc () - { - m_pInternal->m_bComplete = false; + std::wstring& GetResponse() + { + return m_pInternal->m_sResponse; + } - int hrResultAll = 0; - if(m_pInternal->m_eLoadType == m_pInternal->DOWNLOADFILE) - hrResultAll = m_pInternal->DownloadFile(); - else if(m_pInternal->m_eLoadType == m_pInternal->UPLOADFILE) - hrResultAll = m_pInternal->UploadFile(); - else if(m_pInternal->m_eLoadType == m_pInternal->UPLOADDATA) - hrResultAll = m_pInternal->UploadData(); + bool TransferSync() + { + this->Start( 1 ); + while ( this->IsRunned() ) + { + NSThreads::Sleep( 10 ); + } + return IsFileDownloaded(); + } - if (0 == hrResultAll) - m_pInternal->m_bComplete = true; - else - { - if (NSFile::CFileBinary::Exists(m_pInternal->m_sDownloadFilePath)) - NSFile::CFileBinary::Remove(m_pInternal->m_sDownloadFilePath); - } + void TransferAsync() + { + this->Start( 1 ); + } - if (m_pInternal->m_func_onComplete) - m_pInternal->m_func_onComplete(hrResultAll); + void SetSession(CSession* session) + { + m_pInternal->m_pSession = session; + } - m_bRunThread = FALSE; - return 0; - } - }; - } + protected : + + virtual DWORD ThreadProc () + { + m_pInternal->m_bComplete = false; + + int hrResultAll = 0; + if(m_pInternal->m_eLoadType == m_pInternal->DOWNLOADFILE) + hrResultAll = m_pInternal->DownloadFile(); + else if(m_pInternal->m_eLoadType == m_pInternal->UPLOADFILE) + hrResultAll = m_pInternal->UploadFile(); + else if(m_pInternal->m_eLoadType == m_pInternal->UPLOADDATA) + hrResultAll = m_pInternal->UploadData(); + + if (0 == hrResultAll) + m_pInternal->m_bComplete = true; + else + { + if (NSFile::CFileBinary::Exists(m_pInternal->m_sDownloadFilePath)) + NSFile::CFileBinary::Remove(m_pInternal->m_sDownloadFilePath); + } + + if (m_pInternal->m_func_onComplete) + m_pInternal->m_func_onComplete(hrResultAll); + + m_bRunThread = FALSE; + return 0; + } + }; + } } diff --git a/Common/Network/FileTransporter/src/FileTransporter_win.cpp b/Common/Network/FileTransporter/src/FileTransporter_win.cpp index 8e51da3c95..968cbb0dcf 100644 --- a/Common/Network/FileTransporter/src/FileTransporter_win.cpp +++ b/Common/Network/FileTransporter/src/FileTransporter_win.cpp @@ -56,459 +56,459 @@ namespace NSNetwork { - namespace NSFileTransport - { - class CFileTransporterBaseWin : public CFileTransporterBase - { - public : - CFileTransporterBaseWin(const std::wstring &sDownloadFileUrl, bool bDelete = true) : - CFileTransporterBase(sDownloadFileUrl, bDelete) - { - } + namespace NSFileTransport + { + class CFileTransporterBaseWin : public CFileTransporterBase + { + public : + CFileTransporterBaseWin(const std::wstring &sDownloadFileUrl, bool bDelete = true) : + CFileTransporterBase(sDownloadFileUrl, bDelete) + { + } - CFileTransporterBaseWin(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) : - CFileTransporterBase(sUploadUrl, cData, nSize) - { - } + CFileTransporterBaseWin(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) : + CFileTransporterBase(sUploadUrl, cData, nSize) + { + } - CFileTransporterBaseWin(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) : - CFileTransporterBase(sUploadUrl, sUploadFilePath) - { - } + CFileTransporterBaseWin(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) : + CFileTransporterBase(sUploadUrl, sUploadFilePath) + { + } - virtual ~CFileTransporterBaseWin() - { - if ( m_pFile ) - { - ::fclose( m_pFile ); - m_pFile = NULL; - } - } + virtual ~CFileTransporterBaseWin() + { + if ( m_pFile ) + { + ::fclose( m_pFile ); + m_pFile = NULL; + } + } - virtual int DownloadFile() override - { - CoInitialize ( NULL ); - if ( /*S_OK != _DownloadFile ( m_sFileUrl )*/TRUE ) - { - if (m_sDownloadFilePath.empty()) - { - m_sDownloadFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"DWD"); - if (NSFile::CFileBinary::Exists(m_sDownloadFilePath)) - NSFile::CFileBinary::Remove(m_sDownloadFilePath); - } + virtual int DownloadFile() override + { + CoInitialize ( NULL ); + if ( /*S_OK != _DownloadFile ( m_sFileUrl )*/TRUE ) + { + if (m_sDownloadFilePath.empty()) + { + m_sDownloadFilePath = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSFile::CFileBinary::GetTempPath(), L"DWD"); + if (NSFile::CFileBinary::Exists(m_sDownloadFilePath)) + NSFile::CFileBinary::Remove(m_sDownloadFilePath); + } - HRESULT hrResultAll = DownloadFileAll(m_sDownloadFileUrl, m_sDownloadFilePath); + HRESULT hrResultAll = DownloadFileAll(m_sDownloadFileUrl, m_sDownloadFilePath); - if(E_ABORT == hrResultAll /*&& m_bIsExit->load()*/) - { - //DeleteUrlCacheEntry(m_sDownloadFileUrl.c_str()); - CoUninitialize (); - return hrResultAll; - } - if (S_OK != hrResultAll) - { - hrResultAll = (true == DownloadFilePS(m_sDownloadFileUrl, m_sDownloadFilePath)) ? S_OK : S_FALSE; - CoUninitialize (); - return hrResultAll; - } - } + if(E_ABORT == hrResultAll /*&& m_bIsExit->load()*/) + { + //DeleteUrlCacheEntry(m_sDownloadFileUrl.c_str()); + CoUninitialize (); + return hrResultAll; + } + if (S_OK != hrResultAll) + { + hrResultAll = (true == DownloadFilePS(m_sDownloadFileUrl, m_sDownloadFilePath)) ? S_OK : S_FALSE; + CoUninitialize (); + return hrResultAll; + } + } - CoUninitialize (); - m_bComplete = true; - return S_OK; - } + CoUninitialize (); + m_bComplete = true; + return S_OK; + } - virtual int UploadData() override - { - //stub - return S_OK; - } + virtual int UploadData() override + { + //stub + return S_OK; + } - virtual int UploadFile() override - { - //stub - return S_OK; - } + virtual int UploadFile() override + { + //stub + return S_OK; + } - protected: - FILE * m_pFile = nullptr; // Хэндл на временный файл - unsigned int _DownloadFile(std::wstring sFileUrl) - { - // Проверяем состояние соединения - if ( FALSE == InternetGetConnectedState ( 0, 0 ) ) - return S_FALSE; + protected: + FILE * m_pFile = nullptr; // Хэндл на временный файл + unsigned int _DownloadFile(std::wstring sFileUrl) + { + // Проверяем состояние соединения + if ( FALSE == InternetGetConnectedState ( 0, 0 ) ) + return S_FALSE; - wchar_t sTempPath[MAX_PATH], sTempFile[MAX_PATH]; - if ( 0 == GetTempPathW( MAX_PATH, sTempPath ) ) - return S_FALSE; + wchar_t sTempPath[MAX_PATH], sTempFile[MAX_PATH]; + if ( 0 == GetTempPathW( MAX_PATH, sTempPath ) ) + return S_FALSE; - if ( 0 == GetTempFileNameW( sTempPath, L"CSS", 0, sTempFile ) ) - return S_FALSE; + if ( 0 == GetTempFileNameW( sTempPath, L"CSS", 0, sTempFile ) ) + return S_FALSE; - m_pFile = ::_wfopen( sTempFile, L"wb" ); - if ( !m_pFile ) - return S_FALSE; + m_pFile = ::_wfopen( sTempFile, L"wb" ); + if ( !m_pFile ) + return S_FALSE; - m_sDownloadFilePath = std::wstring( sTempFile ); + m_sDownloadFilePath = std::wstring( sTempFile ); - // Открываем сессию - 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; + // Открываем сессию + 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 = InternetOpenUrlW ( hInternetSession, sFileUrl.c_str(), sHTTPHdr.c_str(), -1, INTERNET_FLAG_RESYNCHRONIZE, 0 ); - if ( NULL != hInternetOpenURL ) - { - // Открытие произошло, проверяем ответ - if ( TRUE == QueryStatusCode ( hInternetOpenURL, TRUE ) ) - { - // Запрос прошел удачно, проверяем возможность чтения частями и получаем размер данных - LONGLONG nFileSize = IsAccept_Ranges ( hInternetOpenURL ); - // Закрываем хендл - InternetCloseHandle ( hInternetOpenURL ); - if ( -1 == nFileSize ) - { - // Чтение частями недоступно - // Закрываем хендл соединения - InternetCloseHandle ( hInternetSession ); - // Закрываем файл (сделается на DownloadAll) - // Попробуем записать его целиком - return S_FALSE; - } - else - { - // Чтение частями доступно - LONGLONG nStartByte = 0; - while ( true ) - { - // Если закачали весь файл - то выходим - if ( nStartByte == nFileSize - 1 ) - { - // Закрываем хендл соединения - InternetCloseHandle ( hInternetSession ); - return S_OK; - } - LONGLONG nEndByte = nStartByte + DOWNLOAD_FILE_SIZE; - // Если файл заканчивается, то загружаем меньшее колличество байт ( на 1 меньше, чем размер, т.к. начинается с 0 ) - if ( nEndByte >= nFileSize ) - nEndByte = nFileSize - 1; + // Заголовок запроса ( пока содержит 0 байт ( необходимо для проверки ) ) + std::wstring sHTTPHdr = L"Range: bytes=0-0"; + // Открываем ссылку для проверки на ее существование, а также на возможность чтения частями + HINTERNET hInternetOpenURL = InternetOpenUrlW ( hInternetSession, sFileUrl.c_str(), sHTTPHdr.c_str(), -1, INTERNET_FLAG_RESYNCHRONIZE, 0 ); + if ( NULL != hInternetOpenURL ) + { + // Открытие произошло, проверяем ответ + if ( TRUE == QueryStatusCode ( hInternetOpenURL, TRUE ) ) + { + // Запрос прошел удачно, проверяем возможность чтения частями и получаем размер данных + LONGLONG nFileSize = IsAccept_Ranges ( hInternetOpenURL ); + // Закрываем хендл + InternetCloseHandle ( hInternetOpenURL ); + if ( -1 == nFileSize ) + { + // Чтение частями недоступно + // Закрываем хендл соединения + InternetCloseHandle ( hInternetSession ); + // Закрываем файл (сделается на DownloadAll) + // Попробуем записать его целиком + return S_FALSE; + } + else + { + // Чтение частями доступно + LONGLONG nStartByte = 0; + while ( true ) + { + // Если закачали весь файл - то выходим + if ( nStartByte == nFileSize - 1 ) + { + // Закрываем хендл соединения + InternetCloseHandle ( hInternetSession ); + return S_OK; + } + LONGLONG nEndByte = nStartByte + DOWNLOAD_FILE_SIZE; + // Если файл заканчивается, то загружаем меньшее колличество байт ( на 1 меньше, чем размер, т.к. начинается с 0 ) + if ( nEndByte >= nFileSize ) + nEndByte = nFileSize - 1; - // Буффер для закачки - BYTE arrBuffer [ DOWNLOAD_FILE_SIZE ] = { 0 }; - DWORD dwBytesDownload = DownloadFilePath ( hInternetSession, arrBuffer, nStartByte, nEndByte, sFileUrl ); + // Буффер для закачки + BYTE arrBuffer [ DOWNLOAD_FILE_SIZE ] = { 0 }; + DWORD dwBytesDownload = DownloadFilePath ( hInternetSession, arrBuffer, nStartByte, nEndByte, sFileUrl ); - nStartByte = nEndByte; - if ( -1 == dwBytesDownload ) - { - // Ничего не прочиталось - это плохо!!!! - // Закрываем хендл соединения - InternetCloseHandle ( hInternetSession ); - // Закрываем файл (сделается на DownloadAll) - // Попробуем записать его целиком - return S_FALSE; - } + nStartByte = nEndByte; + if ( -1 == dwBytesDownload ) + { + // Ничего не прочиталось - это плохо!!!! + // Закрываем хендл соединения + InternetCloseHandle ( hInternetSession ); + // Закрываем файл (сделается на DownloadAll) + // Попробуем записать его целиком + return S_FALSE; + } - // Пишем в файл - ::fwrite( (BYTE*)arrBuffer, 1, dwBytesDownload, m_pFile ); - ::fflush( m_pFile ); + // Пишем в файл + ::fwrite( (BYTE*)arrBuffer, 1, dwBytesDownload, m_pFile ); + ::fflush( m_pFile ); - NSThreads::Sleep(10); - } - } - } - else - { - // Закрываем хендл соединения - InternetCloseHandle ( hInternetSession ); - // Закрываем файл (сделается на DownloadAll) - // Попробуем записать его целиком - return S_FALSE; - } - } - else - { - // Закрываем хендл соединения - InternetCloseHandle ( hInternetSession ); - // Закрываем файл (сделается на DownloadAll) - // Попробуем записать его целиком - return S_FALSE; - } + NSThreads::Sleep(10); + } + } + } + else + { + // Закрываем хендл соединения + InternetCloseHandle ( hInternetSession ); + // Закрываем файл (сделается на DownloadAll) + // Попробуем записать его целиком + return S_FALSE; + } + } + else + { + // Закрываем хендл соединения + InternetCloseHandle ( hInternetSession ); + // Закрываем файл (сделается на DownloadAll) + // Попробуем записать его целиком + return S_FALSE; + } - // Закрываем хендл соединения - InternetCloseHandle ( hInternetSession ); + // Закрываем хендл соединения + InternetCloseHandle ( hInternetSession ); - return S_OK; - } - DWORD DownloadFilePath ( HINTERNET hInternet, LPBYTE pBuffer, LONGLONG nStartByte, LONGLONG nEndByte, std::wstring sFileURL ) - { - // Неоткрытая сессия - if ( NULL == hInternet ) - return -1; + return S_OK; + } + DWORD DownloadFilePath ( HINTERNET hInternet, LPBYTE pBuffer, LONGLONG nStartByte, LONGLONG nEndByte, std::wstring sFileURL ) + { + // Неоткрытая сессия + if ( NULL == hInternet ) + return -1; - // Пришли непонятные параметры - if ( nStartByte > nEndByte || !pBuffer ) - return -1; + // Пришли непонятные параметры + if ( nStartByte > nEndByte || !pBuffer ) + return -1; - // Заголовок запроса ( содержит nEndByte - nStartByte байт ) - std::wstring sHTTPHdr = L"Range: bytes=" + std::to_wstring(nStartByte) + L"-" + std::to_wstring(nEndByte); - // Открываем ссылку для закачки - HINTERNET hInternetOpenURL = InternetOpenUrlW ( hInternet, sFileURL.c_str(), sHTTPHdr.c_str(), -1, INTERNET_FLAG_RESYNCHRONIZE, 0 ); - if ( NULL == hInternetOpenURL ) - return -1; - // Открытие произошло, проверяем ответ - if ( FALSE == QueryStatusCode ( hInternetOpenURL, TRUE ) ) - { - // Закрываем хендл соединения - InternetCloseHandle ( hInternetOpenURL ); - return -1; - } + // Заголовок запроса ( содержит nEndByte - nStartByte байт ) + std::wstring sHTTPHdr = L"Range: bytes=" + std::to_wstring(nStartByte) + L"-" + std::to_wstring(nEndByte); + // Открываем ссылку для закачки + HINTERNET hInternetOpenURL = InternetOpenUrlW ( hInternet, sFileURL.c_str(), sHTTPHdr.c_str(), -1, INTERNET_FLAG_RESYNCHRONIZE, 0 ); + if ( NULL == hInternetOpenURL ) + return -1; + // Открытие произошло, проверяем ответ + if ( FALSE == QueryStatusCode ( hInternetOpenURL, TRUE ) ) + { + // Закрываем хендл соединения + InternetCloseHandle ( hInternetOpenURL ); + return -1; + } - // Какое колличество байт прочитано - DWORD dwBytesRead = 0; - // Читаем файл - if ( FALSE == InternetReadFile ( hInternetOpenURL, pBuffer, DOWNLOAD_FILE_SIZE, &dwBytesRead ) ) - { - // Закрываем хендл соединения - InternetCloseHandle ( hInternetOpenURL ); - return -1; - } + // Какое колличество байт прочитано + DWORD dwBytesRead = 0; + // Читаем файл + if ( FALSE == InternetReadFile ( hInternetOpenURL, pBuffer, DOWNLOAD_FILE_SIZE, &dwBytesRead ) ) + { + // Закрываем хендл соединения + InternetCloseHandle ( hInternetOpenURL ); + return -1; + } - // Закрываем хендл соединения - InternetCloseHandle ( hInternetOpenURL ); + // Закрываем хендл соединения + InternetCloseHandle ( hInternetOpenURL ); - return dwBytesRead; - } + return dwBytesRead; + } - BOOL QueryStatusCode ( HINTERNET hInternet, BOOL bIsRanges ) - { - // Зачем проверять у неоткрытой сессии что-то - if ( NULL == hInternet ) - return FALSE; + BOOL QueryStatusCode ( HINTERNET hInternet, BOOL bIsRanges ) + { + // Зачем проверять у неоткрытой сессии что-то + if ( NULL == hInternet ) + return FALSE; - // Результат ответа - INT nResult = 0; - // Размер данных ответа ( должно быть = 4 ) - DWORD dwLengthDataSize = 4; + // Результат ответа + INT nResult = 0; + // Размер данных ответа ( должно быть = 4 ) + DWORD dwLengthDataSize = 4; - // Делаем запрос, если не проходит - то возвращаем FALSE - if ( FALSE == HttpQueryInfo ( hInternet, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &nResult, &dwLengthDataSize, NULL ) ) - return FALSE; + // Делаем запрос, если не проходит - то возвращаем FALSE + if ( FALSE == HttpQueryInfo ( hInternet, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &nResult, &dwLengthDataSize, NULL ) ) + return FALSE; - // Запрос прошел, теперь проверяем код ответа - if ( HTTP_STATUS_NOT_FOUND == nResult ) - { - // Объект не найден, плохая ссылка или что-то еще - return FALSE; - } - else if ( ( HTTP_STATUS_OK != nResult && FALSE == bIsRanges ) || ( HTTP_STATUS_PARTIAL_CONTENT != nResult && TRUE == bIsRanges ) ) - { - // Запрос не прошел по какой-то причине - return FALSE; - } + // Запрос прошел, теперь проверяем код ответа + if ( HTTP_STATUS_NOT_FOUND == nResult ) + { + // Объект не найден, плохая ссылка или что-то еще + return FALSE; + } + else if ( ( HTTP_STATUS_OK != nResult && FALSE == bIsRanges ) || ( HTTP_STATUS_PARTIAL_CONTENT != nResult && TRUE == bIsRanges ) ) + { + // Запрос не прошел по какой-то причине + return FALSE; + } - // Все отлично, запрос прошел - return TRUE; - } - // Проверяет, доступно ли для ресурса чтение частями и возвращает -1 если не доступно и размер данных, если доступно - LONGLONG IsAccept_Ranges ( HINTERNET hInternet ) - { - // Зачем проверять у неоткрытой сессии что-то - if ( NULL == hInternet ) - return -1; + // Все отлично, запрос прошел + return TRUE; + } + // Проверяет, доступно ли для ресурса чтение частями и возвращает -1 если не доступно и размер данных, если доступно + LONGLONG IsAccept_Ranges ( HINTERNET hInternet ) + { + // Зачем проверять у неоткрытой сессии что-то + if ( NULL == hInternet ) + return -1; - // Результат ответа - wchar_t arrResult [ MAX_SIZE ] = { 0 }; - // Размер данных ответа - DWORD dwLengthDataSize = sizeof ( arrResult ); + // Результат ответа + wchar_t arrResult [ MAX_SIZE ] = { 0 }; + // Размер данных ответа + DWORD dwLengthDataSize = sizeof ( arrResult ); - // Делаем запрос, если не проходит - то возвращаем FALSE - if ( FALSE == HttpQueryInfoW ( hInternet, HTTP_QUERY_CONTENT_RANGE, &arrResult, &dwLengthDataSize, NULL ) ) - { - // Получаем последнюю ошибку - DWORD dwLastError = GetLastError (); - if ( dwLastError == ERROR_HTTP_HEADER_NOT_FOUND ) - { - // Не пришел заголовок, значит ресурс не поддерживает чтение частями - return -1; - } + // Делаем запрос, если не проходит - то возвращаем FALSE + if ( FALSE == HttpQueryInfoW ( hInternet, HTTP_QUERY_CONTENT_RANGE, &arrResult, &dwLengthDataSize, NULL ) ) + { + // Получаем последнюю ошибку + DWORD dwLastError = GetLastError (); + if ( dwLastError == ERROR_HTTP_HEADER_NOT_FOUND ) + { + // Не пришел заголовок, значит ресурс не поддерживает чтение частями + return -1; + } - // Возникла какая-то другая ошибка - возвращаем FALSE - return -1; - } + // Возникла какая-то другая ошибка - возвращаем FALSE + return -1; + } - // Если размер 0, то заголовка нет - if ( 0 >= dwLengthDataSize ) - return -1; + // Если размер 0, то заголовка нет + if ( 0 >= dwLengthDataSize ) + return -1; - // Приведем к std::wstring - std::wstring strResult ( arrResult ); + // Приведем к std::wstring + std::wstring strResult ( arrResult ); - // Содержит размер данных - LONGLONG nFileSize = 0; + // Содержит размер данных + LONGLONG nFileSize = 0; - try - { - // Ищем индекс размера данных в строке - INT nStartIndex = (INT)strResult.find ( CONTENT_RANGE ); - if ( -1 == nStartIndex ) - return -1; + try + { + // Ищем индекс размера данных в строке + INT nStartIndex = (INT)strResult.find ( CONTENT_RANGE ); + if ( -1 == nStartIndex ) + return -1; - // Оставляем в строке только размер данных - strResult = strResult.substr( nStartIndex + CONTENT_RANGE_SIZE ); - // Теперь получим размер данных, переводя стринг в LONGLONG - nFileSize = _wtoi64 ( strResult.c_str() ); - // Т.к. реально нумерация с 0 ( поэтому добавляем еще 1 байт ) - if ( 0 < nFileSize ) - nFileSize += 1; - } - catch ( ... ) - { - // не нашли возвращаем ошибку - return -1; - } + // Оставляем в строке только размер данных + strResult = strResult.substr( nStartIndex + CONTENT_RANGE_SIZE ); + // Теперь получим размер данных, переводя стринг в LONGLONG + nFileSize = _wtoi64 ( strResult.c_str() ); + // Т.к. реально нумерация с 0 ( поэтому добавляем еще 1 байт ) + if ( 0 < nFileSize ) + nFileSize += 1; + } + catch ( ... ) + { + // не нашли возвращаем ошибку + return -1; + } - // Все отлично, ресурс поддерживает чтение частями, возвращаем размер - return nFileSize; - } + // Все отлично, ресурс поддерживает чтение частями, возвращаем размер + return nFileSize; + } - HRESULT DownloadFileAll(std::wstring sFileURL, std::wstring strFileOutput) - { - if ( m_pFile ) - { - ::fclose( m_pFile ); - m_pFile = NULL; - } + HRESULT DownloadFileAll(std::wstring sFileURL, std::wstring strFileOutput) + { + if ( m_pFile ) + { + ::fclose( m_pFile ); + m_pFile = NULL; + } - DownloadProgress progress; - progress.func_checkAborted = m_check_aborted; - progress.func_onProgress = m_func_onProgress; - // Скачиваем файл с возвратом процентов состояния - return URLDownloadToFileW (NULL, sFileURL.c_str(), strFileOutput.c_str(), NULL, static_cast(&progress)); - } + DownloadProgress progress; + progress.func_checkAborted = m_check_aborted; + progress.func_onProgress = m_func_onProgress; + // Скачиваем файл с возвратом процентов состояния + return URLDownloadToFileW (NULL, sFileURL.c_str(), strFileOutput.c_str(), NULL, static_cast(&progress)); + } - class DownloadProgress : public IBindStatusCallback { - public: - HRESULT __stdcall QueryInterface(const IID &,void **) { - return E_NOINTERFACE; - } - ULONG STDMETHODCALLTYPE AddRef(void) { - return 1; - } - ULONG STDMETHODCALLTYPE Release(void) { - return 1; - } - HRESULT STDMETHODCALLTYPE OnStartBinding(DWORD dwReserved, IBinding *pib) { - return E_NOTIMPL; - } - virtual HRESULT STDMETHODCALLTYPE GetPriority(LONG *pnPriority) { - return E_NOTIMPL; - } - virtual HRESULT STDMETHODCALLTYPE OnLowResource(DWORD reserved) { - return S_OK; - } - virtual HRESULT STDMETHODCALLTYPE OnStopBinding(HRESULT hresult, LPCWSTR szError) { - return E_NOTIMPL; - } - virtual HRESULT STDMETHODCALLTYPE GetBindInfo(DWORD *grfBINDF, BINDINFO *pbindinfo) { - return E_NOTIMPL; - } - virtual HRESULT STDMETHODCALLTYPE OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed) { - return E_NOTIMPL; - } - virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(REFIID riid, IUnknown *punk) { - return E_NOTIMPL; - } + class DownloadProgress : public IBindStatusCallback { + public: + HRESULT __stdcall QueryInterface(const IID &,void **) { + return E_NOINTERFACE; + } + ULONG STDMETHODCALLTYPE AddRef(void) { + return 1; + } + ULONG STDMETHODCALLTYPE Release(void) { + return 1; + } + HRESULT STDMETHODCALLTYPE OnStartBinding(DWORD dwReserved, IBinding *pib) { + return E_NOTIMPL; + } + virtual HRESULT STDMETHODCALLTYPE GetPriority(LONG *pnPriority) { + return E_NOTIMPL; + } + virtual HRESULT STDMETHODCALLTYPE OnLowResource(DWORD reserved) { + return S_OK; + } + virtual HRESULT STDMETHODCALLTYPE OnStopBinding(HRESULT hresult, LPCWSTR szError) { + return E_NOTIMPL; + } + virtual HRESULT STDMETHODCALLTYPE GetBindInfo(DWORD *grfBINDF, BINDINFO *pbindinfo) { + return E_NOTIMPL; + } + virtual HRESULT STDMETHODCALLTYPE OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed) { + return E_NOTIMPL; + } + virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(REFIID riid, IUnknown *punk) { + return E_NOTIMPL; + } - virtual HRESULT __stdcall OnProgress(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) - { - if(func_checkAborted && func_checkAborted()) - { - return E_ABORT; - } - if(ulProgressMax != 0) - { - int percent = static_cast((100.0 * ulProgress) / ulProgressMax); - if(func_onProgress) - func_onProgress(percent); - } - return S_OK; - } + virtual HRESULT __stdcall OnProgress(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) + { + if(func_checkAborted && func_checkAborted()) + { + return E_ABORT; + } + if(ulProgressMax != 0) + { + int percent = static_cast((100.0 * ulProgress) / ulProgressMax); + if(func_onProgress) + func_onProgress(percent); + } + return S_OK; + } - std::function func_checkAborted = nullptr; - std::function func_onProgress = nullptr; - }; + std::function func_checkAborted = nullptr; + std::function func_onProgress = nullptr; + }; - bool DownloadFilePS(const std::wstring& sFileURL, const std::wstring& strFileOutput) - { - STARTUPINFO sturtupinfo; - ZeroMemory(&sturtupinfo,sizeof(STARTUPINFO)); - sturtupinfo.cb = sizeof(STARTUPINFO); + bool DownloadFilePS(const std::wstring& sFileURL, const std::wstring& strFileOutput) + { + STARTUPINFO sturtupinfo; + ZeroMemory(&sturtupinfo,sizeof(STARTUPINFO)); + sturtupinfo.cb = sizeof(STARTUPINFO); - std::wstring sFileDst = strFileOutput; - size_t posn = 0; - while (std::wstring::npos != (posn = sFileDst.find('\\', posn))) - { - sFileDst.replace(posn, 1, L"/"); - posn += 1; - } + std::wstring sFileDst = strFileOutput; + size_t posn = 0; + while (std::wstring::npos != (posn = sFileDst.find('\\', posn))) + { + sFileDst.replace(posn, 1, L"/"); + posn += 1; + } - std::wstring sApp = L"powershell.exe –c \"(new-object System.Net.WebClient).DownloadFile('" + sFileURL + L"','" + sFileDst + L"')\""; - wchar_t* pCommandLine = new wchar_t[sApp.length() + 1]; - memcpy(pCommandLine, sApp.c_str(), sApp.length() * sizeof(wchar_t)); - pCommandLine[sApp.length()] = (wchar_t)'\0'; + std::wstring sApp = L"powershell.exe –c \"(new-object System.Net.WebClient).DownloadFile('" + sFileURL + L"','" + sFileDst + L"')\""; + wchar_t* pCommandLine = new wchar_t[sApp.length() + 1]; + memcpy(pCommandLine, sApp.c_str(), sApp.length() * sizeof(wchar_t)); + pCommandLine[sApp.length()] = (wchar_t)'\0'; - HANDLE ghJob = CreateJobObject(NULL, NULL); + HANDLE ghJob = CreateJobObject(NULL, NULL); - if (ghJob) - { - JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 }; + if (ghJob) + { + JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 }; - // Configure all child processes associated with the job to terminate when the - jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; - if ( 0 == SetInformationJobObject( ghJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli))) - { - CloseHandle(ghJob); - ghJob = NULL; - } - } + // Configure all child processes associated with the job to terminate when the + jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + if ( 0 == SetInformationJobObject( ghJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli))) + { + CloseHandle(ghJob); + ghJob = NULL; + } + } - PROCESS_INFORMATION processinfo; - ZeroMemory(&processinfo,sizeof(PROCESS_INFORMATION)); - BOOL bResult = CreateProcessW(NULL, pCommandLine, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &sturtupinfo, &processinfo); + PROCESS_INFORMATION processinfo; + ZeroMemory(&processinfo,sizeof(PROCESS_INFORMATION)); + BOOL bResult = CreateProcessW(NULL, pCommandLine, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &sturtupinfo, &processinfo); - if (bResult && ghJob) - { - AssignProcessToJobObject(ghJob, processinfo.hProcess); - } + if (bResult && ghJob) + { + AssignProcessToJobObject(ghJob, processinfo.hProcess); + } - ::WaitForSingleObject(processinfo.hProcess, INFINITE); + ::WaitForSingleObject(processinfo.hProcess, INFINITE); - RELEASEARRAYOBJECTS(pCommandLine); + RELEASEARRAYOBJECTS(pCommandLine); - return NSFile::CFileBinary::Exists(sFileDst); - } - }; + return NSFile::CFileBinary::Exists(sFileDst); + } + }; - CFileTransporter_private::CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete) - : m_pInternal(new CFileTransporterBaseWin(sDownloadFileUrl, bDelete)) - { - m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); - } + CFileTransporter_private::CFileTransporter_private(const std::wstring &sDownloadFileUrl, bool bDelete) + : m_pInternal(new CFileTransporterBaseWin(sDownloadFileUrl, bDelete)) + { + m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); + } - CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) - : m_pInternal(new CFileTransporterBaseWin(sUploadUrl, cData, nSize)) - { - m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); - } + CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize) + : m_pInternal(new CFileTransporterBaseWin(sUploadUrl, cData, nSize)) + { + m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); + } - CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) - : m_pInternal(new CFileTransporterBaseWin(sUploadUrl, sUploadFilePath)) - { - m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); - } - } + CFileTransporter_private::CFileTransporter_private(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath) + : m_pInternal(new CFileTransporterBaseWin(sUploadUrl, sUploadFilePath)) + { + m_pInternal->m_check_aborted = std::bind(&CBaseThread::isAborted, this); + } + } } diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_unions/SXDB_bu.cpp b/Common/Network/FileTransporter/src/Session.cpp similarity index 74% rename from MsBinaryFile/XlsFile/Format/Logic/Biff_unions/SXDB_bu.cpp rename to Common/Network/FileTransporter/src/Session.cpp index be047348d3..8cd3548d1c 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_unions/SXDB_bu.cpp +++ b/Common/Network/FileTransporter/src/Session.cpp @@ -29,49 +29,37 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ +#pragma once +#include "Session.h" -#include "SXDB.h" -#include "DREF.h" -#include "SXTBL.h" -#include "DBQUERY.h" - -namespace XLS +namespace NSNetwork { - - -SXDB::SXDB() -{ -} - - -SXDB::~SXDB() -{ -} - - -BaseObjectPtr SXDB::clone() -{ - return BaseObjectPtr(new SXDB(*this)); -} - - -// SXDB = DREF / SXTBL / DBQUERY -const bool SXDB::loadContent(BinProcessor& proc) -{ - if(!proc.optional()) + namespace NSFileTransport { - if(!proc.optional()) + CSession::CSession() { - if(!proc.optional()) - { - return false; - } + m_pInternal = CreateSession(); } + CSession::~CSession() + { + delete m_pInternal; + } + + void CSession::SetProperty(const std::string& name, const std::string& value) + { + m_pInternal->m_props.insert(std::make_pair(name, value)); + } + + void CSession::Initialize() + { + m_pInternal->Create(); + } + +#if !defined(_IOS) && !defined(_MAC) + CSession_private* CreateSession() + { + return new CSession_private(); + } +#endif } - m_source = elements_.back(); - elements_.pop_back(); - return true; } - -} // namespace XLS - diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_unions/SXDB.h b/Common/Network/FileTransporter/src/Session.h similarity index 82% rename from MsBinaryFile/XlsFile/Format/Logic/Biff_unions/SXDB.h rename to Common/Network/FileTransporter/src/Session.h index 463eeb2778..76b116d533 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_unions/SXDB.h +++ b/Common/Network/FileTransporter/src/Session.h @@ -31,26 +31,29 @@ */ #pragma once -#include "../CompositeObject.h" +#include "../include/FileTransporter.h" +#include -namespace XLS +namespace NSNetwork { + namespace NSFileTransport + { + class CSession_private + { + public: + std::map m_props; -class SXDB: public CompositeObject -{ - BASE_OBJECT_DEFINE_CLASS_NAME(SXDB) -public: - SXDB(); - ~SXDB(); + public: + CSession_private() + { + } + ~CSession_private() + { + } - BaseObjectPtr clone(); - - virtual const bool loadContent(BinProcessor& proc); - - static const ElementType type = typeSXDB; - - BaseObjectPtr m_source; -}; - -} // namespace XLS + virtual void Create() {} + }; + CSession_private* CreateSession(); + } +} diff --git a/Common/Network/FileTransporter/src/manager.cpp b/Common/Network/FileTransporter/src/manager.cpp new file mode 100644 index 0000000000..95cb3fe77e --- /dev/null +++ b/Common/Network/FileTransporter/src/manager.cpp @@ -0,0 +1,272 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +#include +#include "./../include/manager.h" +#include "./../../../core/DesktopEditor/graphics/TemporaryCS.h" +#include "./../../../core/DesktopEditor/graphics/BaseThread.h" + +namespace ASC +{ + class CDownloadTask : public IDownloadTask, public NSThreads::CBaseThread + { + public: + std::wstring Directory; + std::wstring FileName; + std::wstring Url; + + DownloadStatus Status; + int ID; + void* Observer; + std::function Handler; + + bool IsDeleted; + + CDownloadManager_private* m_manager; + + public: + CDownloadTask(CDownloadManager_private* manager) : IDownloadTask() + { + m_manager = manager; + + IsDeleted = false; + Observer = nullptr; + Handler = nullptr; + } + virtual ~CDownloadTask() + { + } + + virtual DWORD ThreadProc(); + + public: + std::wstring GetPath() + { + return Directory + L"/" + FileName; + } + DownloadStatus GetStatus() + { + return Status; + } + }; + + class CDownloadManager_private + { + public: + NSCriticalSection::CRITICAL_SECTION m_oCS; + + NSNetwork::NSFileTransport::CSession m_oSession; + + std::list m_arTasks; + std::list m_arWaitTasks; + + int m_nMaxConcurrentDownloadCount; + + int m_nTaskID; + int m_nPriority; + + public: + CDownloadManager_private() + { + m_oCS.InitializeCriticalSection(); + m_nMaxConcurrentDownloadCount = 5; + + m_nTaskID = 0; + m_nPriority = 0; + } + ~CDownloadManager_private() + { + Clear(); + } + + public: + IDownloadTask* Create(const std::wstring& url, + const std::wstring& directory, + const std::wstring& filename, + void* observer, + std::function handler) + { + CTemporaryCS oCS(&m_oCS); + CDownloadTask* pTask = new CDownloadTask(this); + + pTask->Url = url; + pTask->Directory = directory; + pTask->FileName = filename; + pTask->Observer = observer; + pTask->Handler = handler; + pTask->ID = m_nTaskID++; + + if (m_nMaxConcurrentDownloadCount < (int)m_arTasks.size()) + { + m_arTasks.push_back(pTask); + pTask->DestroyOnFinish(); + pTask->Start(m_nPriority); + } + else + { + m_arWaitTasks.push_back(pTask); + } + + return pTask; + } + + void OnDownloadTask(CDownloadTask* task) + { + CTemporaryCS oCS(&m_oCS); + + for (std::list::iterator iter = m_arTasks.begin(); iter != m_arTasks.end(); iter++) + { + if (task == (*iter)) + { + m_arTasks.erase(iter); + break; + } + } + + if (task->Handler) + task->Handler(task); + } + void OnDestroyObserver(void* observer) + { + CTemporaryCS oCS(&m_oCS); + + for (std::list::iterator iter = m_arTasks.begin(); iter != m_arTasks.end(); iter++) + { + (*iter)->Handler = nullptr; + } + + for (std::list::iterator iter = m_arWaitTasks.begin(); iter != m_arWaitTasks.end();) + { + CDownloadTask* pTask = *iter; + if (pTask->Observer == observer) + { + iter = m_arTasks.erase(iter); + delete pTask; + } + else + iter++; + } + } + void Clear() + { + CTemporaryCS oCS(&m_oCS); + + for (std::list::iterator iter = m_arTasks.begin(); iter != m_arTasks.end(); iter++) + { + (*iter)->Handler = nullptr; + } + + for (std::list::iterator iter = m_arWaitTasks.begin(); iter != m_arWaitTasks.end();) + { + CDownloadTask* pTask = *iter; + delete pTask; + } + m_arWaitTasks.clear(); + } + }; + + DWORD CDownloadTask::ThreadProc() + { + NSNetwork::NSFileTransport::CFileDownloader oDownloader(Url, false); + oDownloader.SetSession(&m_manager->m_oSession); + + oDownloader.SetFilePath(GetPath()); + + oDownloader.Start( 0 ); + while ( oDownloader.IsRunned() ) + { + NSThreads::Sleep( 10 ); + } + + Status = oDownloader.IsFileDownloaded() ? ASC::Success : ASC::Error; + + m_manager->OnDownloadTask(this); + return 0; + } + + // INTERFACE + IDownloadTask::IDownloadTask() {} + IDownloadTask::~IDownloadTask() {} + + CDownloadManager::CDownloadManager() + { + m_internal = new CDownloadManager_private(); + } + CDownloadManager::~CDownloadManager() + { + Clear(); + delete m_internal; + } + + NSNetwork::NSFileTransport::CSession* CDownloadManager::GetSession() + { + return &m_internal->m_oSession; + } + + void CDownloadManager::SetMaxConcurrentDownloadCount(const int& count) + { + m_internal->m_nMaxConcurrentDownloadCount = count; + } + void CDownloadManager::AddTask(const std::wstring& url, + const std::wstring& directory, + const std::wstring& filename, + void* observer, + std::function handler) + { + m_internal->Create(url, directory, filename, observer, handler); + } + void CDownloadManager::OnDestroyObserver(void* observer) + { + m_internal->OnDestroyObserver(observer); + } + void CDownloadManager::Clear() + { + m_internal->Clear(); + } + + bool CDownloadManager::DownloadExternal(const std::wstring& url, const std::wstring& path) + { + NSNetwork::NSFileTransport::CFileDownloader oDownloader(url, false); + NSNetwork::NSFileTransport::CSession oSession; + oDownloader.SetSession(&oSession); + + oDownloader.SetFilePath(path); + + oDownloader.Start( 0 ); + while ( oDownloader.IsRunned() ) + { + NSThreads::Sleep( 10 ); + } + + return oDownloader.IsFileDownloaded(); + } +} diff --git a/Common/base.pri b/Common/base.pri index 0a5a356bb9..3d678f82ff 100644 --- a/Common/base.pri +++ b/Common/base.pri @@ -570,3 +570,7 @@ ADD_INC_PATH = $$(ADDITIONAL_INCLUDE_PATH) CONFIG += warn_off } } + +!disable_precompiled_header { + CONFIG += precompile_header +} diff --git a/Common/cfcpp/Stream/fstream_wrapper.h b/Common/cfcpp/Stream/fstream_wrapper.h index 0e4087cb31..58676381db 100644 --- a/Common/cfcpp/Stream/fstream_wrapper.h +++ b/Common/cfcpp/Stream/fstream_wrapper.h @@ -68,6 +68,9 @@ public: inline void close() override { std::fstream::close(); } + inline bool isError() override { + return (std::fstream::bad() || std::fstream::fail()); + } }; } diff --git a/Common/cfcpp/Stream/stream.h b/Common/cfcpp/Stream/stream.h index e773959cbd..dfd4431ae0 100644 --- a/Common/cfcpp/Stream/stream.h +++ b/Common/cfcpp/Stream/stream.h @@ -48,6 +48,7 @@ namespace CFCPP virtual void write (const char* buffer, _INT64 len) = 0; virtual void flush() = 0; virtual void close() = 0; + virtual bool isError() = 0; }; using Stream = std::shared_ptr; diff --git a/Common/cfcpp/compoundfile.cpp b/Common/cfcpp/compoundfile.cpp index 9437c50e6a..1e552d105f 100644 --- a/Common/cfcpp/compoundfile.cpp +++ b/Common/cfcpp/compoundfile.cpp @@ -67,9 +67,9 @@ std::shared_ptr CompoundFile::RootStorage() { return _impl->RootStorage(); } -void CompoundFile::Save(std::wstring wFileName) +bool CompoundFile::Save(std::wstring wFileName) { - _impl->Save(wFileName); + return _impl->Save(wFileName); } void CompoundFile::Save(Stream stream) { @@ -316,15 +316,23 @@ void CompoundFile_impl::Load(Stream stream) } } -void CompoundFile_impl::Save(std::wstring wFileName) -{ - if (isDisposed) - throw CFException("Compound File closed: cannot save data"); +bool CompoundFile_impl::Save(std::wstring wFileName) +{ + if (isDisposed) + { + //throw CFException("Compound File closed: cannot save data"); + return false; + } Stream file = OpenFileStream(wFileName, true, true); - file->seek(0, std::ios::beg); - try + if (!file) return false; + if (file->isError()) return false; + + file->seek(0, std::ios::beg); + + bool result = true; + try { Save(file); @@ -343,7 +351,9 @@ void CompoundFile_impl::Save(std::wstring wFileName) file->close(); throw CFException("Error saving file [" + fileName + "]", ex); + result = false; } + return result; } diff --git a/Common/cfcpp/compoundfile.h b/Common/cfcpp/compoundfile.h index 37e7bc2ef5..286066ecbc 100644 --- a/Common/cfcpp/compoundfile.h +++ b/Common/cfcpp/compoundfile.h @@ -64,7 +64,7 @@ public: std::shared_ptr RootStorage(); - void Save(std::wstring wFileName); + bool Save(std::wstring wFileName); void Save(Stream stream); void Commit(bool releaseMemory = false); diff --git a/Common/cfcpp/compoundfile_impl.h b/Common/cfcpp/compoundfile_impl.h index 690d048225..5e0e717f6f 100644 --- a/Common/cfcpp/compoundfile_impl.h +++ b/Common/cfcpp/compoundfile_impl.h @@ -59,7 +59,7 @@ public: // Main methods std::shared_ptr RootStorage(); - void Save(std::wstring wFileName); + bool Save(std::wstring wFileName); void Save(Stream stream); void Commit(bool releaseMemory = false); diff --git a/Common/cfcpp/streamview.cpp b/Common/cfcpp/streamview.cpp index b38c2039bf..3b80feef55 100644 --- a/Common/cfcpp/streamview.cpp +++ b/Common/cfcpp/streamview.cpp @@ -123,6 +123,14 @@ void StreamView::close() if (std::dynamic_pointer_cast(stream) != nullptr) stream->close(); } +bool StreamView::isError() +{ + if (std::dynamic_pointer_cast(stream) == nullptr) return true; + if ((std::dynamic_pointer_cast(stream))->bad()) return true; + if ((std::dynamic_pointer_cast(stream))->fail()) return true; + + return false; +} _INT64 StreamView::read(char *buffer, _INT64 len) { diff --git a/Common/cfcpp/streamview.h b/Common/cfcpp/streamview.h index 6a8786cd05..94d5cd1c37 100644 --- a/Common/cfcpp/streamview.h +++ b/Common/cfcpp/streamview.h @@ -46,14 +46,13 @@ public: StreamView(const SVector §orChain, _INT32 sectorSize, _INT64 length, SList &availableSectors, Stream stream, bool isFatStream = false); - _INT64 tell() override; _INT64 seek(_INT64 offset, std::ios_base::seekdir mode = std::ios::beg) override; _INT64 read(char *buffer, _INT64 count) override; void write(const char *buffer, _INT64 count) override; void flush() override {} void close() override; - + bool isError() override; _INT64 getPosition() const; void SetLength(_INT64 value); diff --git a/DesktopEditor/Word_Api/Editor_Api.h b/DesktopEditor/Word_Api/Editor_Api.h deleted file mode 100644 index 8a3708bd53..0000000000 --- a/DesktopEditor/Word_Api/Editor_Api.h +++ /dev/null @@ -1,3077 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#ifndef _BUILD_EDITOR_API_CROSSPLATFORM_H_ -#define _BUILD_EDITOR_API_CROSSPLATFORM_H_ - -#include "./Editor_Defines.h" - -#include - -#include - -namespace NSEditorApi -{ - class IMenuEventDataBase - { - protected: - unsigned int m_lRef; - - public: - IMenuEventDataBase() - { - m_lRef = 1; - } - - virtual ~IMenuEventDataBase() - { - } - - virtual unsigned int AddRef() - { - ++m_lRef; - return m_lRef; - } - virtual unsigned int Release() - { - unsigned int ret = --m_lRef; - if (0 == m_lRef) - delete this; - return ret; - } - }; -} - -namespace NSEditorApi -{ - -#define LINK_PROPERTY_INT(memberName) \ - inline int get_##memberName() \ - { \ - return m_n##memberName; \ - } \ - inline void put_##memberName(const int& newVal) \ - { \ - m_n##memberName = newVal; \ - } -#define LINK_PROPERTY_UINT(memberName) \ - inline unsigned int get_##memberName() \ - { \ - return m_n##memberName; \ - } \ - inline void put_##memberName(const unsigned int& newVal) \ - { \ - m_n##memberName = newVal; \ - } - -#define LINK_PROPERTY_DOUBLE(memberName) \ - inline double get_##memberName() \ - { \ - return m_d##memberName; \ - } \ - inline void put_##memberName(const double& newVal) \ - { \ - m_d##memberName = newVal; \ - } - -#define LINK_PROPERTY_BOOL(memberName) \ - inline bool get_##memberName() \ - { \ - return m_b##memberName; \ - } \ - inline void put_##memberName(const bool& newVal) \ - { \ - m_b##memberName = newVal; \ - } - -#define LINK_PROPERTY_BYTE(memberName) \ - inline unsigned char get_##memberName() \ - { \ - return m_n##memberName; \ - } \ - inline void put_##memberName(const unsigned char& newVal) \ - { \ - m_n##memberName = newVal; \ - } - -#define LINK_PROPERTY_STRING(memberName) \ - inline std::wstring get_##memberName() \ - { \ - return m_s##memberName; \ - } \ - inline void put_##memberName(const std::wstring& newVal) \ - { \ - m_s##memberName = newVal; \ - } -#define LINK_PROPERTY_STRINGA(memberName) \ - inline std::string get_##memberName() \ - { \ - return m_s##memberName; \ - } \ - inline void put_##memberName(const std::string& newVal) \ - { \ - m_s##memberName = newVal; \ - } - -#define LINK_PROPERTY_OBJECT(objectType, memberName) \ - inline objectType& get_##memberName() \ - { \ - return m_o##memberName; \ - } \ - inline void put_##memberName(const objectType& newVal) \ - { \ - m_o##memberName = newVal; \ - } - -// JS -#define LINK_PROPERTY_INT_JS(memberName) \ - inline js_wrapper& get_##memberName() \ - { \ - return m_n##memberName; \ - } \ - inline void put_##memberName(const int& newVal) \ - { \ - m_n##memberName = newVal; \ - } \ - inline void put_##memberName(const js_wrapper& newVal) \ - { \ - m_n##memberName = newVal; \ - } - -#define LINK_PROPERTY_DOUBLE_JS(memberName) \ - inline js_wrapper& get_##memberName() \ - { \ - return m_d##memberName; \ - } \ - inline void put_##memberName(const double& newVal) \ - { \ - m_d##memberName = newVal; \ - } \ - inline void put_##memberName(const js_wrapper& newVal) \ - { \ - m_d##memberName = newVal; \ - } - -#define LINK_PROPERTY_BOOL_JS(memberName) \ - inline js_wrapper& get_##memberName() \ - { \ - return m_b##memberName; \ - } \ - inline void put_##memberName(const bool& newVal) \ - { \ - m_b##memberName = newVal; \ - } \ - inline void put_##memberName(const js_wrapper& newVal) \ - { \ - m_b##memberName = newVal; \ - } - -#define LINK_PROPERTY_BYTE_JS(memberName) \ - inline js_wrapper& get_##memberName() \ - { \ - return m_n##memberName; \ - } \ - inline void put_##memberName(const unsigned char& newVal) \ - { \ - m_n##memberName = newVal; \ - } \ - inline void put_##memberName(const js_wrapper& newVal) \ - { \ - m_n##memberName = newVal; \ - } - -#define LINK_PROPERTY_STRING_JS(memberName) \ - inline js_wrapper& get_##memberName() \ - { \ - return m_s##memberName; \ - } \ - inline void put_##memberName(const std::wstring& newVal) \ - { \ - m_s##memberName = newVal; \ - } \ - inline void put_##memberName(const js_wrapper& newVal) \ - { \ - m_s##memberName = newVal; \ - } - -#define LINK_PROPERTY_STRINGA_JS(memberName) \ - inline js_wrapper& get_##memberName() \ - { \ - return m_s##memberName; \ - } \ - inline void put_##memberName(const std::string& newVal) \ - { \ - m_s##memberName = newVal; \ - } \ - inline void put_##memberName(const js_wrapper& newVal) \ - { \ - m_s##memberName = newVal; \ - } - -#define LINK_PROPERTY_OBJECT_JS(objectType, memberName) \ - inline js_wrapper& get_##memberName() \ - { \ - return m_o##memberName; \ - } \ - inline void put_##memberName(const js_wrapper& newVal) \ - { \ - m_o##memberName = newVal; \ - } \ - inline void put_##memberName(objectType* newVal) \ - { \ - m_o##memberName = newVal; \ - } - -template -class js_wrapper : public NSEditorApi::IMenuEventDataBase -{ -protected: - Type* m_pPointer; - bool m_bIsNull; - -public: - js_wrapper() - { - m_pPointer = NULL; - m_bIsNull = false; - } - js_wrapper(const js_wrapper& oOther) - { - m_pPointer = NULL; - - if (oOther.m_bIsNull) - m_bIsNull = true; - else - { - m_bIsNull = false; - - if ( NULL != oOther.m_pPointer ) - m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) ); - } - } - js_wrapper(Type* pOther) - { - m_pPointer = pOther; - m_bIsNull = false; - } - virtual ~js_wrapper() - { - if (NULL != m_pPointer) - delete m_pPointer; - } - -public: - inline Type& operator*() { return *m_pPointer; } - inline Type* operator->() { return m_pPointer; } - - inline Type& operator*() const { return *m_pPointer; } - inline Type* operator->() const { return m_pPointer; } - - inline const Type& get()const { return *m_pPointer; } - inline Type& get() { return *m_pPointer; } - -public: - js_wrapper& operator=(const js_wrapper &oOther) - { - if (NULL != m_pPointer) - { - delete m_pPointer; - m_pPointer = NULL; - } - - if (oOther.m_bIsNull) - m_bIsNull = true; - else - { - m_bIsNull = false; - - if ( NULL != oOther.m_pPointer ) - m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) ); - } - return *this; - } - js_wrapper& operator=(Type* pType) - { - if (NULL != m_pPointer && m_pPointer != pType) - delete m_pPointer; - - m_pPointer = pType; - m_bIsNull = false; - return *this; - } - js_wrapper& operator=(const Type& oSrc) - { - if (NULL != m_pPointer) - delete m_pPointer; - - m_pPointer = new Type(oSrc); - m_bIsNull = false; - return *this; - } - -public: - inline bool IsNull() const - { - return m_bIsNull; - } - inline bool IsUndefined() const - { - return (NULL == m_pPointer); - } - inline bool IsInit() const - { - return ((NULL != m_pPointer) && !m_bIsNull); - } - inline void SetNull() - { - m_bIsNull = true; - } - inline void ReleaseNoAttack() - { - m_pPointer = NULL; - } -}; - -} - -// colors -namespace NSEditorApi -{ - class CAscColorSimple : public IMenuEventDataBase - { - public: - unsigned char R; - unsigned char G; - unsigned char B; - unsigned char A; - - public: - CAscColorSimple() - { - R = 0; - G = 0; - B = 0; - A = 0; - } - virtual ~CAscColorSimple() - { - } - }; - - class CColorMod : public IMenuEventDataBase - { - private: - std::string m_sName; - int m_nValue; - - public: - CColorMod() - { - m_sName = ""; - m_nValue = 0; - } - virtual ~CColorMod() - { - } - - LINK_PROPERTY_STRINGA(Name) - LINK_PROPERTY_INT(Value) - }; - - class CColorMods : public IMenuEventDataBase - { - private: - CColorMod* m_pMods; - int m_lCount; - - public: - CColorMods() - { - m_pMods = NULL; - m_lCount = 0; - } - virtual ~CColorMods() - { - if (NULL != m_pMods) - delete [] m_pMods; - } - - int GetCount() { return m_lCount; } - CColorMod* GetMods() { return m_pMods; } - - void SetMods(CColorMod* pMods, int nCount) - { - m_pMods = pMods; - m_lCount = nCount; - } - }; - - class CAscColor : public IMenuEventDataBase - { - private: - js_wrapper m_nType; // c_oAscColor_COLOR_TYPE - - js_wrapper m_nR; - js_wrapper m_nG; - js_wrapper m_nB; - js_wrapper m_nA; - - js_wrapper m_bAuto; - - js_wrapper m_nValue; - js_wrapper m_nColorSchemeId; - - js_wrapper m_oMods; - - public: - CAscColor() - { - } - virtual ~CAscColor() - { - } - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_BYTE_JS(R) - LINK_PROPERTY_BYTE_JS(G) - LINK_PROPERTY_BYTE_JS(B) - LINK_PROPERTY_BYTE_JS(A) - LINK_PROPERTY_BOOL_JS(Auto) - LINK_PROPERTY_INT_JS(Value) - LINK_PROPERTY_INT_JS(ColorSchemeId) - LINK_PROPERTY_OBJECT_JS(CColorMods, Mods) - }; - - class CPrstColor : public IMenuEventDataBase - { - private: - - js_wrapper m_nType; // c_oAscColor_COLOR_TYPE - js_wrapper m_sId; - js_wrapper m_nR; - js_wrapper m_nG; - js_wrapper m_nB; - js_wrapper m_nA; - js_wrapper m_bNeedRecalc; - - public: - CPrstColor() - { - } - virtual ~CPrstColor() - { - } - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_STRINGA_JS(Id) - LINK_PROPERTY_BYTE_JS(R) - LINK_PROPERTY_BYTE_JS(G) - LINK_PROPERTY_BYTE_JS(B) - LINK_PROPERTY_BYTE_JS(A) - LINK_PROPERTY_BOOL_JS(NeedRecalc) - }; - - class CUniColor : public IMenuEventDataBase - { - private: - - js_wrapper m_oColor; - js_wrapper m_oMods; - js_wrapper m_nR; - js_wrapper m_nG; - js_wrapper m_nB; - js_wrapper m_nA; - - - public: - CUniColor() - { - } - virtual ~CUniColor() - { - } - - LINK_PROPERTY_OBJECT_JS(CPrstColor, Color) - LINK_PROPERTY_OBJECT_JS(CColorMods, Mods) - LINK_PROPERTY_BYTE_JS(R) - LINK_PROPERTY_BYTE_JS(G) - LINK_PROPERTY_BYTE_JS(B) - LINK_PROPERTY_BYTE_JS(A) - }; -} - -namespace NSEditorApi -{ - // not release data!!! - class CAscImageRaw - { - public: - unsigned char* Data; - int Width; - int Height; - - bool Release; - - public: - CAscImageRaw() - { - Data = NULL; - Width = 0; - Height = 0; - Release = false; - } - ~CAscImageRaw() - { - if (NULL != Data && Release) - delete [] Data; - } - - CAscImageRaw& operator=(const CAscImageRaw& oSrc) - { - Data = oSrc.Data; - Width = oSrc.Width; - Height = oSrc.Height; - Release = false; - return *this; - } - - static void ExternalRelease(void* data) - { - delete [] (unsigned char*)data; - } - }; - - class CAscBinaryData - { - public: - unsigned char* Data; - int Size; - - public: - CAscBinaryData() - { - Data = NULL; - Size = 0; - } - ~CAscBinaryData() - { - if (NULL != Data) - delete [] Data; - } - }; - - class CAscInsertImage : public IMenuEventDataBase - { - private: - js_wrapper m_oRaw; - js_wrapper m_sPath; - js_wrapper m_sUploadPath; - js_wrapper m_sBase64; - js_wrapper m_oBinaryData; - js_wrapper m_sAdditionalParams; - js_wrapper m_nPositionX; - js_wrapper m_nPositionY; - js_wrapper m_nWrapType; - - public: - CAscInsertImage() - { - } - virtual ~CAscInsertImage() - { - } - - LINK_PROPERTY_OBJECT_JS(CAscImageRaw, Raw) - LINK_PROPERTY_STRING_JS(Path) - LINK_PROPERTY_STRING_JS(UploadPath) - LINK_PROPERTY_STRINGA_JS(Base64) - LINK_PROPERTY_OBJECT_JS(CAscBinaryData, BinaryData) - LINK_PROPERTY_STRING_JS(AdditionalParams) - LINK_PROPERTY_INT_JS(PositionX) - LINK_PROPERTY_INT_JS(PositionY) - LINK_PROPERTY_INT_JS(WrapType) - }; -} - -// document -namespace NSEditorApi -{ - class CAscEditorPermissions : public IMenuEventDataBase - { - private: - bool m_bCanEdit; - bool m_bCanDownload; - bool m_bCanCoAuthoring; - bool m_bCanBranding; - bool m_bIsAutosaveEnabled; - int m_nAutosaveMinInterval; - - public: - CAscEditorPermissions() - { - m_bCanEdit = true; - m_bCanDownload = true; - m_bCanCoAuthoring = true; - m_bCanBranding = true; - m_bIsAutosaveEnabled = true; - m_nAutosaveMinInterval = 300; - } - virtual ~CAscEditorPermissions() - { - } - - public: - LINK_PROPERTY_BOOL(CanEdit) - LINK_PROPERTY_BOOL(CanDownload) - LINK_PROPERTY_BOOL(CanCoAuthoring) - LINK_PROPERTY_BOOL(CanBranding) - LINK_PROPERTY_BOOL(IsAutosaveEnabled) - LINK_PROPERTY_INT(AutosaveMinInterval) - }; - - class CAscLicense : public IMenuEventDataBase - { - private: - js_wrapper m_sCustomer; - js_wrapper m_sCustomerAddr; - js_wrapper m_sCustomerWww; - js_wrapper m_sCustomerMail; - js_wrapper m_sCustomerInfo; - js_wrapper m_sCustomerLogo; - - public: - CAscLicense() - { - m_sCustomer.SetNull(); - m_sCustomerAddr.SetNull(); - m_sCustomerWww.SetNull(); - m_sCustomerMail.SetNull(); - m_sCustomerInfo.SetNull(); - m_sCustomerLogo.SetNull(); - } - virtual ~CAscLicense() - { - } - - LINK_PROPERTY_STRING_JS(Customer) - LINK_PROPERTY_STRING_JS(CustomerAddr) - LINK_PROPERTY_STRING_JS(CustomerWww) - LINK_PROPERTY_STRING_JS(CustomerMail) - LINK_PROPERTY_STRING_JS(CustomerInfo) - LINK_PROPERTY_STRING_JS(CustomerLogo) - }; - - class CAscDocumentOpenProgress : public IMenuEventDataBase - { - private: - int m_nType; - - int m_nFontsCount; - int m_nFontCurrent; - - int m_nImagesCount; - int m_nImageCurrent; - - public: - CAscDocumentOpenProgress() - { - m_nType = c_oAscAsyncAction_Open; - - m_nFontsCount = 0; - m_nFontCurrent = 0; - - m_nImagesCount = 0; - m_nImageCurrent = 0; - } - virtual ~CAscDocumentOpenProgress() - { - } - - LINK_PROPERTY_INT(Type) - LINK_PROPERTY_INT(FontsCount) - LINK_PROPERTY_INT(FontCurrent) - LINK_PROPERTY_INT(ImagesCount) - LINK_PROPERTY_INT(ImageCurrent) - }; - - class CAscDocumentInfo : public IMenuEventDataBase - { - private: - js_wrapper m_sId; - js_wrapper m_sUrl; - js_wrapper m_sTitle; - js_wrapper m_sFormat; - js_wrapper m_sVKey; - js_wrapper m_sUserId; - js_wrapper m_sUserName; - - public: - CAscDocumentInfo() - { - m_sId.SetNull(); - m_sUrl.SetNull(); - m_sTitle.SetNull(); - m_sFormat.SetNull(); - m_sVKey.SetNull(); - m_sUserId.SetNull(); - m_sUserName.SetNull(); - } - virtual ~CAscDocumentInfo() - { - } - - LINK_PROPERTY_STRING_JS(Id) - LINK_PROPERTY_STRING_JS(Url) - LINK_PROPERTY_STRING_JS(Title) - LINK_PROPERTY_STRING_JS(Format) - LINK_PROPERTY_STRING_JS(VKey) - LINK_PROPERTY_STRING_JS(UserId) - LINK_PROPERTY_STRING_JS(UserName) - }; -} - -// base -namespace NSEditorApi -{ - class CAscRect - { - public: - int X; - int Y; - int Width; - int Height; - - public: - CAscRect() - { - X = 0; - Y = 0; - Width = 0; - Height = 0; - } - }; - - class CAscPaddings - { - private: - js_wrapper m_dLeft; - js_wrapper m_dTop; - js_wrapper m_dRight; - js_wrapper m_dBottom; - - public: - CAscPaddings() - { - } - - LINK_PROPERTY_DOUBLE_JS(Left) - LINK_PROPERTY_DOUBLE_JS(Top) - LINK_PROPERTY_DOUBLE_JS(Right) - LINK_PROPERTY_DOUBLE_JS(Bottom) - }; - - class CAscPosition - { - private: - js_wrapper m_dX; - js_wrapper m_dY; - - public: - CAscPosition() - { - m_dX.SetNull(); - m_dY.SetNull(); - } - - LINK_PROPERTY_DOUBLE_JS(X) - LINK_PROPERTY_DOUBLE_JS(Y) - }; -} - -// fill -namespace NSEditorApi -{ - class CAscFillBase - { - public: - CAscFillBase() - { - } - virtual ~CAscFillBase() - { - } - }; - - class CAscFillSolid : public CAscFillBase - { - private: - js_wrapper m_oColor; - - public: - CAscFillSolid() - { - } - virtual ~CAscFillSolid() - { - } - - LINK_PROPERTY_OBJECT_JS(CAscColor, Color) - }; - - class CAscFillBlip : public CAscFillBase - { - private: - js_wrapper m_nType; // c_oAscFillBlipType_ - js_wrapper m_sUrl; - js_wrapper m_nTextureId; - - // для выставления заливки - js_wrapper m_oInsertData; - - public: - CAscFillBlip() - { - } - virtual ~CAscFillBlip() - { - } - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_STRING_JS(Url) - LINK_PROPERTY_INT_JS(TextureId) - LINK_PROPERTY_OBJECT_JS(CAscInsertImage, InsertData) - }; - - class CAscFillHatch : public CAscFillBase - { - private: - js_wrapper m_nPatternType; - js_wrapper m_oFg; - js_wrapper m_oBg; - - public: - CAscFillHatch() - { - } - virtual ~CAscFillHatch() - { - } - - LINK_PROPERTY_INT_JS(PatternType) - - LINK_PROPERTY_OBJECT_JS(CAscColor, Fg) - LINK_PROPERTY_OBJECT_JS(CAscColor, Bg) - }; - - class CAscFillGradColors - { - private: - std::vector m_arColors; - std::vector m_arPositions; - - public: - - CAscFillGradColors() - { - - } - - virtual ~CAscFillGradColors() - { - for (std::vector::iterator i = m_arColors.begin(); i != m_arColors.end(); ++i) - { - CAscColor* data = *i; - if (NULL != data) - data->Release(); - } - } - - inline std::vector& GetColors() {return m_arColors;} - inline void AddColor(CAscColor* color) {m_arColors.push_back(color);} - - inline std::vector GetPositions() {return m_arPositions;} - inline void AddPosition(int position) {m_arPositions.push_back(position);} - }; - - class CAscFillGrad : public CAscFillBase - { - private: - js_wrapper m_oColors; - - js_wrapper m_nGradType; - - js_wrapper m_dLinearAngle; - js_wrapper m_bLinearScale; - - js_wrapper m_nPathType; - - public: - CAscFillGrad() - { - } - - LINK_PROPERTY_OBJECT_JS(CAscFillGradColors, Colors) - - LINK_PROPERTY_INT_JS(GradType) - LINK_PROPERTY_DOUBLE_JS(LinearAngle) - LINK_PROPERTY_BOOL_JS(LinearScale) - LINK_PROPERTY_INT_JS(PathType) - }; - - class CAscFill : public IMenuEventDataBase - { - private: - js_wrapper m_nType; - js_wrapper m_oFill; - js_wrapper m_nTransparent; - - public: - CAscFill() - { - } - virtual ~CAscFill() - { - } - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_INT_JS(Transparent) - - LINK_PROPERTY_OBJECT_JS(CAscFillBase, Fill) - }; -} - -// stroke -namespace NSEditorApi -{ - class CAscStroke : public IMenuEventDataBase - { - private: - js_wrapper m_nType; - js_wrapper m_dWidth; - js_wrapper m_oColor; - - js_wrapper m_nLineJoin; - js_wrapper m_nLineCap; - - js_wrapper m_nLineBeginStyle; - js_wrapper m_nLineBeginSize; - - js_wrapper m_nLineEndStyle; - js_wrapper m_nLineEndSize; - - js_wrapper m_bCanChangeArrows; - js_wrapper m_nPrstDash; - - public: - CAscStroke() - { - m_bCanChangeArrows = false; - } - virtual ~CAscStroke() - { - } - - LINK_PROPERTY_OBJECT_JS(CAscColor, Color) - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_DOUBLE_JS(Width) - - LINK_PROPERTY_BYTE_JS(LineJoin) - LINK_PROPERTY_BYTE_JS(LineCap) - LINK_PROPERTY_BYTE_JS(LineBeginStyle) - LINK_PROPERTY_BYTE_JS(LineBeginSize) - LINK_PROPERTY_BYTE_JS(LineEndStyle) - LINK_PROPERTY_BYTE_JS(LineEndSize) - - LINK_PROPERTY_BOOL_JS(CanChangeArrows) - LINK_PROPERTY_INT_JS(PrstDash) - }; -} - -// shadow -namespace NSEditorApi -{ - class CAscShadow : public IMenuEventDataBase - { - private: - - js_wrapper m_oColor; - js_wrapper m_nAlgn; - js_wrapper m_nBlurRad; - js_wrapper m_nDir; - js_wrapper m_nDist; - js_wrapper m_bRotWithShape; - js_wrapper m_bDisplay; - - public: - CAscShadow() - { - m_bRotWithShape = false; - m_bDisplay = false; - } - virtual ~CAscShadow() - { - } - - LINK_PROPERTY_OBJECT_JS(CUniColor, Color) - LINK_PROPERTY_INT_JS(Algn) - LINK_PROPERTY_INT_JS(BlurRad) - LINK_PROPERTY_INT_JS(Dir) - LINK_PROPERTY_INT_JS(Dist) - LINK_PROPERTY_BOOL_JS(RotWithShape) - LINK_PROPERTY_BOOL_JS(Display) - }; -} - -// shape/image/chart props -namespace NSEditorApi -{ - class CAscShapeProp : public IMenuEventDataBase - { - js_wrapper m_sType; - - js_wrapper m_oFill; - js_wrapper m_oStroke; - - js_wrapper m_oPaddings; - - js_wrapper m_bCanFill; - js_wrapper m_bFromChart; - js_wrapper m_bFromGroup; - - js_wrapper m_nInsertPageNum; - - js_wrapper m_oShadow; - - js_wrapper m_nVerticalTextAlign; - - public: - CAscShapeProp() - { - m_bCanFill = true; - m_bFromChart = false; - m_bFromGroup = false; - } - virtual ~CAscShapeProp() - { - } - - LINK_PROPERTY_STRING_JS(Type) - LINK_PROPERTY_BOOL_JS(CanFill) - LINK_PROPERTY_BOOL_JS(FromChart) - LINK_PROPERTY_BOOL_JS(FromGroup) - - LINK_PROPERTY_OBJECT_JS(CAscFill, Fill) - LINK_PROPERTY_OBJECT_JS(CAscStroke, Stroke) - LINK_PROPERTY_OBJECT_JS(CAscPaddings, Paddings) - - LINK_PROPERTY_INT_JS(InsertPageNum) - - LINK_PROPERTY_OBJECT_JS(CAscShadow, Shadow) - - LINK_PROPERTY_INT_JS(VerticalTextAlign) - }; - - - - - class CAscSlideTiming : public IMenuEventDataBase - { - private: - js_wrapper m_nTransitionType; - js_wrapper m_nTransitionOption; - js_wrapper m_nTransitionDuration; - js_wrapper m_nSlideAdvanceDuration; - - js_wrapper m_bSlideAdvanceOnMouseClick; - js_wrapper m_bSlideAdvanceAfter; - js_wrapper m_bShowLoop; - - public: - CAscSlideTiming() - { - } - virtual ~CAscSlideTiming() - { - } - LINK_PROPERTY_INT_JS(TransitionType) - LINK_PROPERTY_INT_JS(TransitionOption) - LINK_PROPERTY_INT_JS(TransitionDuration) - LINK_PROPERTY_INT_JS(SlideAdvanceDuration) - - LINK_PROPERTY_BOOL_JS(SlideAdvanceOnMouseClick) - LINK_PROPERTY_BOOL_JS(SlideAdvanceAfter) - LINK_PROPERTY_BOOL_JS(ShowLoop) - }; - - class CAscTransitions : public IMenuEventDataBase - { - public: - std::vector m_arTransitions; - public: - - CAscTransitions() - {} - - virtual ~CAscTransitions() - { - } - }; - - - class CAscSlideProp : public IMenuEventDataBase - { - js_wrapper m_oBackground; - js_wrapper m_oTiming; - - js_wrapper m_nLayoutIndex; - js_wrapper m_bIsHidden; - js_wrapper m_bLockBackground; - js_wrapper m_bLockDelete; - js_wrapper m_bLockLayout; - js_wrapper m_bLockRemove; - js_wrapper m_bLockTiming; - js_wrapper m_bLockTransition; - - public: - CAscSlideProp() - { - } - virtual ~CAscSlideProp() - { - } - LINK_PROPERTY_OBJECT_JS(CAscFill, Background) - LINK_PROPERTY_OBJECT_JS(CAscSlideTiming, Timing) - - LINK_PROPERTY_INT_JS(LayoutIndex) - LINK_PROPERTY_BOOL_JS(IsHidden) - LINK_PROPERTY_BOOL_JS(LockBackground) - LINK_PROPERTY_BOOL_JS(LockDelete) - LINK_PROPERTY_BOOL_JS(LockLayout) - LINK_PROPERTY_BOOL_JS(LockRemove) - LINK_PROPERTY_BOOL_JS(LockTiming) - LINK_PROPERTY_BOOL_JS(LockTransition) - - }; - - class CAscImagePosition - { - private: - js_wrapper m_nRelativeFrom; - js_wrapper m_bUseAlign; - js_wrapper m_nAlign; - js_wrapper m_nValue; - - public: - CAscImagePosition() - { - } - - LINK_PROPERTY_INT_JS(RelativeFrom) - LINK_PROPERTY_BOOL_JS(UseAlign) - LINK_PROPERTY_INT_JS(Align) - LINK_PROPERTY_INT_JS(Value) - }; - - class CAscImageSize - { - private: - double m_dWidth; - double m_dHeight; - bool m_bIsCorrect; - - public: - CAscImageSize() - { - m_dWidth = 0; - m_dHeight = 0; - m_bIsCorrect = false; - } - - LINK_PROPERTY_DOUBLE(Width) - LINK_PROPERTY_DOUBLE(Height) - LINK_PROPERTY_BOOL(IsCorrect) - }; - - class CAscValAxisSettings - { - private: - js_wrapper m_nMinValRule; // c_oAscValAxisRule_ - js_wrapper m_nMinVal; - js_wrapper m_nMaxValRule; // c_oAscValAxisRule_ - js_wrapper m_nMaxVal; - - js_wrapper m_bInsertValOrder; - - js_wrapper m_bLogScale; - js_wrapper m_nLogBase; - - js_wrapper m_nDispUnitsRule; // c_oAscValAxUnits_ - js_wrapper m_nUnits; // c_oAscValAxUnits_ - - js_wrapper m_bShowUnitsOnChart; - - js_wrapper m_nMajorTickMark; // c_oAscTickMark_ - js_wrapper m_nMinorTickMark; // c_oAscTickMark_ - - js_wrapper m_nTickLabelsPos; // c_oAscTickLabelsPos_ - - js_wrapper m_nCrossesRule; // c_oAscCrossesRule_ - js_wrapper m_nCrosses; - - js_wrapper m_nAxisType; // c_oAscAxisType_ - - public: - CAscValAxisSettings() - { - } - - LINK_PROPERTY_INT_JS(MinValRule) - LINK_PROPERTY_INT_JS(MinVal) - LINK_PROPERTY_INT_JS(MaxValRule) - LINK_PROPERTY_INT_JS(MaxVal) - - LINK_PROPERTY_BOOL_JS(InsertValOrder) - - LINK_PROPERTY_BOOL_JS(LogScale) - LINK_PROPERTY_INT_JS(LogBase) - - LINK_PROPERTY_INT_JS(DispUnitsRule) - LINK_PROPERTY_INT_JS(Units) - - LINK_PROPERTY_BOOL_JS(ShowUnitsOnChart) - - LINK_PROPERTY_INT_JS(MajorTickMark) - LINK_PROPERTY_INT_JS(MinorTickMark) - - LINK_PROPERTY_INT_JS(TickLabelsPos) - - LINK_PROPERTY_INT_JS(CrossesRule) - LINK_PROPERTY_INT_JS(Crosses) - - LINK_PROPERTY_INT_JS(AxisType) - }; - - class CAscCatAxisSettings - { - private: - js_wrapper m_dIntervalBetweenTick; - js_wrapper m_nIntervalBetweenLabelsRule; // c_oAscBetweenLabelsRule_ - js_wrapper m_dIntervalBetweenLabels; - - js_wrapper m_bInvertCatOrder; - js_wrapper m_dLabelsAxisDistance; - - js_wrapper m_nMajorTickMark; // c_oAscTickMark_ - js_wrapper m_nMinorTickMark; // c_oAscTickMark_ - - js_wrapper m_nTickLabelsPos; // c_oAscTickLabelsPos_ - - js_wrapper m_nCrossesRule; // c_oAscCrossesRule_ - js_wrapper m_nCrosses; - - js_wrapper m_nLabelsPosition; // c_oAscLabelsPosition_ - - js_wrapper m_nAxisType; // c_oAscAxisType_ - - js_wrapper m_nCrossMinVal; - js_wrapper m_nCrossMaxVal; - - public: - CAscCatAxisSettings() - { - } - - LINK_PROPERTY_DOUBLE_JS(IntervalBetweenTick) - LINK_PROPERTY_INT_JS(IntervalBetweenLabelsRule) - LINK_PROPERTY_DOUBLE_JS(IntervalBetweenLabels) - - LINK_PROPERTY_BOOL_JS(InvertCatOrder) - LINK_PROPERTY_DOUBLE_JS(LabelsAxisDistance) - - LINK_PROPERTY_INT_JS(MajorTickMark) - LINK_PROPERTY_INT_JS(MinorTickMark) - LINK_PROPERTY_INT_JS(TickLabelsPos) - LINK_PROPERTY_INT_JS(CrossesRule) - LINK_PROPERTY_INT_JS(Crosses) - LINK_PROPERTY_INT_JS(LabelsPosition) - LINK_PROPERTY_INT_JS(AxisType) - - LINK_PROPERTY_INT_JS(CrossMinVal) - LINK_PROPERTY_INT_JS(CrossMaxVal) - }; - - class CAscChartProperties : public IMenuEventDataBase - { - private: - js_wrapper m_nStyle; - js_wrapper m_nTitle; // c_oAscChartTitleShowSettings_ - - js_wrapper m_nRowCols; - - js_wrapper m_nHorAxisLabel; // c_oAscChartHorAxisLabelShowSettings_ - js_wrapper m_nVertAxisLabel; // c_oAscChartVertAxisLabelShowSettings_ - - js_wrapper m_nLegendPos; // c_oAscChartLegendShowSettings_ - js_wrapper m_nDataLabelPos; // c_oAscChartDataLabelsPos_ - - js_wrapper m_nHorAx; - js_wrapper m_nVertAx; - - js_wrapper m_nHorGridLines; // c_oAscGridLinesSettings_ - js_wrapper m_nVertGridLines; // c_oAscGridLinesSettings_ - - js_wrapper m_nType; - - js_wrapper m_bShowSerName; - js_wrapper m_bShowCatName; - js_wrapper m_bShowVal; - - js_wrapper m_sSeparator; - - js_wrapper m_oHorValAxisProps; - js_wrapper m_oVertValAxisProps; - - js_wrapper m_oHorCatAxisProps; - js_wrapper m_oVertCatAxisProps; - - js_wrapper m_sRange; - js_wrapper m_bInColumns; - - js_wrapper m_bShowMarker; - js_wrapper m_bLine; - js_wrapper m_bSmooth; - - public: - CAscChartProperties() - { - } - virtual ~CAscChartProperties() - { - } - - LINK_PROPERTY_INT_JS(Style) - LINK_PROPERTY_INT_JS(Title) - - LINK_PROPERTY_INT_JS(RowCols) - - LINK_PROPERTY_INT_JS(HorAxisLabel) - LINK_PROPERTY_INT_JS(VertAxisLabel) - - LINK_PROPERTY_INT_JS(LegendPos) - LINK_PROPERTY_INT_JS(DataLabelPos) - LINK_PROPERTY_INT_JS(HorAx) - LINK_PROPERTY_INT_JS(VertAx) - - LINK_PROPERTY_INT_JS(HorGridLines) - LINK_PROPERTY_INT_JS(VertGridLines) - LINK_PROPERTY_INT_JS(Type) - - LINK_PROPERTY_BOOL_JS(ShowSerName) - LINK_PROPERTY_BOOL_JS(ShowCatName) - LINK_PROPERTY_BOOL_JS(ShowVal) - - LINK_PROPERTY_STRING_JS(Separator) - - LINK_PROPERTY_OBJECT_JS(CAscValAxisSettings, HorValAxisProps) - LINK_PROPERTY_OBJECT_JS(CAscValAxisSettings, VertValAxisProps) - - LINK_PROPERTY_OBJECT_JS(CAscCatAxisSettings, HorCatAxisProps) - LINK_PROPERTY_OBJECT_JS(CAscCatAxisSettings, VertCatAxisProps) - - LINK_PROPERTY_STRING_JS(Range) - LINK_PROPERTY_BOOL_JS(InColumns) - - LINK_PROPERTY_BOOL_JS(ShowMarker) - LINK_PROPERTY_BOOL_JS(Line) - LINK_PROPERTY_BOOL_JS(Smooth) - }; - - class CAscImageProp : public IMenuEventDataBase - { - private: - js_wrapper m_bCanBeFlow; - - js_wrapper m_dWidth; - js_wrapper m_dHeight; - - js_wrapper m_nWrappingStyle; - - js_wrapper m_oPaddings; - js_wrapper m_oPosition; - - js_wrapper m_bAllowOverlap; - - js_wrapper m_oPositionH; - js_wrapper m_oPositionV; - - js_wrapper m_nInternalPosition; - - js_wrapper m_sUrl; - js_wrapper m_bLocked; - - js_wrapper m_oChartProperties; - js_wrapper m_oShapeProperties; - - js_wrapper m_nChangeLevel; - js_wrapper m_nGroup; - - js_wrapper m_bFromGroup; - - js_wrapper m_bSeveralCharts; - js_wrapper m_nSeveralChartTypes; - js_wrapper m_nSeveralChartStyles; - - js_wrapper m_nVerticalTextAlign; - - // только для выставления - js_wrapper m_oChangeImage; - js_wrapper m_bSetOriginalSize; - - public: - CAscImageProp() - { - } - virtual ~CAscImageProp() - { - } - - LINK_PROPERTY_BOOL_JS(CanBeFlow) - - LINK_PROPERTY_DOUBLE_JS(Width) - LINK_PROPERTY_DOUBLE_JS(Height) - - LINK_PROPERTY_INT_JS(WrappingStyle) - - LINK_PROPERTY_OBJECT_JS(CAscPaddings, Paddings) - LINK_PROPERTY_OBJECT_JS(CAscPosition, Position) - - LINK_PROPERTY_BOOL_JS(AllowOverlap) - - LINK_PROPERTY_OBJECT_JS(CAscImagePosition, PositionH) - LINK_PROPERTY_OBJECT_JS(CAscImagePosition, PositionV) - - LINK_PROPERTY_INT_JS(InternalPosition) - - LINK_PROPERTY_STRING_JS(Url) - LINK_PROPERTY_BOOL_JS(Locked) - - LINK_PROPERTY_OBJECT_JS(CAscChartProperties, ChartProperties) - LINK_PROPERTY_OBJECT_JS(CAscShapeProp, ShapeProperties) - - LINK_PROPERTY_INT_JS(ChangeLevel) - - LINK_PROPERTY_INT_JS(Group) - LINK_PROPERTY_BOOL_JS(FromGroup) - LINK_PROPERTY_BOOL_JS(SeveralCharts) - - LINK_PROPERTY_INT_JS(SeveralChartTypes) - LINK_PROPERTY_INT_JS(SeveralChartStyles) - LINK_PROPERTY_INT_JS(VerticalTextAlign) - - LINK_PROPERTY_OBJECT_JS(CAscInsertImage, ChangeImage) - LINK_PROPERTY_BOOL_JS(SetOriginalSize) - }; -} - -// section -namespace NSEditorApi -{ - class CAscSection : public IMenuEventDataBase - { - private: - js_wrapper m_dPageWidth; - js_wrapper m_dPageHeight; - - js_wrapper m_dMarginLeft; - js_wrapper m_dMarginRight; - js_wrapper m_dMarginTop; - js_wrapper m_dMarginBottom; - - js_wrapper m_bPortrait; - - public: - CAscSection() - { - } - virtual ~CAscSection() - { - } - - LINK_PROPERTY_DOUBLE_JS(PageWidth) - LINK_PROPERTY_DOUBLE_JS(PageHeight) - LINK_PROPERTY_DOUBLE_JS(MarginLeft) - LINK_PROPERTY_DOUBLE_JS(MarginRight) - LINK_PROPERTY_DOUBLE_JS(MarginTop) - LINK_PROPERTY_DOUBLE_JS(MarginBottom) - LINK_PROPERTY_BOOL_JS(Portrait) - }; -} - -// text -namespace NSEditorApi -{ - class CAscListType - { - private: - js_wrapper m_nType; - js_wrapper m_nSubType; - - public: - - CAscListType() - { - } - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_INT_JS(SubType) - }; - - class CAscTextFontFamily - { - private: - js_wrapper m_sName; - js_wrapper m_nIndex; - - public: - - CAscTextFontFamily() - { - m_sName = L"Times New Roman"; - m_nIndex = -1; - } - CAscTextFontFamily(const CAscTextFontFamily& oSrc) - { - m_sName = oSrc.m_sName; - m_nIndex = oSrc.m_nIndex; - } - - LINK_PROPERTY_STRING_JS(Name) - LINK_PROPERTY_INT_JS(Index) - }; - - class CAscTextPr : public IMenuEventDataBase - { - private: - js_wrapper m_bBold; - js_wrapper m_bItalic; - js_wrapper m_bUnderline; - js_wrapper m_bStrikeout; - - js_wrapper m_oFontFamily; - js_wrapper m_dFontSize; - - js_wrapper m_oColor; - - js_wrapper m_nVertAlign; - js_wrapper m_oHighLight; // null = none. undefined = no init - - js_wrapper m_bDStrikeout; - - js_wrapper m_bCaps; - js_wrapper m_bSmallCaps; - - js_wrapper m_dSpacing; - - public: - - CAscTextPr() - { - } - virtual ~CAscTextPr() - { - } - - LINK_PROPERTY_BOOL_JS(Bold) - LINK_PROPERTY_BOOL_JS(Italic) - LINK_PROPERTY_BOOL_JS(Underline) - LINK_PROPERTY_BOOL_JS(Strikeout) - - LINK_PROPERTY_OBJECT_JS(CAscTextFontFamily, FontFamily) - - LINK_PROPERTY_DOUBLE_JS(FontSize) - LINK_PROPERTY_INT_JS(VertAlign) - - LINK_PROPERTY_OBJECT_JS(CAscColor, Color) - LINK_PROPERTY_OBJECT_JS(CAscColor, HighLight) - - LINK_PROPERTY_BOOL_JS(DStrikeout) - LINK_PROPERTY_BOOL_JS(Caps) - LINK_PROPERTY_BOOL_JS(SmallCaps) - - LINK_PROPERTY_DOUBLE_JS(Spacing) - }; - - class CAscParagraphInd - { - private: - js_wrapper m_dLeft; - js_wrapper m_dRight; - js_wrapper m_dFirstLine; - - public: - CAscParagraphInd() - { - } - - LINK_PROPERTY_DOUBLE_JS(Left) - LINK_PROPERTY_DOUBLE_JS(Right) - LINK_PROPERTY_DOUBLE_JS(FirstLine) - }; - - class CAscParagraphSpacing - { - private: - js_wrapper m_dLine; - js_wrapper m_nLineRule; - js_wrapper m_dBefore; - js_wrapper m_bBeforeAuto; - js_wrapper m_dAfter; - js_wrapper m_bAfterAuto; - - public: - - CAscParagraphSpacing() - { - } - - LINK_PROPERTY_DOUBLE_JS(Line) - LINK_PROPERTY_INT_JS(LineRule) - LINK_PROPERTY_DOUBLE_JS(Before) - LINK_PROPERTY_DOUBLE_JS(After) - LINK_PROPERTY_BOOL_JS(BeforeAuto) - LINK_PROPERTY_BOOL_JS(AfterAuto) - }; - - class CAscParagraphShd - { - private: - js_wrapper m_nType; - js_wrapper m_oColor; - - public: - - CAscParagraphShd() - { - } - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_OBJECT_JS(CAscColor, Color) - }; - - class CAscBorder - { - private: - js_wrapper m_oColor; - js_wrapper m_dSize; - js_wrapper m_nValue; - js_wrapper m_dSpace; - - public: - - CAscBorder() - { - } - - LINK_PROPERTY_OBJECT_JS(CAscColor, Color) - LINK_PROPERTY_DOUBLE_JS(Size) - LINK_PROPERTY_INT_JS(Value) - LINK_PROPERTY_DOUBLE_JS(Space) - }; - - class CAscParagraphBorders - { - private: - js_wrapper m_oLeft; - js_wrapper m_oTop; - js_wrapper m_oRight; - js_wrapper m_oBottom; - js_wrapper m_oBetween; - - public: - - CAscParagraphBorders() - { - } - - LINK_PROPERTY_OBJECT_JS(CAscBorder, Left) - LINK_PROPERTY_OBJECT_JS(CAscBorder, Top) - LINK_PROPERTY_OBJECT_JS(CAscBorder, Right) - LINK_PROPERTY_OBJECT_JS(CAscBorder, Bottom) - LINK_PROPERTY_OBJECT_JS(CAscBorder, Between) - }; - - class CAscParagraphTab - { - private: - js_wrapper m_dPos; - js_wrapper m_nValue; - - public: - - CAscParagraphTab() - { - } - - LINK_PROPERTY_DOUBLE_JS(Pos) - LINK_PROPERTY_INT_JS(Value) - }; - - class CAscParagraphTabs - { - private: - CAscParagraphTab* m_pTabs; - int m_lCount; - - public: - - CAscParagraphTabs() - { - m_pTabs = NULL; - m_lCount = 0; - } - ~CAscParagraphTabs() - { - if (NULL != m_pTabs) - delete [] m_pTabs; - } - - int GetCount() { return m_lCount; } - CAscParagraphTab* GetTabs() { return m_pTabs; } - void SetTabs(CAscParagraphTab* pTabs, int nCount) - { - m_pTabs = pTabs; - m_lCount = nCount; - } - }; - - class CAscParagraphFrame - { - private: - js_wrapper m_bFromDropCapMenu; - js_wrapper m_nDropCap; // c_oAscDropCap_ - - js_wrapper m_dW; - js_wrapper m_dH; - - js_wrapper m_nHAnchor; - js_wrapper m_nHRule; // linerule_ - js_wrapper m_dHSpace; - - js_wrapper m_nVAnchor; - js_wrapper m_dVSpace; - - js_wrapper m_dX; - js_wrapper m_dY; - - js_wrapper m_nXAlign; - js_wrapper m_nYAlign; - - js_wrapper m_nLines; - js_wrapper m_nWrap; // c_oAsc_wrap_ - - js_wrapper m_oBrd; - js_wrapper m_oShd; - js_wrapper m_oFontFamily; - - public: - CAscParagraphFrame() - { - } - - LINK_PROPERTY_BOOL_JS(FromDropCapMenu) - LINK_PROPERTY_INT_JS(DropCap) - - LINK_PROPERTY_DOUBLE_JS(W) - LINK_PROPERTY_DOUBLE_JS(H) - - LINK_PROPERTY_INT_JS(HAnchor) - LINK_PROPERTY_INT_JS(HRule) - LINK_PROPERTY_DOUBLE_JS(HSpace) - - LINK_PROPERTY_INT_JS(VAnchor) - LINK_PROPERTY_DOUBLE_JS(VSpace) - - LINK_PROPERTY_DOUBLE_JS(X) - LINK_PROPERTY_DOUBLE_JS(Y) - - LINK_PROPERTY_INT_JS(XAlign) - LINK_PROPERTY_INT_JS(YAlign) - - LINK_PROPERTY_INT_JS(Lines) - LINK_PROPERTY_INT_JS(Wrap) - - LINK_PROPERTY_OBJECT_JS(CAscParagraphBorders, Brd) - LINK_PROPERTY_OBJECT_JS(CAscParagraphShd, Shd) - LINK_PROPERTY_OBJECT_JS(CAscTextFontFamily, FontFamily) - }; - - class CAscParagraphPr : public IMenuEventDataBase - { - private: - js_wrapper m_bContextualSpacing; - - js_wrapper m_oInd; - - js_wrapper m_bKeepLines; - js_wrapper m_bKeepNext; - js_wrapper m_bWidowControl; - js_wrapper m_bPageBreakBefore; - - js_wrapper m_oSpacing; - - js_wrapper m_oBrd; - js_wrapper m_oShd; - - js_wrapper m_bLocked; - js_wrapper m_bCanAddTable; - js_wrapper m_bCanAddDropCap; - - js_wrapper m_dDefaultTab; - js_wrapper m_oTabs; - - js_wrapper m_oFramePr; - - js_wrapper m_bSubscript; - js_wrapper m_bSuperscript; - js_wrapper m_bSmallCaps; - js_wrapper m_bAllCaps; - js_wrapper m_bStrikeout; - js_wrapper m_bDStrikeout; - - js_wrapper m_dTextSpacing; - js_wrapper m_dPosition; - - js_wrapper m_oListType; - js_wrapper m_sStyle; - js_wrapper m_nJc; - - public: - - CAscParagraphPr() - { - } - virtual ~CAscParagraphPr() - { - } - - LINK_PROPERTY_BOOL_JS(ContextualSpacing) - - LINK_PROPERTY_OBJECT_JS(CAscParagraphInd, Ind) - - LINK_PROPERTY_BOOL_JS(KeepLines) - LINK_PROPERTY_BOOL_JS(KeepNext) - LINK_PROPERTY_BOOL_JS(WidowControl) - LINK_PROPERTY_BOOL_JS(PageBreakBefore) - - LINK_PROPERTY_OBJECT_JS(CAscParagraphSpacing, Spacing) - - LINK_PROPERTY_OBJECT_JS(CAscParagraphBorders, Brd) - LINK_PROPERTY_OBJECT_JS(CAscParagraphShd, Shd) - - LINK_PROPERTY_BOOL_JS(Locked) - LINK_PROPERTY_BOOL_JS(CanAddTable) - LINK_PROPERTY_BOOL_JS(CanAddDropCap) - - LINK_PROPERTY_DOUBLE_JS(DefaultTab) - LINK_PROPERTY_OBJECT_JS(CAscParagraphTabs, Tabs) - - LINK_PROPERTY_OBJECT_JS(CAscParagraphFrame, FramePr) - - LINK_PROPERTY_BOOL_JS(Subscript) - LINK_PROPERTY_BOOL_JS(Superscript) - LINK_PROPERTY_BOOL_JS(SmallCaps) - LINK_PROPERTY_BOOL_JS(AllCaps) - LINK_PROPERTY_BOOL_JS(Strikeout) - LINK_PROPERTY_BOOL_JS(DStrikeout) - - LINK_PROPERTY_DOUBLE_JS(TextSpacing) - LINK_PROPERTY_DOUBLE_JS(Position) - - LINK_PROPERTY_OBJECT_JS(CAscListType, ListType) - LINK_PROPERTY_STRING_JS(Style) - LINK_PROPERTY_INT_JS(Jc) - }; -} - -// table -namespace NSEditorApi -{ - class CAscCellMargins - { - private: - js_wrapper m_dLeft; - js_wrapper m_dTop; - js_wrapper m_dRight; - js_wrapper m_dBottom; - js_wrapper m_nFlag; - - public: - CAscCellMargins() - { - } - - LINK_PROPERTY_DOUBLE_JS(Left) - LINK_PROPERTY_DOUBLE_JS(Top) - LINK_PROPERTY_DOUBLE_JS(Right) - LINK_PROPERTY_DOUBLE_JS(Bottom) - LINK_PROPERTY_INT_JS(Flag) - }; - - class CAscTableBorders - { - private: - js_wrapper m_oLeft; - js_wrapper m_oTop; - js_wrapper m_oRight; - js_wrapper m_oBottom; - js_wrapper m_oInsideH; - js_wrapper m_oInsideV; - - public: - - CAscTableBorders() - { - } - - LINK_PROPERTY_OBJECT_JS(CAscBorder, Left) - LINK_PROPERTY_OBJECT_JS(CAscBorder, Top) - LINK_PROPERTY_OBJECT_JS(CAscBorder, Right) - LINK_PROPERTY_OBJECT_JS(CAscBorder, Bottom) - LINK_PROPERTY_OBJECT_JS(CAscBorder, InsideH) - LINK_PROPERTY_OBJECT_JS(CAscBorder, InsideV) - }; - - class CAscCellBackground - { - private: - js_wrapper m_oColor; - js_wrapper m_nValue; - - public: - CAscCellBackground() - { - } - - LINK_PROPERTY_OBJECT_JS(CAscColor, Color) - LINK_PROPERTY_INT_JS(Value) - }; - - class CAscTableLook - { - private: - js_wrapper m_bFirstCol; - js_wrapper m_bFirstRow; - js_wrapper m_bLastCol; - js_wrapper m_bLastRow; - js_wrapper m_bBandHor; - js_wrapper m_bBandVer; - - public: - CAscTableLook() - { - } - - LINK_PROPERTY_BOOL_JS(FirstCol) - LINK_PROPERTY_BOOL_JS(FirstRow) - LINK_PROPERTY_BOOL_JS(LastCol) - LINK_PROPERTY_BOOL_JS(LastRow) - LINK_PROPERTY_BOOL_JS(BandHor) - LINK_PROPERTY_BOOL_JS(BandVer) - }; - - class CAscTableAnchorPosition - { - public: - // Рассчитанные координаты - double CalcX; - double CalcY; - - // Данные для Flow-объектов - double W; - double H; - double X; - double Y; - double Left_Margin; - double Right_Margin; - double Top_Margin; - double Bottom_Margin; - double Page_W; - double Page_H; - - double X_min; - double Y_min; - double X_max; - double Y_max; - - public: - CAscTableAnchorPosition() - { - CalcX = 0; - CalcY = 0; - - W = 0; - H = 0; - X = 0; - Y = 0; - Left_Margin = 0; - Right_Margin = 0; - Top_Margin = 0; - Bottom_Margin = 0; - Page_W = 0; - Page_H = 0; - - X_min = 0; - Y_min = 0; - X_max = 0; - Y_max = 0; - } - - // По значению CalcX получем Value - double Calculate_X_Value(const int& RelativeFrom) - { - switch (RelativeFrom) - { - case c_oAscHAnchor_Text: - case c_oAscHAnchor_Margin: - { - return CalcX - Left_Margin; - } - case c_oAscHAnchor_Page: - { - return CalcX - X_min; - } - case c_oAscHAnchor_PageInternal: - { - return CalcX; - } - default: - break; - } - - return 0; - } - - // По значению CalcY и заданному RelativeFrom получем Value - double Calculate_Y_Value(const int& RelativeFrom) - { - switch (RelativeFrom) - { - case c_oAscVAnchor_Margin: - { - return CalcY - Top_Margin; - } - case c_oAscVAnchor_Page: - { - return CalcY; - } - case c_oAscVAnchor_Text: - { - return CalcY - Y; - } - } - - return 0; - } - }; - - class CAscTableCellSplit - { - public: - int Rows; - int Cols; - - CAscTableCellSplit() - { - Rows = 0; - Cols = 0; - } - }; - - class CAscTableProperties : public IMenuEventDataBase - { - private: - js_wrapper m_bCanBeFlow; - js_wrapper m_bCellSelect; - - js_wrapper m_dWidth; - js_wrapper m_dSpacing; - - js_wrapper m_oDefaultMargins; - js_wrapper m_oCellMargins; - - js_wrapper m_nAlignment; - js_wrapper m_dIndent; - - js_wrapper m_nWrappingStyle; - - js_wrapper m_oPaddings; - - js_wrapper m_oTableBorders; - js_wrapper m_oCellBorders; - - js_wrapper m_oTableBackground; - js_wrapper m_oCellBackground; - - js_wrapper m_oPosition; - - js_wrapper m_oPositionH; - js_wrapper m_oPositionV; - - js_wrapper m_oInternalPosition; - - js_wrapper m_bForSelectedCells; - js_wrapper m_sStyle; - js_wrapper m_oLook; - js_wrapper m_nRowsInHeader; - js_wrapper m_nCellsVAlign; // c_oAscVertAlignJc_ - - js_wrapper m_bAllowOverlap; - - js_wrapper m_nLayout; - js_wrapper m_bLocked; - - public: - CAscTableProperties() - { - m_bCellSelect = false; - m_bLocked = false; - } - virtual ~CAscTableProperties() - { - } - - LINK_PROPERTY_BOOL_JS(CanBeFlow) - LINK_PROPERTY_BOOL_JS(CellSelect) - - LINK_PROPERTY_DOUBLE_JS(Width) - LINK_PROPERTY_DOUBLE_JS(Spacing) - - LINK_PROPERTY_OBJECT_JS(CAscPaddings, DefaultMargins) - LINK_PROPERTY_OBJECT_JS(CAscCellMargins, CellMargins) - - LINK_PROPERTY_INT_JS(Alignment) - LINK_PROPERTY_DOUBLE_JS(Indent) - LINK_PROPERTY_INT_JS(WrappingStyle) - - LINK_PROPERTY_OBJECT_JS(CAscPaddings, Paddings) - LINK_PROPERTY_OBJECT_JS(CAscTableBorders, TableBorders) - LINK_PROPERTY_OBJECT_JS(CAscTableBorders, CellBorders) - LINK_PROPERTY_OBJECT_JS(CAscCellBackground, TableBackground) - LINK_PROPERTY_OBJECT_JS(CAscCellBackground, CellBackground) - LINK_PROPERTY_OBJECT_JS(CAscPosition, Position) - LINK_PROPERTY_OBJECT_JS(CAscImagePosition, PositionH) - LINK_PROPERTY_OBJECT_JS(CAscImagePosition, PositionV) - - LINK_PROPERTY_OBJECT_JS(CAscTableAnchorPosition, InternalPosition) - - LINK_PROPERTY_BOOL_JS(ForSelectedCells) - LINK_PROPERTY_STRING_JS(Style) - LINK_PROPERTY_OBJECT_JS(CAscTableLook, Look) - - LINK_PROPERTY_INT_JS(RowsInHeader) - LINK_PROPERTY_INT_JS(CellsVAlign) - - LINK_PROPERTY_BOOL_JS(AllowOverlap) - LINK_PROPERTY_INT_JS(Layout) - LINK_PROPERTY_BOOL_JS(Locked) - - double get_Value_X(const int& RelativeFrom) - { - if (m_oInternalPosition.IsInit()) - return m_oInternalPosition->Calculate_X_Value(RelativeFrom); - return 0; - } - double get_Value_Y(const int& RelativeFrom) - { - if (m_oInternalPosition.IsInit()) - return m_oInternalPosition->Calculate_Y_Value(RelativeFrom); - return 0; - } - }; - - class CAscTableInsertDeleteRowColumn : public IMenuEventDataBase - { - public: - js_wrapper m_bAbove; - js_wrapper m_bIsAdd; // true - add, false - remove - js_wrapper m_nType; // 1 - column, 2 - row - - public: - CAscTableInsertDeleteRowColumn() - { - } - virtual ~CAscTableInsertDeleteRowColumn() - { - } - - LINK_PROPERTY_BOOL_JS(Above) - LINK_PROPERTY_BOOL_JS(IsAdd) - LINK_PROPERTY_INT_JS(Type) - }; -} - -// header/footer -namespace NSEditorApi -{ - class CAscHeaderFooterPr : public IMenuEventDataBase - { - private: - js_wrapper m_nType; - js_wrapper m_dPosition; - js_wrapper m_bDifferentFirst; - js_wrapper m_bDifferentEvenOdd; - js_wrapper m_bLinkToPrevious; - js_wrapper m_bLocked; - - public: - - CAscHeaderFooterPr() - { - } - virtual ~CAscHeaderFooterPr() - { - } - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_DOUBLE_JS(Position) - LINK_PROPERTY_BOOL_JS(DifferentFirst) - LINK_PROPERTY_BOOL_JS(DifferentEvenOdd) - LINK_PROPERTY_BOOL_JS(LinkToPrevious) - LINK_PROPERTY_BOOL_JS(Locked) - }; -} - -// hyperlink -namespace NSEditorApi -{ - class CAscHyperlinkPr : public IMenuEventDataBase - { - private: - js_wrapper m_sText; - js_wrapper m_sValue; - js_wrapper m_sToolTip; - - public: - - CAscHyperlinkPr() - { - } - virtual ~CAscHyperlinkPr() - { - } - - LINK_PROPERTY_STRING_JS(Text) - LINK_PROPERTY_STRING_JS(Value) - LINK_PROPERTY_STRING_JS(ToolTip) - }; -} - -// common -namespace NSEditorApi -{ - class CAscColorScheme : public IMenuEventDataBase - { - private: - std::wstring m_sName; - - bool m_bIsDelete; - CAscColorSimple* m_pColors; - int m_lColorsCount; - - public: - CAscColorScheme() - { - m_sName = L""; - m_bIsDelete = true; - m_pColors = NULL; - m_lColorsCount = 0; - } - virtual ~CAscColorScheme() - { - if (m_bIsDelete) - { - if (NULL != m_pColors) - delete [] m_pColors; - m_pColors = NULL; - } - } - - void Create(const std::wstring& sName, const bool& bDelete, const int& nCountColors) - { - if (m_bIsDelete) - { - if (NULL != m_pColors) - delete [] m_pColors; - m_pColors = NULL; - } - - m_sName = sName; - m_bIsDelete = bDelete; - m_lColorsCount = nCountColors; - - if (0 < m_lColorsCount) - { - m_pColors = new CAscColorSimple[m_lColorsCount]; - } - } - - LINK_PROPERTY_STRING(Name) - - inline int get_ColorsCount() { return m_lColorsCount; } - inline CAscColorSimple* get_Colors() { return m_pColors; } - void put_AscColorSimple(CAscColorSimple* pColors, int lCount) - { - if (NULL != m_pColors) - delete [] m_pColors; - m_pColors = pColors; - m_lColorsCount = lCount; - } - }; - - class CAscTexture : public IMenuEventDataBase - { - private: - int m_nId; - std::wstring m_sImage; - - public: - CAscTexture() - { - m_nId = 0; - m_sImage = L""; - } - virtual ~CAscTexture() - { - } - - LINK_PROPERTY_INT(Id) - LINK_PROPERTY_STRING(Image) - }; -} - -// insert -namespace NSEditorApi -{ - class CAscInsertTable : public IMenuEventDataBase - { - private: - js_wrapper m_sStyle; - js_wrapper m_nColumns; - js_wrapper m_nRows; - - public: - CAscInsertTable() - { - } - virtual ~CAscInsertTable() - { - } - - LINK_PROPERTY_STRING_JS(Style) - LINK_PROPERTY_INT_JS(Columns) - LINK_PROPERTY_INT_JS(Rows) - }; - - typedef CAscShapeProp CAscInsertShape; - typedef CAscHyperlinkPr CAscInsertHyperlink; - - class CAscMethodParamInt : public IMenuEventDataBase - { - private: - js_wrapper m_nValue; - - public: - CAscMethodParamInt() - { - } - virtual ~CAscMethodParamInt() - { - } - - LINK_PROPERTY_INT_JS(Value) - }; - - typedef CAscMethodParamInt CAscInsertSectionBreak; - typedef CAscMethodParamInt CAscInsertPageNumber; -} - -namespace NSEditorApi -{ - class CAscStyleImage - { - public: - std::wstring Name; - int NameNum; - - CAscImageRaw Image; - - public: - CAscStyleImage() - { - NameNum = -1; - } - }; - - class CAscStyleImages : public IMenuEventDataBase - { - public: - std::vector m_arStyles; - - CAscStyleImages() - { - } - virtual ~CAscStyleImages() - { - } - - public: - void SetReleaseAll() - { - for (std::vector::iterator iter = m_arStyles.begin(); iter != m_arStyles.end(); iter++) - { - iter->Image.Release = true; - } - } - }; -} - -namespace NSEditorApi -{ - class CAscSearchFindText : public IMenuEventDataBase - { - private: - std::wstring m_sText; - bool m_bIsNext; - bool m_bIsMatchCase; - - public: - CAscSearchFindText() - { - } - virtual ~CAscSearchFindText() - { - } - - LINK_PROPERTY_STRING(Text) - LINK_PROPERTY_BOOL(IsNext) - LINK_PROPERTY_BOOL(IsMatchCase) - }; - class CAscSearchReplaceText : public IMenuEventDataBase - { - private: - std::wstring m_sText; - std::wstring m_sReplaceWith; - bool m_bIsReplaceAll; - bool m_bIsMatchCase; - - public: - CAscSearchReplaceText() - { - } - virtual ~CAscSearchReplaceText() - { - } - - LINK_PROPERTY_STRING(Text) - LINK_PROPERTY_STRING(ReplaceWith) - LINK_PROPERTY_BOOL(IsReplaceAll) - LINK_PROPERTY_BOOL(IsMatchCase) - }; -} - - - -namespace NSEditorApi -{ - class CAscMath : public IMenuEventDataBase - { - private: - js_wrapper m_nType; - js_wrapper m_nAction; - js_wrapper m_bCanIncreaseArgumentSize; - js_wrapper m_bCanDecreaseArgumentSize; - js_wrapper m_bCanInsertForcedBreak; - js_wrapper m_bCanDeleteForcedBreak; - js_wrapper m_bCanAlignToCharacter; - - public: - CAscMath() - { - } - virtual ~CAscMath() - { - } - - LINK_PROPERTY_INT_JS(Type) - LINK_PROPERTY_INT_JS(Action) - LINK_PROPERTY_BOOL_JS(CanIncreaseArgumentSize) - LINK_PROPERTY_BOOL_JS(CanDecreaseArgumentSize); - LINK_PROPERTY_BOOL_JS(CanInsertForcedBreak); - LINK_PROPERTY_BOOL_JS(CanDeleteForcedBreak); - LINK_PROPERTY_BOOL_JS(CanAlignToCharacter); - }; -} - -namespace NSEditorApi -{ - class CAscMenuEvent : public IMenuEventDataBase - { - public: - int m_nType; - IMenuEventDataBase* m_pData; - - public: - CAscMenuEvent(int nType = -1) - : m_nType(nType) - , m_pData(NULL) - { - } - virtual ~CAscMenuEvent() - { - if (NULL != m_pData) - m_pData->Release(); - } - }; - - class CAscMenuEventStackData : public IMenuEventDataBase - { - public: - std::vector m_data; - - public: - CAscMenuEventStackData() - { - } - virtual ~CAscMenuEventStackData() - { - for (std::vector::iterator i = m_data.begin(); i != m_data.end(); ++i) - { - CAscMenuEvent* data = *i; - if (NULL != data) - data->Release(); - } - } - }; - - class CAscMenuEventListener - { - public: - // memory release!!! - virtual void OnEvent(CAscMenuEvent* pEvent) - { - if (NULL != pEvent) - pEvent->Release(); - } - virtual bool IsSupportEvent(int nEventType) - { - return true; - } - - void Invoke(int nEventType) - { - NSEditorApi::CAscMenuEvent* pEvent = new NSEditorApi::CAscMenuEvent(); - if (pEvent) - { - pEvent->m_nType = nEventType; - OnEvent(pEvent); - } - } - }; - - class CAscMenuController - { - // release memory in sdk - virtual NSEditorApi::CAscMenuEvent* Apply(CAscMenuEvent* pEvent) - { - if (NULL != pEvent) - pEvent->Release(); - return NULL; - } - }; - - class CAscCefMenuEvent : public CAscMenuEvent - { - public: - int m_nSenderId; - - public: - CAscCefMenuEvent(int nType = -1) : CAscMenuEvent(nType) - { - m_nSenderId = -1; - } - virtual ~CAscCefMenuEvent() - { - } - - LINK_PROPERTY_INT(SenderId) - }; - - class CAscCefMenuEventListener - { - public: - // memory release!!! - virtual void OnEvent(CAscCefMenuEvent* pEvent) - { - if (NULL != pEvent) - pEvent->Release(); - } - virtual bool IsSupportEvent(int nEventType) - { - return true; - } - }; -} - -namespace NSEditorApi -{ - class CAscEditorSettings : public IMenuEventDataBase - { - public: - js_wrapper ParagraphStyleThumbnailWidth; - js_wrapper ParagraphStyleThumbnailHeight; - - js_wrapper TableStyleThumbnailWidth; - js_wrapper TableStyleThumbnailHeight; - - js_wrapper ChartStyleThumbnailWidth; - js_wrapper ChartStyleThumbnailHeight; - - js_wrapper ViewerMode; - - CAscEditorSettings() - { - } - - CAscEditorSettings(const CAscEditorSettings& oSrc) - { - ParagraphStyleThumbnailWidth = oSrc.ParagraphStyleThumbnailWidth; - ParagraphStyleThumbnailHeight = oSrc.ParagraphStyleThumbnailHeight; - - TableStyleThumbnailWidth = oSrc.TableStyleThumbnailWidth; - TableStyleThumbnailHeight = oSrc.TableStyleThumbnailHeight; - - ChartStyleThumbnailWidth = oSrc.ChartStyleThumbnailWidth; - ChartStyleThumbnailHeight = oSrc.ChartStyleThumbnailHeight; - - ViewerMode = oSrc.ViewerMode; - } - - CAscEditorSettings& operator=(const CAscEditorSettings& oSrc) - { - ParagraphStyleThumbnailWidth = oSrc.ParagraphStyleThumbnailWidth; - ParagraphStyleThumbnailHeight = oSrc.ParagraphStyleThumbnailHeight; - - TableStyleThumbnailWidth = oSrc.TableStyleThumbnailWidth; - TableStyleThumbnailHeight = oSrc.TableStyleThumbnailHeight; - - ChartStyleThumbnailWidth = oSrc.ChartStyleThumbnailWidth; - ChartStyleThumbnailHeight = oSrc.ChartStyleThumbnailHeight; - - ViewerMode = oSrc.ViewerMode; - - return *this; - } - - virtual ~CAscEditorSettings() - { - } - }; - - class CAscClipboardFormats : public IMenuEventDataBase - { - public: - js_wrapper Doct; - js_wrapper TextUnicode; - js_wrapper Image; - - CAscClipboardFormats() - { - } - - virtual ~CAscClipboardFormats() - { - } - }; - - class CAscContextMenuInfo : public IMenuEventDataBase - { - public: - bool Copy; - bool Cut; - bool Paste; - bool Delete; - bool Select; - bool SelectAll; - - // rect - CAscRect Rect; - - public: - CAscContextMenuInfo() - { - Copy = false; - Cut = false; - Paste = false; - Delete = false; - Select = false; - SelectAll = false; - } - virtual ~CAscContextMenuInfo() - { - } - }; - - class CAscPageScrollInfo : public IMenuEventDataBase - { - public: - int status; - int page; - int pages; - - public: - CAscPageScrollInfo() - { - status = 0; - page = 0; - pages = 0; - } - virtual ~CAscPageScrollInfo() - { - } - }; - - class CAscStatisticInfo : public IMenuEventDataBase - { - public: - int PageCount; - int WordsCount; - int ParagraphCount; - int SymbolsCount; - int SymbolsWSCount; - - public: - CAscStatisticInfo() - { - PageCount = 0; - WordsCount = 0; - ParagraphCount = 0; - SymbolsCount = 0; - SymbolsWSCount = 0; - } - virtual ~CAscStatisticInfo() - { - } - }; - - class CAscSColorScheme : public IMenuEventDataBase - { - public: - CAscSColorScheme() - { - - } - virtual ~CAscSColorScheme() - { - for (std::vector::iterator i = m_arColors.begin(); i != m_arColors.end(); ++i) - { - CAscColor* data = *i; - if (NULL != data) - data->Release(); - } - } - - LINK_PROPERTY_STRING_JS(Name); - - inline std::vector& GetColors() {return m_arColors;} - inline void AddColor(CAscColor* color) {m_arColors.push_back(color);} - - private: - - js_wrapper m_sName; - std::vector m_arColors; - }; - - class CAscColorSchemes : public IMenuEventDataBase - { - public: - CAscColorSchemes() - { - - } - virtual ~CAscColorSchemes() - { - for (std::vector::iterator i = m_arSchemes.begin(); i != m_arSchemes.end(); ++i) - { - CAscSColorScheme* data = *i; - if (NULL != data) - data->Release(); - } - } - - inline std::vector& GetSchemes() {return m_arSchemes;} - inline void AddScheme(CAscSColorScheme* oScheme) {m_arSchemes.push_back(oScheme);} - - private: - - std::vector m_arSchemes; - }; - -} - -namespace NSEditorApi -{ - class CAscLocalRecentsAll : public IMenuEventDataBase - { - private: - std::wstring m_sJSON; - int m_nId; - - public: - - CAscLocalRecentsAll() - { - m_nId = -1; - } - virtual ~CAscLocalRecentsAll() - { - } - - LINK_PROPERTY_STRING(JSON) - LINK_PROPERTY_INT(Id) - }; - - class CAscLocalOpenFileRecent_Recover : public IMenuEventDataBase - { - private: - int m_nId; - bool m_bIsRecover; - std::wstring m_sPath; - bool m_bIsRemove; - - public: - - CAscLocalOpenFileRecent_Recover() - { - m_bIsRecover = false; - m_bIsRemove = false; - } - virtual ~CAscLocalOpenFileRecent_Recover() - { - } - - LINK_PROPERTY_BOOL(IsRecover) - LINK_PROPERTY_BOOL(IsRemove) - LINK_PROPERTY_INT(Id) - LINK_PROPERTY_STRING(Path) - }; - - class CAscLocalFileOpen : public IMenuEventDataBase - { - private: - std::wstring m_sDirectory; - - public: - - CAscLocalFileOpen() - { - } - virtual ~CAscLocalFileOpen() - { - } - - LINK_PROPERTY_STRING(Directory) - }; - - class CAscLocalFileCreate : public IMenuEventDataBase - { - private: - int m_nType; - - public: - - CAscLocalFileCreate() - { - } - virtual ~CAscLocalFileCreate() - { - } - - LINK_PROPERTY_INT(Type) - }; -} - -namespace NSEditorApi -{ - class CAscExecCommand : public IMenuEventDataBase - { - private: - std::wstring m_sCommand; - std::wstring m_sParam; - - public: - - CAscExecCommand() - { - } - virtual ~CAscExecCommand() - { - } - - LINK_PROPERTY_STRING(Command) - LINK_PROPERTY_STRING(Param) - }; - - class CAscExecCommandJS : public IMenuEventDataBase - { - private: - std::wstring m_sCommand; - std::wstring m_sParam; - std::wstring m_sFrameName; - - public: - - CAscExecCommandJS() - { - } - virtual ~CAscExecCommandJS() - { - } - - LINK_PROPERTY_STRING(Command) - LINK_PROPERTY_STRING(Param) - LINK_PROPERTY_STRING(FrameName) - }; -} - -namespace NSEditorApi -{ - class CAscError : public IMenuEventDataBase - { - private: - int m_nId; - int m_nLevel; - std::wstring m_sMessage; - - public: - - CAscError() - { - } - virtual ~CAscError() - { - } - - LINK_PROPERTY_INT(Id) - LINK_PROPERTY_INT(Level) - LINK_PROPERTY_STRING(Message) - }; -} - -namespace NSEditorApi -{ - class CAscUserZoom : public IMenuEventDataBase - { - public: - - CAscUserZoom() - { - } - virtual ~CAscUserZoom() - { - } - - LINK_PROPERTY_INT(Type) - LINK_PROPERTY_DOUBLE(AnchorX) - LINK_PROPERTY_DOUBLE(AnchorY) - LINK_PROPERTY_DOUBLE(MinZoom) - LINK_PROPERTY_DOUBLE(MaxZoom) - LINK_PROPERTY_DOUBLE(Zoom) - private: - - int m_nType; // 1 - touchBegin, -1 - touchEnd, 0 - touchProcessing - double m_dAnchorX; - double m_dAnchorY; - double m_dMinZoom; - double m_dMaxZoom; - double m_dZoom; - }; -} - -namespace NSEditorApi -{ - class CAscUser : public IMenuEventDataBase - { - public: - CAscUser() - { - } - virtual ~CAscUser() - { - } - - LINK_PROPERTY_STRING_JS(Id) - LINK_PROPERTY_STRING_JS(FirstName) - LINK_PROPERTY_STRING_JS(LastName) - LINK_PROPERTY_STRING_JS(UserName) - LINK_PROPERTY_BOOL_JS(IsView) - LINK_PROPERTY_OBJECT_JS(CAscColor, Color) - - private: - js_wrapper m_sId; - js_wrapper m_sFirstName; - js_wrapper m_sLastName; - js_wrapper m_sUserName; - js_wrapper m_bIsView; - js_wrapper m_oColor; - }; - - class CAscUsers : public IMenuEventDataBase - { - public: - CAscUsers() - { - - } - virtual ~CAscUsers() - { - - } - - inline std::vector& GetUsers() {return m_oUsers;} - inline void AddUser(const CAscUser& oSheet) {m_oUsers.push_back(oSheet);} - - private: - std::vector m_oUsers; - }; -} - -#endif //_BUILD_EDITOR_API_CROSSPLATFORM_H_ diff --git a/DesktopEditor/Word_Api/Editor_Defines.h b/DesktopEditor/Word_Api/Editor_Defines.h deleted file mode 100644 index e0f940816e..0000000000 --- a/DesktopEditor/Word_Api/Editor_Defines.h +++ /dev/null @@ -1,891 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#ifndef _BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_ -#define _BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_ - -#define g_bDate1904 = false; - -#define CellValueType_Number 0 -#define CellValueType_String 1 -#define CellValueType_Bool 2 -#define CellValueType_Error 3 - -//NumFormat defines -#define c_oAscNumFormatType_General 0 -#define c_oAscNumFormatType_Custom 1 -#define c_oAscNumFormatType_Text 2 -#define c_oAscNumFormatType_Number 3 -#define c_oAscNumFormatType_Integer 4 -#define c_oAscNumFormatType_Scientific 5 -#define c_oAscNumFormatType_Currency 6 -#define c_oAscNumFormatType_Date 7 -#define c_oAscNumFormatType_Time 8 -#define c_oAscNumFormatType_Percent 9 -#define c_oAscNumFormatType_Fraction 10 - -#define c_oAscDrawingLayerType_BringToFront 0 -#define c_oAscDrawingLayerType_BringForward 1 -#define c_oAscDrawingLayerType_SendToBack 2 -#define c_oAscDrawingLayerType_SendBackward 3 - -#define c_oAscTransactionState_No -1 -#define c_oAscTransactionState_Start 0 -#define c_oAscTransactionState_Stop 1 - -#define c_oAscCellAnchorType_cellanchorAbsolute 0 -#define c_oAscCellAnchorType_cellanchorOneCell 1 -#define c_oAscCellAnchorType_cellanchorTwoCell 2 - -#define c_oAscChartDefines_defaultChartWidth 478 -#define c_oAscChartDefines_defaultChartHeight 286 - -#define c_oAscLineDrawingRule_Left 0 -#define c_oAscLineDrawingRule_Center 1 -#define c_oAscLineDrawingRule_Right 2 -#define c_oAscLineDrawingRule_Top 0 -#define c_oAscLineDrawingRule_Bottom 2 - -#define align_Right 0 -#define align_Left 1 -#define align_Center 2 -#define align_Justify 3 - -#define linerule_AtLeast 0 -#define linerule_Auto 1 -#define linerule_Exact 2 - -#define shd_Clear 0 -#define shd_Nil 1 - -#define vertalign_Baseline 0 -#define vertalign_SuperScript 1 -#define vertalign_SubScript 2 -#define hdrftr_Header 0x01 -#define hdrftr_Footer 0x02 - -#define c_oAscChartTitleShowSettings_none 0 -#define c_oAscChartTitleShowSettings_overlay 1 -#define c_oAscChartTitleShowSettings_noOverlay 2 - -#define c_oAscChartHorAxisLabelShowSettings_none 0 -#define c_oAscChartHorAxisLabelShowSettings_noOverlay 1 - -#define c_oAscChartVertAxisLabelShowSettings_none 0 -#define c_oAscChartVertAxisLabelShowSettings_rotated 1 -#define c_oAscChartVertAxisLabelShowSettings_vertical 2 -#define c_oAscChartVertAxisLabelShowSettings_horizontal 3 - -#define c_oAscChartLegendShowSettings_none 0 -#define c_oAscChartLegendShowSettings_left 1 -#define c_oAscChartLegendShowSettings_top 2 -#define c_oAscChartLegendShowSettings_right 3 -#define c_oAscChartLegendShowSettings_bottom 4 -#define c_oAscChartLegendShowSettings_leftOverlay 5 -#define c_oAscChartLegendShowSettings_rightOverlay 6 -#define c_oAscChartLegendShowSettings_layout 7 - -#define c_oAscChartDataLabelsPos_none 0 -#define c_oAscChartDataLabelsPos_b 1 -#define c_oAscChartDataLabelsPos_bestFit 2 -#define c_oAscChartDataLabelsPos_ctr 3 -#define c_oAscChartDataLabelsPos_inBase 4 -#define c_oAscChartDataLabelsPos_inEnd 5 -#define c_oAscChartDataLabelsPos_l 6 -#define c_oAscChartDataLabelsPos_outEnd 7 -#define c_oAscChartDataLabelsPos_r 8 -#define c_oAscChartDataLabelsPos_t 9 - -#define c_oAscChartCatAxisSettings_none 0 -#define c_oAscChartCatAxisSettings_leftToRight 1 -#define c_oAscChartCatAxisSettings_rightToLeft 2 -#define c_oAscChartCatAxisSettings_noLabels 3 - -#define c_oAscChartValAxisSettings_none 0 -#define c_oAscChartValAxisSettings_byDefault 1 -#define c_oAscChartValAxisSettings_thousands 2 -#define c_oAscChartValAxisSettings_millions 3 -#define c_oAscChartValAxisSettings_billions 4 -#define c_oAscChartValAxisSettings_log 5 - -#define c_oAscAxisTypeSettings_vert 0 -#define c_oAscAxisTypeSettings_hor 1 - -#define c_oAscGridLinesSettings_none 0 -#define c_oAscGridLinesSettings_major 1 -#define c_oAscGridLinesSettings_minor 2 -#define c_oAscGridLinesSettings_majorMinor 3 - -#define c_oAscChartTypeSettings_barNormal 0 -#define c_oAscChartTypeSettings_barStacked 1 -#define c_oAscChartTypeSettings_barStackedPer 2 -#define c_oAscChartTypeSettings_barNormal3d 3 -#define c_oAscChartTypeSettings_barStacked3d 4 -#define c_oAscChartTypeSettings_barStackedPer3d 5 -#define c_oAscChartTypeSettings_barNormal3dPerspective 6 -#define c_oAscChartTypeSettings_lineNormal 7 -#define c_oAscChartTypeSettings_lineStacked 8 -#define c_oAscChartTypeSettings_lineStackedPer 9 -#define c_oAscChartTypeSettings_lineNormalMarker 10 -#define c_oAscChartTypeSettings_lineStackedMarker 11 -#define c_oAscChartTypeSettings_lineStackedPerMarker 12 -#define c_oAscChartTypeSettings_line3d 13 -#define c_oAscChartTypeSettings_pie 14 -#define c_oAscChartTypeSettings_pie3d 15 -#define c_oAscChartTypeSettings_hBarNormal 16 -#define c_oAscChartTypeSettings_hBarStacked 17 -#define c_oAscChartTypeSettings_hBarStackedPer 18 -#define c_oAscChartTypeSettings_hBarNormal3d 19 -#define c_oAscChartTypeSettings_hBarStacked3d 20 -#define c_oAscChartTypeSettings_hBarStackedPer3d 21 -#define c_oAscChartTypeSettings_areaNormal 22 -#define c_oAscChartTypeSettings_areaStacked 23 -#define c_oAscChartTypeSettings_areaStackedPer 24 -#define c_oAscChartTypeSettings_doughnut 25 -#define c_oAscChartTypeSettings_stock 26 -#define c_oAscChartTypeSettings_scatter 27 -#define c_oAscChartTypeSettings_scatterLine 28 -#define c_oAscChartTypeSettings_scatterLineMarker 29 -#define c_oAscChartTypeSettings_scatterMarker 30 -#define c_oAscChartTypeSettings_scatterNone 31 -#define c_oAscChartTypeSettings_scatterSmooth 32 -#define c_oAscChartTypeSettings_scatterSmoothMarker 33 -#define c_oAscChartTypeSettings_unknown 34 - -#define c_oAscValAxisRule_auto 0 -#define c_oAscValAxisRule_fixed 1 - -#define c_oAscValAxUnits_none 0 -#define c_oAscValAxUnits_BILLIONS 1 -#define c_oAscValAxUnits_HUNDRED_MILLIONS 2 -#define c_oAscValAxUnits_HUNDREDS 3 -#define c_oAscValAxUnits_HUNDRED_THOUSANDS 4 -#define c_oAscValAxUnits_MILLIONS 5 -#define c_oAscValAxUnits_TEN_MILLIONS 6 -#define c_oAscValAxUnits_TEN_THOUSANDS 7 -#define c_oAscValAxUnits_TRILLIONS 8 -#define c_oAscValAxUnits_CUSTOM 9 -#define c_oAscValAxUnits_THOUSANDS 10 - -#define c_oAscTickMark_TICK_MARK_CROSS 0 -#define c_oAscTickMark_TICK_MARK_IN 1 -#define c_oAscTickMark_TICK_MARK_NONE 2 -#define c_oAscTickMark_TICK_MARK_OUT 3 - -#define c_oAscTickLabelsPos_TICK_LABEL_POSITION_HIGH 0 -#define c_oAscTickLabelsPos_TICK_LABEL_POSITION_LOW 1 -#define c_oAscTickLabelsPos_TICK_LABEL_POSITION_NEXT_TO 2 -#define c_oAscTickLabelsPos_TICK_LABEL_POSITION_NONE 3 - -#define c_oAscCrossesRule_auto 0 -#define c_oAscCrossesRule_maxValue 1 -#define c_oAscCrossesRule_value 2 -#define c_oAscCrossesRule_minValue 3 - -#define c_oAscHorAxisType_auto 0 -#define c_oAscHorAxisType_date 1 -#define c_oAscHorAxisType_text 2 - -#define c_oAscBetweenLabelsRule_auto 0 -#define c_oAscBetweenLabelsRule_manual 1 - -#define c_oAscLabelsPosition_byDivisions 0 -#define c_oAscLabelsPosition_betweenDivisions 1 - -#define c_oAscAxisType_auto 0 -#define c_oAscAxisType_date 1 -#define c_oAscAxisType_text 2 -#define c_oAscAxisType_cat 3 -#define c_oAscAxisType_val 4 - -#define c_oAscHAnchor_Margin 0x00 -#define c_oAscHAnchor_Page 0x01 -#define c_oAscHAnchor_Text 0x02 -#define c_oAscHAnchor_PageInternal 0xFF // только для внутреннего использования - -#define c_oAscXAlign_Center 0x00 -#define c_oAscXAlign_Inside 0x01 -#define c_oAscXAlign_Left 0x02 -#define c_oAscXAlign_Outside 0x03 -#define c_oAscXAlign_Right 0x04 - -#define c_oAscYAlign_Bottom 0x00 -#define c_oAscYAlign_Center 0x01 -#define c_oAscYAlign_Inline 0x02 -#define c_oAscYAlign_Inside 0x03 -#define c_oAscYAlign_Outside 0x04 -#define c_oAscYAlign_Top 0x05 - -#define c_oAscVAnchor_Margin 0x00 -#define c_oAscVAnchor_Page 0x01 -#define c_oAscVAnchor_Text 0x02 - -#define c_oAscRelativeFromH_Character 0x00 -#define c_oAscRelativeFromH_Column 0x01 -#define c_oAscRelativeFromH_InsideMargin 0x02 -#define c_oAscRelativeFromH_LeftMargin 0x03 -#define c_oAscRelativeFromH_Margin 0x04 -#define c_oAscRelativeFromH_OutsideMargin 0x05 -#define c_oAscRelativeFromH_Page 0x06 -#define c_oAscRelativeFromH_RightMargin 0x07 - -#define c_oAscRelativeFromV_BottomMargin 0x00 -#define c_oAscRelativeFromV_InsideMargin 0x01 -#define c_oAscRelativeFromV_Line 0x02 -#define c_oAscRelativeFromV_Margin 0x03 -#define c_oAscRelativeFromV_OutsideMargin 0x04 -#define c_oAscRelativeFromV_Page 0x05 -#define c_oAscRelativeFromV_Paragraph 0x06 -#define c_oAscRelativeFromV_TopMargin 0x07 - -// image wrap style -#define c_oAscWrapStyle_Inline 0 -#define c_oAscWrapStyle_Flow 1 - -// math -#define c_oAscLimLoc_SubSup 0x00 -#define c_oAscLimLoc_UndOvr 0x01 - -#define c_oAscMathJc_Center 0x00 -#define c_oAscMathJc_CenterGroup 0x01 -#define c_oAscMathJc_Left 0x02 -#define c_oAscMathJc_Right 0x03 - -#define c_oAscTopBot_Bot 0x00 -#define c_oAscTopBot_Top 0x01 - -#define c_oAscScript_DoubleStruck 0x00 -#define c_oAscScript_Fraktur 0x01 -#define c_oAscScript_Monospace 0x02 -#define c_oAscScript_Roman 0x03 -#define c_oAscScript_SansSerif 0x04 -#define c_oAscScript_Script 0x05 - -#define c_oAscShp_Centered 0x00 -#define c_oAscShp_Match 0x01 - -#define c_oAscSty_Bold 0x00 -#define c_oAscSty_BoldItalic 0x01 -#define c_oAscSty_Italic 0x02 -#define c_oAscSty_Plain 0x03 - -#define c_oAscFType_Bar 0x00 -#define c_oAscFType_Lin 0x01 -#define c_oAscFType_NoBar 0x02 -#define c_oAscFType_Skw 0x03 - -#define c_oAscBrkBin_After 0x00 -#define c_oAscBrkBin_Before 0x01 -#define c_oAscBrkBin_Repeat 0x02 - -#define c_oAscBrkBinSub_PlusMinus 0x00 -#define c_oAscBrkBinSub_MinusPlus 0x01 -#define c_oAscBrkBinSub_MinusMinus 0x02 - -// Толщина бордера -#define c_oAscBorderWidth_None 0 // 0px -#define c_oAscBorderWidth_Thin 1 // 1px -#define c_oAscBorderWidth_Medium 2 // 2px -#define c_oAscBorderWidth_Thick 3 // 3px - -// Располагаются в порядке значимости для отрисовки -#define c_oAscBorderStyles_None 0 -#define c_oAscBorderStyles_Double 1 -#define c_oAscBorderStyles_Hair 2 -#define c_oAscBorderStyles_DashDotDot 3 -#define c_oAscBorderStyles_DashDot 4 -#define c_oAscBorderStyles_Dotted 5 -#define c_oAscBorderStyles_Dashed 6 -#define c_oAscBorderStyles_Thin 7 -#define c_oAscBorderStyles_MediumDashDotDot 8 -#define c_oAscBorderStyles_SlantDashDot 9 -#define c_oAscBorderStyles_MediumDashDot 10 -#define c_oAscBorderStyles_MediumDashed 11 -#define c_oAscBorderStyles_Medium 12 -#define c_oAscBorderStyles_Thick 13 - -// PageOrientation -#define c_oAscPageOrientation_PagePortrait 1 -#define c_oAscPageOrientation_PageLandscape 2 - -/** - * lock types - * @const - */ -#define c_oAscLockTypes_kLockTypeNone 1 // никто не залочил данный объект -#define c_oAscLockTypes_kLockTypeMine 2 // данный объект залочен текущим пользователем -#define c_oAscLockTypes_kLockTypeOther 3 // данный объект залочен другим(не текущим) пользователем -#define c_oAscLockTypes_kLockTypeOther2 4 // данный объект залочен другим(не текущим) пользователем (обновления уже пришли) -#define c_oAscLockTypes_kLockTypeOther3 5 // данный объект был залочен (обновления пришли) и снова стал залочен - -#define c_oAscFormatPainterState_kOff 0 -#define c_oAscFormatPainterState_kOn 1 -#define c_oAscFormatPainterState_kMultiple 2 - - -#define c_oAscZoomType_Current 0 -#define c_oAscZoomType_FitWidth 1 -#define c_oAscZoomType_FitPage 2 - -#define c_oAscLockLockTypeNone 1 // никто не залочил данный объект -#define c_oAscLockLockTypeMine 2 // данный объект залочен текущим пользователем -#define c_oAscLockLockTypeOther 3 // данный объект залочен другим(не текущим) пользователем -#define c_oAscLockLockTypeOther2 4 // данный объект залочен другим(не текущим) пользователем (обновления уже пришли) -#define c_oAscLockLockTypeOther3 5 // данный объект был залочен (обновления пришли) и снова стал залочен - -#define c_oAscAsyncActionType_Information 0 -#define c_oAscAsyncActionType_BlockInteraction 1 - -#define c_oAscAsyncAction_Open 0 // открытие документа -#define c_oAscAsyncAction_Save 1 -#define c_oAscAsyncAction_LoadDocumentFonts 2 // загружаем фонты документа (сразу после открытия) -#define c_oAscAsyncAction_LoadDocumentImages 3 // загружаем картинки документа (сразу после загрузки шрифтов) -#define c_oAscAsyncAction_ LoadFont 4 // подгрузка нужного шрифта -#define c_oAscAsyncAction_LoadImage 5 // подгрузка картинки -#define c_oAscAsyncAction_DownloadAs 6 -#define c_oAscAsyncAction_Print 7 // конвертация в PDF и сохранение у пользователя -#define c_oAscAsyncAction_UploadImage 8 -#define c_oAscAsyncAction_ApplyChanges 9 // применение изменений от другого пользователя. -#define c_oAscAsyncAction_PrepareToSave 10 // Подготовка к сохранению - -//files type for Saving & DownloadAs -#define c_oAscFileType_INNER 0x0041 -#define c_oAscFileType_DOCX 0x0041 -#define c_oAscFileType_DOC 0x0042 -#define c_oAscFileType_ODT 0x0043 -#define c_oAscFileType_RTF 0x0044 -#define c_oAscFileType_TXT 0x0045 -#define c_oAscFileType_HTML_ZIP 0x0803 -#define c_oAscFileType_MHT 0x0047 -#define c_oAscFileType_PDF 0x0201 -#define c_oAscFileType_EPUB 0x0048 -#define c_oAscFileType_FB2 0x0049 -#define c_oAscFileType_MOBI 0x004a -#define c_oAscFileType_DOCY 0x1001 - -// Right = 0; Left = 1; Center = 2; Justify = 3; -#define c_oAscAlignType_LEFT 0 -#define c_oAscAlignType_CENTER 1 -#define c_oAscAlignType_RIGHT 2 -#define c_oAscAlignType_JUSTIFY 3 -#define c_oAscAlignType_TOP 4 -#define c_oAscAlignType_MIDDLE 5 -#define c_oAscAlignType_BOTTOM 6 - -#define c_oAscWrapStyle2_Inline 0 -#define c_oAscWrapStyle2_Square 1 -#define c_oAscWrapStyle2_Tight 2 -#define c_oAscWrapStyle2_Through 3 -#define c_oAscWrapStyle2_TopAndBottom 4 -#define c_oAscWrapStyle2_Behind 5 -#define c_oAscWrapStyle2_InFront 6 - -/*Error level & ID*/ -#define c_oAscError_Level_Critical -1 -#define c_oAscError_Level_NoCritical 0 - -#define c_oAscError_ID_ServerSaveComplete 3 -#define c_oAscError_ID_ConvertationProgress 2 -#define c_oAscError_ID_DownloadProgress 1 -#define c_oAscError_ID_No 0 -#define c_oAscError_ID_Unknown -1 -#define c_oAscError_ID_ConvertationTimeout -2 -#define c_oAscError_ID_ConvertationError -3 -#define c_oAscError_ID_DownloadError -4 -#define c_oAscError_ID_UnexpectedGuid -5 -#define c_oAscError_ID_Database -6 -#define c_oAscError_ID_FileRequest -7 -#define c_oAscError_ID_FileVKey -8 -#define c_oAscError_ID_UplImageSize -9 -#define c_oAscError_ID_UplImageExt -10 -#define c_oAscError_ID_UplImageFileCount -11 -#define c_oAscError_ID_NoSupportClipdoard -12 -#define c_oAscError_ID_UplImageUrl -13 - -#define c_oAscError_ID_StockChartError -17 -#define c_oAscError_ID_CoAuthoringDisconnect -18 -#define c_oAscError_ID_ConvertationPassword -19 -#define c_oAscError_ID_VKeyEncrypt -20 -#define c_oAscError_ID_KeyExpire -21 -#define c_oAscError_ID_UserCountExceed -22 - -#define c_oAscError_ID_SplitCellMaxRows -30 -#define c_oAscError_ID_SplitCellMaxCols -31 -#define c_oAscError_ID_SplitCellRowsDivider -32 -#define c_oAscError_ID_MobileUnexpectedCharCount -35 -#define c_oAscError_ID_MailMergeLoadFile -40 -#define c_oAscError_ID_MailMergeSaveFile -41 -#define c_oAscError_ID_AutoFilterDataRangeError -50 -#define c_oAscError_ID_AutoFilterChangeFormatTableError -51 -#define c_oAscError_ID_AutoFilterChangeError -52 -#define c_oAscError_ID_AutoFilterMoveToHiddenRangeError -53 -#define c_oAscError_ID_LockedAllError -54 -#define c_oAscError_ID_LockedWorksheetRename -55 -#define c_oAscError_ID_FTChangeTableRangeError -56 -#define c_oAscError_ID_FTRangeIncludedOtherTables -57 - -#define c_oAscError_ID_PasteMaxRangeError -64 -#define c_oAscError_ID_PastInMergeAreaError -65 - -#define c_oAscError_ID_DataRangeError -72 -#define c_oAscError_ID_CannotMoveRange -71 - -#define c_oAscError_ID_MaxDataSeriesError -80 -#define c_oAscError_ID_CannotFillRange -81 - -#define c_oAscError_ID_UserDrop -100 -#define c_oAscError_ID_Warning -101 - -#define c_oAscError_ID_FrmlWrongCountParentheses -300 -#define c_oAscError_ID_FrmlWrongOperator -301 -#define c_oAscError_ID_FrmlWrongMaxArgument -302 -#define c_oAscError_ID_FrmlWrongCountArgument -303 -#define c_oAscError_ID_FrmlWrongFunctionName -304 -#define c_oAscError_ID_FrmlAnotherParsingError -305 -#define c_oAscError_ID_FrmlWrongArgumentRange -306 -#define c_oAscError_ID_FrmlOperandExpected -307 -#define c_oAscError_ID_FrmlParenthesesCorrectCount -308 -#define c_oAscError_ID_FrmlWrongReferences -309 - -#define c_oAscError_ID_InvalidReferenceOrName -310 -#define c_oAscError_ID_LockCreateDefName -311 - -#define c_oAscError_ID_OpenWarning 500 - -#define c_oAscError_ID_EvaluteJSError -1000 - -#define c_oAscTypeSelectElement_Paragraph 0 -#define c_oAscTypeSelectElement_Table 1 -#define c_oAscTypeSelectElement_Image 2 -#define c_oAscTypeSelectElement_Header 3 -#define c_oAscTypeSelectElement_Hyperlink 4 -#define c_oAscTypeSelectElement_SpellCheck 5 -#define c_oAscTypeSelectElement_Shape 6 -#define c_oAscTypeSelectElement_Slide 7 -#define c_oAscTypeSelectElement_Chart 8 -#define c_oAscTypeSelectElement_Math 9 -#define c_oAscTypeSelectElement_MailMerge 10 -#define c_oAscTypeSelectElement_ContentControl 11 - -#define c_oAscTableBordersType_LEFT 0 -#define c_oAscTableBordersType_TOP 1 -#define c_oAscTableBordersType_RIGHT 2 -#define c_oAscTableBordersType_BOTTOM 3 -#define c_oAscTableBordersType_VERTLINE 4 -#define c_oAscTableBordersType_HORIZONTLINE 5 -#define c_oAscTableBordersType_INSIDE 6 -#define c_oAscTableBordersType_OUTSIDE 7 -#define c_oAscTableBordersType_ALL 8 - -#define FONT_THUMBNAIL_HEIGHT 26 - -#define c_oAscStyleImage_Default 0 -#define c_oAscStyleImage_Document 1 - -#define c_oAscLineDrawingRule_Left 0 -#define c_oAscLineDrawingRule_Center 1 -#define c_oAscLineDrawingRule_Right 2 -#define c_oAscLineDrawingRule_Top 0 -#define c_oAscLineDrawingRule_Bottom 2 - -// Chart defines -#define c_oAscChartType_line 0 -#define c_oAscChartType_bar 1 -#define c_oAscChartType_hbar 2 -#define c_oAscChartType_area 3 -#define c_oAscChartType_pie 4 -#define c_oAscChartType_scatter 5 -#define c_oAscChartType_stock 6 - -#define c_oAscChartSubType_normal 0 -#define c_oAscChartSubType_stacked 1 -#define c_oAscChartSubType_stackedPer 2 - -#define vertalign_Baseline 0 -#define vertalign_SuperScript 1 -#define vertalign_SubScript 2 -#define hdrftr_Header 0x01 -#define hdrftr_Footer 0x02 - -#define hdrftr_Default 0x01 -#define hdrftr_Even 0x02 -#define hdrftr_First 0x03 - -#define c_oAscTableSelectionType_Cell 0 -#define c_oAscTableSelectionType_Row 1 -#define c_oAscTableSelectionType_Column 2 -#define c_oAscTableSelectionType_Table 3 - -#define linerule_AtLeast 0 -#define linerule_Auto 1 -#define linerule_Exact 2 - -#define shd_Clear 0 -#define shd_Nil 1 - -#define c_oAscHyperlinkType_InternalLink 0 -#define c_oAscHyperlinkType_WebLink 1 -#define c_oAscHyperlinkType_RangeLink 2 - -#define c_oAscContextMenuTypes_Common 0 // Обычное контекстное меню -#define c_oAscContextMenuTypes_ChangeHdrFtr 1 // Специальное контестное меню для попадания в колонтитул - -#define c_oAscMouseMoveDataTypes_Common 0 -#define c_oAscMouseMoveDataTypes_Hyperlink 1 -#define c_oAscMouseMoveDataTypes_LockedObject 2 - -#define c_oAscMouseMoveLockedObjectType_Common 0 -#define c_oAscMouseMoveLockedObjectType_Header 1 -#define c_oAscMouseMoveLockedObjectType_Footer 2 - -#define c_oAscCollaborativeMarksShowType_None -1 -#define c_oAscCollaborativeMarksShowType_All 0 -#define c_oAscCollaborativeMarksShowType_LastChanges 1 - -#define c_oAscAlignH_Center 0x00 -#define c_oAscAlignH_Inside 0x01 -#define c_oAscAlignH_Left 0x02 -#define c_oAscAlignH_Outside 0x03 -#define c_oAscAlignH_Right 0x04 - -#define c_oAscChangeLevel_BringToFront 0x00 -#define c_oAscChangeLevel_BringForward 0x01 -#define c_oAscChangeLevel_SendToBack 0x02 -#define c_oAscChangeLevel_BringBackward 0x03 - -#define c_oAscAlignV_Bottom 0x00 -#define c_oAscAlignV_Center 0x01 -#define c_oAscAlignV_Inside 0x02 -#define c_oAscAlignV_Outside 0x03 -#define c_oAscAlignV_Top 0x04 - -#define c_oAscVertAlignJc_Top 0x00 -#define c_oAscVertAlignJc_Center 0x01 -#define c_oAscVertAlignJc_Bottom 0x02 - -#define c_oAscTableLayout_AutoFit 0x00 -#define c_oAscTableLayout_Fixed 0x01 - -#define c_oAscColor_COLOR_TYPE_SRGB 1 -#define c_oAscColor_COLOR_TYPE_PRST 2 -#define c_oAscColor_COLOR_TYPE_SCHEME 3 - -#define c_oAscFill_FILL_TYPE_BLIP 1 -#define c_oAscFill_FILL_TYPE_NOFILL 2 -#define c_oAscFill_FILL_TYPE_SOLID 3 -#define c_oAscFill_FILL_TYPE_GRAD 4 -#define c_oAscFill_FILL_TYPE_PATT 5 - -#define c_oAscFillGradType_GRAD_LINEAR 1 -#define c_oAscFillGradType_GRAD_PATH 2 - -#define c_oAscFillBlipType_STRETCH 1 -#define c_oAscFillBlipType_TILE 2 - -#define c_oAscStrokeType_STROKE_NONE 0 -#define c_oAscStrokeType_STROKE_COLOR 1 - -#define c_oAscAlignShapeType_ALIGN_LEFT 0 -#define c_oAscAlignShapeType_ALIGN_RIGHT 1 -#define c_oAscAlignShapeType_ALIGN_TOP 2 -#define c_oAscAlignShapeType_ALIGN_BOTTOM 3 -#define c_oAscAlignShapeType_ALIGN_CENTER 4 -#define c_oAscAlignShapeType_ALIGN_MIDDLE 5 - -#define c_oAscVerticalTextAlign_TEXT_ALIGN_BOTTOM 0 // (Text Anchor Enum ( Bottom )) -#define c_oAscVerticalTextAlign_TEXT_ALIGN_CTR 1 // (Text Anchor Enum ( Center )) -#define c_oAscVerticalTextAlign_TEXT_ALIGN_DIST 2 // (Text Anchor Enum ( Distributed )) -#define c_oAscVerticalTextAlign_TEXT_ALIGN_JUST 3 // (Text Anchor Enum ( Justified )) -#define c_oAscVerticalTextAlign_TEXT_ALIGN_TOP 4 // Top - -#define c_oAscLineJoinType_Round 1 -#define c_oAscLineJoinType_Bevel 2 -#define c_oAscLineJoinType_Miter 3 - -#define c_oAscLineCapType_Flat 0 -#define c_oAscLineCapType_Round 1 -#define c_oAscLineCapType_Square 2 - -#define c_oAscLineBeginType_None 0 -#define c_oAscLineBeginType_Arrow 1 -#define c_oAscLineBeginType_Diamond 2 -#define c_oAscLineBeginType_Oval 3 -#define c_oAscLineBeginType_Stealth 4 -#define c_oAscLineBeginType_Triangle 5 - -#define c_oAscLineBeginSize_small_small 0 -#define c_oAscLineBeginSize_small_mid 1 -#define c_oAscLineBeginSize_small_large 2 -#define c_oAscLineBeginSize_mid_small 3 -#define c_oAscLineBeginSize_mid_mid 4 -#define c_oAscLineBeginSize_mid_large 5 -#define c_oAscLineBeginSize_large_small 6 -#define c_oAscLineBeginSize_large_mid 7 -#define c_oAscLineBeginSize_large_large 8 - -#define TABLE_STYLE_WIDTH_PIX 70 -#define TABLE_STYLE_HEIGHT_PIX 50 - -#define c_oAscDropCap_None 0 -#define c_oAscDropCap_Drop 1 -#define c_oAscDropCap_Margin 2 - -#define c_oAsc_wrap_Around 0x01 -#define c_oAsc_wrap_Auto 0x02 -#define c_oAsc_wrap_None 0x03 -#define c_oAsc_wrap_NotBeside 0x04 -#define c_oAsc_wrap_Through 0x05 -#define c_oAsc_wrap_Tight 0x06 - -#define c_oAscSectionBreakType_NextPage 0x00 -#define c_oAscSectionBreakType_OddPage 0x01 -#define c_oAscSectionBreakType_EvenPage 0x02 -#define c_oAscSectionBreakType_Continuous 0x03 -#define c_oAscSectionBreakType_Column 0x04 - -#define c_oAscRestriction_None 0x00 -#define c_oAscRestriction_OnlyForms 0x01 -#define c_oAscRestriction_OnlyComments 0x02 -#define c_oAscRestriction_OnlySignatures 0x04 -#define c_oAscRestriction_View 0x80 - -#define c_oAscAdvancedOptionsID_CSV 0 -#define c_oAscAdvancedOptionsID_TXT 1 -#define c_oAscAdvancedOptionsID_DRM 2 - -#define c_oAscContentControlSpecificTypeNone 0 -#define c_oAscContentControlSpecificTypeCheckBox 1 -#define c_oAscContentControlSpecificTypePicture 2 -#define c_oAscContentControlSpecificTypeComboBox 3 -#define c_oAscContentControlSpecificTypeDropDownList 4 -#define c_oAscContentControlSpecificTypeDateTime 5 -#define c_oAscContentControlSpecificTypeTOC 10 - -#define c_oAscEDocProtectComments 0 -#define c_oAscEDocProtectForms 1 -#define c_oAscEDocProtectNone 2 -#define c_oAscEDocProtectReadOnly 3 -#define c_oAscEDocProtectTrackedChanges 4 - -#define INSERT_PAGE_NUM_PARAM(AlignV, AlignH) ((AlignV << 16) | AlignH) - -// MENU COMMANDS -#define ASC_MENU_EVENT_TYPE_TEXTPR 1 -#define ASC_MENU_EVENT_TYPE_PARAPR 2 -#define ASC_MENU_EVENT_TYPE_UNDO 3 -#define ASC_MENU_EVENT_TYPE_REDO 4 -#define ASC_MENU_EVENT_TYPE_LOADDOCUMENT 5 -#define ASC_MENU_EVENT_TYPE_STACK_OBJECTS 6 -#define ASC_MENU_EVENT_TYPE_HEADERFOOTER 7 -#define ASC_MENU_EVENT_TYPE_HYPERLINK 8 -#define ASC_MENU_EVENT_TYPE_IMAGE 9 -#define ASC_MENU_EVENT_TYPE_TABLE 10 -#define ASC_MENU_EVENT_TYPE_PARAGRAPHSTYLES 11 -#define ASC_MENU_EVENT_TYPE_TABLESTYLES 12 -#define ASC_MENU_EVENT_TYPE_INCREASEPARAINDENT 13 -#define ASC_MENU_EVENT_TYPE_DECREASEPARAINDENT 14 -#define ASC_MENU_EVENT_TYPE_TABLEMERGECELLS 15 -#define ASC_MENU_EVENT_TYPE_TABLESPLITCELLS 16 -#define ASC_MENU_EVENT_TYPE_SECTION 17 -#define ASC_MENU_EVENT_TYPE_SHAPE 18 -#define ASC_MENU_EVENT_TYPE_SLIDE 20 -#define ASC_MENU_EVENT_TYPE_CHART 21 -#define ASC_MENU_EVENT_TYPE_MATH 22 - -// insert commands -#define ASC_MENU_EVENT_TYPE_INSERT_IMAGE 50 -#define ASC_MENU_EVENT_TYPE_INSERT_TABLE 51 -#define ASC_MENU_EVENT_TYPE_INSERT_HYPERLINK 52 -#define ASC_MENU_EVENT_TYPE_INSERT_SHAPE 53 -#define ASC_MENU_EVENT_TYPE_INSERT_PAGEBREAK 54 -#define ASC_MENU_EVENT_TYPE_INSERT_LINEBREAK 55 -#define ASC_MENU_EVENT_TYPE_INSERT_PAGENUMBER 56 -#define ASC_MENU_EVENT_TYPE_INSERT_SECTIONBREAK 57 - -// hyperlink -#define ASC_MENU_EVENT_TYPE_CAN_ADD_HYPERLINK 58 -#define ASC_MENU_EVENT_TYPE_REMOVE_HYPERLINK 59 - -// undo/redo -#define ASC_MENU_EVENT_TYPE_CAN_UNDO 60 -#define ASC_MENU_EVENT_TYPE_CAN_REDO 61 - -#define ASC_MENU_EVENT_TYPE_SEARCH_FINDTEXT 62 -#define ASC_MENU_EVENT_TYPE_SEARCH_REPLACETEXT 63 -#define ASC_MENU_EVENT_TYPE_SEARCH_SELECTRESULTS 64 -#define ASC_MENU_EVENT_TYPE_SEARCH_ISSELECTRESULTS 65 - -#define ASC_MENU_EVENT_TYPE_DOCUMETN_MODIFITY 66 - -// statictic -#define ASC_MENU_EVENT_TYPE_STATISTIC_START 67 -#define ASC_MENU_EVENT_TYPE_STATISTIC_STOP 68 -#define ASC_MENU_EVENT_TYPE_STATISTIC_END 69 -#define ASC_MENU_EVENT_TYPE_STATISTIC_INFO 70 - -#define ASC_MENU_EVENT_TYPE_TABLE_INSERTDELETE_ROWCOLUMN 71 - -#define ASC_MENU_EVENT_TYPE_KEYBOARD_SHOW 100 -#define ASC_MENU_EVENT_TYPE_KEYBOARD_UNSHOW 101 - -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_SHOW 102 -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_UNSHOW 103 -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_COMMANDS_AVAILIBLE 104 - -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_COPY 110 -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_CUT 111 -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_PASTE 112 -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_DELETE 113 -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_SELECT 114 -#define ASC_MENU_EVENT_TYPE_CONTEXTMENU_SELECTALL 115 - -#define ASC_MENU_EVENT_TYPE_DOCUMENT_BASE64 200 - -#define ASC_MENU_EVENT_TYPE_DOCUMENT_CHARTSTYLES 201 - -#define ASC_MENU_EVENT_TYPE_DOCUMENT_PDFBASE64 202 -#define ASC_MENU_EVENT_TYPE_DOCUMENT_PDFBASE64_PRINT 203 - -#define ASC_MENU_EVENT_TYPE_USER_SCROLL_PAGE 300 -#define ASC_MENU_EVENT_TYPE_USER_ZOOM 301 - -#define ASC_MENU_EVENT_TYPE_INSERT_CHART 400 -#define ASC_MENU_EVENT_TYPE_INSERT_SCREEN_IMAGE 401 -#define ASC_MENU_EVENT_TYPE_ADD_CHART_DATA 440 -#define ASC_MENU_EVENT_TYPE_GET_CHART_DATA 450 -#define ASC_MENU_EVENT_TYPE_SET_CHART_DATA 460 - -#define ASC_MENU_EVENT_TYPE_ERROR 500 - -#define ASC_EVENT_TYPE_DROP_OPERATION_COPY_TEXT 600 - -#define ASC_MENU_EVENT_TYPE_COLOR_SCHEMES 2404 // CAscColorSchemes -#define ASC_MENU_EVENT_TYPE_CHANGE_COLOR_SCHEME 2415 // SET(int) -#define ASC_MENU_EVENT_TYPE_GET_COLOR_SCHEME 2416 // GET(int) -#define ASC_MENU_EVENT_TYPE_THEMECOLORS 2417 - -#define ASC_MENU_EVENT_TYPE_CHANGE_MOBILE_MODE 2500 - -#define ASC_MENU_EVENT_TYPE_GO_TO_INTERNAL_LINK 5000 - -#define ASC_SOCKET_EVENT_TYPE_OPEN 10000 -#define ASC_SOCKET_EVENT_TYPE_ON_CLOSE 10010 -#define ASC_SOCKET_EVENT_TYPE_MESSAGE 10020 -#define ASC_SOCKET_EVENT_TYPE_ON_DISCONNECT 11010 -#define ASC_SOCKET_EVENT_TYPE_TRY_RECONNECT 11020 - -#define ASC_COAUTH_EVENT_TYPE_PARTICIPANTS_CHANGED 20101 -#define ASC_COAUTH_EVENT_TYPE_LOST_CONNECTION 20102 -#define ASC_COAUTH_EVENT_TYPE_DROP_CONNECTION 20103 -#define ASC_COAUTH_EVENT_TYPE_ERROR_CONNECTION 20104 - -#define ASC_COAUTH_EVENT_TYPE_INSERT_URL_IMAGE 21000 -#define ASC_COAUTH_EVENT_TYPE_LOAD_URL_IMAGE 21001 -#define ASC_COAUTH_EVENT_TYPE_REPLACE_URL_IMAGE 21002 -#define ASC_COAUTH_EVENT_TYPE_INSERT_SCREEN_URL_IMAGE 21003 - -#define ASC_MENU_EVENT_TYPE_ADVANCED_OPTIONS 22000 -#define ASC_MENU_EVENT_TYPE_SET_PASSWORD 22001 -#define ASC_MENU_EVENT_TYPE_SET_TRANSLATIONS 22002 - -#define ASC_MENU_EVENT_TYPE_ON_EDIT_TEXT 22003 - -#define ASC_EVENT_TYPE_SPELLCHECK_MESSAGE 22004 -#define ASC_EVENT_TYPE_SPELLCHECK_TURN_ON 22005 - -#define ASC_MENU_EVENT_TYPE_DO_NONPRINTING_DISPLAY 22006 - - -#define ASC_MENU_EVENT_RUN_JS_SCRIPT 22007 -#define ASC_MENU_EVENT_RUN_JS_SCRIPT_FUNCTION 22008 - -// Comments -#define ASC_MENU_EVENT_TYPE_ADD_COMMENT 23001 -#define ASC_MENU_EVENT_TYPE_ADD_COMMENTS 23002 -#define ASC_MENU_EVENT_TYPE_REMOVE_COMMENT 23003 -#define ASC_MENU_EVENT_TYPE_CHANGE_COMMENTS 23004 -#define ASC_MENU_EVENT_TYPE_REMOVE_COMMENTS 23005 -#define ASC_MENU_EVENT_TYPE_CHANGE_COMMENT_DATA 23006 -#define ASC_MENU_EVENT_TYPE_LOCK_COMMENT 23007 -#define ASC_MENU_EVENT_TYPE_UNLOCK_COMMENT 23008 -#define ASC_MENU_EVENT_TYPE_SHOW_COMMENT 23009 -#define ASC_MENU_EVENT_TYPE_HIDE_COMMENT 23010 -#define ASC_MENU_EVENT_TYPE_UPDATE_COMMENT_POSITION 23011 -#define ASC_MENU_EVENT_TYPE_DOCUMENT_PLACE_CHANGED 23012 -#define ASC_MENU_EVENT_TYPE_DO_SELECT_COMMENT 23101 -#define ASC_MENU_EVENT_TYPE_DO_SHOW_COMMENT 23102 -#define ASC_MENU_EVENT_TYPE_DO_SELECT_COMMENTS 23103 -#define ASC_MENU_EVENT_TYPE_DO_DESELECT_COMMENTS 23104 -#define ASC_MENU_EVENT_TYPE_DO_ADD_COMMENT 23105 -#define ASC_MENU_EVENT_TYPE_DO_REMOVE_COMMENT 23106 -#define ASC_MENU_EVENT_TYPE_DO_REMOVE_ALL_COMMENTS 23107 -#define ASC_MENU_EVENT_TYPE_DO_CHANGE_COMMENT 23108 -#define ASC_MENU_EVENT_TYPE_DO_CAN_ADD_QUOTED_COMMENT 23109 - -// Track reviews -#define ASC_MENU_EVENT_TYPE_SHOW_REVISIONS_CHANGE 24001 - -#define ASC_MENU_EVENT_TYPE_DO_SET_TRACK_REVISIONS 24101 -#define ASC_MENU_EVENT_TYPE_DO_BEGIN_VIEWMODE_IN_REVIEW 24102 -#define ASC_MENU_EVENT_TYPE_DO_END_VIEWMODE_IN_REVIEW 24103 -#define ASC_MENU_EVENT_TYPE_DO_ACCEPT_ALL_CHANGES 24104 -#define ASC_MENU_EVENT_TYPE_DO_REJECT_ALL_CHANGES 24105 -#define ASC_MENU_EVENT_TYPE_DO_GET_PREV_REVISIONS_CHANGE 24106 -#define ASC_MENU_EVENT_TYPE_DO_GET_NEXT_REVISIONS_CHANGE 24107 -#define ASC_MENU_EVENT_TYPE_DO_ACCEPT_CHANGES 24108 -#define ASC_MENU_EVENT_TYPE_DO_REJECT_CHANGES 24109 -#define ASC_MENU_EVENT_TYPE_DO_FOLLOW_REVISION_MOVE 24110 - -// Universal call -#define ASC_MENU_EVENT_TYPE_DO_API_FUNCTION_CALL 25001 - -// Fill forms -#define ASC_MENU_EVENT_TYPE_SHOW_CONTENT_CONTROLS_ACTIONS 26001 -#define ASC_MENU_EVENT_TYPE_HIDE_CONTENT_CONTROLS_ACTIONS 26002 -#define ASC_MENU_EVENT_TYPE_DO_SET_CONTENTCONTROL_PICTURE 26003 -#define ASC_MENU_EVENT_TYPE_DO_SET_CONTENTCONTROL_PICTURE_URL 26004 - -// Footnote -#define ASC_MENU_EVENT_TYPE_SET_FOOTNOTE_PROP 27001 - -// Others -#define ASC_MENU_EVENT_TYPE_FOCUS_OBJECT 26101 -#define ASC_MENU_EVENT_TYPE_LONGACTION_BEGIN 26102 -#define ASC_MENU_EVENT_TYPE_LONGACTION_END 26103 -#define ASC_MENU_EVENT_TYPE_API_ERROR 26104 - -// Document Processing - -#define ASC_EVENT_TYPE_OPEN_DOCUMENT_PROCESSING_BEGIN 60100 -#define ASC_EVENT_TYPE_OPEN_DOCUMENT_PROCESSING_END 60101 -#define ASC_EVENT_TYPE_OPEN_DOCUMENT_ERROR 60102 - -#endif //_BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_ diff --git a/DesktopEditor/Word_Api/GLKView_Control.h b/DesktopEditor/Word_Api/GLKView_Control.h deleted file mode 100644 index 2daea3b321..0000000000 --- a/DesktopEditor/Word_Api/GLKView_Control.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -// -// DocumentEditorCtrl.h -// DocumentEditorCtrl -// -// Created by NewOleg on 07.07.14. -// Copyright (c) 2014 Ascensio System. All rights reserved. -// - -#import -#import -#import -#import - -#include "./Editor_Api.h" - -@interface DocumentEditorContextMenuHandler : UIScrollView -{ -@public - UIView* m_pParent; -} -@end - -@interface DocumentEditorCtrl : GLKView - --(void) TM_InvalidateRectNative: (CGRect)rect; --(void) TM_InvalidateRectNativeOnlyTarget; --(void) TM_SetCursorTypeNative: (const wchar_t*) strType; --(void) TM_CaptureMouse; --(void) TM_UnCaptureMouse; - --(void) TM_SetSettings: (const NSEditorApi::CAscEditorSettings&)settings; --(void) TM_SetScriptPath: (NSString*)path; --(void) TM_SetFontsPath: (NSString*)path; --(void) TM_SetApplicationInfo: (unsigned char*)data : (unsigned int)len; - --(void) TM_LoadDocument: (NSString*)filename; --(void) TM_Zoom: (double)zoom; --(void) TM_Destroy; - --(void) TM_Apply : (NSEditorApi::CAscMenuEvent*)pEvent; --(NSEditorApi::CAscMenuEvent*) TM_ApplySync : (NSEditorApi::CAscMenuEvent*)pEvent; --(void) TM_SetListener : (NSEditorApi::CAscMenuEventListener*)pListener; - --(void) TM_ShowKeyboard; --(void) TM_UnShowKeyboard; - --(void) private_DrawSnapshot:(CGContextRef)ctx : (CGRect)rect; --(void) private_StartDrawLock; --(void) private_EndDrawLock; - --(void) TM_OnUpdateContentSizes; --(void) TM_CheckTargetOnScreen; --(void) TM_Init:(UIViewController*)controller : (DocumentEditorContextMenuHandler*)handler; --(void) TM_SetOffsetY:(int)offset; --(int) TM_GetOffsetY; - --(bool) TM_Clipboard_Copy; --(bool) TM_Clipboard_Cut; --(bool) TM_Clipboard_Paste; - --(NSString*) TM_GetDocumentBase64; --(bool) TM_SavePDF:(NSString*)path; --(UIViewController*) GetController; - -@property(nonatomic) UITextAutocorrectionType autocorrectionType; -@property(nonatomic) UIKeyboardType keyboardType; - -@end diff --git a/DesktopEditor/Word_Api/QGLWidget_Control.h b/DesktopEditor/Word_Api/QGLWidget_Control.h deleted file mode 100644 index 3aadb9b604..0000000000 --- a/DesktopEditor/Word_Api/QGLWidget_Control.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#ifndef NATIVECONTROL_H -#define NATIVECONTROL_H - -#include -#include -#include -#include -#include -#include - -class CEditorCtrlWrapper; -class CNativeCtrl : public QGLWidget -{ - Q_OBJECT - -signals: - void signal_threadRepaint(); - -protected slots: - void slot_threadRepaint(); - -public: - CNativeCtrl(QWidget *parent = 0, const char *name = NULL); - virtual ~CNativeCtrl(); - -public: - virtual void initializeGL(); - - virtual void paintGL(); - virtual void resizeGL(int width, int height); - - virtual void closeEvent(QCloseEvent* e); - - virtual void mousePressEvent(QMouseEvent* e); - virtual void mouseMoveEvent(QMouseEvent* e); - virtual void mouseReleaseEvent(QMouseEvent* e); - virtual void wheelEvent(QWheelEvent* event); - - virtual void keyPressEvent(QKeyEvent* e); - virtual void keyReleaseEvent(QKeyEvent* e); - - virtual void InvalidateRectNative(int x, int y, int w, int h); - -public: - void InitSDK(const std::wstring& sFontsPath, const std::wstring& sSdkPath); - void OpenFile(const std::wstring& sFilePath); - - void SetZoom(double dZoom); - void ChangeCountPagesInBlock(); - -private: - CEditorCtrlWrapper* m_pWrapper; -}; - -#endif // NATIVECONTROL_H diff --git a/DesktopEditor/Word_Api/X2tConverter.h b/DesktopEditor/Word_Api/X2tConverter.h deleted file mode 100644 index 58d2abf394..0000000000 --- a/DesktopEditor/Word_Api/X2tConverter.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -// -// X2tConverter.h -// X2tConverter -// -// Created by alexey.musinov on 25.03.15. -// Copyright (c) 2015 Ascensio System SIA. All rights reserved. -// - -#import - -@interface X2tConverter : NSObject - -- (int)sdk_docx2doct_bin:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_docx2doct:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_doct_bin2docx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir; -- (int)sdk_doct2docx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir; - -- (int)sdk_xlsx2xlst_bin:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_xlsx2xlst:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_xlst_bin2xlsx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir; -- (int)sdk_xlst2xlsx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir; - -- (int)sdk_pptx2pptt_bin:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_pptx2pptt:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_pptt_bin2pptx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir; -- (int)sdk_pptt2pptx:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir; - -- (int)sdk_csv2xlst:(NSString*)nsFrom nsTo:(NSString*)nsTo xmlOptions:(NSString*)xmlOptions nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_csv2xlsx:(NSString*)nsFrom nsTo:(NSString*)nsTo xmlOptions:(NSString*)xmlOptions nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_xlst2csv:(NSString*)nsFrom nsTo:(NSString*)nsTo xmlOptions:(NSString*)xmlOptions nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; -- (int)sdk_xlsx2csv:(NSString*)nsFrom nsTo:(NSString*)nsTo xmlOptions:(NSString*)xmlOptions nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath; - -- (int)sdk_dir2zip:(NSString*)nsFrom nsTo:(NSString*)nsTo; -- (int)sdk_zip2dir:(NSString*)nsFrom nsTo:(NSString*)nsTo; - -@end diff --git a/DesktopEditor/doctrenderer/docbuilder_p.cpp b/DesktopEditor/doctrenderer/docbuilder_p.cpp index ce9d6e0c99..6ab7fa5e99 100644 --- a/DesktopEditor/doctrenderer/docbuilder_p.cpp +++ b/DesktopEditor/doctrenderer/docbuilder_p.cpp @@ -48,16 +48,28 @@ CV8RealTimeWorker::CV8RealTimeWorker(NSDoctRenderer::CDocBuilder* pBuilder) m_nFileType = -1; m_context = new CJSContext(); - m_context->CreateContext(); CJSContextScope scope(m_context); - CNativeControlEmbed::CreateObjectBuilderInContext("CreateNativeEngine", m_context); - CGraphicsEmbed::CreateObjectInContext("CreateNativeGraphics", m_context); - NSJSBase::CreateDefaults(m_context); + CJSContext::Embed(false); + CJSContext::Embed(); + NSJSBase::CreateDefaults(); JSSmart try_catch = m_context->GetExceptions(); - builder_CreateNative("builderJS", m_context, pBuilder); + CJSContext::Embed(false); + CJSContext::Embed(false); + + JSSmart global = m_context->GetGlobal(); + global->set("window", global); + + JSSmart oBuilderJS = CJSContext::createEmbedObject("CBuilderEmbed"); + global->set("builderJS", oBuilderJS); + + JSSmart oNativeCtrl = CJSContext::createEmbedObject("CNativeControlEmbed"); + global->set("native", oNativeCtrl); + + CBuilderEmbed* pBuilderJSNative = static_cast(oBuilderJS->getNative()); + pBuilderJSNative->m_pBuilder = pBuilder; } CV8RealTimeWorker::~CV8RealTimeWorker() { @@ -182,10 +194,8 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri // GET_NATIVE_ENGINE if (!bIsBreak) { - JSSmart js_result2 = global_js->call_func("GetNativeEngine", 1, args); - if (try_catch->Check()) - bIsBreak = true; - else + JSSmart js_result2 = global_js->get("native"); + if (js_result2.is_init()) { JSSmart objNative = js_result2->toObject(); pNative = (NSNativeControl::CNativeControl*)objNative->getNative()->getObject(); @@ -271,8 +281,8 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path, // GET_NATIVE_ENGINE if (true) { - JSSmart js_result2 = global_js->call_func("GetNativeEngine", 1, args); - if (!try_catch->Check()) + JSSmart js_result2 = global_js->get("native"); + if (js_result2.is_init()) { JSSmart objNative = js_result2->toObject(); pNative = (NSNativeControl::CNativeControl*)objNative->getNative()->getObject(); @@ -583,7 +593,7 @@ namespace NSDoctRenderer return ret; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->get(name); + ret.m_internal->m_value = m_internal->m_value->toObject()->get(name); ret.m_internal->m_parent = new CDocBuilderValue_Private::CParentValueInfo(); ret.m_internal->m_parent->m_parent = m_internal->m_value; @@ -641,7 +651,7 @@ namespace NSDoctRenderer std::string sPropA = U_TO_UTF8(sProp); value.m_internal->CheckNative(); - m_internal->m_value->toObjectSmart()->set(sPropA.c_str(), value.m_internal->m_value.GetPointer()); + m_internal->m_value->toObject()->set(sPropA.c_str(), value.m_internal->m_value.GetPointer()); } void CDocBuilderValue::SetProperty(const wchar_t* name, CDocBuilderValue value) { @@ -710,7 +720,7 @@ namespace NSDoctRenderer return ret; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(name); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(name); return ret; } CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1) @@ -724,7 +734,7 @@ namespace NSDoctRenderer argv[0] = p1.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(name, 1, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(name, 1, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2) @@ -740,7 +750,7 @@ namespace NSDoctRenderer argv[1] = p2.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(name, 2, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(name, 2, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3) @@ -758,7 +768,7 @@ namespace NSDoctRenderer argv[2] = p3.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(name, 3, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(name, 3, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4) @@ -778,7 +788,7 @@ namespace NSDoctRenderer argv[3] = p4.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(name, 4, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(name, 4, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4, CDocBuilderValue p5) @@ -800,7 +810,7 @@ namespace NSDoctRenderer argv[4] = p5.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(name, 5, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(name, 5, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const char* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4, CDocBuilderValue p5, CDocBuilderValue p6) @@ -824,7 +834,7 @@ namespace NSDoctRenderer argv[5] = p6.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(name, 6, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(name, 6, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name) @@ -837,7 +847,7 @@ namespace NSDoctRenderer std::string sPropA = U_TO_UTF8(sProp); ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(sPropA.c_str()); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(sPropA.c_str()); return ret; } CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1) @@ -854,7 +864,7 @@ namespace NSDoctRenderer argv[0] = p1.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(sPropA.c_str(), 1, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(sPropA.c_str(), 1, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2) @@ -873,7 +883,7 @@ namespace NSDoctRenderer argv[1] = p2.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(sPropA.c_str(), 2, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(sPropA.c_str(), 2, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3) @@ -894,7 +904,7 @@ namespace NSDoctRenderer argv[2] = p3.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(sPropA.c_str(), 3, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(sPropA.c_str(), 3, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4) @@ -917,7 +927,7 @@ namespace NSDoctRenderer argv[3] = p4.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(sPropA.c_str(), 4, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(sPropA.c_str(), 4, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4, CDocBuilderValue p5) @@ -942,7 +952,7 @@ namespace NSDoctRenderer argv[4] = p5.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(sPropA.c_str(), 5, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(sPropA.c_str(), 5, argv); return ret; } CDocBuilderValue CDocBuilderValue::Call(const wchar_t* name, CDocBuilderValue p1, CDocBuilderValue p2, CDocBuilderValue p3, CDocBuilderValue p4, CDocBuilderValue p5, CDocBuilderValue p6) @@ -969,7 +979,7 @@ namespace NSDoctRenderer argv[5] = p6.m_internal->m_value; ret.m_internal->m_context = m_internal->m_context; - ret.m_internal->m_value = m_internal->m_value->toObjectSmart()->call_func(sPropA.c_str(), 6, argv); + ret.m_internal->m_value = m_internal->m_value->toObject()->call_func(sPropA.c_str(), 6, argv); return ret; } diff --git a/DesktopEditor/doctrenderer/docbuilder_p.h b/DesktopEditor/doctrenderer/docbuilder_p.h index 2fbdea035f..b15240c6ea 100644 --- a/DesktopEditor/doctrenderer/docbuilder_p.h +++ b/DesktopEditor/doctrenderer/docbuilder_p.h @@ -44,6 +44,7 @@ #include "js_internal/js_base.h" #include "embed/NativeBuilderEmbed.h" +#include "embed/NativeBuilderDocumentEmbed.h" #include "embed/NativeControlEmbed.h" #include "embed/GraphicsEmbed.h" #include "embed/Default.h" diff --git a/DesktopEditor/doctrenderer/doctrenderer.cpp b/DesktopEditor/doctrenderer/doctrenderer.cpp index 2958aca838..4da89e8d90 100644 --- a/DesktopEditor/doctrenderer/doctrenderer.cpp +++ b/DesktopEditor/doctrenderer/doctrenderer.cpp @@ -555,14 +555,22 @@ namespace NSDoctRenderer if (true) { - context->CreateContext(); CJSContextScope scope(context); - CNativeControlEmbed::CreateObjectBuilderInContext("CreateNativeEngine", context); - CGraphicsEmbed::CreateObjectInContext("CreateNativeGraphics", context); - NSJSBase::CreateDefaults(context); + CJSContext::Embed(false); + CJSContext::Embed(); + NSJSBase::CreateDefaults(); JSSmart try_catch = context->GetExceptions(); + JSSmart global_js = context->GetGlobal(); + global_js->set("window", global_js); + + JSSmart oNativeCtrl = CJSContext::createEmbedObject("CNativeControlEmbed"); + global_js->set("native", oNativeCtrl); + + NSNativeControl::CNativeControl* pNative = static_cast(oNativeCtrl->getNative()->getObject()); + pNative->m_sConsoleLogFile = m_sConsoleLogFile; + LOGGER_SPEED_LAP("compile"); JSSmart res = context->runScript(strScript, try_catch, sCachePath); @@ -575,29 +583,10 @@ namespace NSDoctRenderer LOGGER_SPEED_LAP("run"); //--------------------------------------------------------------- - JSSmart global_js = context->GetGlobal(); JSSmart args[1]; args[0] = CJSContext::createInt(0); - NSNativeControl::CNativeControl* pNative = NULL; - // GET_NATIVE_ENGINE - if (!bIsBreak) - { - JSSmart js_result2 = global_js->call_func("GetNativeEngine", 1, args); - if (try_catch->Check()) - { - strError = L"code=\"run\""; - bIsBreak = true; - } - else - { - JSSmart objNative = js_result2->toObject(); - pNative = (NSNativeControl::CNativeControl*)objNative->getNative()->getObject(); - pNative->m_sConsoleLogFile = m_sConsoleLogFile; - } - } - if (pNative != NULL) { pNative->m_pChanges = &m_oParams.m_arChanges; @@ -1091,11 +1080,14 @@ namespace NSDoctRenderer if (true) { - context->CreateContext(); CJSContextScope scope(context); - CNativeControlEmbed::CreateObjectBuilderInContext("CreateNativeEngine", context); - CGraphicsEmbed::CreateObjectInContext("CreateNativeGraphics", context); - NSJSBase::CreateDefaults(context); + CJSContext::Embed(); + CJSContext::Embed(); + NSJSBase::CreateDefaults(); + + JSSmart global = context->GetGlobal(); + global->set("window", global); + global->set("native", CJSContext::createEmbedObject("CNativeControlEmbed")); JSSmart try_catch = context->GetExceptions(); diff --git a/DesktopEditor/doctrenderer/doctrenderer.pro b/DesktopEditor/doctrenderer/doctrenderer.pro index 6f7692b356..17a3ff8cff 100644 --- a/DesktopEditor/doctrenderer/doctrenderer.pro +++ b/DesktopEditor/doctrenderer/doctrenderer.pro @@ -13,9 +13,11 @@ PWD_ROOT_DIR = $$PWD include(../../Common/base.pri) DEFINES += DOCTRENDERER_USE_DYNAMIC_LIBRARY_BUILDING +DEFINES += JSBASE_USE_DYNAMIC_LIBRARY_BUILDING ADD_DEPENDENCY(graphics, kernel, UnicodeConverter, kernel_network) #CONFIG += build_xp +#CONFIG += v8_version_60 core_android:DEFINES += DISABLE_MEMORY_LIMITATION HEADERS += \ @@ -49,6 +51,7 @@ HEADERS += \ embed/MemoryStreamEmbed.h \ embed/NativeControlEmbed.h \ embed/NativeBuilderEmbed.h \ + embed/NativeBuilderDocumentEmbed.h \ embed/TextMeasurerEmbed.h \ embed/HashEmbed.h \ embed/Default.h \ @@ -61,6 +64,7 @@ SOURCES += \ embed/MemoryStreamEmbed.cpp \ embed/NativeControlEmbed.cpp \ embed/NativeBuilderEmbed.cpp \ + embed/NativeBuilderDocumentEmbed.cpp \ embed/TextMeasurerEmbed.cpp \ embed/HashEmbed.cpp \ embed/Default.cpp @@ -68,32 +72,24 @@ SOURCES += \ include($$PWD/js_internal/js_base.pri) !use_javascript_core { - SOURCES += \ - embed/v8/v8_MemoryStream.cpp \ - embed/v8/v8_NativeControl.cpp \ - embed/v8/v8_NativeBuilder.cpp \ - embed/v8/v8_Graphics.cpp \ - embed/v8/v8_Zip.cpp \ - embed/v8/v8_Pointer.cpp \ - embed/v8/v8_TextMeasurer.cpp \ - embed/v8/v8_Hash.cpp - build_xp:DESTDIR=$$DESTDIR/xp -} else { - OBJECTIVE_SOURCES += ../common/Mac/NSString+StringUtils.mm - OBJECTIVE_SOURCES += \ - embed/jsc/jsc_Graphics.mm \ - embed/jsc/jsc_MemoryStream.mm \ - embed/jsc/jsc_NativeControl.mm \ - embed/jsc/jsc_NativeBuilder.mm \ - embed/jsc/jsc_Zip.mm \ - embed/jsc/jsc_Pointer.mm \ - embed/jsc/jsc_TextMeasurer.mm \ - embed/jsc/jsc_Hash.mm - - LIBS += -framework Foundation } +use_javascript_core { + OBJECTIVE_SOURCES += ../common/Mac/NSString+StringUtils.mm +} + +# files for embedded classes +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/GraphicsEmbed.h) +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/HashEmbed.h) +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/MemoryStreamEmbed.h) +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeBuilderEmbed.h) +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeBuilderDocumentEmbed.h) +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/NativeControlEmbed.h) +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/PointerEmbed.h) +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/TextMeasurerEmbed.h) +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(embed/ZipEmbed.h) + include(../graphics/pro/textshaper.pri) include(../../Common/3dParty/openssl/openssl.pri) diff --git a/DesktopEditor/doctrenderer/embed/Default.cpp b/DesktopEditor/doctrenderer/embed/Default.cpp index c656f8a058..52d814ce58 100644 --- a/DesktopEditor/doctrenderer/embed/Default.cpp +++ b/DesktopEditor/doctrenderer/embed/Default.cpp @@ -1,17 +1,17 @@ #include "Default.h" #include "./ZipEmbed.h" -#include "./TextMeasurerEmbed.h" #include "./MemoryStreamEmbed.h" +#include "./TextMeasurerEmbed.h" #include "./HashEmbed.h" namespace NSJSBase { - void CreateDefaults(JSSmart& context) + void CreateDefaults() { - CZipEmbed::CreateObjectInContext("CreateNativeZip", context); - CTextMeasurerEmbed::CreateObjectInContext("CreateNativeTextMeasurer", context); - CMemoryStreamEmbed::CreateObjectInContext("CreateNativeMemoryStream", context); - CHashEmbed::CreateObjectInContext("CreateNativeHash", context); + CJSContext::Embed(); + CJSContext::Embed(); + CJSContext::Embed(); + CJSContext::Embed(); } } diff --git a/DesktopEditor/doctrenderer/embed/Default.h b/DesktopEditor/doctrenderer/embed/Default.h index 9d62e214e3..9131ec6a36 100644 --- a/DesktopEditor/doctrenderer/embed/Default.h +++ b/DesktopEditor/doctrenderer/embed/Default.h @@ -5,7 +5,7 @@ namespace NSJSBase { - void JS_DECL CreateDefaults(JSSmart& context); + void JS_DECL CreateDefaults(); } #endif // _BUILD_NATIVE_DEFAULT_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp b/DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp index c9a3c2c5c5..69f21471bb 100644 --- a/DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp +++ b/DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp @@ -1,8 +1,8 @@ #include "GraphicsEmbed.h" -JSSmart CGraphicsEmbed::init(JSSmart Native, JSSmart width_px, JSSmart height_px, JSSmart width_mm, JSSmart height_mm) +JSSmart CGraphicsEmbed::create(JSSmart Native, JSSmart width_px, JSSmart height_px, JSSmart width_mm, JSSmart height_mm) { - m_pInternal->init((NSNativeControl::CNativeControl*)Native->toObjectSmart()->getNative()->getObject(), width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble()); + m_pInternal->init((NSNativeControl::CNativeControl*)Native->toObject()->getNative()->getObject(), width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble()); return NULL; } JSSmart CGraphicsEmbed::Destroy() diff --git a/DesktopEditor/doctrenderer/embed/GraphicsEmbed.h b/DesktopEditor/doctrenderer/embed/GraphicsEmbed.h index 720e108c77..5982da9892 100644 --- a/DesktopEditor/doctrenderer/embed/GraphicsEmbed.h +++ b/DesktopEditor/doctrenderer/embed/GraphicsEmbed.h @@ -17,7 +17,7 @@ public: virtual void* getObject() override { return (void*)m_pInternal; } public: - JSSmart init(JSSmart Native, JSSmart width_px, JSSmart height_px, JSSmart width_mm, JSSmart height_mm); + JSSmart create(JSSmart Native, JSSmart width_px, JSSmart height_px, JSSmart width_mm, JSSmart height_mm); JSSmart Destroy(); JSSmart EndDraw(); JSSmart put_GlobalAlpha(JSSmart enable, JSSmart globalAlpha); @@ -132,7 +132,7 @@ public: JSSmart CoordTransformOffset(JSSmart tx, JSSmart ty); JSSmart GetTransform(); - static void CreateObjectInContext(const std::string& name, JSSmart context); + DECLARE_EMBED_METHODS }; #endif // _BUILD_NATIVE_GRAPHICS_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/HashEmbed.h b/DesktopEditor/doctrenderer/embed/HashEmbed.h index b8cc8a8981..2ae2cdf1f7 100644 --- a/DesktopEditor/doctrenderer/embed/HashEmbed.h +++ b/DesktopEditor/doctrenderer/embed/HashEmbed.h @@ -5,7 +5,7 @@ #include "../hash.h" using namespace NSJSBase; -class CHashEmbed : public CJSEmbedObject +class JS_DECL CHashEmbed : public CJSEmbedObject { public: CHash* m_pHash; @@ -24,8 +24,7 @@ public: JSSmart hash(JSSmart data, JSSmart size, JSSmart alg); JSSmart hash2(JSSmart password, JSSmart salt, JSSmart spinCount, JSSmart alg); -public: - static void CreateObjectInContext(const std::string& name, JSSmart context); + DECLARE_EMBED_METHODS }; #endif // _BUILD_NATIVE_HASH_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/MemoryStreamEmbed.h b/DesktopEditor/doctrenderer/embed/MemoryStreamEmbed.h index 25cd09b910..5db51d5e68 100644 --- a/DesktopEditor/doctrenderer/embed/MemoryStreamEmbed.h +++ b/DesktopEditor/doctrenderer/embed/MemoryStreamEmbed.h @@ -5,7 +5,7 @@ #include "../js_internal/js_base.h" using namespace NSJSBase; -class CMemoryStreamEmbed : public CJSEmbedObject +class JS_DECL CMemoryStreamEmbed : public CJSEmbedObject { public: NSMemoryStream::CMemoryStream* m_pInternal; @@ -29,7 +29,7 @@ public: JSSmart WriteString(JSSmart value); JSSmart WriteString2(JSSmart value); - static void CreateObjectInContext(const std::string& name, JSSmart context); + DECLARE_EMBED_METHODS }; #endif // _BUILD_NATIVE_MEMORYSTREAM_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/NativeBuilderDocumentEmbed.cpp b/DesktopEditor/doctrenderer/embed/NativeBuilderDocumentEmbed.cpp new file mode 100644 index 0000000000..40c05ada63 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/NativeBuilderDocumentEmbed.cpp @@ -0,0 +1,80 @@ +#include "NativeBuilderDocumentEmbed.h" +#include "./../docbuilder_p.h" + +#include "../../common/Directory.h" + +JSSmart CBuilderDocumentEmbed::IsValid() +{ + return CJSContext::createBool(m_bIsValid); +} + +JSSmart CBuilderDocumentEmbed::GetBinary() +{ + return CJSContext::createUint8Array(m_sFolder + L"/Editor.bin"); +} + +JSSmart CBuilderDocumentEmbed::GetFolder() +{ + return CJSContext::createString(m_sFolder); +} + +JSSmart CBuilderDocumentEmbed::Close() +{ + _CloseFile(); + return NULL; +} + +JSSmart CBuilderDocumentEmbed::GetImageMap() +{ + std::vector files = NSDirectory::GetFiles(m_sFolder + L"/media"); + + JSSmart obj = CJSContext::createObject(); + for (std::vector::iterator i = files.begin(); i != files.end(); i++) + { + std::wstring sFile = *i; + NSStringUtils::string_replace(sFile, L"\\", L"/"); + std::wstring sName = L"media/" + NSFile::GetFileName(sFile); + + obj->set(U_TO_UTF8(sName).c_str(), CJSContext::createString(sFile)); + } + + return obj->toValue(); +} + +void CBuilderDocumentEmbed::_OpenFile(const std::wstring& sFile, const std::wstring& sParams) +{ + NSDoctRenderer::CDocBuilder_Private* pBuilder = GetPrivate(m_pBuilder); + + std::wstring sTmpDir = pBuilder->m_sTmpFolder; + + m_sFolder = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"DE_"); + if (NSFile::CFileBinary::Exists(m_sFolder)) + NSFile::CFileBinary::Remove(m_sFolder); + + NSStringUtils::string_replace(m_sFolder, L"\\", L"/"); + + std::wstring::size_type nPosPoint = m_sFolder.rfind('.'); + if (nPosPoint != std::wstring::npos && nPosPoint > sTmpDir.length()) + { + m_sFolder = m_sFolder.substr(0, nPosPoint); + } + + NSDirectory::CreateDirectory(m_sFolder); + + std::wstring sExtCopy = pBuilder->GetFileCopyExt(sFile); + std::wstring sFileCopy = m_sFolder + L"/origin." + sExtCopy; + + pBuilder->MoveFileOpen(sFile, sFileCopy); + int nConvertResult = pBuilder->ConvertToInternalFormat(m_sFolder, sFileCopy, sParams); + + if (0 == nConvertResult) + m_bIsValid = true; +} + +void CBuilderDocumentEmbed::_CloseFile() +{ + if (!m_sFolder.empty()) + NSDirectory::DeleteDirectory(m_sFolder); + m_bIsValid = false; + m_sFolder = L""; +} diff --git a/DesktopEditor/doctrenderer/v8_native_wrapper/builder.h b/DesktopEditor/doctrenderer/embed/NativeBuilderDocumentEmbed.h similarity index 62% rename from DesktopEditor/doctrenderer/v8_native_wrapper/builder.h rename to DesktopEditor/doctrenderer/embed/NativeBuilderDocumentEmbed.h index 87275da5f7..ab06cada81 100644 --- a/DesktopEditor/doctrenderer/v8_native_wrapper/builder.h +++ b/DesktopEditor/doctrenderer/embed/NativeBuilderDocumentEmbed.h @@ -29,39 +29,39 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -#ifndef BUILDER_WRAPPER_BUILDER -#define BUILDER_WRAPPER_BUILDER +#ifndef _BUILD_NATIVE_BUILDER_DOCUMENT_EMBED_H_ +#define _BUILD_NATIVE_BUILDER_DOCUMENT_EMBED_H_ #include "../docbuilder.h" -#include "../nativecontrol.h" +#include "../js_internal/js_base.h" -class CBuilderObject +using namespace NSJSBase; +class CBuilderDocumentEmbed : public CJSEmbedObject { public: - NSDoctRenderer::CDocBuilder* m_pBuilder; + NSDoctRenderer::CDocBuilder* m_pBuilder; + bool m_bIsValid; + std::wstring m_sFolder; public: - CBuilderObject() - { - m_pBuilder = NULL; - } - ~CBuilderObject() - { - } + CBuilderDocumentEmbed() : m_pBuilder(NULL), m_bIsValid(false) {} + ~CBuilderDocumentEmbed() { if(m_pBuilder) RELEASEOBJECT(m_pBuilder); } + + virtual void* getObject() { return (void*)m_pBuilder; } + NSDoctRenderer::CDocBuilder_Private* GetPrivate(NSDoctRenderer::CDocBuilder* pBuilder) { return pBuilder->GetPrivate(); } + +public: + void _OpenFile(const std::wstring& sFile, const std::wstring& sParams); + void _CloseFile(); + +public: + JSSmart IsValid(); + JSSmart GetBinary(); + JSSmart GetFolder(); + JSSmart Close(); + JSSmart GetImageMap(); + + DECLARE_EMBED_METHODS }; -// wrap_methods ------------- -CBuilderObject* unwrap_builder(v8::Handle obj); - -void _b_openfile(const v8::FunctionCallbackInfo& args); -void _b_createfile(const v8::FunctionCallbackInfo& args); -void _b_settmpfolder(const v8::FunctionCallbackInfo& args); -void _b_savefile(const v8::FunctionCallbackInfo& args); -void _b_closefile(const v8::FunctionCallbackInfo& args); -void _b_writefile(const v8::FunctionCallbackInfo& args); - -v8::Handle CreateBuilderTemplate(v8::Isolate* isolate); -void CreateBuilderObject(const v8::FunctionCallbackInfo& args); - -#endif // BUILDER_WRAPPER_BUILDER - +#endif // _BUILD_NATIVE_BUILDER_DOCUMENT_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/NativeBuilderEmbed.cpp b/DesktopEditor/doctrenderer/embed/NativeBuilderEmbed.cpp index 5f15e5598b..b42bd34745 100644 --- a/DesktopEditor/doctrenderer/embed/NativeBuilderEmbed.cpp +++ b/DesktopEditor/doctrenderer/embed/NativeBuilderEmbed.cpp @@ -1,16 +1,18 @@ #include "NativeBuilderEmbed.h" +#include "NativeBuilderDocumentEmbed.h" #include "./../docbuilder_p.h" #include "../../common/Directory.h" -JSSmart CBuilderEmbed::builder_OpenFile(JSSmart sPath, JSSmart sParams) +JSSmart CBuilderEmbed::OpenFile(JSSmart sPath, JSSmart sParams) { std::wstring Path = sPath->toStringW(); std::wstring Params = sParams->toStringW(); int ret = m_pBuilder->OpenFile(Path.c_str(), Params.c_str()); return CJSContext::createInt(ret); } -JSSmart CBuilderEmbed::builder_CreateFile(JSSmart type) + +JSSmart CBuilderEmbed::CreateFile(JSSmart type) { int nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX; if (type->isString()) @@ -21,13 +23,15 @@ JSSmart CBuilderEmbed::builder_CreateFile(JSSmart type) bool ret = m_pBuilder->CreateFile(nFormat); return CJSContext::createBool(ret); } -JSSmart CBuilderEmbed::builder_SetTmpFolder(JSSmart path) + +JSSmart CBuilderEmbed::SetTmpFolder(JSSmart path) { std::wstring sPath = path->toStringW(); m_pBuilder->SetTmpFolder(sPath.c_str()); return NULL; } -JSSmart CBuilderEmbed::builder_SaveFile(JSSmart type, JSSmart path, JSSmart params) + +JSSmart CBuilderEmbed::SaveFile(JSSmart type, JSSmart path, JSSmart params) { int nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX; if (type->isString()) @@ -40,80 +44,20 @@ JSSmart CBuilderEmbed::builder_SaveFile(JSSmart type, JSSmar int ret = m_pBuilder->SaveFile(nFormat, sPath.c_str(), sParams.empty() ? NULL : sParams.c_str()); return CJSContext::createInt(ret); } -JSSmart CBuilderEmbed::builder_CloseFile() + +JSSmart CBuilderEmbed::CloseFile() { m_pBuilder->CloseFile(); return NULL; } - -JSSmart CBuilderDocumentEmbed::builder_doc_IsValid() +JSSmart CBuilderEmbed::OpenTmpFile(JSSmart path, JSSmart params) { - return CJSContext::createBool(m_bIsValid); -} -JSSmart CBuilderDocumentEmbed::builder_doc_GetBinary() -{ - return CJSContext::createUint8Array(m_sFolder + L"/Editor.bin"); -} -JSSmart CBuilderDocumentEmbed::builder_doc_GetFolder() -{ - return CJSContext::createString(m_sFolder); -} -JSSmart CBuilderDocumentEmbed::builder_doc_CloseFile() -{ - CloseFile(); - return NULL; -} -JSSmart CBuilderDocumentEmbed::builder_doc_GetImageMap() -{ - std::vector files = NSDirectory::GetFiles(m_sFolder + L"/media"); - - JSSmart obj = CJSContext::createObject(); - for (std::vector::iterator i = files.begin(); i != files.end(); i++) - { - std::wstring sFile = *i; - NSStringUtils::string_replace(sFile, L"\\", L"/"); - std::wstring sName = L"media/" + NSFile::GetFileName(sFile); - - obj->set(U_TO_UTF8(sName).c_str(), CJSContext::createString(sFile)); - } - - return obj->toValue(); -} - -void CBuilderDocumentEmbed::OpenFile(const std::wstring& sFile, const std::wstring& sParams) -{ - NSDoctRenderer::CDocBuilder_Private* pBuilder = GetPrivate(m_pBuilder); - - std::wstring sTmpDir = pBuilder->m_sTmpFolder; - - m_sFolder = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"DE_"); - if (NSFile::CFileBinary::Exists(m_sFolder)) - NSFile::CFileBinary::Remove(m_sFolder); - - NSStringUtils::string_replace(m_sFolder, L"\\", L"/"); - - std::wstring::size_type nPosPoint = m_sFolder.rfind('.'); - if (nPosPoint != std::wstring::npos && nPosPoint > sTmpDir.length()) - { - m_sFolder = m_sFolder.substr(0, nPosPoint); - } - - NSDirectory::CreateDirectory(m_sFolder); - - std::wstring sExtCopy = pBuilder->GetFileCopyExt(sFile); - std::wstring sFileCopy = m_sFolder + L"/origin." + sExtCopy; - - pBuilder->MoveFileOpen(sFile, sFileCopy); - int nConvertResult = pBuilder->ConvertToInternalFormat(m_sFolder, sFileCopy, sParams); - - if (0 == nConvertResult) - m_bIsValid = true; -} -void CBuilderDocumentEmbed::CloseFile() -{ - if (!m_sFolder.empty()) - NSDirectory::DeleteDirectory(m_sFolder); - m_bIsValid = false; - m_sFolder = L""; + std::wstring sPath = path->toStringW(); + std::wstring sParams = params->toStringW(); + JSSmart oBuilderTmpDoc = CJSContext::createEmbedObject("CBuilderDocumentEmbed"); + CBuilderDocumentEmbed* pBuilderTmpDocNative = static_cast(oBuilderTmpDoc->getNative()); + pBuilderTmpDocNative->m_pBuilder = m_pBuilder; + pBuilderTmpDocNative->_OpenFile(sPath, sParams); + return oBuilderTmpDoc->toValue(); } diff --git a/DesktopEditor/doctrenderer/embed/NativeBuilderEmbed.h b/DesktopEditor/doctrenderer/embed/NativeBuilderEmbed.h index a1bc05ea53..a37c3ff0ca 100644 --- a/DesktopEditor/doctrenderer/embed/NativeBuilderEmbed.h +++ b/DesktopEditor/doctrenderer/embed/NativeBuilderEmbed.h @@ -29,12 +29,17 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -#ifndef NATIVECONTROLBUILDER -#define NATIVECONTROLBUILDER +#ifndef _BUILD_NATIVE_BUILDER_EMBED_H_ +#define _BUILD_NATIVE_BUILDER_EMBED_H_ #include "../docbuilder.h" #include "../js_internal/js_base.h" +// For windows fileapi +#ifdef CreateFile +#undef CreateFile +#endif + using namespace NSJSBase; class CBuilderEmbed : public CJSEmbedObject { @@ -47,40 +52,16 @@ public: virtual void* getObject() { return (void*)m_pBuilder; } public: - JSSmart builder_OpenFile(JSSmart sPath, JSSmart sParams); - JSSmart builder_CreateFile(JSSmart type); - JSSmart builder_SetTmpFolder(JSSmart path); - JSSmart builder_SaveFile(JSSmart type, JSSmart path, JSSmart params); - JSSmart builder_CloseFile(); - JSSmart builder_OpenTmpFile(JSSmart path, JSSmart params); -}; + JSSmart OpenFile(JSSmart sPath, JSSmart sParams); + JSSmart CreateFile(JSSmart type); + JSSmart SetTmpFolder(JSSmart path); + JSSmart SaveFile(JSSmart type, JSSmart path, JSSmart params); + JSSmart CloseFile(); + JSSmart OpenTmpFile(JSSmart path, JSSmart params); -class CBuilderDocumentEmbed : public CJSEmbedObject -{ -public: - NSDoctRenderer::CDocBuilder* m_pBuilder; - bool m_bIsValid; - std::wstring m_sFolder; - -public: - CBuilderDocumentEmbed() : m_pBuilder(NULL), m_bIsValid(false) {} - ~CBuilderDocumentEmbed() { if(m_pBuilder) RELEASEOBJECT(m_pBuilder); } - - virtual void* getObject() { return (void*)m_pBuilder; } - NSDoctRenderer::CDocBuilder_Private* GetPrivate(NSDoctRenderer::CDocBuilder* pBuilder) { return pBuilder->GetPrivate(); } - -public: - void OpenFile(const std::wstring& sFile, const std::wstring& sParams); - void CloseFile(); - -public: - JSSmart builder_doc_IsValid(); - JSSmart builder_doc_GetBinary(); - JSSmart builder_doc_GetFolder(); - JSSmart builder_doc_CloseFile(); - JSSmart builder_doc_GetImageMap(); + DECLARE_EMBED_METHODS }; void builder_CreateNative(const std::string& name, JSSmart context, NSDoctRenderer::CDocBuilder* builder); -#endif // NATIVECONTROLBUILDER +#endif // _BUILD_NATIVE_BUILDER_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/NativeControlEmbed.cpp b/DesktopEditor/doctrenderer/embed/NativeControlEmbed.cpp index 82573b1ed5..797890b4c2 100644 --- a/DesktopEditor/doctrenderer/embed/NativeControlEmbed.cpp +++ b/DesktopEditor/doctrenderer/embed/NativeControlEmbed.cpp @@ -147,7 +147,7 @@ JSSmart CNativeControlEmbed::SaveChanges(JSSmart sParam, JSS return NULL; } -JSSmart CNativeControlEmbed::zipOpenFile(JSSmart name) +JSSmart CNativeControlEmbed::ZipOpen(JSSmart name) { bool bIsOpen = m_pInternal->m_oZipWorker.Open(name->toStringW()); if (!bIsOpen) @@ -163,7 +163,7 @@ JSSmart CNativeControlEmbed::zipOpenFile(JSSmart name) return obj->toValue(); } -JSSmart CNativeControlEmbed::zipOpenFileBase64(JSSmart name) +JSSmart CNativeControlEmbed::ZipOpenBase64(JSSmart name) { bool bIsOpen = m_pInternal->m_oZipWorker.OpenBase64(name->toStringA()); if (!bIsOpen) @@ -179,7 +179,7 @@ JSSmart CNativeControlEmbed::zipOpenFileBase64(JSSmart name) return obj->toValue(); } -JSSmart CNativeControlEmbed::zipGetFileAsString(JSSmart name) +JSSmart CNativeControlEmbed::ZipFileAsString(JSSmart name) { BYTE* pData = NULL; DWORD len = 0; @@ -187,12 +187,12 @@ JSSmart CNativeControlEmbed::zipGetFileAsString(JSSmart name return CJSContext::createString((char*)pData, len); } -JSSmart CNativeControlEmbed::zipGetFileAsBinary(JSSmart name) +JSSmart CNativeControlEmbed::ZipFileAsBinary(JSSmart name) { return CJSContext::createUint8Array(m_pInternal->m_oZipWorker.m_sTmpFolder + L"/" + name->toStringW()); } -JSSmart CNativeControlEmbed::zipCloseFile() +JSSmart CNativeControlEmbed::ZipClose() { m_pInternal->m_oZipWorker.Close(); return NULL; diff --git a/DesktopEditor/doctrenderer/embed/NativeControlEmbed.h b/DesktopEditor/doctrenderer/embed/NativeControlEmbed.h index 79d69798dc..4e82d297c7 100644 --- a/DesktopEditor/doctrenderer/embed/NativeControlEmbed.h +++ b/DesktopEditor/doctrenderer/embed/NativeControlEmbed.h @@ -30,23 +30,22 @@ public: JSSmart CheckNextChange(); JSSmart GetCountChanges(); JSSmart GetChangesFile(JSSmart index); - JSSmart Save_AllocNative(JSSmart nLen); - JSSmart Save_ReAllocNative(JSSmart pos, JSSmart len); + /*[noexport]*/JSSmart Save_AllocNative(JSSmart nLen); + /*[noexport]*/JSSmart Save_ReAllocNative(JSSmart pos, JSSmart len); JSSmart Save_End(JSSmart pos, JSSmart len); JSSmart AddImageInChanges(JSSmart img); JSSmart ConsoleLog(JSSmart message); - JSSmart SaveChanges(JSSmart sParam, JSSmart nDeleteIndex, JSSmart nCount); - JSSmart zipOpenFile(JSSmart name); - JSSmart zipOpenFileBase64(JSSmart name); - JSSmart zipGetFileAsString(JSSmart name); - JSSmart zipGetFileAsBinary(JSSmart name); - JSSmart zipCloseFile(); + /*[noexport]*/JSSmart SaveChanges(JSSmart sParam, JSSmart nDeleteIndex, JSSmart nCount); + JSSmart ZipOpen(JSSmart name); + JSSmart ZipOpenBase64(JSSmart name); + JSSmart ZipFileAsString(JSSmart name); + JSSmart ZipFileAsBinary(JSSmart name); + JSSmart ZipClose(); JSSmart GetImageUrl(JSSmart sUrl); JSSmart GetImagesPath(); JSSmart GetImageOriginalSize(JSSmart sUrl); - static void CreateObjectInContext(const std::string& name, JSSmart context); - static void CreateObjectBuilderInContext(const std::string& name, JSSmart context); + DECLARE_EMBED_METHODS }; #endif // _BUILD_NATIVE_NATIVECONTROL_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/PointerEmbed.h b/DesktopEditor/doctrenderer/embed/PointerEmbed.h index a40fc2ace2..fc14e7220b 100644 --- a/DesktopEditor/doctrenderer/embed/PointerEmbed.h +++ b/DesktopEditor/doctrenderer/embed/PointerEmbed.h @@ -14,7 +14,7 @@ namespace NSPointerObjectDeleters #define POINTER_DELETER(CLASS_NAME, NAME) void NAME(void* data) { CLASS_NAME* p = (CLASS_NAME*)data; delete data; } using namespace NSJSBase; -class CPointerEmbedObject : public CJSEmbedObject +class JS_DECL CPointerEmbedObject : public CJSEmbedObject { public: void* Data; diff --git a/DesktopEditor/doctrenderer/embed/TextMeasurerEmbed.cpp b/DesktopEditor/doctrenderer/embed/TextMeasurerEmbed.cpp index f3efaa5422..37a75319e5 100644 --- a/DesktopEditor/doctrenderer/embed/TextMeasurerEmbed.cpp +++ b/DesktopEditor/doctrenderer/embed/TextMeasurerEmbed.cpp @@ -1,8 +1,9 @@ #include "./TextMeasurerEmbed.h" +#include "./PointerEmbed.h" #include "./../../fontengine/TextShaper.h" -#define RAW_POINTER(value) ((CPointerEmbedObject*)value->toObjectSmart()->getNative())->Data -#define POINTER_OBJECT(value) ((CPointerEmbedObject*)value->toObjectSmart()->getNative()) +#define RAW_POINTER(value) ((CPointerEmbedObject*)value->toObject()->getNative())->Data +#define POINTER_OBJECT(value) ((CPointerEmbedObject*)value->toObject()->getNative()) // в js не хотим следить, чтобы в каждом face была ссылка на library - т.е. чтобы // сначала удалились все face, а потом library - поэтому делаем свой счетчик ссылок @@ -54,7 +55,7 @@ JSSmart CTextMeasurerEmbed::FT_Malloc(JSSmart typed_array_or } JSSmart CTextMeasurerEmbed::FT_Free(JSSmart pointer) { - CPointerEmbedObject* pEmbed = (CPointerEmbedObject*)pointer->toObjectSmart()->getNative(); + CPointerEmbedObject* pEmbed = (CPointerEmbedObject*)pointer->toObject()->getNative(); pEmbed->Free(); return CJSContext::createUndefined(); } diff --git a/DesktopEditor/doctrenderer/embed/TextMeasurerEmbed.h b/DesktopEditor/doctrenderer/embed/TextMeasurerEmbed.h index ca5f0f97dd..f7a0f9be47 100644 --- a/DesktopEditor/doctrenderer/embed/TextMeasurerEmbed.h +++ b/DesktopEditor/doctrenderer/embed/TextMeasurerEmbed.h @@ -2,14 +2,13 @@ #define _BUILD_NATIVE_TEXT_MEASURER_EMBED_H_ #include "../js_internal/js_base.h" -#include "./PointerEmbed.h" #if defined(__ANDROID__) || defined(_IOS) #define SUPPORT_HARFBUZZ_SHAPER #endif using namespace NSJSBase; -class CTextMeasurerEmbed : public CJSEmbedObject +class JS_DECL CTextMeasurerEmbed : public CJSEmbedObject { public: CTextMeasurerEmbed() @@ -51,7 +50,7 @@ public: JSSmart HB_FontFree(JSSmart font); #endif - static void CreateObjectInContext(const std::string& name, JSSmart context); + DECLARE_EMBED_METHODS }; #endif // _BUILD_NATIVE_TEXT_MEASURER_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/ZipEmbed.h b/DesktopEditor/doctrenderer/embed/ZipEmbed.h index 60464be032..35bb724ffb 100644 --- a/DesktopEditor/doctrenderer/embed/ZipEmbed.h +++ b/DesktopEditor/doctrenderer/embed/ZipEmbed.h @@ -5,7 +5,7 @@ #include "../js_internal/js_base.h" using namespace NSJSBase; -class CZipEmbed : public CJSEmbedObject +class JS_DECL CZipEmbed : public CJSEmbedObject { public: IFolder* m_pFolder; @@ -37,7 +37,7 @@ public: JSSmart encodeImage(JSSmart typedArray, JSSmart format); JSSmart getImageType(JSSmart typedArray); - static void CreateObjectInContext(const std::string& name, JSSmart context); + DECLARE_EMBED_METHODS }; #endif // _BUILD_NATIVE_ZIP_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/embed/embed.py b/DesktopEditor/doctrenderer/embed/embed.py new file mode 100644 index 0000000000..5cb543d7b7 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/embed.py @@ -0,0 +1,347 @@ +import sys +import re +import os +import argparse + +class MethodInfo: + def __init__(self, name, args): + self.name = name + self.args = args + +class MethodList: + def __init__(self, ifdef, methods): + self.ifdef = ifdef + self.methods = methods + +def makeDir(dirname): + if not os.path.exists(dirname): + os.mkdir(dirname) + +def getMethods(content): + methods = [] + # Extract name and argument list of the methods that return JSSmart + src_methods = re.findall(r'JSSmart\\s+(\w+)\s*\(([^\)]*)\)\s*;', content) + # Get method names and argument lists + for src_method in src_methods: + args = re.findall(r'JSSmart\\s+(\w+)', src_method[1]) + + method = MethodInfo(src_method[0], args) + methods.append(method) + + return methods + +def parseHeader(header_file): + class_name = '' + method_lists = [] + with open(header_file, 'r') as file: + content = file.read() + + # Extract the class name + match = re.search(r'class\s+(\w+)\s*:\s*public\s+CJSEmbedObject', content) + if match: + class_name = match.group(1) + else: + print("No class derived from CJSEmbedObject was found") + sys.exit(1) + + # Remove all functions which start with "/*[noexport]*/" comment + content = re.sub(r'/\*\[noexport\]\*/\s*JSSmart\\s+\w+\s*\([^\)]*\)\s*;', '', content) + + # Handle methods inside of ifdef blocks + ifdef_blocks = re.findall(r'#ifdef\s+([\w\d_]+)\s+(.*?)#endif', content, re.DOTALL) + for ifdef_block in ifdef_blocks: + methods = getMethods(ifdef_block[1]) + if len(methods) > 0: + method_lists.append(MethodList(ifdef_block[0], methods)) + content = content.replace(ifdef_block[1], '') + + # Add all other methods + method_lists.append(MethodList(None, getMethods(content))) + + return class_name, method_lists + +def generateCommonCode(class_name): + code = "std::string " + class_name + "::getName() { return \"" + class_name + "\"; }\n" + code += "\n" + code += "CJSEmbedObject* " + class_name + "::getCreator()\n" + code += "{\n" + code += " return new " + class_name + "();\n" + code += "}\n" + return code + +def generateV8InternalCode(class_name, method_lists, header_file): + code = "// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT!\n" + code += "// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH \"--internal\" OPTION.\n\n" + code += "#include \"../" + header_file + "\"\n" + code += "#include \"../../js_internal/v8/v8_base.h\"\n\n" + namespace_name = "NS" + header_file[:-2] + code += "namespace " + namespace_name + "\n" + code += "{\n" + code += "#define CURRENTWRAPPER " + class_name + "\n\n" + for method_list in method_lists: + if method_list.ifdef: + code += "#ifdef " + method_list.ifdef + "\n" + for method in method_list.methods: + code += " FUNCTION_WRAPPER_V8_" + str(len(method.args)) + "(_" + method.name + ", " + method.name + ")\n" + if method_list.ifdef: + code += "#endif\n" + code += "\n" + code += " v8::Handle CreateTemplate(v8::Isolate* isolate)\n" + code += " {\n" + code += " v8::EscapableHandleScope handle_scope(isolate);\n" + code += " v8::Local result = v8::ObjectTemplate::New(isolate);\n" + code += " result->SetInternalFieldCount(1);\n" + code += "\n" + for method_list in method_lists: + if method_list.ifdef: + code += "#ifdef " + method_list.ifdef + "\n" + for method in method_list.methods: + code += " NSV8Objects::Template_Set(result, \"" + method.name + "\", _" + method.name + ");\n" + if method_list.ifdef: + code += "#endif\n" + code += "\n" + code += " return handle_scope.Escape(result);\n" + code += " }\n" + code += "}\n" + code += "\n" + adapter_name = class_name + "Adapter" + code += "class " + adapter_name + " : public CJSEmbedObjectAdapterV8Template\n" + code += "{\n" + code += "public:\n" + code += " virtual v8::Local getTemplate(v8::Isolate* isolate) override\n" + code += " {\n" + code += " v8::EscapableHandleScope handle_scope(isolate);\n" + code += " v8::Local templ = " + namespace_name + "::CreateTemplate(isolate);\n" + code += " return handle_scope.Escape(templ);\n" + code += " }\n" + code += "};\n" + code += "\n" + code += "CJSEmbedObjectAdapterBase* " + class_name + "::getAdapter()\n" + code += "{\n" + code += " if (m_pAdapter == nullptr)\n" + code += " m_pAdapter = new " + adapter_name + "();\n" + code += " return m_pAdapter;\n" + code += "}\n\n" + return code + +def generateJSCInternalCode(class_name, method_lists, header_file): + code = "// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT!\n" + code += "// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH \"--internal\" OPTION.\n\n" + code += "#include \"../" + header_file + "\"\n" + code += "#include \"../../js_internal/jsc/jsc_base.h\"\n\n" + objc_protocol_name = "IJS" + class_name + code += "@protocol " + objc_protocol_name + " \n" + for method_list in method_lists: + if method_list.ifdef: + code += "#ifdef " + method_list.ifdef + "\n" + for method in method_list.methods: + code += "-(JSValue*) " + method.name + for arg in method.args: + code += " : (JSValue*)" + arg + code += ";\n" + if method_list.ifdef: + code += "#endif\n" + code += "@end\n\n" + objc_class_name = "CJS" + class_name + code += "@interface " + objc_class_name + " : NSObject<" + objc_protocol_name + ", JSEmbedObjectProtocol>\n" + code += "{\n" + code += "@public\n" + code += " " + class_name + "* m_internal;\n" + code += "}\n" + code += "@end\n\n" + code += "@implementation " + objc_class_name + "\n" + code += "EMBED_OBJECT_WRAPPER_METHODS(" + class_name + ");\n" + code += "\n" + for method_list in method_lists: + if method_list.ifdef: + code += "#ifdef " + method_list.ifdef + "\n" + for method in method_list.methods: + code += "FUNCTION_WRAPPER_JS_" + str(len(method.args)) + "(" + method.name + ", " + method.name + ")\n" + if method_list.ifdef: + code += "#endif\n" + code += "@end\n" + code += "\n" + adapter_name = class_name + "Adapter" + code += "class " + adapter_name + " : public CJSEmbedObjectAdapterJSC\n" + code += "{\n" + code += "public:\n" + code += " virtual id getExportedObject(CJSEmbedObject* pNative) override\n" + code += " {\n" + code += " return [[" + objc_class_name + " alloc] init:(" + class_name + "*)pNative];\n" + code += " }\n" + code += "};\n" + code += "\n" + code += "CJSEmbedObjectAdapterBase* " + class_name + "::getAdapter()\n" + code += "{\n" + code += " if (m_pAdapter == nullptr)\n" + code += " m_pAdapter = new " + adapter_name + "();\n" + code += " return m_pAdapter;\n" + code += "}\n\n" + return code + +def generateV8ExternalCode(class_name, method_lists, header_file): + code = "// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT!\n" + code += "// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT.\n\n" + code += "#include \"../" + header_file + "\"\n" + code += "#include \"js_embed.h\"\n\n" + adapter_name = class_name + "Adapter" + code += "class " + adapter_name + " : public CJSEmbedObjectAdapterV8\n" + code += "{\n" + code += "public:\n" + code += " virtual std::vector getMethodNames() override\n" + code += " {\n" + code += " return std::vector {\n" + for method_list in method_lists: + if method_list.ifdef: + code += "#ifdef " + method_list.ifdef + "\n" + for method in method_list.methods: + code += " \"" + method.name + "\",\n" + if method_list.ifdef: + code += "#endif\n" + code += " };\n" + code += " }\n" + code += "\n" + code += " virtual void initFunctions(CJSEmbedObject* pNativeObjBase) override\n" + code += " {\n" + code += " " + class_name + "* pNativeObj = static_cast<" + class_name + "*>(pNativeObjBase);\n" + code += " m_functions = std::vector {\n" + for method_list in method_lists: + if method_list.ifdef: + code += "#ifdef " + method_list.ifdef + "\n" + for method in method_list.methods: + code += " [pNativeObj](CJSFunctionArguments* args) { return pNativeObj->" + method.name + "(" + for i in range(len(method.args)): + code += "args->Get(" + str(i) + ")" + if i != len(method.args) - 1: + code += ", " + code += "); },\n" + if method_list.ifdef: + code += "#endif\n" + code += " };\n" + code += " }\n" + code += "};\n" + code += "\n" + code += "CJSEmbedObjectAdapterBase* " + class_name + "::getAdapter()\n" + code += "{\n" + code += " if (m_pAdapter == nullptr)\n" + code += " m_pAdapter = new " + adapter_name + "();\n" + code += " return m_pAdapter;\n" + code += "}\n\n" + return code + +def generateJSCExternalCode(class_name, method_lists, header_file): + code = "// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT!\n" + code += "// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT.\n\n" + code += "#include \"../" + header_file + "\"\n" + code += "#import \"js_embed.h\"\n\n" + objc_protocol_name = "IJS" + class_name + code += "@protocol " + objc_protocol_name + " \n" + for method_list in method_lists: + if method_list.ifdef: + code += "#ifdef " + method_list.ifdef + "\n" + for method in method_list.methods: + code += "-(JSValue*) " + method.name + for arg in method.args: + code += " : (JSValue*)" + arg + code += ";\n" + if method_list.ifdef: + code += "#endif\n" + code += "@end\n" + code += "\n" + objc_class_name = "CJS" + class_name + code += "@interface " + objc_class_name + " : NSObject<" + objc_protocol_name + ", JSEmbedObjectProtocol>\n" + code += "{\n" + code += "@public\n" + code += " " + class_name + "* m_internal;\n" + code += "}\n" + code += "@end\n" + code += "\n" + code += "@implementation " + objc_class_name + "\n" + code += "EMBED_OBJECT_WRAPPER_METHODS(" + class_name + ");\n" + code += "\n" + for method_list in method_lists: + if method_list.ifdef: + code += "#ifdef " + method_list.ifdef + "\n" + for method in method_list.methods: + code += "-(JSValue*) " + method.name + for arg in method.args: + code += " : (JSValue*)" + arg + code += "\n{\n" + code += " JSSmart ret = m_internal->" + method.name + "(" + for arg in method.args: + code += "CJSEmbedObjectAdapterJSC::Native2Value(" + arg + ")" + if arg != method.args[-1]: + code += ", " + code += ");\n" + code += " return CJSEmbedObjectAdapterJSC::Value2Native(ret);\n" + code += "}\n" + if method_list.ifdef: + code += "#endif\n\n" + code += "@end\n\n" + adapter_name = class_name + "Adapter" + code += "class " + adapter_name + " : public CJSEmbedObjectAdapterJSC\n" + code += "{\n" + code += "public:\n" + code += " virtual id getExportedObject(CJSEmbedObject* pNative) override\n" + code += " {\n" + code += " return [[" + objc_class_name + " alloc] init:(" + class_name + "*)pNative];\n" + code += " }\n" + code += "};\n" + code += "\n" + code += "CJSEmbedObjectAdapterBase* " + class_name + "::getAdapter()\n" + code += "{\n" + code += " if (m_pAdapter == nullptr)\n" + code += " m_pAdapter = new " + adapter_name + "();\n" + code += " return m_pAdapter;\n" + code += "}\n\n" + return code + +def writeToFile(file_name, content): + with open(file_name, 'w') as file: + file.write(content) + print("\t" + file_name) + +# MAIN +parser = argparse.ArgumentParser(description='Generate files for embedding your class into JS') +parser.add_argument('filename', help='the path to .h file with class you want to embed'); +parser.add_argument('-i', '--internal', action='store_true', help='for internal library usage') + +# if filename wasn't specified the programm will stop here +args = parser.parse_args() + +header_file = args.filename; +if header_file[-2:] != ".h": + print("Argument must be a header file with \".h\" extension!") + sys.exit(1); + +header_dir = os.path.dirname(header_file) +if len(header_dir) == 0: + header_dir = "." + +header_base_name = os.path.basename(header_file) +header_base_name_no_extension = header_base_name[:-2] +class_name, method_lists = parseHeader(header_file) + +if not class_name: + print("Proper class was not found in specified header file.") + sys.exit(1) + +v8_dir = header_dir + "/v8" +jsc_dir = header_dir + "/jsc" +makeDir(v8_dir) +makeDir(jsc_dir) + +code_common = generateCommonCode(class_name) +code_v8 = "" +code_jsc = "" + +if args.internal: + code_v8 = generateV8InternalCode(class_name, method_lists, header_base_name) + code_jsc = generateJSCInternalCode(class_name, method_lists, header_base_name) +else: + code_v8 = generateV8ExternalCode(class_name, method_lists, header_base_name) + code_jsc = generateJSCExternalCode(class_name, method_lists, header_base_name) + +print("Generated code was written to:") +writeToFile(v8_dir + "/v8_" + header_base_name_no_extension + ".cpp", code_v8 + code_common) +writeToFile(jsc_dir + "/jsc_" + header_base_name_no_extension + ".mm", code_jsc + code_common) diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_Graphics.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_Graphics.mm deleted file mode 100644 index c2e3493ebe..0000000000 --- a/DesktopEditor/doctrenderer/embed/jsc/jsc_Graphics.mm +++ /dev/null @@ -1,255 +0,0 @@ -#include "../GraphicsEmbed.h" -#include "../../js_internal/jsc/jsc_base.h" - -@protocol IJSCGraphics --(JSValue*) create : (JSValue*)Native : (JSValue*)width_px : (JSValue*)height_px : (JSValue*)width_mm : (JSValue*)height_mm; --(JSValue*) Destroy; --(JSValue*) EndDraw; --(JSValue*) put_GlobalAlpha : (JSValue*)enable : (JSValue*)globalAlpha; --(JSValue*) Start_GlobalAlpha; --(JSValue*) End_GlobalAlpha; -// pen methods --(JSValue*) p_color : (JSValue*)r : (JSValue*)g : (JSValue*)b : (JSValue*)a; --(JSValue*) p_width : (JSValue*)w; --(JSValue*) p_dash : (JSValue*)params; -// brush methods --(JSValue*) b_color1 : (JSValue*)r : (JSValue*)g : (JSValue*)b :(JSValue*)a; --(JSValue*) b_color2 : (JSValue*)r : (JSValue*)g : (JSValue*)b :(JSValue*)a; --(JSValue*) transform : (JSValue*)sx : (JSValue*)shy : (JSValue*)shx : (JSValue*)sy : (JSValue*)tx : (JSValue*)ty; --(JSValue*) CalculateFullTransform : (JSValue*)isInvertNeed; -// path commands --(JSValue*) _s; --(JSValue*) _e; --(JSValue*) _z; --(JSValue*) _m : (JSValue*)x : (JSValue*)y; --(JSValue*) _l : (JSValue*)x : (JSValue*)y; --(JSValue*) _c : (JSValue*)x1 : (JSValue*)y1 : (JSValue*)x2 : (JSValue*)y2 : (JSValue*)x3 : (JSValue*)y3; --(JSValue*) _c2 : (JSValue*)x1 : (JSValue*)y1 : (JSValue*)x2 : (JSValue*)y2; --(JSValue*) ds; --(JSValue*) df; -// canvas state --(JSValue*)save; --(JSValue*)restore; --(JSValue*)clip; --(JSValue*)reset; --(JSValue*)FreeFont; --(JSValue*)ClearLastFont; -// images --(JSValue*)drawImage2 : (JSValue*)img : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h : (JSValue*)alpha : (JSValue*)srcRect; --(JSValue*)drawImage : (JSValue*)img : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h : (JSValue*)alpha : (JSValue*)srcRect : (JSValue*)nativeImage; -// text --(JSValue*)GetFont; --(JSValue*)font : (JSValue*)font_id : (JSValue*)font_size; --(JSValue*)SetFont : (JSValue*)path : (JSValue*)face : (JSValue*)size : (JSValue*)style; --(JSValue*)GetTextPr; --(JSValue*)FillText : (JSValue*)x : (JSValue*)y : (JSValue*)text; --(JSValue*)t : (JSValue*)x : (JSValue*)y : (JSValue*)_arr; --(JSValue*)FillText2 : (JSValue*)x : (JSValue*)y : (JSValue*)text : (JSValue*)cropX : (JSValue*)cropW; --(JSValue*)t2 : (JSValue*)text : (JSValue*)x : (JSValue*)y : (JSValue*)cropX : (JSValue*)cropW; --(JSValue*)FillTextCode : (JSValue*)x : (JSValue*)y : (JSValue*)lUnicode; --(JSValue*)tg : (JSValue*)text : (JSValue*)x : (JSValue*)y; --(JSValue*)charspace : (JSValue*)space; -// private methods --(JSValue*)private_FillGlyph : (JSValue*)pGlyph : (JSValue*)_bounds; --(JSValue*)private_FillGlyphC : (JSValue*)pGlyph : (JSValue*)cropX : (JSValue*)cropW; --(JSValue*)private_FillGlyph2 : (JSValue*)pGlyph; --(JSValue*)SetIntegerGrid : (JSValue*)param; --(JSValue*)GetIntegerGrid; --(JSValue*)DrawStringASCII : (JSValue*)text : (JSValue*)x : (JSValue*)y; --(JSValue*)DrawStringASCII2 : (JSValue*)text : (JSValue*)x : (JSValue*)y; --(JSValue*)DrawHeaderEdit : (JSValue*)yPos : (JSValue*)lock_type : (JSValue*)sectionNum : (JSValue*)bIsRepeat : (JSValue*)type; --(JSValue*)DrawFooterEdit : (JSValue*)yPos : (JSValue*)lock_type : (JSValue*)sectionNum : (JSValue*)bIsRepeat : (JSValue*)type; --(JSValue*)DrawLockParagraph : (JSValue*)x : (JSValue*)y1 : (JSValue*)y2; --(JSValue*)DrawLockObjectRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)DrawEmptyTableLine : (JSValue*)x1 : (JSValue*)y1 : (JSValue*)x2 : (JSValue*)y2; --(JSValue*)DrawSpellingLine : (JSValue*)y0 : (JSValue*)x0 : (JSValue*)x1 : (JSValue*)w; -// smart methods for horizontal / vertical lines --(JSValue*)drawHorLine : (JSValue*)align : (JSValue*)y : (JSValue*)x : (JSValue*)r : (JSValue*)penW; --(JSValue*)drawHorLine2 : (JSValue*)align : (JSValue*)y : (JSValue*)x : (JSValue*)r : (JSValue*)penW; --(JSValue*)drawVerLine : (JSValue*)align : (JSValue*)x : (JSValue*)y : (JSValue*)b : (JSValue*)penW; -// мега крутые функции для таблиц --(JSValue*)drawHorLineExt : (JSValue*)align : (JSValue*)y : (JSValue*)x : (JSValue*)r : (JSValue*)penW : (JSValue*)leftMW : (JSValue*)rightMW; --(JSValue*)rect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)TableRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; -// функции клиппирования --(JSValue*)AddClipRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)RemoveClipRect; --(JSValue*)SetClip : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)RemoveClip; --(JSValue*)drawMailMergeField : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)drawSearchResult : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)drawFlowAnchor : (JSValue*)x : (JSValue*)y; --(JSValue*)SavePen; --(JSValue*)RestorePen; --(JSValue*)SaveBrush; --(JSValue*)RestoreBrush; --(JSValue*)SavePenBrush; --(JSValue*)RestorePenBrush; --(JSValue*)SaveGrState; --(JSValue*)RestoreGrState; --(JSValue*)StartClipPath; --(JSValue*)EndClipPath; --(JSValue*)StartCheckTableDraw; --(JSValue*)SetTextClipRect : (JSValue*)_l : (JSValue*)_t : (JSValue*)_r : (JSValue*)_b; --(JSValue*)AddSmartRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h : (JSValue*)pen_w; --(JSValue*)CheckUseFonts2 : (JSValue*)_transform; --(JSValue*)UncheckUseFonts2; --(JSValue*)Drawing_StartCheckBounds : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)Drawing_EndCheckBounds; --(JSValue*)DrawPresentationComment : (JSValue*)type : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)DrawPolygon : (JSValue*)oPath : (JSValue*)lineWidth : (JSValue*)shift; --(JSValue*)DrawFootnoteRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; -// new methods --(JSValue*)toDataURL: (JSValue*)type; --(JSValue*)GetPenColor; --(JSValue*)GetBrushColor; --(JSValue*)put_brushTexture : (JSValue*)src : (JSValue*)type; --(JSValue*)put_brushTextureMode : (JSValue*)mode; --(JSValue*)put_BrushTextureAlpha : (JSValue*)a; --(JSValue*)put_BrushGradient : (JSValue*)colors : (JSValue*)n : (JSValue*)x0 : (JSValue*)y0 : (JSValue*)x1 : (JSValue*)y1 : (JSValue*)r0 : (JSValue*)r1; --(JSValue*)TransformPointX : (JSValue*)x : (JSValue*)y; --(JSValue*)TransformPointY : (JSValue*)x : (JSValue*)y; --(JSValue*)put_LineJoin : (JSValue*)join; --(JSValue*)get_LineJoin; --(JSValue*)put_TextureBounds : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; --(JSValue*)GetlineWidth; --(JSValue*)DrawPath : (JSValue*)path; --(JSValue*)CoordTransformOffset : (JSValue*)tx : (JSValue*)ty; --(JSValue*)GetTransform; - -@end - -@interface CJSCGraphics : NSObject -{ -@public - CGraphicsEmbed* m_internal; -} -@end - -@implementation CJSCGraphics - -EMBED_OBJECT_WRAPPER_METHODS(CGraphicsEmbed) - -FUNCTION_WRAPPER_JS_5(create, init) -FUNCTION_WRAPPER_JS(Destroy, Destroy) -FUNCTION_WRAPPER_JS(EndDraw, EndDraw) -FUNCTION_WRAPPER_JS_2(put_GlobalAlpha, put_GlobalAlpha) -FUNCTION_WRAPPER_JS(Start_GlobalAlpha, Start_GlobalAlpha) -FUNCTION_WRAPPER_JS(End_GlobalAlpha, End_GlobalAlpha) -// pen methods -FUNCTION_WRAPPER_JS_4(p_color, p_color) -FUNCTION_WRAPPER_JS_1(p_width, p_width) -FUNCTION_WRAPPER_JS_1(p_dash, p_dash) -// brush methods -FUNCTION_WRAPPER_JS_4(b_color1, b_color1) -FUNCTION_WRAPPER_JS_4(b_color2, b_color2) -FUNCTION_WRAPPER_JS_6(transform, transform) -FUNCTION_WRAPPER_JS_1(CalculateFullTransform, CalculateFullTransform) -// path commands -FUNCTION_WRAPPER_JS(_s, _s) -FUNCTION_WRAPPER_JS(_e, _e) -FUNCTION_WRAPPER_JS(_z, _z) -FUNCTION_WRAPPER_JS_2(_m, _m) -FUNCTION_WRAPPER_JS_2(_l, _l) -FUNCTION_WRAPPER_JS_6(_c, _c) -FUNCTION_WRAPPER_JS_4(_c2, _c2) -FUNCTION_WRAPPER_JS(ds, ds) -FUNCTION_WRAPPER_JS(df, df) -// canvas state -FUNCTION_WRAPPER_JS(save, save) -FUNCTION_WRAPPER_JS(restore, restore) -FUNCTION_WRAPPER_JS(clip, clip) -FUNCTION_WRAPPER_JS(reset, reset) -FUNCTION_WRAPPER_JS(FreeFont, FreeFont) -FUNCTION_WRAPPER_JS(ClearLastFont, ClearLastFont) -// images -FUNCTION_WRAPPER_JS_7(drawImage2, drawImage2) -FUNCTION_WRAPPER_JS_8(drawImage, drawImage) -// text -FUNCTION_WRAPPER_JS(GetFont, GetFont) -FUNCTION_WRAPPER_JS_2(font, font) -FUNCTION_WRAPPER_JS_4(SetFont, SetFont) -FUNCTION_WRAPPER_JS (GetTextPr, GetTextPr) -FUNCTION_WRAPPER_JS_3(FillText, FillText) -FUNCTION_WRAPPER_JS_3(t, t) -FUNCTION_WRAPPER_JS_5(FillText2, FillText2) -FUNCTION_WRAPPER_JS_5(t2, t2) -FUNCTION_WRAPPER_JS_3(FillTextCode, FillTextCode) -FUNCTION_WRAPPER_JS_3(tg, tg) -FUNCTION_WRAPPER_JS_1(charspace, charspace) -// private methods -FUNCTION_WRAPPER_JS_2(private_FillGlyph, private_FillGlyph) -FUNCTION_WRAPPER_JS_3(private_FillGlyphC, private_FillGlyphC) -FUNCTION_WRAPPER_JS_1(private_FillGlyph2, private_FillGlyph2) -FUNCTION_WRAPPER_JS_1(SetIntegerGrid, SetIntegerGrid) -FUNCTION_WRAPPER_JS (GetIntegerGrid, GetIntegerGrid) -FUNCTION_WRAPPER_JS_3(DrawStringASCII, DrawStringASCII) -FUNCTION_WRAPPER_JS_3(DrawStringASCII2, DrawStringASCII2) -FUNCTION_WRAPPER_JS_5(DrawHeaderEdit, DrawHeaderEdit) -FUNCTION_WRAPPER_JS_5(DrawFooterEdit, DrawFooterEdit) -FUNCTION_WRAPPER_JS_3(DrawLockParagraph, DrawLockParagraph) -FUNCTION_WRAPPER_JS_4(DrawLockObjectRect, DrawLockObjectRect) -FUNCTION_WRAPPER_JS_4(DrawEmptyTableLine, DrawEmptyTableLine) -FUNCTION_WRAPPER_JS_4(DrawSpellingLine, DrawSpellingLine) -// smart methods for horizontal / vertical lines -FUNCTION_WRAPPER_JS_5(drawHorLine, drawHorLine) -FUNCTION_WRAPPER_JS_5(drawHorLine2, drawHorLine2) -FUNCTION_WRAPPER_JS_5(drawVerLine, drawVerLine) -// мега крутые функции для таблиц -FUNCTION_WRAPPER_JS_7(drawHorLineExt, drawHorLineExt) -FUNCTION_WRAPPER_JS_4(rect, rect) -FUNCTION_WRAPPER_JS_4(TableRect, TableRect) -// функции клиппирования -FUNCTION_WRAPPER_JS_4(AddClipRect, AddClipRect) -FUNCTION_WRAPPER_JS (RemoveClipRect, RemoveClipRect) -FUNCTION_WRAPPER_JS_4(SetClip, SetClip) -FUNCTION_WRAPPER_JS(RemoveClip, RemoveClip) -FUNCTION_WRAPPER_JS_4(drawMailMergeField, drawMailMergeField) -FUNCTION_WRAPPER_JS_4(drawSearchResult, drawSearchResult) -FUNCTION_WRAPPER_JS_2(drawFlowAnchor, drawFlowAnchor) -FUNCTION_WRAPPER_JS(SavePen, SavePen) -FUNCTION_WRAPPER_JS(RestorePen, RestorePen) -FUNCTION_WRAPPER_JS(SaveBrush, SaveBrush) -FUNCTION_WRAPPER_JS(RestoreBrush, RestoreBrush) -FUNCTION_WRAPPER_JS(SavePenBrush, SavePenBrush) -FUNCTION_WRAPPER_JS(RestorePenBrush, RestorePenBrush) -FUNCTION_WRAPPER_JS(SaveGrState, SaveGrState) -FUNCTION_WRAPPER_JS(RestoreGrState, RestoreGrState) -FUNCTION_WRAPPER_JS(StartClipPath, StartClipPath) -FUNCTION_WRAPPER_JS(EndClipPath, EndClipPath) -FUNCTION_WRAPPER_JS(StartCheckTableDraw, StartCheckTableDraw) -FUNCTION_WRAPPER_JS_4(SetTextClipRect, SetTextClipRect) -FUNCTION_WRAPPER_JS_5(AddSmartRect, AddSmartRect) -FUNCTION_WRAPPER_JS_1(CheckUseFonts2, CheckUseFonts2) -FUNCTION_WRAPPER_JS(UncheckUseFonts2, UncheckUseFonts2) -FUNCTION_WRAPPER_JS_4(Drawing_StartCheckBounds, Drawing_StartCheckBounds) -FUNCTION_WRAPPER_JS(Drawing_EndCheckBounds, Drawing_EndCheckBounds) -FUNCTION_WRAPPER_JS_5(DrawPresentationComment, DrawPresentationComment) -FUNCTION_WRAPPER_JS_3(DrawPolygon, DrawPolygon) -FUNCTION_WRAPPER_JS_4(DrawFootnoteRect, DrawFootnoteRect) -// new methods -FUNCTION_WRAPPER_JS_1(toDataURL, toDataURL) -FUNCTION_WRAPPER_JS(GetPenColor, GetPenColor) -FUNCTION_WRAPPER_JS(GetBrushColor, GetBrushColor) -FUNCTION_WRAPPER_JS_2(put_brushTexture, put_brushTexture) -FUNCTION_WRAPPER_JS_1(put_brushTextureMode, put_brushTextureMode) -FUNCTION_WRAPPER_JS_1(put_BrushTextureAlpha, put_BrushTextureAlpha) -FUNCTION_WRAPPER_JS_8(put_BrushGradient, put_BrushGradient) -FUNCTION_WRAPPER_JS_2(TransformPointX, TransformPointX) -FUNCTION_WRAPPER_JS_2(TransformPointY, TransformPointY) -FUNCTION_WRAPPER_JS_1(put_LineJoin, put_LineJoin) -FUNCTION_WRAPPER_JS(get_LineJoin, get_LineJoin) -FUNCTION_WRAPPER_JS_4(put_TextureBounds, put_TextureBounds) -FUNCTION_WRAPPER_JS(GetlineWidth, GetlineWidth) -FUNCTION_WRAPPER_JS_1(DrawPath, DrawPath) -FUNCTION_WRAPPER_JS_2(CoordTransformOffset, CoordTransformOffset) -FUNCTION_WRAPPER_JS(GetTransform, GetTransform) - -@end - -void CGraphicsEmbed::CreateObjectInContext(const std::string &name, JSSmart context) -{ - context->m_internal->context[[NSString stringWithAString:name]] = ^(){ - return [[CJSCGraphics alloc] init]; - }; -} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_GraphicsEmbed.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_GraphicsEmbed.mm new file mode 100644 index 0000000000..0928dcb2d6 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/jsc/jsc_GraphicsEmbed.mm @@ -0,0 +1,249 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../GraphicsEmbed.h" +#include "../../js_internal/jsc/jsc_base.h" + +@protocol IJSCGraphicsEmbed +-(JSValue*) create : (JSValue*)Native : (JSValue*)width_px : (JSValue*)height_px : (JSValue*)width_mm : (JSValue*)height_mm; +-(JSValue*) Destroy; +-(JSValue*) EndDraw; +-(JSValue*) put_GlobalAlpha : (JSValue*)enable : (JSValue*)globalAlpha; +-(JSValue*) Start_GlobalAlpha; +-(JSValue*) End_GlobalAlpha; +-(JSValue*) p_color : (JSValue*)r : (JSValue*)g : (JSValue*)b : (JSValue*)a; +-(JSValue*) p_width : (JSValue*)w; +-(JSValue*) p_dash : (JSValue*)params; +-(JSValue*) b_color1 : (JSValue*)r : (JSValue*)g : (JSValue*)b : (JSValue*)a; +-(JSValue*) b_color2 : (JSValue*)r : (JSValue*)g : (JSValue*)b : (JSValue*)a; +-(JSValue*) transform : (JSValue*)sx : (JSValue*)shy : (JSValue*)shx : (JSValue*)sy : (JSValue*)tx : (JSValue*)ty; +-(JSValue*) CalculateFullTransform : (JSValue*)isInvertNeed; +-(JSValue*) _s; +-(JSValue*) _e; +-(JSValue*) _z; +-(JSValue*) _m : (JSValue*)x : (JSValue*)y; +-(JSValue*) _l : (JSValue*)x : (JSValue*)y; +-(JSValue*) _c : (JSValue*)x1 : (JSValue*)y1 : (JSValue*)x2 : (JSValue*)y2 : (JSValue*)x3 : (JSValue*)y3; +-(JSValue*) _c2 : (JSValue*)x1 : (JSValue*)y1 : (JSValue*)x2 : (JSValue*)y2; +-(JSValue*) ds; +-(JSValue*) df; +-(JSValue*) save; +-(JSValue*) restore; +-(JSValue*) clip; +-(JSValue*) reset; +-(JSValue*) FreeFont; +-(JSValue*) ClearLastFont; +-(JSValue*) drawImage2 : (JSValue*)img : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h : (JSValue*)alpha : (JSValue*)srcRect; +-(JSValue*) drawImage : (JSValue*)img : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h : (JSValue*)alpha : (JSValue*)srcRect : (JSValue*)nativeImage; +-(JSValue*) GetFont; +-(JSValue*) font : (JSValue*)font_id : (JSValue*)font_size; +-(JSValue*) SetFont : (JSValue*)path : (JSValue*)face : (JSValue*)size : (JSValue*)style; +-(JSValue*) GetTextPr; +-(JSValue*) FillText : (JSValue*)x : (JSValue*)y : (JSValue*)text; +-(JSValue*) t : (JSValue*)x : (JSValue*)y : (JSValue*)_arr; +-(JSValue*) FillText2 : (JSValue*)x : (JSValue*)y : (JSValue*)text : (JSValue*)cropX : (JSValue*)cropW; +-(JSValue*) t2 : (JSValue*)text : (JSValue*)x : (JSValue*)y : (JSValue*)cropX : (JSValue*)cropW; +-(JSValue*) FillTextCode : (JSValue*)x : (JSValue*)y : (JSValue*)lUnicode; +-(JSValue*) tg : (JSValue*)text : (JSValue*)x : (JSValue*)y; +-(JSValue*) charspace : (JSValue*)space; +-(JSValue*) private_FillGlyph : (JSValue*)pGlyph : (JSValue*)_bounds; +-(JSValue*) private_FillGlyphC : (JSValue*)pGlyph : (JSValue*)cropX : (JSValue*)cropW; +-(JSValue*) private_FillGlyph2 : (JSValue*)pGlyph; +-(JSValue*) SetIntegerGrid : (JSValue*)param; +-(JSValue*) GetIntegerGrid; +-(JSValue*) DrawStringASCII : (JSValue*)text : (JSValue*)x : (JSValue*)y; +-(JSValue*) DrawStringASCII2 : (JSValue*)text : (JSValue*)x : (JSValue*)y; +-(JSValue*) DrawHeaderEdit : (JSValue*)yPos : (JSValue*)lock_type : (JSValue*)sectionNum : (JSValue*)bIsRepeat : (JSValue*)type; +-(JSValue*) DrawFooterEdit : (JSValue*)yPos : (JSValue*)lock_type : (JSValue*)sectionNum : (JSValue*)bIsRepeat : (JSValue*)type; +-(JSValue*) DrawLockParagraph : (JSValue*)x : (JSValue*)y1 : (JSValue*)y2; +-(JSValue*) DrawLockObjectRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) DrawEmptyTableLine : (JSValue*)x1 : (JSValue*)y1 : (JSValue*)x2 : (JSValue*)y2; +-(JSValue*) DrawSpellingLine : (JSValue*)y0 : (JSValue*)x0 : (JSValue*)x1 : (JSValue*)w; +-(JSValue*) drawHorLine : (JSValue*)align : (JSValue*)y : (JSValue*)x : (JSValue*)r : (JSValue*)penW; +-(JSValue*) drawHorLine2 : (JSValue*)align : (JSValue*)y : (JSValue*)x : (JSValue*)r : (JSValue*)penW; +-(JSValue*) drawVerLine : (JSValue*)align : (JSValue*)x : (JSValue*)y : (JSValue*)b : (JSValue*)penW; +-(JSValue*) drawHorLineExt : (JSValue*)align : (JSValue*)y : (JSValue*)x : (JSValue*)r : (JSValue*)penW : (JSValue*)leftMW : (JSValue*)rightMW; +-(JSValue*) rect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) TableRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) AddClipRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) RemoveClipRect; +-(JSValue*) SetClip : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) RemoveClip; +-(JSValue*) drawMailMergeField : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) drawSearchResult : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) drawFlowAnchor : (JSValue*)x : (JSValue*)y; +-(JSValue*) SavePen; +-(JSValue*) RestorePen; +-(JSValue*) SaveBrush; +-(JSValue*) RestoreBrush; +-(JSValue*) SavePenBrush; +-(JSValue*) RestorePenBrush; +-(JSValue*) SaveGrState; +-(JSValue*) RestoreGrState; +-(JSValue*) StartClipPath; +-(JSValue*) EndClipPath; +-(JSValue*) StartCheckTableDraw; +-(JSValue*) SetTextClipRect : (JSValue*)_l : (JSValue*)_t : (JSValue*)_r : (JSValue*)_b; +-(JSValue*) AddSmartRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h : (JSValue*)pen_w; +-(JSValue*) CheckUseFonts2 : (JSValue*)_transform; +-(JSValue*) UncheckUseFonts2; +-(JSValue*) Drawing_StartCheckBounds : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) Drawing_EndCheckBounds; +-(JSValue*) DrawPresentationComment : (JSValue*)type : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) DrawPolygon : (JSValue*)oPath : (JSValue*)lineWidth : (JSValue*)shift; +-(JSValue*) DrawFootnoteRect : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) toDataURL : (JSValue*)type; +-(JSValue*) GetPenColor; +-(JSValue*) GetBrushColor; +-(JSValue*) put_brushTexture : (JSValue*)src : (JSValue*)type; +-(JSValue*) put_brushTextureMode : (JSValue*)mode; +-(JSValue*) put_BrushTextureAlpha : (JSValue*)a; +-(JSValue*) put_BrushGradient : (JSValue*)colors : (JSValue*)n : (JSValue*)x0 : (JSValue*)y0 : (JSValue*)x1 : (JSValue*)y1 : (JSValue*)r0 : (JSValue*)r1; +-(JSValue*) TransformPointX : (JSValue*)x : (JSValue*)y; +-(JSValue*) TransformPointY : (JSValue*)x : (JSValue*)y; +-(JSValue*) put_LineJoin : (JSValue*)join; +-(JSValue*) get_LineJoin; +-(JSValue*) put_TextureBounds : (JSValue*)x : (JSValue*)y : (JSValue*)w : (JSValue*)h; +-(JSValue*) GetlineWidth; +-(JSValue*) DrawPath : (JSValue*)path; +-(JSValue*) CoordTransformOffset : (JSValue*)tx : (JSValue*)ty; +-(JSValue*) GetTransform; +@end + +@interface CJSCGraphicsEmbed : NSObject +{ +@public + CGraphicsEmbed* m_internal; +} +@end + +@implementation CJSCGraphicsEmbed +EMBED_OBJECT_WRAPPER_METHODS(CGraphicsEmbed); + +FUNCTION_WRAPPER_JS_5(create, create) +FUNCTION_WRAPPER_JS_0(Destroy, Destroy) +FUNCTION_WRAPPER_JS_0(EndDraw, EndDraw) +FUNCTION_WRAPPER_JS_2(put_GlobalAlpha, put_GlobalAlpha) +FUNCTION_WRAPPER_JS_0(Start_GlobalAlpha, Start_GlobalAlpha) +FUNCTION_WRAPPER_JS_0(End_GlobalAlpha, End_GlobalAlpha) +FUNCTION_WRAPPER_JS_4(p_color, p_color) +FUNCTION_WRAPPER_JS_1(p_width, p_width) +FUNCTION_WRAPPER_JS_1(p_dash, p_dash) +FUNCTION_WRAPPER_JS_4(b_color1, b_color1) +FUNCTION_WRAPPER_JS_4(b_color2, b_color2) +FUNCTION_WRAPPER_JS_6(transform, transform) +FUNCTION_WRAPPER_JS_1(CalculateFullTransform, CalculateFullTransform) +FUNCTION_WRAPPER_JS_0(_s, _s) +FUNCTION_WRAPPER_JS_0(_e, _e) +FUNCTION_WRAPPER_JS_0(_z, _z) +FUNCTION_WRAPPER_JS_2(_m, _m) +FUNCTION_WRAPPER_JS_2(_l, _l) +FUNCTION_WRAPPER_JS_6(_c, _c) +FUNCTION_WRAPPER_JS_4(_c2, _c2) +FUNCTION_WRAPPER_JS_0(ds, ds) +FUNCTION_WRAPPER_JS_0(df, df) +FUNCTION_WRAPPER_JS_0(save, save) +FUNCTION_WRAPPER_JS_0(restore, restore) +FUNCTION_WRAPPER_JS_0(clip, clip) +FUNCTION_WRAPPER_JS_0(reset, reset) +FUNCTION_WRAPPER_JS_0(FreeFont, FreeFont) +FUNCTION_WRAPPER_JS_0(ClearLastFont, ClearLastFont) +FUNCTION_WRAPPER_JS_7(drawImage2, drawImage2) +FUNCTION_WRAPPER_JS_8(drawImage, drawImage) +FUNCTION_WRAPPER_JS_0(GetFont, GetFont) +FUNCTION_WRAPPER_JS_2(font, font) +FUNCTION_WRAPPER_JS_4(SetFont, SetFont) +FUNCTION_WRAPPER_JS_0(GetTextPr, GetTextPr) +FUNCTION_WRAPPER_JS_3(FillText, FillText) +FUNCTION_WRAPPER_JS_3(t, t) +FUNCTION_WRAPPER_JS_5(FillText2, FillText2) +FUNCTION_WRAPPER_JS_5(t2, t2) +FUNCTION_WRAPPER_JS_3(FillTextCode, FillTextCode) +FUNCTION_WRAPPER_JS_3(tg, tg) +FUNCTION_WRAPPER_JS_1(charspace, charspace) +FUNCTION_WRAPPER_JS_2(private_FillGlyph, private_FillGlyph) +FUNCTION_WRAPPER_JS_3(private_FillGlyphC, private_FillGlyphC) +FUNCTION_WRAPPER_JS_1(private_FillGlyph2, private_FillGlyph2) +FUNCTION_WRAPPER_JS_1(SetIntegerGrid, SetIntegerGrid) +FUNCTION_WRAPPER_JS_0(GetIntegerGrid, GetIntegerGrid) +FUNCTION_WRAPPER_JS_3(DrawStringASCII, DrawStringASCII) +FUNCTION_WRAPPER_JS_3(DrawStringASCII2, DrawStringASCII2) +FUNCTION_WRAPPER_JS_5(DrawHeaderEdit, DrawHeaderEdit) +FUNCTION_WRAPPER_JS_5(DrawFooterEdit, DrawFooterEdit) +FUNCTION_WRAPPER_JS_3(DrawLockParagraph, DrawLockParagraph) +FUNCTION_WRAPPER_JS_4(DrawLockObjectRect, DrawLockObjectRect) +FUNCTION_WRAPPER_JS_4(DrawEmptyTableLine, DrawEmptyTableLine) +FUNCTION_WRAPPER_JS_4(DrawSpellingLine, DrawSpellingLine) +FUNCTION_WRAPPER_JS_5(drawHorLine, drawHorLine) +FUNCTION_WRAPPER_JS_5(drawHorLine2, drawHorLine2) +FUNCTION_WRAPPER_JS_5(drawVerLine, drawVerLine) +FUNCTION_WRAPPER_JS_7(drawHorLineExt, drawHorLineExt) +FUNCTION_WRAPPER_JS_4(rect, rect) +FUNCTION_WRAPPER_JS_4(TableRect, TableRect) +FUNCTION_WRAPPER_JS_4(AddClipRect, AddClipRect) +FUNCTION_WRAPPER_JS_0(RemoveClipRect, RemoveClipRect) +FUNCTION_WRAPPER_JS_4(SetClip, SetClip) +FUNCTION_WRAPPER_JS_0(RemoveClip, RemoveClip) +FUNCTION_WRAPPER_JS_4(drawMailMergeField, drawMailMergeField) +FUNCTION_WRAPPER_JS_4(drawSearchResult, drawSearchResult) +FUNCTION_WRAPPER_JS_2(drawFlowAnchor, drawFlowAnchor) +FUNCTION_WRAPPER_JS_0(SavePen, SavePen) +FUNCTION_WRAPPER_JS_0(RestorePen, RestorePen) +FUNCTION_WRAPPER_JS_0(SaveBrush, SaveBrush) +FUNCTION_WRAPPER_JS_0(RestoreBrush, RestoreBrush) +FUNCTION_WRAPPER_JS_0(SavePenBrush, SavePenBrush) +FUNCTION_WRAPPER_JS_0(RestorePenBrush, RestorePenBrush) +FUNCTION_WRAPPER_JS_0(SaveGrState, SaveGrState) +FUNCTION_WRAPPER_JS_0(RestoreGrState, RestoreGrState) +FUNCTION_WRAPPER_JS_0(StartClipPath, StartClipPath) +FUNCTION_WRAPPER_JS_0(EndClipPath, EndClipPath) +FUNCTION_WRAPPER_JS_0(StartCheckTableDraw, StartCheckTableDraw) +FUNCTION_WRAPPER_JS_4(SetTextClipRect, SetTextClipRect) +FUNCTION_WRAPPER_JS_5(AddSmartRect, AddSmartRect) +FUNCTION_WRAPPER_JS_1(CheckUseFonts2, CheckUseFonts2) +FUNCTION_WRAPPER_JS_0(UncheckUseFonts2, UncheckUseFonts2) +FUNCTION_WRAPPER_JS_4(Drawing_StartCheckBounds, Drawing_StartCheckBounds) +FUNCTION_WRAPPER_JS_0(Drawing_EndCheckBounds, Drawing_EndCheckBounds) +FUNCTION_WRAPPER_JS_5(DrawPresentationComment, DrawPresentationComment) +FUNCTION_WRAPPER_JS_3(DrawPolygon, DrawPolygon) +FUNCTION_WRAPPER_JS_4(DrawFootnoteRect, DrawFootnoteRect) +FUNCTION_WRAPPER_JS_1(toDataURL, toDataURL) +FUNCTION_WRAPPER_JS_0(GetPenColor, GetPenColor) +FUNCTION_WRAPPER_JS_0(GetBrushColor, GetBrushColor) +FUNCTION_WRAPPER_JS_2(put_brushTexture, put_brushTexture) +FUNCTION_WRAPPER_JS_1(put_brushTextureMode, put_brushTextureMode) +FUNCTION_WRAPPER_JS_1(put_BrushTextureAlpha, put_BrushTextureAlpha) +FUNCTION_WRAPPER_JS_8(put_BrushGradient, put_BrushGradient) +FUNCTION_WRAPPER_JS_2(TransformPointX, TransformPointX) +FUNCTION_WRAPPER_JS_2(TransformPointY, TransformPointY) +FUNCTION_WRAPPER_JS_1(put_LineJoin, put_LineJoin) +FUNCTION_WRAPPER_JS_0(get_LineJoin, get_LineJoin) +FUNCTION_WRAPPER_JS_4(put_TextureBounds, put_TextureBounds) +FUNCTION_WRAPPER_JS_0(GetlineWidth, GetlineWidth) +FUNCTION_WRAPPER_JS_1(DrawPath, DrawPath) +FUNCTION_WRAPPER_JS_2(CoordTransformOffset, CoordTransformOffset) +FUNCTION_WRAPPER_JS_0(GetTransform, GetTransform) +@end + +class CGraphicsEmbedAdapter : public CJSEmbedObjectAdapterJSC +{ +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCGraphicsEmbed alloc] init:(CGraphicsEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CGraphicsEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CGraphicsEmbedAdapter(); + return m_pAdapter; +} + +std::string CGraphicsEmbed::getName() { return "CGraphicsEmbed"; } + +CJSEmbedObject* CGraphicsEmbed::getCreator() +{ + return new CGraphicsEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_Hash.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_Hash.mm deleted file mode 100644 index e5918e87eb..0000000000 --- a/DesktopEditor/doctrenderer/embed/jsc/jsc_Hash.mm +++ /dev/null @@ -1,31 +0,0 @@ -#include "../HashEmbed.h" -#include "../../js_internal/jsc/jsc_base.h" - -@protocol IJSCHash --(JSValue*) hash : (JSValue*)data : (JSValue*)size : (JSValue*)alg; --(JSValue*) hash2 : (JSValue*)password : (JSValue*)salt : (JSValue*)spinCount : (JSValue*)alg; - -@end - -@interface CJSCHash : NSObject -{ -@public - CHashEmbed* m_internal; -} -@end - -@implementation CJSCHash - -EMBED_OBJECT_WRAPPER_METHODS(CHashEmbed) - -FUNCTION_WRAPPER_JS_3(hash, hash) -FUNCTION_WRAPPER_JS_4(hash2, hash2) - -@end - -void CHashEmbed::CreateObjectInContext(const std::string &name, JSSmart context) -{ - context->m_internal->context[[NSString stringWithAString:name]] = ^(){ - return [[CJSCHash alloc] init]; - }; -} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_HashEmbed.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_HashEmbed.mm new file mode 100644 index 0000000000..035cca9108 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/jsc/jsc_HashEmbed.mm @@ -0,0 +1,47 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../HashEmbed.h" +#include "../../js_internal/jsc/jsc_base.h" + +@protocol IJSCHashEmbed +-(JSValue*) hash : (JSValue*)data : (JSValue*)size : (JSValue*)alg; +-(JSValue*) hash2 : (JSValue*)password : (JSValue*)salt : (JSValue*)spinCount : (JSValue*)alg; +@end + +@interface CJSCHashEmbed : NSObject +{ +@public + CHashEmbed* m_internal; +} +@end + +@implementation CJSCHashEmbed +EMBED_OBJECT_WRAPPER_METHODS(CHashEmbed); + +FUNCTION_WRAPPER_JS_3(hash, hash) +FUNCTION_WRAPPER_JS_4(hash2, hash2) +@end + +class CHashEmbedAdapter : public CJSEmbedObjectAdapterJSC +{ +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCHashEmbed alloc] init:(CHashEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CHashEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CHashEmbedAdapter(); + return m_pAdapter; +} + +std::string CHashEmbed::getName() { return "CHashEmbed"; } + +CJSEmbedObject* CHashEmbed::getCreator() +{ + return new CHashEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_MemoryStream.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_MemoryStream.mm deleted file mode 100644 index b3e45246cf..0000000000 --- a/DesktopEditor/doctrenderer/embed/jsc/jsc_MemoryStream.mm +++ /dev/null @@ -1,46 +0,0 @@ -#include "../MemoryStreamEmbed.h" -#include "../../js_internal/jsc/jsc_base.h" - -@protocol IJSCMemoryStream --(JSValue*) Copy : (JSValue*)value : (JSValue*)pos : (JSValue*)len; --(JSValue*) ClearNoAttack; --(JSValue*) WriteByte : (JSValue*)value; --(JSValue*) WriteBool : (JSValue*)value; --(JSValue*) WriteLong : (JSValue*)value; --(JSValue*) WriteDouble : (JSValue*)value; --(JSValue*) WriteDouble2 : (JSValue*)value; --(JSValue*) WriteStringA : (JSValue*)value; --(JSValue*) WriteString : (JSValue*)value; --(JSValue*) WriteString2 : (JSValue*)value; -@end - -@interface CJSCMemoryStream : NSObject -{ -@public - CMemoryStreamEmbed* m_internal; -} -@end - -@implementation CJSCMemoryStream - -EMBED_OBJECT_WRAPPER_METHODS(CMemoryStreamEmbed) - -FUNCTION_WRAPPER_JS_3(Copy, Copy) -FUNCTION_WRAPPER_JS(ClearNoAttack, ClearNoAttack) -FUNCTION_WRAPPER_JS_1(WriteByte, WriteByte) -FUNCTION_WRAPPER_JS_1(WriteBool, WriteBool) -FUNCTION_WRAPPER_JS_1(WriteLong, WriteLong) -FUNCTION_WRAPPER_JS_1(WriteDouble, WriteDouble) -FUNCTION_WRAPPER_JS_1(WriteDouble2, WriteDouble2) -FUNCTION_WRAPPER_JS_1(WriteStringA, WriteStringA) -FUNCTION_WRAPPER_JS_1(WriteString, WriteString) -FUNCTION_WRAPPER_JS_1(WriteString2, WriteString2) - -@end - -void CMemoryStreamEmbed::CreateObjectInContext(const std::string &name, JSSmart context) -{ - context->m_internal->context[[NSString stringWithAString:name]] = ^(){ - return [[CJSCMemoryStream alloc] init]; - }; -} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_MemoryStreamEmbed.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_MemoryStreamEmbed.mm new file mode 100644 index 0000000000..803ef27d3d --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/jsc/jsc_MemoryStreamEmbed.mm @@ -0,0 +1,63 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../MemoryStreamEmbed.h" +#include "../../js_internal/jsc/jsc_base.h" + +@protocol IJSCMemoryStreamEmbed +-(JSValue*) Copy : (JSValue*)stream : (JSValue*)pos : (JSValue*)len; +-(JSValue*) ClearNoAttack; +-(JSValue*) WriteByte : (JSValue*)value; +-(JSValue*) WriteBool : (JSValue*)value; +-(JSValue*) WriteLong : (JSValue*)value; +-(JSValue*) WriteDouble : (JSValue*)value; +-(JSValue*) WriteDouble2 : (JSValue*)value; +-(JSValue*) WriteStringA : (JSValue*)value; +-(JSValue*) WriteString : (JSValue*)value; +-(JSValue*) WriteString2 : (JSValue*)value; +@end + +@interface CJSCMemoryStreamEmbed : NSObject +{ +@public + CMemoryStreamEmbed* m_internal; +} +@end + +@implementation CJSCMemoryStreamEmbed +EMBED_OBJECT_WRAPPER_METHODS(CMemoryStreamEmbed); + +FUNCTION_WRAPPER_JS_3(Copy, Copy) +FUNCTION_WRAPPER_JS_0(ClearNoAttack, ClearNoAttack) +FUNCTION_WRAPPER_JS_1(WriteByte, WriteByte) +FUNCTION_WRAPPER_JS_1(WriteBool, WriteBool) +FUNCTION_WRAPPER_JS_1(WriteLong, WriteLong) +FUNCTION_WRAPPER_JS_1(WriteDouble, WriteDouble) +FUNCTION_WRAPPER_JS_1(WriteDouble2, WriteDouble2) +FUNCTION_WRAPPER_JS_1(WriteStringA, WriteStringA) +FUNCTION_WRAPPER_JS_1(WriteString, WriteString) +FUNCTION_WRAPPER_JS_1(WriteString2, WriteString2) +@end + +class CMemoryStreamEmbedAdapter : public CJSEmbedObjectAdapterJSC +{ +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCMemoryStreamEmbed alloc] init:(CMemoryStreamEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CMemoryStreamEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CMemoryStreamEmbedAdapter(); + return m_pAdapter; +} + +std::string CMemoryStreamEmbed::getName() { return "CMemoryStreamEmbed"; } + +CJSEmbedObject* CMemoryStreamEmbed::getCreator() +{ + return new CMemoryStreamEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilder.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilder.mm deleted file mode 100644 index 2bd4e5d79e..0000000000 --- a/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilder.mm +++ /dev/null @@ -1,111 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#include "../NativeBuilderEmbed.h" -#include "../../docbuilder_p.h" -#include "../../js_internal/jsc/jsc_base.h" - -@protocol IJSCBuilderDocumentEmbed --(JSValue*) IsValid; --(JSValue*) GetBinary; --(JSValue*) GetFolder; --(JSValue*) CloseFile; --(JSValue*) GetImageMap; -@end - -@interface CJSCBuilderDocumentEmbed : NSObject -{ -@public - CBuilderDocumentEmbed* m_internal; -} -@end - -@implementation CJSCBuilderDocumentEmbed - -EMBED_OBJECT_WRAPPER_METHODS(CBuilderDocumentEmbed) - -FUNCTION_WRAPPER_JS(IsValid, builder_doc_IsValid) -FUNCTION_WRAPPER_JS(GetBinary, builder_doc_GetBinary) -FUNCTION_WRAPPER_JS(GetFolder, builder_doc_GetFolder) -FUNCTION_WRAPPER_JS(CloseFile, builder_doc_CloseFile) -FUNCTION_WRAPPER_JS(GetImageMap, builder_doc_GetImageMap) - -@end - -@protocol IJSCNativeBuilder --(JSValue*) OpenFile : (JSValue*)sPath : (JSValue*)sParams; --(JSValue*) CreateFile : (JSValue*)type; --(JSValue*) SetTmpFolder : (JSValue*)path; --(JSValue*) SaveFile : (JSValue*)t : (JSValue*)path : (JSValue*)params; --(JSValue*) CloseFile; --(JSValue*) OpenTmpFile : (JSValue*)path : (JSValue*)params; -@end - -@interface CJSCNativeBuilder : NSObject -{ -@public - CBuilderEmbed* m_internal; -} -@end - -@implementation CJSCNativeBuilder - -EMBED_OBJECT_WRAPPER_METHODS(CBuilderEmbed) - -FUNCTION_WRAPPER_JS_2(OpenFile, builder_OpenFile) -FUNCTION_WRAPPER_JS_1(CreateFile, builder_CreateFile) -FUNCTION_WRAPPER_JS_1(SetTmpFolder, builder_SetTmpFolder) -FUNCTION_WRAPPER_JS_3(SaveFile, builder_SaveFile) -FUNCTION_WRAPPER_JS(CloseFile, builder_CloseFile) -FUNCTION_WRAPPER_JS_2(OpenTmpFile, builder_OpenTmpFile) - -@end - -JSSmart CBuilderEmbed::builder_OpenTmpFile(JSSmart path, JSSmart params) -{ - std::wstring sPath = path->toStringW(); - std::wstring sParams = params->toStringW(); - CJSCBuilderDocumentEmbed* p = [[CJSCBuilderDocumentEmbed alloc] init]; - p->m_internal->m_pBuilder = m_pBuilder; - p->m_internal->OpenFile(sPath, sParams); - CJSValueJSC* pRet = new CJSValueJSC(); - pRet->value = [JSValue valueWithObject:(id)p inContext:NSJSBase::CJSContextPrivate::GetCurrentContext()]; - return pRet; -} - -void builder_CreateNative(const std::string& name, JSSmart context, NSDoctRenderer::CDocBuilder* builder) -{ - context->m_internal->context[[NSString stringWithAString:name]] = ^(){ - CJSCNativeBuilder* p = [[CJSCNativeBuilder alloc] init]; - p->m_internal->m_pBuilder = builder; - return p; - }; -} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilderDocumentEmbed.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilderDocumentEmbed.mm new file mode 100644 index 0000000000..ab4484ab49 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilderDocumentEmbed.mm @@ -0,0 +1,53 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../NativeBuilderDocumentEmbed.h" +#include "../../js_internal/jsc/jsc_base.h" + +@protocol IJSCBuilderDocumentEmbed +-(JSValue*) IsValid; +-(JSValue*) GetBinary; +-(JSValue*) GetFolder; +-(JSValue*) Close; +-(JSValue*) GetImageMap; +@end + +@interface CJSCBuilderDocumentEmbed : NSObject +{ +@public + CBuilderDocumentEmbed* m_internal; +} +@end + +@implementation CJSCBuilderDocumentEmbed +EMBED_OBJECT_WRAPPER_METHODS(CBuilderDocumentEmbed); + +FUNCTION_WRAPPER_JS_0(IsValid, IsValid) +FUNCTION_WRAPPER_JS_0(GetBinary, GetBinary) +FUNCTION_WRAPPER_JS_0(GetFolder, GetFolder) +FUNCTION_WRAPPER_JS_0(Close, Close) +FUNCTION_WRAPPER_JS_0(GetImageMap, GetImageMap) +@end + +class CBuilderDocumentEmbedAdapter : public CJSEmbedObjectAdapterJSC +{ +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCBuilderDocumentEmbed alloc] init:(CBuilderDocumentEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CBuilderDocumentEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CBuilderDocumentEmbedAdapter(); + return m_pAdapter; +} + +std::string CBuilderDocumentEmbed::getName() { return "CBuilderDocumentEmbed"; } + +CJSEmbedObject* CBuilderDocumentEmbed::getCreator() +{ + return new CBuilderDocumentEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilderEmbed.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilderEmbed.mm new file mode 100644 index 0000000000..d2fb6f449a --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeBuilderEmbed.mm @@ -0,0 +1,55 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../NativeBuilderEmbed.h" +#include "../../js_internal/jsc/jsc_base.h" + +@protocol IJSCBuilderEmbed +-(JSValue*) OpenFile : (JSValue*)sPath : (JSValue*)sParams; +-(JSValue*) CreateFile : (JSValue*)type; +-(JSValue*) SetTmpFolder : (JSValue*)path; +-(JSValue*) SaveFile : (JSValue*)type : (JSValue*)path : (JSValue*)params; +-(JSValue*) CloseFile; +-(JSValue*) OpenTmpFile : (JSValue*)path : (JSValue*)params; +@end + +@interface CJSCBuilderEmbed : NSObject +{ +@public + CBuilderEmbed* m_internal; +} +@end + +@implementation CJSCBuilderEmbed +EMBED_OBJECT_WRAPPER_METHODS(CBuilderEmbed); + +FUNCTION_WRAPPER_JS_2(OpenFile, OpenFile) +FUNCTION_WRAPPER_JS_1(CreateFile, CreateFile) +FUNCTION_WRAPPER_JS_1(SetTmpFolder, SetTmpFolder) +FUNCTION_WRAPPER_JS_3(SaveFile, SaveFile) +FUNCTION_WRAPPER_JS_0(CloseFile, CloseFile) +FUNCTION_WRAPPER_JS_2(OpenTmpFile, OpenTmpFile) +@end + +class CBuilderEmbedAdapter : public CJSEmbedObjectAdapterJSC +{ +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCBuilderEmbed alloc] init:(CBuilderEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CBuilderEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CBuilderEmbedAdapter(); + return m_pAdapter; +} + +std::string CBuilderEmbed::getName() { return "CBuilderEmbed"; } + +CJSEmbedObject* CBuilderEmbed::getCreator() +{ + return new CBuilderEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeControl.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeControl.mm deleted file mode 100644 index 9ee9ce0c32..0000000000 --- a/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeControl.mm +++ /dev/null @@ -1,85 +0,0 @@ -#include "../NativeControlEmbed.h" -#include "../../js_internal/jsc/jsc_base.h" - -@protocol IJSCNativeControl --(JSValue*) GetFilePath; --(JSValue*) SetFilePath : (JSValue*)path; --(JSValue*) GetFileId; --(JSValue*) SetFileId : (JSValue*)fileid; --(JSValue*) GetFileBinary : (JSValue*)file; --(JSValue*) GetFontBinary : (JSValue*)file; --(JSValue*) GetFontsDirectory; --(JSValue*) GetFileString : (JSValue*)file; --(JSValue*) GetEditorType; --(JSValue*) CheckNextChange; --(JSValue*) GetCountChanges; --(JSValue*) GetChangesFile : (JSValue*)index; -//-(JSValue*) Save_AllocNative : (JSValue*)len; -//-(JSValue*) Save_ReAllocNative : (JSValue*)pos : (JSValue*)len; --(JSValue*) Save_End : (JSValue*)pos : (JSValue*)len; --(JSValue*) AddImageInChanges : (JSValue*)img; --(JSValue*) ConsoleLog : (JSValue*)message; --(JSValue*) SaveChanges : (JSValue*)param : (JSValue*)delete_index : (JSValue*)count; --(JSValue*) ZipOpen : (JSValue*)name; --(JSValue*) ZipOpenBase64 : (JSValue*)name; --(JSValue*) ZipFileAsString : (JSValue*)name; --(JSValue*) ZipFileAsBinary : (JSValue*)name; --(JSValue*) ZipClose; --(JSValue*) GetImageUrl : (JSValue*)url; --(JSValue*) GetImagesPath; --(JSValue*) GetImageOriginalSize : (JSValue*)url; - -@end - -@interface CJSCNativeControl : NSObject -{ -@public - CNativeControlEmbed* m_internal; -} -@end - -@implementation CJSCNativeControl - -EMBED_OBJECT_WRAPPER_METHODS(CNativeControlEmbed) - -FUNCTION_WRAPPER_JS(GetFilePath, GetFilePath) -FUNCTION_WRAPPER_JS_1(SetFilePath, SetFilePath) -FUNCTION_WRAPPER_JS(GetFileId, GetFileId) -FUNCTION_WRAPPER_JS_1(SetFileId, SetFileId) -FUNCTION_WRAPPER_JS_1(GetFileBinary, GetFileBinary) -FUNCTION_WRAPPER_JS_1(GetFontBinary, GetFontBinary); -FUNCTION_WRAPPER_JS(GetFontsDirectory, GetFontsDirectory) -FUNCTION_WRAPPER_JS_1(GetFileString, GetFileString) -FUNCTION_WRAPPER_JS(GetEditorType, GetEditorType) -FUNCTION_WRAPPER_JS(CheckNextChange, CheckNextChange) -FUNCTION_WRAPPER_JS(GetCountChanges, GetCountChanges) -FUNCTION_WRAPPER_JS_1(GetChangesFile, GetChangesFile) -//FUNCTION_WRAPPER_JS_1(Save_AllocNative, Save_AllocNative) -//FUNCTION_WRAPPER_JS_2(Save_ReAllocNative, Save_ReAllocNative) -FUNCTION_WRAPPER_JS_2(Save_End, Save_End) -FUNCTION_WRAPPER_JS_1(AddImageInChanges, AddImageInChanges) -FUNCTION_WRAPPER_JS_1(ConsoleLog, ConsoleLog) -FUNCTION_WRAPPER_JS_3(SaveChanges, SaveChanges) -FUNCTION_WRAPPER_JS_1(ZipOpen, zipOpenFile) -FUNCTION_WRAPPER_JS_1(ZipOpenBase64, zipOpenFileBase64) -FUNCTION_WRAPPER_JS_1(ZipFileAsString, zipGetFileAsString) -FUNCTION_WRAPPER_JS_1(ZipFileAsBinary, zipGetFileAsBinary) -FUNCTION_WRAPPER_JS(ZipClose, zipCloseFile); -FUNCTION_WRAPPER_JS_1(GetImageUrl, GetImageUrl); -FUNCTION_WRAPPER_JS(GetImagesPath, GetImagesPath) -FUNCTION_WRAPPER_JS_1(GetImageOriginalSize, GetImageOriginalSize); - -@end - -void CNativeControlEmbed::CreateObjectInContext(const std::string &name, JSSmart context) -{ - context->m_internal->context[[NSString stringWithAString:name]] = ^(){ - return [[CJSCNativeControl alloc] init]; - }; -} -void CNativeControlEmbed::CreateObjectBuilderInContext(const std::string &name, JSSmart context) -{ - context->m_internal->context[[NSString stringWithAString:name]] = ^(){ - return [[CJSCNativeControl alloc] init]; - }; -} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeControlEmbed.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeControlEmbed.mm new file mode 100644 index 0000000000..e79b7795d4 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/jsc/jsc_NativeControlEmbed.mm @@ -0,0 +1,89 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../NativeControlEmbed.h" +#include "../../js_internal/jsc/jsc_base.h" + +@protocol IJSCNativeControlEmbed +-(JSValue*) SetFilePath : (JSValue*)path; +-(JSValue*) GetFilePath; +-(JSValue*) SetFileId : (JSValue*)fileId; +-(JSValue*) GetFileId; +-(JSValue*) GetFileBinary : (JSValue*)file; +-(JSValue*) GetFontBinary : (JSValue*)file; +-(JSValue*) GetFontsDirectory; +-(JSValue*) GetFileString : (JSValue*)file; +-(JSValue*) GetEditorType; +-(JSValue*) CheckNextChange; +-(JSValue*) GetCountChanges; +-(JSValue*) GetChangesFile : (JSValue*)index; +-(JSValue*) Save_End : (JSValue*)pos : (JSValue*)len; +-(JSValue*) AddImageInChanges : (JSValue*)img; +-(JSValue*) ConsoleLog : (JSValue*)message; +-(JSValue*) ZipOpen : (JSValue*)name; +-(JSValue*) ZipOpenBase64 : (JSValue*)name; +-(JSValue*) ZipFileAsString : (JSValue*)name; +-(JSValue*) ZipFileAsBinary : (JSValue*)name; +-(JSValue*) ZipClose; +-(JSValue*) GetImageUrl : (JSValue*)sUrl; +-(JSValue*) GetImagesPath; +-(JSValue*) GetImageOriginalSize : (JSValue*)sUrl; +@end + +@interface CJSCNativeControlEmbed : NSObject +{ +@public + CNativeControlEmbed* m_internal; +} +@end + +@implementation CJSCNativeControlEmbed +EMBED_OBJECT_WRAPPER_METHODS(CNativeControlEmbed); + +FUNCTION_WRAPPER_JS_1(SetFilePath, SetFilePath) +FUNCTION_WRAPPER_JS_0(GetFilePath, GetFilePath) +FUNCTION_WRAPPER_JS_1(SetFileId, SetFileId) +FUNCTION_WRAPPER_JS_0(GetFileId, GetFileId) +FUNCTION_WRAPPER_JS_1(GetFileBinary, GetFileBinary) +FUNCTION_WRAPPER_JS_1(GetFontBinary, GetFontBinary) +FUNCTION_WRAPPER_JS_0(GetFontsDirectory, GetFontsDirectory) +FUNCTION_WRAPPER_JS_1(GetFileString, GetFileString) +FUNCTION_WRAPPER_JS_0(GetEditorType, GetEditorType) +FUNCTION_WRAPPER_JS_0(CheckNextChange, CheckNextChange) +FUNCTION_WRAPPER_JS_0(GetCountChanges, GetCountChanges) +FUNCTION_WRAPPER_JS_1(GetChangesFile, GetChangesFile) +FUNCTION_WRAPPER_JS_2(Save_End, Save_End) +FUNCTION_WRAPPER_JS_1(AddImageInChanges, AddImageInChanges) +FUNCTION_WRAPPER_JS_1(ConsoleLog, ConsoleLog) +FUNCTION_WRAPPER_JS_1(ZipOpen, ZipOpen) +FUNCTION_WRAPPER_JS_1(ZipOpenBase64, ZipOpenBase64) +FUNCTION_WRAPPER_JS_1(ZipFileAsString, ZipFileAsString) +FUNCTION_WRAPPER_JS_1(ZipFileAsBinary, ZipFileAsBinary) +FUNCTION_WRAPPER_JS_0(ZipClose, ZipClose) +FUNCTION_WRAPPER_JS_1(GetImageUrl, GetImageUrl) +FUNCTION_WRAPPER_JS_0(GetImagesPath, GetImagesPath) +FUNCTION_WRAPPER_JS_1(GetImageOriginalSize, GetImageOriginalSize) +@end + +class CNativeControlEmbedAdapter : public CJSEmbedObjectAdapterJSC +{ +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCNativeControlEmbed alloc] init:(CNativeControlEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CNativeControlEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CNativeControlEmbedAdapter(); + return m_pAdapter; +} + +std::string CNativeControlEmbed::getName() { return "CNativeControlEmbed"; } + +CJSEmbedObject* CNativeControlEmbed::getCreator() +{ + return new CNativeControlEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_Pointer.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_PointerEmbed.mm similarity index 100% rename from DesktopEditor/doctrenderer/embed/jsc/jsc_Pointer.mm rename to DesktopEditor/doctrenderer/embed/jsc/jsc_PointerEmbed.mm diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_TextMeasurer.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_TextMeasurerEmbed.mm similarity index 63% rename from DesktopEditor/doctrenderer/embed/jsc/jsc_TextMeasurer.mm rename to DesktopEditor/doctrenderer/embed/jsc/jsc_TextMeasurerEmbed.mm index 458b1c4260..0764e40238 100644 --- a/DesktopEditor/doctrenderer/embed/jsc/jsc_TextMeasurer.mm +++ b/DesktopEditor/doctrenderer/embed/jsc/jsc_TextMeasurerEmbed.mm @@ -1,81 +1,87 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + #include "../TextMeasurerEmbed.h" #include "../../js_internal/jsc/jsc_base.h" -@protocol IJSCTextMeasurer +@protocol IJSCTextMeasurerEmbed +#ifdef SUPPORT_HARFBUZZ_SHAPER +-(JSValue*) HB_LanguageFromString : (JSValue*)language_bcp_47; +-(JSValue*) HB_ShapeText : (JSValue*)face : (JSValue*)font : (JSValue*)text : (JSValue*)nFeatures : (JSValue*)nScript : (JSValue*)nDirection : (JSValue*)nLanguage; +-(JSValue*) HB_FontMalloc; +-(JSValue*) HB_FontFree : (JSValue*)font; +#endif -(JSValue*) FT_Malloc : (JSValue*)typed_array_or_len; -(JSValue*) FT_Free : (JSValue*)pointer; - -(JSValue*) FT_Init; -(JSValue*) FT_Set_TrueType_HintProp : (JSValue*)library : (JSValue*)tt_interpreter; - -(JSValue*) FT_Open_Face : (JSValue*)library : (JSValue*)memory : (JSValue*)size : (JSValue*)face_index; -(JSValue*) FT_Open_Face2 : (JSValue*)library : (JSValue*)array : (JSValue*)face_index; -(JSValue*) FT_GetFaceInfo : (JSValue*)face; - -(JSValue*) FT_Load_Glyph : (JSValue*)face : (JSValue*)gid : (JSValue*)mode; -(JSValue*) FT_Get_Glyph_Measure_Params : (JSValue*)face : (JSValue*)is_vector; -(JSValue*) FT_Get_Glyph_Render_Params : (JSValue*)face : (JSValue*)render_mode; -(JSValue*) FT_Get_Glyph_Render_Buffer : (JSValue*)face : (JSValue*)size; - -(JSValue*) FT_Set_Transform : (JSValue*)face : (JSValue*)xx : (JSValue*)yx : (JSValue*)xy : (JSValue*)yy; --(JSValue*) FT_Set_Char_Size : (JSValue*)face : (JSValue*)cw : (JSValue*)ch : (JSValue*)hres : (JSValue*)vres; +-(JSValue*) FT_Set_Char_Size : (JSValue*)face : (JSValue*)char_width : (JSValue*)char_height : (JSValue*)hres : (JSValue*)vres; -(JSValue*) FT_SetCMapForCharCode : (JSValue*)face : (JSValue*)unicode; -(JSValue*) FT_GetKerningX : (JSValue*)face : (JSValue*)gid1 : (JSValue*)gid2; -(JSValue*) FT_GetFaceMaxAdvanceX : (JSValue*)face; - -#ifdef SUPPORT_HARFBUZZ_SHAPER --(JSValue*) HB_LanguageFromString : (JSValue*)lang; --(JSValue*) HB_ShapeText : (JSValue*) face : (JSValue*) font : (JSValue*) text : (JSValue*) nFeatures : (JSValue*) nScript : (JSValue*) nDirection : (JSValue*) nLanguage; --(JSValue*) HB_FontMalloc; --(JSValue*) HB_FontFree : (JSValue*)font; -#endif - @end -@interface CJSCTextMeasurer : NSObject +@interface CJSCTextMeasurerEmbed : NSObject { @public - CTextMeasurerEmbed* m_internal; + CTextMeasurerEmbed* m_internal; } @end -@implementation CJSCTextMeasurer - -EMBED_OBJECT_WRAPPER_METHODS(CTextMeasurerEmbed) +@implementation CJSCTextMeasurerEmbed +EMBED_OBJECT_WRAPPER_METHODS(CTextMeasurerEmbed); +#ifdef SUPPORT_HARFBUZZ_SHAPER +FUNCTION_WRAPPER_JS_1(HB_LanguageFromString, HB_LanguageFromString) +FUNCTION_WRAPPER_JS_7(HB_ShapeText, HB_ShapeText) +FUNCTION_WRAPPER_JS_0(HB_FontMalloc, HB_FontMalloc) +FUNCTION_WRAPPER_JS_1(HB_FontFree, HB_FontFree) +#endif FUNCTION_WRAPPER_JS_1(FT_Malloc, FT_Malloc) FUNCTION_WRAPPER_JS_1(FT_Free, FT_Free) - -FUNCTION_WRAPPER_JS(FT_Init, FT_Init) +FUNCTION_WRAPPER_JS_0(FT_Init, FT_Init) FUNCTION_WRAPPER_JS_2(FT_Set_TrueType_HintProp, FT_Set_TrueType_HintProp) - FUNCTION_WRAPPER_JS_4(FT_Open_Face, FT_Open_Face) FUNCTION_WRAPPER_JS_3(FT_Open_Face2, FT_Open_Face2) FUNCTION_WRAPPER_JS_1(FT_GetFaceInfo, FT_GetFaceInfo) - FUNCTION_WRAPPER_JS_3(FT_Load_Glyph, FT_Load_Glyph) FUNCTION_WRAPPER_JS_2(FT_Get_Glyph_Measure_Params, FT_Get_Glyph_Measure_Params) FUNCTION_WRAPPER_JS_2(FT_Get_Glyph_Render_Params, FT_Get_Glyph_Render_Params) FUNCTION_WRAPPER_JS_2(FT_Get_Glyph_Render_Buffer, FT_Get_Glyph_Render_Buffer) - FUNCTION_WRAPPER_JS_5(FT_Set_Transform, FT_Set_Transform) FUNCTION_WRAPPER_JS_5(FT_Set_Char_Size, FT_Set_Char_Size) FUNCTION_WRAPPER_JS_2(FT_SetCMapForCharCode, FT_SetCMapForCharCode) FUNCTION_WRAPPER_JS_3(FT_GetKerningX, FT_GetKerningX) FUNCTION_WRAPPER_JS_1(FT_GetFaceMaxAdvanceX, FT_GetFaceMaxAdvanceX) - -#ifdef SUPPORT_HARFBUZZ_SHAPER -FUNCTION_WRAPPER_JS_1(HB_LanguageFromString, HB_LanguageFromString) -FUNCTION_WRAPPER_JS_7(HB_ShapeText, HB_ShapeText) -FUNCTION_WRAPPER_JS(HB_FontMalloc, HB_FontMalloc) -FUNCTION_WRAPPER_JS_1(HB_FontFree, HB_FontFree) -#endif - @end -void CTextMeasurerEmbed::CreateObjectInContext(const std::string &name, JSSmart context) +class CTextMeasurerEmbedAdapter : public CJSEmbedObjectAdapterJSC { - context->m_internal->context[[NSString stringWithAString:name]] = ^(){ - return [[CJSCTextMeasurer alloc] init]; - }; +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCTextMeasurerEmbed alloc] init:(CTextMeasurerEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CTextMeasurerEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CTextMeasurerEmbedAdapter(); + return m_pAdapter; +} + +std::string CTextMeasurerEmbed::getName() { return "CTextMeasurerEmbed"; } + +CJSEmbedObject* CTextMeasurerEmbed::getCreator() +{ + return new CTextMeasurerEmbed(); } diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_Zip.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_Zip.mm deleted file mode 100644 index 5c44c56420..0000000000 --- a/DesktopEditor/doctrenderer/embed/jsc/jsc_Zip.mm +++ /dev/null @@ -1,53 +0,0 @@ -#include "../ZipEmbed.h" -#include "../../js_internal/jsc/jsc_base.h" - -@protocol IJSCZip --(JSValue*) open : (JSValue*)file; --(JSValue*) create; --(JSValue*) save; --(JSValue*) getFile : (JSValue*)path; --(JSValue*) addFile : (JSValue*)path : (JSValue*)data; --(JSValue*) removeFile : (JSValue*)path; --(JSValue*) close; --(JSValue*) getPaths; - --(JSValue*) decodeImage : (JSValue*)typedArray : (JSValue*)isRgba; --(JSValue*) encodeImageData : (JSValue*)typedArray : (JSValue*)w : (JSValue*)h : (JSValue*)stride : (JSValue*)format : (JSValue*)isRgba; --(JSValue*) encodeImage : (JSValue*)typedArray : (JSValue*)format; --(JSValue*) getImageType : (JSValue*)typedArray; - -@end - -@interface CJSCZip : NSObject -{ -@public - CZipEmbed* m_internal; -} -@end - -@implementation CJSCZip - -EMBED_OBJECT_WRAPPER_METHODS(CZipEmbed) - -FUNCTION_WRAPPER_JS_1(open, open) -FUNCTION_WRAPPER_JS(create, create) -FUNCTION_WRAPPER_JS(save, save) -FUNCTION_WRAPPER_JS_1(getFile, getFile) -FUNCTION_WRAPPER_JS_2(addFile, addFile) -FUNCTION_WRAPPER_JS_1(removeFile, removeFile) -FUNCTION_WRAPPER_JS(close, close) -FUNCTION_WRAPPER_JS(getPaths, getPaths) - -FUNCTION_WRAPPER_JS_2(decodeImage, decodeImage) -FUNCTION_WRAPPER_JS_6(encodeImageData, encodeImageData) -FUNCTION_WRAPPER_JS_2(encodeImage, encodeImage) -FUNCTION_WRAPPER_JS_1(getImageType, getImageType) - -@end - -void CZipEmbed::CreateObjectInContext(const std::string &name, JSSmart context) -{ - context->m_internal->context[[NSString stringWithAString:name]] = ^(){ - return [[CJSCZip alloc] init]; - }; -} diff --git a/DesktopEditor/doctrenderer/embed/jsc/jsc_ZipEmbed.mm b/DesktopEditor/doctrenderer/embed/jsc/jsc_ZipEmbed.mm new file mode 100644 index 0000000000..1c831a0aab --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/jsc/jsc_ZipEmbed.mm @@ -0,0 +1,67 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../ZipEmbed.h" +#include "../../js_internal/jsc/jsc_base.h" + +@protocol IJSCZipEmbed +-(JSValue*) open : (JSValue*)typedArray_or_Folder; +-(JSValue*) create; +-(JSValue*) save; +-(JSValue*) getFile : (JSValue*)filePath; +-(JSValue*) addFile : (JSValue*)filePath : (JSValue*)typedArray; +-(JSValue*) removeFile : (JSValue*)filePath; +-(JSValue*) close; +-(JSValue*) getPaths; +-(JSValue*) decodeImage : (JSValue*)typedArray : (JSValue*)isRgba; +-(JSValue*) encodeImageData : (JSValue*)typedArray : (JSValue*)w : (JSValue*)h : (JSValue*)stride : (JSValue*)format : (JSValue*)isRgba; +-(JSValue*) encodeImage : (JSValue*)typedArray : (JSValue*)format; +-(JSValue*) getImageType : (JSValue*)typedArray; +@end + +@interface CJSCZipEmbed : NSObject +{ +@public + CZipEmbed* m_internal; +} +@end + +@implementation CJSCZipEmbed +EMBED_OBJECT_WRAPPER_METHODS(CZipEmbed); + +FUNCTION_WRAPPER_JS_1(open, open) +FUNCTION_WRAPPER_JS_0(create, create) +FUNCTION_WRAPPER_JS_0(save, save) +FUNCTION_WRAPPER_JS_1(getFile, getFile) +FUNCTION_WRAPPER_JS_2(addFile, addFile) +FUNCTION_WRAPPER_JS_1(removeFile, removeFile) +FUNCTION_WRAPPER_JS_0(close, close) +FUNCTION_WRAPPER_JS_0(getPaths, getPaths) +FUNCTION_WRAPPER_JS_2(decodeImage, decodeImage) +FUNCTION_WRAPPER_JS_6(encodeImageData, encodeImageData) +FUNCTION_WRAPPER_JS_2(encodeImage, encodeImage) +FUNCTION_WRAPPER_JS_1(getImageType, getImageType) +@end + +class CZipEmbedAdapter : public CJSEmbedObjectAdapterJSC +{ +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCZipEmbed alloc] init:(CZipEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CZipEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CZipEmbedAdapter(); + return m_pAdapter; +} + +std::string CZipEmbed::getName() { return "CZipEmbed"; } + +CJSEmbedObject* CZipEmbed::getCreator() +{ + return new CZipEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_Graphics.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_Graphics.cpp deleted file mode 100644 index 7b21113fb8..0000000000 --- a/DesktopEditor/doctrenderer/embed/v8/v8_Graphics.cpp +++ /dev/null @@ -1,250 +0,0 @@ -#include "../GraphicsEmbed.h" -#include "../../js_internal/v8/v8_base.h" - -namespace NSGraphics -{ -#define CURRENTWRAPPER CGraphicsEmbed - - // FUNCTION - FUNCTION_WRAPPER_V8_5(_init, init) - FUNCTION_WRAPPER_V8 (_destroy, Destroy) - FUNCTION_WRAPPER_V8 (_EndDraw, EndDraw) - FUNCTION_WRAPPER_V8_2(_put_GlobalAlpha, put_GlobalAlpha) - FUNCTION_WRAPPER_V8 (_Start_GlobalAlpha, Start_GlobalAlpha) - FUNCTION_WRAPPER_V8 (_End_GlobalAlpha, End_GlobalAlpha) - // pen methods - FUNCTION_WRAPPER_V8_4(_p_color, p_color) - FUNCTION_WRAPPER_V8_1(_p_width, p_width) - FUNCTION_WRAPPER_V8_1(_p_dash, p_dash) - // brush methods - FUNCTION_WRAPPER_V8_4(_b_color1, b_color1) - FUNCTION_WRAPPER_V8_4(_b_color2, b_color2) - FUNCTION_WRAPPER_V8_6(_transform, transform) - FUNCTION_WRAPPER_V8_1(_CalculateFullTransform, CalculateFullTransform) - // path commands - FUNCTION_WRAPPER_V8 (__s, _s) - FUNCTION_WRAPPER_V8 (__e, _e) - FUNCTION_WRAPPER_V8 (__z, _z) - FUNCTION_WRAPPER_V8_2(__m, _m) - FUNCTION_WRAPPER_V8_2(__l, _l) - FUNCTION_WRAPPER_V8_6(__c, _c) - FUNCTION_WRAPPER_V8_4(__c2, _c2) - FUNCTION_WRAPPER_V8 (_ds, ds) - FUNCTION_WRAPPER_V8 (_df, df) - // canvas state - FUNCTION_WRAPPER_V8 (_save, save) - FUNCTION_WRAPPER_V8 (_restore, restore) - FUNCTION_WRAPPER_V8 (_clip, clip) - FUNCTION_WRAPPER_V8 (_reset, reset) - FUNCTION_WRAPPER_V8 (_FreeFont, FreeFont) - FUNCTION_WRAPPER_V8 (_ClearLastFont, ClearLastFont) - // images - FUNCTION_WRAPPER_V8_7(_drawImage2, drawImage2) - FUNCTION_WRAPPER_V8_8(_drawImage, drawImage) - // text - FUNCTION_WRAPPER_V8 (_GetFont, GetFont) - FUNCTION_WRAPPER_V8_2(_font, font) - FUNCTION_WRAPPER_V8_4(_SetFont, SetFont) - FUNCTION_WRAPPER_V8 (_GetTextPr, GetTextPr) - FUNCTION_WRAPPER_V8_3(_FillText, FillText) - FUNCTION_WRAPPER_V8_3(_t, t) - FUNCTION_WRAPPER_V8_5(_FillText2, FillText2) - FUNCTION_WRAPPER_V8_5(_t2, t2) - FUNCTION_WRAPPER_V8_3(_FillTextCode, FillTextCode) - FUNCTION_WRAPPER_V8_3(_tg, tg) - FUNCTION_WRAPPER_V8_1(_charspace, charspace) - // private methods - FUNCTION_WRAPPER_V8_2(_private_FillGlyph, private_FillGlyph) - FUNCTION_WRAPPER_V8_3(_private_FillGlyphC, private_FillGlyphC) - FUNCTION_WRAPPER_V8_1(_private_FillGlyph2, private_FillGlyph2) - FUNCTION_WRAPPER_V8_1(_SetIntegerGrid, SetIntegerGrid) - FUNCTION_WRAPPER_V8 (_GetIntegerGrid, GetIntegerGrid) - FUNCTION_WRAPPER_V8_3(_DrawStringASCII, DrawStringASCII) - FUNCTION_WRAPPER_V8_3(_DrawStringASCII2, DrawStringASCII2) - FUNCTION_WRAPPER_V8_5(_DrawHeaderEdit, DrawHeaderEdit) - FUNCTION_WRAPPER_V8_5(_DrawFooterEdit, DrawFooterEdit) - FUNCTION_WRAPPER_V8_3(_DrawLockParagraph, DrawLockParagraph) - FUNCTION_WRAPPER_V8_4(_DrawLockObjectRect, DrawLockObjectRect) - FUNCTION_WRAPPER_V8_4(_DrawEmptyTableLine, DrawEmptyTableLine) - FUNCTION_WRAPPER_V8_4(_DrawSpellingLine, DrawSpellingLine) - // smart methods for horizontal / vertical lines - FUNCTION_WRAPPER_V8_5(_drawHorLine, drawHorLine) - FUNCTION_WRAPPER_V8_5(_drawHorLine2, drawHorLine2) - FUNCTION_WRAPPER_V8_5(_drawVerLine, drawVerLine) - // мега крутые функции для таблиц - FUNCTION_WRAPPER_V8_7(_drawHorLineExt, drawHorLineExt) - FUNCTION_WRAPPER_V8_4(_rect, rect) - FUNCTION_WRAPPER_V8_4(_TableRect, TableRect) - // функции клиппирования - FUNCTION_WRAPPER_V8_4(_AddClipRect, AddClipRect) - FUNCTION_WRAPPER_V8 (_RemoveClipRect, RemoveClipRect) - FUNCTION_WRAPPER_V8_4(_SetClip, SetClip) - FUNCTION_WRAPPER_V8 (_RemoveClip, RemoveClip) - FUNCTION_WRAPPER_V8_4(_drawMailMergeField, drawMailMergeField) - FUNCTION_WRAPPER_V8_4(_drawSearchResult, drawSearchResult) - FUNCTION_WRAPPER_V8_2(_drawFlowAnchor, drawFlowAnchor) - FUNCTION_WRAPPER_V8 (_SavePen, SavePen) - FUNCTION_WRAPPER_V8 (_RestorePen, RestorePen) - FUNCTION_WRAPPER_V8 (_SaveBrush, SaveBrush) - FUNCTION_WRAPPER_V8 (_RestoreBrush, RestoreBrush) - FUNCTION_WRAPPER_V8 (_SavePenBrush, SavePenBrush) - FUNCTION_WRAPPER_V8 (_RestorePenBrush, RestorePenBrush) - FUNCTION_WRAPPER_V8 (_SaveGrState, SaveGrState) - FUNCTION_WRAPPER_V8 (_RestoreGrState, RestoreGrState) - FUNCTION_WRAPPER_V8 (_StartClipPath, StartClipPath) - FUNCTION_WRAPPER_V8 (_EndClipPath, EndClipPath) - FUNCTION_WRAPPER_V8 (_StartCheckTableDraw, StartCheckTableDraw) - FUNCTION_WRAPPER_V8_4(_SetTextClipRect, SetTextClipRect) - FUNCTION_WRAPPER_V8_5(_AddSmartRect, AddSmartRect) - FUNCTION_WRAPPER_V8_1(_CheckUseFonts2, CheckUseFonts2) - FUNCTION_WRAPPER_V8 (_UncheckUseFonts2, UncheckUseFonts2) - FUNCTION_WRAPPER_V8_4(_Drawing_StartCheckBounds, Drawing_StartCheckBounds) - FUNCTION_WRAPPER_V8 (_Drawing_EndCheckBounds, Drawing_EndCheckBounds) - FUNCTION_WRAPPER_V8_5(_DrawPresentationComment, DrawPresentationComment) - FUNCTION_WRAPPER_V8_3(_DrawPolygon, DrawPolygon) - FUNCTION_WRAPPER_V8_4(_DrawFootnoteRect, DrawFootnoteRect) - // new methods - FUNCTION_WRAPPER_V8_1(_toDataURL, toDataURL) - FUNCTION_WRAPPER_V8 (_GetPenColor, GetPenColor) - FUNCTION_WRAPPER_V8 (_GetBrushColor, GetBrushColor) - FUNCTION_WRAPPER_V8_2(_put_brushTexture, put_brushTexture) - FUNCTION_WRAPPER_V8_1(_put_brushTextureMode, put_brushTextureMode) - FUNCTION_WRAPPER_V8_1(_put_BrushTextureAlpha, put_BrushTextureAlpha) - FUNCTION_WRAPPER_V8_8(_put_BrushGradient, put_BrushGradient) - FUNCTION_WRAPPER_V8_2(_TransformPointX, TransformPointX) - FUNCTION_WRAPPER_V8_2(_TransformPointY, TransformPointY) - FUNCTION_WRAPPER_V8_1(_put_LineJoin, put_LineJoin) - FUNCTION_WRAPPER_V8 (_get_LineJoin, get_LineJoin) - FUNCTION_WRAPPER_V8_4(_put_TextureBounds, put_TextureBounds) - FUNCTION_WRAPPER_V8 (_GetlineWidth, GetlineWidth) - FUNCTION_WRAPPER_V8_1(_DrawPath, DrawPath) - FUNCTION_WRAPPER_V8_2(_CoordTransformOffset, CoordTransformOffset) - FUNCTION_WRAPPER_V8 (_GetTransform, GetTransform) - - v8::Handle CreateGraphicsTemplate(v8::Isolate* isolate) - { - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local result = v8::ObjectTemplate::New(isolate); - result->SetInternalFieldCount(1); - - v8::Isolate* current = v8::Isolate::GetCurrent(); - - // методы - NSV8Objects::Template_Set(result, "create", _init); - NSV8Objects::Template_Set(result, "Destroy", _destroy); - NSV8Objects::Template_Set(result, "EndDraw", _EndDraw); - NSV8Objects::Template_Set(result, "put_GlobalAlpha", _put_GlobalAlpha); - NSV8Objects::Template_Set(result, "Start_GlobalAlpha", _Start_GlobalAlpha); - NSV8Objects::Template_Set(result, "End_GlobalAlpha", _End_GlobalAlpha); - NSV8Objects::Template_Set(result, "p_color", _p_color); - NSV8Objects::Template_Set(result, "p_width", _p_width); - NSV8Objects::Template_Set(result, "p_dash", _p_dash); - NSV8Objects::Template_Set(result, "b_color1", _b_color1); - NSV8Objects::Template_Set(result, "b_color2", _b_color2); - NSV8Objects::Template_Set(result, "transform", _transform); - NSV8Objects::Template_Set(result, "CalculateFullTransform", _CalculateFullTransform); - NSV8Objects::Template_Set(result, "_s", __s); - NSV8Objects::Template_Set(result, "_e", __e); - NSV8Objects::Template_Set(result, "_z", __z); - NSV8Objects::Template_Set(result, "_m", __m); - NSV8Objects::Template_Set(result, "_l", __l); - NSV8Objects::Template_Set(result, "_c", __c); - NSV8Objects::Template_Set(result, "_c2", __c2); - NSV8Objects::Template_Set(result, "ds", _ds); - NSV8Objects::Template_Set(result, "df", _df); - NSV8Objects::Template_Set(result, "save", _save); - NSV8Objects::Template_Set(result, "restore", _restore); - NSV8Objects::Template_Set(result, "clip", _clip); - NSV8Objects::Template_Set(result, "reset", _reset); - NSV8Objects::Template_Set(result, "FreeFont", _FreeFont); - NSV8Objects::Template_Set(result, "ClearLastFont", _ClearLastFont); - NSV8Objects::Template_Set(result, "drawImage2", _drawImage2); - NSV8Objects::Template_Set(result, "drawImage", _drawImage); - NSV8Objects::Template_Set(result, "GetFont", _GetFont); - NSV8Objects::Template_Set(result, "font", _font); - NSV8Objects::Template_Set(result, "SetFont", _SetFont); - NSV8Objects::Template_Set(result, "GetTextPr", _GetTextPr); - NSV8Objects::Template_Set(result, "FillText", _FillText); - NSV8Objects::Template_Set(result, "t", _t); - NSV8Objects::Template_Set(result, "FillText2", _FillText2); - NSV8Objects::Template_Set(result, "t2", _t2); - NSV8Objects::Template_Set(result, "FillTextCode", _FillTextCode); - NSV8Objects::Template_Set(result, "tg", _tg); - NSV8Objects::Template_Set(result, "charspace", _charspace); - NSV8Objects::Template_Set(result, "private_FillGlyph", _private_FillGlyph); - NSV8Objects::Template_Set(result, "private_FillGlyphC", _private_FillGlyphC); - NSV8Objects::Template_Set(result, "private_FillGlyph2", _private_FillGlyph2); - NSV8Objects::Template_Set(result, "SetIntegerGrid", _SetIntegerGrid); - NSV8Objects::Template_Set(result, "GetIntegerGrid", _GetIntegerGrid); - NSV8Objects::Template_Set(result, "DrawStringASCII", _DrawStringASCII); - NSV8Objects::Template_Set(result, "DrawStringASCII2", _DrawStringASCII2); - NSV8Objects::Template_Set(result, "DrawHeaderEdit", _DrawHeaderEdit); - NSV8Objects::Template_Set(result, "DrawFooterEdit", _DrawFooterEdit); - NSV8Objects::Template_Set(result, "DrawLockParagraph", _DrawLockParagraph); - NSV8Objects::Template_Set(result, "DrawLockObjectRect", _DrawLockObjectRect); - NSV8Objects::Template_Set(result, "DrawEmptyTableLine", _DrawEmptyTableLine); - NSV8Objects::Template_Set(result, "DrawSpellingLine", _DrawSpellingLine); - NSV8Objects::Template_Set(result, "drawHorLine", _drawHorLine); - NSV8Objects::Template_Set(result, "drawHorLine2", _drawHorLine2); - NSV8Objects::Template_Set(result, "drawVerLine", _drawVerLine); - NSV8Objects::Template_Set(result, "drawHorLineExt", _drawHorLineExt); - NSV8Objects::Template_Set(result, "rect", _rect); - NSV8Objects::Template_Set(result, "TableRect", _TableRect); - NSV8Objects::Template_Set(result, "AddClipRect", _AddClipRect); - NSV8Objects::Template_Set(result, "RemoveClipRect", _RemoveClipRect); - NSV8Objects::Template_Set(result, "SetClip", _SetClip); - NSV8Objects::Template_Set(result, "RemoveClip", _RemoveClip); - NSV8Objects::Template_Set(result, "drawMailMergeField", _drawMailMergeField); - NSV8Objects::Template_Set(result, "drawSearchResult", _drawSearchResult); - NSV8Objects::Template_Set(result, "drawFlowAnchor", _drawFlowAnchor); - NSV8Objects::Template_Set(result, "SavePen", _SavePen); - NSV8Objects::Template_Set(result, "RestorePen", _RestorePen); - NSV8Objects::Template_Set(result, "SaveBrush", _SaveBrush); - NSV8Objects::Template_Set(result, "RestoreBrush", _RestoreBrush); - NSV8Objects::Template_Set(result, "SavePenBrush", _SavePenBrush); - NSV8Objects::Template_Set(result, "RestorePenBrush", _RestorePenBrush); - NSV8Objects::Template_Set(result, "SaveGrState", _SaveGrState); - NSV8Objects::Template_Set(result, "RestoreGrState", _RestoreGrState); - NSV8Objects::Template_Set(result, "StartClipPath", _StartClipPath); - NSV8Objects::Template_Set(result, "EndClipPath", _EndClipPath); - NSV8Objects::Template_Set(result, "StartCheckTableDraw", _StartCheckTableDraw); - NSV8Objects::Template_Set(result, "SetTextClipRect", _SetTextClipRect); - NSV8Objects::Template_Set(result, "AddSmartRect", _AddSmartRect); - NSV8Objects::Template_Set(result, "CheckUseFonts2", _CheckUseFonts2); - NSV8Objects::Template_Set(result, "UncheckUseFonts2", _UncheckUseFonts2); - NSV8Objects::Template_Set(result, "Drawing_StartCheckBounds", _Drawing_StartCheckBounds); - NSV8Objects::Template_Set(result, "Drawing_EndCheckBounds", _Drawing_EndCheckBounds); - NSV8Objects::Template_Set(result, "DrawPresentationComment", _DrawPresentationComment); - NSV8Objects::Template_Set(result, "DrawPolygon", _DrawPolygon); - NSV8Objects::Template_Set(result, "DrawFootnoteRect", _DrawFootnoteRect); - NSV8Objects::Template_Set(result, "toDataURL", _toDataURL); - NSV8Objects::Template_Set(result, "GetPenColor", _GetPenColor); - NSV8Objects::Template_Set(result, "GetBrushColor", _GetBrushColor); - NSV8Objects::Template_Set(result, "put_brushTexture", _put_brushTexture); - NSV8Objects::Template_Set(result, "put_brushTextureMode", _put_brushTextureMode); - NSV8Objects::Template_Set(result, "put_BrushTextureAlpha", _put_BrushTextureAlpha); - NSV8Objects::Template_Set(result, "put_BrushGradient", _put_BrushGradient); - NSV8Objects::Template_Set(result, "TransformPointX", _TransformPointX); - NSV8Objects::Template_Set(result, "TransformPointY", _TransformPointY); - NSV8Objects::Template_Set(result, "put_LineJoin", _put_LineJoin); - NSV8Objects::Template_Set(result, "get_LineJoin", _get_LineJoin); - NSV8Objects::Template_Set(result, "put_TextureBounds", _put_TextureBounds); - NSV8Objects::Template_Set(result, "GetlineWidth", _GetlineWidth); - NSV8Objects::Template_Set(result, "DrawPath", _DrawPath); - NSV8Objects::Template_Set(result, "CoordTransformOffset", _CoordTransformOffset); - NSV8Objects::Template_Set(result, "GetTransform", _GetTransform); - - return handle_scope.Escape(result); - } - - void CreateNativeGraphics(const v8::FunctionCallbackInfo& args) - { - CreateNativeInternalField(new CGraphicsEmbed(), NSGraphics::CreateGraphicsTemplate, args); - } -} - -void CGraphicsEmbed::CreateObjectInContext(const std::string& name, JSSmart context) -{ - InsertToGlobal(name, context, NSGraphics::CreateNativeGraphics); -} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_GraphicsEmbed.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_GraphicsEmbed.cpp new file mode 100644 index 0000000000..ce4aac9e74 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/v8/v8_GraphicsEmbed.cpp @@ -0,0 +1,252 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../GraphicsEmbed.h" +#include "../../js_internal/v8/v8_base.h" + +namespace NSGraphicsEmbed +{ +#define CURRENTWRAPPER CGraphicsEmbed + + FUNCTION_WRAPPER_V8_5(_create, create) + FUNCTION_WRAPPER_V8_0(_Destroy, Destroy) + FUNCTION_WRAPPER_V8_0(_EndDraw, EndDraw) + FUNCTION_WRAPPER_V8_2(_put_GlobalAlpha, put_GlobalAlpha) + FUNCTION_WRAPPER_V8_0(_Start_GlobalAlpha, Start_GlobalAlpha) + FUNCTION_WRAPPER_V8_0(_End_GlobalAlpha, End_GlobalAlpha) + FUNCTION_WRAPPER_V8_4(_p_color, p_color) + FUNCTION_WRAPPER_V8_1(_p_width, p_width) + FUNCTION_WRAPPER_V8_1(_p_dash, p_dash) + FUNCTION_WRAPPER_V8_4(_b_color1, b_color1) + FUNCTION_WRAPPER_V8_4(_b_color2, b_color2) + FUNCTION_WRAPPER_V8_6(_transform, transform) + FUNCTION_WRAPPER_V8_1(_CalculateFullTransform, CalculateFullTransform) + FUNCTION_WRAPPER_V8_0(__s, _s) + FUNCTION_WRAPPER_V8_0(__e, _e) + FUNCTION_WRAPPER_V8_0(__z, _z) + FUNCTION_WRAPPER_V8_2(__m, _m) + FUNCTION_WRAPPER_V8_2(__l, _l) + FUNCTION_WRAPPER_V8_6(__c, _c) + FUNCTION_WRAPPER_V8_4(__c2, _c2) + FUNCTION_WRAPPER_V8_0(_ds, ds) + FUNCTION_WRAPPER_V8_0(_df, df) + FUNCTION_WRAPPER_V8_0(_save, save) + FUNCTION_WRAPPER_V8_0(_restore, restore) + FUNCTION_WRAPPER_V8_0(_clip, clip) + FUNCTION_WRAPPER_V8_0(_reset, reset) + FUNCTION_WRAPPER_V8_0(_FreeFont, FreeFont) + FUNCTION_WRAPPER_V8_0(_ClearLastFont, ClearLastFont) + FUNCTION_WRAPPER_V8_7(_drawImage2, drawImage2) + FUNCTION_WRAPPER_V8_8(_drawImage, drawImage) + FUNCTION_WRAPPER_V8_0(_GetFont, GetFont) + FUNCTION_WRAPPER_V8_2(_font, font) + FUNCTION_WRAPPER_V8_4(_SetFont, SetFont) + FUNCTION_WRAPPER_V8_0(_GetTextPr, GetTextPr) + FUNCTION_WRAPPER_V8_3(_FillText, FillText) + FUNCTION_WRAPPER_V8_3(_t, t) + FUNCTION_WRAPPER_V8_5(_FillText2, FillText2) + FUNCTION_WRAPPER_V8_5(_t2, t2) + FUNCTION_WRAPPER_V8_3(_FillTextCode, FillTextCode) + FUNCTION_WRAPPER_V8_3(_tg, tg) + FUNCTION_WRAPPER_V8_1(_charspace, charspace) + FUNCTION_WRAPPER_V8_2(_private_FillGlyph, private_FillGlyph) + FUNCTION_WRAPPER_V8_3(_private_FillGlyphC, private_FillGlyphC) + FUNCTION_WRAPPER_V8_1(_private_FillGlyph2, private_FillGlyph2) + FUNCTION_WRAPPER_V8_1(_SetIntegerGrid, SetIntegerGrid) + FUNCTION_WRAPPER_V8_0(_GetIntegerGrid, GetIntegerGrid) + FUNCTION_WRAPPER_V8_3(_DrawStringASCII, DrawStringASCII) + FUNCTION_WRAPPER_V8_3(_DrawStringASCII2, DrawStringASCII2) + FUNCTION_WRAPPER_V8_5(_DrawHeaderEdit, DrawHeaderEdit) + FUNCTION_WRAPPER_V8_5(_DrawFooterEdit, DrawFooterEdit) + FUNCTION_WRAPPER_V8_3(_DrawLockParagraph, DrawLockParagraph) + FUNCTION_WRAPPER_V8_4(_DrawLockObjectRect, DrawLockObjectRect) + FUNCTION_WRAPPER_V8_4(_DrawEmptyTableLine, DrawEmptyTableLine) + FUNCTION_WRAPPER_V8_4(_DrawSpellingLine, DrawSpellingLine) + FUNCTION_WRAPPER_V8_5(_drawHorLine, drawHorLine) + FUNCTION_WRAPPER_V8_5(_drawHorLine2, drawHorLine2) + FUNCTION_WRAPPER_V8_5(_drawVerLine, drawVerLine) + FUNCTION_WRAPPER_V8_7(_drawHorLineExt, drawHorLineExt) + FUNCTION_WRAPPER_V8_4(_rect, rect) + FUNCTION_WRAPPER_V8_4(_TableRect, TableRect) + FUNCTION_WRAPPER_V8_4(_AddClipRect, AddClipRect) + FUNCTION_WRAPPER_V8_0(_RemoveClipRect, RemoveClipRect) + FUNCTION_WRAPPER_V8_4(_SetClip, SetClip) + FUNCTION_WRAPPER_V8_0(_RemoveClip, RemoveClip) + FUNCTION_WRAPPER_V8_4(_drawMailMergeField, drawMailMergeField) + FUNCTION_WRAPPER_V8_4(_drawSearchResult, drawSearchResult) + FUNCTION_WRAPPER_V8_2(_drawFlowAnchor, drawFlowAnchor) + FUNCTION_WRAPPER_V8_0(_SavePen, SavePen) + FUNCTION_WRAPPER_V8_0(_RestorePen, RestorePen) + FUNCTION_WRAPPER_V8_0(_SaveBrush, SaveBrush) + FUNCTION_WRAPPER_V8_0(_RestoreBrush, RestoreBrush) + FUNCTION_WRAPPER_V8_0(_SavePenBrush, SavePenBrush) + FUNCTION_WRAPPER_V8_0(_RestorePenBrush, RestorePenBrush) + FUNCTION_WRAPPER_V8_0(_SaveGrState, SaveGrState) + FUNCTION_WRAPPER_V8_0(_RestoreGrState, RestoreGrState) + FUNCTION_WRAPPER_V8_0(_StartClipPath, StartClipPath) + FUNCTION_WRAPPER_V8_0(_EndClipPath, EndClipPath) + FUNCTION_WRAPPER_V8_0(_StartCheckTableDraw, StartCheckTableDraw) + FUNCTION_WRAPPER_V8_4(_SetTextClipRect, SetTextClipRect) + FUNCTION_WRAPPER_V8_5(_AddSmartRect, AddSmartRect) + FUNCTION_WRAPPER_V8_1(_CheckUseFonts2, CheckUseFonts2) + FUNCTION_WRAPPER_V8_0(_UncheckUseFonts2, UncheckUseFonts2) + FUNCTION_WRAPPER_V8_4(_Drawing_StartCheckBounds, Drawing_StartCheckBounds) + FUNCTION_WRAPPER_V8_0(_Drawing_EndCheckBounds, Drawing_EndCheckBounds) + FUNCTION_WRAPPER_V8_5(_DrawPresentationComment, DrawPresentationComment) + FUNCTION_WRAPPER_V8_3(_DrawPolygon, DrawPolygon) + FUNCTION_WRAPPER_V8_4(_DrawFootnoteRect, DrawFootnoteRect) + FUNCTION_WRAPPER_V8_1(_toDataURL, toDataURL) + FUNCTION_WRAPPER_V8_0(_GetPenColor, GetPenColor) + FUNCTION_WRAPPER_V8_0(_GetBrushColor, GetBrushColor) + FUNCTION_WRAPPER_V8_2(_put_brushTexture, put_brushTexture) + FUNCTION_WRAPPER_V8_1(_put_brushTextureMode, put_brushTextureMode) + FUNCTION_WRAPPER_V8_1(_put_BrushTextureAlpha, put_BrushTextureAlpha) + FUNCTION_WRAPPER_V8_8(_put_BrushGradient, put_BrushGradient) + FUNCTION_WRAPPER_V8_2(_TransformPointX, TransformPointX) + FUNCTION_WRAPPER_V8_2(_TransformPointY, TransformPointY) + FUNCTION_WRAPPER_V8_1(_put_LineJoin, put_LineJoin) + FUNCTION_WRAPPER_V8_0(_get_LineJoin, get_LineJoin) + FUNCTION_WRAPPER_V8_4(_put_TextureBounds, put_TextureBounds) + FUNCTION_WRAPPER_V8_0(_GetlineWidth, GetlineWidth) + FUNCTION_WRAPPER_V8_1(_DrawPath, DrawPath) + FUNCTION_WRAPPER_V8_2(_CoordTransformOffset, CoordTransformOffset) + FUNCTION_WRAPPER_V8_0(_GetTransform, GetTransform) + + v8::Handle CreateTemplate(v8::Isolate* isolate) + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + + NSV8Objects::Template_Set(result, "create", _create); + NSV8Objects::Template_Set(result, "Destroy", _Destroy); + NSV8Objects::Template_Set(result, "EndDraw", _EndDraw); + NSV8Objects::Template_Set(result, "put_GlobalAlpha", _put_GlobalAlpha); + NSV8Objects::Template_Set(result, "Start_GlobalAlpha", _Start_GlobalAlpha); + NSV8Objects::Template_Set(result, "End_GlobalAlpha", _End_GlobalAlpha); + NSV8Objects::Template_Set(result, "p_color", _p_color); + NSV8Objects::Template_Set(result, "p_width", _p_width); + NSV8Objects::Template_Set(result, "p_dash", _p_dash); + NSV8Objects::Template_Set(result, "b_color1", _b_color1); + NSV8Objects::Template_Set(result, "b_color2", _b_color2); + NSV8Objects::Template_Set(result, "transform", _transform); + NSV8Objects::Template_Set(result, "CalculateFullTransform", _CalculateFullTransform); + NSV8Objects::Template_Set(result, "_s", __s); + NSV8Objects::Template_Set(result, "_e", __e); + NSV8Objects::Template_Set(result, "_z", __z); + NSV8Objects::Template_Set(result, "_m", __m); + NSV8Objects::Template_Set(result, "_l", __l); + NSV8Objects::Template_Set(result, "_c", __c); + NSV8Objects::Template_Set(result, "_c2", __c2); + NSV8Objects::Template_Set(result, "ds", _ds); + NSV8Objects::Template_Set(result, "df", _df); + NSV8Objects::Template_Set(result, "save", _save); + NSV8Objects::Template_Set(result, "restore", _restore); + NSV8Objects::Template_Set(result, "clip", _clip); + NSV8Objects::Template_Set(result, "reset", _reset); + NSV8Objects::Template_Set(result, "FreeFont", _FreeFont); + NSV8Objects::Template_Set(result, "ClearLastFont", _ClearLastFont); + NSV8Objects::Template_Set(result, "drawImage2", _drawImage2); + NSV8Objects::Template_Set(result, "drawImage", _drawImage); + NSV8Objects::Template_Set(result, "GetFont", _GetFont); + NSV8Objects::Template_Set(result, "font", _font); + NSV8Objects::Template_Set(result, "SetFont", _SetFont); + NSV8Objects::Template_Set(result, "GetTextPr", _GetTextPr); + NSV8Objects::Template_Set(result, "FillText", _FillText); + NSV8Objects::Template_Set(result, "t", _t); + NSV8Objects::Template_Set(result, "FillText2", _FillText2); + NSV8Objects::Template_Set(result, "t2", _t2); + NSV8Objects::Template_Set(result, "FillTextCode", _FillTextCode); + NSV8Objects::Template_Set(result, "tg", _tg); + NSV8Objects::Template_Set(result, "charspace", _charspace); + NSV8Objects::Template_Set(result, "private_FillGlyph", _private_FillGlyph); + NSV8Objects::Template_Set(result, "private_FillGlyphC", _private_FillGlyphC); + NSV8Objects::Template_Set(result, "private_FillGlyph2", _private_FillGlyph2); + NSV8Objects::Template_Set(result, "SetIntegerGrid", _SetIntegerGrid); + NSV8Objects::Template_Set(result, "GetIntegerGrid", _GetIntegerGrid); + NSV8Objects::Template_Set(result, "DrawStringASCII", _DrawStringASCII); + NSV8Objects::Template_Set(result, "DrawStringASCII2", _DrawStringASCII2); + NSV8Objects::Template_Set(result, "DrawHeaderEdit", _DrawHeaderEdit); + NSV8Objects::Template_Set(result, "DrawFooterEdit", _DrawFooterEdit); + NSV8Objects::Template_Set(result, "DrawLockParagraph", _DrawLockParagraph); + NSV8Objects::Template_Set(result, "DrawLockObjectRect", _DrawLockObjectRect); + NSV8Objects::Template_Set(result, "DrawEmptyTableLine", _DrawEmptyTableLine); + NSV8Objects::Template_Set(result, "DrawSpellingLine", _DrawSpellingLine); + NSV8Objects::Template_Set(result, "drawHorLine", _drawHorLine); + NSV8Objects::Template_Set(result, "drawHorLine2", _drawHorLine2); + NSV8Objects::Template_Set(result, "drawVerLine", _drawVerLine); + NSV8Objects::Template_Set(result, "drawHorLineExt", _drawHorLineExt); + NSV8Objects::Template_Set(result, "rect", _rect); + NSV8Objects::Template_Set(result, "TableRect", _TableRect); + NSV8Objects::Template_Set(result, "AddClipRect", _AddClipRect); + NSV8Objects::Template_Set(result, "RemoveClipRect", _RemoveClipRect); + NSV8Objects::Template_Set(result, "SetClip", _SetClip); + NSV8Objects::Template_Set(result, "RemoveClip", _RemoveClip); + NSV8Objects::Template_Set(result, "drawMailMergeField", _drawMailMergeField); + NSV8Objects::Template_Set(result, "drawSearchResult", _drawSearchResult); + NSV8Objects::Template_Set(result, "drawFlowAnchor", _drawFlowAnchor); + NSV8Objects::Template_Set(result, "SavePen", _SavePen); + NSV8Objects::Template_Set(result, "RestorePen", _RestorePen); + NSV8Objects::Template_Set(result, "SaveBrush", _SaveBrush); + NSV8Objects::Template_Set(result, "RestoreBrush", _RestoreBrush); + NSV8Objects::Template_Set(result, "SavePenBrush", _SavePenBrush); + NSV8Objects::Template_Set(result, "RestorePenBrush", _RestorePenBrush); + NSV8Objects::Template_Set(result, "SaveGrState", _SaveGrState); + NSV8Objects::Template_Set(result, "RestoreGrState", _RestoreGrState); + NSV8Objects::Template_Set(result, "StartClipPath", _StartClipPath); + NSV8Objects::Template_Set(result, "EndClipPath", _EndClipPath); + NSV8Objects::Template_Set(result, "StartCheckTableDraw", _StartCheckTableDraw); + NSV8Objects::Template_Set(result, "SetTextClipRect", _SetTextClipRect); + NSV8Objects::Template_Set(result, "AddSmartRect", _AddSmartRect); + NSV8Objects::Template_Set(result, "CheckUseFonts2", _CheckUseFonts2); + NSV8Objects::Template_Set(result, "UncheckUseFonts2", _UncheckUseFonts2); + NSV8Objects::Template_Set(result, "Drawing_StartCheckBounds", _Drawing_StartCheckBounds); + NSV8Objects::Template_Set(result, "Drawing_EndCheckBounds", _Drawing_EndCheckBounds); + NSV8Objects::Template_Set(result, "DrawPresentationComment", _DrawPresentationComment); + NSV8Objects::Template_Set(result, "DrawPolygon", _DrawPolygon); + NSV8Objects::Template_Set(result, "DrawFootnoteRect", _DrawFootnoteRect); + NSV8Objects::Template_Set(result, "toDataURL", _toDataURL); + NSV8Objects::Template_Set(result, "GetPenColor", _GetPenColor); + NSV8Objects::Template_Set(result, "GetBrushColor", _GetBrushColor); + NSV8Objects::Template_Set(result, "put_brushTexture", _put_brushTexture); + NSV8Objects::Template_Set(result, "put_brushTextureMode", _put_brushTextureMode); + NSV8Objects::Template_Set(result, "put_BrushTextureAlpha", _put_BrushTextureAlpha); + NSV8Objects::Template_Set(result, "put_BrushGradient", _put_BrushGradient); + NSV8Objects::Template_Set(result, "TransformPointX", _TransformPointX); + NSV8Objects::Template_Set(result, "TransformPointY", _TransformPointY); + NSV8Objects::Template_Set(result, "put_LineJoin", _put_LineJoin); + NSV8Objects::Template_Set(result, "get_LineJoin", _get_LineJoin); + NSV8Objects::Template_Set(result, "put_TextureBounds", _put_TextureBounds); + NSV8Objects::Template_Set(result, "GetlineWidth", _GetlineWidth); + NSV8Objects::Template_Set(result, "DrawPath", _DrawPath); + NSV8Objects::Template_Set(result, "CoordTransformOffset", _CoordTransformOffset); + NSV8Objects::Template_Set(result, "GetTransform", _GetTransform); + + return handle_scope.Escape(result); + } +} + +class CGraphicsEmbedAdapter : public CJSEmbedObjectAdapterV8Template +{ +public: + virtual v8::Local getTemplate(v8::Isolate* isolate) override + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local templ = NSGraphicsEmbed::CreateTemplate(isolate); + return handle_scope.Escape(templ); + } +}; + +CJSEmbedObjectAdapterBase* CGraphicsEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CGraphicsEmbedAdapter(); + return m_pAdapter; +} + +std::string CGraphicsEmbed::getName() { return "CGraphicsEmbed"; } + +CJSEmbedObject* CGraphicsEmbed::getCreator() +{ + return new CGraphicsEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_Hash.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_Hash.cpp deleted file mode 100644 index fa0655bdcd..0000000000 --- a/DesktopEditor/doctrenderer/embed/v8/v8_Hash.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "../HashEmbed.h" -#include "../../js_internal/v8/v8_base.h" - -namespace NSHash -{ -#define CURRENTWRAPPER CHashEmbed - - FUNCTION_WRAPPER_V8_3(_hash, hash) - FUNCTION_WRAPPER_V8_4(_hash2, hash2) - - v8::Handle CreateHashTemplate(v8::Isolate* isolate) - { - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local result = v8::ObjectTemplate::New(isolate); - result->SetInternalFieldCount(1); - - // methods - NSV8Objects::Template_Set(result, "hash", _hash); - NSV8Objects::Template_Set(result, "hash2", _hash2); - - return handle_scope.Escape(result); - } - - void CreateNativeHash(const v8::FunctionCallbackInfo& args) - { - CreateNativeInternalField(new CHashEmbed(), NSHash::CreateHashTemplate, args); - } -} - -void CHashEmbed::CreateObjectInContext(const std::string& name, JSSmart context) -{ - InsertToGlobal(name, context, NSHash::CreateNativeHash); -} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_HashEmbed.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_HashEmbed.cpp new file mode 100644 index 0000000000..e3c4ddcc2c --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/v8/v8_HashEmbed.cpp @@ -0,0 +1,50 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../HashEmbed.h" +#include "../../js_internal/v8/v8_base.h" + +namespace NSHashEmbed +{ +#define CURRENTWRAPPER CHashEmbed + + FUNCTION_WRAPPER_V8_3(_hash, hash) + FUNCTION_WRAPPER_V8_4(_hash2, hash2) + + v8::Handle CreateTemplate(v8::Isolate* isolate) + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + + NSV8Objects::Template_Set(result, "hash", _hash); + NSV8Objects::Template_Set(result, "hash2", _hash2); + + return handle_scope.Escape(result); + } +} + +class CHashEmbedAdapter : public CJSEmbedObjectAdapterV8Template +{ +public: + virtual v8::Local getTemplate(v8::Isolate* isolate) override + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local templ = NSHashEmbed::CreateTemplate(isolate); + return handle_scope.Escape(templ); + } +}; + +CJSEmbedObjectAdapterBase* CHashEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CHashEmbedAdapter(); + return m_pAdapter; +} + +std::string CHashEmbed::getName() { return "CHashEmbed"; } + +CJSEmbedObject* CHashEmbed::getCreator() +{ + return new CHashEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_MemoryStream.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_MemoryStream.cpp deleted file mode 100644 index 610c4d34bc..0000000000 --- a/DesktopEditor/doctrenderer/embed/v8/v8_MemoryStream.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "../MemoryStreamEmbed.h" -#include "../../js_internal/v8/v8_base.h" - -namespace NSMemoryStream -{ -#define CURRENTWRAPPER CMemoryStreamEmbed - - FUNCTION_WRAPPER_V8_1(_ms_write_byte, WriteByte) - FUNCTION_WRAPPER_V8_1(_ms_write_bool, WriteBool) - FUNCTION_WRAPPER_V8_1(_ms_write_long, WriteLong) - FUNCTION_WRAPPER_V8_1(_ms_write_double, WriteDouble) - FUNCTION_WRAPPER_V8_1(_ms_write_double2, WriteDouble2) - FUNCTION_WRAPPER_V8_1(_ms_writestringA, WriteStringA) - FUNCTION_WRAPPER_V8_1(_ms_writestring1, WriteString) - FUNCTION_WRAPPER_V8_1(_ms_writestring2, WriteString2) - FUNCTION_WRAPPER_V8_3(_ms_copy, Copy) - FUNCTION_WRAPPER_V8(_ms_clearnoattack, ClearNoAttack) - - void _ms_pos(v8::Local name, const v8::PropertyCallbackInfo& args) - { - CMemoryStreamEmbed* _this = (CMemoryStreamEmbed*)unwrap_native(args.This()); - args.GetReturnValue().Set(v8::Integer::New(CV8Worker::GetCurrent(), _this->m_pInternal->GetSize())); - } - - v8::Handle CreateMemoryStreamTemplate(v8::Isolate* isolate) - { - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local result = v8::ObjectTemplate::New(V8IsolateOneArg); - result->SetInternalFieldCount(1); - - // property - result->SetAccessor(CreateV8String(CV8Worker::GetCurrent(), "pos"), _ms_pos); - - NSV8Objects::Template_Set(result, "Copy", _ms_copy); - NSV8Objects::Template_Set(result, "ClearNoAttack", _ms_clearnoattack); - NSV8Objects::Template_Set(result, "WriteByte", _ms_write_byte); - NSV8Objects::Template_Set(result, "WriteBool", _ms_write_bool); - NSV8Objects::Template_Set(result, "WriteLong", _ms_write_long); - NSV8Objects::Template_Set(result, "WriteDouble", _ms_write_double); - NSV8Objects::Template_Set(result, "WriteDouble2", _ms_write_double2); - NSV8Objects::Template_Set(result, "WriteStringA", _ms_writestringA); - NSV8Objects::Template_Set(result, "WriteString", _ms_writestring1); - NSV8Objects::Template_Set(result, "WriteString2", _ms_writestring2); - - return handle_scope.Escape(result); - } - - void CreateNativeMemoryStream(const v8::FunctionCallbackInfo& args) - { - CreateNativeInternalField(new CMemoryStreamEmbed(), NSMemoryStream::CreateMemoryStreamTemplate, args); - } -} - -void CMemoryStreamEmbed::CreateObjectInContext(const std::string& name, JSSmart context) -{ - InsertToGlobal(name, context, NSMemoryStream::CreateNativeMemoryStream); -} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_MemoryStreamEmbed.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_MemoryStreamEmbed.cpp new file mode 100644 index 0000000000..70e2d2f657 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/v8/v8_MemoryStreamEmbed.cpp @@ -0,0 +1,66 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../MemoryStreamEmbed.h" +#include "../../js_internal/v8/v8_base.h" + +namespace NSMemoryStreamEmbed +{ +#define CURRENTWRAPPER CMemoryStreamEmbed + + FUNCTION_WRAPPER_V8_3(_Copy, Copy) + FUNCTION_WRAPPER_V8_0(_ClearNoAttack, ClearNoAttack) + FUNCTION_WRAPPER_V8_1(_WriteByte, WriteByte) + FUNCTION_WRAPPER_V8_1(_WriteBool, WriteBool) + FUNCTION_WRAPPER_V8_1(_WriteLong, WriteLong) + FUNCTION_WRAPPER_V8_1(_WriteDouble, WriteDouble) + FUNCTION_WRAPPER_V8_1(_WriteDouble2, WriteDouble2) + FUNCTION_WRAPPER_V8_1(_WriteStringA, WriteStringA) + FUNCTION_WRAPPER_V8_1(_WriteString, WriteString) + FUNCTION_WRAPPER_V8_1(_WriteString2, WriteString2) + + v8::Handle CreateTemplate(v8::Isolate* isolate) + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + + NSV8Objects::Template_Set(result, "Copy", _Copy); + NSV8Objects::Template_Set(result, "ClearNoAttack", _ClearNoAttack); + NSV8Objects::Template_Set(result, "WriteByte", _WriteByte); + NSV8Objects::Template_Set(result, "WriteBool", _WriteBool); + NSV8Objects::Template_Set(result, "WriteLong", _WriteLong); + NSV8Objects::Template_Set(result, "WriteDouble", _WriteDouble); + NSV8Objects::Template_Set(result, "WriteDouble2", _WriteDouble2); + NSV8Objects::Template_Set(result, "WriteStringA", _WriteStringA); + NSV8Objects::Template_Set(result, "WriteString", _WriteString); + NSV8Objects::Template_Set(result, "WriteString2", _WriteString2); + + return handle_scope.Escape(result); + } +} + +class CMemoryStreamEmbedAdapter : public CJSEmbedObjectAdapterV8Template +{ +public: + virtual v8::Local getTemplate(v8::Isolate* isolate) override + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local templ = NSMemoryStreamEmbed::CreateTemplate(isolate); + return handle_scope.Escape(templ); + } +}; + +CJSEmbedObjectAdapterBase* CMemoryStreamEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CMemoryStreamEmbedAdapter(); + return m_pAdapter; +} + +std::string CMemoryStreamEmbed::getName() { return "CMemoryStreamEmbed"; } + +CJSEmbedObject* CMemoryStreamEmbed::getCreator() +{ + return new CMemoryStreamEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilder.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilder.cpp deleted file mode 100644 index dfced4f082..0000000000 --- a/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilder.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#include "../NativeBuilderEmbed.h" -#include "../../docbuilder_p.h" -#include "../../js_internal/v8/v8_base.h" - -#define CURRENTWRAPPER CBuilderEmbed - -FUNCTION_WRAPPER_V8_2(_builder_OpenFile, builder_OpenFile) -FUNCTION_WRAPPER_V8_1(_builder_CreateFile, builder_CreateFile) -FUNCTION_WRAPPER_V8_1(_builder_SetTmpFolder, builder_SetTmpFolder) -FUNCTION_WRAPPER_V8_3(_builder_SaveFile, builder_SaveFile) -FUNCTION_WRAPPER_V8 (_builder_CloseFile, builder_CloseFile) -FUNCTION_WRAPPER_V8_2(_builder_OpenTmpFile, builder_OpenTmpFile) - -#undef CURRENTWRAPPER -#define CURRENTWRAPPER CBuilderDocumentEmbed - -FUNCTION_WRAPPER_V8(_builder_doc_IsValid, builder_doc_IsValid) -FUNCTION_WRAPPER_V8(_builder_doc_GetBinary, builder_doc_GetBinary) -FUNCTION_WRAPPER_V8(_builder_doc_GetFolder, builder_doc_GetFolder) -FUNCTION_WRAPPER_V8(_builder_doc_CloseFile, builder_doc_CloseFile) -FUNCTION_WRAPPER_V8(_builder_doc_GetImageMap, builder_doc_GetImageMap) - -v8::Local _builder_CreateNativeTmpDoc(v8::Isolate* isolate, NSDoctRenderer::CDocBuilder* pBuilder, const std::wstring& sFile, const std::wstring& sParams) -{ - v8::Local _template = v8::ObjectTemplate::New(isolate); - _template->SetInternalFieldCount(1); // отводим в нем место для хранения CNativeControl - - NSV8Objects::Template_Set(_template, "IsValid", _builder_doc_IsValid); - NSV8Objects::Template_Set(_template, "GetBinary", _builder_doc_GetBinary); - NSV8Objects::Template_Set(_template, "GetFolder", _builder_doc_GetFolder); - NSV8Objects::Template_Set(_template, "Close", _builder_doc_CloseFile); - NSV8Objects::Template_Set(_template, "GetImageMap", _builder_doc_GetImageMap); - - CBuilderDocumentEmbed* _embed = new CBuilderDocumentEmbed(); - _embed->m_pBuilder = pBuilder; - _embed->OpenFile(sFile, sParams); - - v8::Local obj = _template->NewInstance(V8ContextOneArg).ToLocalChecked(); - obj->SetInternalField(0, v8::External::New(isolate, _embed)); - - return obj; -} -v8::Local _builder_CreateNative(v8::Isolate* isolate, NSDoctRenderer::CDocBuilder* builder) -{ - v8::Local _template = v8::ObjectTemplate::New(isolate); - _template->SetInternalFieldCount(1); - - NSV8Objects::Template_Set(_template, "OpenFile", _builder_OpenFile); - NSV8Objects::Template_Set(_template, "CreateFile", _builder_CreateFile); - NSV8Objects::Template_Set(_template, "SetTmpFolder", _builder_SetTmpFolder); - NSV8Objects::Template_Set(_template, "SaveFile", _builder_SaveFile); - NSV8Objects::Template_Set(_template, "CloseFile", _builder_CloseFile); - NSV8Objects::Template_Set(_template, "OpenTmpFile", _builder_OpenTmpFile); - - CBuilderEmbed* _embed = new CBuilderEmbed(); - _embed->m_pBuilder = builder; - - v8::Local obj = _template->NewInstance(V8ContextOneArg).ToLocalChecked(); - obj->SetInternalField(0, v8::External::New(isolate, _embed)); - - return obj; -} - -void builder_CreateNativeTmpDoc(const std::string& name, JSSmart context, NSDoctRenderer::CDocBuilder* builder, const std::wstring& sFile, const std::wstring& sParams) -{ - v8::Isolate* current = CV8Worker::GetCurrent(); - context->m_internal->m_context->Global()->Set(context->m_internal->m_context, CreateV8String(current, name.c_str()), _builder_CreateNativeTmpDoc(current, builder, sFile, sParams)); -} -void builder_CreateNative (const std::string& name, JSSmart context, NSDoctRenderer::CDocBuilder* builder) -{ - v8::Isolate* current = CV8Worker::GetCurrent(); - context->m_internal->m_context->Global()->Set(context->m_internal->m_context, CreateV8String(current, name.c_str()), _builder_CreateNative(current, builder)); -} - -JSSmart CBuilderEmbed::builder_OpenTmpFile(JSSmart path, JSSmart params) -{ - std::wstring sPath = path->toStringW(); - std::wstring sParams = params->toStringW(); - v8::Local obj = _builder_CreateNativeTmpDoc(CV8Worker::GetCurrent(), m_pBuilder, sPath, sParams); - CJSValueV8* res = new CJSValueV8(); - res->value = obj; - return res; -} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilderDocumentEmbed.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilderDocumentEmbed.cpp new file mode 100644 index 0000000000..51175b47f8 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilderDocumentEmbed.cpp @@ -0,0 +1,56 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../NativeBuilderDocumentEmbed.h" +#include "../../js_internal/v8/v8_base.h" + +namespace NSNativeBuilderDocumentEmbed +{ +#define CURRENTWRAPPER CBuilderDocumentEmbed + + FUNCTION_WRAPPER_V8_0(_IsValid, IsValid) + FUNCTION_WRAPPER_V8_0(_GetBinary, GetBinary) + FUNCTION_WRAPPER_V8_0(_GetFolder, GetFolder) + FUNCTION_WRAPPER_V8_0(_Close, Close) + FUNCTION_WRAPPER_V8_0(_GetImageMap, GetImageMap) + + v8::Handle CreateTemplate(v8::Isolate* isolate) + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + + NSV8Objects::Template_Set(result, "IsValid", _IsValid); + NSV8Objects::Template_Set(result, "GetBinary", _GetBinary); + NSV8Objects::Template_Set(result, "GetFolder", _GetFolder); + NSV8Objects::Template_Set(result, "Close", _Close); + NSV8Objects::Template_Set(result, "GetImageMap", _GetImageMap); + + return handle_scope.Escape(result); + } +} + +class CBuilderDocumentEmbedAdapter : public CJSEmbedObjectAdapterV8Template +{ +public: + virtual v8::Local getTemplate(v8::Isolate* isolate) override + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local templ = NSNativeBuilderDocumentEmbed::CreateTemplate(isolate); + return handle_scope.Escape(templ); + } +}; + +CJSEmbedObjectAdapterBase* CBuilderDocumentEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CBuilderDocumentEmbedAdapter(); + return m_pAdapter; +} + +std::string CBuilderDocumentEmbed::getName() { return "CBuilderDocumentEmbed"; } + +CJSEmbedObject* CBuilderDocumentEmbed::getCreator() +{ + return new CBuilderDocumentEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilderEmbed.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilderEmbed.cpp new file mode 100644 index 0000000000..5ff6e8c8cd --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/v8/v8_NativeBuilderEmbed.cpp @@ -0,0 +1,58 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../NativeBuilderEmbed.h" +#include "../../js_internal/v8/v8_base.h" + +namespace NSNativeBuilderEmbed +{ +#define CURRENTWRAPPER CBuilderEmbed + + FUNCTION_WRAPPER_V8_2(_OpenFile, OpenFile) + FUNCTION_WRAPPER_V8_1(_CreateFile, CreateFile) + FUNCTION_WRAPPER_V8_1(_SetTmpFolder, SetTmpFolder) + FUNCTION_WRAPPER_V8_3(_SaveFile, SaveFile) + FUNCTION_WRAPPER_V8_0(_CloseFile, CloseFile) + FUNCTION_WRAPPER_V8_2(_OpenTmpFile, OpenTmpFile) + + v8::Handle CreateTemplate(v8::Isolate* isolate) + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + + NSV8Objects::Template_Set(result, "OpenFile", _OpenFile); + NSV8Objects::Template_Set(result, "CreateFile", _CreateFile); + NSV8Objects::Template_Set(result, "SetTmpFolder", _SetTmpFolder); + NSV8Objects::Template_Set(result, "SaveFile", _SaveFile); + NSV8Objects::Template_Set(result, "CloseFile", _CloseFile); + NSV8Objects::Template_Set(result, "OpenTmpFile", _OpenTmpFile); + + return handle_scope.Escape(result); + } +} + +class CBuilderEmbedAdapter : public CJSEmbedObjectAdapterV8Template +{ +public: + virtual v8::Local getTemplate(v8::Isolate* isolate) override + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local templ = NSNativeBuilderEmbed::CreateTemplate(isolate); + return handle_scope.Escape(templ); + } +}; + +CJSEmbedObjectAdapterBase* CBuilderEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CBuilderEmbedAdapter(); + return m_pAdapter; +} + +std::string CBuilderEmbed::getName() { return "CBuilderEmbed"; } + +CJSEmbedObject* CBuilderEmbed::getCreator() +{ + return new CBuilderEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_NativeControl.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_NativeControl.cpp deleted file mode 100644 index 77bac9049e..0000000000 --- a/DesktopEditor/doctrenderer/embed/v8/v8_NativeControl.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include "../NativeControlEmbed.h" -#include "../../js_internal/v8/v8_base.h" - -namespace NSNativeControl -{ -#define CURRENTWRAPPER CNativeControlEmbed - - FUNCTION_WRAPPER_V8(_GetFilePath, GetFilePath) - FUNCTION_WRAPPER_V8_1(_SetFilePath, SetFilePath) - FUNCTION_WRAPPER_V8(_GetFileId, GetFileId) - FUNCTION_WRAPPER_V8_1(_SetFileId, SetFileId) - FUNCTION_WRAPPER_V8_1(_GetFileArrayBuffer, GetFileBinary) - FUNCTION_WRAPPER_V8_1(_GetFontArrayBuffer, GetFontBinary) - FUNCTION_WRAPPER_V8(_GetFontsDirectory, GetFontsDirectory) - FUNCTION_WRAPPER_V8_1(_GetFileString, GetFileString) - FUNCTION_WRAPPER_V8(_GetEditorType, GetEditorType) - FUNCTION_WRAPPER_V8(_CheckNextChange, CheckNextChange) - FUNCTION_WRAPPER_V8(_GetChangesCount, GetCountChanges) - FUNCTION_WRAPPER_V8_1(_GetChangesFile, GetChangesFile) - FUNCTION_WRAPPER_V8_1(_Save_AllocNative, Save_AllocNative) - FUNCTION_WRAPPER_V8_2(_Save_ReAllocNative, Save_ReAllocNative) - FUNCTION_WRAPPER_V8_2(_Save_End, Save_End) - FUNCTION_WRAPPER_V8_1(_AddImageInChanges, AddImageInChanges) - FUNCTION_WRAPPER_V8_1(_ConsoleLog, ConsoleLog) - FUNCTION_WRAPPER_V8_3(_SaveChanges, SaveChanges) - FUNCTION_WRAPPER_V8_1(_zipOpenFile, zipOpenFile) - FUNCTION_WRAPPER_V8_1(_zipOpenFileBase64, zipOpenFileBase64) - FUNCTION_WRAPPER_V8_1(_zipGetFileAsString, zipGetFileAsString) - FUNCTION_WRAPPER_V8_1(_zipGetFileAsBinary, zipGetFileAsBinary) - FUNCTION_WRAPPER_V8(_zipCloseFile, zipCloseFile) - FUNCTION_WRAPPER_V8_1(_GetImageUrl, GetImageUrl) - FUNCTION_WRAPPER_V8_1(_GetImageOriginalSize, GetImageOriginalSize) - FUNCTION_WRAPPER_V8(_GetImagesPath, GetImagesPath) - - v8::Handle CreateNativeControlTemplate(v8::Isolate* isolate) - { - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local result = v8::ObjectTemplate::New(V8IsolateOneArg); - result->SetInternalFieldCount(1); - - NSV8Objects::Template_Set(result, "SetFilePath", _SetFilePath); - NSV8Objects::Template_Set(result, "GetFilePath", _GetFilePath); - NSV8Objects::Template_Set(result, "SetFileId", _SetFileId); - NSV8Objects::Template_Set(result, "GetFileId", _GetFileId); - NSV8Objects::Template_Set(result, "GetFileBinary", _GetFileArrayBuffer); - NSV8Objects::Template_Set(result, "GetFontBinary", _GetFontArrayBuffer); - NSV8Objects::Template_Set(result, "GetFontsDirectory", _GetFontsDirectory); - NSV8Objects::Template_Set(result, "GetFileString", _GetFileString); - NSV8Objects::Template_Set(result, "GetEditorType", _GetEditorType); - NSV8Objects::Template_Set(result, "CheckNextChange", _CheckNextChange); - NSV8Objects::Template_Set(result, "GetCountChanges", _GetChangesCount); - NSV8Objects::Template_Set(result, "GetChangesFile", _GetChangesFile); - //NSV8Objects::Template_Set(result, "Save_AllocNative", _Save_AllocNative); - //NSV8Objects::Template_Set(result, "Save_ReAllocNative", _Save_ReAllocNative); - NSV8Objects::Template_Set(result, "Save_End", _Save_End); - NSV8Objects::Template_Set(result, "AddImageInChanges", _AddImageInChanges); - NSV8Objects::Template_Set(result, "ConsoleLog", _ConsoleLog); - NSV8Objects::Template_Set(result, "SaveChanges", _SaveChanges); - NSV8Objects::Template_Set(result, "ZipOpen", _zipOpenFile); - NSV8Objects::Template_Set(result, "ZipOpenBase64", _zipOpenFileBase64); - NSV8Objects::Template_Set(result, "ZipFileAsString", _zipGetFileAsString); - NSV8Objects::Template_Set(result, "ZipFileAsBinary", _zipGetFileAsBinary); - NSV8Objects::Template_Set(result, "ZipClose", _zipCloseFile); - NSV8Objects::Template_Set(result, "getImageUrl", _GetImageUrl); - NSV8Objects::Template_Set(result, "getImagesDirectory", _GetImagesPath); - NSV8Objects::Template_Set(result, "GetImageOriginalSize", _GetImageOriginalSize); - - return handle_scope.Escape(result); - } - - // Без SaveChanges - v8::Handle CreateNativeControlTemplateBuilder(v8::Isolate* isolate) - { - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local result = v8::ObjectTemplate::New(V8IsolateOneArg); - result->SetInternalFieldCount(1); - - NSV8Objects::Template_Set(result, "SetFilePath", _SetFilePath); - NSV8Objects::Template_Set(result, "GetFilePath", _GetFilePath); - NSV8Objects::Template_Set(result, "SetFileId", _SetFileId); - NSV8Objects::Template_Set(result, "GetFileId", _GetFileId); - NSV8Objects::Template_Set(result, "GetFileBinary", _GetFileArrayBuffer); - NSV8Objects::Template_Set(result, "GetFontBinary", _GetFontArrayBuffer); - NSV8Objects::Template_Set(result, "GetFontsDirectory", _GetFontsDirectory); - NSV8Objects::Template_Set(result, "GetFileString", _GetFileString); - NSV8Objects::Template_Set(result, "GetEditorType", _GetEditorType); - NSV8Objects::Template_Set(result, "CheckNextChange", _CheckNextChange); - NSV8Objects::Template_Set(result, "GetCountChanges", _GetChangesCount); - NSV8Objects::Template_Set(result, "GetChangesFile", _GetChangesFile); - //NSV8Objects::Template_Set(result, "Save_AllocNative", _Save_AllocNative); - //NSV8Objects::Template_Set(result, "Save_ReAllocNative", _Save_ReAllocNative); - NSV8Objects::Template_Set(result, "Save_End", _Save_End); - NSV8Objects::Template_Set(result, "AddImageInChanges", _AddImageInChanges); - NSV8Objects::Template_Set(result, "ConsoleLog", _ConsoleLog); - NSV8Objects::Template_Set(result, "ZipOpen", _zipOpenFile); - NSV8Objects::Template_Set(result, "ZipOpenBase64", _zipOpenFileBase64); - NSV8Objects::Template_Set(result, "ZipFileAsString", _zipGetFileAsString); - NSV8Objects::Template_Set(result, "ZipFileAsBinary", _zipGetFileAsBinary); - NSV8Objects::Template_Set(result, "ZipClose", _zipCloseFile); - NSV8Objects::Template_Set(result, "getImageUrl", _GetImageUrl); - NSV8Objects::Template_Set(result, "getImagesDirectory", _GetImagesPath); - NSV8Objects::Template_Set(result, "GetImageOriginalSize", _GetImageOriginalSize); - - return handle_scope.Escape(result); - } - - void CreateNativeObject(const v8::FunctionCallbackInfo& args) - { - CreateNativeInternalField(new CNativeControlEmbed(), CreateNativeControlTemplate, args, CIsolateAdditionalData::iadtSingletonNative); - } - - // Без SaveChanges - void CreateNativeObjectBuilder(const v8::FunctionCallbackInfo& args) - { - CreateNativeInternalField(new CNativeControlEmbed(), CreateNativeControlTemplateBuilder, args, CIsolateAdditionalData::iadtSingletonNative); - } -} - -void CNativeControlEmbed::CreateObjectInContext(const std::string& name, JSSmart context) -{ - InsertToGlobal(name, context, NSNativeControl::CreateNativeObject); -} - -void CNativeControlEmbed::CreateObjectBuilderInContext(const std::string& name, JSSmart context) -{ - InsertToGlobal(name, context, NSNativeControl::CreateNativeObjectBuilder); -} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_NativeControlEmbed.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_NativeControlEmbed.cpp new file mode 100644 index 0000000000..51ad8a519c --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/v8/v8_NativeControlEmbed.cpp @@ -0,0 +1,92 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../NativeControlEmbed.h" +#include "../../js_internal/v8/v8_base.h" + +namespace NSNativeControlEmbed +{ +#define CURRENTWRAPPER CNativeControlEmbed + + FUNCTION_WRAPPER_V8_1(_SetFilePath, SetFilePath) + FUNCTION_WRAPPER_V8_0(_GetFilePath, GetFilePath) + FUNCTION_WRAPPER_V8_1(_SetFileId, SetFileId) + FUNCTION_WRAPPER_V8_0(_GetFileId, GetFileId) + FUNCTION_WRAPPER_V8_1(_GetFileBinary, GetFileBinary) + FUNCTION_WRAPPER_V8_1(_GetFontBinary, GetFontBinary) + FUNCTION_WRAPPER_V8_0(_GetFontsDirectory, GetFontsDirectory) + FUNCTION_WRAPPER_V8_1(_GetFileString, GetFileString) + FUNCTION_WRAPPER_V8_0(_GetEditorType, GetEditorType) + FUNCTION_WRAPPER_V8_0(_CheckNextChange, CheckNextChange) + FUNCTION_WRAPPER_V8_0(_GetCountChanges, GetCountChanges) + FUNCTION_WRAPPER_V8_1(_GetChangesFile, GetChangesFile) + FUNCTION_WRAPPER_V8_2(_Save_End, Save_End) + FUNCTION_WRAPPER_V8_1(_AddImageInChanges, AddImageInChanges) + FUNCTION_WRAPPER_V8_1(_ConsoleLog, ConsoleLog) + FUNCTION_WRAPPER_V8_1(_ZipOpen, ZipOpen) + FUNCTION_WRAPPER_V8_1(_ZipOpenBase64, ZipOpenBase64) + FUNCTION_WRAPPER_V8_1(_ZipFileAsString, ZipFileAsString) + FUNCTION_WRAPPER_V8_1(_ZipFileAsBinary, ZipFileAsBinary) + FUNCTION_WRAPPER_V8_0(_ZipClose, ZipClose) + FUNCTION_WRAPPER_V8_1(_GetImageUrl, GetImageUrl) + FUNCTION_WRAPPER_V8_0(_GetImagesPath, GetImagesPath) + FUNCTION_WRAPPER_V8_1(_GetImageOriginalSize, GetImageOriginalSize) + + v8::Handle CreateTemplate(v8::Isolate* isolate) + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + + NSV8Objects::Template_Set(result, "SetFilePath", _SetFilePath); + NSV8Objects::Template_Set(result, "GetFilePath", _GetFilePath); + NSV8Objects::Template_Set(result, "SetFileId", _SetFileId); + NSV8Objects::Template_Set(result, "GetFileId", _GetFileId); + NSV8Objects::Template_Set(result, "GetFileBinary", _GetFileBinary); + NSV8Objects::Template_Set(result, "GetFontBinary", _GetFontBinary); + NSV8Objects::Template_Set(result, "GetFontsDirectory", _GetFontsDirectory); + NSV8Objects::Template_Set(result, "GetFileString", _GetFileString); + NSV8Objects::Template_Set(result, "GetEditorType", _GetEditorType); + NSV8Objects::Template_Set(result, "CheckNextChange", _CheckNextChange); + NSV8Objects::Template_Set(result, "GetCountChanges", _GetCountChanges); + NSV8Objects::Template_Set(result, "GetChangesFile", _GetChangesFile); + NSV8Objects::Template_Set(result, "Save_End", _Save_End); + NSV8Objects::Template_Set(result, "AddImageInChanges", _AddImageInChanges); + NSV8Objects::Template_Set(result, "ConsoleLog", _ConsoleLog); + NSV8Objects::Template_Set(result, "ZipOpen", _ZipOpen); + NSV8Objects::Template_Set(result, "ZipOpenBase64", _ZipOpenBase64); + NSV8Objects::Template_Set(result, "ZipFileAsString", _ZipFileAsString); + NSV8Objects::Template_Set(result, "ZipFileAsBinary", _ZipFileAsBinary); + NSV8Objects::Template_Set(result, "ZipClose", _ZipClose); + NSV8Objects::Template_Set(result, "GetImageUrl", _GetImageUrl); + NSV8Objects::Template_Set(result, "GetImagesPath", _GetImagesPath); + NSV8Objects::Template_Set(result, "GetImageOriginalSize", _GetImageOriginalSize); + + return handle_scope.Escape(result); + } +} + +class CNativeControlEmbedAdapter : public CJSEmbedObjectAdapterV8Template +{ +public: + virtual v8::Local getTemplate(v8::Isolate* isolate) override + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local templ = NSNativeControlEmbed::CreateTemplate(isolate); + return handle_scope.Escape(templ); + } +}; + +CJSEmbedObjectAdapterBase* CNativeControlEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CNativeControlEmbedAdapter(); + return m_pAdapter; +} + +std::string CNativeControlEmbed::getName() { return "CNativeControlEmbed"; } + +CJSEmbedObject* CNativeControlEmbed::getCreator() +{ + return new CNativeControlEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_Pointer.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_PointerEmbed.cpp similarity index 100% rename from DesktopEditor/doctrenderer/embed/v8/v8_Pointer.cpp rename to DesktopEditor/doctrenderer/embed/v8/v8_PointerEmbed.cpp diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_TextMeasurer.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_TextMeasurer.cpp deleted file mode 100644 index 9c4a7ed4df..0000000000 --- a/DesktopEditor/doctrenderer/embed/v8/v8_TextMeasurer.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "../TextMeasurerEmbed.h" -#include "../../js_internal/v8/v8_base.h" - -namespace NSMeasurer -{ -#define CURRENTWRAPPER CTextMeasurerEmbed - - FUNCTION_WRAPPER_V8_1(_FT_Malloc, FT_Malloc) - FUNCTION_WRAPPER_V8_1(_FT_Free, FT_Free) - - FUNCTION_WRAPPER_V8 (_FT_Init, FT_Init) - FUNCTION_WRAPPER_V8_2(_FT_Set_TrueType_HintProp, FT_Set_TrueType_HintProp) - - FUNCTION_WRAPPER_V8_4(_FT_Open_Face, FT_Open_Face) - FUNCTION_WRAPPER_V8_3(_FT_Open_Face2, FT_Open_Face2) - FUNCTION_WRAPPER_V8_1(_FT_GetFaceInfo, FT_GetFaceInfo) - - FUNCTION_WRAPPER_V8_3(_FT_Load_Glyph, FT_Load_Glyph) - FUNCTION_WRAPPER_V8_2(_FT_Get_Glyph_Measure_Params, FT_Get_Glyph_Measure_Params) - FUNCTION_WRAPPER_V8_2(_FT_Get_Glyph_Render_Params, FT_Get_Glyph_Render_Params) - FUNCTION_WRAPPER_V8_2(_FT_Get_Glyph_Render_Buffer, FT_Get_Glyph_Render_Buffer) - - FUNCTION_WRAPPER_V8_5(_FT_Set_Transform, FT_Set_Transform) - FUNCTION_WRAPPER_V8_5(_FT_Set_Char_Size, FT_Set_Char_Size) - FUNCTION_WRAPPER_V8_2(_FT_SetCMapForCharCode, FT_SetCMapForCharCode) - FUNCTION_WRAPPER_V8_3(_FT_GetKerningX, FT_GetKerningX) - FUNCTION_WRAPPER_V8_1(_FT_GetFaceMaxAdvanceX, FT_GetFaceMaxAdvanceX) - -#ifdef SUPPORT_HARFBUZZ_SHAPER - FUNCTION_WRAPPER_V8_1(_HB_LanguageFromString, HB_LanguageFromString) - FUNCTION_WRAPPER_V8_7(_HB_ShapeText, HB_ShapeText) - FUNCTION_WRAPPER_V8 (_HB_FontMalloc, HB_FontMalloc) - FUNCTION_WRAPPER_V8_1(_HB_FontFree, HB_FontFree) -#endif - - v8::Handle CreateMeasurerTemplate(v8::Isolate* isolate) - { - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local result = v8::ObjectTemplate::New(isolate); - result->SetInternalFieldCount(1); - - // методы - NSV8Objects::Template_Set(result, "FT_Malloc", _FT_Malloc); - NSV8Objects::Template_Set(result, "FT_Free", _FT_Free); - - NSV8Objects::Template_Set(result, "FT_Init", _FT_Init); - NSV8Objects::Template_Set(result, "FT_Set_TrueType_HintProp", _FT_Set_TrueType_HintProp); - - NSV8Objects::Template_Set(result, "FT_Open_Face", _FT_Open_Face); - NSV8Objects::Template_Set(result, "FT_Open_Face2", _FT_Open_Face2); - NSV8Objects::Template_Set(result, "FT_GetFaceInfo", _FT_GetFaceInfo); - - NSV8Objects::Template_Set(result, "FT_Load_Glyph", _FT_Load_Glyph); - NSV8Objects::Template_Set(result, "FT_Get_Glyph_Measure_Params",_FT_Get_Glyph_Measure_Params); - NSV8Objects::Template_Set(result, "FT_Get_Glyph_Render_Params", _FT_Get_Glyph_Render_Params); - NSV8Objects::Template_Set(result, "FT_Get_Glyph_Render_Buffer", _FT_Get_Glyph_Render_Buffer); - - NSV8Objects::Template_Set(result, "FT_Set_Transform", _FT_Set_Transform); - NSV8Objects::Template_Set(result, "FT_Set_Char_Size", _FT_Set_Char_Size); - NSV8Objects::Template_Set(result, "FT_SetCMapForCharCode", _FT_SetCMapForCharCode); - NSV8Objects::Template_Set(result, "FT_GetKerningX", _FT_GetKerningX); - NSV8Objects::Template_Set(result, "FT_GetFaceMaxAdvanceX", _FT_GetFaceMaxAdvanceX); - -#ifdef SUPPORT_HARFBUZZ_SHAPER - NSV8Objects::Template_Set(result, "HB_LanguageFromString", _HB_LanguageFromString); - NSV8Objects::Template_Set(result, "HB_ShapeText", _HB_ShapeText); - NSV8Objects::Template_Set(result, "HB_FontMalloc", _HB_FontMalloc); - NSV8Objects::Template_Set(result, "HB_FontFree", _HB_FontFree); -#endif - - return handle_scope.Escape(result); - } - - void CreateNativeMeasurer(const v8::FunctionCallbackInfo& args) - { - CreateNativeInternalField(new CTextMeasurerEmbed(), CreateMeasurerTemplate, args); - } -} - -void CTextMeasurerEmbed::CreateObjectInContext(const std::string& name, JSSmart context) -{ - InsertToGlobal(name, context, NSMeasurer::CreateNativeMeasurer); -} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_TextMeasurerEmbed.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_TextMeasurerEmbed.cpp new file mode 100644 index 0000000000..a107afcc30 --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/v8/v8_TextMeasurerEmbed.cpp @@ -0,0 +1,90 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../TextMeasurerEmbed.h" +#include "../../js_internal/v8/v8_base.h" + +namespace NSTextMeasurerEmbed +{ +#define CURRENTWRAPPER CTextMeasurerEmbed + +#ifdef SUPPORT_HARFBUZZ_SHAPER + FUNCTION_WRAPPER_V8_1(_HB_LanguageFromString, HB_LanguageFromString) + FUNCTION_WRAPPER_V8_7(_HB_ShapeText, HB_ShapeText) + FUNCTION_WRAPPER_V8_0(_HB_FontMalloc, HB_FontMalloc) + FUNCTION_WRAPPER_V8_1(_HB_FontFree, HB_FontFree) +#endif + FUNCTION_WRAPPER_V8_1(_FT_Malloc, FT_Malloc) + FUNCTION_WRAPPER_V8_1(_FT_Free, FT_Free) + FUNCTION_WRAPPER_V8_0(_FT_Init, FT_Init) + FUNCTION_WRAPPER_V8_2(_FT_Set_TrueType_HintProp, FT_Set_TrueType_HintProp) + FUNCTION_WRAPPER_V8_4(_FT_Open_Face, FT_Open_Face) + FUNCTION_WRAPPER_V8_3(_FT_Open_Face2, FT_Open_Face2) + FUNCTION_WRAPPER_V8_1(_FT_GetFaceInfo, FT_GetFaceInfo) + FUNCTION_WRAPPER_V8_3(_FT_Load_Glyph, FT_Load_Glyph) + FUNCTION_WRAPPER_V8_2(_FT_Get_Glyph_Measure_Params, FT_Get_Glyph_Measure_Params) + FUNCTION_WRAPPER_V8_2(_FT_Get_Glyph_Render_Params, FT_Get_Glyph_Render_Params) + FUNCTION_WRAPPER_V8_2(_FT_Get_Glyph_Render_Buffer, FT_Get_Glyph_Render_Buffer) + FUNCTION_WRAPPER_V8_5(_FT_Set_Transform, FT_Set_Transform) + FUNCTION_WRAPPER_V8_5(_FT_Set_Char_Size, FT_Set_Char_Size) + FUNCTION_WRAPPER_V8_2(_FT_SetCMapForCharCode, FT_SetCMapForCharCode) + FUNCTION_WRAPPER_V8_3(_FT_GetKerningX, FT_GetKerningX) + FUNCTION_WRAPPER_V8_1(_FT_GetFaceMaxAdvanceX, FT_GetFaceMaxAdvanceX) + + v8::Handle CreateTemplate(v8::Isolate* isolate) + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + +#ifdef SUPPORT_HARFBUZZ_SHAPER + NSV8Objects::Template_Set(result, "HB_LanguageFromString", _HB_LanguageFromString); + NSV8Objects::Template_Set(result, "HB_ShapeText", _HB_ShapeText); + NSV8Objects::Template_Set(result, "HB_FontMalloc", _HB_FontMalloc); + NSV8Objects::Template_Set(result, "HB_FontFree", _HB_FontFree); +#endif + NSV8Objects::Template_Set(result, "FT_Malloc", _FT_Malloc); + NSV8Objects::Template_Set(result, "FT_Free", _FT_Free); + NSV8Objects::Template_Set(result, "FT_Init", _FT_Init); + NSV8Objects::Template_Set(result, "FT_Set_TrueType_HintProp", _FT_Set_TrueType_HintProp); + NSV8Objects::Template_Set(result, "FT_Open_Face", _FT_Open_Face); + NSV8Objects::Template_Set(result, "FT_Open_Face2", _FT_Open_Face2); + NSV8Objects::Template_Set(result, "FT_GetFaceInfo", _FT_GetFaceInfo); + NSV8Objects::Template_Set(result, "FT_Load_Glyph", _FT_Load_Glyph); + NSV8Objects::Template_Set(result, "FT_Get_Glyph_Measure_Params", _FT_Get_Glyph_Measure_Params); + NSV8Objects::Template_Set(result, "FT_Get_Glyph_Render_Params", _FT_Get_Glyph_Render_Params); + NSV8Objects::Template_Set(result, "FT_Get_Glyph_Render_Buffer", _FT_Get_Glyph_Render_Buffer); + NSV8Objects::Template_Set(result, "FT_Set_Transform", _FT_Set_Transform); + NSV8Objects::Template_Set(result, "FT_Set_Char_Size", _FT_Set_Char_Size); + NSV8Objects::Template_Set(result, "FT_SetCMapForCharCode", _FT_SetCMapForCharCode); + NSV8Objects::Template_Set(result, "FT_GetKerningX", _FT_GetKerningX); + NSV8Objects::Template_Set(result, "FT_GetFaceMaxAdvanceX", _FT_GetFaceMaxAdvanceX); + + return handle_scope.Escape(result); + } +} + +class CTextMeasurerEmbedAdapter : public CJSEmbedObjectAdapterV8Template +{ +public: + virtual v8::Local getTemplate(v8::Isolate* isolate) override + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local templ = NSTextMeasurerEmbed::CreateTemplate(isolate); + return handle_scope.Escape(templ); + } +}; + +CJSEmbedObjectAdapterBase* CTextMeasurerEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CTextMeasurerEmbedAdapter(); + return m_pAdapter; +} + +std::string CTextMeasurerEmbed::getName() { return "CTextMeasurerEmbed"; } + +CJSEmbedObject* CTextMeasurerEmbed::getCreator() +{ + return new CTextMeasurerEmbed(); +} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_Zip.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_Zip.cpp deleted file mode 100644 index 4355e070ae..0000000000 --- a/DesktopEditor/doctrenderer/embed/v8/v8_Zip.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "../ZipEmbed.h" -#include "../../js_internal/v8/v8_base.h" - -namespace NSZip -{ -#define CURRENTWRAPPER CZipEmbed - - FUNCTION_WRAPPER_V8_1(_open, open) - FUNCTION_WRAPPER_V8 (_create, create) - FUNCTION_WRAPPER_V8 (_save, save) - FUNCTION_WRAPPER_V8_1(_getFile, getFile) - FUNCTION_WRAPPER_V8_2(_addFile, addFile) - FUNCTION_WRAPPER_V8_1(_removeFile, removeFile) - FUNCTION_WRAPPER_V8 (_close, close) - FUNCTION_WRAPPER_V8 (_getPaths, getPaths) - - FUNCTION_WRAPPER_V8_2(_decodeImage, decodeImage) - FUNCTION_WRAPPER_V8_6(_encodeImageData, encodeImageData) - FUNCTION_WRAPPER_V8_2(_encodeImage, encodeImage) - FUNCTION_WRAPPER_V8_1(_getImageType, getImageType) - - v8::Handle CreateZipTemplate(v8::Isolate* isolate) - { - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local result = v8::ObjectTemplate::New(isolate); - result->SetInternalFieldCount(1); - - // методы - NSV8Objects::Template_Set(result, "open", _open); - NSV8Objects::Template_Set(result, "create", _create); - NSV8Objects::Template_Set(result, "save", _save); - NSV8Objects::Template_Set(result, "getFile", _getFile); - NSV8Objects::Template_Set(result, "addFile", _addFile); - NSV8Objects::Template_Set(result, "removeFile", _removeFile); - NSV8Objects::Template_Set(result, "close", _close); - NSV8Objects::Template_Set(result, "getPaths", _getPaths); - - NSV8Objects::Template_Set(result, "decodeImage", _decodeImage); - NSV8Objects::Template_Set(result, "encodeImageData", _encodeImageData); - NSV8Objects::Template_Set(result, "encodeImage", _encodeImage); - NSV8Objects::Template_Set(result, "getImageType", _getImageType); - - return handle_scope.Escape(result); - } - - void CreateNativeZip(const v8::FunctionCallbackInfo& args) - { - CreateNativeInternalField(new CZipEmbed(), NSZip::CreateZipTemplate, args); - } -} - -void CZipEmbed::CreateObjectInContext(const std::string& name, JSSmart context) -{ - InsertToGlobal(name, context, NSZip::CreateNativeZip); -} diff --git a/DesktopEditor/doctrenderer/embed/v8/v8_ZipEmbed.cpp b/DesktopEditor/doctrenderer/embed/v8/v8_ZipEmbed.cpp new file mode 100644 index 0000000000..7e6b00e67e --- /dev/null +++ b/DesktopEditor/doctrenderer/embed/v8/v8_ZipEmbed.cpp @@ -0,0 +1,70 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT WITH "--internal" OPTION. + +#include "../ZipEmbed.h" +#include "../../js_internal/v8/v8_base.h" + +namespace NSZipEmbed +{ +#define CURRENTWRAPPER CZipEmbed + + FUNCTION_WRAPPER_V8_1(_open, open) + FUNCTION_WRAPPER_V8_0(_create, create) + FUNCTION_WRAPPER_V8_0(_save, save) + FUNCTION_WRAPPER_V8_1(_getFile, getFile) + FUNCTION_WRAPPER_V8_2(_addFile, addFile) + FUNCTION_WRAPPER_V8_1(_removeFile, removeFile) + FUNCTION_WRAPPER_V8_0(_close, close) + FUNCTION_WRAPPER_V8_0(_getPaths, getPaths) + FUNCTION_WRAPPER_V8_2(_decodeImage, decodeImage) + FUNCTION_WRAPPER_V8_6(_encodeImageData, encodeImageData) + FUNCTION_WRAPPER_V8_2(_encodeImage, encodeImage) + FUNCTION_WRAPPER_V8_1(_getImageType, getImageType) + + v8::Handle CreateTemplate(v8::Isolate* isolate) + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + + NSV8Objects::Template_Set(result, "open", _open); + NSV8Objects::Template_Set(result, "create", _create); + NSV8Objects::Template_Set(result, "save", _save); + NSV8Objects::Template_Set(result, "getFile", _getFile); + NSV8Objects::Template_Set(result, "addFile", _addFile); + NSV8Objects::Template_Set(result, "removeFile", _removeFile); + NSV8Objects::Template_Set(result, "close", _close); + NSV8Objects::Template_Set(result, "getPaths", _getPaths); + NSV8Objects::Template_Set(result, "decodeImage", _decodeImage); + NSV8Objects::Template_Set(result, "encodeImageData", _encodeImageData); + NSV8Objects::Template_Set(result, "encodeImage", _encodeImage); + NSV8Objects::Template_Set(result, "getImageType", _getImageType); + + return handle_scope.Escape(result); + } +} + +class CZipEmbedAdapter : public CJSEmbedObjectAdapterV8Template +{ +public: + virtual v8::Local getTemplate(v8::Isolate* isolate) override + { + v8::EscapableHandleScope handle_scope(isolate); + v8::Local templ = NSZipEmbed::CreateTemplate(isolate); + return handle_scope.Escape(templ); + } +}; + +CJSEmbedObjectAdapterBase* CZipEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CZipEmbedAdapter(); + return m_pAdapter; +} + +std::string CZipEmbed::getName() { return "CZipEmbed"; } + +CJSEmbedObject* CZipEmbed::getCreator() +{ + return new CZipEmbed(); +} diff --git a/DesktopEditor/doctrenderer/js_internal/js_base.cpp b/DesktopEditor/doctrenderer/js_internal/js_base.cpp index 1f28ff90c6..4f275ae2d2 100644 --- a/DesktopEditor/doctrenderer/js_internal/js_base.cpp +++ b/DesktopEditor/doctrenderer/js_internal/js_base.cpp @@ -1,4 +1,5 @@ #include "js_base.h" +#include "js_base_p.h" namespace NSJSBase { @@ -10,11 +11,6 @@ namespace NSJSBase { { } - JSSmart CJSValue::toObjectSmart() - { - return toObject(); - } - CJSEmbedObjectPrivateBase::CJSEmbedObjectPrivateBase() { } @@ -23,19 +19,42 @@ namespace NSJSBase { { } + CJSEmbedObjectAdapterBase::CJSEmbedObjectAdapterBase() + { + } + + CJSEmbedObjectAdapterBase::~CJSEmbedObjectAdapterBase() + { + } + CJSEmbedObject::CJSEmbedObject() { - embed_native_internal = NULL; + embed_native_internal = nullptr; + m_pAdapter = nullptr; } CJSEmbedObject::~CJSEmbedObject() { RELEASEOBJECT(embed_native_internal); + RELEASEOBJECT(m_pAdapter); } void* CJSEmbedObject::getObject() { - return NULL; + return nullptr; + } + + CJSEmbedObjectAdapterBase* CJSEmbedObject::getAdapter() + { + return nullptr; + } + + void CJSContext::AddEmbedCreator(const std::string& name, + EmbedObjectCreator creator, + const bool& isAllowedInJS) + { + CEmbedObjectRegistrator& oRegistrator = CEmbedObjectRegistrator::getInstance(); + oRegistrator.Register(name, creator, isAllowedInJS); } CJSObject::CJSObject() @@ -46,6 +65,16 @@ namespace NSJSBase { { } + void CJSObject::set(const char* name, JSSmart value) + { + this->set(name, value.GetPointer()); + } + void CJSObject::set(const char* name, JSSmart obj) + { + JSSmart value = obj->toValue(); + this->set(name, value.GetPointer()); + } + CJSArray::CJSArray() { } @@ -123,6 +152,23 @@ namespace NSJSBase { return CJSContext::createNull(); } + JSSmart CJSContext::createEmbedObject(const std::string& name) + { + // Allow creation for embedded class in JS while in current scope + CEmbedObjectRegistrator& oRegistrator = CEmbedObjectRegistrator::getInstance(); + JSSmart oCreationScope = oRegistrator.AllowCreationInScope(name); + if (!oCreationScope.IsInit()) + return nullptr; + // Call CreateEmbedObject() from JS + JSSmart context = CJSContext::GetCurrent(); + JSSmart args[1]; + args[0] = CJSContext::createString(name); + JSSmart res = context->GetGlobal()->call_func("CreateEmbedObject", 1 , args); + if (!res->isObject()) + return nullptr; + return res->toObject(); + } + CJSContextScope::CJSContextScope(JSSmart context) : m_context(context) { m_context->Enter(); diff --git a/DesktopEditor/doctrenderer/js_internal/js_base.h b/DesktopEditor/doctrenderer/js_internal/js_base.h index 69fad763c2..319308308d 100644 --- a/DesktopEditor/doctrenderer/js_internal/js_base.h +++ b/DesktopEditor/doctrenderer/js_internal/js_base.h @@ -6,8 +6,10 @@ #include "../../../OOXML/Base/SmartPtr.h" #include "../../graphics/BaseThread.h" +#include + // disable export (ios/android problem (external embed objects)) -#define JSBASE_NO_USE_DYNAMIC_LIBRARY +//#define JSBASE_NO_USE_DYNAMIC_LIBRARY #ifdef JSBASE_NO_USE_DYNAMIC_LIBRARY #define JS_DECL @@ -33,41 +35,111 @@ namespace NSJSBase class CJSTypedArray; class CJSFunction; + /** + * The class represents a wrapper for primitive values and objects in JS. + * Objects of this class are used to interact with variables in JS contexts. + */ class JS_DECL CJSValue { public: CJSValue(); virtual ~CJSValue(); - + /** + * Returns true if the value is undefined. + */ virtual bool isUndefined() = 0; + /** + * Returns true if the value is null. + */ virtual bool isNull() = 0; + /** + * Returns true if the value is a boolean value. + */ virtual bool isBool() = 0; + /** + * Returns true if the value is a number. + */ virtual bool isNumber() = 0; + /** + * Returns true if the value is a string. + */ virtual bool isString() = 0; + /** + * Returns true if the value is an array. + */ virtual bool isArray() = 0; + /** + * Returns true if the value is a typed array. + */ virtual bool isTypedArray() = 0; + /** + * Returns true if the value is an object. + */ virtual bool isObject() = 0; + /** + * Returns true if the value is a function. + */ virtual bool isFunction() = 0; + /** + * Returns true if the value is empty. + */ virtual bool isEmpty() = 0; + /** + * Makes this value undefined. + */ virtual void doUndefined() = 0; + /** + * Makes this value null. + */ virtual void doNull() = 0; + /** + * Converts the value to a boolean value. + */ virtual bool toBool() = 0; + /** + * Converts the value to a 32-bit integer. + */ virtual int toInt32() = 0; + /** + * Converts the value to a 32-bit unsigned integer. + */ virtual unsigned int toUInt32() = 0; + /** + * Converts the value to a double value. + */ virtual double toDouble() = 0; + /** + * Converts the value to an ASCII string. + */ virtual std::string toStringA() = 0; + /** + * Converts the value to a wchar string. + */ virtual std::wstring toStringW() = 0; - virtual CJSObject* toObject() = 0; - virtual CJSArray* toArray() = 0; - virtual CJSTypedArray* toTypedArray() = 0; - virtual CJSFunction* toFunction() = 0; - - virtual JSSmart toObjectSmart(); + /** + * Converts the value to an object. + */ + virtual JSSmart toObject() = 0; + /** + * Converts the value to an array. + */ + virtual JSSmart toArray() = 0; + /** + * Converts the value to a typed array. + */ + virtual JSSmart toTypedArray() = 0; + /** + * Converts the value to a function. + */ + virtual JSSmart toFunction() = 0; }; + /** + * The base class for member of CJSEmbedObject class. + */ class JS_DECL CJSEmbedObjectPrivateBase { public: @@ -75,71 +147,201 @@ namespace NSJSBase virtual ~CJSEmbedObjectPrivateBase(); }; - class JS_DECL CJSEmbedObject + /** + * The base class for member of CJSEmbedObject class. + * Inheritors of this class implement engine-specific behaviour for embedding external C++ class in a JS context. + */ + class JS_DECL CJSEmbedObjectAdapterBase + { + public: + CJSEmbedObjectAdapterBase(); + virtual ~CJSEmbedObjectAdapterBase(); + }; + + /** + * The class that used for getting arguments of the function called in a JS context. + */ + class JS_DECL CJSFunctionArguments + { + public: + /** + * Returns number of the arguments. + */ + virtual int GetCount() = 0; + /** + * Returns a value of the argument by its index. + * @param index The index of an argument. + */ + virtual JSSmart Get(const int& index) = 0; + }; + + /** + * The base class that should be inherited by classes intended to be embedded in a JS context. + */ + class JS_DECL CJSEmbedObject { public: CJSEmbedObject(); virtual ~CJSEmbedObject(); public: + /** + * Returns a pointer to the member of the embedded class. + */ virtual void* getObject(); + /** + * Creates and returns an adapter for the embedded class (its implementation is generated). + */ + virtual CJSEmbedObjectAdapterBase* getAdapter(); protected: CJSEmbedObjectPrivateBase* embed_native_internal; + CJSEmbedObjectAdapterBase* m_pAdapter; friend class CJSEmbedObjectPrivateBase; friend class CJSEmbedObjectPrivate; }; + /** + * The class represents a wrapper for objects in JS. + */ class JS_DECL CJSObject : public CJSValue { public: CJSObject(); virtual ~CJSObject(); - virtual CJSValue* get(const char* name) = 0; + /** + * Returns specified property of the object. + * @param name The name of a property. + */ + virtual JSSmart get(const char* name) = 0; + /** + * Sets a property of the object. + * @param name The name of a property. + * @param value The value of a property. + */ virtual void set(const char* name, CJSValue* value) = 0; - virtual void set(const char* name, const int& value) = 0; virtual void set(const char* name, const double& value) = 0; + // Common funcs + void set(const char* name, JSSmart value); + void set(const char* name, JSSmart value); + /** + * Returns a pointer to the native embedded object. + */ virtual CJSEmbedObject* getNative() = 0; - + /** + * Calls a function of the object. + * @param name The name of a function to call. + * @param argc Number of arguments. + * @param argv The array of arguments. + * @return The value returned by function. + */ virtual JSSmart call_func(const char* name, const int argc = 0, JSSmart argv[] = NULL) = 0; + /** + * Converts the object to a value. + */ virtual JSSmart toValue() = 0; }; + /** + * The class represents a wrapper for arrays in JS. + */ class JS_DECL CJSArray : public CJSValue { public: CJSArray(); virtual ~CJSArray(); + /** + * Returns the number of elements. + */ virtual int getCount() = 0; + /** + * Returns an array value by its index. + * @param index The index of the array value. + */ virtual JSSmart get(const int& index) = 0; + /** + * Sets an array value by its index. + * @param index The index of the array value. + * @param value The array value to be set. + */ virtual void set(const int& index, CJSValue* value) = 0; virtual void set(const int& index, const bool& value) = 0; virtual void set(const int& index, const int& value) = 0; virtual void set(const int& index, const double& value) = 0; + /** + * Add the specified value to the array. + * @param value The value to be added. + */ virtual void add(CJSValue* value) = 0; + /** + * Add null to the array. + */ virtual void add_null() = 0; + /** + * Add undefined to the array. + */ virtual void add_undefined() = 0; + /** + * Add a boolean value to the array. + * @param value The boolean value to be added. + */ virtual void add_bool(const bool& value) = 0; + /** + * Add a byte of data to the array. + * @param value The byte to be added. + */ virtual void add_byte(const BYTE& value) = 0; + /** + * Add an integer value to the array. + * @param value The integer value to be added. + */ virtual void add_int(const int& value) = 0; + /** + * Add a double value to the array. + * @param value The double value to be added. + */ virtual void add_double(const double& value) = 0; + /** + * Add an ASCII string to the array. + * @param value The string to be added. + */ virtual void add_stringa(const std::string& value) = 0; + /** + * Add a wchar string to the array. + * @param value The wstring to be added. + */ virtual void add_string(const std::wstring& value) = 0; + /** + * Converts the array to a value. + */ virtual JSSmart toValue() = 0; }; namespace NSAllocator { - unsigned char* Alloc(const size_t& size); - void Free(unsigned char* data, const size_t& size); + /** + * Engine-specific memory allocator. + * @param size The size of allocated memory in bytes. + * @return Pointer to the allocated memory. Returns nullptr if allocation was not successful. + */ + JS_DECL unsigned char* Alloc(const size_t& size); + /** + * Engine-specific memory deallocator. + * @param data Pointer to the previously allocated with Alloc() memory. + * @param size The size of allocated memory. + */ + JS_DECL void Free(unsigned char* data, const size_t& size); } + /** + * The class that stores raw chunks of binary data. + */ class JS_DECL CJSDataBuffer { public: @@ -149,39 +351,80 @@ namespace NSJSBase bool IsExternalize; public: - BYTE* Copy(); CJSDataBuffer(); + + /** + * Returns a pointer to the new allocated memory that contains a copy of the binary data. + */ + BYTE* Copy(); + /** + * Frees the memory for the binary data. + */ void Free(); }; + /** + * The class represents a wrapper for typed arrays in JS. + */ class JS_DECL CJSTypedArray : public CJSValue { public: CJSTypedArray(BYTE* data = NULL, int count = 0); virtual ~CJSTypedArray(); + /** + * Returns the length of the typed array in bytes. + */ virtual int getCount() = 0; + /** + * Returns the binary data stored in the typed array. + */ virtual CJSDataBuffer getData() = 0; + /** + * Converts the typed array to a value. + */ virtual JSSmart toValue() = 0; }; + /** + * The class represents a wrapper for functions in JS. + */ class JS_DECL CJSFunction : public CJSValue { public: CJSFunction(); virtual ~CJSFunction(); - virtual CJSValue* Call(CJSValue* recv, int argc, JSSmart argv[]) = 0; + /** + * Calls the function. + * @param recv The reciever of the function call. + * @param argc Number of arguments. + * @param argv The array of arguments. + * @return The value returned by the function. + */ + virtual JSSmart Call(CJSValue* recv, int argc, JSSmart argv[]) = 0; }; + /** + * The class for tracking exceptions during code execution in JS contexts. + */ class JS_DECL CJSTryCatch { public: CJSTryCatch(); virtual ~CJSTryCatch(); + + /** + * Returns true if exception was caught and print some info about it to stdout. + */ virtual bool Check() = 0; }; + using EmbedObjectCreator = CJSEmbedObject* (*)(); + + /** + * The class for getting JS context instance for working with it. + */ class CJSContextPrivate; class JS_DECL CJSContext { @@ -192,51 +435,195 @@ namespace NSJSBase CJSContext(const bool& bIsInitialize = true); ~CJSContext(); + /** + * Initializes the JS context. + * By default it happens automatically when creating a CJSConext instance. + */ void Initialize(); + /** + * Releases any resources taken by the JS context. + * Generally there is no need to call it manually, cause this method called when CJSConext is being destructed. + */ void Dispose(); - CJSTryCatch* GetExceptions(); + /** + * Creates and returns the pointer to an object for tracking exceptions during code execution in current JS context. + */ + JSSmart GetExceptions(); + /** + * Creates and returns the pointer to a global object for this JS context. + */ + JSSmart GetGlobal(); - void CreateContext(); - CJSObject* GetGlobal(); - - // Use this methods before working with needed context if you want to work with multiple contexts simultaneously (or use CJSContextScope) + /** + * Enters the JS context and makes it the active context for further work. + * This method is called in the constructor of CJSContextScope class. + */ void Enter(); + /** + * Exits the JS context, which restores the context that was in place when entering the current context. + * This method is called in the destructor of CJSContextScope class. + */ void Exit(); + /** + * Embeds specified class in JS contexts. + * @tparam T Embedded class name. + * @param isAllowedInJS If true, user can create the embedded object instance from JS code using CreateEmbedObject(). + * If this parameter is false, then user can do so only using JSContext::createEmbedObject(). + */ + template + static void Embed(const bool& isAllowedInJS = true) + { + AddEmbedCreator(T::getName(), T::getCreator, isAllowedInJS); + } + + /** + * Run the script in the current JS context. + * @param script The script to be executed. + * @param exception The object for handling exceptions. + * @param scriptPath The path to the script, where cache files will be created for further usage. + * If scriptPath is not specified, cache is not used. + * @return The value returned from JS context after script execution. + */ JSSmart runScript(const std::string& script, JSSmart exception = NULL, const std::wstring& scriptPath = std::wstring(L"")); - CJSValue* JSON_Parse(const char* json_content); + /** + * Parses the JSON string and convert it to corresponding JS value. + * @param json_content The JSON string to be parsed. + * @return The pointer to resulted JS value after parsing. + */ + JSSmart JSON_Parse(const char* json_content); + /** + * Do not use this function. It is for internal needs. + * Associates current context with the specifed thread id. + * @param id The id of a thread. + */ void MoveToThread(ASC_THREAD_ID* id = NULL); + /** + * Do not use this function manually. It is called from CJSContext::Embed method. + * Adds a creator object for corresponding embedded class name. + * @param name The name of an embedded class. + * @param creator The creator function for an embedded class. + * @param isAllowedInJS Specifies whether user can create the embedded object from JS code or not. + */ + static void AddEmbedCreator(const std::string& name, EmbedObjectCreator creator, const bool& isAllowedInJS = true); + + // NOTE: All raw pointers obtained from the following functions, should be deleted by caller. public: + /** + * Creates and returns undefined JS value in current context. + */ static CJSValue* createUndefined(); + /** + * Creates and returns null JS value in current context. + */ static CJSValue* createNull(); + /** + * Creates and returns a boolean JS value in current context. + * @param value The boolean value. + */ static CJSValue* createBool(const bool& value); + /** + * Creates and returns an integer JS value in current context. + * @param value The integer value. + */ static CJSValue* createInt(const int& value); + /** + * Creates and returns an unsigned integer JS value in current context. + * @param value The unsigned integer value. + */ static CJSValue* createUInt(const unsigned int& value); + /** + * Creates and returns a double JS value in current context. + * @param value The double value. + */ static CJSValue* createDouble(const double& value); + /** + * Creates and returns a JS string in current context. + * @param value The pointer to a null terminated char array. + * @param length The length of a created string. By default the whole string will be created. + */ static CJSValue* createString(const char* value, const int& length = -1); + /** + * Creates and returns a JS string in current context. + * @param value The pointer to a null terminated wchar_t array. + * @param length The length of a created string. By default the whole string will be created. + */ static CJSValue* createString(const wchar_t* value, const int& length = -1); + /** + * Creates and returns a JS string in current context. + * @param value The ASCII string. + */ static CJSValue* createString(const std::string& value); + /** + * Creates and returns a JS string in current context. + * @param value The wchar string. + */ static CJSValue* createString(const std::wstring& value); + /** + * Creates and returns an empty JS object in current context. + */ static CJSObject* createObject(); + /** + * Creates and returns a JS array of specified length in current context. + * @param count The length of an array. + */ static CJSArray* createArray(const int& count); + /** + * Creates and returns a JS typed array in current context. + * @param data The pointer to binary data. + * @param count The length of an array in bytes. + * @param isExternalize If true the memory block will not be reclaimed when the created JS array is destroyed. + * If this parameter is false then the memory block will be released using NSAllocator::Free function when the JS typed array is destroyed. + */ static CJSTypedArray* createUint8Array(BYTE* data = NULL, int count = 0, const bool& isExternalize = true); + /** + * Creates and returns a JS typed array in current context from the specified binary file. + * @param sFilePath The path to a binary file. + * @return The JS typed array as JS value. Or null value if the binary file was not found. + */ static CJSValue* createUint8Array(const std::wstring& sFilePath); + /** + * Creates and returns a JS object, which is a wrapper around specified embedded class. + * @param name The name of an embedded class. + */ + static JSSmart createEmbedObject(const std::string& name); + public: + /** + * Returns a copy of the last entered JS context. + * Do not use Enter, Exit or any scope-changing operations on this object. + * If you need so, use original CJSContext instance for this purposes. + */ static JSSmart GetCurrent(); public: + /** + * Sets directory for external initialization. + * @param sDirectory The directory path. + */ static void ExternalInitialize(const std::wstring& sDirectory); + /** + * Externally reclaim any resources for all JS contexts. + */ static void ExternalDispose(); + /** + * Returns true if typed arrays are supported natively on current platform. + */ static bool IsSupportNativeTypedArrays(); }; + + /** + * The class that sets a new scope for any local variables created after its construction. + * In the destructor of the class this scope and all local variables created in it will be removed. + */ class CJSLocalScopePrivate; class JS_DECL CJSLocalScope { @@ -248,7 +635,11 @@ namespace NSJSBase ~CJSLocalScope(); }; - class JS_DECL CJSContextScope + /** + * The class that sets execution context for further work. + * This class can be used instead of Enter() and Exit() methods, cause it calls them on its creation and destruction, respectively. + */ + class JS_DECL CJSContextScope { public: JSSmart m_context; @@ -259,4 +650,30 @@ namespace NSJSBase }; } +// Macro for embedding +#define DECLARE_EMBED_METHODS \ + static std::string getName(); \ + static CJSEmbedObject* getCreator(); \ + virtual CJSEmbedObjectAdapterBase* getAdapter() override; + +/** + * If you want to embed your external C++ class in a JS context then do the following: + * + * 1. Make sure that your class is inherit CJSEmbedObject class. + * 2. Override `getObject()` method and write its implementation if needed. + * 3. Use macro `DECLARE_EMBED_METHODS` in the `public` section of your class declaration. + * 4. Include "doctrenderer/js_internal/js_base_embed.pri" in your .pro file. + * 5. Add a line `ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(YourClassHeader.h)` to your .pro file. + * 6. Run the script "doctrenderer/embed/embed.py" with the name of your class header as an argument for generating some necessary files for embedding. + * If you're going to embed a class for doctrenderer library, then also specify `--internal` (or just `-i`) option. + * 7. In C++ code call `CJSContext::Embed()`. + * + * Then you can call `CreateEmbedOjbect('YourClassName')` in JS code or `CJSContext::createEmbedObject('YourClassName')` in C++ code + * to get a JS object-wrapper for the embedded class. + * + * NOTE: If you don't want to export certain functions from your embedded class for some reason, + * then add the inline comment "[noexport]" at the start of a function declaration. + * Also you can use `#ifdef ... #endif` blocks (see doctrenderer/test/internal/Embed.h for an example). + */ + #endif // _CORE_EXT_JS_BASE_H_ diff --git a/DesktopEditor/doctrenderer/js_internal/js_base.pri b/DesktopEditor/doctrenderer/js_internal/js_base.pri index 856947dac8..467d6e433a 100644 --- a/DesktopEditor/doctrenderer/js_internal/js_base.pri +++ b/DesktopEditor/doctrenderer/js_internal/js_base.pri @@ -1,15 +1,13 @@ -core_mac { - !use_v8:CONFIG += use_javascript_core -} -core_ios { - CONFIG += use_javascript_core -} +include($$PWD/js_base_embed.pri) -INCLUDEPATH += $$PWD +HEADERS += \ + $$PWD/js_base.h \ + $$PWD/js_embed.h -HEADERS += $$PWD/js_base.h SOURCES += $$PWD/js_base.cpp +HEADERS += $$PWD/js_base_p.h + HEADERS += $$PWD/js_logger.h SOURCES += $$PWD/js_logger.cpp @@ -78,13 +76,6 @@ SOURCES += $$PWD/js_logger.cpp } use_javascript_core { - HEADERS += $$PWD/jsc/jsc_base.h OBJECTIVE_SOURCES += $$PWD/jsc/jsc_base.mm - QMAKE_OBJECTIVE_CFLAGS += -fobjc-arc -fobjc-weak - - LIBS += -framework JavaScriptCore - - DEFINES += JS_ENGINE_JAVASCRIPTCORE - } diff --git a/DesktopEditor/doctrenderer/js_internal/js_base_embed.pri b/DesktopEditor/doctrenderer/js_internal/js_base_embed.pri new file mode 100644 index 0000000000..543c10899f --- /dev/null +++ b/DesktopEditor/doctrenderer/js_internal/js_base_embed.pri @@ -0,0 +1,32 @@ +core_mac { + !use_v8:CONFIG += use_javascript_core +} +core_ios { + CONFIG += use_javascript_core +} + +INCLUDEPATH += $$PWD + +use_javascript_core { + QMAKE_OBJECTIVE_CFLAGS += -fobjc-arc -fobjc-weak + + LIBS += -framework Foundation + LIBS += -framework JavaScriptCore + + DEFINES += JS_ENGINE_JAVASCRIPTCORE +} + +defineTest(ADD_FILES_FOR_EMBEDDED_CLASS_HEADER) { + header_path = $$absolute_path($$ARGS) + header_basename = $$basename(ARGS) + header_dir = $$dirname(header_path) + header_name_splitted = $$split(header_basename, .) + header_basename_no_extension = $$first(header_name_splitted) + use_javascript_core { + OBJECTIVE_SOURCES += $$header_dir/$$join(header_basename_no_extension,, jsc/jsc_, .mm) + } else { + SOURCES += $$header_dir/$$join(header_basename_no_extension,, v8/v8_, .cpp) + } + export(SOURCES) + export(OBJECTIVE_SOURCES) +} diff --git a/DesktopEditor/doctrenderer/js_internal/js_base_p.h b/DesktopEditor/doctrenderer/js_internal/js_base_p.h new file mode 100644 index 0000000000..ada6e50674 --- /dev/null +++ b/DesktopEditor/doctrenderer/js_internal/js_base_p.h @@ -0,0 +1,76 @@ +#ifndef _CORE_EXT_JS_BASE_P_H_ +#define _CORE_EXT_JS_BASE_P_H_ + +#include "./js_base.h" +#include +#include + +class CEmbedObjectRegistrator +{ +public: + class CEmdedClassInfo + { + public: + NSJSBase::EmbedObjectCreator m_creator; + bool m_bIsCreationAllowed; + + CEmdedClassInfo(NSJSBase::EmbedObjectCreator creator, const bool& bIsCreationAllowed = true) + { + m_creator = creator; + m_bIsCreationAllowed = bIsCreationAllowed; + } + }; + + using store_t = std::map; + + class CAllowedCreationScope + { + private: + store_t::iterator m_oIter; + bool m_bPrev; + std::lock_guard m_guard; + + public: + CAllowedCreationScope(const store_t::iterator& iter) : m_oIter(iter), m_guard(getInstance().m_mutex) + { + m_bPrev = m_oIter->second.m_bIsCreationAllowed; + m_oIter->second.m_bIsCreationAllowed = true; + } + + ~CAllowedCreationScope() + { + m_oIter->second.m_bIsCreationAllowed = m_bPrev; + } + }; + +public: + store_t m_infos; + std::mutex m_mutex; + +private: + CEmbedObjectRegistrator() = default; + +public: + void Register(const std::string& name, + NSJSBase::EmbedObjectCreator creator, + const bool& bIsCreationAllowed = true) + { + m_infos.insert(std::pair(name, CEmdedClassInfo(creator, bIsCreationAllowed))); + } + + CAllowedCreationScope* AllowCreationInScope(const std::string& name) + { + store_t::iterator iter = m_infos.find(name); + if (iter == m_infos.end()) + return nullptr; + return new CAllowedCreationScope(iter); + } + + static CEmbedObjectRegistrator& getInstance() + { + static CEmbedObjectRegistrator oRegistrator; + return oRegistrator; + } +}; + +#endif // _CORE_EXT_JS_BASE_P_H_ diff --git a/DesktopEditor/doctrenderer/js_internal/js_embed.h b/DesktopEditor/doctrenderer/js_internal/js_embed.h new file mode 100644 index 0000000000..d763ee522c --- /dev/null +++ b/DesktopEditor/doctrenderer/js_internal/js_embed.h @@ -0,0 +1,90 @@ +#ifndef _BUILD_NATIVE_CONTROL_JS_EMBED_H_ +#define _BUILD_NATIVE_CONTROL_JS_EMBED_H_ + +#include "./js_base.h" + +#ifdef JS_ENGINE_JAVASCRIPTCORE + +#import +#import + +@protocol JSEmbedObjectProtocol +-(void*) getNative; +@end + +#if __has_feature(objc_arc) +#define SUPER_DEALLOC +#else +#define SUPER_DEALLOC [super dealloc] +#endif + +#define EMBED_OBJECT_WRAPPER_METHODS(CLASS) \ +-(id) init \ +{ \ + self = [super init]; \ + if (self) \ + m_internal = new CLASS; \ + return self; \ +} \ +-(id) init : (CLASS*)pNativeObj \ +{ \ + self = [super init]; \ + if (self) \ + m_internal = pNativeObj; \ + return self; \ +} \ +-(void) dealloc \ +{ \ + RELEASEOBJECT(m_internal); \ + SUPER_DEALLOC; \ +} \ +-(void*) getNative \ +{ \ + return m_internal; \ +} + +namespace NSJSBase +{ + class JS_DECL CJSEmbedObjectAdapterJSC : public CJSEmbedObjectAdapterBase + { + public: + CJSEmbedObjectAdapterJSC() = default; + virtual ~CJSEmbedObjectAdapterJSC() = default; + + virtual id getExportedObject(CJSEmbedObject* pNative) = 0; + + static JSSmart Native2Value(JSValue* value); + static JSValue* Value2Native(JSSmart value); + }; +} + +#else + +namespace NSJSBase +{ + class JS_DECL CJSEmbedObjectAdapterV8 : public CJSEmbedObjectAdapterBase + { + public: + using EmbedFunctionType = std::function(CJSFunctionArguments*)>; + + public: + CJSEmbedObjectAdapterV8() = default; + virtual ~CJSEmbedObjectAdapterV8() = default; + + virtual std::vector getMethodNames() = 0; + virtual void initFunctions(CJSEmbedObject* pNativeObjBase) = 0; + + public: + JSSmart Call(const int& index, CJSFunctionArguments* args) + { + return m_functions[index](args); + } + + protected: + std::vector m_functions; + }; +} + +#endif + +#endif // _BUILD_NATIVE_CONTROL_JS_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.h b/DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.h index 5d2a0b64d1..1a82a4e0b1 100644 --- a/DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.h +++ b/DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.h @@ -1,20 +1,15 @@ #ifndef _BUILD_NATIVE_CONTROL_JSC_BASE_H_ #define _BUILD_NATIVE_CONTROL_JSC_BASE_H_ -#include "../js_base.h" +#include "../js_embed.h" +#include "../js_base_p.h" -#import -#import #include #include #import "../../../../DesktopEditor/common/Mac/NSString+StringUtils.h" #include -@protocol JSEmbedObjectProtocol -- (void*) getNative; -@end - namespace NSJSBase { class CJSContextPrivate @@ -36,6 +31,9 @@ namespace NSJSBase static JSContext* GetCurrentContext(); static bool IsOldVersion(); }; + + // embed + id CreateEmbedNativeObject(NSString* name); } namespace NSJSBase @@ -82,10 +80,10 @@ namespace NSJSBase virtual std::string toStringA(); virtual std::wstring toStringW(); - virtual CJSObject* toObject(); - virtual CJSArray* toArray(); - virtual CJSTypedArray* toTypedArray(); - virtual CJSFunction* toFunction(); + virtual JSSmart toObject(); + virtual JSSmart toArray(); + virtual JSSmart toTypedArray(); + virtual JSSmart toFunction(); JSContext* getContext() { @@ -112,7 +110,7 @@ namespace NSJSBase value = nil; } - virtual CJSValue* get(const char* name) + virtual JSSmart get(const char* name) { CJSValueJSC* _value = new CJSValueJSC(); _value->value = [value valueForProperty:[[NSString alloc] initWithUTF8String:name]]; @@ -394,7 +392,7 @@ namespace NSJSBase value = nil; } - virtual CJSValue* Call(CJSValue* recv, int argc, JSSmart argv[]) + virtual JSSmart Call(CJSValue* recv, int argc, JSSmart argv[]) { NSMutableArray* arr = [[NSMutableArray alloc] init]; for (int i = 0; i < argc; ++i) @@ -411,7 +409,7 @@ namespace NSJSBase }; template - CJSObject* CJSValueJSCTemplate::toObject() + JSSmart CJSValueJSCTemplate::toObject() { CJSObjectJSC* _value = new CJSObjectJSC(); _value->value = value; @@ -419,7 +417,7 @@ namespace NSJSBase } template - CJSArray* CJSValueJSCTemplate::toArray() + JSSmart CJSValueJSCTemplate::toArray() { CJSArrayJSC* _value = new CJSArrayJSC(); _value->value = value; @@ -427,7 +425,7 @@ namespace NSJSBase } template - CJSTypedArray* CJSValueJSCTemplate::toTypedArray() + JSSmart CJSValueJSCTemplate::toTypedArray() { CJSTypedArrayJSC* _value = new CJSTypedArrayJSC(getContext()); _value->value = value; @@ -435,7 +433,7 @@ namespace NSJSBase } template - CJSFunction* CJSValueJSCTemplate::toFunction() + JSSmart CJSValueJSCTemplate::toFunction() { CJSFunctionJSC* _value = new CJSFunctionJSC(); _value->value = value; @@ -482,12 +480,14 @@ inline JSValue* js_return(JSSmart _value) return _tmp->value; } -#define FUNCTION_WRAPPER_JS(NAME, NAME_EMBED) \ +#define FUNCTION_WRAPPER_JS_0(NAME, NAME_EMBED) \ -(JSValue*) NAME \ { \ return js_return(m_internal->NAME_EMBED()); \ } +#define FUNCTION_WRAPPER_JS(NAME, NAME_EMBED) FUNCTION_WRAPPER_JS_0(NAME, NAME_EMBED) + #define FUNCTION_WRAPPER_JS_1(NAME, NAME_EMBED) \ -(JSValue*) NAME:(JSValue*)p1 \ { \ @@ -529,41 +529,4 @@ inline JSValue* js_return(JSSmart _value) return js_return(m_internal->NAME_EMBED(js_value(p1), js_value(p2), js_value(p3), js_value(p4), js_value(p5), js_value(p6), js_value(p7), js_value(p8))); \ } -#if __has_feature(objc_arc) -#define EMBED_OBJECT_WRAPPER_METHODS(CLASS) \ --(id) init \ -{ \ - self = [super init]; \ - if (self) \ - m_internal = new CLASS(); \ - return self; \ -} \ --(void) dealloc \ -{ \ - RELEASEOBJECT(m_internal); \ -} \ -- (void*) getNative \ -{ \ - return m_internal; \ -} -#else -#define EMBED_OBJECT_WRAPPER_METHODS(CLASS) \ --(id) init \ -{ \ - self = [super init]; \ - if (self) \ - m_internal = new CLASS(); \ - return self; \ -} \ --(void) dealloc \ -{ \ - RELEASEOBJECT(m_internal); \ - [super dealloc]; \ -} \ -- (void*) getNative \ -{ \ - return m_internal; \ -} -#endif - #endif // _BUILD_NATIVE_CONTROL_JSC_BASE_H_ diff --git a/DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.mm b/DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.mm index d7803517f4..504aec74bf 100644 --- a/DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.mm +++ b/DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.mm @@ -209,7 +209,7 @@ namespace NSJSBase RELEASEOBJECT(m_internal); } - CJSTryCatch* CJSContext::GetExceptions() + JSSmart CJSContext::GetExceptions() { return new CJSCTryCatch(); } @@ -224,6 +224,10 @@ namespace NSJSBase { [m_internal->context evaluateScript:@"function jsc_toBase64(r){for(var o=[\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\",\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\",\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"+\",\"/\"],a=r.length,f=4*(a/3>>0),n=f/76>>0,t=19,v=0,e=[],i=\"\",s=0;s<=n;s++){s==n&&(t=f%76/4>>0);for(var u=0;u>>26&255],c<<=6,c&=4294967295}e.push(i)}}if(n=a%3!=0?a%3+1:0){for(c=0,h=0;h<3;h++)h>>26&255],c<<=6}t=0!=n?4-n:0;for(u=0;u>>3,c=0;c>>16,s<<=8}return t}\n"]; } + // insert CreateEmbedObject() function to global object of this context + m_internal->context[@"CreateEmbedObject"] = ^(NSString* name) { + return CreateEmbedNativeObject(name); + }; JSValue* global_js = [m_internal->context globalObject]; [global_js setValue:global_js forProperty:[[NSString alloc] initWithUTF8String:"window"]]; @@ -237,12 +241,7 @@ namespace NSJSBase m_internal->context = nil; } - void CJSContext::CreateContext() - { - // NONE - } - - CJSObject* CJSContext::GetGlobal() + JSSmart CJSContext::GetGlobal() { CJSObjectJSC* ret = new CJSObjectJSC(); ret->value = [m_internal->context globalObject]; @@ -373,7 +372,7 @@ namespace NSJSBase return (CJSContextPrivate::IsOldVersion() == false) ? true : false; } - CJSValue* CJSContext::JSON_Parse(const char *sTmp) + JSSmart CJSContext::JSON_Parse(const char *sTmp) { if (!sTmp) return CJSContext::createUndefined(); @@ -438,3 +437,37 @@ namespace NSJSBase return true; } } + +// embed +namespace NSJSBase +{ + id CreateEmbedNativeObject(NSString* name) + { + std::string sName = [name stdstring]; + CEmbedObjectRegistrator& oRegistrator = CEmbedObjectRegistrator::getInstance(); + CEmbedObjectRegistrator::store_t::iterator itFound = oRegistrator.m_infos.find(sName); + if (itFound == oRegistrator.m_infos.end()) + return nil; + + const CEmbedObjectRegistrator::CEmdedClassInfo& oInfo = itFound->second; + + if (oInfo.m_bIsCreationAllowed == false) + return nil; + + CJSEmbedObject* pNativeObj = oInfo.m_creator(); + CJSEmbedObjectAdapterJSC* pAdapter = static_cast(pNativeObj->getAdapter()); + id pEmbedObj = pAdapter->getExportedObject(pNativeObj); + + return pEmbedObj; + } + + JSSmart CJSEmbedObjectAdapterJSC::Native2Value(JSValue* value) + { + return js_value(value); + } + + JSValue* CJSEmbedObjectAdapterJSC::Value2Native(JSSmart value) + { + return js_return(value); + } +} diff --git a/DesktopEditor/doctrenderer/js_internal/v8/inspector/main.cpp b/DesktopEditor/doctrenderer/js_internal/v8/inspector/main.cpp index 2739f89217..4f7307e055 100644 --- a/DesktopEditor/doctrenderer/js_internal/v8/inspector/main.cpp +++ b/DesktopEditor/doctrenderer/js_internal/v8/inspector/main.cpp @@ -19,11 +19,7 @@ using namespace NSJSBase; int main() { JSSmart pContext1 = new CJSContext(); - pContext1->CreateContext(); - - JSSmart pContext2 = new CJSContext(); - pContext2->CreateContext(); { CJSContextScope oScope(pContext1); diff --git a/DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp b/DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp index a0eb6284f6..06bbc06717 100644 --- a/DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp +++ b/DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp @@ -179,17 +179,15 @@ namespace NSJSBase if (bIsInitialize) Initialize(); } + CJSContext::~CJSContext() { - if (m_internal->m_contextPersistent.IsEmpty()) - return; - - if (m_internal->m_isolate) + if (m_internal->m_isolate && !m_internal->m_contextPersistent.IsEmpty()) Dispose(); RELEASEOBJECT(m_internal); } - CJSTryCatch* CJSContext::GetExceptions() + JSSmart CJSContext::GetExceptions() { return new CV8TryCatch(); } @@ -198,10 +196,19 @@ namespace NSJSBase { if (m_internal->m_isolate == NULL) { + // get new isolate v8::Isolate* isolate = CV8Worker::getInitializer().CreateNew(); m_internal->m_isolate = isolate; + // get new context v8::Isolate::Scope iscope(isolate); v8::HandleScope scope(isolate); + m_internal->m_contextPersistent.Reset(isolate, v8::Context::New(isolate)); + // create temporary local handle to context + m_internal->m_context = v8::Local::New(isolate, m_internal->m_contextPersistent); + // insert CreateEmbedObject() function to global object of this context + m_internal->InsertToGlobal("CreateEmbedObject", CreateEmbedNativeObject); + // clear temporary local handle + m_internal->m_context.Clear(); } } void CJSContext::Dispose() @@ -212,31 +219,11 @@ namespace NSJSBase #endif m_internal->m_contextPersistent.Reset(); - - unsigned int nEmbedDataCount = m_internal->m_isolate->GetNumberOfDataSlots(); - if (nEmbedDataCount > 0) - { - void* pSingletonData = m_internal->m_isolate->GetData(0); - if (NULL != pSingletonData) - { - CIsolateAdditionalData* pData = (CIsolateAdditionalData*)pSingletonData; - delete pData; - } - } - m_internal->m_isolate->Dispose(); m_internal->m_isolate = NULL; } - void CJSContext::CreateContext() - { - v8::Isolate* isolate = m_internal->m_isolate; - v8::Isolate::Scope iscope(isolate); - v8::HandleScope scope(isolate); - m_internal->m_contextPersistent.Reset(isolate, v8::Context::New(isolate)); - } - - CJSObject* CJSContext::GetGlobal() + JSSmart CJSContext::GetGlobal() { CJSObjectV8* ret = new CJSObjectV8(); ret->value = m_internal->m_context->Global(); @@ -410,14 +397,13 @@ namespace NSJSBase JSSmart CJSContext::GetCurrent() { - CJSContext* ret = new CJSContext(); + CJSContext* ret = new CJSContext(false); ret->m_internal->m_isolate = CV8Worker::GetCurrent(); ret->m_internal->m_context = ret->m_internal->m_isolate->GetCurrentContext(); - // global??? return ret; } - CJSValue* CJSContext::JSON_Parse(const char *sTmp) + JSSmart CJSContext::JSON_Parse(const char *sTmp) { CJSValueV8* _value = new CJSValueV8(); #ifndef V8_OS_XP @@ -459,3 +445,114 @@ namespace NSJSBase CV8Worker::getInitializer().getAllocator()->Free(data, size); } } + +// embed +namespace NSJSBase +{ + class CJSFunctionArgumentsV8 : public CJSFunctionArguments + { + const v8::FunctionCallbackInfo* m_args; + int m_count; + // TODO: do we actually need it? + int m_skip_count; + public: + CJSFunctionArgumentsV8(const v8::FunctionCallbackInfo* args, const bool skip_count = 1) + { + m_args = args; + m_skip_count = skip_count; + m_count = m_args->Length() - m_skip_count; + } + public: + virtual int GetCount() override + { + return m_count; + } + virtual JSSmart Get(const int& index) override + { + if (index < m_count) + return js_value(m_args->operator[](index + m_skip_count)); + return js_value(v8::Undefined(m_args->GetIsolate())); + } + }; + + // this function is called when method from embedded object is called + void _Call(const v8::FunctionCallbackInfo& args) + { + CJSEmbedObject* _this = (CJSEmbedObject*)unwrap_native(args.Holder()); + CJSFunctionArgumentsV8 _args(&args, 0); + JSSmart funcIndex = js_value(args.Data()); + CJSEmbedObjectAdapterV8* _adapter = static_cast(_this->getAdapter()); + JSSmart ret = _adapter->Call(funcIndex->toInt32(), &_args); + js_return(args, ret); + } + + v8::Handle CreateEmbedObjectTemplate(v8::Isolate* isolate, CJSEmbedObject* pNativeObj) + { + v8::EscapableHandleScope handle_scope(isolate); + CJSEmbedObjectAdapterV8* pAdapter = static_cast(pNativeObj->getAdapter()); + + v8::Local result = v8::ObjectTemplate::New(isolate); + result->SetInternalFieldCount(1); + + pAdapter->initFunctions(pNativeObj); + std::vector arNames = pAdapter->getMethodNames(); + for (int i = 0, len = arNames.size(); i < len; ++i) + { + // associate all methods with corresponding Call() index + result->Set(CreateV8String(isolate, arNames[i].c_str()), v8::FunctionTemplate::New(isolate, _Call, v8::Integer::New(isolate, i))); + } + + return handle_scope.Escape(result); + } + + void CreateEmbedNativeObject(const v8::FunctionCallbackInfo& args) + { + v8::Isolate* isolate = args.GetIsolate(); + v8::HandleScope scope(isolate); + + if (args.Length() != 1) + { + args.GetReturnValue().Set(v8::Undefined(isolate)); + return; + } + + std::string sName; + v8::String::Utf8Value data(V8IsolateFirstArg args[0]); + if (NULL != *data) + sName = std::string((char*)*data, data.length()); + + CEmbedObjectRegistrator& oRegistrator = CEmbedObjectRegistrator::getInstance(); + CEmbedObjectRegistrator::store_t::iterator itFound = oRegistrator.m_infos.find(sName); + if (itFound == oRegistrator.m_infos.end()) + { + args.GetReturnValue().Set(v8::Undefined(isolate)); + return; + } + + CEmbedObjectRegistrator::CEmdedClassInfo& oInfo = itFound->second; + + if (oInfo.m_bIsCreationAllowed == false) + { + args.GetReturnValue().Set(v8::Undefined(isolate)); + return; + } + + CJSEmbedObject* pNativeObj = oInfo.m_creator(); + v8::Local oCurTemplate; + CJSEmbedObjectAdapterV8Template* pTemplateAdapter = dynamic_cast(pNativeObj->getAdapter()); + if (pTemplateAdapter) + { + oCurTemplate = pTemplateAdapter->getTemplate(isolate); + } + else + { + oCurTemplate = CreateEmbedObjectTemplate(isolate, pNativeObj); + } + v8::MaybeLocal oTemplateMayBe = oCurTemplate->NewInstance(isolate->GetCurrentContext()); + v8::Local obj = oTemplateMayBe.ToLocalChecked(); + obj->SetInternalField(0, v8::External::New(CV8Worker::GetCurrent(), pNativeObj)); + + NSJSBase::CJSEmbedObjectPrivate::CreateWeaker(obj); + args.GetReturnValue().Set(obj); + } +} diff --git a/DesktopEditor/doctrenderer/js_internal/v8/v8_base.h b/DesktopEditor/doctrenderer/js_internal/v8/v8_base.h index 5740d37565..c90f2966d4 100644 --- a/DesktopEditor/doctrenderer/js_internal/v8/v8_base.h +++ b/DesktopEditor/doctrenderer/js_internal/v8/v8_base.h @@ -5,7 +5,9 @@ #include "inspector/inspector_pool.h" #endif +#include "../js_embed.h" #include "../js_base.h" +#include "../js_base_p.h" #include "../js_logger.h" #include #include @@ -75,44 +77,6 @@ public: }; #endif -class CIsolateAdditionalData -{ -public: - enum IsolateAdditionlDataType { - iadtSingletonNative = 0, - iadtUndefined = 255 - }; - - IsolateAdditionlDataType m_eType; -public: - CIsolateAdditionalData(const IsolateAdditionlDataType& type = iadtUndefined) { m_eType = type; } - virtual ~CIsolateAdditionalData() {} - - static bool CheckSingletonType(v8::Isolate* isolate, const IsolateAdditionlDataType& type, const bool& isAdd = true) - { - unsigned int nCount = isolate->GetNumberOfDataSlots(); - if (nCount == 0) - return false; - - void* pSingletonData = isolate->GetData(0); - if (NULL != pSingletonData) - { - CIsolateAdditionalData* pData = (CIsolateAdditionalData*)pSingletonData; - if (pData->m_eType == type) - return true; - - return false; - } - - if (isAdd) - { - isolate->SetData(0, (void*)(new CIsolateAdditionalData(type))); - } - - return false; - } -}; - class CV8Initializer { private: @@ -359,10 +323,10 @@ namespace NSJSBase return L""; } - virtual CJSObject* toObject(); - virtual CJSArray* toArray(); - virtual CJSTypedArray* toTypedArray(); - virtual CJSFunction* toFunction(); + virtual JSSmart toObject(); + virtual JSSmart toArray(); + virtual JSSmart toTypedArray(); + virtual JSSmart toFunction(); }; class CJSValueV8TemplatePrimitive : public CJSValueV8Template @@ -453,7 +417,7 @@ namespace NSJSBase value.Clear(); } - virtual CJSValue* get(const char* name) + virtual JSSmart get(const char* name) { CJSValueV8* _value = new CJSValueV8(); v8::Local _name = CreateV8String(CV8Worker::GetCurrent(), name); @@ -719,7 +683,7 @@ namespace NSJSBase value.Clear(); } - virtual CJSValue* Call(CJSValue* recv, int argc, JSSmart argv[]) + virtual JSSmart Call(CJSValue* recv, int argc, JSSmart argv[]) { CJSValueV8* _value = static_cast(recv); CJSValueV8* _return = new CJSValueV8(); @@ -743,7 +707,7 @@ namespace NSJSBase }; template - CJSObject* CJSValueV8Template::toObject() + JSSmart CJSValueV8Template::toObject() { CJSObjectV8* _value = new CJSObjectV8(); _value->value = value->ToObject(V8ContextOneArg).ToLocalChecked(); @@ -751,7 +715,7 @@ namespace NSJSBase } template - CJSArray* CJSValueV8Template::toArray() + JSSmart CJSValueV8Template::toArray() { CJSArrayV8* _value = new CJSArrayV8(); _value->value = v8::Local::Cast(value); @@ -759,7 +723,7 @@ namespace NSJSBase } template - CJSTypedArray* CJSValueV8Template::toTypedArray() + JSSmart CJSValueV8Template::toTypedArray() { CJSTypedArrayV8* _value = new CJSTypedArrayV8(); _value->value = v8::Local::Cast(value); @@ -767,7 +731,7 @@ namespace NSJSBase } template - CJSFunction* CJSValueV8Template::toFunction() + JSSmart CJSValueV8Template::toFunction() { CJSFunctionV8* _value = new CJSFunctionV8(); _value->value = v8::Local::Cast(value); @@ -840,7 +804,6 @@ namespace NSJSBase class CJSContextPrivate { public: - CV8Worker m_oWorker; v8::Isolate* m_isolate; std::stack m_scope; @@ -848,9 +811,28 @@ namespace NSJSBase v8::Local m_context; public: - CJSContextPrivate() : m_oWorker(), m_isolate(NULL) + CJSContextPrivate() : m_isolate(NULL) { } + + void InsertToGlobal(const std::string& name, v8::FunctionCallback creator) + { + v8::Local templ = v8::FunctionTemplate::New(m_isolate, creator); + v8::MaybeLocal oFuncMaybeLocal = templ->GetFunction(m_context); + m_context->Global()->Set(m_context, CreateV8String(m_isolate, name.c_str()), oFuncMaybeLocal.ToLocalChecked()); + } + }; + + // embed + void CreateEmbedNativeObject(const v8::FunctionCallbackInfo& args); + + class CJSEmbedObjectAdapterV8Template : public CJSEmbedObjectAdapterBase + { + public: + CJSEmbedObjectAdapterV8Template() = default; + virtual ~CJSEmbedObjectAdapterV8Template() = default; + + virtual v8::Local getTemplate(v8::Isolate* isolate) = 0; }; } @@ -919,6 +901,7 @@ inline NSJSBase::CJSEmbedObject* unwrap_native(const v8::Local& valu v8::Handle field = v8::Handle::Cast(value->GetInternalField(0)); return (NSJSBase::CJSEmbedObject*)field->Value(); } + inline NSJSBase::CJSEmbedObject* unwrap_native2(const v8::Local& value) { v8::Local _obj = value->ToObject(V8ContextOneArg).ToLocalChecked(); @@ -961,7 +944,7 @@ inline void js_return(const v8::PropertyCallbackInfo& info, JSSmart& args) \ { \ CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.Holder()); \ @@ -969,6 +952,8 @@ inline void js_return(const v8::PropertyCallbackInfo& info, JSSmart& args) \ { \ @@ -1053,38 +1038,4 @@ inline void js_return(const v8::PropertyCallbackInfo& info, JSSmart& context, v8::FunctionCallback creator) -{ - v8::Isolate* current = CV8Worker::GetCurrent(); - v8::Local localContext = context->m_internal->m_context; - v8::Local templ = v8::FunctionTemplate::New(current, creator); - v8::MaybeLocal oFuncMaybeLocal = templ->GetFunction(localContext); - v8::Maybe oResultMayBe = localContext->Global()->Set(localContext, CreateV8String(current, name.c_str()), oFuncMaybeLocal.ToLocalChecked()); -} - -using FunctionCreateTemplate = v8::Handle (*)(v8::Isolate* isolate); -static void CreateNativeInternalField(void* native, FunctionCreateTemplate creator, const v8::FunctionCallbackInfo& args, - const CIsolateAdditionalData::IsolateAdditionlDataType& type = CIsolateAdditionalData::iadtUndefined) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope scope(isolate); - - if (CIsolateAdditionalData::iadtUndefined != type) - { - if (CIsolateAdditionalData::CheckSingletonType(isolate, type)) - { - args.GetReturnValue().Set(v8::Undefined(isolate)); - return; - } - } - - v8::Handle oCurTemplate = creator(isolate); - v8::MaybeLocal oTemplateMayBe = oCurTemplate->NewInstance(isolate->GetCurrentContext()); - v8::Local obj = oTemplateMayBe.ToLocalChecked(); - obj->SetInternalField(0, v8::External::New(CV8Worker::GetCurrent(), native)); - - NSJSBase::CJSEmbedObjectPrivate::CreateWeaker(obj); - args.GetReturnValue().Set(obj); -} - #endif // _BUILD_NATIVE_CONTROL_V8_BASE_H_ diff --git a/DesktopEditor/doctrenderer/test/embed/test.cpp b/DesktopEditor/doctrenderer/test/embed/test.cpp index 82ce0e057f..32e3b4883a 100644 --- a/DesktopEditor/doctrenderer/test/embed/test.cpp +++ b/DesktopEditor/doctrenderer/test/embed/test.cpp @@ -26,12 +26,11 @@ public: void SetUp() override { // create context - m_pContext = new CJSContext; - m_pContext->CreateContext(); + m_pContext = new CJSContext(); m_pContext->Enter(); // create default embeded objects for context - CreateDefaults(m_pContext); + CreateDefaults(); } void TearDown() override @@ -43,7 +42,7 @@ public: { std::string sAlg = std::to_string(static_cast(alg)); JSSmart oRes1 = m_pContext->runScript( - "var oHash = new CreateNativeHash;\n" + "var oHash = CreateEmbedObject('CHashEmbed');\n" "var str = '" + str + "';\n" "var alg = " + sAlg + ";\n" "var hash = oHash.hash(str, str.length, alg);"); @@ -59,7 +58,7 @@ public: std::string sSpinCount = std::to_string(nSpinCount); std::string sAlg = std::to_string(static_cast(alg)); JSSmart oRes1 = m_pContext->runScript( - "var oHash = new CreateNativeHash;\n" + "var oHash = CreateEmbedObject('CHashEmbed');\n" "var sPassword = '" + sPassword + "';\n" "var sSalt = '" + sSalt + "';\n" "var nSpinCount = " + sSpinCount + ";\n" diff --git a/DesktopEditor/doctrenderer/test/internal/Embed.cpp b/DesktopEditor/doctrenderer/test/internal/Embed.cpp new file mode 100644 index 0000000000..7c6710b39b --- /dev/null +++ b/DesktopEditor/doctrenderer/test/internal/Embed.cpp @@ -0,0 +1,35 @@ +#include "Embed.h" + +#ifdef ENABLE_SUM_DEL +JSSmart CTestEmbed::FunctionSum(JSSmart param1, JSSmart param2) +{ + int n1 = param1->toInt32(); + int n2 = param2->toInt32(); + return CJSContext::createInt(n1 + n2); +} + +JSSmart CTestEmbed::FunctionDel(JSSmart param1, JSSmart param2) +{ + int n1 = param1->toInt32(); + int n2 = param2->toInt32(); + return CJSContext::createInt(n1 / n2); +} +#endif + +JSSmart CTestEmbed::FunctionSquare(JSSmart param) +{ + int n = param->toInt32(); + return CJSContext::createInt(n * n); +} + +#ifdef ENABLE_GET +JSSmart CTestEmbed::FunctionGet() +{ + return CJSContext::createInt(42); +} +#endif + +JSSmart CTestEmbed::FunctionSpecial() +{ + return CJSContext::createUndefined(); +} diff --git a/DesktopEditor/doctrenderer/test/internal/Embed.h b/DesktopEditor/doctrenderer/test/internal/Embed.h new file mode 100644 index 0000000000..80f06776a7 --- /dev/null +++ b/DesktopEditor/doctrenderer/test/internal/Embed.h @@ -0,0 +1,36 @@ +#ifndef _BUILD_NATIVE_HASH_EMBED_H_ +#define _BUILD_NATIVE_HASH_EMBED_H_ + +#include "../../js_internal/js_base.h" + +#define ENABLE_SUM_DEL +#define ENABLE_GET + +using namespace NSJSBase; +class CTestEmbed : public CJSEmbedObject +{ +public: + CTestEmbed() + { + } + + ~CTestEmbed() + { + } + + virtual void* getObject() override { return NULL; } + +#ifdef ENABLE_SUM_DEL + JSSmart FunctionSum(JSSmart param1, JSSmart param2); + JSSmart FunctionDel(JSSmart param1, JSSmart param2); +#endif + JSSmart FunctionSquare(JSSmart param); +#ifdef ENABLE_GET + JSSmart FunctionGet(); +#endif + /*[noexport]*/ JSSmart FunctionSpecial(); + + DECLARE_EMBED_METHODS +}; + +#endif // _BUILD_NATIVE_HASH_EMBED_H_ diff --git a/DesktopEditor/doctrenderer/test/internal/jsc/jsc_Embed.mm b/DesktopEditor/doctrenderer/test/internal/jsc/jsc_Embed.mm new file mode 100644 index 0000000000..fe80864582 --- /dev/null +++ b/DesktopEditor/doctrenderer/test/internal/jsc/jsc_Embed.mm @@ -0,0 +1,77 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT. + +#include "../Embed.h" +#import "js_embed.h" + +@protocol IJSCTestEmbed +#ifdef ENABLE_SUM_DEL +-(JSValue*) FunctionSum : (JSValue*)param1 : (JSValue*)param2; +-(JSValue*) FunctionDel : (JSValue*)param1 : (JSValue*)param2; +#endif +#ifdef ENABLE_GET +-(JSValue*) FunctionGet; +#endif +-(JSValue*) FunctionSquare : (JSValue*)param; +@end + +@interface CJSCTestEmbed : NSObject +{ +@public + CTestEmbed* m_internal; +} +@end + +@implementation CJSCTestEmbed +EMBED_OBJECT_WRAPPER_METHODS(CTestEmbed); + +#ifdef ENABLE_SUM_DEL +-(JSValue*) FunctionSum : (JSValue*)param1 : (JSValue*)param2 +{ + JSSmart ret = m_internal->FunctionSum(CJSEmbedObjectAdapterJSC::Native2Value(param1), CJSEmbedObjectAdapterJSC::Native2Value(param2)); + return CJSEmbedObjectAdapterJSC::Value2Native(ret); +} +-(JSValue*) FunctionDel : (JSValue*)param1 : (JSValue*)param2 +{ + JSSmart ret = m_internal->FunctionDel(CJSEmbedObjectAdapterJSC::Native2Value(param1), CJSEmbedObjectAdapterJSC::Native2Value(param2)); + return CJSEmbedObjectAdapterJSC::Value2Native(ret); +} +#endif + +#ifdef ENABLE_GET +-(JSValue*) FunctionGet +{ + JSSmart ret = m_internal->FunctionGet(); + return CJSEmbedObjectAdapterJSC::Value2Native(ret); +} +#endif + +-(JSValue*) FunctionSquare : (JSValue*)param +{ + JSSmart ret = m_internal->FunctionSquare(CJSEmbedObjectAdapterJSC::Native2Value(param)); + return CJSEmbedObjectAdapterJSC::Value2Native(ret); +} +@end + +class CTestEmbedAdapter : public CJSEmbedObjectAdapterJSC +{ +public: + virtual id getExportedObject(CJSEmbedObject* pNative) override + { + return [[CJSCTestEmbed alloc] init:(CTestEmbed*)pNative]; + } +}; + +CJSEmbedObjectAdapterBase* CTestEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CTestEmbedAdapter(); + return m_pAdapter; +} + +std::string CTestEmbed::getName() { return "CTestEmbed"; } + +CJSEmbedObject* CTestEmbed::getCreator() +{ + return new CTestEmbed(); +} diff --git a/DesktopEditor/doctrenderer/test/internal/main.cpp b/DesktopEditor/doctrenderer/test/internal/main.cpp index 04e459fc5f..bf1d7156ba 100644 --- a/DesktopEditor/doctrenderer/test/internal/main.cpp +++ b/DesktopEditor/doctrenderer/test/internal/main.cpp @@ -34,11 +34,12 @@ #include "embed/Default.h" #include "js_internal/js_base.h" +#include "Embed.h" using namespace NSJSBase; int main(int argc, char *argv[]) { -#if 1 +#if 0 // Primitives example JSSmart oContext1 = new CJSContext(false); @@ -47,12 +48,6 @@ int main(int argc, char *argv[]) JSSmart oContext2 = new CJSContext; // oContext2->Initialize(); - // Create first context - oContext1->CreateContext(); - - // Create second context - oContext2->CreateContext(); - // Work with first context oContext1->Enter(); @@ -101,34 +96,51 @@ int main(int argc, char *argv[]) #endif +#if 0 + // External embed example + + JSSmart oContext1 = new CJSContext(); + + // Embedding + CJSContextScope scope(oContext1); + CJSContext::Embed(); + + JSSmart oResTestEmbed1 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSum(10, 5); })();"); + std::cout << "FunctionSum(10, 5) = " << oResTestEmbed1->toInt32() << std::endl; + + JSSmart oResTestEmbed2 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSquare(4); })();"); + std::cout << "FunctionSquare(4) = " << oResTestEmbed2->toInt32() << std::endl; + + JSSmart oResTestEmbed3 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionDel(30, 3); })();"); + std::cout << "FunctionDel(30, 3) = " << oResTestEmbed3->toInt32() << std::endl; + + JSSmart oResTestEmbed4 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionGet(); })();"); + std::cout << "FunctionGet() = " << oResTestEmbed4->toInt32() << std::endl; + +#endif + #if 0 // CZipEmbed example - JSSmart oContext1 = new CJSContext; - JSSmart oContext2 = new CJSContext; - - // Create first context - oContext1->CreateContext(); - - // Create second context - oContext2->CreateContext(); + JSSmart oContext1 = new CJSContext(); + JSSmart oContext2 = new CJSContext(); // Work with first context oContext1->Enter(); - CreateDefaults(oContext1); + CreateDefaults(); JSSmart oRes1 = oContext1->runScript( - "var oZip = new CreateNativeZip;\n" - "var files = oZip.open('" CURR_DIR "/../v8');\n" + "var oZip = CreateEmbedObject('CZipEmbed');\n" + "var files = oZip.open('" CURR_DIR "');\n" "oZip.close();"); oContext1->Exit(); // Work with second context { CJSContextScope scope(oContext2); - CreateDefaults(oContext2); +// CreateDefaults(); JSSmart oRes2 = oContext2->runScript( - "var oZip = new CreateNativeZip;\n" - "var files = oZip.open('" CURR_DIR "/../jsc');\n" + "var oZip = CreateEmbedObject('CZipEmbed');\n" + "var files = oZip.open('" CURR_DIR "/../embed');\n" "oZip.close();"); } @@ -159,16 +171,13 @@ int main(int argc, char *argv[]) #if 0 // CHashEmbed example - JSSmart oContext1 = new CJSContext; - - // Create first context - oContext1->CreateContext(); + JSSmart oContext1 = new CJSContext(); // Call hash() on first context CJSContextScope scope(oContext1); - CreateDefaults(oContext1); + CreateDefaults(); JSSmart oRes1 = oContext1->runScript( - "var oHash = new CreateNativeHash;\n" + "var oHash = CreateEmbedObject('CHashEmbed');\n" "var str = 'test';\n" "var hash = oHash.hash(str, str.length, 0);"); @@ -183,7 +192,6 @@ int main(int argc, char *argv[]) std::cout << std::endl; // Call hash2() on first context - CreateDefaults(oContext1); JSSmart oRes2 = oContext1->runScript( "var str2 = 'test';\n" "var hash2 = oHash.hash2(str2, 'yrGivlyCImiWnryRee1OJw==', 100000, 7);"); @@ -197,6 +205,73 @@ int main(int argc, char *argv[]) } std::cout << std::endl; +#endif + +#if 1 + // Mixed embed example + + JSSmart oContext1 = new CJSContext(); + + // External CTestEmbed + CJSContextScope scope(oContext1); + CJSContext::Embed(false); + + JSSmart oResTestEmbed1 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSum(10, 5); })();"); + if (oResTestEmbed1->isNumber()) + std::cout << "FunctionSum(10, 5) = " << oResTestEmbed1->toInt32() << std::endl; + + JSSmart oTestEmbed = CJSContext::createEmbedObject("CTestEmbed"); + +// JSSmart oResTestEmbed2 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionSquare(4); })();"); + JSSmart args2[1]; + args2[0] = CJSContext::createInt(4); + JSSmart oResTestEmbed2 = oTestEmbed->call_func("FunctionSquare", 1, args2); + if (oResTestEmbed2->isNumber()) + std::cout << "FunctionSquare(4) = " << oResTestEmbed2->toInt32() << std::endl; + +// JSSmart oResTestEmbed3 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionDel(30, 3); })();"); + JSSmart args3[2]; + args3[0] = CJSContext::createInt(30); + args3[1] = CJSContext::createInt(3); + JSSmart oResTestEmbed3 = oTestEmbed->call_func("FunctionDel", 2, args3); + if (oResTestEmbed3->isNumber()) + std::cout << "FunctionDel(30, 3) = " << oResTestEmbed3->toInt32() << std::endl; + + JSSmart oResTestEmbed4 = oContext1->runScript("(function() { var value = CreateEmbedObject('CTestEmbed'); return value.FunctionGet(); })();"); + if (oResTestEmbed4->isNumber()) + std::cout << "FunctionGet() = " << oResTestEmbed4->toInt32() << std::endl; + + // Internal CHashEmbed + CreateDefaults(); + oContext1->runScript( + "var oHash = CreateEmbedObject('CHashEmbed');\n" + "var str = 'test';\n" + "var hash = oHash.hash(str, str.length, 0);"); + + // Print hash + JSSmart oGlobal = oContext1->GetGlobal(); + JSSmart oHash = oGlobal->get("hash")->toTypedArray(); + std::cout << "\nRESULTED HASH:\n"; + for (int i = 0; i < oHash->getCount(); i++) + { + std::cout << std::hex << static_cast(oHash->getData().Data[i]); + } + std::cout << std::endl; + + // Internal CZipEmbed + oContext1->runScript( + "var oZip = CreateEmbedObject('CZipEmbed');\n" + "var files = oZip.open('" CURR_DIR "');\n" + "oZip.close();"); + + // Print files + JSSmart oFiles1 = oGlobal->get("files")->toArray(); + std::cout << "\nFILES IN CURRENT DIRECTORY:\n"; + for (int i = 0; i < oFiles1->getCount(); i++) + { + std::cout << oFiles1->get(i)->toStringA() << std::endl; + } + #endif return 0; diff --git a/DesktopEditor/doctrenderer/test/internal/test_internal.pro b/DesktopEditor/doctrenderer/test/internal/test_internal.pro index 8f4423cf3f..aa25c41f1f 100644 --- a/DesktopEditor/doctrenderer/test/internal/test_internal.pro +++ b/DesktopEditor/doctrenderer/test/internal/test_internal.pro @@ -13,12 +13,15 @@ CORE_ROOT_DIR = $$PWD/../../../../../core PWD_ROOT_DIR = $$PWD include($$CORE_ROOT_DIR/Common/base.pri) +include($$CORE_ROOT_DIR/DesktopEditor/doctrenderer/js_internal/js_base_embed.pri) ############### destination path ############### DESTDIR = $$PWD/build ################################################ INCLUDEPATH += ../.. +DEFINES += CURR_DIR=\\\"$$PWD_ROOT_DIR\\\" + ADD_DEPENDENCY(doctrenderer) core_linux { @@ -26,6 +29,10 @@ core_linux { LIBS += -ldl } -SOURCES += main.cpp +SOURCES += main.cpp \ + Embed.cpp -DEFINES += CURR_DIR=\\\"$$PWD_ROOT_DIR\\\" +HEADERS += \ + Embed.h + +ADD_FILES_FOR_EMBEDDED_CLASS_HEADER(Embed.h) diff --git a/DesktopEditor/doctrenderer/test/internal/v8/v8_Embed.cpp b/DesktopEditor/doctrenderer/test/internal/v8/v8_Embed.cpp new file mode 100644 index 0000000000..87a3d6af27 --- /dev/null +++ b/DesktopEditor/doctrenderer/test/internal/v8/v8_Embed.cpp @@ -0,0 +1,52 @@ +// THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT CHANGE IT! +// IF YOU NEED TO UPDATE THIS CODE, JUST RERUN PYTHON SCRIPT. + +#include "../Embed.h" +#include "js_embed.h" + +class CTestEmbedAdapter : public CJSEmbedObjectAdapterV8 +{ +public: + virtual std::vector getMethodNames() override + { + return std::vector { +#ifdef ENABLE_SUM_DEL + "FunctionSum", + "FunctionDel", +#endif +#ifdef ENABLE_GET + "FunctionGet", +#endif + "FunctionSquare", + }; + } + + virtual void initFunctions(CJSEmbedObject* pNativeObjBase) override + { + CTestEmbed* pNativeObj = static_cast(pNativeObjBase); + m_functions = std::vector { +#ifdef ENABLE_SUM_DEL + [pNativeObj](CJSFunctionArguments* args) { return pNativeObj->FunctionSum(args->Get(0), args->Get(1)); }, + [pNativeObj](CJSFunctionArguments* args) { return pNativeObj->FunctionDel(args->Get(0), args->Get(1)); }, +#endif +#ifdef ENABLE_GET + [pNativeObj](CJSFunctionArguments* args) { return pNativeObj->FunctionGet(); }, +#endif + [pNativeObj](CJSFunctionArguments* args) { return pNativeObj->FunctionSquare(args->Get(0)); }, + }; + } +}; + +CJSEmbedObjectAdapterBase* CTestEmbed::getAdapter() +{ + if (m_pAdapter == nullptr) + m_pAdapter = new CTestEmbedAdapter(); + return m_pAdapter; +} + +std::string CTestEmbed::getName() { return "CTestEmbed"; } + +CJSEmbedObject* CTestEmbed::getCreator() +{ + return new CTestEmbed(); +} diff --git a/DesktopEditor/doctrenderer/v8_native_wrapper/builder.cpp b/DesktopEditor/doctrenderer/v8_native_wrapper/builder.cpp deleted file mode 100644 index b8a56e68dd..0000000000 --- a/DesktopEditor/doctrenderer/v8_native_wrapper/builder.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#include "builder.h" -#include "../../../Common/OfficeFileFormats.h" -#include "../../fontengine/application_generate_fonts_common.h" - -// wrap_methods ------------- -CBuilderObject* unwrap_builder(v8::Handle obj) -{ - v8::Handle field = v8::Handle::Cast(obj->GetInternalField(0)); - return static_cast(field->Value()); -} - -void _b_openfile(const v8::FunctionCallbackInfo& args) -{ - CBuilderObject* builder = unwrap_builder(args.This()); - if (!builder->m_pBuilder) - { - args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); - return; - } - - - std::wstring sFile; - std::wstring sParams; - - if (args.Length() > 0) - sFile = to_cstring(args[0]); - if (args.Length() > 1) - sParams = to_cstring(args[1]); - - int nRet = builder->m_pBuilder->OpenFile(sFile.c_str(), sParams.c_str()); - args.GetReturnValue().Set(v8::Integer::New(v8::Isolate::GetCurrent(), nRet)); -} -void _b_createfile(const v8::FunctionCallbackInfo& args) -{ - CBuilderObject* builder = unwrap_builder(args.This()); - if (!builder->m_pBuilder) - { - args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); - return; - } - - std::string sType = "docx"; - if (args.Length() > 0) - sType = to_cstringA(args[0]); - - bool isNoError = false; - if ("docx" == sType) - isNoError = builder->m_pBuilder->CreateFile(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX); - else if ("pptx" == sType) - isNoError = builder->m_pBuilder->CreateFile(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX); - else if ("xlsx" == sType) - isNoError = builder->m_pBuilder->CreateFile(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX); - - args.GetReturnValue().Set(v8::Boolean::New(v8::Isolate::GetCurrent(), isNoError)); -} -void _b_settmpfolder(const v8::FunctionCallbackInfo& args) -{ - CBuilderObject* builder = unwrap_builder(args.This()); - args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); - if (!builder->m_pBuilder) - return; - - if (args.Length() > 0) - { - std::wstring sFolder = to_cstring(args[0]); - builder->m_pBuilder->SetTmpFolder(sFolder.c_str()); - } -} -void _b_savefile(const v8::FunctionCallbackInfo& args) -{ - CBuilderObject* builder = unwrap_builder(args.This()); - if (!builder->m_pBuilder || args.Length() < 2) - { - args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); - return; - } - - int nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX; - std::string sFormat = to_cstringA(args[0]); - - if ("docx" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX; - else if ("doc" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC; - else if ("odt" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT; - else if ("rtf" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF; - else if ("txt" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT; - else if ("pptx" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX; - else if ("odp" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP; - else if ("xlsx" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX; - else if ("xls" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS; - else if ("ods" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS; - else if ("csv" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV; - else if ("pdf" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF; - else if ("image" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_IMAGE; - else if ("jpg" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_IMAGE; - else if ("png" == sFormat) - nFormat = AVS_OFFICESTUDIO_FILE_IMAGE; - - if (builder->m_pBuilder->IsSaveWithDoctrendererMode()) - { - // перед сохранением в такой схеме нужно скинуть изменения - builder->m_pBuilder->ExecuteCommand(L"_api.asc_Save();"); - } - - std::wstring sFile = to_cstring(args[1]); - std::wstring sFileParams; - if (args.Length() > 2) - sFileParams = to_cstring(args[2]); - - int nRet = builder->m_pBuilder->SaveFile(nFormat, sFile.c_str(), sFileParams.empty() ? NULL : sFileParams.c_str()); - args.GetReturnValue().Set(v8::Integer::New(v8::Isolate::GetCurrent(), nRet)); -} -void _b_closefile(const v8::FunctionCallbackInfo& args) -{ - CBuilderObject* builder = unwrap_builder(args.This()); - args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); - if (!builder->m_pBuilder) - return; - builder->m_pBuilder->CloseFile(); -} -void _b_writefile(const v8::FunctionCallbackInfo& args) -{ - CBuilderObject* builder = unwrap_builder(args.This()); - args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); - if (!builder->m_pBuilder || args.Length() < 2) - return; - - bool bIsAppend = true; - if (args.Length() > 2) - bIsAppend = args[2]->BooleanValue(); - - std::wstring sFile = to_cstring(args[0]); - std::string sData = to_cstringA(args[1]); - NSCommon::string_replaceA(sData, "%", "%%"); - - if (!bIsAppend) - NSFile::CFileBinary::Remove(sFile); - - NSFile::CFileBinary oFile; - FILE* pFile = oFile.OpenFileNative(sFile, bIsAppend ? L"a+" : L"a"); - if (pFile) - { - fprintf(pFile, sData.c_str()); - fclose(pFile); - } -} - -v8::Handle CreateBuilderTemplate(v8::Isolate* isolate) -{ - //v8::HandleScope handle_scope(isolate); - - v8::Local result = v8::ObjectTemplate::New(); - result->SetInternalFieldCount(1); // отводим в нем место для хранения CNativeControl - - v8::Isolate* current = v8::Isolate::GetCurrent(); - - void _b_openfile(const v8::FunctionCallbackInfo& args); - void _b_createfile(const v8::FunctionCallbackInfo& args); - void _b_settmpfolder(const v8::FunctionCallbackInfo& args); - void _b_savefile(const v8::FunctionCallbackInfo& args); - void _b_closefile(const v8::FunctionCallbackInfo& args); - - // прописываем функции - методы объекта - result->Set(v8::String::NewFromUtf8(current, "OpenFile"), v8::FunctionTemplate::New(current, _b_openfile)); - result->Set(v8::String::NewFromUtf8(current, "CreateFile"), v8::FunctionTemplate::New(current, _b_createfile)); - result->Set(v8::String::NewFromUtf8(current, "SetTmpFolder"), v8::FunctionTemplate::New(current, _b_settmpfolder)); - result->Set(v8::String::NewFromUtf8(current, "SaveFile"), v8::FunctionTemplate::New(current, _b_savefile)); - result->Set(v8::String::NewFromUtf8(current, "CloseFile"), v8::FunctionTemplate::New(current, _b_closefile)); - result->Set(v8::String::NewFromUtf8(current, "Write"), v8::FunctionTemplate::New(current, _b_writefile)); - - // возвращаем временный хэндл хитрым образом, который переносит наш хэндл в предыдущий HandleScope и не дает ему - // уничтожиться при уничтожении "нашего" HandleScope - handle_scope - - //return handle_scope.Close(result); - return result; -} - -void CreateBuilderObject(const v8::FunctionCallbackInfo& args) -{ - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - - v8::Handle NativeObjectTemplate = CreateBuilderTemplate(isolate); - CBuilderObject* pNativeObject = new CBuilderObject(); - - v8::Local obj = NativeObjectTemplate->NewInstance(); - obj->SetInternalField(0, v8::External::New(v8::Isolate::GetCurrent(), pNativeObject)); - - args.GetReturnValue().Set(obj); -} - diff --git a/DesktopEditor/Word_Api/ApplicationFontsWorker.h b/DesktopEditor/vboxtester/help.h similarity index 71% rename from DesktopEditor/Word_Api/ApplicationFontsWorker.h rename to DesktopEditor/vboxtester/help.h index cf0f2959ad..1331227ba5 100644 --- a/DesktopEditor/Word_Api/ApplicationFontsWorker.h +++ b/DesktopEditor/vboxtester/help.h @@ -1,52 +1,50 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#ifndef _BUILD_APPLICATIONFONTSWORKER_H_ -#define _BUILD_APPLICATIONFONTSWORKER_H_ - -#include -#include - -class CApplicationFontsWorker -{ -public: - std::vector m_arAdditionalFolders; - -public: - CApplicationFontsWorker(); - ~CApplicationFontsWorker(); - - std::vector CheckApplication(bool bIsNeedSystemFonts, - unsigned char* pDataSrc, unsigned int nLenSrc, - unsigned char*& pDataDst, unsigned int& nLenDst); -}; - -#endif // _BUILD_APPLICATIONFONTSWORKER_H_ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +#pragma once + +#include + +// Commands +std::wstring sCfgUser = L"user="; +std::wstring sCfgPassword = L"password="; + +std::wstring sCfgBranch = L"branch="; +std::wstring sCfgVersion = L"version="; + +std::wstring sCfgDebianStart = L"debian-start="; +std::wstring sCfgRedhatStart = L"redhat-start="; + +std::wstring sCfgDebianScript = L"debian-script="; +std::wstring sCfgRedhatScript = L"redhat-script="; + +std::wstring sCfgVerboseLog = L"verbose-log="; diff --git a/DesktopEditor/vboxtester/main.cpp b/DesktopEditor/vboxtester/main.cpp new file mode 100644 index 0000000000..1d4937b625 --- /dev/null +++ b/DesktopEditor/vboxtester/main.cpp @@ -0,0 +1,1362 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +#include +#include +#include +#include +#include + +#include "help.h" +#include "../common/File.h" +#include "../common/Directory.h" +#include "../../DesktopEditor/common/StringBuilder.h" +#include "../../DesktopEditor/common/SystemUtils.h" +#include "../../DesktopEditor/graphics/BaseThread.h" +#include "../../OfficeUtils/src/OfficeUtils.h" +#include "../../Common/Network/FileTransporter/include/FileTransporter.h" + +#ifdef CreateDirectory +#undef CreateDirectory +#endif + +#ifdef GetTempPath +#undef GetTempPath +#endif + +#ifdef LINUX +#include +#include +#endif + +// Misc +std::wstring CorrectValue(const std::wstring& value) +{ + if (value.empty()) + return L""; + + const wchar_t* data = value.c_str(); + + std::wstring::size_type pos1 = (data[0] == '\"') ? 1 : 0; + std::wstring::size_type pos2 = value.length(); + + if (data[pos2 - 1] == '\"') + --pos2; + + return value.substr(pos1, pos2 - pos1); +} + +bool SplitStringAsVector(const std::wstring& sData, const std::wstring& sDelimiter, std::vector& arrOutput) +{ + arrOutput.clear(); + + if ( sData.length() ) + { + std::wstring sTmp = sData; + NSStringUtils::string_replace(sTmp, L", ", L","); + + size_t pos_start = 0, pos_end, delim_len = sDelimiter.length(); + std::wstring token = L""; + + while ((pos_end = sTmp.find(sDelimiter, pos_start)) != std::wstring::npos) + { + token = sTmp.substr(pos_start, pos_end - pos_start); + pos_start = pos_end + delim_len; + if (token.length()) + arrOutput.push_back(token); + } + + token = sTmp.substr(pos_start); + if ( token.length() ) + arrOutput.push_back(token); + } + + return arrOutput.size() > 0; +} + +// +enum SystemType +{ + Debian = 0, + RedHat, + Empty +}; + +class CVm +{ +public: + std::wstring m_sName; + std::wstring m_sGuid; + + // from showvminfo command + std::wstring m_sGuestOS; + + // real OS + std::wstring m_sOperationSystem; + + SystemType m_eType; + + CVm() + { + m_sName = L""; + m_sGuid = L""; + m_sGuestOS = L""; + m_sOperationSystem = L""; + m_eType = Empty; + } + + CVm(const std::wstring& sName, const std::wstring& sGuid, const std::wstring& sGuestOS, const SystemType& eType) + { + m_sName = sName; + m_sGuid = sGuid; + m_sGuestOS = sGuestOS; + m_sOperationSystem = L""; + m_eType = eType; + } + + bool IsDebian() + { + return m_eType == Debian; + } + + bool IsRedHat() + { + return m_eType == RedHat; + } + + std::wstring ToString() + { + std::wstringstream sInfo; + + if ( m_sName.length() && m_sGuid.length() && m_sGuestOS.length() ) + sInfo << m_sName << L"-" << m_sGuestOS << L"-" << m_sGuid; + + return sInfo.str(); + } +}; + +class CVirtualBox +{ +private: + std::wstring m_sVbmPath; + + std::wstring m_sVmUser; + std::wstring m_sVmPassword; + + std::wstring m_sBranch; + std::wstring m_sVersion; + + std::wstring m_sDebianUrl; + std::wstring m_sCentosUrl; + std::wstring m_sOpSuseUrl; + + std::wstring m_sEditorsPath; + std::wstring m_sSuccessOutput; + + std::wstring m_sConfigName; + std::wstring m_sReportName; + std::wstring m_sStdoutFile; + + std::wstring m_sRunScript; + std::wstring m_sSetupScript; + + std::vector m_arrVms; + CVm* m_pVm; + + std::wstring m_sDebianStart; + std::wstring m_sRedHatStart; + + std::wstring m_sDebianScript; + std::wstring m_sRedHatScript; + + bool m_bVerboseLog; + +public: + CVirtualBox() + { + m_pVm = NULL; + + m_sDebianStart = L""; + m_sRedHatStart = L""; + + m_sDebianScript = L""; + m_sRedHatScript = L""; + + m_sVmUser = L""; + m_sVmPassword = L""; + + m_sRunScript = L"run"; + m_sSetupScript = L"setup"; + + m_sConfigName = L"config"; + m_sReportName = L"report.txt"; + m_sStdoutFile = L"stdout.txt"; + + m_sEditorsPath = L"/opt/onlyoffice/desktopeditors/DesktopEditors"; + m_sSuccessOutput = L"[DesktopEditors]: start page loaded"; + + m_sBranch = L""; + m_sVersion = L""; + + m_sDebianUrl = L""; + m_sCentosUrl = L""; + m_sOpSuseUrl = L""; + + m_bVerboseLog = false; + +#ifdef WIN32 + m_sVbmPath = L"\"c:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe\""; +#endif +#ifdef LINUX + m_sVbmPath = L"/usr/lib/virtualbox/VBoxManage"; +#endif + } + + // VboxManage + bool InitVms() + { + m_arrVms.clear(); + std::wstring sOutput = ExecuteCommand(L"list vms"); + + std::vector arrLines; + if ( SplitStringAsVector(sOutput, L"\n", arrLines) ) + { + for (size_t i = 0; i < arrLines.size(); i++) + { + std::wstring sLine = arrLines[i]; + + std::wstring::size_type pos1 = sLine.find(L"{"); + std::wstring::size_type pos2 = sLine.find(L"}", pos1); + + if (pos1 != std::wstring::npos && pos2 != std::wstring::npos && pos2 > pos1) + { + std::wstring sGuid = sLine.substr(pos1, pos2 - pos1 + 1); + std::wstring sName = sLine.substr(0, pos1 - 1); + sName = CorrectValue(sName); + std::wstring sOs = GetVmOS(sGuid); + + SystemType eType = Empty; + std::wstring sOsLower = sOs; + std::transform(sOsLower.begin(), sOsLower.end(), sOsLower.begin(), tolower); + + if ( sOsLower.find(L"ubuntu") != std::wstring::npos || + sOsLower.find(L"debian") != std::wstring::npos) + eType = Debian; + else + if ( sOsLower.find(L"red hat") != std::wstring::npos || + sOsLower.find(L"fedora") != std::wstring::npos || + sOsLower.find(L"opensuse") != std::wstring::npos) + eType = RedHat; + + m_arrVms.push_back(new CVm(sName, sGuid, sOs, eType)); + } + } + } + + return m_arrVms.size() > 0; + } + + void SetVm(CVm* pVm) + { + m_pVm = pVm; + } + + std::vector GetStartVms() + { + std::vector arrResult; + + // Check Debian systems + if ( m_sDebianStart.length() ) + { + std::vector arrDebian = GetDebianVms(); + + std::wstring sDebian = m_sDebianStart; + std::vector list; + NSStringUtils::string_replace(sDebian, L", ", L","); + + if ( SplitStringAsVector(sDebian, L",", list) ) + { + for (size_t i = 0; i < arrDebian.size(); i++) + { + if ( std::find(list.begin(), list.end(), arrDebian[i]->m_sName) != list.end() ) + { + arrResult.push_back(arrDebian[i]); + } + } + } + } + + // Check RedHat systems + if ( m_sRedHatStart.length() ) + { + std::vector arrRedHat = GetRedHatVms(); + + std::wstring sRedHat = m_sRedHatStart; + std::vector list; + NSStringUtils::string_replace(sRedHat, L", ", L","); + + if ( SplitStringAsVector(sRedHat, L",", list) ) + { + for (size_t i = 0; i < arrRedHat.size(); i++) + { + if ( std::find(list.begin(), list.end(), arrRedHat[i]->m_sName) != list.end() ) + { + arrResult.push_back(arrRedHat[i]); + } + } + } + } + + return arrResult; + } + + bool StartVm() + { + bool bResult = false; + + if ( m_pVm ) + { + if (m_bVerboseLog) + { + WriteReport(L"Starting VM"); + WriteReport(L"---------------------------------------"); + } + + WriteReport(m_pVm->m_sName); + + if (m_bVerboseLog) + { + WriteReport(m_pVm->m_sGuestOS); + WriteReport(m_pVm->m_sGuid); + } + + std::wstring sCommand = L"startvm " + m_pVm->m_sGuid; + std::wstring sOutput = ExecuteCommand(sCommand); + bResult = sOutput.find(L"started") != std::wstring::npos; + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + bool ResetVm() + { + bool bResult = false; + + if ( m_pVm ) + { + if (m_bVerboseLog) + WriteReport(L"Restart VM"); + + std::wstring sCommand = L"controlvm " + m_pVm->m_sGuid + L" reset"; + std::wstring sOutput = ExecuteCommand(sCommand); + bResult = sOutput.find(L"") != std::wstring::npos; + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + bool StopVm(bool bSaveState = false) + { + bool bResult = false; + + if ( m_pVm ) + { + if (m_bVerboseLog) + WriteReport(L"Stop VM"); + + std::wstring sCommand = L"controlvm " + m_pVm->m_sGuid + (bSaveState ? L" savestate" : L" poweroff"); + std::wstring sOutput = ExecuteCommand(sCommand); + bResult = sOutput.find(L"") != std::wstring::npos; + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + void WaitLoadVm() + { + // Wait success or 10 min + int iSleep = 5000; + int iCount = 10 * 60 * 1000 / iSleep; + + if (m_bVerboseLog) + WriteReport(L"Waiting loading"); + + if ( m_pVm ) + { + while ( (iCount > 0) && !IsVmLoggedIn() ) + { + NSThreads::Sleep(iSleep); + iCount--; + } + + NSThreads::Sleep(30000); + } + + if (m_bVerboseLog) + WriteReportResult(iCount > 0); + } + + bool WaitInstall() + { + // Wait success or 10 min + int iSleep = 5000; + int iCount = 10 * 60 * 1000 / iSleep; + + if (m_bVerboseLog) + WriteReport(L"Waiting installation"); + + if ( m_pVm ) + { + std::vector arrProcess; + + if ( m_pVm->IsDebian() ) + { + arrProcess.push_back(L"apt"); + arrProcess.push_back(L"dpkg"); + } + else if ( m_pVm->IsRedHat() ) + { + arrProcess.push_back(L"rpm"); + } + + while ( iCount > 0 ) + { + bool bResult = IsLocationExists(m_sEditorsPath); + for (size_t i = 0; i < arrProcess.size(); i++) + { + bResult &= !IsProcessExists(arrProcess[i]); + } + if ( bResult ) + break; + + NSThreads::Sleep(iSleep); + iCount--; + } + } + + // True - installation, False - timeout + if (m_bVerboseLog) + WriteReportResult(iCount > 0); + + return iCount > 0; + } + + bool WaitStdout() + { + // Wait success or 1 min + int iSleep = 5000; + int iCount = 1 * 60 * 1000 / iSleep; + + bool bStdout = false; + + if (m_bVerboseLog) + WriteReport(L"Waiting stdout"); + + if ( m_pVm ) + { + std::wstring sStdoutFile = GetWorkingDir() + L"/" + m_sStdoutFile; + + while ( (iCount > 0) && (!IsLocationExists(sStdoutFile)) ) + { + NSThreads::Sleep(iSleep); + iCount--; + } + + // File exists + if ( iCount > 0 ) + { + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" run --exe /bin/cat" + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --wait-stdout -- cat/arg0 " + sStdoutFile; + + std::wstring sOutput = ExecuteCommand(sCommand); + + if ( sOutput.find(m_sSuccessOutput) != std::wstring::npos ) + bStdout = true; + } + } + + if (m_bVerboseLog) + WriteReportResult(bStdout); + + // True - installation, False - timeout + return bStdout && ( iCount > 0 ); + } + + bool SaveScreenshot() + { + bool bResult = false; + + if ( m_pVm ) + { + if (m_bVerboseLog) + WriteReport(L"Saving screenshot"); + + std::wstring sFilePath = GetReportDir() + L"/" + m_pVm->m_sName + L".png"; + + if ( NSFile::CFileBinary::Exists(sFilePath) ) + NSFile::CFileBinary::Remove(sFilePath); + + std::wstring sCommand = L"controlvm " + m_pVm->m_sGuid + L" screenshotpng " + sFilePath; + std::wstring sOutput = ExecuteCommand(sCommand); + bResult = NSFile::CFileBinary::Exists(sFilePath); + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + bool CreateWorkingDir() + { + bool bResult = false; + + if ( m_pVm && m_sVmUser.length() ) + { + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" rmdir --recursive " + GetWorkingDir(); + + std::wstring sOutput = ExecuteCommand(sCommand); + + sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" mkdir " + GetWorkingDir(); + + sOutput = ExecuteCommand(sCommand); + //NSThreads::Sleep(10000); + + bResult = true; + } + + return bResult; + } + + bool CheckOperationSystem() + { + bool bResult = false; + + if ( m_pVm ) + { + // Get real description + m_pVm->m_sOperationSystem = L""; + std::wstring sBin = L"/usr/bin/hostnamectl"; + + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" run --exe " + sBin + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --wait-stdout"; + + std::wstring sOutput = ExecuteCommand(sCommand); + + std::vector arrLines; + if ( SplitStringAsVector(sOutput, L"\n", arrLines) ) + { + std::wstring sPrefix = L"Operating System:"; + + for (size_t i = 0; i < arrLines.size(); i++) + { + std::wstring sLine = arrLines[i]; + + std::wstring::size_type pos = sLine.find(sPrefix); + if ( pos != std::wstring::npos ) + { + m_pVm->m_sOperationSystem = sLine; + pos = m_pVm->m_sOperationSystem.find(sPrefix + L" "); + while ( pos != std::wstring::npos ) + { + NSStringUtils::string_replace(m_pVm->m_sOperationSystem, sPrefix + L" ", sPrefix); + pos = m_pVm->m_sOperationSystem.find(sPrefix + L" "); + } + NSStringUtils::string_replace(m_pVm->m_sOperationSystem, sPrefix, L""); + + bResult = true; + break; + } + } + } + } + + return bResult; + } + + bool DownloadDistrib() + { + bool bResult = false; + + if ( m_pVm ) + { + // Prepare url + std::wstring sUrl = L""; + + CheckOperationSystem(); + + if ( m_pVm->IsDebian() ) + sUrl = m_sDebianUrl; + + else if ( m_pVm->IsRedHat() ) + { + std::wstring sOsLower = m_pVm->m_sOperationSystem; + std::transform(sOsLower.begin(), sOsLower.end(), sOsLower.begin(), tolower); + + if ( sOsLower.find(L"centos") != std::wstring::npos || + sOsLower.find(L"fedora") != std::wstring::npos) + sUrl = m_sCentosUrl; + else if ( sOsLower.find(L"opensuse") != std::wstring::npos ) + sUrl = m_sOpSuseUrl; + } + + if (m_bVerboseLog) + WriteReport(L"Start downloading: " + sUrl); + + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" run --exe /usr/bin/curl" + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --wait-stdout -- curl/arg0 " + sUrl + + L" --output " + GetWorkingDir() + L"/" + NSFile::GetFileName(sUrl); + + std::wstring sOutput = ExecuteCommand(sCommand); + + // Wait flush to disk. Wait min + NSThreads::Sleep(60000); + bResult = true; + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + bool CopyScripts() + { + bool bResult = false; + + if ( m_pVm ) + { + if (m_bVerboseLog) + WriteReport(L"Copiyng scripts"); + + // Setup + std::wstring sData = L""; + std::wstring sUrl = m_pVm->IsDebian() ? m_sDebianUrl : m_sCentosUrl; + std::wstring sScriptPath = NSDirectory::GetTempPath() + L"/" + m_sSetupScript; + std::wstring sDistribFile = NSFile::GetFileName(sUrl); + + if ( NSFile::CFileBinary::Exists(sScriptPath) ) + NSFile::CFileBinary::Remove(sScriptPath); + + if ( m_pVm->IsDebian() ) + { + if ( m_sDebianScript.length() ) + { + if ( NSFile::CFileBinary::Exists(m_sDebianScript) ) + { + NSFile::CFileBinary::ReadAllTextUtf8(m_sDebianScript, sData); + } + } + else + { + sData = L"#!/bin/bash\n" \ + L"echo \"Install DesktopEditors\"\n" \ + L"apt purge onlyoffice-desktopeditors -y\n" \ + L"dpkg -i ./" + sDistribFile + "\n" \ + L"apt install -f"; + } + } + else if ( m_pVm->IsRedHat() ) + { + if ( m_sRedHatScript.length() ) + { + NSFile::CFileBinary::ReadAllTextUtf8(m_sRedHatScript, sData); + } + else + { + sData = L"#!/bin/bash\n" \ + L"echo \"Install DesktopEditors\"\n" \ + L"rpm -e onlyoffice-desktopeditors\n" \ + L"rpm -i ./" + sDistribFile; + } + } + + NSFile::CFileBinary oFile; + bResult = oFile.CreateFileW(sScriptPath); + oFile.WriteStringUTF8(sData); + oFile.CloseFile(); + + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" copyto " + sScriptPath + L" " + GetWorkingDir() + L"/" + m_sSetupScript; + + std::wstring sOutput = ExecuteCommand(sCommand); + + NSFile::CFileBinary::Remove(sScriptPath); + //NSThreads::Sleep(10000); + + // Run + sScriptPath = NSDirectory::GetTempPath() + L"/" + m_sRunScript; + std::wstring sStdoutFile = GetWorkingDir() + L"/" + m_sStdoutFile; + + if ( NSFile::CFileBinary::Exists(sScriptPath) ) + NSFile::CFileBinary::Remove(sScriptPath); + + std::wstring sEditorsFolder = m_sEditorsPath; + NSStringUtils::string_replace(sEditorsFolder, NSFile::GetFileName(m_sEditorsPath), L""); + + sData = L"#!/bin/bash\n" \ + L"LD_LIBRARY_PATH=" + sEditorsFolder + L" " + m_sEditorsPath + L" --ascdesktop-log-file=" + sStdoutFile; + + bResult &= oFile.CreateFileW(sScriptPath); + oFile.WriteStringUTF8(sData); + oFile.CloseFile(); + + sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" copyto " + sScriptPath + L" " + GetWorkingDir() + L"/" + m_sRunScript; + + sOutput = ExecuteCommand(sCommand); + + NSFile::CFileBinary::Remove(sScriptPath); + //NSThreads::Sleep(10000); + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + bool RemoveScripts() + { + bool bResult = true; + + if ( m_pVm ) + { + if (m_bVerboseLog) + WriteReport(L"Removing scripts"); + + std::vector arrScipts; + arrScipts.push_back(m_sRunScript); + arrScipts.push_back(m_sSetupScript); + + for (size_t i = 0; i < arrScipts.size(); i++) + { + std::wstring sScriptPath = GetWorkingDir() + L"/" + arrScipts[i]; + + if ( IsLocationExists(sScriptPath) ) + { + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" rm " + sScriptPath; + + std::wstring sOutput = ExecuteCommand(sCommand); + + bResult &= !IsLocationExists(sScriptPath); + } + } + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + bool RunEditors() + { + bool bResult = true; + + if ( m_pVm && IsLocationExists(m_sEditorsPath) ) + { + if (m_bVerboseLog) + WriteReport(L"Runing DesktopEditors"); + + std::wstring sRunScript = GetWorkingDir() + L"/" + m_sRunScript; + + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" start " + sRunScript + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --putenv DISPLAY=:0.0"; + + std::wstring sOutput = ExecuteCommand(sCommand); + } + + return bResult; + } + + bool IsReadyReset() + { + bool bResult = true; + + if ( m_pVm ) + { + if (m_bVerboseLog) + WriteReport(L"Ready restart"); + + std::wstring sUrl = m_pVm->IsDebian() ? m_sDebianUrl : m_sCentosUrl; + std::wstring sRunScript = GetWorkingDir() + L"/" + m_sSetupScript; + std::wstring sSetupScript = GetWorkingDir() + L"/" + m_sSetupScript; + std::wstring sDistribPath = GetWorkingDir() + L"/" + NSFile::GetFileName(sUrl); + + bResult = IsLocationExists(sRunScript) && + IsLocationExists(sSetupScript) && + IsLocationExists(sDistribPath); + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + bool IsEditorsRunned() + { + bool bResult = true; + + if ( m_pVm ) + { + if (m_bVerboseLog) + WriteReport(L"DesktopEditors runned"); + + std::wstring sEditorProc = NSFile::GetFileName(m_sEditorsPath); + bResult = IsProcessExists(sEditorProc); + + if (m_bVerboseLog) + WriteReportResult(bResult); + } + + return bResult; + } + + // Report + void CreateReport() + { + std::ofstream oFile; + std::wstring sReportPath = GetReportDir() + L"/" + m_sReportName; + oFile.open(U_TO_UTF8(sReportPath), std::ofstream::out | std::ofstream::trunc); + oFile.close(); + } + + void WriteReport(const std::wstring& sText) + { + if ( sText.length() ) + { + std::wofstream oFile; + std::wstring sReportPath = GetReportDir() + L"/" + m_sReportName; + oFile.open(U_TO_UTF8(sReportPath), std::ios_base::app); + oFile << sText << std::endl; + oFile.close(); + + std::wcout << sText << std::endl; + } + } + + void WriteReportResult(const bool& bResult) + { + std::wofstream oFile; + std::wstring sReportPath = GetReportDir() + L"/" + m_sReportName; + oFile.open(U_TO_UTF8(sReportPath), std::ios_base::app); + oFile << BoolToStr(bResult) + L"\n" << std::endl; + oFile.close(); + + std::wcout << BoolToStr(bResult) + L"\n" << std::endl; + } + + void RemoveReport() + { + if ( NSDirectory::Exists(GetReportDir()) ) + NSDirectory::DeleteDirectory(GetReportDir()); + } + + // Config + bool IsConfigExists() + { + return NSFile::CFileBinary::Exists(m_sConfigName); + } + + bool CreateConfig() + { + std::wstring sDebian = L""; + std::wstring sRedHat = L""; + std::vector arrDebian = GetDebianVms(); + std::vector arrRedHat = GetRedHatVms(); + + for (size_t i = 0; i < arrDebian.size(); i++) + { + sDebian += arrDebian[i]->m_sName + (i < arrDebian.size() - 1 ? L", " : L""); + } + for (size_t i = 0; i < arrRedHat.size(); i++) + { + sRedHat += arrRedHat[i]->m_sName + (i < arrRedHat.size() - 1 ? L", " : L""); + } + + std::wstring sData = sCfgUser + L"\n" + + sCfgPassword + L"\n\n" + + sCfgBranch + L"7.4.0\n" + + sCfgVersion + L"173\n\n" + + sCfgDebianStart + sDebian + L"\n" + + sCfgRedhatStart + sRedHat + L"\n\n" + + sCfgDebianScript + L"\n" + + sCfgRedhatScript + L"\n\n" + + sCfgVerboseLog + L"0\n"; + + NSFile::CFileBinary oFile; + oFile.CreateFileW(m_sConfigName); + oFile.WriteStringUTF8(sData); + oFile.CloseFile(); + + return IsConfigExists(); + } + + bool ReadConfig() + { + bool bResult = false; + + if ( IsConfigExists() ) + { + std::wstring sData = L""; + + NSFile::CFileBinary oFile; + if ( oFile.ReadAllTextUtf8(m_sConfigName, sData) ) + { + std::vector arrLines; + if ( SplitStringAsVector(sData, L"\n", arrLines) ) + { + for (size_t i = 0; i < arrLines.size(); i++) + { + std::wstring sLine = arrLines[i]; + + // Auth + if ( sLine.find(sCfgUser) != std::wstring::npos ) + m_sVmUser = sLine.substr(sCfgUser.length()); + else if ( sLine.find(sCfgPassword) != std::wstring::npos ) + m_sVmPassword = sLine.substr(sCfgPassword.length()); + + // URL + else if ( sLine.find(sCfgBranch) != std::wstring::npos ) + m_sBranch = sLine.substr(sCfgBranch.length()); + else if ( sLine.find(sCfgVersion) != std::wstring::npos ) + m_sVersion = sLine.substr(sCfgVersion.length()); + + // Systems + else if ( sLine.find(sCfgDebianStart) != std::wstring::npos ) + m_sDebianStart = sLine.substr(sCfgDebianStart.length()); + else if ( sLine.find(sCfgRedhatStart) != std::wstring::npos ) + m_sRedHatStart = sLine.substr(sCfgRedhatStart.length()); + + // Custom setup scripts + else if ( sLine.find(sCfgDebianScript) != std::wstring::npos ) + m_sDebianScript = sLine.substr(sCfgDebianScript.length()); + else if ( sLine.find(sCfgRedhatScript) != std::wstring::npos ) + m_sRedHatScript = sLine.substr(sCfgRedhatScript.length()); + + // Log + else if ( sLine.find(sCfgVerboseLog) != std::wstring::npos ) + m_bVerboseLog = sLine.substr(sCfgVerboseLog.length()) == L"1"; + } + + // Prepare urls + if ( m_sBranch.length() && m_sVersion.length() ) + { + std::wstring sAmazonS3 = L"https://s3.eu-west-1.amazonaws.com/repo-doc-onlyoffice-com/desktop/linux"; + + if ( m_sDebianStart.length() ) + { + m_sDebianUrl = sAmazonS3 + L"/debian/onlyoffice-desktopeditors_{BRANCH}-{VERSION}_amd64.deb"; + NSStringUtils::string_replace(m_sDebianUrl, L"{BRANCH}", m_sBranch); + NSStringUtils::string_replace(m_sDebianUrl, L"{VERSION}", m_sVersion); + } + if ( m_sRedHatStart.length() ) + { + m_sCentosUrl = sAmazonS3 + L"/rhel/onlyoffice-desktopeditors-{BRANCH}-{VERSION}.el7.x86_64.rpm"; + NSStringUtils::string_replace(m_sCentosUrl, L"{BRANCH}", m_sBranch); + NSStringUtils::string_replace(m_sCentosUrl, L"{VERSION}", m_sVersion); + + m_sOpSuseUrl = sAmazonS3 + L"/suse/onlyoffice-desktopeditors-{BRANCH}-{VERSION}.suse12.x86_64.rpm"; + NSStringUtils::string_replace(m_sOpSuseUrl, L"{BRANCH}", m_sBranch); + NSStringUtils::string_replace(m_sOpSuseUrl, L"{VERSION}", m_sVersion); + } + } + } + + oFile.CloseFile(); + } + } + + return bResult; + } + +private: + std::wstring GetWorkingDir() + { + std::wstring sDir = L""; + + if ( m_sVmUser.length() ) + sDir = L"/home/" + m_sVmUser + L"/vboxtester"; + + return sDir; + } + + std::wstring GetReportDir() + { + std::wstring sAppPath = NSFile::GetProcessDirectory(); + sAppPath += L"/report"; + + if ( !NSDirectory::Exists(sAppPath) ) + NSDirectory::CreateDirectory(sAppPath); + + return sAppPath; + } + + bool IsLocationExists(const std::wstring& sPath) + { + // check ile or folder + bool bResult = false; + + if ( m_pVm && sPath.length() ) + { + std::wstring sFile = L""; + std::wstring sFolder = sPath; + std::vector arrParts; + if ( SplitStringAsVector(sPath, L"/", arrParts) ) + { + sFile = arrParts[arrParts.size() - 1]; + NSStringUtils::string_replace(sFolder, L"/" + sFile, L""); + } + + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" run --exe /bin/ls" + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --wait-stdout -- ls/arg0 " + sFolder; + + std::wstring sOutput = ExecuteCommand(sCommand); + if ( sOutput.length() ) + { + if ( SplitStringAsVector(sOutput, L"\n", arrParts) ) + bResult = std::find(arrParts.begin(), arrParts.end(), sFile) != arrParts.end(); + } + } + + return bResult; + } + + bool IsProcessExists(const std::wstring& sName) + { + bool bResult = false; + + if ( m_pVm && sName.length() ) + { + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" run --exe /bin/ps" + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --wait-stdout -- ps/arg0 -e"; + + std::wstring sOutput = ExecuteCommand(sCommand); + + if ( sOutput.length() ) + { + std::vector arrLines; + std::vector arrParts; + + if ( SplitStringAsVector(sOutput, L"\n", arrLines) ) + { + for (size_t i = 0; i < arrLines.size(); i++) + { + std::wstring sLine = arrLines[i]; + if ( (i > 0) && SplitStringAsVector(sLine, L" ", arrParts) ) + { + if ( arrParts[arrParts.size() - 1] == sName ) + { + bResult = true; + break; + } + } + } + } + } + } + + return bResult; + } + + bool IsVmLoggedIn() + { + bool bResult = false; + + if ( m_pVm ) + { + // whoami check + std::wstring sBin = L"/usr/bin/whoami"; + if ( m_pVm->IsRedHat() ) + NSStringUtils::string_replace(sBin, L"/usr", L""); + + std::wstring sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" run --exe " + sBin + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --wait-stdout"; + + std::wstring sOutput = ExecuteCommand(sCommand); + bool bWhoami = sOutput.find(m_sVmUser) != std::wstring::npos; + + // uptime check + sBin = L"/usr/bin/uptime"; + if ( m_pVm->IsRedHat() ) + NSStringUtils::string_replace(sBin, L"/usr", L""); + + sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" run --exe " + sBin + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --wait-stdout"; + + sOutput = ExecuteCommand(sCommand); + bool bUptime = sOutput.find(L"user") != std::wstring::npos; + + // TODO check: ps -e | grep X + + // connection + sCommand = L"guestcontrol " + m_pVm->m_sGuid + + L" run --exe /usr/bin/curl" + + L" --username " + m_sVmUser + + L" --password " + m_sVmPassword + + L" --wait-stdout -- curl/arg0 -I http://www.google.com"; + + sOutput = ExecuteCommand(sCommand); + bool bConnection = sOutput.find(L"200 OK") != std::wstring::npos; + + bResult = (bWhoami || bUptime) && bConnection; + } + + return bResult; + } + + std::vector GetDebianVms() + { + std::vector arrVms; + + for (size_t i = 0; i < m_arrVms.size(); i++) + { + if ( m_arrVms[i]->IsDebian() ) + { + arrVms.push_back(m_arrVms[i]); + } + } + + return arrVms; + } + + std::vector GetRedHatVms() + { + std::vector arrVms; + + for (size_t i = 0; i < m_arrVms.size(); i++) + { + if ( m_arrVms[i]->IsRedHat() ) + { + arrVms.push_back(m_arrVms[i]); + } + } + + return arrVms; + } + + std::wstring GetVmOS(const std::wstring& sGuid) + { + return ParseVmInfo(sGuid, L"Guest OS"); + } + + std::wstring ParseVmInfo(const std::wstring& sGuid, const std::wstring& sPref) + { + std::wstring sStatus = L""; + + if ( sGuid.length() && sPref.length() ) + { + std::wstring command = L"showvminfo " + sGuid; + std::wstring sOutput = ExecuteCommand(command); + + std::vector arrLines; + if ( SplitStringAsVector(sOutput, L"\n", arrLines) ) + { + std::wstring sPrefix = sPref + L":"; + + for (size_t i = 0; i < arrLines.size(); i++) + { + std::wstring sLine = arrLines[i]; + + std::wstring::size_type pos = sLine.find(sPrefix); + if ( pos != std::wstring::npos ) + { + sStatus = sLine; + pos = sStatus.find(sPrefix + L" "); + while ( pos != std::wstring::npos ) + { + NSStringUtils::string_replace(sStatus, sPrefix + L" ", sPrefix); + pos = sStatus.find(sPrefix + L" "); + } + NSStringUtils::string_replace(sStatus, sPrefix, L""); + break; + } + } + } + } + + return sStatus; + } + + std::wstring ExecuteCommand(const std::wstring& sArgs) + { + std::wstring sResult = L""; + + std::wstring sCommand = m_sVbmPath + L" " + sArgs; + +#ifdef WIN32 + std::array aBuffer; + FILE* pipe = _wpopen(sCommand.c_str(), L"r"); +#endif +#ifdef LINUX + std::array aBuffer; + FILE* pipe = popen(U_TO_UTF8(sCommand).c_str(), "r"); +#endif + if (!pipe) + return sResult; + +#ifdef WIN32 + while ( fgetws(aBuffer.data(), 128, pipe) != NULL ) + { + sResult += aBuffer.data(); + } +#endif +#ifdef LINUX + while ( fgets(aBuffer.data(), 128, pipe) != NULL ) + { + std::string sBuf = aBuffer.data(); + sResult += UTF8_TO_U(sBuf); + } +#endif + + return sResult; + } + + std::wstring BoolToStr(bool bResult) + { + return bResult ? L"OK" : L"ERROR"; + } +}; + +// Main +#ifdef WIN32 +int wmain(int argc, wchar_t** argv) +#else +int main(int argc, char** argv) +#endif +{ + // Test + CVirtualBox oTester; + oTester.InitVms(); + + if ( !oTester.IsConfigExists() ) + { + oTester.CreateConfig(); + return 0; + } + oTester.ReadConfig(); + + oTester.RemoveReport(); + oTester.CreateReport(); + + std::vector arrStartVms = oTester.GetStartVms(); + + for (size_t i = 0; i < arrStartVms.size(); i++) + { + CVm* pVm = arrStartVms[i]; + std::wstring sGuid = pVm->m_sGuid; + std::wstring sName = pVm->m_sName; + + oTester.SetVm(pVm); + + oTester.StartVm(); + oTester.WaitLoadVm(); + + oTester.CreateWorkingDir(); + oTester.CopyScripts(); + oTester.DownloadDistrib(); + + bool bPassed = false; + if ( oTester.IsReadyReset() ) + { + oTester.ResetVm(); + oTester.WaitLoadVm(); + + if ( oTester.WaitInstall() ) + { + oTester.RunEditors(); + oTester.WaitStdout(); + + if ( oTester.IsEditorsRunned() ) + { + oTester.SaveScreenshot(); + bPassed = true; + } + } + } + + oTester.WriteReport(bPassed ? L"PASSED\n" : L"FAILED\n"); + + oTester.RemoveScripts(); + oTester.StopVm(); + } + + return 0; +} diff --git a/DesktopEditor/vboxtester/vboxtester.pro b/DesktopEditor/vboxtester/vboxtester.pro new file mode 100644 index 0000000000..90d1a6fcdc --- /dev/null +++ b/DesktopEditor/vboxtester/vboxtester.pro @@ -0,0 +1,26 @@ +TEMPLATE = app +CONFIG += console +CONFIG -= app_bundle +CONFIG -= qt + +CORE_ROOT_DIR = $$PWD/../.. +PWD_ROOT_DIR = $$PWD + +include($$CORE_ROOT_DIR/Common/base.pri) +include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri) + +DESTDIR = $$CORE_BUILDS_BINARY_PATH + +TARGET = vboxtester + +ADD_DEPENDENCY(kernel, kernel_network, UnicodeConverter) + +core_windows { + LIBS += -lAdvapi32 + LIBS += -lShell32 + LIBS += -lGdi32 + LIBS += -lUser32 +} + +SOURCES += main.cpp +HEADERS += help.h diff --git a/EpubFile/src/CEpubFile.cpp b/EpubFile/src/CEpubFile.cpp index 2c3bb606a1..0dc7da562b 100644 --- a/EpubFile/src/CEpubFile.cpp +++ b/EpubFile/src/CEpubFile.cpp @@ -167,7 +167,7 @@ HRESULT CEpubFile::Convert(const std::wstring& sInputFile, const std::wstring& s NSDirectory::CreateDirectory(sOutputDir); HRESULT hRes = oFile.OpenBatchHtml(arFiles, sOutputDir, &oFileParams); if (bIsOutCompress && S_OK == hRes) - oOfficeUtils.CompressFileOrDirectory(sOutputDir, sOutputFile); + hRes = oOfficeUtils.CompressFileOrDirectory(sOutputDir, sOutputFile); #ifdef _DEBUG std::wcout << L"---" << (S_OK == hRes ? L"Successful" : L"Failed") << L" conversion of Epub to Docx---" << std::endl; @@ -544,6 +544,17 @@ HRESULT CEpubFile::FromHtml(const std::wstring& sHtmlFile, const std::wstring& s } // spine & guide std::wstring sItemRef; + if (!nFile) + { + nFile = 1; + // write index.html + NSFile::CFileBinary oIndexHtml; + if (oIndexHtml.CreateFileW(m_sTempDir + L"/OEBPS/index0.html")) + { + oIndexHtml.WriteStringUTF8(sIndexHtml); + oIndexHtml.CloseFile(); + } + } for (int i = 0; i < nFile; ++i) { std::wstring sI = std::to_wstring(i); @@ -568,17 +579,6 @@ HRESULT CEpubFile::FromHtml(const std::wstring& sHtmlFile, const std::wstring& s oTocNcx.CloseFile(); } - // write index.html - if (!nFile) - { - NSFile::CFileBinary oIndexHtml; - if (oIndexHtml.CreateFileW(m_sTempDir + L"/OEBPS/index0.html")) - { - oIndexHtml.WriteStringUTF8(sIndexHtml); - oIndexHtml.CloseFile(); - } - } - // compress COfficeUtils oOfficeUtils; return oOfficeUtils.CompressFileOrDirectory(m_sTempDir, sDstFile); diff --git a/EpubFile/test/main.cpp b/EpubFile/test/main.cpp index f355fe236e..828b5ad3cc 100644 --- a/EpubFile/test/main.cpp +++ b/EpubFile/test/main.cpp @@ -18,7 +18,7 @@ int main() bool bFromHtml = false; if (bFromHtml) { - std::wstring sFile = NSFile::GetProcessDirectory() + L"/../../../Files/test.html"; + std::wstring sFile = NSFile::GetProcessDirectory() + L"/test.html"; CEpubFile oEpub; oEpub.SetTempDirectory(sTmp); oEpub.FromHtml(sFile, sOutputDirectory + L"/res.epub", L""); diff --git a/Fb2File/Fb2File.cpp b/Fb2File/Fb2File.cpp index 87ec41eb95..916acb0446 100644 --- a/Fb2File/Fb2File.cpp +++ b/Fb2File/Fb2File.cpp @@ -39,27 +39,14 @@ struct CTc } }; -// Информация об авторе книги. Тэг author, translator -struct SAuthor -{ - std::wstring first_name; - std::wstring middle_name; - std::wstring last_name; - std::wstring nickname; - /* - std::vector home_page; - std::vector email; - std::wstring id; - */ -}; - // Описание информации о произведении. Тэг title-info, src-title-info struct STitleInfo { - std::vector m_arGenres; // Жанры - std::vector m_arAuthors; // Авторы - std::wstring m_sBookTitle; // Название - std::wstring m_pKeywords; // Ключевые слова + std::wstring m_sGenres; // Жанры + std::wstring m_sAuthors; // Авторы + std::wstring m_sBookTitle; // Название + std::wstring m_sKeywords; // Ключевые слова + std::wstring m_sAnnotation;// Аннотация /* std::vector m_arTranslator; // Переводчики std::wstring m_sLang; // Язык после перевода @@ -67,61 +54,7 @@ struct STitleInfo std::pair* m_pDate; // Дата std::wstring* m_pSrcLang; // Язык до перевода std::map m_mSequence; // Серии книг - - STitleInfo() - { - m_pKeywords = NULL; - m_pDate = NULL; - m_pSrcLang = NULL; - } */ - - ~STitleInfo() - { - m_arGenres .clear(); - m_arAuthors.clear(); - /* - m_arTranslator.clear(); - m_mSequence.clear(); - RELEASEARRAYOBJECTS(m_pDate); - RELEASEARRAYOBJECTS(m_pSrcLang); - */ - } - - // Преобразование закодированного жанра - /* - static std::wstring definitionGenre(std::wstring sGenre) - { - std::wstring sRes = L""; - if(sGenre == L"sf_fantasy") - sRes = L"Фэнтези"; - return sRes; - } - */ - - // Разделитель не важен , - std::wstring getGenres() - { - std::wstring sRes = std::accumulate(m_arGenres.begin(), m_arGenres.end(), std::wstring(), - [] (std::wstring& sRes, const std::wstring& vElem) { return sRes += (vElem.empty() ? L"" : (vElem + L", ")); }); - if (!sRes.empty()) - sRes.erase(sRes.end() - 2, sRes.end()); - return sRes; - } - - // Разделитель ; - std::wstring getAuthors() - { - std::wstring sRes = std::accumulate(m_arAuthors.begin(), m_arAuthors.end(), std::wstring(), - [] (std::wstring& sRes, const SAuthor& vElem) { return sRes += - (vElem.middle_name.empty() ? L"" : (vElem.middle_name + L' ')) + - (vElem.first_name.empty() ? L"" : (vElem.first_name + L' ')) + - (vElem.last_name.empty() ? L"" : (vElem.last_name + L' ')) + - vElem.nickname + L';'; }); - if (!sRes.empty()) - sRes.erase(sRes.end() - 1); - return sRes; - } }; // Описание информации о fb2-документе. Тэг document-info @@ -227,16 +160,21 @@ public: STitleInfo m_oTitleInfo; // Данные о книге // SDocumentInfo m_oDocumentInfo; // Информация об fb2-документе // std::wstring m_sTmpFolder; // Рабочая папка + std::map> m_mImages; // Картинки + std::map m_mFootnotes; // Сноски + + NSStringUtils::CStringBuilder m_oDocXmlRels; // document.xml.rels private: int m_nContentsId; // ID содержания int m_nCrossReferenceId; // ID перекрестной ссылки + int m_nHyperlinkId; // ID внешней ссылки + bool m_bFootnote; // Чтение Footnote из html + bool m_bInP; + bool m_bInTable; // STitleInfo* m_pSrcTitleInfo; // Данные об исходнике книги // SPublishInfo* m_pPublishInfo; // Сведения об издании книги - - std::map m_mFootnotes; // Сноски - std::map> m_mImages; // Картинки // std::map m_mCustomInfo; // Произвольная информация public: @@ -246,6 +184,10 @@ public: // m_pPublishInfo = NULL; m_nContentsId = 1; m_nCrossReferenceId = 1; + m_nHyperlinkId = 1; + m_bFootnote = false; + m_bInP = false; + m_bInTable = false; } ~CFb2File_Private() @@ -276,37 +218,6 @@ public: return m_oLightReader.ReadNextNode() && m_oLightReader.GetName() == L"FictionBook"; } - // Читает поля автора - void getAuthor(std::vector& arAuthor) - { - if (m_oLightReader.IsEmptyNode()) - return; - - SAuthor oAuthor; - int nDepth = m_oLightReader.GetDepth(); - while (m_oLightReader.ReadNextSiblingNode(nDepth)) - { - std::wstring sName = m_oLightReader.GetName(); - if (sName == L"first-name") - oAuthor.first_name = content(); - else if (sName == L"middle-name") - oAuthor.middle_name = content(); - else if (sName == L"last-name") - oAuthor.last_name = content(); - else if (sName == L"nickname") - oAuthor.nickname = content(); - /* - else if(sName == L"home-page") - oAuthor.home_page.push_back(content()); - else if(sName == L"email") - oAuthor.email.push_back(content()); - else if(sName == L"id") - oAuthor.id = content(); - */ - } - arAuthor.push_back(oAuthor); - } - // Читает image // НЕ имеет право писать p void readImage(NSStringUtils::CStringBuilder& oBuilder) @@ -481,8 +392,9 @@ public: // Читаем ссылку else if (sName == L"a") { + bool bCross = true; // Читаем href - std::wstring sFootnoteName; + std::wstring sRef; while (m_oLightReader.MoveToNextAttribute()) { std::wstring sTName = m_oLightReader.GetName(); @@ -490,33 +402,62 @@ public: if (sTName.substr(nLen) == L"href") { std::wstring sText = m_oLightReader.GetText(); - if (sText.length() > 1) - sFootnoteName = sText.substr(1); + size_t nRef = sText.find('#'); + if (nRef != 0) + { + bCross = false; + sRef = sText; + } + else if (sText.length() > 1) + sRef = sText.substr(1); break; } } m_oLightReader.MoveToElement(); - std::map::iterator it = m_mFootnotes.find(sFootnoteName); - if (it != m_mFootnotes.end()) + if (bCross) { - // Пробел перед текстом внутри сноски - oBuilder += L" "; - // Читаем текст внутри сноски - readP(sRStyle, oBuilder); - // Стиль сноски - oBuilder += L"second; - oBuilder += L"\"/>"; + std::map::iterator it = m_mFootnotes.find(sRef); + if (it != m_mFootnotes.end()) + { + // Пробел перед текстом внутри сноски + oBuilder += L" "; + // Читаем текст внутри сноски + readP(sRStyle, oBuilder); + // Стиль сноски + oBuilder += L"second; + oBuilder += L"\"/>"; + } + // Перекрестная ссылка + else + { + oBuilder += L""; + // Читаем текст внутри ссылки + readP(sRStyle + L"", oBuilder); + oBuilder += L""; + } } - // Перекрестная ссылка else { - oBuilder += L""; + // Пишем рельсы + m_oDocXmlRels.WriteString(L""); + + // Пишем в document.xml + oBuilder.WriteString(L""); + // Читаем текст внутри ссылки - readP(sRStyle + L"", oBuilder); + readP(sRStyle, oBuilder); oBuilder += L""; } } @@ -749,6 +690,30 @@ public: oBuilder += L""; } + void readAnnotationFromDescription(NSStringUtils::CStringBuilder& oBuilder) + { + if (m_oLightReader.IsEmptyNode()) + return; + + int nADeath = m_oLightReader.GetDepth(); + while (m_oLightReader.ReadNextSiblingNode2(nADeath)) + { + std::wstring sAnName = m_oLightReader.GetName(); + if (sAnName == L"#text") + m_oTitleInfo.m_sAnnotation += ((m_oTitleInfo.m_sAnnotation.empty() ? L"" : L" ") + m_oLightReader.GetText()); + else if (sAnName == L"image") + { + oBuilder += L""; + readImage(oBuilder); + oBuilder += L""; + } + else if (sAnName == L"table") + readTable(oBuilder); + else + readAnnotationFromDescription(oBuilder); + } + } + // Читает annotation void readAnnotation(NSStringUtils::CStringBuilder& oBuilder) { @@ -880,7 +845,7 @@ public: } // Читает содержание, binary, body, сноски, description - bool readText(const std::wstring& sPath, const std::wstring& sMediaDirectory, NSStringUtils::CStringBuilder& oContents, NSStringUtils::CStringBuilder& oRels, NSStringUtils::CStringBuilder& oFootnotes) + bool readText(const std::wstring& sPath, const std::wstring& sMediaDirectory, NSStringUtils::CStringBuilder& oContents, NSStringUtils::CStringBuilder& oFootnotes) { if (!m_oLightReader.IsValid()) { @@ -925,7 +890,7 @@ public: } // Читаем картинки else if (sName == L"binary") - getImage(std::to_wstring(nImageId++), sMediaDirectory, oRels); + getImage(std::to_wstring(nImageId++), sMediaDirectory); } oContents += L""; return true; @@ -1082,7 +1047,7 @@ public: } // Читает binary - void getImage(const std::wstring& sImageId, const std::wstring& sMediaDirectory, NSStringUtils::CStringBuilder& oRels) + void getImage(const std::wstring& sImageId, const std::wstring& sMediaDirectory) { std::wstring sId, sType = L".png"; while (m_oLightReader.MoveToNextAttribute()) @@ -1145,11 +1110,11 @@ public: m_mImages.insert(std::make_pair(sId, vImage)); // Запись картинок в рельсы - oRels += L""; + m_oDocXmlRels += L""; } } @@ -1164,7 +1129,7 @@ public: { // Читаем title-info if (m_oLightReader.GetName() == L"title-info") - getTitleInfo(m_oTitleInfo, oBuilder); + getTitleInfo(oBuilder); /* // Читаем src-title-info (ноль или один) else if(sName == L"src-title-info") @@ -1326,7 +1291,7 @@ public: */ // Читает title-info и src-title-info - void getTitleInfo(STitleInfo& oTitleInfo, NSStringUtils::CStringBuilder& oBuilder) + void getTitleInfo(NSStringUtils::CStringBuilder& oBuilder) { if (m_oLightReader.IsEmptyNode()) return; @@ -1336,7 +1301,7 @@ public: { std::wstring sName = m_oLightReader.GetName(); if (sName == L"annotation") - readAnnotation(oBuilder); + readAnnotationFromDescription(oBuilder); else if (sName == L"coverpage") { if (m_oLightReader.IsEmptyNode()) @@ -1354,14 +1319,48 @@ public: } } else if (sName == L"genre") - oTitleInfo.m_arGenres.push_back(content()); + { + std::wstring sGenre = content(); + m_oTitleInfo.m_sGenres += ((m_oTitleInfo.m_sGenres.empty() ? L"" : L", ") + sGenre); + } + // Читает поля автора else if (sName == L"author") - getAuthor(oTitleInfo.m_arAuthors); + { + std::wstring sFirstName, sMiddleName, sLastName, sNickname; + int nDepth = m_oLightReader.GetDepth(); + while (m_oLightReader.ReadNextSiblingNode(nDepth)) + { + std::wstring sName = m_oLightReader.GetName(); + if (sName == L"first-name") + sFirstName = content(); + else if (sName == L"middle-name") + sMiddleName = content(); + else if (sName == L"last-name") + sLastName = content(); + else if (sName == L"nickname") + sNickname = content(); + /* + else if(sName == L"home-page") + oAuthor.home_page.push_back(content()); + else if(sName == L"email") + oAuthor.email.push_back(content()); + else if(sName == L"id") + oAuthor.id = content(); + */ + } + + m_oTitleInfo.m_sAuthors += + ((m_oTitleInfo.m_sAuthors.empty() ? L"" : L";") + + (sLastName.empty() ? L"" : (sLastName + L' ')) + + (sFirstName.empty() ? L"" : (sFirstName + L' ')) + + (sMiddleName.empty() ? L"" : (sMiddleName + L' ')) + + sNickname); + } else if (sName == L"book-title") - oTitleInfo.m_sBookTitle = content(); + m_oTitleInfo.m_sBookTitle = content(); // Читаем keywords (ноль или один) else if(sName == L"keywords") - oTitleInfo.m_pKeywords = content(); + m_oTitleInfo.m_sKeywords = content(); /* // Читаем date (ноль или один) else if(sName == L"date") @@ -1425,6 +1424,445 @@ public: return m_oLightReader.GetTextA(); return ""; } + + std::wstring GenerateUUID() + { + std::mt19937 oRand(time(0)); + std::wstringstream sstream; + sstream << std::setfill(L'0') << std::hex << std::setw(8) << (oRand() & 0xffffffff); + sstream << L'-'; + sstream << std::setfill(L'0') << std::hex << std::setw(4) << (oRand() & 0xffff); + sstream << L'-'; + sstream << std::setfill(L'0') << std::hex << std::setw(4) << (oRand() & 0xffff); + sstream << L'-'; + sstream << std::setfill(L'0') << std::hex << std::setw(4) << (oRand() & 0xffff); + sstream << L'-'; + sstream << std::setfill(L'0') << std::hex << std::setw(8) << (oRand() & 0xffffffff); + return sstream.str(); + } + + // html -> fb2 + + void readStream(NSStringUtils::CStringBuilder& oXml) + { + int nDepth = m_oLightReader.GetDepth(); + if (m_oLightReader.IsEmptyNode() || !m_oLightReader.ReadNextSiblingNode2(nDepth)) + return; + do + { + std::wstring sName = m_oLightReader.GetName(); + if (sName == L"#text") + oXml.WriteEncodeXmlString(m_oLightReader.GetText()); + else if (sName == L"br" && !m_bInTable) + { + if (m_bInP) + oXml.WriteString(L"

"); + else + oXml.WriteString(L"

"); + } + else if (sName == L"div") + { + std::wstring sFootnoteName; + NSStringUtils::CStringBuilder oFootnote; + while (m_oLightReader.MoveToNextAttribute()) + { + std::wstring sAtrName = m_oLightReader.GetName(); + std::wstring sAtrText = m_oLightReader.GetText(); + if (sAtrName == L"style" && sAtrText == L"mso-element:footnote") + m_bFootnote = true; + else if (sAtrName == L"id") + sFootnoteName = sAtrText; + } + m_oLightReader.MoveToElement(); + if (m_bFootnote && !sFootnoteName.empty()) + { + readStream(oFootnote); + m_mFootnotes.insert(std::make_pair(sFootnoteName, oFootnote.GetData())); + m_bFootnote = false; + } + else + readStream(oXml); + } + else if (sName == L"p") + { + if (!m_bInTable && !m_bInP) + { + oXml.WriteString(L"

"); + m_bInP = true; + } + readStream(oXml); + if (!m_bInTable && m_bInP) + { + oXml.WriteString(L"

"); + m_bInP = false; + } + } + else if (sName == L"title") + { + m_oTitleInfo.m_sBookTitle = EncodeXmlString(m_oLightReader.GetText2()); + } + else if (sName == L"meta") + { + std::wstring sAtrName, sAtrContent; + while (m_oLightReader.MoveToNextAttribute()) + { + std::wstring sAtr = m_oLightReader.GetName(); + if (sAtr == L"name") + sAtrName = m_oLightReader.GetText(); + else if (sAtr == L"content") + sAtrContent = m_oLightReader.GetText(); + } + m_oLightReader.MoveToElement(); + + if (!sAtrName.empty()) + { + if (sAtrName == L"creator") + m_oTitleInfo.m_sAuthors = EncodeXmlString(sAtrContent); + else if (sAtrName == L"description") + m_oTitleInfo.m_sAnnotation = EncodeXmlString(sAtrContent); + else if (sAtrName == L"subject") + m_oTitleInfo.m_sGenres = EncodeXmlString(sAtrContent); + else if (sAtrName == L"keywords") + m_oTitleInfo.m_sKeywords = EncodeXmlString(sAtrContent); + } + } + else if (sName == L"h1") + { + if (!m_bInTable) + oXml.WriteString(L"
<p>"); + m_bInP = true; + readStream(oXml); + m_bInP = false; + if (!m_bInTable) + oXml.WriteString(L"</p>
"); + } + else if (sName == L"h2") + { + if (!m_bInTable) + oXml.WriteString(L"
<p>"); + m_bInP = true; + readStream(oXml); + m_bInP = false; + if (!m_bInTable) + oXml.WriteString(L"</p>
"); + } + else if (sName == L"h3") + { + if (!m_bInTable) + oXml.WriteString(L"
<p>"); + m_bInP = true; + readStream(oXml); + m_bInP = false; + if (!m_bInTable) + oXml.WriteString(L"</p>
"); + } + else if (sName == L"h4") + { + if (!m_bInTable) + oXml.WriteString(L"
<p>"); + m_bInP = true; + readStream(oXml); + m_bInP = false; + if (!m_bInTable) + oXml.WriteString(L"</p>
"); + } + else if (sName == L"h5") + { + if (!m_bInTable) + oXml.WriteString(L"
<p>"); + m_bInP = true; + readStream(oXml); + m_bInP = false; + if (!m_bInTable) + oXml.WriteString(L"</p>
"); + } + else if (sName == L"h6") + { + if (!m_bInTable) + oXml.WriteString(L"
<p>"); + m_bInP = true; + readStream(oXml); + m_bInP = false; + if (!m_bInTable) + oXml.WriteString(L"</p>
"); + } + else if (sName == L"span") + { + std::wstring sStyle; + while (m_oLightReader.MoveToNextAttribute()) + if (m_oLightReader.GetName() == L"style") + sStyle = m_oLightReader.GetText(); + m_oLightReader.MoveToElement(); + + std::wstring sAlign; + size_t nAlign = sStyle.find(L"vertical-align"); + if (nAlign != std::wstring::npos) + { + nAlign = sStyle.find(L':', nAlign); + size_t nAlignEnd = sStyle.find(L';', nAlign); + sAlign = sStyle.substr(nAlign + 1, (nAlignEnd < sStyle.length() ? nAlignEnd : sStyle.length()) - nAlign); + if (sAlign == L"super") + { + oXml.WriteString(L""); + readStream(oXml); + oXml.WriteString(L""); + } + else if (sAlign == L"sub") + { + oXml.WriteString(L""); + readStream(oXml); + oXml.WriteString(L""); + } + else + readStream(oXml); + } + else + readStream(oXml); + } + else if (sName == L"s") + { + oXml.WriteString(L""); + readStream(oXml); + oXml.WriteString(L""); + } + else if (sName == L"i") + { + oXml.WriteString(L""); + readStream(oXml); + oXml.WriteString(L""); + } + else if (sName == L"b") + { + oXml.WriteString(L""); + readStream(oXml); + oXml.WriteString(L""); + } + else if (sName == L"table") + { + oXml.WriteString(L""); + m_bInTable = true; + readStream(oXml); + oXml.WriteString(L"
"); + m_bInTable = false; + } + else if (sName == L"tr") + { + oXml.WriteString(L""); + readStream(oXml); + oXml.WriteString(L""); + } + else if (sName == L"td" || sName == L"th") + { + oXml.WriteString(L""); + readStream(oXml); + oXml.WriteString(L""); + } + else if (sName == L"a") + { + bool bFootnote = false; + oXml.WriteString(L""); + + readStream(oXml); + oXml.WriteString(L""); + } + else if (sName == L"ul") + readLi(oXml, true); + else if (sName == L"ol") + readLi(oXml, false); + else if (sName == L"img") + { + std::wstring sId, sBinary; + while (m_oLightReader.MoveToNextAttribute()) + { + if (m_oLightReader.GetName() == L"src") + { + sBinary = m_oLightReader.GetText(); + sBinary.erase(0, sBinary.find(L',') + 1); + std::vector vImage; + vImage.push_back(sBinary); + sId = std::to_wstring(m_mImages.size() + 1); + m_mImages.insert(std::make_pair(sId, vImage)); + } + } + m_oLightReader.MoveToElement(); + oXml.WriteString(L""); + } + else + readStream(oXml); + } while (m_oLightReader.ReadNextSiblingNode2(nDepth)); + } + + void readLi(NSStringUtils::CStringBuilder& oXml, bool bUl) + { + int nNum = 1; + while (m_oLightReader.MoveToNextAttribute()) + if (m_oLightReader.GetName() == L"start") + nNum = std::stoi(m_oLightReader.GetText()); + m_oLightReader.MoveToElement(); + int nDeath = m_oLightReader.GetDepth(); + if (m_oLightReader.IsEmptyNode() || !m_oLightReader.ReadNextSiblingNode2(nDeath)) + return; + do + { + if (m_oLightReader.GetName() == L"li") + { + if (!m_bInP) + oXml.WriteString(L"

"); + m_bInP = true; + if (bUl) + oXml.AddCharSafe(183); + else + { + std::wstring sPoint = std::to_wstring(nNum) + L'.'; + while (m_oLightReader.MoveToNextAttribute()) + { + if (m_oLightReader.GetName() == L"style") + { + std::wstring sText = m_oLightReader.GetText(); + size_t nListType = sText.find(L"list-style-type: "); + if (nListType != std::wstring::npos) + { + nListType += 17; + size_t nListTypeEnd = sText.find(L';', nListType); + std::wstring sListType = sText.substr(nListType, nListTypeEnd - nListType); + if (sListType == L"decimal") + break; + else if (sListType == L"upper-alpha") + sPoint = std::wstring((nNum - 1) / 26 + 1, L'A' + (nNum - 1) % 26); + else if (sListType == L"lower-alpha") + sPoint = std::wstring((nNum - 1) / 26 + 1, L'a' + (nNum - 1) % 26); + else if (sListType == L"lower-roman") + sPoint = ToLowerRoman(nNum); + else if (sListType == L"upper-roman") + sPoint = ToUpperRoman(nNum); + sPoint += L'.'; + } + } + } + m_oLightReader.MoveToElement(); + + nNum++; + oXml.WriteString(sPoint); + } + oXml.WriteString(L" "); + readStream(oXml); + if (m_bInP) + oXml.WriteString(L"

"); + m_bInP = false; + } + } while (m_oLightReader.ReadNextSiblingNode2(nDeath)); + } + + void readTitleInfo(NSStringUtils::CStringBuilder& oTitleInfo) + { + if (!m_oTitleInfo.m_sBookTitle.empty()) + { + oTitleInfo.WriteString(L""); + oTitleInfo.WriteString(m_oTitleInfo.m_sBookTitle); + oTitleInfo.WriteString(L""); + } + if (!m_oTitleInfo.m_sAuthors.empty()) + { + oTitleInfo.WriteString(L""); + oTitleInfo.WriteString(m_oTitleInfo.m_sAuthors); + oTitleInfo.WriteString(L""); + } + if (!m_oTitleInfo.m_sGenres.empty()) + { + oTitleInfo.WriteString(L""); + oTitleInfo.WriteString(m_oTitleInfo.m_sGenres); + oTitleInfo.WriteString(L""); + } + if (!m_oTitleInfo.m_sKeywords.empty()) + { + oTitleInfo.WriteString(L""); + oTitleInfo.WriteString(m_oTitleInfo.m_sKeywords); + oTitleInfo.WriteString(L""); + } + if (!m_oTitleInfo.m_sAnnotation.empty()) + { + oTitleInfo.WriteString(L"

"); + oTitleInfo.WriteString(m_oTitleInfo.m_sAnnotation); + oTitleInfo.WriteString(L"

"); + } + } + + std::wstring ToUpperRoman(int number) + { + if (number < 0 || number > 3999) return L""; + if (number < 1) return L""; + if (number >= 1000) return L"M" + ToUpperRoman(number - 1000); + if (number >= 900) return L"CM" + ToUpperRoman(number - 900); + if (number >= 500) return L"D" + ToUpperRoman(number - 500); + if (number >= 400) return L"CD" + ToUpperRoman(number - 400); + if (number >= 100) return L"C" + ToUpperRoman(number - 100); + if (number >= 90) return L"XC" + ToUpperRoman(number - 90); + if (number >= 50) return L"L" + ToUpperRoman(number - 50); + if (number >= 40) return L"XL" + ToUpperRoman(number - 40); + if (number >= 10) return L"X" + ToUpperRoman(number - 10); + if (number >= 9) return L"IX" + ToUpperRoman(number - 9); + if (number >= 5) return L"V" + ToUpperRoman(number - 5); + if (number >= 4) return L"IV" + ToUpperRoman(number - 4); + if (number >= 1) return L"I" + ToUpperRoman(number - 1); + return L""; + } + + std::wstring ToLowerRoman(int number) + { + if (number < 0 || number > 3999) return L""; + if (number < 1) return L""; + if (number >= 1000) return L"m" + ToLowerRoman(number - 1000); + if (number >= 900) return L"cm" + ToLowerRoman(number - 900); + if (number >= 500) return L"d" + ToLowerRoman(number - 500); + if (number >= 400) return L"cd" + ToLowerRoman(number - 400); + if (number >= 100) return L"c" + ToLowerRoman(number - 100); + if (number >= 90) return L"xc" + ToLowerRoman(number - 90); + if (number >= 50) return L"l" + ToLowerRoman(number - 50); + if (number >= 40) return L"xl" + ToLowerRoman(number - 40); + if (number >= 10) return L"x" + ToLowerRoman(number - 10); + if (number >= 9) return L"ix" + ToLowerRoman(number - 9); + if (number >= 5) return L"v" + ToLowerRoman(number - 5); + if (number >= 4) return L"iv" + ToLowerRoman(number - 4); + if (number >= 1) return L"i" + ToLowerRoman(number - 1); + return L""; + } }; CFb2File::CFb2File() @@ -1470,14 +1908,14 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory oFootnotes += L""; // Создаем рельсы - NSStringUtils::CStringBuilder oRels; - oRels += L""; - oRels += L""; - oRels += L""; - oRels += L""; - oRels += L""; - oRels += L""; - oRels += L""; + //NSStringUtils::CStringBuilder oRels; + m_internal->m_oDocXmlRels += L""; + m_internal->m_oDocXmlRels += L""; + m_internal->m_oDocXmlRels += L""; + m_internal->m_oDocXmlRels += L""; + m_internal->m_oDocXmlRels += L""; + m_internal->m_oDocXmlRels += L""; + m_internal->m_oDocXmlRels += L""; // Директория картинок std::wstring sMediaDirectory = sDirectory + L"/word/media"; @@ -1491,7 +1929,7 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory bool bNeedContents = false; if (oParams) bNeedContents = oParams->bNeedContents; - if (!m_internal->readText(sPath, sMediaDirectory, oContents, oRels, oFootnotes)) + if (!m_internal->readText(sPath, sMediaDirectory, oContents, oFootnotes)) return S_FALSE; // Переходим в начало @@ -1547,16 +1985,6 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory oDocumentXmlWriter.CloseFile(); } - // Конец рельсов - oRels += L""; - // Пишем рельсы в файл - NSFile::CFileBinary oRelsWriter; - if (oRelsWriter.CreateFileW(sDirectory + L"/word/_rels/document.xml.rels")) - { - oRelsWriter.WriteStringUTF8(oRels.GetData()); - oRelsWriter.CloseFile(); - } - // Директория app и core std::wstring sDocPropsDirectory = sDirectory + L"/docProps"; NSDirectory::CreateDirectory(sDocPropsDirectory); @@ -1567,19 +1995,33 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory oCore += L""; oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.m_sBookTitle)); // Жанры - oCore += L""; - oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.getGenres())); + oCore.WriteString(L""); + if (!m_internal->m_oTitleInfo.m_sGenres.empty()) + { + oCore.WriteString(L""); + oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.m_sGenres)); + oCore.WriteString(L""); + } // Авторы - oCore += L""; - oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.getAuthors())); - oCore.WriteString(L""); + if (!m_internal->m_oTitleInfo.m_sAuthors.empty()) + { + oCore.WriteString(L""); + oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.m_sAuthors)); + oCore.WriteString(L""); + } // Ключевые слова - if (!m_internal->m_oTitleInfo.m_pKeywords.empty()) + if (!m_internal->m_oTitleInfo.m_sKeywords.empty()) { oCore.WriteString(L""); - oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.m_pKeywords)); + oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.m_sKeywords)); oCore.WriteString(L""); } + if (!m_internal->m_oTitleInfo.m_sAnnotation.empty()) + { + oCore.WriteString(L""); + oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.m_sAnnotation)); + oCore.WriteString(L""); + } // Конец core oCore += L"1"; // Пишем core в файл @@ -1612,6 +2054,16 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory oAppWriter.CloseFile(); } + // Конец рельсов + m_internal->m_oDocXmlRels += L""; + // Пишем рельсы в файл + NSFile::CFileBinary oRelsWriter; + if (oRelsWriter.CreateFileW(sDirectory + L"/word/_rels/document.xml.rels")) + { + oRelsWriter.WriteStringUTF8(m_internal->m_oDocXmlRels.GetData()); + oRelsWriter.CloseFile(); + } + // Архивим в docx bool bNeedDocx = false; if (oParams) @@ -1624,363 +2076,7 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory return S_OK; } -void readLi(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuilder& oTitleInfo, XmlUtils::CXmlLiteReader& oIndexHtml, std::vector& arrBinary, bool bUl, bool bWasP, bool bWasTable); -void readStream(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuilder& oTitleInfo, XmlUtils::CXmlLiteReader& oIndexHtml, std::vector& arrBinary, bool bWasP, bool bWasTable) -{ - int nDepth = oIndexHtml.GetDepth(); - if (oIndexHtml.IsEmptyNode() || !oIndexHtml.ReadNextSiblingNode2(nDepth)) - return; - do - { - std::wstring sName = oIndexHtml.GetName(); - if (sName == L"#text") - oXml.WriteEncodeXmlString(oIndexHtml.GetText()); - else if (sName == L"p") - { - if (!bWasP) - oXml.WriteString(L"

"); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasTable); - if (!bWasP) - oXml.WriteString(L"

"); - } - else if (sName == L"title") - { - oTitleInfo.WriteString(L""); - oTitleInfo.WriteString(EncodeXmlString(oIndexHtml.GetText2())); - oTitleInfo.WriteString(L""); - } - else if (sName == L"meta") - { - std::wstring sAtrName, sAtrContent; - while (oIndexHtml.MoveToNextAttribute()) - { - std::wstring sAtr = oIndexHtml.GetName(); - if (sAtr == L"name") - sAtrName = oIndexHtml.GetText(); - else if (sAtr == L"content") - sAtrContent = oIndexHtml.GetText(); - } - oIndexHtml.MoveToElement(); - - if (!sAtrName.empty()) - { - if (sAtrName == L"creator") - { - oTitleInfo.WriteString(L""); - oTitleInfo.WriteString(EncodeXmlString(sAtrContent)); - oTitleInfo.WriteString(L""); - } - else if (sAtrName == L"description") - { - oTitleInfo.WriteString(L"

"); - oTitleInfo.WriteString(EncodeXmlString(sAtrContent)); - oTitleInfo.WriteString(L"

"); - } - else if (sAtrName == L"subject") - { - oTitleInfo.WriteString(L""); - oTitleInfo.WriteString(EncodeXmlString(sAtrContent)); - oTitleInfo.WriteString(L""); - } - else if (sAtrName == L"keywords") - { - oTitleInfo.WriteString(L""); - oTitleInfo.WriteString(EncodeXmlString(sAtrContent)); - oTitleInfo.WriteString(L""); - } - } - } - else if (sName == L"h1") - { - if (!bWasP) - oXml.WriteString(L"
<p>"); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasTable); - if (!bWasP) - oXml.WriteString(L"</p>
"); - } - else if (sName == L"h2") - { - if (!bWasP) - oXml.WriteString(L"
<p>"); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasTable); - if (!bWasP) - oXml.WriteString(L"</p>
"); - } - else if (sName == L"h3") - { - if (!bWasP) - oXml.WriteString(L"
<p>"); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasTable); - if (!bWasP) - oXml.WriteString(L"</p>
"); - } - else if (sName == L"h4") - { - if (!bWasP) - oXml.WriteString(L"
<p>"); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasTable); - if (!bWasP) - oXml.WriteString(L"</p>
"); - } - else if (sName == L"h5") - { - if (!bWasP) - oXml.WriteString(L"
<p>"); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasTable); - if (!bWasP) - oXml.WriteString(L"</p>
"); - } - else if (sName == L"h6") - { - if (!bWasP) - oXml.WriteString(L"
<p>"); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasTable); - if (!bWasP) - oXml.WriteString(L"</p>
"); - } - else if (sName == L"span") - { - std::wstring sStyle; - while (oIndexHtml.MoveToNextAttribute()) - if (oIndexHtml.GetName() == L"style") - sStyle = oIndexHtml.GetText(); - oIndexHtml.MoveToElement(); - - std::wstring sAlign; - size_t nAlign = sStyle.find(L"vertical-align"); - if (nAlign != std::wstring::npos) - { - nAlign = sStyle.find(L':', nAlign); - size_t nAlignEnd = sStyle.find(L';', nAlign); - sAlign = sStyle.substr(nAlign + 1, (nAlignEnd < sStyle.length() ? nAlignEnd : sStyle.length()) - nAlign); - if (sAlign == L"super") - { - oXml.WriteString(L""); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - oXml.WriteString(L""); - } - else if (sAlign == L"sub") - { - oXml.WriteString(L""); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - oXml.WriteString(L""); - } - else - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - } - else - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - } - else if (sName == L"s") - { - oXml.WriteString(L""); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - oXml.WriteString(L""); - } - else if (sName == L"i") - { - oXml.WriteString(L""); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - oXml.WriteString(L""); - } - else if (sName == L"b") - { - oXml.WriteString(L""); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - oXml.WriteString(L""); - } - else if (sName == L"table") - { - if (!bWasTable) - oXml.WriteString(L""); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - if (!bWasTable) - oXml.WriteString(L"
"); - } - else if (sName == L"tr") - { - if (!bWasTable) - oXml.WriteString(L""); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - if (!bWasTable) - oXml.WriteString(L""); - } - else if (sName == L"td" || sName == L"th") - { - if (!bWasTable) - { - oXml.WriteString(L""); - } - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, true); - if (!bWasTable) - oXml.WriteString(L""); - } - else if (sName == L"a") - { - oXml.WriteString(L""); - - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - oXml.WriteString(L""); - } - else if (sName == L"ul") - readLi(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasP, bWasTable); - else if (sName == L"ol") - readLi(oXml, oTitleInfo, oIndexHtml, arrBinary, false, bWasP, bWasTable); - else if (sName == L"img") - { - std::wstring sBinary; - while (oIndexHtml.MoveToNextAttribute()) - { - if (oIndexHtml.GetName() == L"src") - { - sBinary = oIndexHtml.GetText(); - sBinary.erase(0, sBinary.find(L',') + 1); - arrBinary.push_back(sBinary); - } - } - oIndexHtml.MoveToElement(); - oXml.WriteString(L""); - } - else - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, bWasP, bWasTable); - } while (oIndexHtml.ReadNextSiblingNode2(nDepth)); -} - -std::wstring ToUpperRoman(int number) -{ - if (number < 0 || number > 3999) return L""; - if (number < 1) return L""; - if (number >= 1000) return L"M" + ToUpperRoman(number - 1000); - if (number >= 900) return L"CM" + ToUpperRoman(number - 900); - if (number >= 500) return L"D" + ToUpperRoman(number - 500); - if (number >= 400) return L"CD" + ToUpperRoman(number - 400); - if (number >= 100) return L"C" + ToUpperRoman(number - 100); - if (number >= 90) return L"XC" + ToUpperRoman(number - 90); - if (number >= 50) return L"L" + ToUpperRoman(number - 50); - if (number >= 40) return L"XL" + ToUpperRoman(number - 40); - if (number >= 10) return L"X" + ToUpperRoman(number - 10); - if (number >= 9) return L"IX" + ToUpperRoman(number - 9); - if (number >= 5) return L"V" + ToUpperRoman(number - 5); - if (number >= 4) return L"IV" + ToUpperRoman(number - 4); - if (number >= 1) return L"I" + ToUpperRoman(number - 1); - return L""; -} - -std::wstring ToLowerRoman(int number) -{ - if (number < 0 || number > 3999) return L""; - if (number < 1) return L""; - if (number >= 1000) return L"m" + ToLowerRoman(number - 1000); - if (number >= 900) return L"cm" + ToLowerRoman(number - 900); - if (number >= 500) return L"d" + ToLowerRoman(number - 500); - if (number >= 400) return L"cd" + ToLowerRoman(number - 400); - if (number >= 100) return L"c" + ToLowerRoman(number - 100); - if (number >= 90) return L"xc" + ToLowerRoman(number - 90); - if (number >= 50) return L"l" + ToLowerRoman(number - 50); - if (number >= 40) return L"xl" + ToLowerRoman(number - 40); - if (number >= 10) return L"x" + ToLowerRoman(number - 10); - if (number >= 9) return L"ix" + ToLowerRoman(number - 9); - if (number >= 5) return L"v" + ToLowerRoman(number - 5); - if (number >= 4) return L"iv" + ToLowerRoman(number - 4); - if (number >= 1) return L"i" + ToLowerRoman(number - 1); - return L""; -} - -void readLi(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuilder& oTitleInfo, XmlUtils::CXmlLiteReader& oIndexHtml, std::vector& arrBinary, bool bUl, bool bWasP, bool bWasTable) -{ - int nNum = 1; - while (oIndexHtml.MoveToNextAttribute()) - if (oIndexHtml.GetName() == L"start") - nNum = std::stoi(oIndexHtml.GetText()); - oIndexHtml.MoveToElement(); - int nDeath = oIndexHtml.GetDepth(); - if (oIndexHtml.IsEmptyNode() || !oIndexHtml.ReadNextSiblingNode2(nDeath)) - return; - do - { - if (oIndexHtml.GetName() == L"li") - { - if (!bWasP) - oXml.WriteString(L"

"); - if (bUl) - oXml.AddCharSafe(183); - else - { - std::wstring sPoint = std::to_wstring(nNum) + L'.'; - while (oIndexHtml.MoveToNextAttribute()) - { - if (oIndexHtml.GetName() == L"style") - { - std::wstring sText = oIndexHtml.GetText(); - size_t nListType = sText.find(L"list-style-type: "); - if (nListType != std::wstring::npos) - { - nListType += 17; - size_t nListTypeEnd = sText.find(L';', nListType); - std::wstring sListType = sText.substr(nListType, nListTypeEnd - nListType); - if (sListType == L"decimal") - break; - else if (sListType == L"upper-alpha") - sPoint = std::wstring((nNum - 1) / 26 + 1, L'A' + (nNum - 1) % 26); - else if (sListType == L"lower-alpha") - sPoint = std::wstring((nNum - 1) / 26 + 1, L'a' + (nNum - 1) % 26); - else if (sListType == L"lower-roman") - sPoint = ToLowerRoman(nNum); - else if (sListType == L"upper-roman") - sPoint = ToUpperRoman(nNum); - sPoint += L'.'; - } - } - } - oIndexHtml.MoveToElement(); - - nNum++; - oXml.WriteString(sPoint); - } - oXml.WriteString(L" "); - readStream(oXml, oTitleInfo, oIndexHtml, arrBinary, true, bWasTable); - if (!bWasP) - oXml.WriteString(L"

"); - } - } while (oIndexHtml.ReadNextSiblingNode2(nDeath)); -} - -std::wstring GenerateUUID() -{ - std::mt19937 oRand(time(0)); - std::wstringstream sstream; - sstream << std::setfill(L'0') << std::hex << std::setw(8) << (oRand() & 0xffffffff); - sstream << L'-'; - sstream << std::setfill(L'0') << std::hex << std::setw(4) << (oRand() & 0xffff); - sstream << L'-'; - sstream << std::setfill(L'0') << std::hex << std::setw(4) << (oRand() & 0xffff); - sstream << L'-'; - sstream << std::setfill(L'0') << std::hex << std::setw(4) << (oRand() & 0xffff); - sstream << L'-'; - sstream << std::setfill(L'0') << std::hex << std::setw(8) << (oRand() & 0xffffffff); - return sstream.str(); -} - +// sHtmlFile - путь к файлу html, sDst - путь к результирующему файлу fb2, sInpTitle - входящий заголовок файла HRESULT CFb2File::FromHtml(const std::wstring& sHtmlFile, const std::wstring& sDst, const std::wstring& sInpTitle) { std::wstring sTitle = sInpTitle; @@ -2008,43 +2104,51 @@ HRESULT CFb2File::FromHtml(const std::wstring& sHtmlFile, const std::wstring& sD } RELEASEARRAYOBJECTS(pData); - XmlUtils::CXmlLiteReader oIndexHtml; + //XmlUtils::CXmlLiteReader oIndexHtml; std::wstring xhtml = htmlToXhtml(sContent, bNeedConvert); - if (!oIndexHtml.FromString(xhtml)) + if (!m_internal->m_oLightReader.FromString(xhtml)) return S_FALSE; - oIndexHtml.ReadNextNode(); // html - int nDepth = oIndexHtml.GetDepth(); - oIndexHtml.ReadNextSiblingNode(nDepth); // head - oIndexHtml.ReadNextSiblingNode(nDepth); // body + m_internal->m_oLightReader.ReadNextNode(); // html + int nDepth = m_internal->m_oLightReader.GetDepth(); + m_internal->m_oLightReader.ReadNextSiblingNode(nDepth); // head + m_internal->m_oLightReader.ReadNextSiblingNode(nDepth); // body - std::vector arrBinary; + //std::vector arrBinary; NSStringUtils::CStringBuilder oDocument; - NSStringUtils::CStringBuilder oTitleInfo; - readStream(oDocument, oTitleInfo, oIndexHtml, arrBinary, false, false); + m_internal->readStream(oDocument); NSStringUtils::CStringBuilder oRes; oRes.WriteString(L""); // description title-info oRes.WriteString(L""); - std::wstring sTitleInfo = oTitleInfo.GetData(); - if (sTitleInfo.find(L"") == std::wstring::npos) - { - oRes.WriteString(L""); - oRes.WriteString(EncodeXmlString(sTitle)); - oRes.WriteString(L""); - } - oRes.WriteString(sTitleInfo); + if (m_internal->m_oTitleInfo.m_sBookTitle.empty()) + m_internal->m_oTitleInfo.m_sBookTitle = EncodeXmlString(sTitle); + NSStringUtils::CStringBuilder oTitleInfo; + m_internal->readTitleInfo(oTitleInfo); + oRes.WriteString(oTitleInfo.GetData()); oRes.WriteString(L""); // body oRes.WriteString(L"
"); oRes.WriteString(oDocument.GetData()); oRes.WriteString(L"
"); - // binary - for (size_t i = 0; i < arrBinary.size(); i++) + // notes + if (!m_internal->m_mFootnotes.empty()) { - oRes.WriteString(L""); - oRes.WriteString(arrBinary[i]); + oRes.WriteString(L""); + for (std::map::iterator i = m_internal->m_mFootnotes.begin(); i != m_internal->m_mFootnotes.end(); i++) + { + oRes.WriteString(L"
first + L"\">"); + oRes.WriteString(i->second); + oRes.WriteString(L"
"); + } + oRes.WriteString(L""); + } + // binary + for (std::map>::iterator i = m_internal->m_mImages.begin(); i != m_internal->m_mImages.end(); i++) + { + oRes.WriteString(L"first + L".png\" content-type=\"image/png\">"); + oRes.WriteString(i->second[0]); oRes.WriteString(L""); } oRes.WriteString(L"
"); diff --git a/Fb2File/test/main.cpp b/Fb2File/test/main.cpp index 92ede2307c..13dbec5a56 100644 --- a/Fb2File/test/main.cpp +++ b/Fb2File/test/main.cpp @@ -16,7 +16,7 @@ void getDirectories(const std::wstring& sDirectory, std::vector& a int main() { bool bBatchMode = false; - bool bFromHtml = true; + bool bFromHtml = false; if (bBatchMode) { // Директория файлов @@ -91,7 +91,7 @@ int main() CFb2File oFile; // Файл, который открываем - std::wstring sFile = NSFile::GetProcessDirectory() + L"/../../../examples/res.fb2"; + std::wstring sFile = NSFile::GetProcessDirectory() + L"/res.fb2"; // Директория, где будем создавать docx std::wstring sOutputDirectory = NSFile::GetProcessDirectory() + L"/res"; @@ -100,7 +100,7 @@ int main() if (bFromHtml) { - sFile = NSFile::GetProcessDirectory() + L"/../../../examples/test.html"; + sFile = NSFile::GetProcessDirectory() + L"/test.html"; oFile.FromHtml(sFile, sOutputDirectory + L"/res.fb2", L"Test Title"); return 0; } diff --git a/HtmlFile2/htmlfile2.cpp b/HtmlFile2/htmlfile2.cpp index 64d5c7f799..e60e9d6687 100644 --- a/HtmlFile2/htmlfile2.cpp +++ b/HtmlFile2/htmlfile2.cpp @@ -130,6 +130,8 @@ private: bool m_bInP; // открыт? bool m_bWasPStyle; // записан? bool m_bWasSpace; // Был пробел? + + std::map m_mFootnotes; // Сноски public: CHtmlFile2_Private() : m_nImageId(1), m_nFootnoteId(1), m_nHyperlinkId(1), m_nCrossId(1), m_nNumberingId(1), m_bInP(false), m_bWasPStyle(false), m_bWasSpace(false) @@ -999,17 +1001,63 @@ private: oTSP.sPStyle += L""; readStream(oXml, sSelectors, oTSP); } + // aside возможно использовать для сносок в epub + else if (sName == L"aside" || sName == L"div") + { + int bMsoFootnote = 0; + std::wstring sFootnoteID; + while (m_oLightReader.MoveToNextAttribute()) + { + std::wstring sAName = m_oLightReader.GetName(); + std::wstring sAText = m_oLightReader.GetText(); + if (sAName == L"epub:type" && sAText == L"footnote") + bMsoFootnote++; + else if (sAName == L"style" && sAText == L"mso-element:footnote") + bMsoFootnote++; + else if (sAName == L"id") + { + std::map::iterator it = m_mFootnotes.find(sAText); + if (it != m_mFootnotes.end()) + { + bMsoFootnote++; + sFootnoteID = it->second; + } + } + } + m_oLightReader.MoveToElement(); + if (bMsoFootnote >= 2) + { + m_oNoteXml.WriteString(L""); + readStream(&m_oNoteXml, sSelectors, oTS); + m_oNoteXml.WriteString(L""); + } + else + readStream(oXml, sSelectors, oTS); + } // С нового абзаца - else if(sName == L"article" || sName == L"header" || sName == L"div" || sName == L"blockquote" || sName == L"main" || + else if(sName == L"article" || sName == L"header" || sName == L"blockquote" || sName == L"main" || sName == L"dir" || sName == L"summary" || sName == L"footer" || sName == L"nav" || sName == L"figcaption" || sName == L"form" || - sName == L"details" || sName == L"option" || sName == L"dt" || sName == L"aside" || sName == L"p" || + sName == L"details" || sName == L"option" || sName == L"dt" || sName == L"p" || sName == L"section" || sName == L"figure" || sName == L"dl" || sName == L"legend" || sName == L"map" || - sName == L"dir" || sName == L"h1" || sName == L"h2" || sName == L"h3" || sName == L"h4" || sName == L"h5" || sName == L"h6") readStream(oXml, sSelectors, oTS); // Горизонтальная линия else if(sName == L"hr") - oXml->WriteString(L""); + { + bool bPrint = true; + for (const NSCSS::CNode& item : sSelectors) + { + if (item.m_sName == L"div" && item.m_sStyle == L"mso-element:footnote-list") + { + bPrint = false; + break; + } + } + if (bPrint) + oXml->WriteString(L""); + } // Меню // Маркированный список else if(sName == L"menu" || sName == L"ul" || sName == L"select" || sName == L"datalist") @@ -1571,12 +1619,14 @@ private: std::wstring sRef; std::wstring sAlt; bool bCross = false; + std::wstring sFootnote; while(m_oLightReader.MoveToNextAttribute()) { std::wstring sName = m_oLightReader.GetName(); + std::wstring sText = m_oLightReader.GetText(); if(sName == L"href") { - sRef = m_oLightReader.GetText(); + sRef = sText; if(sRef.find('#') != std::wstring::npos) bCross = true; } @@ -1586,18 +1636,25 @@ private: oXml->WriteString(L"WriteString(sCrossId); oXml->WriteString(L"\" w:name=\""); - oXml->WriteString(m_oLightReader.GetText()); + oXml->WriteString(sText); oXml->WriteString(L"\"/>WriteString(sCrossId); oXml->WriteString(L"\"/>"); } else if(sName == L"alt") - sAlt = m_oLightReader.GetText(); + sAlt = sText; + else if (sName == L"style" && sText.find(L"mso-footnote-id") != std::wstring::npos) + sFootnote = sText.substr(sText.rfind(L':') + 1); + else if (sName == L"epub:type" && sText.find(L"noteref")) + sFootnote = L"href"; } m_oLightReader.MoveToElement(); if(sNote.empty()) sNote = sRef; + if (bCross && sFootnote == L"href") + sFootnote = sRef.substr(sRef.find('#') + 1); + if (!m_bInP) { oXml->WriteString(L""); @@ -1645,7 +1702,21 @@ private: oXml->WriteString(L""); } if (m_bInP) + { oXml->WriteString(L"
"); + + // Сноска + if (bCross && !sFootnote.empty()) + { + std::wstring sFootnoteID = std::to_wstring(m_nFootnoteId++); + oXml->WriteString(L"WriteString(sFootnoteID); + oXml->WriteString(L"\"/>"); + + m_mFootnotes.insert(std::make_pair(sFootnote, sFootnoteID)); + } + } + sNote = L""; } diff --git a/HtmlFile2/test/main.cpp b/HtmlFile2/test/main.cpp index 35531ffbd3..eb2fb2553c 100644 --- a/HtmlFile2/test/main.cpp +++ b/HtmlFile2/test/main.cpp @@ -97,7 +97,7 @@ int main() oParams.SetDescription(L"Description"); // Файл, который открываем - std::wstring sFile = NSFile::GetProcessDirectory() + L"/../../../examples/test.html"; + std::wstring sFile = NSFile::GetProcessDirectory() + L"/test.html"; CHtmlFile2 oFile; oFile.SetTmpDirectory(sOutputDirectory); nResConvert = (bMhtMode ? oFile.OpenMht(sFile, sOutputDirectory, &oParams) : oFile.OpenHtml(sFile, sOutputDirectory, &oParams)); diff --git a/MsBinaryFile/Common/Vba/Records.cpp b/MsBinaryFile/Common/Vba/Records.cpp index ed12cfda15..180fa7636a 100644 --- a/MsBinaryFile/Common/Vba/Records.cpp +++ b/MsBinaryFile/Common/Vba/Records.cpp @@ -1014,7 +1014,7 @@ namespace VBA //} //const bool PROJECTMODULES::loadContent(BinProcessor& proc) //{ - // BiffAttributeSimple nCount; + // unsigned short nCount; // proc.nCount; diff --git a/MsBinaryFile/PptFile/Drawing/TextStructures.cpp b/MsBinaryFile/PptFile/Drawing/TextStructures.cpp index 6fafa17b27..e2a4f8094d 100644 --- a/MsBinaryFile/PptFile/Drawing/TextStructures.cpp +++ b/MsBinaryFile/PptFile/Drawing/TextStructures.cpp @@ -101,7 +101,7 @@ std::wstring PPT::CFontProperty::getXmlArgsStr() const { std::wstring str = L" typeface=\"" + Name + L"\""; if (IsValidPitchFamily(PitchFamily)) - str += L" pitchFamily=\"" + std::to_wstring(PitchFamily) + L"\""; + str += L" pitchFamily=\"" + std::to_wstring((char)PitchFamily) + L"\""; if (IsValidCharset(Charset)) str += L" charset=\"" + std::to_wstring((char)Charset) + L"\""; diff --git a/MsBinaryFile/PptFile/PPTXWriter/BulletsConverter.cpp b/MsBinaryFile/PptFile/PPTXWriter/BulletsConverter.cpp index 039e974f2f..29bf29e884 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/BulletsConverter.cpp +++ b/MsBinaryFile/PptFile/PPTXWriter/BulletsConverter.cpp @@ -221,7 +221,7 @@ void BulletsConverter::ConvertAllBullets(PPTX::Logic::TextParagraphPr &oPPr, CTe pBuFont->typeface = pPF->bulletFontProperties->Name; if ( CFontProperty::IsValidPitchFamily(pPF->bulletFontProperties->PitchFamily)) - pBuFont->pitchFamily = std::to_wstring(pPF->bulletFontProperties->PitchFamily); + pBuFont->pitchFamily = std::to_wstring((char)pPF->bulletFontProperties->PitchFamily); if ( CFontProperty::IsValidCharset(pPF->bulletFontProperties->Charset)) pBuFont->charset = std::to_wstring(pPF->bulletFontProperties->Charset); diff --git a/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.cpp b/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.cpp index e278dc1fe6..af40c0aba6 100644 --- a/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.cpp +++ b/MsBinaryFile/PptFile/PPTXWriter/ShapeWriter.cpp @@ -1430,7 +1430,7 @@ std::wstring CShapeWriter::WriteBullets(CTextPFRun *pPF, CRelsGenerator* pRels) if ( pPF->bulletFontProperties->PitchFamily > 0) { - buWrt.WriteString(std::wstring(L" pitchFamily=\"") + std::to_wstring(pPF->bulletFontProperties->PitchFamily) + L"\""); + buWrt.WriteString(std::wstring(L" pitchFamily=\"") + std::to_wstring((char)pPF->bulletFontProperties->PitchFamily) + L"\""); } if ( pPF->bulletFontProperties->Charset > 0) { diff --git a/MsBinaryFile/Projects/XlsFormatLib/Linux/XlsFormatLib.pro b/MsBinaryFile/Projects/XlsFormatLib/Linux/XlsFormatLib.pro index 701ac4a738..2b4d461d9b 100644 --- a/MsBinaryFile/Projects/XlsFormatLib/Linux/XlsFormatLib.pro +++ b/MsBinaryFile/Projects/XlsFormatLib/Linux/XlsFormatLib.pro @@ -30,7 +30,6 @@ INCLUDEPATH += ../../../XlsFile/Format INCLUDEPATH += ../../../Common INCLUDEPATH += ../../../../OOXML/XlsbFormat -!disable_precompiled_header:CONFIG += precompile_header precompile_header { PRECOMPILED_HEADER = precompiled.h HEADERS += precompiled.h diff --git a/MsBinaryFile/Projects/XlsFormatLib/Windows/XlsFormat.vcxproj b/MsBinaryFile/Projects/XlsFormatLib/Windows/XlsFormat.vcxproj index a89e62957c..025b710770 100644 --- a/MsBinaryFile/Projects/XlsFormatLib/Windows/XlsFormat.vcxproj +++ b/MsBinaryFile/Projects/XlsFormatLib/Windows/XlsFormat.vcxproj @@ -381,6 +381,20 @@ + + + + + + + + + + + + + + @@ -780,7 +794,6 @@ - @@ -1174,6 +1187,23 @@ + + + + + + + + + + + + + + + + + @@ -1580,7 +1610,6 @@ - diff --git a/MsBinaryFile/Projects/XlsFormatLib/Windows/XlsFormat.vcxproj.filters b/MsBinaryFile/Projects/XlsFormatLib/Windows/XlsFormat.vcxproj.filters index 78d845c2c8..58d4991e66 100644 --- a/MsBinaryFile/Projects/XlsFormatLib/Windows/XlsFormat.vcxproj.filters +++ b/MsBinaryFile/Projects/XlsFormatLib/Windows/XlsFormat.vcxproj.filters @@ -35,6 +35,9 @@ {73faf489-4c86-4f5b-b26b-0d51a50612ad} + + {5654e677-b95e-42da-bac5-20d259c046e2} + @@ -1105,12 +1108,6 @@ Logic\Biff_structures - - Logic\Biff_structures - - - Logic\Biff_structures - Logic\Biff_structures @@ -2218,9 +2215,6 @@ Logic\Biff_unions - - Logic\Biff_unions - Logic\Biff_unions @@ -2392,6 +2386,54 @@ Logic + + Logic\Biff_structures + + + Logic\Biff_structures + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + @@ -4599,9 +4641,6 @@ Logic\Biff_unions - - Logic\Biff_unions - Logic\Biff_unions @@ -4791,5 +4830,56 @@ Logic + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + + + Logic\Biff_structures\BIFF12 + \ No newline at end of file diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/BOF.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/BOF.h index f689a0754c..89e4cee93a 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/BOF.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/BOF.h @@ -91,7 +91,7 @@ public: unsigned char verLowestBiff; unsigned char verLastXLSaved; - ForwardOnlyParam stream_ptr; + _CP_OPT(unsigned int) stream_ptr; CFRecordType::TypeId type_id_ = rt_BOF_BIFF8; }; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/BoundSheet8.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/BoundSheet8.h index f6969c1570..44a7458b8a 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/BoundSheet8.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/BoundSheet8.h @@ -49,14 +49,13 @@ public: BaseObjectPtr clone(); - void readFields(CFRecord& record); static const ElementType type = typeBoundSheet8; - ForwardOnlyParam<_UINT32> lbPlyPos; - std::wstring hsState; - unsigned char dt; + _UINT32 lbPlyPos; + std::wstring hsState; + unsigned char dt; //----------------------------- std::wstring name_; }; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/DBCell.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/DBCell.h index 8cd6a1c3ce..41b276cf9a 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/DBCell.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/DBCell.h @@ -53,9 +53,8 @@ public: static const ElementType type = typeDBCell; //----------------------------- - ForwardOnlyParam<_UINT32> dbRtrw; - BiffStructurePtrVector rgdb; - BackwardOnlyParam<_UINT32> num_pointers; + _UINT32 dbRtrw; + BiffStructurePtrVector rgdb; }; } // namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Dv.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Dv.cpp index 91e617d06d..e55f2caebf 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Dv.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Dv.cpp @@ -35,7 +35,7 @@ #include "../../../../../OOXML/Base/Unit.h" #include -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/DValStrings.h" +#include "../Biff_structures/BIFF12/DValStrings.h" namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Dv.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Dv.h index 81be354e13..ba998ec6e2 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Dv.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Dv.h @@ -35,8 +35,8 @@ #include "../Biff_structures/BiffString.h" #include "../Biff_structures/DVParsedFormula.h" #include "../Biff_structures/SqRefU.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/UncheckedSqRfX.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/FRTHeader.h" +#include "../Biff_structures/BIFF12/UncheckedSqRfX.h" +#include "../Biff_structures/BIFF12/FRTHeader.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/ExtSST.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/ExtSST.h index 627cc49205..4e238d52bd 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/ExtSST.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/ExtSST.h @@ -57,7 +57,7 @@ public: //----------------------------- _UINT16 dsst; BiffStructurePtrVector rgISSTInf; - BackwardOnlyParam<_UINT32> num_sets; + _UINT32 num_sets; }; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/FileSharing.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/FileSharing.h index c0fae96cab..d2d31729e2 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/FileSharing.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/FileSharing.h @@ -33,8 +33,8 @@ #include "BiffRecord.h" #include "../Biff_structures/BiffString.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" -#include "../../../../../OOXML/XlsxFormat/WritingElement.h" +#include "../Biff_structures/BIFF12/XLWideString.h" +//#include "../../../../../OOXML/XlsxFormat/WritingElement.h" namespace XLS { @@ -60,7 +60,6 @@ public: _UINT16 iNoResPass; XLUnicodeString stUNUsername; XLSB::XLNullableWideString stUserName; - }; } // namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Font.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Font.cpp index 44a6ef69b9..aec516dcb5 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Font.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Font.cpp @@ -32,7 +32,7 @@ #include "Font.h" #include "../Biff_structures/BiffString.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" +#include "../Biff_structures/BIFF12/XLWideString.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Font.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Font.h index 4f06cd926b..adb43be590 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Font.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Font.h @@ -33,7 +33,7 @@ #include "BiffRecord.h" #include "../Biff_structures/BorderFillInfo.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_records/Color.h" +#include "../Biff_structures/BIFF12/Color.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Formula.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Formula.h index 840bde7874..7f92b5b1df 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Formula.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Formula.h @@ -61,8 +61,8 @@ public: bool fAlwaysCalc; bool fShrFmla; - BackwardOnlyParam fFill; - BackwardOnlyParam fClearErrors; + bool fFill; + bool fClearErrors; CellParsedFormula formula; }; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLink.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLink.h index 998c1d0475..21740e3e9a 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLink.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLink.h @@ -57,8 +57,8 @@ public: //----------------------------- Ref8U ref8; - ForwardOnlyParam hlinkClsid; - OSHARED::HyperlinkObject hyperlink; + std::wstring hlinkClsid; + OSHARED::HyperlinkObject hyperlink; }; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLinkTooltip.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLinkTooltip.cpp index a9f6c920c8..8e51391797 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLinkTooltip.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLinkTooltip.cpp @@ -60,7 +60,7 @@ void HLinkTooltip::readFields(CFRecord& record) record >> frtRefHeaderNoGrbit; std::wstring wzTooltip_prep; - record >> wzTooltip_prep; + record >> wzTooltip_prep; // ??? wzTooltip = std::wstring (wzTooltip_prep.c_str()); } diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLinkTooltip.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLinkTooltip.h index 053ce04eb5..214a180dbe 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLinkTooltip.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/HLinkTooltip.h @@ -50,8 +50,8 @@ public: static const ElementType type = typeHLinkTooltip; - std::wstring wzTooltip; - BackwardOnlyParam ref_; + std::wstring wzTooltip; + std::wstring ref_; }; } // namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Index.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Index.h index a018d79f61..59d9ce6dbb 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Index.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Index.h @@ -52,13 +52,11 @@ public: static const ElementType type = typeIndex; //----------------------------- - BackwardOnlyParam<_UINT32> rwMic; - BackwardOnlyParam<_UINT32> rwMac; - ForwardOnlyParam<_UINT32> ibXF; - BackwardOnlyParam<_UINT32> num_pointers; + _UINT32 rwMic; + _UINT32 rwMac; + _UINT32 ibXF; BiffStructurePtrVector rgibRw; - }; //000BH biff2 } // namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Lbl.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Lbl.h index 87f7dd7668..16d51fe033 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Lbl.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Lbl.h @@ -34,7 +34,7 @@ #include "BiffRecord.h" #include "../Biff_structures/BiffString.h" #include "../Biff_structures/NameParsedFormula.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" +#include "../Biff_structures/BIFF12/XLWideString.h" namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsi.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsi.cpp index 8ab69cf085..fc5d9f6c9e 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsi.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsi.cpp @@ -31,7 +31,7 @@ */ #include "Qsi.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" +#include "../Biff_structures/BIFF12/XLWideString.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsif.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsif.cpp index a8c37da63f..e188f62dec 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsif.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsif.cpp @@ -31,7 +31,7 @@ */ #include "Qsif.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" +#include "../Biff_structures/BIFF12/XLWideString.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Row.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Row.h index fd364f0e13..edbcfa17c1 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Row.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Row.h @@ -32,7 +32,7 @@ #pragma once #include "BiffRecord.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/ColSpan.h" +#include "../Biff_structures/BIFF12/ColSpan.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Selection.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Selection.h index c1e297233d..f3996fdc5a 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Selection.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Selection.h @@ -32,7 +32,7 @@ #pragma once #include "BiffRecord.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/UncheckedSqRfX.h" +#include "../Biff_structures/BIFF12/UncheckedSqRfX.h" #include "../Biff_structures/CellRangeRef.h" #include "../Biff_structures/PaneType.h" diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Setup.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Setup.cpp index 3e086d5a58..3cf7a01dde 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Setup.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Setup.cpp @@ -31,8 +31,8 @@ */ #include "Setup.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/RelID.h" +#include "../Biff_structures/BIFF12/XLWideString.h" +#include "../Biff_structures/BIFF12/RelID.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/ShrFmla.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/ShrFmla.h index 1bcb640aff..eff4150f1b 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/ShrFmla.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/ShrFmla.h @@ -34,7 +34,7 @@ #include "BiffRecord.h" #include "../Biff_structures/CellRangeRef.h" #include "../Biff_structures/SharedParsedFormula.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h" +#include "../Biff_structures/BIFF12/CellRangeRef.h" namespace XLS { @@ -53,14 +53,14 @@ public: void readFields(CFRecord& record) override; void writeFields(CFRecord& record) override; - static const ElementType type = typeShrFmla; + static const ElementType type = typeShrFmla; //----------------------------- - RefU ref_; - BackwardOnlyParam cUse; - SharedParsedFormula formula; + RefU ref_; + BYTE cUse; + SharedParsedFormula formula; - XLSB::UncheckedRfX rfx; //in biff12 + XLSB::UncheckedRfX rfx; //in biff12 }; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/SortData.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/SortData.cpp index b4eddae230..8b8d6e1007 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/SortData.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/SortData.cpp @@ -31,7 +31,7 @@ */ #include "SortData.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h" +#include "../Biff_structures/BIFF12/CellRangeRef.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Sync.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Sync.h index 72c98371db..be145e5c9e 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Sync.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/Sync.h @@ -36,8 +36,6 @@ namespace XLS { - -// Logical representation of Sync record in BIFF8 class Sync: public BiffRecord { BIFF_RECORD_DEFINE_TYPE_INFO(Sync) @@ -46,19 +44,16 @@ public: Sync(); ~Sync(); - BaseObjectPtr clone(); - - + BaseObjectPtr clone(); void readFields(CFRecord& record); - static const ElementType type = typeSync; + static const ElementType type = typeSync; //----------------------------- - ForwardOnlyParam rw; - ForwardOnlyParam col; + unsigned short rw; + unsigned short col; std::wstring ref_; - }; } // namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/TableStyle.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/TableStyle.cpp index 05aeee4d9d..53de8a2b22 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/TableStyle.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/TableStyle.cpp @@ -31,7 +31,7 @@ */ #include "TableStyle.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" +#include "../Biff_structures/BIFF12/XLWideString.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/TableStyles.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/TableStyles.cpp index fb46c70014..7e4359424e 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/TableStyles.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/TableStyles.cpp @@ -31,7 +31,7 @@ */ #include "TableStyles.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" +#include "../Biff_structures/BIFF12/XLWideString.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/UserBView.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/UserBView.h index 8dc335f253..95b000a4bc 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/UserBView.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/UserBView.h @@ -33,7 +33,7 @@ #include "BiffRecord.h" #include "../Biff_structures/BiffString.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" +#include "../Biff_structures/BIFF12/XLWideString.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/UserSViewBegin.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/UserSViewBegin.h index 62ec7a214c..2a4eb40b0f 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_records/UserSViewBegin.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_records/UserSViewBegin.h @@ -90,8 +90,8 @@ public: Xnum operNumX; Xnum operNumY; - ForwardOnlyParam colRPane; - ForwardOnlyParam rwBPane; + unsigned short colRPane; + unsigned short rwBPane; std::wstring pane_top_left_cell; diff --git a/OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h similarity index 95% rename from OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h index c7fa3ef03e..bfea6ee3aa 100644 --- a/OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h @@ -32,7 +32,7 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CellRangeRef.h" +#include "../CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/CellRef.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRef.h similarity index 96% rename from OOXML/XlsbFormat/Biff12_structures/CellRef.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRef.h index fa5ac2920a..06edcc88e3 100644 --- a/OOXML/XlsbFormat/Biff12_structures/CellRef.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRef.h @@ -32,7 +32,7 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CellRef.h" +#include "../CellRef.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/ColSpan.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/ColSpan.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/ColSpan.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/ColSpan.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/ColSpan.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/ColSpan.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/ColSpan.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/ColSpan.h index ce92d6a299..ea5bf63e0e 100644 --- a/OOXML/XlsbFormat/Biff12_structures/ColSpan.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/ColSpan.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Color.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_records/Color.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.cpp diff --git a/OOXML/XlsbFormat/Biff12_records/Color.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h similarity index 94% rename from OOXML/XlsbFormat/Biff12_records/Color.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h index 862b36f38f..2f43f945d1 100644 --- a/OOXML/XlsbFormat/Biff12_records/Color.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h @@ -31,10 +31,8 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "../../XlsxFormat/WritingElement.h" - - +#include "../../Biff_records/BiffRecord.h" +#include "../../../../../../OOXML/XlsxFormat/WritingElement.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/DValStrings.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/DValStrings.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/DValStrings.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/DValStrings.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/DValStrings.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/DValStrings.h similarity index 93% rename from OOXML/XlsbFormat/Biff12_structures/DValStrings.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/DValStrings.h index e82a156dca..f50ffc4839 100644 --- a/OOXML/XlsbFormat/Biff12_structures/DValStrings.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/DValStrings.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "XLWideString.h" diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTFormula.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormula.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTFormula.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormula.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTFormula.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormula.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/FRTFormula.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormula.h index 475e10dbd8..39c7160627 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTFormula.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormula.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "FRTParsedFormula.h" diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTFormulas.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormulas.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTFormulas.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormulas.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTFormulas.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormulas.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/FRTFormulas.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormulas.h index f55eb3accf..5148a638f6 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTFormulas.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTFormulas.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "FRTFormula.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTHeader.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h similarity index 93% rename from OOXML/XlsbFormat/Biff12_structures/FRTHeader.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h index ffa1360cef..74e704dd21 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTHeader.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "FRTRefs.h" #include "FRTSqrefs.h" #include "FRTFormulas.h" diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTHeader.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader12.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTHeader.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader12.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTParsedFormula.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTParsedFormula.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTParsedFormula.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTParsedFormula.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTParsedFormula.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTParsedFormula.h similarity index 95% rename from OOXML/XlsbFormat/Biff12_structures/FRTParsedFormula.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTParsedFormula.h index 5684e77fc4..ae3bdeec3a 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTParsedFormula.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTParsedFormula.h @@ -31,7 +31,7 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/ParsedFormula.h" +#include "../ParsedFormula.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTRef.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRef.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTRef.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRef.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTRef.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRef.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/FRTRef.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRef.h index d4af6b2a60..e06026acb2 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTRef.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRef.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "CellRangeRef.h" diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTRefs.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRefs.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTRefs.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRefs.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTRefs.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRefs.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/FRTRefs.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRefs.h index 93c1fc050b..fbe62eef85 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTRefs.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRefs.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "FRTRef.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTRelID.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRelID.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTRelID.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRelID.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTRelID.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRelID.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/FRTRelID.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRelID.h index f80eda256c..1793b8db67 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTRelID.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTRelID.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTSqref.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqref.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTSqref.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqref.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTSqref.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqref.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/FRTSqref.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqref.h index 836247ff5a..dcbdecd96f 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTSqref.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqref.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "UncheckedSqRfX.h" diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTSqrefs.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqrefs.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/FRTSqrefs.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqrefs.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/FRTSqrefs.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqrefs.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/FRTSqrefs.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqrefs.h index 5fd931ea26..c1a2f02107 100644 --- a/OOXML/XlsbFormat/Biff12_structures/FRTSqrefs.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTSqrefs.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "FRTSqref.h" diff --git a/OOXML/XlsbFormat/Biff12_structures/RelID.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/RelID.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/RelID.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h similarity index 92% rename from OOXML/XlsbFormat/Biff12_structures/RelID.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h index 4274079242..a6914081b1 100644 --- a/OOXML/XlsbFormat/Biff12_structures/RelID.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "XLWideString.h" diff --git a/OOXML/XlsbFormat/Biff12_structures/UncheckedSqRfX.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/UncheckedSqRfX.cpp similarity index 100% rename from OOXML/XlsbFormat/Biff12_structures/UncheckedSqRfX.cpp rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/UncheckedSqRfX.cpp diff --git a/OOXML/XlsbFormat/Biff12_structures/UncheckedSqRfX.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/UncheckedSqRfX.h similarity index 93% rename from OOXML/XlsbFormat/Biff12_structures/UncheckedSqRfX.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/UncheckedSqRfX.h index 2ad0a8a644..aafdf27a71 100644 --- a/OOXML/XlsbFormat/Biff12_structures/UncheckedSqRfX.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/UncheckedSqRfX.h @@ -32,8 +32,8 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../BiffStructure.h" +#include "../../Biff_records/BiffRecord.h" #include "CellRangeRef.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/XLWideString.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h similarity index 95% rename from OOXML/XlsbFormat/Biff12_structures/XLWideString.h rename to MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h index 8b26c7ec57..a0bc53a032 100644 --- a/OOXML/XlsbFormat/Biff12_structures/XLWideString.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h @@ -32,7 +32,7 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.h" +#include "../BiffString.h" namespace XLSB { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffAttribute.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffAttribute.h index f5d8f392dc..17017f4266 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffAttribute.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffAttribute.h @@ -36,32 +36,16 @@ namespace XLS { -class BiffAttribute : public BiffStructure -{ - BASE_STRUCTURE_DEFINE_CLASS_NAME(BiffAttribute) -public: - BiffAttribute() {} - BiffAttribute(const std::wstring name_init) : attrib_name(name_init) {} - - void setName(const std::wstring name_init) - { - attrib_name = name_init; - } - static const ElementType type = typeBiffAttribute; - - _CP_OPT(std::wstring) attrib_name; -}; - - - - template -class BiffAttributeSimple : public BiffAttribute +class BiffAttributeSimple : public BiffStructure { public: + BASE_STRUCTURE_DEFINE_CLASS_NAME(BiffAttributeSimple) + BiffAttributeSimple() {} BiffAttributeSimple(const Type& val_init) : val(val_init) {} - BiffAttributeSimple(const Type& val_init, const std::wstring & attrib_name) : val(val_init), BiffAttribute(attrib_name) {} + + static const ElementType type = typeBiffAttribute; _CP_OPT(Type) & value() {return val;} @@ -103,43 +87,4 @@ protected: }; -template -class ForwardOnlyParam : public BiffAttributeSimple -{ -public: - ForwardOnlyParam() {} - ForwardOnlyParam(const Type& val_init) - { - BiffAttributeSimple::val = val_init; - } - - ForwardOnlyParam operator= (const ForwardOnlyParam& other) - { - BiffAttributeSimple::val = other.val; - return *this; - } - -}; - - -template -class BackwardOnlyParam : public BiffAttributeSimple -{ -public: - BackwardOnlyParam() {} - BackwardOnlyParam(const Type& val_init) - { - BiffAttributeSimple::val = val_init; - } - - BackwardOnlyParam operator= (const BackwardOnlyParam& other) - { - BiffAttributeSimple::val = other.val; - return *this; - } - -}; - - - } // namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.cpp index abe8eaf90c..369e8aef72 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.cpp @@ -31,7 +31,7 @@ */ #include "BiffString.h" -#include "../../../Common/Utils/OptPtr.h" +#include "../../../../Common/Utils/OptPtr.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.h index db7d1ec564..0be5d56720 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffString.h @@ -55,9 +55,14 @@ typedef enum } CCH_SOURCE; -class BiffString : public BiffAttribute +class BiffString : public BiffStructure { public: + const std::string& getClassName() const { static std::string str("BiffString"); return str; } + virtual XLS::ElementType get_type() { return type; } + + static const ElementType type = typeBiffString; + BiffString(); BiffString(const size_t size); BiffString(const std::wstring & str); diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.cpp index 21a6b60bfe..fd95f51d57 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.cpp @@ -35,28 +35,16 @@ namespace XLS { -void BiffStructure_NoVtbl::load(CFRecord& record) -{ -} -void BiffStructure_NoVtbl::load(IBinaryReader* reader) -{ -} -void BiffStructure_NoVtbl::save(CFRecord& record) -{ -} - - -bool DiffBiff(BiffStructure_NoVtbl& val) -{ - return true; -} - - -bool DiffBiff(BiffStructure& val) -{ - return false; -} - + CFRecord& operator>>(CFRecord& record, BiffStructure& val) + { + val.load(record); + return record; + } + CFRecord& operator<<(CFRecord& record, BiffStructure& val) + { + val.save(record); + return record; + } }// namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h index 5900766931..48ee5424d1 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h @@ -44,83 +44,54 @@ namespace XLS { -class BiffStructure_NoVtbl -{ -public: - void load(CFRecord& record); // this function will never be called ( look at operator>>(CFRecord& record, T& val)) - void load(IBinaryReader* reader); - void save(CFRecord& record); -}; + class BiffStructure; + typedef boost::shared_ptr BiffStructurePtr; + typedef std::vector BiffStructurePtrVector; -class BiffStructure; -typedef boost::shared_ptr BiffStructurePtr; -typedef std::vector BiffStructurePtrVector; - -class BiffStructure : protected BiffStructure_NoVtbl -{ -public: - - virtual BiffStructurePtr clone() = 0; - - virtual void load(CFRecord& record) = 0; - virtual void load(IBinaryReader* reader) + class BiffStructure { - } - virtual void save(CFRecord& record) {}//= 0; + public: + virtual ~BiffStructure() {} + virtual BiffStructurePtr clone() = 0; - virtual ElementType get_type() = 0; + virtual void load(CFRecord& record) = 0; + virtual void load(IBinaryReader* reader) {} - virtual int serialize(std::wostream & _stream) - { - std::stringstream s; - s << std::string("This element - ") << getClassName() << std::string("- not serialize"); - Log::warning(s.str()); - return 0; - } + virtual void save(CFRecord& record) {}//= 0; - virtual const std::string & getClassName() const = 0; // Must be overridden in every deriver. The return value must be a reference to a static variable inside the getter + virtual ElementType get_type() = 0; -}; + virtual int serialize(std::wostream & _stream) + { + std::stringstream s; + s << std::string("This element - ") << getClassName() << std::string("- not serialize"); + Log::warning(s.str()); + return 0; + } + + virtual const std::string & getClassName() const = 0; // The return value must be a reference to a static variable inside the getter + }; #define BASE_STRUCTURE_DEFINE_CLASS_NAME(class_name)\ public: \ - const std::string & getClassName() const { static std::string str(#class_name); return str;}\ - virtual XLS::ElementType get_type() { return type; } - + const std::string & getClassName() const { static std::string str(#class_name); return str; }\ + virtual XLS::ElementType get_type() { return type; } - -bool DiffBiff(BiffStructure_NoVtbl & val); -bool DiffBiff(BiffStructure & val); - - -template -CFRecord& operator>>(CFRecord& record, T& val) -{ - if(DiffBiff(val)) + template::value, T>::type> + CFRecord& operator>>(CFRecord& record, T& val) { record.loadAnyData(val); + return record; } - else - { - val.load(record); - } - return record; -} - -template -CFRecord& operator << (CFRecord& record, T& val) -{ - if (DiffBiff(val)) + template::value, T>::type> + CFRecord& operator<<(CFRecord& record, T& val) { record.storeAnyData(val); + return record; } - else - { - val.save(record); - } - return record; -} + CFRecord& operator>>(CFRecord& record, BiffStructure& val); + CFRecord& operator<<(CFRecord& record, BiffStructure& val); } // namespace XLS diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BitMarkedStructs.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BitMarkedStructs.h index e6ea5cd8f9..1b00497a7e 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BitMarkedStructs.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BitMarkedStructs.h @@ -81,13 +81,13 @@ typedef BiffAttributeSimple BIFF_BYTE; typedef BiffAttributeSimple<_UINT16> BIFF_WORD; typedef BiffAttributeSimple<_UINT32> BIFF_DWORD; -struct PtgAttrSpaceType : public BiffStructure_NoVtbl +struct PtgAttrSpaceType { unsigned char type; unsigned char cch; }; -struct RkNumber : public BiffStructure_NoVtbl +struct RkNumber { unsigned int fX100 : 1; unsigned int fInt : 1; @@ -123,7 +123,7 @@ private: }; -struct BErr : public BiffStructure_NoVtbl +struct BErr { unsigned char err; BErr() {} @@ -197,7 +197,7 @@ struct BErr : public BiffStructure_NoVtbl }; -struct XColorType : public BiffStructure_NoVtbl +struct XColorType { _UINT32 type; enum @@ -211,7 +211,7 @@ struct XColorType : public BiffStructure_NoVtbl }; -struct RevisionType : public BiffStructure_NoVtbl +struct RevisionType { _UINT16 type; enum @@ -239,7 +239,7 @@ struct RevisionType : public BiffStructure_NoVtbl -struct Ts : public BiffStructure_NoVtbl +struct Ts { private: unsigned char unused1 : 1; @@ -255,7 +255,7 @@ private: }; -struct DXFNumIFmt : public BiffStructure_NoVtbl +struct DXFNumIFmt { private: unsigned char unused; @@ -263,7 +263,7 @@ public: unsigned char ifmt; }; -struct FFErrorCheck : public BiffStructure_NoVtbl +struct FFErrorCheck { unsigned int ffecCalcError : 1; unsigned int ffecEmptyCellRef : 1; @@ -277,21 +277,21 @@ struct FFErrorCheck : public BiffStructure_NoVtbl }; -struct ExtSheetPair : public BiffStructure_NoVtbl +struct ExtSheetPair { short itabFirst; short itabLast; }; -struct CondDataValue : public BiffStructure_NoVtbl +struct CondDataValue { _UINT32 condDataValue; _UINT32 reserved; }; -struct KPISets : public BiffStructure_NoVtbl +struct KPISets { _UINT32 set; enum { @@ -316,7 +316,7 @@ struct KPISets : public BiffStructure_NoVtbl }; }; -struct KPISets14 : public BiffStructure_NoVtbl // in biff12 +struct KPISets14 // in biff12 { _UINT32 set; enum { @@ -345,19 +345,19 @@ struct KPISets14 : public BiffStructure_NoVtbl // in biff12 }; -struct CFFlag : public BiffStructure_NoVtbl +struct CFFlag { KPISets iIconSet; long iIcon; }; -struct CFFlag14 : public BiffStructure_NoVtbl // in biff12 +struct CFFlag14 // in biff12 { KPISets14 iIconSet; long iIcon; }; -struct FrtFlags : public BiffStructure_NoVtbl +struct FrtFlags { FrtFlags() : fFrtRef(false), fFrtAlert(false), reserved2(0), reserved(0) {}; bool fFrtRef : 1; @@ -368,7 +368,7 @@ private: }; -struct CFrtId : public BiffStructure_NoVtbl +struct CFrtId { unsigned short rtFirst; unsigned short rtLast; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFExTemplateParams.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFExTemplateParams.h index 221673510a..7a1bd78f99 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFExTemplateParams.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFExTemplateParams.h @@ -38,7 +38,7 @@ namespace XLS #pragma pack(1) -struct CFExFilterParams : public BiffStructure_NoVtbl +struct CFExFilterParams { private: bool fTop : 1; @@ -53,7 +53,7 @@ private: }; -struct CFExTextTemplateParams : public BiffStructure_NoVtbl +struct CFExTextTemplateParams { private: unsigned short ctp; @@ -66,7 +66,7 @@ private: }; -struct CFExDateTemplateParams : public BiffStructure_NoVtbl +struct CFExDateTemplateParams { private: unsigned short dateOp; @@ -79,7 +79,7 @@ private: }; -struct CFExAveragesTemplateParams : public BiffStructure_NoVtbl +struct CFExAveragesTemplateParams { private: unsigned short iParam; @@ -92,7 +92,7 @@ private: }; -struct CFExDefaultTemplateParams : public BiffStructure_NoVtbl +struct CFExDefaultTemplateParams { private: _UINT32 unused1; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Cetab.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Cetab.h index 74fc8a9b5f..3324fd22b2 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Cetab.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Cetab.h @@ -39,7 +39,7 @@ namespace XLS class CFRecord; #pragma pack(1) -class Cetab : public BiffStructure_NoVtbl +class Cetab { public: unsigned short getHighBit() const; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/ChartNumNillable.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/ChartNumNillable.h index 45b817764d..f12ed2530f 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/ChartNumNillable.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/ChartNumNillable.h @@ -36,9 +36,11 @@ namespace XLS { -class ChartNumNillable : public BiffAttribute +class ChartNumNillable : public BiffStructure { + BASE_STRUCTURE_DEFINE_CLASS_NAME(ChartNumNillable) public: + static const ElementType type = typeChartNumNillable; ChartNumNillable(const unsigned short nil_type); @@ -46,7 +48,6 @@ public: virtual void load(CFRecord& record); - void setNilType(const unsigned short type); const bool isNil(); diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/FixedPoint.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/FixedPoint.h index 488c7829b0..872275a85c 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/FixedPoint.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/FixedPoint.h @@ -38,9 +38,13 @@ namespace OSHARED class CFRecord; -class FixedPoint : public XLS::BiffAttribute +class FixedPoint : public XLS::BiffStructure { + BASE_STRUCTURE_DEFINE_CLASS_NAME(FixedPoint) public: + + static const XLS::ElementType type = XLS::typeFixedPoint; + FixedPoint(unsigned short cbElement_); //fixed always!! FixedPoint(); FixedPoint(const int raw_data); diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/FormulaValue.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/FormulaValue.h index 50a028e06a..8696f2c2db 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/FormulaValue.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/FormulaValue.h @@ -38,13 +38,15 @@ namespace XLS class CFRecord; -class FormulaValue : public BiffAttribute +class FormulaValue : public BiffStructure { + BASE_STRUCTURE_DEFINE_CLASS_NAME(FormulaValue) public: BiffStructurePtr clone(); virtual void load(CFRecord& record); + static const ElementType type = typeFormulaValue; unsigned char getType(); diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Ftab_Cetab.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Ftab_Cetab.h index cd32851e49..20a130152f 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Ftab_Cetab.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Ftab_Cetab.h @@ -40,7 +40,7 @@ namespace XLS { #pragma pack(1) -class Ftab_Cetab : public BiffStructure_NoVtbl +class Ftab_Cetab { public: Ftab_Cetab(); diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgArea.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgArea.h index 1ac21dcbd8..d9404d307a 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgArea.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgArea.h @@ -34,7 +34,7 @@ #include "OperandPtg.h" #include "CellRangeRef.h" #include "BitMarkedStructs.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h" +#include "BIFF12/CellRangeRef.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgArea3d.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgArea3d.h index 1a7baf6435..8e6f3b7e45 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgArea3d.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgArea3d.h @@ -34,7 +34,7 @@ #include "OperandPtg.h" #include "CellRangeRef.h" #include "../GlobalWorkbookInfo.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h" +#include "BIFF12/CellRangeRef.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgAreaN.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgAreaN.h index 2de40a4b05..a22d45986e 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgAreaN.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgAreaN.h @@ -33,7 +33,7 @@ #include "OperandPtg.h" #include "CellRangeRef.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h" +#include "BIFF12/CellRangeRef.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgExtraMem.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgExtraMem.h index 539e1bd27c..d7e1a04c4c 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgExtraMem.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgExtraMem.h @@ -33,7 +33,7 @@ #include "Ptg.h" #include "CellRangeRef.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRangeRef.h" +#include "BIFF12/CellRangeRef.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRef.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRef.h index 03ada5d0e9..a10b730b56 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRef.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRef.h @@ -33,7 +33,7 @@ #include "OperandPtg.h" #include "BitMarkedStructs.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRef.h" +#include "BIFF12/CellRef.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRef3d.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRef3d.h index 038392b28e..cbe4626ebe 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRef3d.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRef3d.h @@ -33,7 +33,7 @@ #include "OperandPtg.h" #include "../GlobalWorkbookInfo.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRef.h" +#include "BIFF12/CellRef.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRefN.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRefN.h index aa33b6f645..84f8632285 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRefN.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PtgRefN.h @@ -32,7 +32,7 @@ #pragma once #include "OperandPtg.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/CellRef.h" +#include "BIFF12/CellRef.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/RC4EncryptionHeader.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/RC4EncryptionHeader.h index f25d3de0a2..a4b2194658 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/RC4EncryptionHeader.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/RC4EncryptionHeader.h @@ -37,7 +37,7 @@ namespace CRYPTO { -struct Version : public XLS::BiffStructure_NoVtbl +struct Version { unsigned short vMajor; unsigned short vMinor; diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/RevLblName.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/RevLblName.cpp index ba08c968bd..6ac1d4daff 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/RevLblName.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/RevLblName.cpp @@ -32,7 +32,7 @@ #include "RevLblName.h" #include "../../Binary/CFRecord.h" -#include "../../../../../OOXML/XlsbFormat/Biff12_structures/XLWideString.h" +#include "BIFF12/XLWideString.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProp.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProp.cpp index 8164b53ba4..9a7f8e38cd 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProp.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProp.cpp @@ -58,7 +58,7 @@ void XFProp::load(CFRecord& record) switch(xfPropType) { case 0x0000: - xfPropDataBlob.reset(new BIFF_BYTE(0, L"value")); + xfPropDataBlob.reset(new BIFF_BYTE(0)); break; case 0x0001: case 0x0002: @@ -102,12 +102,12 @@ void XFProp::load(CFRecord& record) case 0x0025: case 0x002B: case 0x002C: - xfPropDataBlob.reset(new BIFF_BYTE(0, L"value")); + xfPropDataBlob.reset(new BIFF_BYTE(0)); break; case 0x0018: { boost::shared_ptr str(new LPWideString); - str->setName(L"value"); + //str->setName(L"value"); record >> *str; xfPropDataBlob = str; return; @@ -117,15 +117,15 @@ void XFProp::load(CFRecord& record) case 0x001B: case 0x0029: case 0x002A: - xfPropDataBlob.reset(new BIFF_WORD(0, L"value")); + xfPropDataBlob.reset(new BIFF_WORD(0)); break; case 0x0024: - xfPropDataBlob.reset(new BIFF_DWORD(0, L"value")); + xfPropDataBlob.reset(new BIFF_DWORD(0)); break; case 0x0026: { boost::shared_ptr str(new LPWideString); - str->setName(L"value"); + //str->setName(L"value"); record >> *str; xfPropDataBlob = str; return; @@ -232,7 +232,7 @@ static void deserialize_val_prop(XmlUtils::CXmlLiteReader& oReader, const std::w else byte = XmlUtils::GetInteger(value); - val.reset(new BIFF_BYTE(byte, L"value")); + val.reset(new BIFF_BYTE(byte)); } else if (typeName == L"BIFF_WORD") { @@ -260,11 +260,11 @@ static void deserialize_val_prop(XmlUtils::CXmlLiteReader& oReader, const std::w else word = XmlUtils::GetInteger(value); - val.reset(new BIFF_WORD(word, L"value")); + val.reset(new BIFF_WORD(word)); } else if (typeName == L"BIFF_DWORD") { - val.reset(new BIFF_DWORD(XmlUtils::GetInteger(value) * 20., L"value")); + val.reset(new BIFF_DWORD(XmlUtils::GetInteger(value) * 20.)); } else if (typeName == L"LPWideString") { @@ -297,7 +297,7 @@ static void deserialize_prop(XmlUtils::CXmlLiteReader& oReader, const std::wstri else byte = XmlUtils::GetInteger(value); - val.reset(new BIFF_BYTE(byte, L"value")); + val.reset(new BIFF_BYTE(byte)); } } static void serialize_val_attr(CP_ATTR_NODE, const std::wstring & name, BiffStructurePtr & val) @@ -527,7 +527,7 @@ void XFProp::deserialize_attr(XmlUtils::CXmlLiteReader& oReader) case 0x0015: case 0x0016: //case 0x0017: - xfPropDataBlob.reset(new BIFF_BYTE(XmlUtils::GetInteger(oReader.GetText()), L"value")); + xfPropDataBlob.reset(new BIFF_BYTE(XmlUtils::GetInteger(oReader.GetText()))); break; case 0x001C: case 0x001D: @@ -537,7 +537,7 @@ void XFProp::deserialize_attr(XmlUtils::CXmlLiteReader& oReader) case 0x0021: case 0x0022: case 0x0023: - xfPropDataBlob.reset(new BIFF_BYTE(1, L"value")); + xfPropDataBlob.reset(new BIFF_BYTE(1)); case 0x0025: deserialize_val_prop(oReader, L"BIFF_BYTE", xfPropDataBlob); break; @@ -549,17 +549,17 @@ void XFProp::deserialize_attr(XmlUtils::CXmlLiteReader& oReader) deserialize_val_prop(oReader, L"LPWideString", xfPropDataBlob); break; case 0x0029: - xfPropDataBlob.reset(new BIFF_WORD(XmlUtils::GetInteger(oReader.GetText()), L"value")); + xfPropDataBlob.reset(new BIFF_WORD(XmlUtils::GetInteger(oReader.GetText()))); break; case 0x0019: case 0x001A: - xfPropDataBlob.reset(new BIFF_WORD(1, L"value")); + xfPropDataBlob.reset(new BIFF_WORD(1)); case 0x001B: case 0x002A: deserialize_val_prop(oReader, L"BIFF_WORD", xfPropDataBlob); break; case 0x0024: - xfPropDataBlob.reset(new BIFF_DWORD(XmlUtils::GetInteger(oReader.GetText()), L"value")); + xfPropDataBlob.reset(new BIFF_DWORD(XmlUtils::GetInteger(oReader.GetText()))); break; case 0x0026: xfPropDataBlob.reset(new LPWideString(oReader.GetText())); diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProp.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProp.h index 9dd89e493a..daf985984f 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProp.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProp.h @@ -34,7 +34,7 @@ #include "BiffStructure.h" #include "FullColorExt.h" -#include "../../../Common/Utils/simple_xml_writer.h" +#include "../../../../Common/Utils/simple_xml_writer.h" namespace XmlUtils { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFPropGradient.h b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFPropGradient.h index a84016281d..3602f29240 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFPropGradient.h +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFPropGradient.h @@ -34,7 +34,7 @@ #include "BiffStructure.h" #include "Boolean.h" -#include "../../../Common/Utils/simple_xml_writer.h" +#include "../../../../Common/Utils/simple_xml_writer.h" namespace XmlUtils { diff --git a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProps.cpp b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProps.cpp index 015cc45e30..def1be5caa 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProps.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/Biff_structures/XFProps.cpp @@ -37,7 +37,7 @@ #include "BitMarkedStructs.h" -#include "../../../../DesktopEditor/xml/include/xmlutils.h" +#include "../../../../../DesktopEditor/xml/include/xmlutils.h" namespace XLS { diff --git a/MsBinaryFile/XlsFile/Format/Logic/XlsElementsType.h b/MsBinaryFile/XlsFile/Format/Logic/XlsElementsType.h index 773970aff9..225b9a43c7 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/XlsElementsType.h +++ b/MsBinaryFile/XlsFile/Format/Logic/XlsElementsType.h @@ -554,7 +554,11 @@ enum ElementType typeAFDOperXNum, typeAFDOperStr, typeBes, + typeBiffString, typeBiffAttribute, + typeFixedPoint, + typeFormulaValue, + typeChartNumNillable, typeBookExt_Conditional11, typeBookExt_Conditional12, typeBuiltInStyle, diff --git a/MsBinaryFile/XlsFile/Format/Logic/pri/xls_format_logic.cpp b/MsBinaryFile/XlsFile/Format/Logic/pri/xls_format_logic.cpp index f948c8dd46..1d530ff12f 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/pri/xls_format_logic.cpp +++ b/MsBinaryFile/XlsFile/Format/Logic/pri/xls_format_logic.cpp @@ -46,6 +46,7 @@ #include "../Biff_records/Backup.cpp" #include "../Biff_records/Bar.cpp" #include "../Biff_records/Begin.cpp" +#include "../Biff_structures/BiffStructure.cpp" #include "../Biff_records/BiffRecord.cpp" #include "../Biff_records/BiffRecordContinued.cpp" #include "../Biff_records/BiffRecordSplit.cpp" @@ -369,7 +370,6 @@ #include "../Biff_structures/ArrayParsedFormula.cpp" #include "../Biff_structures/Bes.cpp" #include "../Biff_structures/BiffString.cpp" -#include "../Biff_structures/BiffStructure.cpp" #include "../Biff_structures/BookExt_Conditional11.cpp" #include "../Biff_structures/BookExt_Conditional12.cpp" #include "../Biff_structures/BorderFillInfo.cpp" @@ -649,6 +649,20 @@ #include "../Biff_structures/Xnum.cpp" #include "../Biff_structures/PBT.cpp" #include "../Biff_structures/FontInfo.cpp" +#include "../Biff_structures/BIFF12/ColSpan.cpp" +#include "../Biff_structures/BIFF12/Color.cpp" +#include "../Biff_structures/BIFF12/DValStrings.cpp" +#include "../Biff_structures/BIFF12/FRTFormula.cpp" +#include "../Biff_structures/BIFF12/FRTFormulas.cpp" +#include "../Biff_structures/BIFF12/FRTHeader12.cpp" +#include "../Biff_structures/BIFF12/FRTParsedFormula.cpp" +#include "../Biff_structures/BIFF12/FRTRef.cpp" +#include "../Biff_structures/BIFF12/FRTRefs.cpp" +#include "../Biff_structures/BIFF12/FRTRelID.cpp" +#include "../Biff_structures/BIFF12/FRTSqref.cpp" +#include "../Biff_structures/BIFF12/FRTSqrefs.cpp" +#include "../Biff_structures/BIFF12/RelID.cpp" +#include "../Biff_structures/BIFF12/UncheckedSqRfX.cpp" #include "../Biff_unions/AI.cpp" #include "../Biff_unions/ATTACHEDLABEL_bu.cpp" diff --git a/MsBinaryFile/XlsFile/Format/Logic/pri/xls_logic.pri b/MsBinaryFile/XlsFile/Format/Logic/pri/xls_logic.pri index 0336dec048..88b9042593 100644 --- a/MsBinaryFile/XlsFile/Format/Logic/pri/xls_logic.pri +++ b/MsBinaryFile/XlsFile/Format/Logic/pri/xls_logic.pri @@ -346,8 +346,8 @@ SOURCES += \ $$LOGIC_DIR/Biff_structures/ArrayParsedFormula.cpp \ $$LOGIC_DIR/Biff_structures/Bes.cpp \ $$LOGIC_DIR/Biff_structures/BiffString.cpp \ - $$LOGIC_DIR/Biff_structures/BiffStructure.cpp \ - $$LOGIC_DIR/Biff_structures/BookExt_Conditional11.cpp \ + $$LOGIC_DIR/Biff_structures/BiffStructure.cpp \ + $$LOGIC_DIR/Biff_structures/BookExt_Conditional11.cpp \ $$LOGIC_DIR/Biff_structures/BookExt_Conditional12.cpp \ $$LOGIC_DIR/Biff_structures/BorderFillInfo.cpp \ $$LOGIC_DIR/Biff_structures/BuiltInStyle.cpp \ @@ -628,7 +628,21 @@ SOURCES += \ $$LOGIC_DIR/Biff_structures/FontInfo.cpp \ $$LOGIC_DIR/Biff_structures/CFDatabar.cpp \ $$LOGIC_DIR/Biff_structures/CFGradient.cpp \ - \ + $$LOGIC_DIR/Biff_structures/BIFF12/ColSpan.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/Color.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/DValStrings.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTFormula.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTFormulas.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTHeader12.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTParsedFormula.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTRef.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTRefs.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTRelID.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTSqref.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTSqrefs.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/RelID.cpp \ + $$LOGIC_DIR/Biff_structures/BIFF12/UncheckedSqRfX.cpp \ + \ $$LOGIC_DIR/Biff_unions/AI.cpp \ $$LOGIC_DIR/Biff_unions/ATTACHEDLABEL_bu.cpp \ $$LOGIC_DIR/Biff_unions/AUTOFILTER_bu.cpp \ @@ -1096,7 +1110,24 @@ HEADERS += \ $$LOGIC_DIR/Biff_records/YMult.h \ $$LOGIC_DIR/Biff_records/IMDATA.h \ $$LOGIC_DIR/Biff_records/FrtWrapper.h \ - \ + \ + $$LOGIC_DIR/Biff_structures/BIFF12/CellRangeRef.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/CellRef.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/ColSpan.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/Color.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/DValStrings.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTFormula.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTFormulas.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTHeader.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTParsedFormula.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTRef.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTRefs.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTRelID.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTSqref.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/FRTSqrefs.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/RelID.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/UncheckedSqRfX.h \ + $$LOGIC_DIR/Biff_structures/BIFF12/XLWideString.h \ $$LOGIC_DIR/Biff_structures/AddinUdf.h \ $$LOGIC_DIR/Biff_structures/AF12Criteria.h \ $$LOGIC_DIR/Biff_structures/AF12CellIcon.h \ diff --git a/OOXML/Binary/Document/BinReader/ReaderClasses.cpp b/OOXML/Binary/Document/BinReader/ReaderClasses.cpp index ed28dd5ea3..cb770c5835 100644 --- a/OOXML/Binary/Document/BinReader/ReaderClasses.cpp +++ b/OOXML/Binary/Document/BinReader/ReaderClasses.cpp @@ -33,117 +33,6 @@ namespace BinDocxRW { - SectPr::SectPr() - { - sHeaderFooterReference = _T(""); - cols = _T(""); - - bW = false; - bH = false; - bOrientation = false; - bLeft = false; - bTop = false; - bRight = false; - bBottom = false; - bHeader = false; - bFooter = false; - bTitlePg = false; - bEvenAndOddHeaders = false; - bSectionType = false; - bPageNumStart = false; - bRtlGutter = false; - bGutter = false; - } - std::wstring SectPr::Write() - { - std::wstring sRes = _T(""); - - if(!sHeaderFooterReference.empty()) - sRes += sHeaderFooterReference; - if(!footnotePr.empty()) - sRes += footnotePr; - if(!endnotePr.empty()) - sRes += endnotePr; - if(bSectionType) - { - std::wstring sType; - switch(SectionType) - { - case 0: sType = _T("continuous");break; - case 1: sType = _T("evenPage");break; - case 2: sType = _T("nextColumn");break; - case 3: sType = _T("nextPage");break; - case 4: sType = _T("oddPage");break; - default: sType = _T("nextPage");break; - } - sRes += L""; - } - if((bW && bH) || bOrientation) - { - sRes += L""; - } - - if(bLeft || bTop || bRight || bBottom || bHeader || bFooter) - { - sRes += L""; - } - if(!pgBorders.empty()) - sRes += pgBorders; - - if(!lineNum.empty()) - sRes += lineNum; - - if(bPageNumStart) - sRes += L""; - - if(bRtlGutter) - { - if(RtlGutter) - sRes += L""; - else - sRes += L""; - } - - if(!cols.empty()) - sRes += cols; - sRes += L""; - - if(bTitlePg && TitlePg) - sRes += L""; - - if(!sectPrChange.empty()) - sRes += sectPrChange; - return sRes; - } - docRGB::docRGB() { R = 255; @@ -173,7 +62,7 @@ namespace BinDocxRW { std::wstring CThemeColor::ToStringColor() { std::wstring sRes; - if(bColor) + if (bColor) { switch(Color) { @@ -202,7 +91,7 @@ namespace BinDocxRW { std::wstring CThemeColor::ToStringTint() { std::wstring sRes; - if(bTint) + if (bTint) { sRes = XmlUtils::ToString(Tint, L"%02X"); } @@ -211,7 +100,7 @@ namespace BinDocxRW { std::wstring CThemeColor::ToStringShade() { std::wstring sRes; - if(bShade) + if (bShade) { sRes = XmlUtils::ToString(Shade, L"%02X"); } @@ -224,7 +113,7 @@ namespace BinDocxRW { { if (Auto) { - if(!oColor.IsInit()) + if (!oColor.IsInit()) oColor.Init(); oColor->SetValue(SimpleTypes::hexcolorAuto); } @@ -244,34 +133,25 @@ namespace BinDocxRW { oThemeShade->SetValue(Shade); } } - Spacing::Spacing() - { - bLineRule = false; - bLine = false; - bLineTwips = false; - bAfter = false; - bBefore = false; - bAfterAuto = false; - bBeforeAuto = false; - } + Background::Background() : bColor (false), bThemeColor(false) {} std::wstring Background::Write() { std::wstring sBackground = L""; pCStringWriter->WriteString(sStyle); - if(!Name.empty()) + if (!Name.empty()) { pCStringWriter->WriteString(L""); } @@ -365,9 +239,9 @@ namespace BinDocxRW { pCStringWriter->WriteEncodeXmlString(Link); pCStringWriter->WriteString(L"\"/>"); } - if(bautoRedefine) + if (bautoRedefine) { - if(autoRedefine) + if (autoRedefine) pCStringWriter->WriteString(L""); else pCStringWriter->WriteString(L""); @@ -411,47 +285,46 @@ namespace BinDocxRW { else pCStringWriter->WriteString(L""); } - if(bpersonal) + if (bpersonal) { - if(personal) + if (personal) pCStringWriter->WriteString(L""); else pCStringWriter->WriteString(L""); } - if(bpersonalCompose) + if (bpersonalCompose) { - if(personalCompose) + if (personalCompose) pCStringWriter->WriteString(L""); else pCStringWriter->WriteString(L""); } - if(bpersonalReply) + if (bpersonalReply) { - if(personalReply) + if (personalReply) pCStringWriter->WriteString(L""); else pCStringWriter->WriteString(L""); } - if(!ParaPr.empty()) + if (!ParaPr.empty()) { - pCStringWriter->WriteString(L""); pCStringWriter->WriteString(ParaPr); - pCStringWriter->WriteString(L""); } - if(!TextPr.empty()) + if (!TextPr.empty()) { pCStringWriter->WriteString(TextPr); } - - if(!TablePr.empty()) + if (!TablePr.empty()) + { pCStringWriter->WriteString(TablePr); - if(!RowPr.empty()) + } + if (!RowPr.empty()) { pCStringWriter->WriteString(L""); pCStringWriter->WriteString(RowPr); pCStringWriter->WriteString(L""); } - if(!CellPr.empty()) + if (!CellPr.empty()) { pCStringWriter->WriteString(L""); pCStringWriter->WriteString(CellPr); @@ -499,11 +372,11 @@ namespace BinDocxRW { } void docImg::Write(NSStringUtils::CStringBuilder* pCStringWriter) { - if(bType) + if (bType) { - if(c_oAscWrapStyle::Inline == Type) + if (c_oAscWrapStyle::Inline == Type) { - if(bWidth && bHeight) + if (bWidth && bHeight) { _INT64 nWidth = (_INT64)(g_dKoef_mm_to_emu * Width); _INT64 nHeight = (_INT64)(g_dKoef_mm_to_emu * Height); @@ -515,9 +388,9 @@ namespace BinDocxRW { pCStringWriter->WriteString(sDrawing); } } - else if(c_oAscWrapStyle::Flow == Type) + else if (c_oAscWrapStyle::Flow == Type) { - if(bX && bY && bWidth && bHeight) + if (bX && bY && bWidth && bHeight) { _INT64 nX = (_INT64)(g_dKoef_mm_to_emu * X); _INT64 nY = (_INT64)(g_dKoef_mm_to_emu * Y); @@ -527,12 +400,12 @@ namespace BinDocxRW { _UINT32 nPaddingTop = 0; _UINT32 nPaddingRight = 0; _UINT32 nPaddingBottom = 0; - if(bPaddings) + if (bPaddings) { - if(Paddings.bLeft) nPaddingLeft = (_UINT32)(g_dKoef_mm_to_emu * Paddings.Left); - if(Paddings.bTop) nPaddingTop = (_UINT32)(g_dKoef_mm_to_emu * Paddings.Top); - if(Paddings.bRight) nPaddingRight = (_UINT32)(g_dKoef_mm_to_emu * Paddings.Right); - if(Paddings.bBottom) nPaddingBottom = (_UINT32)(g_dKoef_mm_to_emu * Paddings.Bottom); + if (Paddings.bLeft) nPaddingLeft = (_UINT32)(g_dKoef_mm_to_emu * Paddings.Left); + if (Paddings.bTop) nPaddingTop = (_UINT32)(g_dKoef_mm_to_emu * Paddings.Top); + if (Paddings.bRight) nPaddingRight = (_UINT32)(g_dKoef_mm_to_emu * Paddings.Right); + if (Paddings.bBottom) nPaddingBottom = (_UINT32)(g_dKoef_mm_to_emu * Paddings.Bottom); } std::wstring sDrawing = L"WriteString(L"<"); - pCStringWriter->WriteString(sName); - if(border_Single == Value) - pCStringWriter->WriteString(L" w:val=\"single\""); - else - pCStringWriter->WriteString(L" w:val=\"none\""); - if(bColor) - { - pCStringWriter->WriteString(L" w:color=\"" + Color.ToString() + L"\""); - } - if(bThemeColor && ThemeColor.IsNoEmpty()) - { - if(ThemeColor.Auto && !bColor) - { - std::wstring sAuto(L" w:color=\"auto\""); - pCStringWriter->WriteString(sAuto); - } - if(ThemeColor.bColor) - { - pCStringWriter->WriteString(L" w:themeColor=\"" + ThemeColor.ToStringColor() + L"\""); - } - if(ThemeColor.bTint) - { - pCStringWriter->WriteString(L" w:themeTint=\"" + ThemeColor.ToStringTint() + L"\""); - } - if(ThemeColor.bShade) - { - pCStringWriter->WriteString(L" w:themeShade=\"" + ThemeColor.ToStringShade() + L"\""); - } - } - if(bSize) - { - pCStringWriter->WriteString(L" w:sz=\"" + std::to_wstring(Size) + L"\""); - } - if(bSpace) - { - pCStringWriter->WriteString(L" w:space=\"" + std::to_wstring(Space) + L"\""); - } - pCStringWriter->WriteString(L"/>"); - } - else - { - pCStringWriter->WriteString(L"<"); - pCStringWriter->WriteString(sName); - if(false != bCell) - pCStringWriter->WriteString(L" w:val=\"nil\""); - else - pCStringWriter->WriteString(L" w:val=\"none\" w:sz=\"0\" w:space=\"0\" w:color=\"auto\""); - pCStringWriter->WriteString(L"/>"); - } - } - - docBorders::docBorders() - { - bLeft = false; - bTop = false; - bRight = false; - bBottom = false; - bInsideV = false; - bInsideH = false; - bBetween = false; - } - bool docBorders::IsEmpty() - { - return !(bLeft || bTop || bRight || bBottom || bInsideV || bInsideH || bBetween); - } - void docBorders::Write(NSStringUtils::CStringBuilder* pCStringWriter, bool bCell) - { - if(bTop) - oTop.Write(L"w:top", pCStringWriter, bCell); - if(bLeft) - oLeft.Write(L"w:left", pCStringWriter, bCell); - if(bBottom) - oBottom.Write(L"w:bottom", pCStringWriter, bCell); - if(bRight) - oRight.Write(L"w:right", pCStringWriter, bCell); - if(bInsideH) - oInsideH.Write(L"w:insideH", pCStringWriter, bCell); - if(bInsideV) - oInsideV.Write(L"w:insideV", pCStringWriter, bCell); - if(bBetween) - oBetween.Write(L"w:between", pCStringWriter, bCell); - } rowPrAfterBefore::rowPrAfterBefore(std::wstring name) { sName = name; @@ -692,18 +470,18 @@ namespace BinDocxRW { } void rowPrAfterBefore::Write(NSStringUtils::CStringBuilder& writer) { - if(bGridAfter && nGridAfter > 0) + if (bGridAfter && nGridAfter > 0) { writer.WriteString(L""); } - if(oAfterWidth.bW) + if (oAfterWidth.bW) oAfterWidth.Write(writer, _T("w:w") + sName); } WriteHyperlink* WriteHyperlink::Parse(std::wstring fld) { WriteHyperlink* res = NULL; - if(-1 != fld.find(L"HYPERLINK")) + if (-1 != fld.find(L"HYPERLINK")) { std::wstring sLink; std::wstring sTooltip; @@ -717,16 +495,16 @@ namespace BinDocxRW { for(size_t i = 0, length = fld.length(); i < length; ++i) { wchar_t sCurLetter = fld[i]; - if('\"' == sCurLetter) + if ('\"' == sCurLetter) bDQuot = !bDQuot; - else if('\\' == sCurLetter && true == bDQuot && i + 1 < length && '\"' == fld[i + 1]) + else if ('\\' == sCurLetter && true == bDQuot && i + 1 < length && '\"' == fld[i + 1]) { i++; sCurItem += fld[i]; } - else if(' ' == sCurLetter && false == bDQuot) + else if (' ' == sCurLetter && false == bDQuot) { - if(sCurItem.length() > 0) + if (sCurItem.length() > 0) { aItems.push_back(sCurItem); sCurItem = _T(""); @@ -735,42 +513,42 @@ namespace BinDocxRW { else sCurItem += sCurLetter; } - if(sCurItem.length() > 0) + if (sCurItem.length() > 0) aItems.push_back(sCurItem); for(size_t i = 0, length = aItems.size(); i < length; ++i) { std::wstring item = aItems[i]; - if(bNextLink) + if (bNextLink) { bNextLink = false; sLink = item; } - if(bNextTooltip) + if (bNextTooltip) { bNextTooltip = false; sTooltip = item; } - if(L"HYPERLINK" == item) + if (L"HYPERLINK" == item) bNextLink = true; - else if(L"\\o" == item) + else if (L"\\o" == item) bNextTooltip = true; } - if(false == sLink.empty()) + if (false == sLink.empty()) { res = new WriteHyperlink(); boost::algorithm::trim(sLink); _INT32 nAnchorIndex = (_INT32)sLink.find(L"#"); - if(-1 != nAnchorIndex) + if (-1 != nAnchorIndex) { res->href = sLink.substr(0, nAnchorIndex); res->anchor = sLink.substr(nAnchorIndex); } else res->href = sLink; - if(false == sTooltip.empty()) + if (false == sTooltip.empty()) { res->tooltip = boost::algorithm::trim_copy(sTooltip); } @@ -780,20 +558,20 @@ namespace BinDocxRW { } void WriteHyperlink::Write(NSStringUtils::CStringBuilder& wr) { - if(false == rId.empty()) + if (false == rId.empty()) { std::wstring sCorrect_rId = XmlUtils::EncodeXmlString(rId); std::wstring sCorrect_tooltip = XmlUtils::EncodeXmlString(tooltip); std::wstring sCorrect_anchor = XmlUtils::EncodeXmlString(anchor); std::wstring sStart = L"bIdFormat) + if (!pComment->bIdFormat) { pComment->bIdFormat = true; pComment->IdFormat = pComment->m_oFormatIdCounter.getNextId(); @@ -879,7 +657,7 @@ namespace BinDocxRW { void CComment::writeContentWritePart(CComment* pComment, std::wstring& sText, _INT32 nPrevIndex, _INT32 nCurIndex, std::wstring& sRes) { std::wstring sPart; - if(nPrevIndex < nCurIndex) + if (nPrevIndex < nCurIndex) sPart = XmlUtils::EncodeXmlString(sText.substr(nPrevIndex, nCurIndex - nPrevIndex)); _INT32 nId = pComment->m_oParaIdCounter.getNextId(); @@ -893,27 +671,27 @@ namespace BinDocxRW { std::wstring CComment::writeContent(CComment* pComment) { std::wstring sRes; - if(!pComment->bIdFormat) + if (!pComment->bIdFormat) { pComment->bIdFormat = true; pComment->IdFormat = pComment->m_oFormatIdCounter.getNextId(); } sRes += L"IdFormat) + L"\""; - if(false == pComment->UserName.empty()) + if (false == pComment->UserName.empty()) { std::wstring sUserName = XmlUtils::EncodeXmlString(pComment->UserName); sRes += L" w:author=\""; sRes += (sUserName); sRes += L"\""; } - if(false == pComment->Date.empty()) + if (false == pComment->Date.empty()) { std::wstring sDate = XmlUtils::EncodeXmlString(pComment->Date); sRes += L" w:date=\""; sRes += sDate; sRes += L"\""; } - if(false == pComment->Initials.empty()) + if (false == pComment->Initials.empty()) { sRes += L" w:initials=\""; sRes += XmlUtils::EncodeXmlString(pComment->Initials); @@ -936,7 +714,7 @@ namespace BinDocxRW { for (size_t i = 0; i < sText.length(); i++) { wchar_t cToken = sText[i]; - if('\n' == cToken) + if ('\n' == cToken) { writeContentWritePart(pComment, sText, nPrevIndex, i, sRes); nPrevIndex = i + 1; @@ -950,12 +728,12 @@ namespace BinDocxRW { std::wstring CComment::writeContentExt(CComment* pComment) { std::wstring sRes; - if(false == pComment->sParaId.empty()) + if (false == pComment->sParaId.empty()) { std::wstring sDone(L"0"); - if(pComment->bSolved && pComment->Solved) + if (pComment->bSolved && pComment->Solved) sDone = _T("1"); - if(!pComment->sParaIdParent.empty()) + if (!pComment->sParaIdParent.empty()) sRes += L"sParaId + L"\" \ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\"/>"; else @@ -969,7 +747,7 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ std::wstring CComment::writeContentExtensible(CComment* pComment) { std::wstring sRes; - if(pComment->bDurableId && !pComment->DateUtc.empty()) + if (pComment->bDurableId && !pComment->DateUtc.empty()) { sRes += L"DurableId, L"%08X") + L"\" w16cex:dateUtc=\"" + pComment->DateUtc + L"\"/>"; } @@ -978,7 +756,7 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ std::wstring CComment::writeContentUserData(CComment* pComment) { std::wstring sRes; - if(pComment->bDurableId && !pComment->UserData.empty()) + if (pComment->bDurableId && !pComment->UserData.empty()) { sRes += L"DurableId, L"%08X") + L"\">"; sRes += L"sParaIdParent + L"\" w15:done=\"" + sDone + L"\ std::wstring CComment::writeContentsIds(CComment* pComment) { std::wstring sRes; - if(!pComment->sParaId.empty() && pComment->bDurableId) + if (!pComment->sParaId.empty() && pComment->bDurableId) { sRes += L"sParaId + L"\" w16cid:durableId=\"" + XmlUtils::ToString(pComment->DurableId, L"%08X") + L"\"/>"; } @@ -999,12 +777,12 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ std::wstring CComment::writePeople(CComment* pComment) { std::wstring sRes; - if(false == pComment->UserName.empty()) + if (false == pComment->UserName.empty()) { sRes += L"UserName); sRes += L"\">"; - if(!pComment->ProviderId.empty() && !pComment->UserId.empty()) + if (!pComment->ProviderId.empty() && !pComment->UserId.empty()) { sRes += L"ProviderId); @@ -1030,7 +808,7 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ } void CComments::add(CComment* pComment) { - if(pComment->bIdOpen) + if (pComment->bIdOpen) { m_mapComments[pComment->IdOpen] = pComment; addAuthor(pComment); @@ -1040,14 +818,14 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ } void CComments::addAuthor(CComment* pComment) { - if(false == pComment->UserName.empty() && false == pComment->UserId.empty()) + if (false == pComment->UserName.empty() && false == pComment->UserId.empty()) m_mapAuthors[pComment->UserName] = pComment; } CComment* CComments::get(_INT32 nInd) { CComment* pRes = NULL; boost::unordered_map<_INT32, CComment*>::const_iterator pair = m_mapComments.find(nInd); - if(m_mapComments.end() != pair) + if (m_mapComments.end() != pair) pRes = pair->second; return pRes; } @@ -1181,15 +959,15 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ } std::wstring CDrawingProperty::Write() { - if(!bType) return L""; + if (!bType) return L""; std::wstring sXml; bool bGraphicFrameContent = IsGraphicFrameContent(); - if(c_oAscWrapStyle::Inline == Type) + if (c_oAscWrapStyle::Inline == Type) { - if(bWidth && bHeight) + if (bWidth && bHeight) { if (bGraphicFrameContent) { @@ -1203,13 +981,13 @@ xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawin distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\">"; } - if(bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB) + if (bEffectExtentL && bEffectExtentT && bEffectExtentR && bEffectExtentB) { sXml += L""; } - if(!sDocPr.empty()) + if (!sDocPr.empty()) { sXml += sDocPr; } @@ -1237,7 +1015,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\">"; _INT64 emuX = 0; - if(bSimplePosX) + if (bSimplePosX) emuX = SimplePosX; _INT64 emuY = 0; - if(bSimplePosY) + if (bSimplePosY) emuY = SimplePosY; sXml += L""; @@ -1308,7 +1086,7 @@ allowOverlap=\"1\">"; case 7: sRelativeFrom = _T("rightMargin");break; } std::wstring sContent; - if(bPositionHAlign) + if (bPositionHAlign) { switch(PositionHAlign) { @@ -1319,11 +1097,11 @@ allowOverlap=\"1\">"; case 4: sContent = _T("right"); break; } } - else if(bPositionHPosOffset) + else if (bPositionHPosOffset) { sContent = L"" + std::to_wstring(PositionHPosOffset) + L""; } - else if(bPositionHPctOffset) + else if (bPositionHPctOffset) { _INT32 pctOffset = (_INT32)(1000 * PositionHPctOffset); sContent = L"" + std::to_wstring(pctOffset) + L""; @@ -1356,11 +1134,11 @@ allowOverlap=\"1\">"; case 4: sContent = _T("top");break; } } - else if(bPositionVPosOffset) + else if (bPositionVPosOffset) { sContent = L"" + std::to_wstring(PositionVPosOffset) + L""; } - else if(bPositionVPctOffset) + else if (bPositionVPctOffset) { _INT32 pctOffset = (_INT32)(1000 * PositionVPctOffset); sContent = L"" + std::to_wstring(pctOffset) + L""; @@ -1386,9 +1164,9 @@ allowOverlap=\"1\">"; case c_oSerImageType2::WrapTight:sTagName = _T("wrapTight"); break; case c_oSerImageType2::WrapTopAndBottom:sTagName = _T("wrapTopAndBottom"); break; } - if(DrawingPropertyWrap.bStart || DrawingPropertyWrap.Points.size() > 0) + if (DrawingPropertyWrap.bStart || DrawingPropertyWrap.Points.size() > 0) { - if( c_oSerImageType2::WrapSquare == DrawingPropertyWrap.WrappingType || + if ( c_oSerImageType2::WrapSquare == DrawingPropertyWrap.WrappingType || c_oSerImageType2::WrapThrough == DrawingPropertyWrap.WrappingType || c_oSerImageType2::WrapTight == DrawingPropertyWrap.WrappingType) { @@ -1398,11 +1176,11 @@ allowOverlap=\"1\">"; sXml += L""; _INT32 nEdited = 0; - if(DrawingPropertyWrap.bEdited && DrawingPropertyWrap.Edited) + if (DrawingPropertyWrap.bEdited && DrawingPropertyWrap.Edited) nEdited = 1; sXml += L""; - if(DrawingPropertyWrap.bStart && DrawingPropertyWrap.Start.bX && DrawingPropertyWrap.Start.bY) + if (DrawingPropertyWrap.bStart && DrawingPropertyWrap.Start.bX && DrawingPropertyWrap.Start.bY) { sXml += L""; } @@ -1410,7 +1188,7 @@ allowOverlap=\"1\">"; for(size_t i = 0; i < DrawingPropertyWrap.Points.size(); ++i) { CDrawingPropertyWrapPoint* pWrapPoint = DrawingPropertyWrap.Points[i]; - if(pWrapPoint->bX && pWrapPoint->bY) + if (pWrapPoint->bX && pWrapPoint->bY) { sXml += L"X) + L"\" y=\"" + std::to_wstring(pWrapPoint->Y) + L"\"/>"; } @@ -1421,7 +1199,7 @@ allowOverlap=\"1\">"; else { //для wrapThrough и wrapTight wrapPolygon обязательное поле, если его нет - меняем тип. - if( c_oSerImageType2::WrapSquare == DrawingPropertyWrap.WrappingType || + if ( c_oSerImageType2::WrapSquare == DrawingPropertyWrap.WrappingType || c_oSerImageType2::WrapThrough == DrawingPropertyWrap.WrappingType || c_oSerImageType2::WrapTight == DrawingPropertyWrap.WrappingType) { @@ -1434,7 +1212,7 @@ allowOverlap=\"1\">"; else sXml += L""; - if(!sDocPr.empty()) + if (!sDocPr.empty()) { sXml += sDocPr; } @@ -1442,7 +1220,7 @@ allowOverlap=\"1\">"; { sXml += L""; } - if(!sGraphicFramePr.empty()) + if (!sGraphicFramePr.empty()) { sXml += sGraphicFramePr; } @@ -1455,11 +1233,11 @@ allowOverlap=\"1\">"; sXml += sGraphicFrameContent; } - if(!sSizeRelH.empty()) + if (!sSizeRelH.empty()) { sXml += sSizeRelH; } - if(!sSizeRelV.empty()) + if (!sSizeRelV.empty()) { sXml += sSizeRelV; } @@ -1481,201 +1259,52 @@ allowOverlap=\"1\">"; { std::wstring sRes; sRes += L""; - if(false == Style.empty()) + if (false == Style.empty()) sRes += (Style); - if(false == tblpPr.empty()) + if (false == tblpPr.empty()) sRes += (tblpPr); - if(!RowBandSize.empty()) + if (!RowBandSize.empty()) sRes += (RowBandSize); - if(!ColBandSize.empty()) + if (!ColBandSize.empty()) sRes += (ColBandSize); if (!Overlap.empty()) sRes += (Overlap); - if(false == TableW.empty()) + if (false == TableW.empty()) sRes += (TableW); - if(false == Jc.empty()) + if (false == Jc.empty()) sRes += (Jc); - if(false == TableCellSpacing.empty()) + if (false == TableCellSpacing.empty()) sRes += (TableCellSpacing); - if(false == TableInd.empty()) + if (false == TableInd.empty()) sRes += (TableInd); - if(false == TableBorders.empty()) + if (false == TableBorders.empty()) sRes += (TableBorders); - if(false == Shd.empty()) + if (false == Shd.empty()) sRes += (Shd); - if(false == Layout.empty()) + if (false == Layout.empty()) sRes += (Layout); - if(false == TableCellMar.empty()) + if (false == TableCellMar.empty()) sRes += (TableCellMar); - if(false == Look.empty()) + if (false == Look.empty()) sRes += (Look); - if(!Caption.empty()) + if (!Caption.empty()) { sRes += L""; } - if(!Description.empty()) + if (!Description.empty()) { sRes += L""; } - if(!tblPrChange.empty()) + if (!tblPrChange.empty()) sRes += (tblPrChange); sRes += L""; return sRes; } - CFramePr::CFramePr() - { - bDropCap = false; - bH = false; - bHAnchor = false; - bHRule = false; - bHSpace = false; - bLines = false; - bVAnchor = false; - bVSpace = false; - bW = false; - bWrap = false; - bX = false; - bXAlign = false; - bY = false; - bYAlign = false; - } - bool CFramePr::IsEmpty() - { - return !(bDropCap || bH || bHAnchor || bHRule || bHSpace || bLines || bVAnchor || bVSpace || bW || bWrap || bX || bXAlign || bY || bYAlign); - } - void CFramePr::Write(NSStringUtils::CStringBuilder& oStringWriter) - { - oStringWriter.WriteString(L""); - } - CHyperlink::CHyperlink() { bHistory = false; @@ -1683,19 +1312,19 @@ allowOverlap=\"1\">"; void CHyperlink::Write(NSStringUtils::CStringBuilder& wr) { wr.WriteString(L""; } void CFldSimple::Write(NSStringUtils::CStringBuilder& wr) { - if(false == sInstr.empty()) + if (false == sInstr.empty()) { std::wstring sCorrect_Instr = XmlUtils::EncodeXmlString(sInstr); std::wstring sStart(L""; Id = NULL; vMerge = NULL; vMergeOrigin = NULL; - RPr = NULL; - PPr = NULL; - sectPr = NULL; tblPr = NULL; tblGridChange = NULL; trPr = NULL; @@ -1766,9 +1392,6 @@ allowOverlap=\"1\">"; RELEASEOBJECT(Id); RELEASEOBJECT(vMerge); RELEASEOBJECT(vMergeOrigin); - RELEASEOBJECT(RPr); - RELEASEOBJECT(PPr); - RELEASEOBJECT(sectPr); RELEASEOBJECT(tblPr); RELEASEOBJECT(tblGridChange); RELEASEOBJECT(trPr); @@ -1808,29 +1431,14 @@ allowOverlap=\"1\">"; { pCStringWriter->WriteString(L" w:vMerge=\"" + std::to_wstring(*vMerge) + L"\""); } - if (NULL != vMergeOrigin) + if ( NULL != vMergeOrigin ) { pCStringWriter->WriteString(L" w:vMergeOrig=\"" + std::to_wstring(*vMergeOrigin) + L"\""); } - if (NULL != RPr || NULL != PPr || NULL != sectPr || NULL != tblPr || NULL != tblGridChange || NULL != trPr || NULL != tcPr || NULL != content || NULL != contentRun) + if ( NULL != tblPr || NULL != tblGridChange || NULL != trPr || NULL != tcPr || NULL != content || NULL != contentRun) { pCStringWriter->WriteString(L">"); - if (NULL != RPr) - { - pCStringWriter->WriteString(RPr->toXML()); - } - if (NULL != PPr) - { - pCStringWriter->WriteString(L""); - pCStringWriter->Write(*PPr); - pCStringWriter->WriteString(L""); - } - if (NULL != sectPr) - { - pCStringWriter->WriteString(L""); - pCStringWriter->WriteString(sectPr->Write()); - pCStringWriter->WriteString(L""); - } + if (NULL != tblPr) { pCStringWriter->WriteString(tblPr->Write()); diff --git a/OOXML/Binary/Document/BinReader/ReaderClasses.h b/OOXML/Binary/Document/BinReader/ReaderClasses.h index 3dcc188fcc..f4f6a66a56 100644 --- a/OOXML/Binary/Document/BinReader/ReaderClasses.h +++ b/OOXML/Binary/Document/BinReader/ReaderClasses.h @@ -35,6 +35,7 @@ #include "../../../Base/Unit.h" #include "../../../DocxFormat/Logic/RunProperty.h" +#include "../../../DocxFormat/Logic/ParagraphProperty.h" #include "../BinWriter/BinReaderWriterDefines.h" #include @@ -42,51 +43,6 @@ namespace BinDocxRW { -class SectPr -{ -public: - std::wstring sHeaderFooterReference; - _INT32 W; - _INT32 H; - BYTE cOrientation; - _INT32 Left; - _INT32 Top; - _INT32 Right; - _INT32 Bottom; - _INT32 Header; - _INT32 Footer; - bool TitlePg; - bool EvenAndOddHeaders; - BYTE SectionType; - _INT32 PageNumStart; - std::wstring sectPrChange; - std::wstring cols; - std::wstring pgBorders; - std::wstring footnotePr; - std::wstring endnotePr; - std::wstring lineNum; - bool RtlGutter; - _INT32 Gutter; - - bool bW; - bool bH; - bool bOrientation; - bool bLeft; - bool bTop; - bool bRight; - bool bBottom; - bool bHeader; - bool bFooter; - bool bTitlePg; - bool bEvenAndOddHeaders; - bool bSectionType; - bool bPageNumStart; - bool bRtlGutter; - bool bGutter; - - SectPr(); - std::wstring Write(); -}; class docRGB { public: @@ -121,27 +77,6 @@ public: nullable& oThemeTint, nullable& oThemeShade); }; -class Spacing -{ -public: - bool bLineRule; - bool bLine; - bool bLineTwips; - bool bAfter; - bool bBefore; - bool bAfterAuto; - bool bBeforeAuto; - - BYTE LineRule; - double Line; - _INT32 LineTwips; - _INT32 After; - _INT32 Before; - bool AfterAuto; - bool BeforeAuto; - - Spacing(); -}; class Background { public: @@ -158,22 +93,6 @@ public: std::wstring Write(); }; -class Tab -{ -public: - SimpleTypes::CTabJc Val; - long Pos; - BYTE Leader; - bool bLeader; - - Tab(); -}; -class Tabs -{ -public: - std::vector m_aTabs; -}; - class docStyle { public: @@ -304,51 +223,6 @@ public: void Write(NSStringUtils::CStringBuilder& pCStringWriter, const std::wstring& sName); std::wstring Write(const std::wstring& sName); }; -class docBorder -{ -public: - docRGB Color; - long Space; - long Size; - BYTE Value; - CThemeColor ThemeColor; - - bool bColor; - bool bSpace; - bool bSize; - bool bValue; - bool bThemeColor; - - docBorder(); - - void Write(std::wstring sName, NSStringUtils::CStringBuilder* pCStringWriter, bool bCell); -}; -class docBorders -{ -public: - docBorder oLeft; - docBorder oTop; - docBorder oRight; - docBorder oBottom; - docBorder oInsideV; - docBorder oInsideH; - docBorder oBetween; - - bool bLeft; - bool bTop; - bool bRight; - bool bBottom; - bool bInsideV; - bool bInsideH; - bool bBetween; - -public: - docBorders(); - - bool IsEmpty(); - void Write(NSStringUtils::CStringBuilder* pCStringWriter, bool bCell); -}; - class rowPrAfterBefore { public: @@ -590,45 +464,6 @@ public: bool IsEmpty(); std::wstring Write(); }; -class CFramePr -{ -public: - bool bDropCap; - bool bH; - bool bHAnchor; - bool bHRule; - bool bHSpace; - bool bLines; - bool bVAnchor; - bool bVSpace; - bool bW; - bool bWrap; - bool bX; - bool bXAlign; - bool bY; - bool bYAlign; - - BYTE DropCap; - _INT32 H; - BYTE HAnchor; - BYTE HRule; - _INT32 HSpace; - _INT32 Lines; - BYTE VAnchor; - _INT32 VSpace; - _INT32 W; - BYTE Wrap; - _INT32 X; - BYTE XAlign; - _INT32 Y; - BYTE YAlign; - -public: - CFramePr(); - - bool IsEmpty(); - void Write(NSStringUtils::CStringBuilder& oStringWriter); -}; class CHyperlink{ public: std::wstring rId; @@ -671,8 +506,6 @@ public: OOX::Logic::CRunProperty* RPr; - NSStringUtils::CStringBuilder* PPr; - SectPr* sectPr; CWiterTblPr* tblPr; NSStringUtils::CStringBuilder* tblGridChange; NSStringUtils::CStringBuilder* trPr; diff --git a/OOXML/Binary/Document/BinReader/Readers.cpp b/OOXML/Binary/Document/BinReader/Readers.cpp index f40c1374e7..260a5604af 100644 --- a/OOXML/Binary/Document/BinReader/Readers.cpp +++ b/OOXML/Binary/Document/BinReader/Readers.cpp @@ -46,6 +46,7 @@ #include "../../../DocxFormat/Math/oMathContent.h" #include "../../../DocxFormat/Logic/DocParts.h" #include "../../../DocxFormat/Logic/SectionProperty.h" +#include "../../../DocxFormat/Logic/TableProperty.h" #include "../../../DocxFormat/Logic/Sdt.h" #include "../../../DocxFormat/Numbering.h" @@ -105,12 +106,12 @@ public: break;\ long read1defLength = m_oBufferedStream.GetLong();\ res = fReadFunction(read1defType, read1defLength, arg);\ - if(res == c_oSerConstants::ReadUnknown)\ + if (res == c_oSerConstants::ReadUnknown)\ {\ m_oBufferedStream.GetPointer(read1defLength);\ res = c_oSerConstants::ReadOk;\ }\ - else if(res != c_oSerConstants::ReadOk)\ + else if (res != c_oSerConstants::ReadOk)\ break;\ read1defCurPos += read1defLength + 5;\ }\ @@ -141,14 +142,14 @@ public: case c_oSerPropLenType::Long64: read2defRealLen = 8;break;\ default:res = c_oSerConstants::ErrorUnknown;break;\ }\ - if(res == c_oSerConstants::ReadOk)\ + if (res == c_oSerConstants::ReadOk)\ res = fReadFunction(read2defType, read2defRealLen, arg);\ - if(res == c_oSerConstants::ReadUnknown)\ + if (res == c_oSerConstants::ReadUnknown)\ {\ m_oBufferedStream.GetPointer(read2defRealLen);\ res = c_oSerConstants::ReadOk;\ }\ - else if(res != c_oSerConstants::ReadOk)\ + else if (res != c_oSerConstants::ReadOk)\ break;\ read2defCurPos += read2defRealLen + read2defCurPosShift;\ }\ @@ -164,36 +165,85 @@ public: }\ } #define READ1_TRACKREV(type, length, poResult) \ - if(c_oSerProp_RevisionType::Author == type)\ + if (c_oSerProp_RevisionType::Author == type)\ {\ poResult->Author = m_oBufferedStream.GetString3(length);\ }\ - else if(c_oSerProp_RevisionType::Date == type)\ + else if (c_oSerProp_RevisionType::Date == type)\ {\ poResult->Date = m_oBufferedStream.GetString3(length);\ }\ - else if(c_oSerProp_RevisionType::Id == type)\ + else if (c_oSerProp_RevisionType::Id == type)\ {\ poResult->Id = new _INT32(m_oBufferedStream.GetLong());\ }\ - else if(c_oSerProp_RevisionType::UserId == type)\ + else if (c_oSerProp_RevisionType::UserId == type)\ {\ poResult->UserId = m_oBufferedStream.GetString3(length);\ } +//------------------------------------------------------------------------------------------------------------------ +#define READ1_BORDERS_START2 \ +if (c_oSerBordersType::left == type)\ +{\ + pBorders->m_oStart.Init();\ + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oStart.GetPointer());\ +}\ +else if (c_oSerBordersType::right == type)\ +{\ + pBorders->m_oEnd.Init();\ + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oEnd.GetPointer());\ +}\ +else if (c_oSerBordersType::insideV == type)\ +{\ + pBorders->m_oInsideV.Init();\ + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oInsideV.GetPointer());\ +}\ +else if (c_oSerBordersType::insideH == type)\ +{\ + pBorders->m_oInsideH.Init();\ + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oInsideH.GetPointer());\ +}\ +READ1_BORDERS_START +//------------------------------------------------------------------------------------------------------------------ +#define READ1_BORDERS_START1 \ +if (c_oSerBordersType::left == type)\ +{\ + pBorders->m_oLeft.Init();\ + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oLeft.GetPointer());\ +}\ +else if (c_oSerBordersType::right == type)\ +{\ + pBorders->m_oRight.Init();\ + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oRight.GetPointer());\ +}\ +READ1_BORDERS_START +//------------------------------------------------------------------------------------------------- +#define READ1_BORDERS_START \ +else if (c_oSerBordersType::top == type)\ +{\ + pBorders->m_oTop.Init();\ + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oTop.GetPointer());\ +}\ +else if (c_oSerBordersType::bottom == type)\ +{\ + pBorders->m_oBottom.Init();\ + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oBottom.GetPointer());\ +} +//------------------------------------------------------------------------------------------------------------------ #define READ1_TRACKREV_2(type, length, poResult) \ - if(c_oSerProp_RevisionType::Author == type)\ + if (c_oSerProp_RevisionType::Author == type)\ {\ poResult->m_sAuthor = m_oBufferedStream.GetString3(length);\ }\ - else if(c_oSerProp_RevisionType::Date == type)\ + else if (c_oSerProp_RevisionType::Date == type)\ {\ poResult->m_oDate.Init(); poResult->m_oDate->SetValue(m_oBufferedStream.GetString3(length));\ }\ - else if(c_oSerProp_RevisionType::Id == type)\ + else if (c_oSerProp_RevisionType::Id == type)\ {\ poResult->m_oId.Init(); poResult->m_oId->SetValue( m_oBufferedStream.GetLong());\ }\ - else if(c_oSerProp_RevisionType::UserId == type)\ + else if (c_oSerProp_RevisionType::UserId == type)\ {\ poResult->m_sUserId = m_oBufferedStream.GetString3(length);\ } @@ -391,9 +441,9 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes case c_oSerHdrFtrTypes::HdrFtr_Even:poHdrFtrItem = new Writers::HdrFtrItem(SimpleTypes::hdrftrEven);break; case c_oSerHdrFtrTypes::HdrFtr_Odd:poHdrFtrItem = new Writers::HdrFtrItem(SimpleTypes::hdrftrDefault);break; } - if(NULL != poHdrFtrItem) + if (NULL != poHdrFtrItem) { - if(nCurType == c_oSerHdrFtrTypes::Header) + if (nCurType == c_oSerHdrFtrTypes::Header) { m_oHeaderFooterWriter.m_aHeaders.push_back(poHdrFtrItem); poHdrFtrItem->m_sFilename = L"header" + std::to_wstring((int)m_oHeaderFooterWriter.m_aHeaders.size()) + L".xml"; @@ -464,7 +514,7 @@ int Binary_rPrReader::ReadContent(BYTE type, long length, void* poResult) case c_oSerProp_rPrType::FontAscii: { std::wstring sFontName = XmlUtils::EncodeXmlString(m_oBufferedStream.GetString3(length)); - if(!sFontName.empty()) + if (!sFontName.empty()) { m_mapFonts[sFontName] = 1; if (!pRPr->m_oRFonts.IsInit()) pRPr->m_oRFonts.Init(); @@ -868,258 +918,119 @@ int Binary_pPrReader::Read(long stLen, void* poResult) READ2_DEF(stLen, res, this->ReadContent, poResult); return res; }; -int Binary_pPrReader::ReadContent( BYTE type, long length, void* poResult) +int Binary_pPrReader::ReadContent(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - switch(type) + OOX::Logic::CParagraphProperty* pPPr = static_cast(poResult); + + switch (type) { case c_oSerProp_pPrType::ContextualSpacing: - { - BYTE contextualSpacing = m_oBufferedStream.GetUChar(); - if(0 != contextualSpacing) - pCStringWriter->WriteString(std::wstring(L"")); - else if(false == bDoNotWriteNullProp) - pCStringWriter->WriteString(std::wstring(L"")); - }break; + { + pPPr->m_oContextualSpacing.Init(); + pPPr->m_oContextualSpacing->m_oVal.FromBool(m_oBufferedStream.GetUChar()); + }break; case c_oSerProp_pPrType::Ind: - { - NSStringUtils::CStringBuilder oTempWriter; - READ2_DEF(length, res, this->ReadInd, &oTempWriter); - if(oTempWriter.GetCurSize() > 0) - { - pCStringWriter->WriteString(std::wstring(L"Write(oTempWriter); - pCStringWriter->WriteString(std::wstring(L"/>")); - } - break; - } + { + pPPr->m_oInd.Init(); + NSStringUtils::CStringBuilder oTempWriter; + READ2_DEF(length, res, this->ReadInd, pPPr->m_oInd.GetPointer()); + }break; case c_oSerProp_pPrType::Jc: + { + BYTE jc = m_oBufferedStream.GetUChar(); + + pPPr->m_oJc.Init(); + pPPr->m_oJc->m_oVal.Init(); + + switch (jc) { - BYTE jc = m_oBufferedStream.GetUChar(); - switch(jc) - { - case align_Right: pCStringWriter->WriteString(std::wstring(L""));break; - case align_Left: pCStringWriter->WriteString(std::wstring(L""));break; - case align_Center: pCStringWriter->WriteString(std::wstring(L""));break; - case align_Justify: pCStringWriter->WriteString(std::wstring(L""));break; - } - }break; + case align_Right: pPPr->m_oJc->m_oVal->SetValueFromByte(3); break; + case align_Left: pPPr->m_oJc->m_oVal->SetValueFromByte(8); break; + case align_Center: pPPr->m_oJc->m_oVal->SetValueFromByte(1); break; + case align_Justify: pPPr->m_oJc->m_oVal->SetValueFromByte(0); break; + } + }break; case c_oSerProp_pPrType::KeepLines: - { - BYTE KeepLines = m_oBufferedStream.GetUChar(); - if(0 != KeepLines) - pCStringWriter->WriteString(std::wstring(L"")); - else if(false == bDoNotWriteNullProp) - pCStringWriter->WriteString(std::wstring(L"")); - }break; + { + pPPr->m_oKeepLines.Init(); + pPPr->m_oKeepLines->m_oVal.FromBool(m_oBufferedStream.GetBool()); + }break; case c_oSerProp_pPrType::KeepNext: - { - BYTE KeepNext = m_oBufferedStream.GetUChar(); - if(0 != KeepNext) - pCStringWriter->WriteString(std::wstring(L"")); - else if(false == bDoNotWriteNullProp) - pCStringWriter->WriteString(std::wstring(L"")); - }break; + { + pPPr->m_oKeepNext.Init(); + pPPr->m_oKeepNext->m_oVal.FromBool(m_oBufferedStream.GetBool()); + }break; case c_oSerProp_pPrType::PageBreakBefore: - { - BYTE pageBreakBefore = m_oBufferedStream.GetUChar(); - if(0 != pageBreakBefore) - pCStringWriter->WriteString(std::wstring(L"")); - else if(false == bDoNotWriteNullProp) - pCStringWriter->WriteString(std::wstring(L"")); - break; - } + { + pPPr->m_oPageBreakBefore.Init(); + pPPr->m_oPageBreakBefore->m_oVal.FromBool(m_oBufferedStream.GetBool()); + }break; case c_oSerProp_pPrType::Spacing: - { - Spacing oSpacing; - READ2_DEF(length, res, this->ReadSpacing, &oSpacing); - if(oSpacing.bLine || oSpacing.bLineTwips || oSpacing.bAfter || oSpacing.bAfterAuto || oSpacing.bBefore || oSpacing.bBeforeAuto) - { - pCStringWriter->WriteString(std::wstring(L"WriteString(sBefore); - } - if (oSpacing.bBeforeAuto) - { - if (true == oSpacing.BeforeAuto) - pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"1\"")); - else - pCStringWriter->WriteString(std::wstring(L" w:beforeAutospacing=\"0\"")); - } - if(oSpacing.bAfter) - { - std::wstring sAfter = L" w:after=\"" + std::to_wstring(oSpacing.After) + L"\""; - pCStringWriter->WriteString(sAfter); - } - if(oSpacing.bAfterAuto) - { - if(true == oSpacing.AfterAuto) - pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"1\"")); - else - pCStringWriter->WriteString(std::wstring(L" w:afterAutospacing=\"0\"")); - } - BYTE bLineRule = linerule_Auto; - - std::wstring sLineRule; - //проверяется bLine, а не bLineRule чтобы всегда писать LineRule, если есть w:line - if (oSpacing.bLine || oSpacing.bLineTwips) - { - if (oSpacing.bLineRule) - bLineRule = oSpacing.LineRule; - switch (oSpacing.LineRule) - { - case linerule_AtLeast: sLineRule = _T(" w:lineRule=\"atLeast\""); break; - case linerule_Exact: sLineRule = _T(" w:lineRule=\"exact\""); break; - default: sLineRule = _T(" w:lineRule=\"auto\""); break; - } - } - if (oSpacing.bLine) - { - std::wstring sLine; - if (linerule_Auto == bLineRule) - { - long nLine = SerializeCommon::Round(oSpacing.Line * 240); - sLine = L" w:line=\"" + std::to_wstring(nLine) + L"\""; - } - else - { - long nLine = SerializeCommon::Round(g_dKoef_mm_to_twips * oSpacing.Line); - sLine = L" w:line=\"" + std::to_wstring(nLine) + L"\""; - } - pCStringWriter->WriteString(sLine); - } - else if (oSpacing.bLineTwips) - { - pCStringWriter->WriteString(L" w:line=\"" + std::to_wstring(oSpacing.LineTwips) + L"\""); - } - if (false == sLineRule.empty()) - pCStringWriter->WriteString(sLineRule); - - pCStringWriter->WriteString(std::wstring(L"/>")); - } - break; - } + { + pPPr->m_oSpacing.Init(); + READ2_DEF(length, res, this->ReadSpacing, pPPr->m_oSpacing.GetPointer()); + }break; case c_oSerProp_pPrType::Shd: - { - ComplexTypes::Word::CShading oShd; - READ2_DEF(length, res, oBinary_CommonReader2.ReadShdComplexType, &oShd); - - std::wstring sShd = oShd.ToString(); - if (false == sShd.empty()) - pCStringWriter->WriteString(L""); - break; - } + { + pPPr->m_oShd.Init(); + READ2_DEF(length, res, oBinary_CommonReader2.ReadShdComplexType, pPPr->m_oShd.GetPointer()); + }break; case c_oSerProp_pPrType::WidowControl: - { - BYTE WidowControl = m_oBufferedStream.GetUChar(); - if(0 != WidowControl) - { - if(false == bDoNotWriteNullProp) - pCStringWriter->WriteString(std::wstring(L"")); - } - else - pCStringWriter->WriteString(std::wstring(L"")); - break; - } + { + pPPr->m_oWidowControl.Init(); + pPPr->m_oWidowControl->m_oVal.FromBool(m_oBufferedStream.GetBool()); + }break; case c_oSerProp_pPrType::Tab: - { - Tabs oTabs; - READ2_DEF(length, res, this->ReadTabs, &oTabs); - size_t nLen = oTabs.m_aTabs.size(); - if(nLen > 0) - { - pCStringWriter->WriteString(std::wstring(L"")); - for(size_t i = 0; i < nLen; ++i) - { - Tab& oTab = oTabs.m_aTabs[i]; - pCStringWriter->WriteString(L"WriteString(L" w:leader=\"" + sLeader + L"\""); - } - pCStringWriter->WriteString(L"/>"); - } - pCStringWriter->WriteString(std::wstring(L"")); - } - }break; + { + pPPr->m_oTabs.Init(); + READ2_DEF(length, res, this->ReadTabs, pPPr->m_oTabs.GetPointer()); + }break; case c_oSerProp_pPrType::ParaStyle: - { - std::wstring sStyleName(m_oBufferedStream.GetString3(length)); - sStyleName = XmlUtils::EncodeXmlString(sStyleName); - pCStringWriter->WriteString(L""); - }break; + { + pPPr->m_oPStyle.Init(); + pPPr->m_oPStyle->m_sVal = m_oBufferedStream.GetString3(length); + }break; case c_oSerProp_pPrType::numPr: - { - pCStringWriter->WriteString(std::wstring(L"")); - READ2_DEF(length, res, this->ReadNumPr, poResult); - pCStringWriter->WriteString(std::wstring(L"")); - }break; + { + pPPr->m_oNumPr.Init(); + READ2_DEF(length, res, this->ReadNumPr, pPPr->m_oNumPr.GetPointer()); + }break; case c_oSerProp_pPrType::pPr_rPr: - { - OOX::Logic::CRunProperty oRPr; - res = oBinary_rPrReader.Read(length, &oRPr); - if (oRPr.IsNoEmpty()) - pCStringWriter->WriteString(oRPr.toXML()); - }break; + { + pPPr->m_oRPr.Init(); + res = oBinary_rPrReader.Read(length, pPPr->m_oRPr.GetPointer()); + }break; case c_oSerProp_pPrType::pBdr: - { - docBorders odocBorders; - READ1_DEF(length, res, this->ReadBorders, &odocBorders); - if(false == odocBorders.IsEmpty()) - { - pCStringWriter->WriteString(std::wstring(_T(""))); - odocBorders.Write(pCStringWriter, false); - pCStringWriter->WriteString(std::wstring(_T(""))); - } - }break; + { + pPPr->m_oPBdr.Init(); + READ1_DEF(length, res, this->ReadBorders, pPPr->m_oPBdr.GetPointer()); + }break; case c_oSerProp_pPrType::FramePr: - { - CFramePr oFramePr; - READ2_DEF(length, res, this->ReadFramePr, &oFramePr); - if(false == oFramePr.IsEmpty()) - oFramePr.Write(*pCStringWriter); - }break; + { + pPPr->m_oFramePr.Init(); + READ2_DEF(length, res, this->ReadFramePr, pPPr->m_oFramePr.GetPointer()); + }break; case c_oSerProp_pPrType::pPrChange: - { - TrackRevision oPPrChange; - READ1_DEF(length, res, this->ReadPPrChange, &oPPrChange); - oPPrChange.Write(pCStringWriter, _T("w:pPrChange")); - }break; - case c_oSerProp_pPrType::SectPr: - { - SectPr oSectPr; - READ1_DEF(length, res, this->Read_SecPr, &oSectPr); - pCStringWriter->WriteString(std::wstring(_T(""))); - pCStringWriter->WriteString(oSectPr.Write()); - pCStringWriter->WriteString(std::wstring(_T(""))); - }break; + { + pPPr->m_oPPrChange.Init(); + READ1_DEF(length, res, this->ReadPPrChange, pPPr->m_oPPrChange.GetPointer()); + }break; + case c_oSerProp_pPrType::SectPr: + { + pPPr->m_oSectPr.Init(); + READ1_DEF(length, res, this->Read_SecPr, pPPr->m_oSectPr.GetPointer()); + }break; case c_oSerProp_pPrType::outlineLvl: - { - long outlineLvl = m_oBufferedStream.GetLong(); - pCStringWriter->WriteString(L""); - }break; + { + pPPr->m_oOutlineLvl.Init(); + pPPr->m_oOutlineLvl->m_oVal = m_oBufferedStream.GetLong(); + }break; case c_oSerProp_pPrType::SuppressLineNumbers: - { - if(m_oBufferedStream.GetBool()) - pCStringWriter->WriteString(std::wstring(L"")); - else - pCStringWriter->WriteString(std::wstring(L"")); - }break; + { + pPPr->m_oSuppressLineNumbers.Init(); + pPPr->m_oSuppressLineNumbers->m_oVal.FromBool(m_oBufferedStream.GetBool()); + }break; default: res = c_oSerConstants::ReadUnknown; break; @@ -1129,12 +1040,29 @@ int Binary_pPrReader::ReadContent( BYTE type, long length, void* poResult) int Binary_pPrReader::ReadPPrChange(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - TrackRevision* pPPrChange = static_cast(poResult); - READ1_TRACKREV(type, length, pPPrChange) - else if(c_oSerProp_RevisionType::pPrChange == type) + OOX::Logic::CPPrChange* pPPrChange = static_cast(poResult); + if (c_oSerProp_RevisionType::Author == type)\ + {\ + pPPrChange->m_sAuthor = m_oBufferedStream.GetString3(length); \ + }\ + else if (c_oSerProp_RevisionType::Date == type)\ + {\ + pPPrChange->m_oDate = m_oBufferedStream.GetString3(length); \ + }\ + else if (c_oSerProp_RevisionType::Id == type)\ + {\ + pPPrChange->m_oId.Init();\ + pPPrChange->m_oId->SetValue(m_oBufferedStream.GetLong()); + }\ + else if (c_oSerProp_RevisionType::UserId == type)\ + {\ + pPPrChange->m_sUserId = m_oBufferedStream.GetString3(length); \ + } + //READ1_TRACKREV(type, length, pPPrChange) + else if (c_oSerProp_RevisionType::pPrChange == type) { - pPPrChange->PPr = new NSStringUtils::CStringBuilder(); - res = Read(length, pPPrChange->PPr); + pPPrChange->m_pParPr.Init(); + res = Read(length, pPPrChange->m_pParPr.GetPointer()); } else res = c_oSerConstants::ReadUnknown; @@ -1143,58 +1071,59 @@ int Binary_pPrReader::ReadPPrChange(BYTE type, long length, void* poResult) int Binary_pPrReader::ReadInd(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); + ComplexTypes::Word::CInd *pInd = static_cast(poResult); switch(type) { case c_oSerProp_pPrType::Ind_Left: - { - double dIndLeft = m_oBufferedStream.GetDouble(); - long nIndLeft = SerializeCommon::Round(dIndLeft * g_dKoef_mm_to_twips); - - pCStringWriter->WriteString(L" w:left=\"" + std::to_wstring(nIndLeft) + L"\""); - break; - } + { + pInd->m_oStart.Init(); + pInd->m_oStart->FromMm(m_oBufferedStream.GetDouble()); + }break; case c_oSerProp_pPrType::Ind_LeftTwips: - { - pCStringWriter->WriteString(L" w:left=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\""); - break; - } + { + pInd->m_oStart.Init(); + pInd->m_oStart->FromTwips(m_oBufferedStream.GetLong()); + }break; case c_oSerProp_pPrType::Ind_Right: - { - double dIndRight = m_oBufferedStream.GetDouble(); - long nIndRight = SerializeCommon::Round(dIndRight * g_dKoef_mm_to_twips); - - pCStringWriter->WriteString(L" w:right=\"" + std::to_wstring(nIndRight) + L"\""); - break; - } + { + pInd->m_oEnd.Init(); + pInd->m_oEnd->FromMm(m_oBufferedStream.GetDouble()); + }break; case c_oSerProp_pPrType::Ind_RightTwips: - { - pCStringWriter->WriteString(L" w:right=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\""); - break; - } + { + pInd->m_oEnd.Init(); + pInd->m_oEnd->FromTwips(m_oBufferedStream.GetLong()); + }break; case c_oSerProp_pPrType::Ind_FirstLine: + { + double dIndFirstLine = m_oBufferedStream.GetDouble(); + std::wstring sIndFirstLine; + if (dIndFirstLine >= 0) { - double dIndFirstLine = m_oBufferedStream.GetDouble(); - long nIndFirstLine = SerializeCommon::Round(dIndFirstLine * g_dKoef_mm_to_twips); - std::wstring sIndFirstLine; - if(nIndFirstLine >= 0) - sIndFirstLine = L" w:firstLine=\"" + std::to_wstring(nIndFirstLine) + L"\""; - else - sIndFirstLine = L" w:hanging=\"" + std::to_wstring(-nIndFirstLine) + L"\""; - pCStringWriter->WriteString(sIndFirstLine); - break; + pInd->m_oFirstLine.Init(); + pInd->m_oFirstLine->FromMm(dIndFirstLine); } + else + { + pInd->m_oHanging.Init(); + pInd->m_oHanging->FromMm(-dIndFirstLine); + } + }break; case c_oSerProp_pPrType::Ind_FirstLineTwips: + { + double dIndFirstLine = m_oBufferedStream.GetLong(); + std::wstring sIndFirstLine; + if (dIndFirstLine >= 0) { - long nIndFirstLine = m_oBufferedStream.GetLong(); - std::wstring sIndFirstLine; - if(nIndFirstLine >= 0) - sIndFirstLine = L" w:firstLine=\"" + std::to_wstring(nIndFirstLine) + L"\""; - else - sIndFirstLine = L" w:hanging=\"" + std::to_wstring(-nIndFirstLine) + L"\""; - pCStringWriter->WriteString(sIndFirstLine); - break; + pInd->m_oFirstLine.Init(); + pInd->m_oFirstLine->FromTwips(dIndFirstLine); } + else + { + pInd->m_oHanging.Init(); + pInd->m_oHanging->FromTwips(-dIndFirstLine); + } + }break; default: res = c_oSerConstants::ReadUnknown; break; @@ -1204,44 +1133,45 @@ int Binary_pPrReader::ReadInd(BYTE type, long length, void* poResult) int Binary_pPrReader::ReadSpacing(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - Spacing* pSpacing = static_cast(poResult); + ComplexTypes::Word::CSpacing* pSpacing = static_cast(poResult); + switch(type) { case c_oSerProp_pPrType::Spacing_Line: - pSpacing->bLine = true; - pSpacing->Line = m_oBufferedStream.GetDouble(); + pSpacing->m_oLine.Init(); + pSpacing->m_oLine->FromMm(m_oBufferedStream.GetDouble()); break; case c_oSerProp_pPrType::Spacing_LineTwips: - pSpacing->bLineTwips = true; - pSpacing->LineTwips = m_oBufferedStream.GetLong(); + pSpacing->m_oLine.Init(); + pSpacing->m_oLine->FromTwips(m_oBufferedStream.GetLong()); break; case c_oSerProp_pPrType::Spacing_LineRule: - pSpacing->bLineRule = true; - pSpacing->LineRule = m_oBufferedStream.GetUChar(); + pSpacing->m_oLineRule.Init(); + pSpacing->m_oLineRule->SetValueFromByte(m_oBufferedStream.GetUChar()); break; case c_oSerProp_pPrType::Spacing_Before: - pSpacing->bBefore = true; - pSpacing->Before = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pSpacing->m_oBefore.Init(); + pSpacing->m_oBefore->FromMm(m_oBufferedStream.GetDouble()); break; case c_oSerProp_pPrType::Spacing_BeforeTwips: - pSpacing->bBefore = true; - pSpacing->Before = m_oBufferedStream.GetLong(); + pSpacing->m_oBefore.Init(); + pSpacing->m_oBefore->FromTwips(m_oBufferedStream.GetLong()); break; case c_oSerProp_pPrType::Spacing_After: - pSpacing->bAfter = true; - pSpacing->After = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pSpacing->m_oAfter.Init(); + pSpacing->m_oAfter->FromMm(m_oBufferedStream.GetDouble()); break; case c_oSerProp_pPrType::Spacing_AfterTwips: - pSpacing->bAfter = true; - pSpacing->After = m_oBufferedStream.GetLong(); + pSpacing->m_oAfter.Init(); + pSpacing->m_oAfter->FromTwips(m_oBufferedStream.GetLong()); break; case c_oSerProp_pPrType::Spacing_BeforeAuto: - pSpacing->bBeforeAuto = true; - pSpacing->BeforeAuto = (0 != m_oBufferedStream.GetUChar()) ? true : false; + pSpacing->m_oBeforeAutospacing.Init(); + pSpacing->m_oBeforeAutospacing->FromBool(m_oBufferedStream.GetBool()); break; case c_oSerProp_pPrType::Spacing_AfterAuto: - pSpacing->bAfterAuto = true; - pSpacing->AfterAuto = (0 != m_oBufferedStream.GetUChar()) ? true : false; + pSpacing->m_oAfterAutospacing.Init(); + pSpacing->m_oAfterAutospacing->FromBool(m_oBufferedStream.GetBool()); break; default: res = c_oSerConstants::ReadUnknown; @@ -1252,12 +1182,12 @@ int Binary_pPrReader::ReadSpacing(BYTE type, long length, void* poResult) int Binary_pPrReader::ReadTabs(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - Tabs* poTabs = static_cast(poResult); - if(c_oSerProp_pPrType::Tab_Item == type) + OOX::Logic::CTabs* poTabs = static_cast(poResult); + if (c_oSerProp_pPrType::Tab_Item == type) { - Tab oTabItem; - READ2_DEF(length, res, this->ReadTabItem, &oTabItem); - poTabs->m_aTabs.push_back(oTabItem); + ComplexTypes::Word::CTabStop* pTabItem = new ComplexTypes::Word::CTabStop(); + READ2_DEF(length, res, this->ReadTabItem, pTabItem); + poTabs->m_arrTabs.push_back(pTabItem); } else res = c_oSerConstants::ReadUnknown; @@ -1266,27 +1196,27 @@ int Binary_pPrReader::ReadTabs(BYTE type, long length, void* poResult) int Binary_pPrReader::ReadTabItem(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - Tab* poTabItem = static_cast(poResult); - if(c_oSerProp_pPrType::Tab_Item_Val == type) - poTabItem->Val.SetValue((SimpleTypes::ETabJc)m_oBufferedStream.GetUChar()); - else if(c_oSerProp_pPrType::Tab_Item_Val_deprecated == type) + ComplexTypes::Word::CTabStop* poTabItem = static_cast(poResult); + + if (c_oSerProp_pPrType::Tab_Item_Val == type) { - switch(m_oBufferedStream.GetUChar()) - { - case 1: poTabItem->Val.SetValue(SimpleTypes::tabjcRight);break; - case 2: poTabItem->Val.SetValue(SimpleTypes::tabjcCenter);break; - case 3: poTabItem->Val.SetValue(SimpleTypes::tabjcClear);break; - default:poTabItem->Val.SetValue(SimpleTypes::tabjcLeft);break; - } + poTabItem->m_oVal.Init(); + poTabItem->m_oVal->SetValueFromByte(m_oBufferedStream.GetUChar()); } - else if(c_oSerProp_pPrType::Tab_Item_Pos == type) - poTabItem->Pos = SerializeCommon::Round( g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); - else if(c_oSerProp_pPrType::Tab_Item_PosTwips == type) - poTabItem->Pos = m_oBufferedStream.GetLong(); - else if(c_oSerProp_pPrType::Tab_Item_Leader == type) + else if (c_oSerProp_pPrType::Tab_Item_Pos == type) { - poTabItem->bLeader = true; - poTabItem->Leader = m_oBufferedStream.GetUChar(); + poTabItem->m_oPos.Init(); + poTabItem->m_oPos->FromMm(m_oBufferedStream.GetDouble()); + } + else if (c_oSerProp_pPrType::Tab_Item_PosTwips == type) + { + poTabItem->m_oPos.Init(); + poTabItem->m_oPos->FromTwips(m_oBufferedStream.GetLong()); + } + else if (c_oSerProp_pPrType::Tab_Item_Leader == type) + { + poTabItem->m_oLeader.Init(); + poTabItem->m_oLeader->SetValueFromByte( m_oBufferedStream.GetUChar()); } else res = c_oSerConstants::ReadUnknown; @@ -1295,156 +1225,122 @@ int Binary_pPrReader::ReadTabItem(BYTE type, long length, void* poResult) int Binary_pPrReader::ReadNumPr(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if(c_oSerProp_pPrType::numPr_lvl == type) + OOX::Logic::CNumPr* pNumPr = static_cast(poResult); + + if (c_oSerProp_pPrType::numPr_lvl == type) { - long nLvl = m_oBufferedStream.GetLong(); - m_nCurLvl = nLvl; - - pCStringWriter->WriteString(L""); + pNumPr->m_oIlvl.Init(); + pNumPr->m_oIlvl->m_oVal = m_oBufferedStream.GetLong(); } - else if(c_oSerProp_pPrType::numPr_id == type) + else if (c_oSerProp_pPrType::numPr_id == type) { - long nnumId = m_oBufferedStream.GetLong(); - m_nCurNumId = nnumId; - - pCStringWriter->WriteString(L""); + pNumPr->m_oNumID.Init(); + pNumPr->m_oNumID->m_oVal = m_oBufferedStream.GetLong(); } - else if(c_oSerProp_pPrType::numPr_Ins == type) + else if (c_oSerProp_pPrType::numPr_Ins == type) { - TrackRevision Ins; - oBinary_CommonReader2.ReadTrackRevision(length, &Ins); - Ins.Write(pCStringWriter, _T("w:ins")); + pNumPr->m_oIns.Init(); + oBinary_CommonReader2.ReadTrackRevision2(length, pNumPr->m_oIns.GetPointer()); } else res = c_oSerConstants::ReadUnknown; return res; }; +int Binary_pPrReader::ReadTableCellBorders(BYTE type, long length, void* poResult) +{ + int res = c_oSerConstants::ReadOk; + OOX::Logic::CTcBorders* pBorders = static_cast(poResult); + + READ1_BORDERS_START2 + else if (c_oSerBordersType::tl2br == type) + { + pBorders->m_oTL2BR.Init(); + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oTL2BR.GetPointer()); + } + else if (c_oSerBordersType::tr2bl == type) + { + pBorders->m_oTR2BL.Init(); + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oTR2BL.GetPointer()); + } + else + res = c_oSerConstants::ReadUnknown; + return res; +} +int Binary_pPrReader::ReadTableBorders(BYTE type, long length, void* poResult) +{ + int res = c_oSerConstants::ReadOk; + OOX::Logic::CTblBorders* pBorders = static_cast(poResult); + + READ1_BORDERS_START2 + else if (c_oSerBordersType::insideV == type) + { + pBorders->m_oInsideV.Init(); + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oInsideV.GetPointer()); + } + else if (c_oSerBordersType::insideH == type) + { + pBorders->m_oInsideH.Init(); + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oInsideH.GetPointer()); + } + else + res = c_oSerConstants::ReadUnknown; + return res; +} int Binary_pPrReader::ReadBorders(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - docBorders* pdocBorders = static_cast(poResult); - if( c_oSerBordersType::left == type ) + OOX::Logic::CPBdr *pBorders = static_cast(poResult); + + READ1_BORDERS_START1 + else if ( c_oSerBordersType::between == type ) { - pdocBorders->bLeft = true; - READ2_DEF(length, res, this->ReadBorder, &pdocBorders->oLeft); - } - else if( c_oSerBordersType::top == type ) - { - pdocBorders->bTop = true; - READ2_DEF(length, res, this->ReadBorder, &pdocBorders->oTop); - } - else if( c_oSerBordersType::right == type ) - { - pdocBorders->bRight = true; - READ2_DEF(length, res, this->ReadBorder, &pdocBorders->oRight); - } - else if( c_oSerBordersType::bottom == type ) - { - pdocBorders->bBottom = true; - READ2_DEF(length, res, this->ReadBorder, &pdocBorders->oBottom); - } - else if( c_oSerBordersType::insideV == type ) - { - pdocBorders->bInsideV = true; - READ2_DEF(length, res, this->ReadBorder, &pdocBorders->oInsideV); - } - else if( c_oSerBordersType::insideH == type ) - { - pdocBorders->bInsideH = true; - READ2_DEF(length, res, this->ReadBorder, &pdocBorders->oInsideH); - } - else if( c_oSerBordersType::between == type ) - { - pdocBorders->bBetween = true; - READ2_DEF(length, res, this->ReadBorder, &pdocBorders->oBetween); + pBorders->m_oBetween.Init(); + READ2_DEF(length, res, this->ReadBorder, pBorders->m_oBetween.GetPointer()); } else res = c_oSerConstants::ReadUnknown; return res; } int Binary_pPrReader::ReadBorder(BYTE type, long length, void* poResult) -{ - int res = c_oSerConstants::ReadOk; - docBorder* odocBorder = static_cast(poResult); - if( c_oSerBorderType::Color == type ) - { - odocBorder->bColor = true; - odocBorder->Color = oBinary_CommonReader2.ReadColor(); - } - else if( c_oSerBorderType::Space == type ) - { - odocBorder->bSpace = true; - odocBorder->Space = SerializeCommon::Round(g_dKoef_mm_to_pt * m_oBufferedStream.GetDouble()); - } - else if( c_oSerBorderType::SpacePoint == type ) - { - odocBorder->bSpace = true; - odocBorder->Space = m_oBufferedStream.GetLong(); - } - else if( c_oSerBorderType::Size == type ) - { - odocBorder->bSize = true; - odocBorder->Size = SerializeCommon::Round(g_dKoef_mm_to_eightpoint * m_oBufferedStream.GetDouble()); - } - else if( c_oSerBorderType::Size8Point == type ) - { - odocBorder->bSize = true; - odocBorder->Size = m_oBufferedStream.GetLong(); - } - else if( c_oSerBorderType::Value == type ) - { - odocBorder->bValue = true; - odocBorder->Value = m_oBufferedStream.GetUChar(); - } - else if( c_oSerBorderType::ColorTheme == type ) - { - odocBorder->bThemeColor = true; - oBinary_CommonReader2.ReadThemeColor(length, odocBorder->ThemeColor); - } - else - res = c_oSerConstants::ReadUnknown; - return res; -} -int Binary_pPrReader::ReadBorder2(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; ComplexTypes::Word::CBorder* pBorder = static_cast(poResult); - if( c_oSerBorderType::Color == type ) + + if ( c_oSerBorderType::Color == type ) { pBorder->m_oColor.Init(); pBorder->m_oColor->SetValue(SimpleTypes::hexcolorRGB); oBinary_CommonReader2.ReadHexColor(pBorder->m_oColor.GetPointer()); } - else if( c_oSerBorderType::Space == type ) + else if ( c_oSerBorderType::Space == type ) { pBorder->m_oSpace.Init(); pBorder->m_oSpace->SetValue(SerializeCommon::Round(g_dKoef_mm_to_pt * m_oBufferedStream.GetDouble())); } - else if( c_oSerBorderType::SpacePoint == type ) + else if ( c_oSerBorderType::SpacePoint == type ) { pBorder->m_oSpace.Init(); pBorder->m_oSpace->SetValue(m_oBufferedStream.GetLong()); } - else if( c_oSerBorderType::Size == type ) + else if ( c_oSerBorderType::Size == type ) { pBorder->m_oSz.Init(); pBorder->m_oSz->SetValue(SerializeCommon::Round(g_dKoef_mm_to_eightpoint * m_oBufferedStream.GetDouble())); } - else if( c_oSerBorderType::Size8Point == type ) + else if ( c_oSerBorderType::Size8Point == type ) { pBorder->m_oSz.Init(); pBorder->m_oSz->SetValue(m_oBufferedStream.GetLong()); } - else if( c_oSerBorderType::Value == type ) + else if ( c_oSerBorderType::Value == type ) { pBorder->m_oVal.Init(); - if(border_Single == m_oBufferedStream.GetUChar()) + if (border_Single == m_oBufferedStream.GetUChar()) pBorder->m_oVal->SetValue(SimpleTypes::bordervalueSingle); else pBorder->m_oVal->SetValue(SimpleTypes::bordervalueNone); } - else if( c_oSerBorderType::ColorTheme == type ) + else if ( c_oSerBorderType::ColorTheme == type ) { CThemeColor ThemeColor; oBinary_CommonReader2.ReadThemeColor(length, ThemeColor); @@ -1457,76 +1353,104 @@ int Binary_pPrReader::ReadBorder2(BYTE type, long length, void* poResult) int Binary_pPrReader::ReadFramePr(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - CFramePr* oFramePr = static_cast(poResult); - if( c_oSer_FramePrType::DropCap == type ) + ComplexTypes::Word::CFramePr* pFramePr = static_cast(poResult); + + if ( c_oSer_FramePrType::DropCap == type ) { - oFramePr->bDropCap = true; - oFramePr->DropCap = m_oBufferedStream.GetUChar(); + pFramePr->m_oDropCap.Init(); + pFramePr->m_oDropCap->SetValueFromByte(m_oBufferedStream.GetUChar()); } - else if( c_oSer_FramePrType::H == type ) + else if ( c_oSer_FramePrType::H == type ) { - oFramePr->bH = true; - oFramePr->H = m_oBufferedStream.GetLong(); + pFramePr->m_oH.Init(); + pFramePr->m_oH->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_FramePrType::HAnchor == type ) + else if ( c_oSer_FramePrType::HAnchor == type ) { - oFramePr->bHAnchor = true; - oFramePr->HAnchor = m_oBufferedStream.GetUChar(); + pFramePr->m_oHAnchor.Init(); + pFramePr->m_oHAnchor->SetValueFromByte(m_oBufferedStream.GetUChar()); } - else if( c_oSer_FramePrType::HRule == type ) + else if ( c_oSer_FramePrType::HRule == type ) { - oFramePr->bHRule = true; - oFramePr->HRule = m_oBufferedStream.GetUChar(); + pFramePr->m_oHRule.Init(); + pFramePr->m_oHRule->SetValueFromByte(m_oBufferedStream.GetUChar()); } - else if( c_oSer_FramePrType::HSpace == type ) + else if ( c_oSer_FramePrType::HSpace == type ) { - oFramePr->bHSpace = true; - oFramePr->HSpace = m_oBufferedStream.GetLong(); + pFramePr->m_oHSpace.Init(); + pFramePr->m_oHSpace->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_FramePrType::Lines == type ) + else if ( c_oSer_FramePrType::Lines == type ) { - oFramePr->bLines = true; - oFramePr->Lines = m_oBufferedStream.GetLong(); + pFramePr->m_oLines.Init(); + pFramePr->m_oLines->SetValue(m_oBufferedStream.GetLong()); } - else if( c_oSer_FramePrType::VAnchor == type ) + else if ( c_oSer_FramePrType::VAnchor == type ) { - oFramePr->bVAnchor = true; - oFramePr->VAnchor = m_oBufferedStream.GetUChar(); + pFramePr->m_oVAnchor.Init(); + pFramePr->m_oVAnchor->SetValueFromByte(m_oBufferedStream.GetUChar()); } - else if( c_oSer_FramePrType::VSpace == type ) + else if ( c_oSer_FramePrType::VSpace == type ) { - oFramePr->bVSpace = true; - oFramePr->VSpace = m_oBufferedStream.GetLong(); + pFramePr->m_oVSpace.Init(); + pFramePr->m_oVSpace->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_FramePrType::W == type ) + else if ( c_oSer_FramePrType::W == type ) { - oFramePr->bW = true; - oFramePr->W = m_oBufferedStream.GetLong(); + pFramePr->m_oW.Init(); + pFramePr->m_oW->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_FramePrType::Wrap == type ) + else if ( c_oSer_FramePrType::Wrap == type ) { - oFramePr->bWrap = true; - oFramePr->Wrap = m_oBufferedStream.GetUChar(); + pFramePr->m_oWrap.Init(); + pFramePr->m_oWrap->SetValueFromByte(m_oBufferedStream.GetUChar()); } - else if( c_oSer_FramePrType::X == type ) + else if ( c_oSer_FramePrType::X == type ) { - oFramePr->bX = true; - oFramePr->X = m_oBufferedStream.GetLong(); + pFramePr->m_oX.Init(); + pFramePr->m_oX->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_FramePrType::XAlign == type ) + else if ( c_oSer_FramePrType::XAlign == type ) { - oFramePr->bXAlign = true; - oFramePr->XAlign = m_oBufferedStream.GetUChar(); + pFramePr->m_oXAlign.Init(); + pFramePr->m_oXAlign->SetValueFromByte(m_oBufferedStream.GetUChar()); } - else if( c_oSer_FramePrType::Y == type ) + else if ( c_oSer_FramePrType::Y == type ) { - oFramePr->bY = true; - oFramePr->Y = m_oBufferedStream.GetLong(); + pFramePr->m_oY.Init(); + pFramePr->m_oY->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_FramePrType::YAlign == type ) + else if ( c_oSer_FramePrType::YAlign == type ) { - oFramePr->bYAlign = true; - oFramePr->YAlign = m_oBufferedStream.GetUChar(); + pFramePr->m_oYAlign.Init(); + pFramePr->m_oYAlign->SetValueFromByte(m_oBufferedStream.GetUChar()); + } + else + res = c_oSerConstants::ReadUnknown; + return res; +} +int Binary_pPrReader::Read_pgSetting(BYTE type, long length, void* poResult) +{ + int res = c_oSerConstants::ReadOk; + OOX::Logic::CSectionProperty* pSectPr = static_cast(poResult); + + if (c_oSerProp_secPrSettingsType::titlePg == type) + { + pSectPr->m_oTitlePg.Init(); + pSectPr->m_oTitlePg->m_oVal.FromBool(m_oBufferedStream.GetBool()); + } + else if (c_oSerProp_secPrSettingsType::EvenAndOddHeaders == type) + { + if (m_oBufferedStream.GetBool()) + { + m_oFileWriter.m_pCurrentSettings->m_oEvenAndOddHeaders.Init(); + } + } + else if (c_oSerProp_secPrSettingsType::SectionType == type) + { + pSectPr->m_oType.Init(); + pSectPr->m_oType->m_oVal.Init(); + pSectPr->m_oType->m_oVal->SetValueFromByte(m_oBufferedStream.GetUChar()); } else res = c_oSerConstants::ReadUnknown; @@ -1534,72 +1458,70 @@ int Binary_pPrReader::ReadFramePr(BYTE type, long length, void* poResult) } int Binary_pPrReader::Read_SecPr(BYTE type, long length, void* poResult) { - SectPr* pSectPr = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerProp_secPrType::pgSz == type ) + OOX::Logic::CSectionProperty* pSectPr = static_cast(poResult); + + if ( c_oSerProp_secPrType::pgSz == type ) { - READ2_DEF(length, res, this->Read_pgSz, poResult); + pSectPr->m_oPgSz.Init(); + READ2_DEF(length, res, this->Read_pgSz, pSectPr->m_oPgSz.GetPointer()); } - else if( c_oSerProp_secPrType::pgMar == type ) + else if ( c_oSerProp_secPrType::pgMar == type ) { - READ2_DEF(length, res, this->Read_pgMar, poResult); + pSectPr->m_oPgMar.Init(); + READ2_DEF(length, res, this->Read_pgMar, pSectPr->m_oPgMar.GetPointer()); } - else if( c_oSerProp_secPrType::setting == type ) + else if (c_oSerProp_secPrType::setting == type) { READ2_DEF(length, res, this->Read_pgSetting, poResult); } - else if( c_oSerProp_secPrType::headers == type ) + else if ( c_oSerProp_secPrType::headers == type ) { READ1_DEF(length, res, this->Read_pgHeader, poResult); } - else if( c_oSerProp_secPrType::footers == type ) + else if ( c_oSerProp_secPrType::footers == type ) { READ1_DEF(length, res, this->Read_pgFooter, poResult); } - else if( c_oSerProp_secPrType::pageNumType == type ) + else if ( c_oSerProp_secPrType::pageNumType == type ) { - READ1_DEF(length, res, this->Read_pageNumType, poResult); + pSectPr->m_oPgNumType.Init(); + READ1_DEF(length, res, this->Read_pageNumType, pSectPr->m_oPgNumType.GetPointer()); } - else if( c_oSerProp_secPrType::lnNumType == type ) + else if ( c_oSerProp_secPrType::lnNumType == type ) { - ComplexTypes::Word::CLineNumber lineNumber; - READ1_DEF(length, res, this->Read_lineNumType, &lineNumber); - pSectPr->lineNum = L""; + pSectPr->m_oLnNumType.Init(); + READ1_DEF(length, res, this->Read_lineNumType, pSectPr->m_oLnNumType.GetPointer()); } - else if( c_oSerProp_secPrType::sectPrChange == type ) + else if ( c_oSerProp_secPrType::sectPrChange == type ) { - TrackRevision sectPrChange; - READ1_DEF(length, res, this->ReadSectPrChange, §PrChange); - pSectPr->sectPrChange = sectPrChange.ToString(_T("w:sectPrChange")); + pSectPr->m_oSectPrChange.Init(); + READ1_DEF(length, res, this->ReadSectPrChange, pSectPr->m_oSectPrChange.GetPointer()); } - else if( c_oSerProp_secPrType::cols == type ) + else if ( c_oSerProp_secPrType::cols == type ) { - OOX::Logic::CColumns oCols; - READ1_DEF(length, res, this->ReadCols, &oCols); - pSectPr->cols = oCols.toXML(); + pSectPr->m_oCols.Init(); + READ1_DEF(length, res, this->ReadCols, pSectPr->m_oCols.GetPointer()); } - else if( c_oSerProp_secPrType::pgBorders == type ) + else if ( c_oSerProp_secPrType::pgBorders == type ) { - OOX::Logic::CPageBorders pgBorders; - READ1_DEF(length, res, this->ReadPageBorders, &pgBorders); - pSectPr->pgBorders = pgBorders.toXML(); + pSectPr->m_oPgBorders.Init(); + READ1_DEF(length, res, this->ReadPageBorders, pSectPr->m_oPgBorders.GetPointer()); } - else if( c_oSerProp_secPrType::footnotePr == type ) + else if ( c_oSerProp_secPrType::footnotePr == type ) { - OOX::Logic::CFtnProps oFtnProps; - READ1_DEF(length, res, this->ReadFootnotePr, &oFtnProps); - pSectPr->footnotePr = oFtnProps.toXML(); + pSectPr->m_oFootnotePr.Init(); + READ1_DEF(length, res, this->ReadFootnotePr, pSectPr->m_oFootnotePr.GetPointer()); } - else if( c_oSerProp_secPrType::endnotePr == type ) + else if ( c_oSerProp_secPrType::endnotePr == type ) { - OOX::Logic::CEdnProps oEdnProps; - READ1_DEF(length, res, this->ReadEndnotePr, &oEdnProps); - pSectPr->endnotePr = oEdnProps.toXML(); + pSectPr->m_oEndnotePr.Init(); + READ1_DEF(length, res, this->ReadEndnotePr, pSectPr->m_oEndnotePr.GetPointer()); } - else if( c_oSerProp_secPrType::rtlGutter == type ) + else if ( c_oSerProp_secPrType::rtlGutter == type ) { - pSectPr->bRtlGutter = true; - pSectPr->RtlGutter = m_oBufferedStream.GetBool(); + pSectPr->m_oRtlGutter.Init(); + pSectPr->m_oRtlGutter->m_oVal.FromBool(m_oBufferedStream.GetBool()); } else res = c_oSerConstants::ReadUnknown; @@ -1609,23 +1531,23 @@ int Binary_pPrReader::ReadFootnotePr(BYTE type, long length, void* poResult) { OOX::Logic::CFtnProps* pFtnProps = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerNotes::PrFmt == type ) + if ( c_oSerNotes::PrFmt == type ) { pFtnProps->m_oNumFmt.Init(); READ1_DEF(length, res, this->ReadNumFmt, pFtnProps->m_oNumFmt.GetPointer()); } - else if( c_oSerNotes::PrRestart == type ) + else if ( c_oSerNotes::PrRestart == type ) { pFtnProps->m_oNumRestart.Init(); pFtnProps->m_oNumRestart->m_oVal.Init(); pFtnProps->m_oNumRestart->m_oVal->SetValue((SimpleTypes::ERestartNumber)m_oBufferedStream.GetUChar()); } - else if( c_oSerNotes::PrStart == type ) + else if ( c_oSerNotes::PrStart == type ) { pFtnProps->m_oNumStart.Init(); pFtnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong(); } - else if( c_oSerNotes::PrFntPos == type ) + else if ( c_oSerNotes::PrFntPos == type ) { pFtnProps->m_oPos.Init(); pFtnProps->m_oPos->m_oVal.Init(); @@ -1639,23 +1561,23 @@ int Binary_pPrReader::ReadEndnotePr(BYTE type, long length, void* poResult) { OOX::Logic::CEdnProps* pEdnProps = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerNotes::PrFmt == type ) + if ( c_oSerNotes::PrFmt == type ) { pEdnProps->m_oNumFmt.Init(); READ1_DEF(length, res, this->ReadNumFmt, pEdnProps->m_oNumFmt.GetPointer()); } - else if( c_oSerNotes::PrRestart == type ) + else if ( c_oSerNotes::PrRestart == type ) { pEdnProps->m_oNumRestart.Init(); pEdnProps->m_oNumRestart->m_oVal.Init(); pEdnProps->m_oNumRestart->m_oVal->SetValue((SimpleTypes::ERestartNumber)m_oBufferedStream.GetUChar()); } - else if( c_oSerNotes::PrStart == type ) + else if ( c_oSerNotes::PrStart == type ) { pEdnProps->m_oNumStart.Init(); pEdnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong(); } - else if( c_oSerNotes::PrEndPos == type ) + else if ( c_oSerNotes::PrEndPos == type ) { pEdnProps->m_oPos.Init(); pEdnProps->m_oPos->m_oVal.Init(); @@ -1669,12 +1591,12 @@ int Binary_pPrReader::ReadNumFmt(BYTE type, long length, void* poResult) { ComplexTypes::Word::CNumFmt* pNumFmt = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerNumTypes::NumFmtVal == type ) + if ( c_oSerNumTypes::NumFmtVal == type ) { pNumFmt->m_oVal.Init(); pNumFmt->m_oVal->SetValue((SimpleTypes::ENumberFormat)m_oBufferedStream.GetUChar()); } - else if( c_oSerNumTypes::NumFmtFormat == type ) + else if ( c_oSerNumTypes::NumFmtFormat == type ) { pNumFmt->m_sFormat.Init(); pNumFmt->m_sFormat->append(m_oBufferedStream.GetString3(length)); @@ -1683,15 +1605,16 @@ int Binary_pPrReader::ReadNumFmt(BYTE type, long length, void* poResult) res = c_oSerConstants::ReadUnknown; return res; } -int Binary_pPrReader::ReadSectPrChange(BYTE type, long length, void* poResult) +int Binary_pPrReader::ReadSectPrChange(BYTE type, long length, void* poResult_) { - TrackRevision* sectPrChange = static_cast(poResult); int res = c_oSerConstants::ReadOk; - READ1_TRACKREV(type, length, sectPrChange) - else if( c_oSerProp_RevisionType::sectPrChange == type ) + OOX::Logic::CSectPrChange* poResult = static_cast(poResult_); + + READ1_TRACKREV_2(type, length, poResult) + else if ( c_oSerProp_RevisionType::sectPrChange == type ) { - sectPrChange->sectPr = new SectPr(); - READ1_DEF(length, res, this->Read_SecPr, sectPrChange->sectPr); + poResult->m_pSecPr.Init(); + READ1_DEF(length, res, this->Read_SecPr, poResult->m_pSecPr.GetPointer()); } else res = c_oSerConstants::ReadUnknown; @@ -1699,32 +1622,33 @@ int Binary_pPrReader::ReadSectPrChange(BYTE type, long length, void* poResult) } int Binary_pPrReader::Read_pgSz(BYTE type, long length, void* poResult) { - SectPr* pSectPr = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSer_pgSzType::Orientation == type ) + ComplexTypes::Word::CPageSz* pPageSz = static_cast(poResult); + + if ( c_oSer_pgSzType::Orientation == type ) { - pSectPr->bOrientation = true; - pSectPr->cOrientation = m_oBufferedStream.GetUChar(); + pPageSz->m_oOrient.Init(); + pPageSz->m_oOrient->SetValueFromByte( m_oBufferedStream.GetUChar()); } - else if( c_oSer_pgSzType::W == type ) + else if ( c_oSer_pgSzType::W == type ) { - pSectPr->bW = true; - pSectPr->W = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pPageSz->m_oW.Init(); + pPageSz->m_oW->FromMm(m_oBufferedStream.GetDouble()); } - else if( c_oSer_pgSzType::WTwips == type ) + else if ( c_oSer_pgSzType::WTwips == type ) { - pSectPr->bW = true; - pSectPr->W = m_oBufferedStream.GetLong(); + pPageSz->m_oW.Init(); + pPageSz->m_oW->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_pgSzType::H == type ) + else if ( c_oSer_pgSzType::H == type ) { - pSectPr->bH = true; - pSectPr->H = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pPageSz->m_oH.Init(); + pPageSz->m_oH->FromMm(m_oBufferedStream.GetDouble()); } - else if( c_oSer_pgSzType::HTwips == type ) + else if ( c_oSer_pgSzType::HTwips == type ) { - pSectPr->bH = true; - pSectPr->H = m_oBufferedStream.GetLong(); + pPageSz->m_oH.Init(); + pPageSz->m_oH->FromTwips(m_oBufferedStream.GetLong()); } else res = c_oSerConstants::ReadUnknown; @@ -1732,95 +1656,73 @@ int Binary_pPrReader::Read_pgSz(BYTE type, long length, void* poResult) } int Binary_pPrReader::Read_pgMar(BYTE type, long length, void* poResult) { - SectPr* pSectPr = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSer_pgMarType::Left == type ) + ComplexTypes::Word::CPageMar* pPageMar = static_cast(poResult); + + if ( c_oSer_pgMarType::Left == type ) { - pSectPr->bLeft = true; - pSectPr->Left = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pPageMar->m_oLeft.Init(); + pPageMar->m_oLeft->FromMm(m_oBufferedStream.GetDouble()); } - else if( c_oSer_pgMarType::LeftTwips == type ) + else if ( c_oSer_pgMarType::LeftTwips == type ) { - pSectPr->bLeft = true; - pSectPr->Left = m_oBufferedStream.GetLong(); + pPageMar->m_oLeft.Init(); + pPageMar->m_oLeft->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_pgMarType::Top == type ) + else if ( c_oSer_pgMarType::Top == type ) { - pSectPr->bTop = true; - pSectPr->Top = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pPageMar->m_oTop.Init(); + pPageMar->m_oTop->FromMm(m_oBufferedStream.GetDouble()); } - else if( c_oSer_pgMarType::TopTwips == type ) + else if ( c_oSer_pgMarType::TopTwips == type ) { - pSectPr->bTop = true; - pSectPr->Top = m_oBufferedStream.GetLong(); + pPageMar->m_oTop.Init(); + pPageMar->m_oTop->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_pgMarType::Right == type ) + else if ( c_oSer_pgMarType::Right == type ) { - pSectPr->bRight = true; - pSectPr->Right = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pPageMar->m_oRight.Init(); + pPageMar->m_oRight->FromMm(m_oBufferedStream.GetDouble()); } - else if( c_oSer_pgMarType::RightTwips == type ) + else if ( c_oSer_pgMarType::RightTwips == type ) { - pSectPr->bRight = true; - pSectPr->Right = m_oBufferedStream.GetLong(); + pPageMar->m_oRight.Init(); + pPageMar->m_oRight->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_pgMarType::Bottom == type ) + else if ( c_oSer_pgMarType::Bottom == type ) { - pSectPr->bBottom = true; - pSectPr->Bottom = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pPageMar->m_oBottom.Init(); + pPageMar->m_oBottom->FromMm(m_oBufferedStream.GetDouble()); } - else if( c_oSer_pgMarType::BottomTwips == type ) + else if ( c_oSer_pgMarType::BottomTwips == type ) { - pSectPr->bBottom = true; - pSectPr->Bottom = m_oBufferedStream.GetLong(); + pPageMar->m_oBottom.Init(); + pPageMar->m_oBottom->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_pgMarType::Header == type ) + else if ( c_oSer_pgMarType::Header == type ) { - pSectPr->bHeader = true; - pSectPr->Header = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pPageMar->m_oHeader.Init(); + pPageMar->m_oHeader->FromMm(m_oBufferedStream.GetDouble()); } - else if( c_oSer_pgMarType::HeaderTwips == type ) + else if ( c_oSer_pgMarType::HeaderTwips == type ) { - pSectPr->bHeader = true; - pSectPr->Header = m_oBufferedStream.GetLong(); + pPageMar->m_oHeader.Init(); + pPageMar->m_oHeader->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_pgMarType::Footer == type ) + else if ( c_oSer_pgMarType::Footer == type ) { - pSectPr->bFooter = true; - pSectPr->Footer = SerializeCommon::Round(g_dKoef_mm_to_twips * m_oBufferedStream.GetDouble()); + pPageMar->m_oFooter.Init(); + pPageMar->m_oFooter->FromMm(m_oBufferedStream.GetDouble()); } - else if( c_oSer_pgMarType::FooterTwips == type ) + else if ( c_oSer_pgMarType::FooterTwips == type ) { - pSectPr->bFooter = true; - pSectPr->Footer = m_oBufferedStream.GetLong(); + pPageMar->m_oFooter.Init(); + pPageMar->m_oFooter->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSer_pgMarType::GutterTwips == type ) + else if ( c_oSer_pgMarType::GutterTwips == type ) { - pSectPr->bGutter = true; - pSectPr->Gutter = m_oBufferedStream.GetLong(); - } - else - res = c_oSerConstants::ReadUnknown; - return res; -} -int Binary_pPrReader::Read_pgSetting(BYTE type, long length, void* poResult) -{ - SectPr* pSectPr = static_cast(poResult); - int res = c_oSerConstants::ReadOk; - if( c_oSerProp_secPrSettingsType::titlePg == type ) - { - pSectPr->bTitlePg = true; - pSectPr->TitlePg = m_oBufferedStream.GetBool(); - } - else if( c_oSerProp_secPrSettingsType::EvenAndOddHeaders == type ) - { - pSectPr->bEvenAndOddHeaders = true; - pSectPr->EvenAndOddHeaders = m_oBufferedStream.GetBool(); - } - else if( c_oSerProp_secPrSettingsType::SectionType == type ) - { - pSectPr->bSectionType = true; - pSectPr->SectionType = m_oBufferedStream.GetUChar(); + pPageMar->m_oGutter.Init(); + pPageMar->m_oGutter->FromTwips(m_oBufferedStream.GetLong()); } else res = c_oSerConstants::ReadUnknown; @@ -1828,23 +1730,26 @@ int Binary_pPrReader::Read_pgSetting(BYTE type, long length, void* poResult) } int Binary_pPrReader::Read_pgHeader(BYTE type, long length, void* poResult) { - SectPr* pSectPr = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerProp_secPrType::hdrftrelem == type ) + OOX::Logic::CSectionProperty* pSectPr = static_cast(poResult); + + if ( c_oSerProp_secPrType::hdrftrelem == type ) { int nHdrFtrIndex = m_oBufferedStream.GetLong(); - if(nHdrFtrIndex >= 0 && nHdrFtrIndex < (int)m_oFileWriter.get_headers_footers_writer().m_aHeaders.size()) + + if (nHdrFtrIndex >= 0 && nHdrFtrIndex < (int)m_oFileWriter.get_headers_footers_writer().m_aHeaders.size()) { Writers::HdrFtrItem* pHdrFtrItem = m_oFileWriter.get_headers_footers_writer().m_aHeaders[nHdrFtrIndex]; - std::wstring sType; - if(SimpleTypes::hdrftrFirst == pHdrFtrItem->eType) - sType = _T("first"); - else if(SimpleTypes::hdrftrEven == pHdrFtrItem->eType) - sType = _T("even"); - else - sType = _T("default"); - pSectPr->sHeaderFooterReference += _T("rId + _T("\"/>"); + ComplexTypes::Word::CHdrFtrRef* pRef = new ComplexTypes::Word::CHdrFtrRef(); + + pRef->m_oType.Init(); + pRef->m_oType->SetValueFromByte(pHdrFtrItem->eType); + + pRef->m_oId.Init(); + pRef->m_oId->SetValue(pHdrFtrItem->rId); + + pSectPr->m_arrHeaderReference.push_back(pRef); } } else @@ -1853,23 +1758,25 @@ int Binary_pPrReader::Read_pgHeader(BYTE type, long length, void* poResult) } int Binary_pPrReader::Read_pgFooter(BYTE type, long length, void* poResult) { - SectPr* pSectPr = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerProp_secPrType::hdrftrelem == type ) + OOX::Logic::CSectionProperty* pSectPr = static_cast(poResult); + + if ( c_oSerProp_secPrType::hdrftrelem == type ) { int nHdrFtrIndex = m_oBufferedStream.GetLong(); - if(nHdrFtrIndex >= 0 && nHdrFtrIndex <= (int)oBinary_HdrFtrTableReader.m_oHeaderFooterWriter.m_aFooters.size()) + if (nHdrFtrIndex >= 0 && nHdrFtrIndex <= (int)oBinary_HdrFtrTableReader.m_oHeaderFooterWriter.m_aFooters.size()) { Writers::HdrFtrItem* pHdrFtrItem = oBinary_HdrFtrTableReader.m_oHeaderFooterWriter.m_aFooters[nHdrFtrIndex]; - std::wstring sType; - if(SimpleTypes::hdrftrFirst == pHdrFtrItem->eType) - sType = _T("first"); - else if(SimpleTypes::hdrftrEven == pHdrFtrItem->eType) - sType = _T("even"); - else - sType = _T("default"); - pSectPr->sHeaderFooterReference += _T("rId + _T("\"/>"); + ComplexTypes::Word::CHdrFtrRef* pRef = new ComplexTypes::Word::CHdrFtrRef(); + + pRef->m_oType.Init(); + pRef->m_oType->SetValueFromByte(pHdrFtrItem->eType); + + pRef->m_oId.Init(); + pRef->m_oId->SetValue(pHdrFtrItem->rId); + + pSectPr->m_arrFooterReference.push_back(pRef); } } else @@ -1878,12 +1785,13 @@ int Binary_pPrReader::Read_pgFooter(BYTE type, long length, void* poResult) } int Binary_pPrReader::Read_pageNumType(BYTE type, long length, void* poResult) { - SectPr* pSectPr = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerProp_secPrPageNumType::start == type ) + ComplexTypes::Word::CPageNumber* pCPageNumber = static_cast(poResult); + + if ( c_oSerProp_secPrPageNumType::start == type ) { - pSectPr->bPageNumStart = true; - pSectPr->PageNumStart = m_oBufferedStream.GetLong(); + pCPageNumber->m_oStart.Init(); + pCPageNumber->m_oStart->SetValue(m_oBufferedStream.GetLong()); } else res = c_oSerConstants::ReadUnknown; @@ -1893,22 +1801,22 @@ int Binary_pPrReader::Read_lineNumType(BYTE type, long length, void* poResult) { ComplexTypes::Word::CLineNumber* pLineNumber = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerProp_secPrLineNumType::CountBy == type ) + if ( c_oSerProp_secPrLineNumType::CountBy == type ) { pLineNumber->m_oCountBy.Init(); pLineNumber->m_oCountBy->SetValue(m_oBufferedStream.GetLong()); } - else if( c_oSerProp_secPrLineNumType::Distance == type ) + else if ( c_oSerProp_secPrLineNumType::Distance == type ) { pLineNumber->m_oDistance.Init(); pLineNumber->m_oDistance->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSerProp_secPrLineNumType::Restart == type ) + else if ( c_oSerProp_secPrLineNumType::Restart == type ) { pLineNumber->m_oRestart.Init(); pLineNumber->m_oRestart->SetValue((SimpleTypes::ELineNumberRestart)m_oBufferedStream.GetUChar()); } - else if( c_oSerProp_secPrLineNumType::Start == type ) + else if ( c_oSerProp_secPrLineNumType::Start == type ) { pLineNumber->m_oStart.Init(); pLineNumber->m_oStart->SetValue(m_oBufferedStream.GetLong()); @@ -1921,27 +1829,27 @@ int Binary_pPrReader::ReadCols(BYTE type, long length, void* poResult) { OOX::Logic::CColumns* pCols = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerProp_Columns::EqualWidth == type ) + if ( c_oSerProp_Columns::EqualWidth == type ) { pCols->m_oEqualWidth.Init(); pCols->m_oEqualWidth->FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSerProp_Columns::Num == type ) + else if ( c_oSerProp_Columns::Num == type ) { pCols->m_oNum.Init(); pCols->m_oNum->SetValue(m_oBufferedStream.GetLong()); } - else if( c_oSerProp_Columns::Sep == type ) + else if ( c_oSerProp_Columns::Sep == type ) { pCols->m_oSep.Init(); pCols->m_oSep->FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSerProp_Columns::Space == type ) + else if ( c_oSerProp_Columns::Space == type ) { pCols->m_oSpace.Init(); pCols->m_oSpace->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSerProp_Columns::Column == type ) + else if ( c_oSerProp_Columns::Column == type ) { ComplexTypes::Word::CColumn* pCol = new ComplexTypes::Word::CColumn(); READ1_DEF(length, res, this->ReadCol, pCol); @@ -1955,12 +1863,12 @@ int Binary_pPrReader::ReadCol(BYTE type, long length, void* poResult) { ComplexTypes::Word::CColumn* pCol = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerProp_Columns::ColumnSpace == type ) + if ( c_oSerProp_Columns::ColumnSpace == type ) { pCol->m_oSpace.Init(); pCol->m_oSpace->FromTwips(m_oBufferedStream.GetLong()); } - else if( c_oSerProp_Columns::ColumnW == type ) + else if ( c_oSerProp_Columns::ColumnW == type ) { pCol->m_oW.Init(); pCol->m_oW->FromTwips(m_oBufferedStream.GetLong()); @@ -1973,37 +1881,37 @@ int Binary_pPrReader::ReadPageBorders(BYTE type, long length, void* poResult) { OOX::Logic::CPageBorders* pPageBorders = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerPageBorders::Display == type ) + if ( c_oSerPageBorders::Display == type ) { pPageBorders->m_oDisplay.Init(); pPageBorders->m_oDisplay->SetValueFromByte(m_oBufferedStream.GetChar()); } - else if( c_oSerPageBorders::OffsetFrom == type ) + else if ( c_oSerPageBorders::OffsetFrom == type ) { pPageBorders->m_oOffsetFrom.Init(); pPageBorders->m_oOffsetFrom->SetValueFromByte(m_oBufferedStream.GetChar()); } - else if( c_oSerPageBorders::ZOrder == type ) + else if ( c_oSerPageBorders::ZOrder == type ) { pPageBorders->m_oZOrder.Init(); pPageBorders->m_oZOrder->SetValueFromByte(m_oBufferedStream.GetChar()); } - else if( c_oSerPageBorders::Bottom == type ) + else if ( c_oSerPageBorders::Bottom == type ) { pPageBorders->m_oBottom.Init(); READ2_DEF(length, res, this->ReadPageBorder, pPageBorders->m_oBottom.GetPointer()); } - else if( c_oSerPageBorders::Left == type ) + else if ( c_oSerPageBorders::Left == type ) { pPageBorders->m_oLeft.Init(); READ2_DEF(length, res, this->ReadPageBorder, pPageBorders->m_oLeft.GetPointer()); } - else if( c_oSerPageBorders::Right == type ) + else if ( c_oSerPageBorders::Right == type ) { pPageBorders->m_oRight.Init(); READ2_DEF(length, res, this->ReadPageBorder, pPageBorders->m_oRight.GetPointer()); } - else if( c_oSerPageBorders::Top == type ) + else if ( c_oSerPageBorders::Top == type ) { pPageBorders->m_oTop.Init(); READ2_DEF(length, res, this->ReadPageBorder, pPageBorders->m_oTop.GetPointer()); @@ -2016,7 +1924,7 @@ int Binary_pPrReader::ReadPageBorder(BYTE type, long length, void* poResult) { ComplexTypes::Word::CPageBorder* pPageBorder = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerPageBorders::Color == type ) + if ( c_oSerPageBorders::Color == type ) { docRGB color = oBinary_CommonReader2.ReadColor(); pPageBorder->m_oColor.Init(); @@ -2025,53 +1933,53 @@ int Binary_pPrReader::ReadPageBorder(BYTE type, long length, void* poResult) pPageBorder->m_oColor->Set_G(color.G); pPageBorder->m_oColor->Set_B(color.B); } - else if( c_oSerPageBorders::ColorTheme == type ) + else if ( c_oSerPageBorders::ColorTheme == type ) { CThemeColor themeColor; oBinary_CommonReader2.ReadThemeColor(length, themeColor); - if(themeColor.Auto) + if (themeColor.Auto) { pPageBorder->m_oColor.Init(); pPageBorder->m_oColor->SetValue(SimpleTypes::hexcolorAuto); } - if(themeColor.bColor) + if (themeColor.bColor) { pPageBorder->m_oThemeColor.Init(); pPageBorder->m_oThemeColor->SetValue((SimpleTypes::EThemeColor)themeColor.Color); } - if(themeColor.bShade) + if (themeColor.bShade) { pPageBorder->m_oThemeShade.Init(); pPageBorder->m_oThemeShade->SetValue(themeColor.Shade); } - if(themeColor.bTint) + if (themeColor.bTint) { pPageBorder->m_oThemeTint.Init(); pPageBorder->m_oThemeTint->SetValue(themeColor.Tint); } } - else if( c_oSerPageBorders::Space == type ) + else if ( c_oSerPageBorders::Space == type ) { pPageBorder->m_oSpace.Init(); pPageBorder->m_oSpace->SetValue(m_oBufferedStream.GetLong()); } - else if( c_oSerPageBorders::Sz == type ) + else if ( c_oSerPageBorders::Sz == type ) { pPageBorder->m_oSz.Init(); pPageBorder->m_oSz->SetValue(m_oBufferedStream.GetLong()); } - else if( c_oSerPageBorders::Val == type ) + else if ( c_oSerPageBorders::Val == type ) { pPageBorder->m_oVal.Init(); pPageBorder->m_oVal->SetValue((SimpleTypes::EBorder)m_oBufferedStream.GetLong()); } - else if( c_oSerPageBorders::Frame == type ) + else if ( c_oSerPageBorders::Frame == type ) { pPageBorder->m_oFrame.Init(); pPageBorder->m_oFrame->FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSerPageBorders::Shadow == type ) + else if ( c_oSerPageBorders::Shadow == type ) { pPageBorder->m_oShadow.Init(); pPageBorder->m_oShadow->FromBool(m_oBufferedStream.GetBool()); @@ -2089,17 +1997,17 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; CWiterTblPr* pWiterTblPr = static_cast(poResult); - if( c_oSerProp_tblPrType::RowBandSize == type ) + if ( c_oSerProp_tblPrType::RowBandSize == type ) { long nRowBandSize = m_oBufferedStream.GetLong(); pWiterTblPr->RowBandSize = L""; } - else if( c_oSerProp_tblPrType::ColBandSize == type ) + else if ( c_oSerProp_tblPrType::ColBandSize == type ) { long nColBandSize = m_oBufferedStream.GetLong(); pWiterTblPr->ColBandSize = L""; } - else if( c_oSerProp_tblPrType::Jc == type ) + else if ( c_oSerProp_tblPrType::Jc == type ) { BYTE jc = m_oBufferedStream.GetUChar(); switch(jc) @@ -2110,47 +2018,45 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult) case align_Left: break; } } - else if( c_oSerProp_tblPrType::TableInd == type ) + else if ( c_oSerProp_tblPrType::TableInd == type ) { double dInd = m_oBufferedStream.GetDouble(); long nInd = SerializeCommon::Round( g_dKoef_mm_to_twips * dInd); pWiterTblPr->TableInd = L""; } - else if( c_oSerProp_tblPrType::TableIndTwips == type ) + else if ( c_oSerProp_tblPrType::TableIndTwips == type ) { pWiterTblPr->TableInd = L""; } - else if( c_oSerProp_tblPrType::TableW == type ) + else if ( c_oSerProp_tblPrType::TableW == type ) { docW odocW; READ2_DEF(length, res, this->ReadW, &odocW); pWiterTblPr->TableW = odocW.Write(std::wstring(_T("w:tblW"))); } - else if( c_oSerProp_tblPrType::TableCellMar == type ) + else if ( c_oSerProp_tblPrType::TableCellMar == type ) { NSStringUtils::CStringBuilder oTempWriter; READ1_DEF(length, res, this->ReadCellMargins, &oTempWriter); - if(oTempWriter.GetCurSize() > 0) + if (oTempWriter.GetCurSize() > 0) { pWiterTblPr->TableCellMar += L""; pWiterTblPr->TableCellMar += oTempWriter.GetData(); pWiterTblPr->TableCellMar += L""; } } - else if( c_oSerProp_tblPrType::TableBorders == type ) + else if ( c_oSerProp_tblPrType::TableBorders == type ) { - docBorders odocBorders; - READ1_DEF(length, res, oBinary_pPrReader.ReadBorders, &odocBorders); - if(false == odocBorders.IsEmpty()) + OOX::Logic::CTblBorders tblBorders; + READ1_DEF(length, res, oBinary_pPrReader.ReadTableBorders, &tblBorders); + + std::wstring sTableBorders = tblBorders.toXML(); + if (false == sTableBorders.empty()) { - NSStringUtils::CStringBuilder oTempWriter; - odocBorders.Write(&oTempWriter, false); - pWiterTblPr->TableBorders += L""; - pWiterTblPr->TableBorders += oTempWriter.GetData(); - pWiterTblPr->TableBorders += L""; + pWiterTblPr->TableBorders += sTableBorders; } } - else if( c_oSerProp_tblPrType::Shd == type ) + else if ( c_oSerProp_tblPrType::Shd == type ) { ComplexTypes::Word::CShading oShd; READ2_DEF(length, res, oBinary_CommonReader2.ReadShdComplexType, &oShd); @@ -2161,7 +2067,7 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult) pWiterTblPr->Shd = L""; } } - else if( c_oSerProp_tblPrType::tblpPr == type ) + else if ( c_oSerProp_tblPrType::tblpPr == type ) { NSStringUtils::CStringBuilder oTempWriter; READ2_DEF(length, res, this->Read_tblpPr, &oTempWriter); @@ -2169,7 +2075,7 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult) pWiterTblPr->tblpPr += oTempWriter.GetData(); pWiterTblPr->tblpPr += L"/>"; } - else if( c_oSerProp_tblPrType::tblpPr2 == type ) + else if ( c_oSerProp_tblPrType::tblpPr2 == type ) { NSStringUtils::CStringBuilder oTempWriter; READ2_DEF(length, res, this->Read_tblpPr2, &oTempWriter); @@ -2177,13 +2083,13 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult) pWiterTblPr->tblpPr += oTempWriter.GetData(); pWiterTblPr->tblpPr += L"/>"; } - else if( c_oSerProp_tblPrType::Style == type ) + else if ( c_oSerProp_tblPrType::Style == type ) { std::wstring Name(m_oBufferedStream.GetString3(length)); Name = XmlUtils::EncodeXmlString(Name); pWiterTblPr->Style = L""; } - else if( c_oSerProp_tblPrType::Look == type ) + else if ( c_oSerProp_tblPrType::Look == type ) { // _INT32 nLook = m_oBufferedStream.GetLong(); @@ -2198,7 +2104,7 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult) + L"\" w:firstColumn=\"" + std::to_wstring(nFC) + L"\" w:lastColumn=\"" + std::to_wstring(nLC) + L"\" w:noHBand=\"" + std::to_wstring(nBH) + L"\" w:noVBand=\"" + std::to_wstring(nBV) + L"\"/>"; } - else if( c_oSerProp_tblPrType::Layout == type ) + else if ( c_oSerProp_tblPrType::Layout == type ) { long nLayout = m_oBufferedStream.GetUChar(); std::wstring sLayout; @@ -2207,31 +2113,31 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult) case 1: sLayout = _T("autofit");break; case 2: sLayout = _T("fixed");break; } - if(false == sLayout.empty()) + if (false == sLayout.empty()) pWiterTblPr->Layout = L""; } - else if( c_oSerProp_tblPrType::tblPrChange == type ) + else if ( c_oSerProp_tblPrType::tblPrChange == type ) { TrackRevision tblPrChange; READ1_DEF(length, res, this->ReadTblPrChange, &tblPrChange); pWiterTblPr->tblPrChange = tblPrChange.ToString(_T("w:tblPrChange")); } - else if( c_oSerProp_tblPrType::TableCellSpacing == type ) + else if ( c_oSerProp_tblPrType::TableCellSpacing == type ) { double dSpacing = m_oBufferedStream.GetDouble(); dSpacing /=2; long nSpacing = SerializeCommon::Round( g_dKoef_mm_to_twips * dSpacing); pWiterTblPr->TableCellSpacing = L""; } - else if( c_oSerProp_tblPrType::TableCellSpacingTwips == type ) + else if ( c_oSerProp_tblPrType::TableCellSpacingTwips == type ) { pWiterTblPr->TableCellSpacing = L""; } - else if( c_oSerProp_tblPrType::tblCaption == type ) + else if ( c_oSerProp_tblPrType::tblCaption == type ) { pWiterTblPr->Caption = m_oBufferedStream.GetString3(length); } - else if( c_oSerProp_tblPrType::tblDescription == type ) + else if ( c_oSerProp_tblPrType::tblDescription == type ) { pWiterTblPr->Description = m_oBufferedStream.GetString3(length); } @@ -2253,17 +2159,17 @@ int Binary_tblPrReader::ReadW(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; docW* odocW = static_cast(poResult); - if( c_oSerWidthType::Type == type ) + if ( c_oSerWidthType::Type == type ) { odocW->bType = true; odocW->Type = m_oBufferedStream.GetUChar(); } - else if( c_oSerWidthType::W == type ) + else if ( c_oSerWidthType::W == type ) { odocW->bW = true; odocW->W = m_oBufferedStream.GetDouble(); } - else if( c_oSerWidthType::WDocx == type ) + else if ( c_oSerWidthType::WDocx == type ) { odocW->bWDocx = true; odocW->WDocx = m_oBufferedStream.GetLong(); @@ -2276,25 +2182,25 @@ int Binary_tblPrReader::ReadCellMargins(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerMarginsType::left == type ) + if ( c_oSerMarginsType::left == type ) { docW oLeft; READ2_DEF(length, res, this->ReadW, &oLeft); oLeft.Write(*pCStringWriter, std::wstring(_T("w:left"))); } - else if( c_oSerMarginsType::top == type ) + else if ( c_oSerMarginsType::top == type ) { docW oTop; READ2_DEF(length, res, this->ReadW, &oTop); oTop.Write(*pCStringWriter, std::wstring(_T("w:top"))); } - else if( c_oSerMarginsType::right == type ) + else if ( c_oSerMarginsType::right == type ) { docW oRight; READ2_DEF(length, res, this->ReadW, &oRight); oRight.Write(*pCStringWriter, std::wstring(_T("w:right"))); } - else if( c_oSerMarginsType::bottom == type ) + else if ( c_oSerMarginsType::bottom == type ) { docW oBottom; READ2_DEF(length, res, this->ReadW, &oBottom); @@ -2308,45 +2214,45 @@ int Binary_tblPrReader::Read_tblpPr(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSer_tblpPrType::X == type ) + if ( c_oSer_tblpPrType::X == type ) { double dX = m_oBufferedStream.GetDouble(); long nX = SerializeCommon::Round( g_dKoef_mm_to_twips * dX); pCStringWriter->WriteString(L" w:tblpX=\"" + std::to_wstring(nX) + L"\""); } - else if( c_oSer_tblpPrType::Y == type ) + else if ( c_oSer_tblpPrType::Y == type ) { double dY = m_oBufferedStream.GetDouble(); long nY = SerializeCommon::Round( g_dKoef_mm_to_twips * dY); pCStringWriter->WriteString(L" w:tblpY=\"" + std::to_wstring(nY) + L"\""); } - else if( c_oSer_tblpPrType::Paddings == type ) + else if ( c_oSer_tblpPrType::Paddings == type ) { PaddingsToWrite oPaddings; READ2_DEF(length, res, this->ReadPaddings, &oPaddings); - if(oPaddings.bLeft) + if (oPaddings.bLeft) { double dLeft = oPaddings.Left; long nLeft = SerializeCommon::Round( g_dKoef_mm_to_twips * dLeft); pCStringWriter->WriteString(L" w:leftFromText=\"" + std::to_wstring(nLeft) + L"\""); } - if(oPaddings.bTop) + if (oPaddings.bTop) { double dTop = oPaddings.Top; long nTop = SerializeCommon::Round( g_dKoef_mm_to_twips * dTop); pCStringWriter->WriteString(L" w:topFromText=\"" + std::to_wstring(nTop) + L"\""); } - if(oPaddings.bRight) + if (oPaddings.bRight) { double dRight = oPaddings.Right; long nRight = SerializeCommon::Round( g_dKoef_mm_to_twips * dRight); pCStringWriter->WriteString(L" w:rightFromText=\"" + std::to_wstring(nRight) + L"\""); } - if(oPaddings.bBottom) + if (oPaddings.bBottom) { double dBottom = oPaddings.Bottom; long nBottom = SerializeCommon::Round( g_dKoef_mm_to_twips * dBottom); @@ -2362,7 +2268,7 @@ int Binary_tblPrReader::Read_tblpPr2(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSer_tblpPrType2::HorzAnchor == type ) + if ( c_oSer_tblpPrType2::HorzAnchor == type ) { std::wstring sXml; switch(m_oBufferedStream.GetUChar()) @@ -2374,18 +2280,18 @@ int Binary_tblPrReader::Read_tblpPr2(BYTE type, long length, void* poResult) } pCStringWriter->WriteString(sXml); } - else if( c_oSer_tblpPrType2::TblpX == type ) + else if ( c_oSer_tblpPrType2::TblpX == type ) { double dX = m_oBufferedStream.GetDouble(); long nX = SerializeCommon::Round( g_dKoef_mm_to_twips * dX); pCStringWriter->WriteString(L" w:tblpX=\"" + std::to_wstring(nX) + L"\""); } - else if( c_oSer_tblpPrType2::TblpXTwips == type ) + else if ( c_oSer_tblpPrType2::TblpXTwips == type ) { pCStringWriter->WriteString(L" w:tblpX=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\""); } - else if( c_oSer_tblpPrType2::TblpXSpec == type ) + else if ( c_oSer_tblpPrType2::TblpXSpec == type ) { std::wstring sXml; switch(m_oBufferedStream.GetUChar()) @@ -2399,7 +2305,7 @@ int Binary_tblPrReader::Read_tblpPr2(BYTE type, long length, void* poResult) } pCStringWriter->WriteString(sXml); } - else if( c_oSer_tblpPrType2::VertAnchor == type ) + else if ( c_oSer_tblpPrType2::VertAnchor == type ) { std::wstring sXml; switch(m_oBufferedStream.GetUChar()) @@ -2411,18 +2317,18 @@ int Binary_tblPrReader::Read_tblpPr2(BYTE type, long length, void* poResult) } pCStringWriter->WriteString(sXml); } - else if( c_oSer_tblpPrType2::TblpY == type ) + else if ( c_oSer_tblpPrType2::TblpY == type ) { double dY = m_oBufferedStream.GetDouble(); long nY = SerializeCommon::Round( g_dKoef_mm_to_twips * dY); pCStringWriter->WriteString(L" w:tblpY=\"" + std::to_wstring(nY) + L"\""); } - else if( c_oSer_tblpPrType2::TblpYTwips == type ) + else if ( c_oSer_tblpPrType2::TblpYTwips == type ) { pCStringWriter->WriteString(L" w:tblpY=\"" + std::to_wstring(m_oBufferedStream.GetLong()) + L"\""); } - else if( c_oSer_tblpPrType2::TblpYSpec == type ) + else if ( c_oSer_tblpPrType2::TblpYSpec == type ) { std::wstring sXml; switch(m_oBufferedStream.GetUChar()) @@ -2437,7 +2343,7 @@ int Binary_tblPrReader::Read_tblpPr2(BYTE type, long length, void* poResult) } pCStringWriter->WriteString(sXml); } - else if( c_oSer_tblpPrType2::Paddings == type ) + else if ( c_oSer_tblpPrType2::Paddings == type ) { READ2_DEF(length, res, this->ReadPaddings2, poResult); } @@ -2449,23 +2355,23 @@ int Binary_tblPrReader::Read_RowPr(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerProp_rowPrType::CantSplit == type ) + if ( c_oSerProp_rowPrType::CantSplit == type ) { BYTE CantSplit = m_oBufferedStream.GetUChar(); - if(0 != CantSplit) + if (0 != CantSplit) pCStringWriter->WriteString(std::wstring(_T(""))); else pCStringWriter->WriteString(std::wstring(_T(""))); } - else if( c_oSerProp_rowPrType::After == type ) + else if ( c_oSerProp_rowPrType::After == type ) { rowPrAfterBefore orowPrAfterBefore(_T("After")); READ2_DEF(length, res, this->ReadAfter, &orowPrAfterBefore); - if(true == orowPrAfterBefore.bGridAfter && orowPrAfterBefore.nGridAfter > 0 && false == orowPrAfterBefore.oAfterWidth.bW) + if (true == orowPrAfterBefore.bGridAfter && orowPrAfterBefore.nGridAfter > 0 && false == orowPrAfterBefore.oAfterWidth.bW) { //ищем по tblGrid long nGridLength = (long)m_aCurTblGrid.size(); - if(orowPrAfterBefore.nGridAfter < nGridLength) + if (orowPrAfterBefore.nGridAfter < nGridLength) { double nSumW = 0; for(int i = 0; i < orowPrAfterBefore.nGridAfter; i++) @@ -2478,14 +2384,14 @@ int Binary_tblPrReader::Read_RowPr(BYTE type, long length, void* poResult) } orowPrAfterBefore.Write(*pCStringWriter); } - else if( c_oSerProp_rowPrType::Before == type ) + else if ( c_oSerProp_rowPrType::Before == type ) { rowPrAfterBefore orowPrAfterBefore(_T("Before")); READ2_DEF(length, res, this->ReadBefore, &orowPrAfterBefore); - if(true == orowPrAfterBefore.bGridAfter && orowPrAfterBefore.nGridAfter > 0 && false == orowPrAfterBefore.oAfterWidth.bW) + if (true == orowPrAfterBefore.bGridAfter && orowPrAfterBefore.nGridAfter > 0 && false == orowPrAfterBefore.oAfterWidth.bW) { //ищем по tblGrid - if(orowPrAfterBefore.nGridAfter < (long)m_aCurTblGrid.size()) + if (orowPrAfterBefore.nGridAfter < (long)m_aCurTblGrid.size()) { double nSumW = 0; for(int i = 0; i < orowPrAfterBefore.nGridAfter; i++) @@ -2498,7 +2404,7 @@ int Binary_tblPrReader::Read_RowPr(BYTE type, long length, void* poResult) } orowPrAfterBefore.Write(*pCStringWriter); } - else if( c_oSerProp_rowPrType::Jc == type ) + else if ( c_oSerProp_rowPrType::Jc == type ) { BYTE jc = m_oBufferedStream.GetUChar(); switch(jc) @@ -2509,7 +2415,7 @@ int Binary_tblPrReader::Read_RowPr(BYTE type, long length, void* poResult) case align_Justify: pCStringWriter->WriteString(std::wstring(_T("")));break; } } - else if( c_oSerProp_rowPrType::TableCellSpacing == type ) + else if ( c_oSerProp_rowPrType::TableCellSpacing == type ) { double dSpacing = m_oBufferedStream.GetDouble(); dSpacing /=2; @@ -2517,11 +2423,11 @@ int Binary_tblPrReader::Read_RowPr(BYTE type, long length, void* poResult) pCStringWriter->WriteString(L""); } - else if( c_oSerProp_rowPrType::TableCellSpacingTwips == type ) + else if ( c_oSerProp_rowPrType::TableCellSpacingTwips == type ) { pCStringWriter->WriteString(L""); } - else if( c_oSerProp_rowPrType::Height == type ) + else if ( c_oSerProp_rowPrType::Height == type ) { RowHeight val; READ2_DEF(length, res, this->ReadHeight, &val); @@ -2535,27 +2441,27 @@ int Binary_tblPrReader::Read_RowPr(BYTE type, long length, void* poResult) } pCStringWriter->WriteString(L"/>"); } - else if( c_oSerProp_rowPrType::TableHeader == type ) + else if ( c_oSerProp_rowPrType::TableHeader == type ) { BYTE tblHeader = m_oBufferedStream.GetUChar(); - if(0 != tblHeader) + if (0 != tblHeader) pCStringWriter->WriteString(std::wstring(_T(""))); else pCStringWriter->WriteString(std::wstring(_T(""))); } - else if( c_oSerProp_rowPrType::Del == type ) + else if ( c_oSerProp_rowPrType::Del == type ) { TrackRevision Del; oBinary_CommonReader2.ReadTrackRevision(length, &Del); Del.Write(pCStringWriter, _T("w:del")); } - else if( c_oSerProp_rowPrType::Ins == type ) + else if ( c_oSerProp_rowPrType::Ins == type ) { TrackRevision Ins; oBinary_CommonReader2.ReadTrackRevision(length, &Ins); Ins.Write(pCStringWriter, _T("w:ins")); } - else if( c_oSerProp_rowPrType::trPrChange == type ) + else if ( c_oSerProp_rowPrType::trPrChange == type ) { TrackRevision trPrChange; READ1_DEF(length, res, this->ReadTrPrChange, &trPrChange); @@ -2569,12 +2475,12 @@ int Binary_tblPrReader::ReadAfter(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; rowPrAfterBefore* orowPrAfterBefore = static_cast(poResult); - if( c_oSerProp_rowPrType::GridAfter == type ) + if ( c_oSerProp_rowPrType::GridAfter == type ) { orowPrAfterBefore->bGridAfter = true; orowPrAfterBefore->nGridAfter = m_oBufferedStream.GetLong(); } - else if( c_oSerProp_rowPrType::WAfter == type ) + else if ( c_oSerProp_rowPrType::WAfter == type ) { READ2_DEF(length, res, this->ReadW, &orowPrAfterBefore->oAfterWidth); } @@ -2586,12 +2492,12 @@ int Binary_tblPrReader::ReadBefore(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; rowPrAfterBefore* orowPrAfterBefore = static_cast(poResult); - if( c_oSerProp_rowPrType::GridBefore == type ) + if ( c_oSerProp_rowPrType::GridBefore == type ) { orowPrAfterBefore->bGridAfter = true; orowPrAfterBefore->nGridAfter = m_oBufferedStream.GetLong(); } - else if( c_oSerProp_rowPrType::WBefore == type ) + else if ( c_oSerProp_rowPrType::WBefore == type ) { READ2_DEF(length, res, this->ReadW, &orowPrAfterBefore->oAfterWidth); } @@ -2605,16 +2511,16 @@ int Binary_tblPrReader::ReadHeight(BYTE type, long length, void* poResult) RowHeight* pHeight = static_cast(poResult); - if( c_oSerProp_rowPrType::Height_Rule == type ) + if ( c_oSerProp_rowPrType::Height_Rule == type ) { pHeight->HRule = m_oBufferedStream.GetUChar(); } - else if( c_oSerProp_rowPrType::Height_Value == type ) + else if ( c_oSerProp_rowPrType::Height_Value == type ) { double dHeight = m_oBufferedStream.GetDouble(); pHeight->nHeight = SerializeCommon::Round( g_dKoef_mm_to_twips * dHeight); } - else if( c_oSerProp_rowPrType::Height_ValueTwips == type ) + else if ( c_oSerProp_rowPrType::Height_ValueTwips == type ) { pHeight->nHeight = m_oBufferedStream.GetLong(); } @@ -2626,15 +2532,15 @@ int Binary_tblPrReader::Read_CellPr(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerProp_cellPrType::GridSpan == type ) + if ( c_oSerProp_cellPrType::GridSpan == type ) { long nGridSpan = m_oBufferedStream.GetLong(); - if(nGridSpan > 1) + if (nGridSpan > 1) { pCStringWriter->WriteString(L""); } } - else if( c_oSerProp_cellPrType::Shd == type ) + else if ( c_oSerProp_cellPrType::Shd == type ) { ComplexTypes::Word::CShading oShd; READ2_DEF(length, res, oBinary_CommonReader2.ReadShdComplexType, &oShd); @@ -2643,35 +2549,35 @@ int Binary_tblPrReader::Read_CellPr(BYTE type, long length, void* poResult) if (false == sShd.empty()) pCStringWriter->WriteString(L""); } - else if( c_oSerProp_cellPrType::TableCellBorders == type ) + else if ( c_oSerProp_cellPrType::TableCellBorders == type ) { - docBorders odocBorders; - READ1_DEF(length, res, oBinary_pPrReader.ReadBorders, &odocBorders); - if(false == odocBorders.IsEmpty()) + OOX::Logic::CTcBorders tcBorders; + READ1_DEF(length, res, oBinary_pPrReader.ReadTableCellBorders, &tcBorders); + + std::wstring sTcBorders = tcBorders.toXML(); + if (false == sTcBorders.empty()) { - pCStringWriter->WriteString(std::wstring(_T(""))); - odocBorders.Write(pCStringWriter, true); - pCStringWriter->WriteString(std::wstring(_T(""))); + pCStringWriter->WriteString(sTcBorders); } } - else if( c_oSerProp_cellPrType::CellMar == type ) + else if ( c_oSerProp_cellPrType::CellMar == type ) { NSStringUtils::CStringBuilder oTempWriter; READ1_DEF(length, res, this->ReadCellMargins, &oTempWriter); - if(oTempWriter.GetCurSize() > 0) + if (oTempWriter.GetCurSize() > 0) { pCStringWriter->WriteString(std::wstring(_T(""))); pCStringWriter->Write(oTempWriter); pCStringWriter->WriteString(std::wstring(_T(""))); } } - else if( c_oSerProp_cellPrType::TableCellW == type ) + else if ( c_oSerProp_cellPrType::TableCellW == type ) { docW oW; READ2_DEF(length, res, this->ReadW, &oW); oW.Write(*pCStringWriter, std::wstring(_T("w:tcW"))); } - else if( c_oSerProp_cellPrType::VAlign == type ) + else if ( c_oSerProp_cellPrType::VAlign == type ) { BYTE VAlign = m_oBufferedStream.GetUChar(); switch(VAlign) @@ -2681,7 +2587,7 @@ int Binary_tblPrReader::Read_CellPr(BYTE type, long length, void* poResult) case vertalignjc_Bottom:pCStringWriter->WriteString(std::wstring(_T("")));break; } } - else if( c_oSerProp_cellPrType::VMerge == type ) + else if ( c_oSerProp_cellPrType::VMerge == type ) { BYTE VMerge = m_oBufferedStream.GetUChar(); switch(VMerge) @@ -2690,7 +2596,7 @@ int Binary_tblPrReader::Read_CellPr(BYTE type, long length, void* poResult) case vmerge_Continue:pCStringWriter->WriteString(std::wstring(_T("")));break; } } - else if( c_oSerProp_cellPrType::HMerge == type ) + else if ( c_oSerProp_cellPrType::HMerge == type ) { BYTE HMerge = m_oBufferedStream.GetUChar(); switch(HMerge) @@ -2699,31 +2605,31 @@ int Binary_tblPrReader::Read_CellPr(BYTE type, long length, void* poResult) case vmerge_Continue:pCStringWriter->WriteString(std::wstring(_T("")));break; } } - else if( c_oSerProp_cellPrType::CellDel == type ) + else if ( c_oSerProp_cellPrType::CellDel == type ) { TrackRevision Del; oBinary_CommonReader2.ReadTrackRevision(length, &Del); Del.Write(pCStringWriter, _T("w:del")); } - else if( c_oSerProp_cellPrType::CellIns == type ) + else if ( c_oSerProp_cellPrType::CellIns == type ) { TrackRevision Ins; oBinary_CommonReader2.ReadTrackRevision(length, &Ins); Ins.Write(pCStringWriter, _T("w:ins")); } - else if( c_oSerProp_cellPrType::CellMerge == type ) + else if ( c_oSerProp_cellPrType::CellMerge == type ) { TrackRevision cellMerge; READ1_DEF(length, res, this->ReadCellMerge, &cellMerge); cellMerge.Write(pCStringWriter, _T("w:cellMerge")); } - else if( c_oSerProp_cellPrType::tcPrChange == type ) + else if ( c_oSerProp_cellPrType::tcPrChange == type ) { TrackRevision tcPrChange; READ1_DEF(length, res, this->ReadTcPrChange, &tcPrChange); tcPrChange.Write(pCStringWriter, _T("w:tcPrChange")); } - else if( c_oSerProp_cellPrType::textDirection == type ) + else if ( c_oSerProp_cellPrType::textDirection == type ) { SimpleTypes::CTextDirection oTextDirection; oTextDirection.SetValue((SimpleTypes::ETextDirection)m_oBufferedStream.GetUChar()); @@ -2731,26 +2637,26 @@ int Binary_tblPrReader::Read_CellPr(BYTE type, long length, void* poResult) pCStringWriter->WriteString(oTextDirection.ToString()); pCStringWriter->WriteString(std::wstring(_T("\" />"))); } - else if( c_oSerProp_cellPrType::hideMark == type ) + else if ( c_oSerProp_cellPrType::hideMark == type ) { bool hideMark = m_oBufferedStream.GetBool(); - if(hideMark) + if (hideMark) pCStringWriter->WriteString(std::wstring(_T(""))); else pCStringWriter->WriteString(std::wstring(_T(""))); } - else if( c_oSerProp_cellPrType::noWrap == type ) + else if ( c_oSerProp_cellPrType::noWrap == type ) { bool noWrap = m_oBufferedStream.GetBool(); - if(noWrap) + if (noWrap) pCStringWriter->WriteString(std::wstring(_T(""))); else pCStringWriter->WriteString(std::wstring(_T(""))); } - else if( c_oSerProp_cellPrType::tcFitText == type ) + else if ( c_oSerProp_cellPrType::tcFitText == type ) { bool tcFitText = m_oBufferedStream.GetBool(); - if(tcFitText) + if (tcFitText) pCStringWriter->WriteString(std::wstring(_T(""))); else pCStringWriter->WriteString(std::wstring(_T(""))); @@ -2936,7 +2842,7 @@ int Binary_NumberingTableReader::ReadNums(BYTE type, long length, void* poResult OOX::Numbering::CNum* pdocNum = new OOX::Numbering::CNum(); READ2_DEF(length, res, this->ReadNum, pdocNum); - if(pdocNum->m_oNumId.IsInit() && pdocNum->m_oAbstractNumId.IsInit()) + if (pdocNum->m_oNumId.IsInit() && pdocNum->m_oAbstractNumId.IsInit()) m_pNumbering->m_mapAbstractNum[*pdocNum->m_oAbstractNumId->m_oVal] = *pdocNum->m_oNumId; m_pNumbering->m_arrNum.push_back(pdocNum); @@ -3234,28 +3140,28 @@ int BinaryStyleTableReader::Read() int BinaryStyleTableReader::ReadStyleTableContent(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - if(c_oSer_st::Styles == type) + if (c_oSer_st::Styles == type) { READ1_DEF(length, res, this->ReadStyle, poResult); } - else if(c_oSer_st::DefpPr == type) + else if (c_oSer_st::DefpPr == type) { - m_oStylesWriter.m_pPrDefault.WriteString(std::wstring(_T(""))); - bool bOldVal = oBinary_pPrReader.bDoNotWriteNullProp; - oBinary_pPrReader.bDoNotWriteNullProp = true; - res = oBinary_pPrReader.Read(length, &m_oStylesWriter.m_pPrDefault); - oBinary_pPrReader.bDoNotWriteNullProp = bOldVal; - m_oStylesWriter.m_pPrDefault.WriteString(std::wstring(_T(""))); - } - else if(c_oSer_st::DefrPr == type) - { - //OOX::CDocDefaults docDefault; - OOX::Logic::CRunProperty oRunPr; - - res = oBinary_rPrReader.Read(length, &oRunPr); - if (oRunPr.IsNoEmpty()) + OOX::Logic::CParagraphProperty paraPr; + res = oBinary_pPrReader.Read(length, ¶Pr); + + if (paraPr.IsNoEmpty()) { - m_oStylesWriter.m_rPrDefault.WriteString(oRunPr.toXML()); + m_oStylesWriter.m_pPrDefault.WriteString(paraPr.toXML()); + } + } + else if (c_oSer_st::DefrPr == type) + { + OOX::Logic::CRunProperty runPr; + res = oBinary_rPrReader.Read(length, &runPr); + + if (runPr.IsNoEmpty()) + { + m_oStylesWriter.m_rPrDefault.WriteString(runPr.toXML()); } } else @@ -3265,11 +3171,11 @@ int BinaryStyleTableReader::ReadStyleTableContent(BYTE type, long length, void* int BinaryStyleTableReader::ReadStyle(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; - if(c_oSer_sts::Style == type) + if (c_oSer_sts::Style == type) { docStyle odocStyle; READ1_DEF(length, res, this->ReadStyleContent, &odocStyle); - if(m_oStylesWriter.m_nVersion < 2) + if (m_oStylesWriter.m_nVersion < 2) { odocStyle.bqFormat = true; odocStyle.qFormat = true; @@ -3284,139 +3190,140 @@ int BinaryStyleTableReader::ReadStyleContent(BYTE type, long length, void* poRes { int res = c_oSerConstants::ReadOk; docStyle* odocStyle = static_cast(poResult); - if(c_oSer_sts::Style_Name == type) + if (c_oSer_sts::Style_Name == type) { std::wstring Name(m_oBufferedStream.GetString3(length)); Name = XmlUtils::EncodeXmlString(Name); odocStyle->Name = Name; } - else if(c_oSer_sts::Style_Id == type) + else if (c_oSer_sts::Style_Id == type) { std::wstring Id(m_oBufferedStream.GetString3(length)); Id = XmlUtils::EncodeXmlString(Id); odocStyle->Id = Id; } - else if(c_oSer_sts::Style_Type == type) + else if (c_oSer_sts::Style_Type == type) { odocStyle->byteType = m_oBufferedStream.GetUChar(); } - else if(c_oSer_sts::Style_Default == type) + else if (c_oSer_sts::Style_Default == type) { odocStyle->bDefault = true; odocStyle->Default = m_oBufferedStream.GetBool(); } - else if(c_oSer_sts::Style_BasedOn == type) + else if (c_oSer_sts::Style_BasedOn == type) { std::wstring BasedOn(m_oBufferedStream.GetString3(length)); BasedOn = XmlUtils::EncodeXmlString(BasedOn); odocStyle->BasedOn = BasedOn; } - else if(c_oSer_sts::Style_Next == type) + else if (c_oSer_sts::Style_Next == type) { std::wstring NextId(m_oBufferedStream.GetString3(length)); NextId = XmlUtils::EncodeXmlString(NextId); odocStyle->NextId = NextId; } - else if(c_oSer_sts::Style_Link == type) + else if (c_oSer_sts::Style_Link == type) { odocStyle->Link = m_oBufferedStream.GetString3(length); } - else if(c_oSer_sts::Style_qFormat == type) + else if (c_oSer_sts::Style_qFormat == type) { odocStyle->bqFormat = true; odocStyle->qFormat = (0 != m_oBufferedStream.GetUChar()) ? true : false; } - else if(c_oSer_sts::Style_uiPriority == type) + else if (c_oSer_sts::Style_uiPriority == type) { odocStyle->buiPriority = true; odocStyle->uiPriority = m_oBufferedStream.GetLong(); } - else if(c_oSer_sts::Style_hidden == type) + else if (c_oSer_sts::Style_hidden == type) { odocStyle->bhidden = true; odocStyle->hidden = (0 != m_oBufferedStream.GetUChar()) ? true : false; } - else if(c_oSer_sts::Style_semiHidden == type) + else if (c_oSer_sts::Style_semiHidden == type) { odocStyle->bsemiHidden = true; odocStyle->semiHidden = (0 != m_oBufferedStream.GetUChar()) ? true : false; } - else if(c_oSer_sts::Style_unhideWhenUsed == type) + else if (c_oSer_sts::Style_unhideWhenUsed == type) { odocStyle->bunhideWhenUsed = true; odocStyle->unhideWhenUsed = (0 != m_oBufferedStream.GetUChar()) ? true : false; } - else if(c_oSer_sts::Style_TextPr == type) + else if (c_oSer_sts::Style_TextPr == type) { OOX::Logic::CRunProperty newRPr; res = oBinary_rPrReader.Read(length, &newRPr); - if(newRPr.IsNoEmpty()) + if (newRPr.IsNoEmpty()) { odocStyle->TextPr = newRPr.toXML(); } } - else if(c_oSer_sts::Style_ParaPr == type) + else if (c_oSer_sts::Style_ParaPr == type) { - NSStringUtils::CStringBuilder oTempWriter; + OOX::Logic::CParagraphProperty pPPr; oBinary_pPrReader.m_nCurNumId = -1; oBinary_pPrReader.m_nCurLvl = -1; - res = oBinary_pPrReader.Read(length, &oTempWriter); - odocStyle->ParaPr = oTempWriter.GetData(); + + res = oBinary_pPrReader.Read(length, &pPPr); + odocStyle->ParaPr = pPPr.toXML(); } - else if(c_oSer_sts::Style_TablePr == type) + else if (c_oSer_sts::Style_TablePr == type) { CWiterTblPr oWiterTblPr; READ1_DEF(length, res, oBinary_tblPrReader.Read_tblPr, &oWiterTblPr); odocStyle->TablePr = oWiterTblPr.Write(); } - else if(c_oSer_sts::Style_RowPr == type) + else if (c_oSer_sts::Style_RowPr == type) { NSStringUtils::CStringBuilder oTempWriter; READ2_DEF(length, res, oBinary_tblPrReader.Read_RowPr, &oTempWriter); std::wstring sRowPr = oTempWriter.GetData(); odocStyle->RowPr = sRowPr; } - else if(c_oSer_sts::Style_CellPr == type) + else if (c_oSer_sts::Style_CellPr == type) { NSStringUtils::CStringBuilder oTempWriter; READ2_DEF(length, res, oBinary_tblPrReader.Read_CellPr, &oTempWriter); std::wstring sCellPr = oTempWriter.GetData(); odocStyle->CellPr = sCellPr; } - else if(c_oSer_sts::Style_TblStylePr == type) + else if (c_oSer_sts::Style_TblStylePr == type) { READ1_DEF(length, res, this->ReadTblStylePr, odocStyle); } - else if(c_oSer_sts::Style_CustomStyle == type) + else if (c_oSer_sts::Style_CustomStyle == type) { odocStyle->bCustom = true; odocStyle->Custom = m_oBufferedStream.GetBool(); } - else if(c_oSer_sts::Style_Aliases == type) + else if (c_oSer_sts::Style_Aliases == type) { odocStyle->Aliases = m_oBufferedStream.GetString3(length); } - else if(c_oSer_sts::Style_AutoRedefine == type) + else if (c_oSer_sts::Style_AutoRedefine == type) { odocStyle->bautoRedefine = true; odocStyle->autoRedefine = m_oBufferedStream.GetBool(); } - else if(c_oSer_sts::Style_Locked == type) + else if (c_oSer_sts::Style_Locked == type) { odocStyle->blocked = true; odocStyle->locked = m_oBufferedStream.GetBool(); } - else if(c_oSer_sts::Style_Personal == type) + else if (c_oSer_sts::Style_Personal == type) { odocStyle->bpersonal = true; odocStyle->personal = m_oBufferedStream.GetBool(); } - else if(c_oSer_sts::Style_PersonalCompose == type) + else if (c_oSer_sts::Style_PersonalCompose == type) { odocStyle->bpersonalCompose = true; odocStyle->personalCompose = m_oBufferedStream.GetBool(); } - else if(c_oSer_sts::Style_PersonalReply == type) + else if (c_oSer_sts::Style_PersonalReply == type) { odocStyle->bpersonalReply = true; odocStyle->personalReply = m_oBufferedStream.GetBool(); @@ -3429,11 +3336,11 @@ int BinaryStyleTableReader::ReadTblStylePr(BYTE type, long length, void* poResul { int res = c_oSerConstants::ReadOk; docStyle* odocStyle = static_cast(poResult); - if(c_oSerProp_tblStylePrType::TblStylePr == type) + if (c_oSerProp_tblStylePrType::TblStylePr == type) { tblStylePr otblStylePr; READ1_DEF(length, res, this->ReadTblStyleProperty, &otblStylePr); - if(otblStylePr.bType && otblStylePr.Writer.GetCurSize() > 0) + if (otblStylePr.bType && otblStylePr.Writer.GetCurSize() > 0) { NSStringUtils::CStringBuilder oCStringWriter; switch(otblStylePr.Type) @@ -3465,58 +3372,57 @@ int BinaryStyleTableReader::ReadTblStyleProperty(BYTE type, long length, void* p { int res = c_oSerConstants::ReadOk; tblStylePr* ptblStylePr = static_cast(poResult); - if(c_oSerProp_tblStylePrType::Type == type) + if (c_oSerProp_tblStylePrType::Type == type) { ptblStylePr->bType = true; ptblStylePr->Type = m_oBufferedStream.GetUChar(); } - else if(c_oSerProp_tblStylePrType::RunPr == type) + else if (c_oSerProp_tblStylePrType::RunPr == type) { OOX::Logic::CRunProperty newRPr; res = oBinary_rPrReader.Read(length, &newRPr); - if(newRPr.IsNoEmpty()) + if (newRPr.IsNoEmpty()) { ptblStylePr->Writer.WriteString(newRPr.toXML()); } } - else if(c_oSerProp_tblStylePrType::ParPr == type) + else if (c_oSerProp_tblStylePrType::ParPr == type) { - NSStringUtils::CStringBuilder oTempWriter; - res = oBinary_pPrReader.Read(length, &oTempWriter); - if(oTempWriter.GetCurSize() > 0) + OOX::Logic::CParagraphProperty paraPr; + res = oBinary_pPrReader.Read(length, ¶Pr); + + if (paraPr.IsNoEmpty()) { - ptblStylePr->Writer.WriteString(std::wstring(_T(""))); - ptblStylePr->Writer.Write(oTempWriter); - ptblStylePr->Writer.WriteString(std::wstring(_T(""))); + ptblStylePr->Writer.WriteString(paraPr.toXML()); } } - else if(c_oSerProp_tblStylePrType::TblPr == type) + else if (c_oSerProp_tblStylePrType::TblPr == type) { CWiterTblPr oWiterTblPr; READ1_DEF(length, res, oBinary_tblPrReader.Read_tblPr, &oWiterTblPr); - if(false == oWiterTblPr.IsEmpty()) + if (false == oWiterTblPr.IsEmpty()) ptblStylePr->Writer.WriteString(oWiterTblPr.Write()); } - else if(c_oSerProp_tblStylePrType::TrPr == type) + else if (c_oSerProp_tblStylePrType::TrPr == type) { NSStringUtils::CStringBuilder oTempWriter; READ2_DEF(length, res, oBinary_tblPrReader.Read_RowPr, &oTempWriter); - if(oTempWriter.GetCurSize() > 0) + if (oTempWriter.GetCurSize() > 0) { ptblStylePr->Writer.WriteString(std::wstring(_T(""))); ptblStylePr->Writer.Write(oTempWriter); ptblStylePr->Writer.WriteString(std::wstring(_T(""))); } } - else if(c_oSerProp_tblStylePrType::TcPr == type) + else if (c_oSerProp_tblStylePrType::TcPr == type) { NSStringUtils::CStringBuilder oTempWriter; READ2_DEF(length, res, oBinary_tblPrReader.Read_CellPr, &oTempWriter); - if(oTempWriter.GetCurSize() > 0) + if (oTempWriter.GetCurSize() > 0) { ptblStylePr->Writer.WriteString(std::wstring(_T(""))); ptblStylePr->Writer.Write(oTempWriter); @@ -3548,7 +3454,7 @@ int Binary_OtherTableReader::ReadOtherContent(BYTE type, long length, void* poRe // READ1_DEF(length, res, this->ReadImageMapContent, NULL); //} //else - if(c_oSerOtherTableTypes::DocxTheme == type) + if (c_oSerOtherTableTypes::DocxTheme == type) { smart_ptr pTheme = new PPTX::Theme(NULL); try @@ -3680,7 +3586,7 @@ int Binary_CommentsTableReader::ReadComments(BYTE type, long length, void* poRes READ1_DEF(length, res, this->ReadCommentContent, pComment); - if(pComment->bIdOpen && NULL == m_oComments.get(pComment->IdOpen)) + if (pComment->bIdOpen && NULL == m_oComments.get(pComment->IdOpen)) m_oComments.add(pComment); else RELEASEOBJECT(pComment); @@ -3884,76 +3790,76 @@ int Binary_SettingsTableReader::ReadSettings(BYTE type, long length, void* poRes pSettings->m_oTrackRevisions.Init(); pSettings->m_oTrackRevisions->m_oVal.FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSer_SettingsType::FootnotePr == type ) + else if ( c_oSer_SettingsType::FootnotePr == type ) { pSettings->m_oFootnotePr.Init(); READ1_DEF(length, res, this->ReadFootnotePr, pSettings->m_oFootnotePr.GetPointer()); } - else if( c_oSer_SettingsType::EndnotePr == type ) + else if ( c_oSer_SettingsType::EndnotePr == type ) { pSettings->m_oEndnotePr.Init(); READ1_DEF(length, res, this->ReadEndnotePr, pSettings->m_oEndnotePr.GetPointer()); } - else if( c_oSer_SettingsType::DecimalSymbol == type ) + else if ( c_oSer_SettingsType::DecimalSymbol == type ) { pSettings->m_oDecimalSymbol.Init(); pSettings->m_oDecimalSymbol->m_sVal = m_oBufferedStream.GetString3(length); } - else if( c_oSer_SettingsType::ListSeparator == type ) + else if ( c_oSer_SettingsType::ListSeparator == type ) { pSettings->m_oListSeparator.Init(); pSettings->m_oListSeparator->m_sVal = m_oBufferedStream.GetString3(length); } - else if( c_oSer_SettingsType::GutterAtTop == type ) + else if ( c_oSer_SettingsType::GutterAtTop == type ) { pSettings->m_oGutterAtTop.Init(); pSettings->m_oGutterAtTop->m_oVal.FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSer_SettingsType::MirrorMargins == type ) + else if ( c_oSer_SettingsType::MirrorMargins == type ) { pSettings->m_oMirrorMargins.Init(); pSettings->m_oMirrorMargins->m_oVal.FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSer_SettingsType::PrintTwoOnOne == type ) + else if ( c_oSer_SettingsType::PrintTwoOnOne == type ) { pSettings->m_oPrintTwoOnOne.Init(); pSettings->m_oPrintTwoOnOne->m_oVal.FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSer_SettingsType::BookFoldPrinting == type ) + else if ( c_oSer_SettingsType::BookFoldPrinting == type ) { pSettings->m_oBookFoldPrinting.Init(); pSettings->m_oBookFoldPrinting->m_oVal.FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSer_SettingsType::BookFoldPrintingSheets == type ) + else if ( c_oSer_SettingsType::BookFoldPrintingSheets == type ) { pSettings->m_oBookFoldPrintingSheets.Init(); pSettings->m_oBookFoldPrintingSheets->m_oVal = m_oBufferedStream.GetLong(); } - else if( c_oSer_SettingsType::BookFoldRevPrinting == type ) + else if ( c_oSer_SettingsType::BookFoldRevPrinting == type ) { pSettings->m_oBookFoldRevPrinting.Init(); pSettings->m_oBookFoldRevPrinting->m_oVal.FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSer_SettingsType::SdtGlobalColor == type ) + else if ( c_oSer_SettingsType::SdtGlobalColor == type ) { OOX::Logic::CRunProperty oRPr; res = m_oBinary_rPrReader.Read(length, &oRPr); m_pSettingsCustom->m_oSdtGlobalColor = oRPr.m_oColor; } - else if( c_oSer_SettingsType::SdtGlobalShowHighlight == type ) + else if ( c_oSer_SettingsType::SdtGlobalShowHighlight == type ) { m_pSettingsCustom->m_oSdtGlobalShowHighlight.Init(); m_pSettingsCustom->m_oSdtGlobalShowHighlight->m_oVal.FromBool(m_oBufferedStream.GetBool()); } - else if( c_oSer_SettingsType::SpecialFormsHighlight == type ) + else if ( c_oSer_SettingsType::SpecialFormsHighlight == type ) { OOX::Logic::CRunProperty oRPr; res = m_oBinary_rPrReader.Read(length, &oRPr); m_pSettingsCustom->m_oSpecialFormsHighlight = oRPr.m_oColor; } - else if( c_oSer_SettingsType::Compat == type ) + else if ( c_oSer_SettingsType::Compat == type ) { pSettings->m_oCompat.Init(); READ1_DEF(length, res, this->ReadCompat, pSettings->m_oCompat.GetPointer()); @@ -3976,13 +3882,13 @@ int Binary_SettingsTableReader::ReadCompat(BYTE type, long length, void* poResul { OOX::Settings::CCompat* pCompat = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerCompat::CompatSetting == type ) + if ( c_oSerCompat::CompatSetting == type ) { OOX::Settings::CCompatSetting* pCCompatSetting = new OOX::Settings::CCompatSetting(); READ1_DEF(length, res, this->ReadCompatSetting, pCCompatSetting); pCompat->m_arrCompatSettings.push_back(pCCompatSetting); } - else if( c_oSerCompat::Flags1 == type ) + else if ( c_oSerCompat::Flags1 == type ) { _UINT32 nFlags = m_oBufferedStream.GetULong(); UINT_TO_COMPLEX_BOOL(0, pCompat->m_oUseSingleBorderforContiguousCells); @@ -4018,7 +3924,7 @@ int Binary_SettingsTableReader::ReadCompat(BYTE type, long length, void* poResul UINT_TO_COMPLEX_BOOL(30, pCompat->m_oFootnoteLayoutLikeWW8); UINT_TO_COMPLEX_BOOL(31, pCompat->m_oShapeLayoutLikeWW8); } - else if( c_oSerCompat::Flags2 == type ) + else if ( c_oSerCompat::Flags2 == type ) { _UINT32 nFlags = m_oBufferedStream.GetULong(); UINT_TO_COMPLEX_BOOL(0, pCompat->m_oAlignTablesRowByRow); @@ -4054,7 +3960,7 @@ int Binary_SettingsTableReader::ReadCompat(BYTE type, long length, void* poResul UINT_TO_COMPLEX_BOOL(30, pCompat->m_oDoNotVertAlignInTxbx); UINT_TO_COMPLEX_BOOL(31, pCompat->m_oUseAnsiKerningPairs); } - else if( c_oSerCompat::Flags3 == type ) + else if ( c_oSerCompat::Flags3 == type ) { _UINT32 nFlags = m_oBufferedStream.GetULong(); UINT_TO_COMPLEX_BOOL(0, pCompat->m_oCachedColBalance); @@ -4067,15 +3973,15 @@ int Binary_SettingsTableReader::ReadCompatSetting(BYTE type, long length, void* { OOX::Settings::CCompatSetting* pCompatSetting = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerCompat::CompatName == type ) + if ( c_oSerCompat::CompatName == type ) { pCompatSetting->m_sName = m_oBufferedStream.GetString3(length); } - else if( c_oSerCompat::CompatUri == type ) + else if ( c_oSerCompat::CompatUri == type ) { pCompatSetting->m_sUri = m_oBufferedStream.GetString3(length); } - else if( c_oSerCompat::CompatValue == type ) + else if ( c_oSerCompat::CompatValue == type ) { pCompatSetting->m_sVal = m_oBufferedStream.GetString3(length); } @@ -4236,29 +4142,29 @@ int Binary_SettingsTableReader::ReadFootnotePr(BYTE type, long length, void* poR { OOX::Settings::CFtnDocProps* pFtnProps = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerNotes::PrFmt == type ) + if ( c_oSerNotes::PrFmt == type ) { pFtnProps->m_oNumFmt.Init(); READ1_DEF(length, res, m_oBinary_pPrReader.ReadNumFmt, pFtnProps->m_oNumFmt.GetPointer()); } - else if( c_oSerNotes::PrRestart == type ) + else if ( c_oSerNotes::PrRestart == type ) { pFtnProps->m_oNumRestart.Init(); pFtnProps->m_oNumRestart->m_oVal.Init(); pFtnProps->m_oNumRestart->m_oVal->SetValue((SimpleTypes::ERestartNumber)m_oBufferedStream.GetUChar()); } - else if( c_oSerNotes::PrStart == type ) + else if ( c_oSerNotes::PrStart == type ) { pFtnProps->m_oNumStart.Init(); pFtnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong(); } - else if( c_oSerNotes::PrFntPos == type ) + else if ( c_oSerNotes::PrFntPos == type ) { pFtnProps->m_oPos.Init(); pFtnProps->m_oPos->m_oVal.Init(); pFtnProps->m_oPos->m_oVal->SetValue((SimpleTypes::EFtnPos)m_oBufferedStream.GetUChar()); } - else if( c_oSerNotes::PrRef == type ) + else if ( c_oSerNotes::PrRef == type ) { OOX::CFtnEdnSepRef* pRef = new OOX::CFtnEdnSepRef(); pRef->m_eType = OOX::et_w_footnote; @@ -4274,29 +4180,29 @@ int Binary_SettingsTableReader::ReadEndnotePr(BYTE type, long length, void* poRe { OOX::Settings::CEdnDocProps* pEdnProps = static_cast(poResult); int res = c_oSerConstants::ReadOk; - if( c_oSerNotes::PrFmt == type ) + if ( c_oSerNotes::PrFmt == type ) { pEdnProps->m_oNumFmt.Init(); READ1_DEF(length, res, m_oBinary_pPrReader.ReadNumFmt, pEdnProps->m_oNumFmt.GetPointer()); } - else if( c_oSerNotes::PrRestart == type ) + else if ( c_oSerNotes::PrRestart == type ) { pEdnProps->m_oNumRestart.Init(); pEdnProps->m_oNumRestart->m_oVal.Init(); pEdnProps->m_oNumRestart->m_oVal->SetValue((SimpleTypes::ERestartNumber)m_oBufferedStream.GetUChar()); } - else if( c_oSerNotes::PrStart == type ) + else if ( c_oSerNotes::PrStart == type ) { pEdnProps->m_oNumStart.Init(); pEdnProps->m_oNumStart->m_oVal = m_oBufferedStream.GetLong(); } - else if( c_oSerNotes::PrEndPos == type ) + else if ( c_oSerNotes::PrEndPos == type ) { pEdnProps->m_oPos.Init(); pEdnProps->m_oPos->m_oVal.Init(); pEdnProps->m_oPos->m_oVal->SetValue((SimpleTypes::EEdnPos)m_oBufferedStream.GetUChar()); } - else if( c_oSerNotes::PrRef == type ) + else if ( c_oSerNotes::PrRef == type ) { OOX::CFtnEdnSepRef* pRef = new OOX::CFtnEdnSepRef(); pRef->m_eType = OOX::et_w_endnote; @@ -4696,7 +4602,7 @@ int Binary_DocumentTableReader::Read() } NSStringUtils::CStringBuilder& Binary_DocumentTableReader::GetRunStringWriter() { - if(NULL != m_pCurWriter) + if (NULL != m_pCurWriter) return *m_pCurWriter; else return m_oDocumentWriter.m_oContent; @@ -4713,7 +4619,7 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void if ( c_oSerParType::Par == type ) { m_byteLastElemType = c_oSerParType::Par; - m_oCur_pPr.ClearNoAttack(); + m_oCur_pPr.Clear(); if (m_bUsedParaIdCounter && m_oFileWriter.m_pComments) { @@ -4755,26 +4661,24 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void GetRunStringWriter().WriteString(pComment->writeRef(std::wstring(_T("")), std::wstring(_T("w:commentRangeEnd")), std::wstring(_T("")))); } } - else if(c_oSerParType::Table == type) + else if (c_oSerParType::Table == type) { m_byteLastElemType = c_oSerParType::Table; m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T(""))); READ1_DEF(length, res, this->ReadDocTable, &m_oDocumentWriter.m_oContent); m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T(""))); } - else if(c_oSerParType::Sdt == type) + else if (c_oSerParType::Sdt == type) { SdtWraper oSdt(0); READ1_DEF(length, res, this->ReadSdt, &oSdt); } else if ( c_oSerParType::sectPr == type ) { - SectPr oSectPr; + OOX::Logic::CSectionProperty oSectPr; READ1_DEF(length, res, this->Read_SecPr, &oSectPr); - m_oDocumentWriter.m_oSecPr.WriteString(oSectPr.Write()); - if (oSectPr.bEvenAndOddHeaders && oSectPr.EvenAndOddHeaders) - m_oFileWriter.m_pCurrentSettings->m_oEvenAndOddHeaders.Init(); + m_oDocumentWriter.m_oSecPr.WriteString(oSectPr.toXML()); } else if ( c_oSerParType::Background == type ) { @@ -4825,7 +4729,7 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void READ1_DEF(length, res, this->ReadDocParts, &oDocParts); m_oDocumentWriter.m_oContent.WriteString(L""); } - else if(c_oSerParType::JsaProject == type) + else if (c_oSerParType::JsaProject == type) { BYTE* pData = m_oBufferedStream.GetPointer(length); OOX::CPath sJsaProject = OOX::FileTypes::JsaProject.DefaultFileName(); @@ -4973,12 +4877,12 @@ int Binary_DocumentTableReader::ReadParagraph(BYTE type, long length, void* poRe int res = c_oSerConstants::ReadOk; if ( c_oSerParType::pPr == type ) { + m_oCur_pPr.Clear(); res = oBinary_pPrReader.Read(length, &m_oCur_pPr); - if(m_oCur_pPr.GetCurSize() > 0) + if (m_oCur_pPr.IsNoEmpty()) { - m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T(""))); - m_oDocumentWriter.m_oContent.Write(m_oCur_pPr); - m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T(""))); + std::wstring sParaPr = m_oCur_pPr.toXML(); + m_oDocumentWriter.m_oContent.WriteString(sParaPr); } } else if ( c_oSerParType::Content == type ) @@ -5003,10 +4907,10 @@ int Binary_DocumentTableReader::ReadParagraphContent(BYTE type, long length, voi { long nId = 0; READ1_DEF(length, res, this->ReadComment, &nId); - if(NULL != m_oFileWriter.m_pComments) + if (NULL != m_oFileWriter.m_pComments) { CComment* pComment = m_oFileWriter.m_pComments->get(nId); - if(NULL != pComment) + if (NULL != pComment) { int nNewId = m_oFileWriter.m_pComments->getNextId(pComment->getCount()); pComment->setFormatStart(nNewId); @@ -5018,10 +4922,10 @@ int Binary_DocumentTableReader::ReadParagraphContent(BYTE type, long length, voi { long nId = 0; READ1_DEF(length, res, this->ReadComment, &nId); - if(NULL != m_oFileWriter.m_pComments) + if (NULL != m_oFileWriter.m_pComments) { CComment* pComment = m_oFileWriter.m_pComments->get(nId); - if(NULL != pComment && pComment->bIdFormat) + if (NULL != pComment && pComment->bIdFormat) GetRunStringWriter().WriteString(pComment->writeRef(std::wstring(_T("")), std::wstring(_T("w:commentRangeEnd")), std::wstring(_T("")))); } } @@ -5103,7 +5007,7 @@ int Binary_DocumentTableReader::ReadParagraphContent(BYTE type, long length, voi READ1_DEF(length, res, this->ReadMoveToRangeEnd, &oMoveToRangeEnd); GetRunStringWriter().WriteString(oMoveToRangeEnd.toXML()); } - else if(c_oSerParType::Sdt == type) + else if (c_oSerParType::Sdt == type) { SdtWraper oSdt(1); READ1_DEF(length, res, this->ReadSdt, &oSdt); @@ -6319,7 +6223,7 @@ int Binary_DocumentTableReader::ReadMathCtrlPr(BYTE type, long length, void* poR m_oMath_rPr.Clear(); res = oBinary_rPrReader.Read(length, &m_oMath_rPr); - if(m_oMath_rPr.IsNoEmpty()) + if (m_oMath_rPr.IsNoEmpty()) GetRunStringWriter().WriteString(m_oMath_rPr.toXML()); } else if ( c_oSerRunType::arPr == type ) @@ -7387,7 +7291,7 @@ int Binary_DocumentTableReader::ReadMathInsDel(BYTE type, long length, void* poR int res = c_oSerConstants::ReadOk; TrackRevision* pTrackRevision = static_cast(poResult); READ1_TRACKREV(type, length, pTrackRevision) - else if(c_oSerProp_RevisionType::ContentRun == type) + else if (c_oSerProp_RevisionType::ContentRun == type) { pTrackRevision->contentRun = new NSStringUtils::CStringBuilder(); NSStringUtils::CStringBuilder* pPrevWriter = m_pCurWriter; @@ -8044,10 +7948,10 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR if (m_oCur_rPr.IsNoEmpty()) GetRunStringWriter().WriteString(m_oCur_rPr.toXML()); GetRunStringWriter().WriteString(std::wstring(_T("PAGE \\* MERGEFORMAT"))); - if(m_oCur_rPr.IsNoEmpty()) + if (m_oCur_rPr.IsNoEmpty()) GetRunStringWriter().WriteString(m_oCur_rPr.toXML()); GetRunStringWriter().WriteString(std::wstring(_T(""))); - if(m_oCur_rPr.IsNoEmpty()) + if (m_oCur_rPr.IsNoEmpty()) GetRunStringWriter().WriteString(m_oCur_rPr.toXML()); GetRunStringWriter().WriteString(std::wstring(_T(""))); } @@ -8075,11 +7979,11 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR { GetRunStringWriter().WriteString(std::wstring(_T(""))); } - else if(c_oSerRunType::image == type) + else if (c_oSerRunType::image == type) { docImg odocImg(m_oFileWriter.getNextDocPr()); READ2_DEF(length, res, this->ReadImage, &odocImg); - if(odocImg.MediaId >= 0 && odocImg.MediaId < m_oMediaWriter.nImageCount) + if (odocImg.MediaId >= 0 && odocImg.MediaId < m_oMediaWriter.nImageCount) { std::wstring sNewImgName = m_oMediaWriter.m_aImageNames[odocImg.MediaId]; std::wstring sNewImgRel = _T("media/") + sNewImgName; @@ -8090,32 +7994,32 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR odocImg.srId = L"rId" + std::to_wstring(rId); //odocImg.srId = m_oMediaWriter.m_poDocumentRelsWriter->AddRels(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"), sNewImgRel, false); //odocImg.srId = m_oMediaWriter.m_aImageRels[odocImg.MediaId]; - if(!odocImg.srId.empty()) + if (!odocImg.srId.empty()) { odocImg.Write(&GetRunStringWriter()); } } } - else if(c_oSerRunType::pptxDrawing == type) + else if (c_oSerRunType::pptxDrawing == type) { CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr()); READ2_DEF(length, res, this->ReadPptxDrawing, &oCDrawingProperty); - if(oCDrawingProperty.IsGraphicFrameContent()) + if (oCDrawingProperty.IsGraphicFrameContent()) { GetRunStringWriter().WriteString(oCDrawingProperty.Write()); } - else if(oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength) + else if (oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength) { std::wstring sDrawingProperty = oCDrawingProperty.Write(); - if(false == sDrawingProperty.empty()) + if (false == sDrawingProperty.empty()) { ReadDrawing(oCDrawingProperty); } } } - else if(c_oSerRunType::table == type) + else if (c_oSerRunType::table == type) { //todo m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"")); @@ -8134,28 +8038,28 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR { m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"")); } - if(m_oCur_pPr.GetCurSize() > 0) + if (m_oCur_pPr.IsNoEmpty()) { - m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"")); - m_oDocumentWriter.m_oContent.Write(m_oCur_pPr); - m_oDocumentWriter.m_oContent.WriteString(std::wstring(L"")); + std::wstring sParaPr = m_oCur_pPr.toXML(); + + m_oDocumentWriter.m_oContent.WriteString(sParaPr); } } - else if(c_oSerRunType::fldstart_deprecated == type) + else if (c_oSerRunType::fldstart_deprecated == type) { std::wstring sField(m_oBufferedStream.GetString3(length)); sField = XmlUtils::EncodeXmlString(sField); GetRunStringWriter().WriteString(std::wstring(_T(""))); - if(m_oCur_rPr.IsNoEmpty()) + if (m_oCur_rPr.IsNoEmpty()) GetRunStringWriter().WriteString(m_oCur_rPr.toXML()); GetRunStringWriter().WriteString(std::wstring(_T(""))); GetRunStringWriter().WriteString(sField); GetRunStringWriter().WriteString(std::wstring(_T(""))); - if(m_oCur_rPr.IsNoEmpty()) + if (m_oCur_rPr.IsNoEmpty()) GetRunStringWriter().WriteString(m_oCur_rPr.toXML()); GetRunStringWriter().WriteString(std::wstring(_T(""))); } - else if(c_oSerRunType::fldend_deprecated == type) + else if (c_oSerRunType::fldend_deprecated == type) { GetRunStringWriter().WriteString(std::wstring(_T(""))); } @@ -8163,10 +8067,10 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR { long nId = 0; READ1_DEF(length, res, this->ReadComment, &nId); - if(NULL != m_oFileWriter.m_pComments) + if (NULL != m_oFileWriter.m_pComments) { CComment* pComment = m_oFileWriter.m_pComments->get(nId); - if(NULL != pComment) // могут быть и без start/end + if (NULL != pComment) // могут быть и без start/end { GetRunStringWriter().WriteString(pComment->writeRef(std::wstring(_T("")), std::wstring(_T("w:commentReference")), std::wstring(_T("")))); } @@ -8269,7 +8173,7 @@ int Binary_DocumentTableReader::ReadEndnoteRef(BYTE type, long length, void* poR void Binary_DocumentTableReader::ReadDrawing(CDrawingProperty &oCDrawingProperty) { std::wstring sDrawingProperty = oCDrawingProperty.Write(); - if(false == sDrawingProperty.empty()) + if (false == sDrawingProperty.empty()) { long nCurPos = m_oBufferedStream.GetPos(); std::wstring sDrawingXml; @@ -8279,7 +8183,7 @@ void Binary_DocumentTableReader::ReadDrawing(CDrawingProperty &oCDrawingProperty m_oFileWriter.m_pDrawingConverter->SaveObjectEx(oCDrawingProperty.DataPos, oCDrawingProperty.DataLength, sDrawingProperty, nDocType, sDrawingXml); m_oBufferedStream.Seek(nCurPos); - if( false == sDrawingXml.empty()) + if ( false == sDrawingXml.empty()) { GetRunStringWriter().WriteString(sDrawingXml); } @@ -8290,17 +8194,17 @@ int Binary_DocumentTableReader::ReadObject(BYTE type, long length, void* poResul CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr()); int res = c_oSerConstants::ReadOk; - if( c_oSerParType::OMath == type ) + if ( c_oSerParType::OMath == type ) { GetRunStringWriter().WriteString(std::wstring(_T(""))); READ1_DEF(length, res, this->ReadMathArg, poResult); GetRunStringWriter().WriteString(std::wstring(_T(""))); } - else if(c_oSerRunType::pptxDrawing == type) + else if (c_oSerRunType::pptxDrawing == type) { READ2_DEF(length, res, this->ReadPptxDrawing, &oCDrawingProperty); - if(oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength) + if (oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength) { ReadDrawing(oCDrawingProperty); } @@ -8323,20 +8227,20 @@ int Binary_DocumentTableReader::ReadDocTable(BYTE type, long length, void* poRes { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerDocTableType::tblPr == type ) + if ( c_oSerDocTableType::tblPr == type ) { CWiterTblPr oWiterTblPr; READ1_DEF(length, res, oBinary_tblPrReader.Read_tblPr, &oWiterTblPr); pCStringWriter->WriteString(oWiterTblPr.Write()); } - else if( c_oSerDocTableType::tblGrid == type ) + else if ( c_oSerDocTableType::tblGrid == type ) { oBinary_tblPrReader.m_aCurTblGrid.clear(); pCStringWriter->WriteString(std::wstring(_T(""))); READ2_DEF(length, res, this->Read_tblGrid, poResult); pCStringWriter->WriteString(std::wstring(_T(""))); } - else if( c_oSerDocTableType::Content == type ) + else if ( c_oSerDocTableType::Content == type ) { READ1_DEF(length, res, this->Read_TableContent, poResult); } @@ -8348,7 +8252,7 @@ int Binary_DocumentTableReader::Read_tblGrid(BYTE type, long length, void* poRes { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerDocTableType::tblGrid_Item == type ) + if ( c_oSerDocTableType::tblGrid_Item == type ) { double dgridCol = m_oBufferedStream.GetDouble(); oBinary_tblPrReader.m_aCurTblGrid.push_back(dgridCol); @@ -8356,7 +8260,7 @@ int Binary_DocumentTableReader::Read_tblGrid(BYTE type, long length, void* poRes pCStringWriter->WriteString(L""); } - else if( c_oSerDocTableType::tblGrid_ItemTwips == type ) + else if ( c_oSerDocTableType::tblGrid_ItemTwips == type ) { int ngridCol = m_oBufferedStream.GetLong(); @@ -8365,7 +8269,7 @@ int Binary_DocumentTableReader::Read_tblGrid(BYTE type, long length, void* poRes else pCStringWriter->WriteString(L""); } - else if( c_oSerDocTableType::tblGridChange == type ) + else if ( c_oSerDocTableType::tblGridChange == type ) { TrackRevision oTrackRevision; READ1_DEF(length, res, this->Read_tblGridChange, &oTrackRevision); @@ -8379,11 +8283,11 @@ int Binary_DocumentTableReader::Read_tblGridChange(BYTE type, long length, void* { int res = c_oSerConstants::ReadOk; TrackRevision* pTrackRevision = static_cast(poResult); - if(c_oSerProp_RevisionType::Id == type) + if (c_oSerProp_RevisionType::Id == type) { pTrackRevision->Id = new _INT32(m_oBufferedStream.GetLong()); } - else if(c_oSerProp_RevisionType::tblGridChange == type) + else if (c_oSerProp_RevisionType::tblGridChange == type) { oBinary_tblPrReader.m_aCurTblGrid.clear(); pTrackRevision->tblGridChange = new NSStringUtils::CStringBuilder(); @@ -8397,13 +8301,13 @@ int Binary_DocumentTableReader::Read_TableContent(BYTE type, long length, void* { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerDocTableType::Row == type ) + if ( c_oSerDocTableType::Row == type ) { pCStringWriter->WriteString(std::wstring(_T(""))); READ1_DEF(length, res, this->Read_Row, poResult); pCStringWriter->WriteString(std::wstring(_T(""))); } - else if(c_oSerDocTableType::Sdt == type) + else if (c_oSerDocTableType::Sdt == type) { SdtWraper oSdt(2); READ1_DEF(length, res, this->ReadSdt, &oSdt); @@ -8452,13 +8356,13 @@ int Binary_DocumentTableReader::Read_Row(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerDocTableType::Row_Pr == type ) + if ( c_oSerDocTableType::Row_Pr == type ) { pCStringWriter->WriteString(std::wstring(_T(""))); READ2_DEF(length, res, oBinary_tblPrReader.Read_RowPr, pCStringWriter); pCStringWriter->WriteString(std::wstring(_T(""))); } - else if( c_oSerDocTableType::Row_Content == type ) + else if ( c_oSerDocTableType::Row_Content == type ) { READ1_DEF(length, res, this->ReadRowContent, poResult); } @@ -8470,13 +8374,13 @@ int Binary_DocumentTableReader::ReadRowContent(BYTE type, long length, void* poR { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerDocTableType::Cell == type ) + if ( c_oSerDocTableType::Cell == type ) { pCStringWriter->WriteString(std::wstring(_T(""))); READ1_DEF(length, res, this->ReadCell, poResult); pCStringWriter->WriteString(std::wstring(_T(""))); } - else if(c_oSerDocTableType::Sdt == type) + else if (c_oSerDocTableType::Sdt == type) { SdtWraper oSdt(3); READ1_DEF(length, res, this->ReadSdt, &oSdt); @@ -8525,18 +8429,18 @@ int Binary_DocumentTableReader::ReadCell(BYTE type, long length, void* poResult) { int res = c_oSerConstants::ReadOk; NSStringUtils::CStringBuilder* pCStringWriter = static_cast(poResult); - if( c_oSerDocTableType::Cell_Pr == type ) + if ( c_oSerDocTableType::Cell_Pr == type ) { pCStringWriter->WriteString(std::wstring(_T(""))); READ2_DEF(length, res, oBinary_tblPrReader.Read_CellPr, pCStringWriter); pCStringWriter->WriteString(std::wstring(_T(""))); } - else if( c_oSerDocTableType::Cell_Content == type ) + else if ( c_oSerDocTableType::Cell_Content == type ) { Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oDocumentWriter, m_bOFormRead); READ1_DEF(length, res, this->ReadCellContent, &oBinary_DocumentTableReader); //Потому что если перед не идет

, то документ считается невалидным - if(c_oSerParType::Par != oBinary_DocumentTableReader.m_byteLastElemType) + if (c_oSerParType::Par != oBinary_DocumentTableReader.m_byteLastElemType) { m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T(""))); } @@ -8600,17 +8504,17 @@ int Binary_DocumentTableReader::Read_Background(BYTE type, long length, void* po int res = c_oSerConstants::ReadOk; Background* pBackground = static_cast(poResult); - if( c_oSerBackgroundType::Color == type ) + if ( c_oSerBackgroundType::Color == type ) { pBackground->bColor = true; pBackground->Color = oBinary_CommonReader2.ReadColor(); } - else if( c_oSerBackgroundType::ColorTheme == type ) + else if ( c_oSerBackgroundType::ColorTheme == type ) { pBackground->bThemeColor = true; oBinary_CommonReader2.ReadThemeColor(length, pBackground->ThemeColor); } - else if( c_oSerBackgroundType::pptxDrawing == type ) + else if ( c_oSerBackgroundType::pptxDrawing == type ) { CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr()); READ2_DEF(length, res, this->ReadPptxDrawing, &oCDrawingProperty); @@ -9478,28 +9382,28 @@ int Binary_DocumentTableReader::ReadSdtCheckBox(BYTE type, long length, void* po } else if (c_oSerSdt::CheckboxCheckedFont == type) { - if(!pSdtCheckBox->m_oCheckedState.IsInit()) + if (!pSdtCheckBox->m_oCheckedState.IsInit()) pSdtCheckBox->m_oCheckedState.Init(); pSdtCheckBox->m_oCheckedState->m_oFont.Init(); pSdtCheckBox->m_oCheckedState->m_oFont->append(m_oBufferedStream.GetString3(length)); } else if (c_oSerSdt::CheckboxCheckedVal == type) { - if(!pSdtCheckBox->m_oCheckedState.IsInit()) + if (!pSdtCheckBox->m_oCheckedState.IsInit()) pSdtCheckBox->m_oCheckedState.Init(); pSdtCheckBox->m_oCheckedState->m_oVal.Init(); pSdtCheckBox->m_oCheckedState->m_oVal->SetValue(m_oBufferedStream.GetLong()); } else if (c_oSerSdt::CheckboxUncheckedFont == type) { - if(!pSdtCheckBox->m_oUncheckedState.IsInit()) + if (!pSdtCheckBox->m_oUncheckedState.IsInit()) pSdtCheckBox->m_oUncheckedState.Init(); pSdtCheckBox->m_oUncheckedState->m_oFont.Init(); pSdtCheckBox->m_oUncheckedState->m_oFont->append(m_oBufferedStream.GetString3(length)); } else if (c_oSerSdt::CheckboxUncheckedVal == type) { - if(!pSdtCheckBox->m_oUncheckedState.IsInit()) + if (!pSdtCheckBox->m_oUncheckedState.IsInit()) pSdtCheckBox->m_oUncheckedState.Init(); pSdtCheckBox->m_oUncheckedState->m_oVal.Init(); pSdtCheckBox->m_oUncheckedState->m_oVal->SetValue(m_oBufferedStream.GetLong()); @@ -9705,7 +9609,7 @@ int Binary_DocumentTableReader::ReadSdtFormPr(BYTE type, long length, void* poRe else if (c_oSerSdt::FormPrBorder == type) { pFormPr->m_oBorder.Init(); - READ2_DEF(length, res, oBinary_pPrReader.ReadBorder2, pFormPr->m_oBorder.GetPointer()); + READ2_DEF(length, res, oBinary_pPrReader.ReadBorder, pFormPr->m_oBorder.GetPointer()); } else if (c_oSerSdt::FormPrShd == type) { @@ -9750,7 +9654,7 @@ int Binary_DocumentTableReader::ReadSdtTextFormPr(BYTE type, long length, void* else if (c_oSerSdt::TextFormPrCombBorder == type) { pTextFormPr->m_oCombBorder.Init(); - READ2_DEF(length, res, oBinary_pPrReader.ReadBorder2, pTextFormPr->m_oCombBorder.GetPointer()); + READ2_DEF(length, res, oBinary_pPrReader.ReadBorder, pTextFormPr->m_oCombBorder.GetPointer()); } else if (c_oSerSdt::TextFormPrAutoFit == type) { @@ -9808,6 +9712,7 @@ int Binary_DocumentTableReader::ReadSdtTextFormPrComb(BYTE type, long length, vo { int res = 0; ComplexTypes::Word::CComb* pComb = static_cast(poResult); + if (c_oSerSdt::TextFormPrCombWidth == type) { pComb->m_oWidth = m_oBufferedStream.GetLong(); @@ -9843,7 +9748,7 @@ int Binary_NotesTableReader::Read() std::wstring sFilename; Writers::ContentWriter* pContentWriter = NULL; - if(m_bIsFootnote) + if (m_bIsFootnote) { sFilename = m_oFileWriter.get_footnotes_writer().getFilename(); pContentWriter = &m_oFileWriter.get_footnotes_writer().m_oNotesWriter; @@ -9897,7 +9802,7 @@ int Binary_NotesTableReader::ReadNote(BYTE type, long length, void* poResult) else if ( c_oSerNotes::NoteContent == type ) { NSStringUtils::CStringBuilder& writer = pBinary_DocumentTableReader->m_oDocumentWriter.m_oContent; - if(m_bIsFootnote) + if (m_bIsFootnote) { writer.WriteString(L"ToString()); writer.WriteString(L"\""); } - if(m_oId.IsInit()) + if (m_oId.IsInit()) { writer.WriteString(L" w:id=\""); writer.WriteString(m_oId->ToString()); @@ -9919,7 +9824,7 @@ int Binary_NotesTableReader::ReadNote(BYTE type, long length, void* poResult) } writer.WriteString(L">"); READ1_DEF(length, res, this->ReadNoteContent, poResult); - if(m_bIsFootnote) + if (m_bIsFootnote) { writer.WriteString(L""); } @@ -9971,7 +9876,7 @@ int BinaryFileReader::ReadMainTable() res = m_oBufferedStream.Peek(1) == false ? c_oSerConstants::ErrorStream : c_oSerConstants::ReadOk; - if(c_oSerConstants::ReadOk != res) + if (c_oSerConstants::ReadOk != res) return res; long nOtherOffset = -1; @@ -9993,32 +9898,32 @@ int BinaryFileReader::ReadMainTable() { //mtItem res = m_oBufferedStream.Peek(5) == false ? c_oSerConstants::ErrorStream : c_oSerConstants::ReadOk; - if(c_oSerConstants::ReadOk != res) + if (c_oSerConstants::ReadOk != res) return res; BYTE mtiType = m_oBufferedStream.GetUChar(); long mtiOffBits = m_oBufferedStream.GetLong(); - if(c_oSerTableTypes::Other == mtiType) + if (c_oSerTableTypes::Other == mtiType) { nOtherOffset = mtiOffBits; } - else if(c_oSerTableTypes::Style == mtiType) + else if (c_oSerTableTypes::Style == mtiType) { nStyleOffset = mtiOffBits; } - else if(c_oSerTableTypes::Settings == mtiType) + else if (c_oSerTableTypes::Settings == mtiType) { nSettingsOffset = mtiOffBits; } - else if(c_oSerTableTypes::Document == mtiType) + else if (c_oSerTableTypes::Document == mtiType) { nDocumentOffset = mtiOffBits; } - else if(c_oSerTableTypes::Comments == mtiType) + else if (c_oSerTableTypes::Comments == mtiType) { nCommentsOffset = mtiOffBits; } - else if(c_oSerTableTypes::DocumentComments == mtiType) + else if (c_oSerTableTypes::DocumentComments == mtiType) { nDocumentCommentsOffset = mtiOffBits; } @@ -10033,7 +9938,7 @@ int BinaryFileReader::ReadMainTable() int nOldPos = m_oBufferedStream.GetPos(); m_oBufferedStream.Seek(nOtherOffset); res = Binary_OtherTableReader(m_sFileInDir, m_oBufferedStream, m_oFileWriter).Read(); - if(c_oSerConstants::ReadOk != res) + if (c_oSerConstants::ReadOk != res) return res; } if (-1 != nSettingsOffset) @@ -10043,7 +9948,7 @@ int BinaryFileReader::ReadMainTable() int nOldPos = m_oBufferedStream.GetPos(); m_oBufferedStream.Seek(nSettingsOffset); res = Binary_SettingsTableReader(m_oBufferedStream, m_oFileWriter, &oSettingsCustom).Read(); - if(c_oSerConstants::ReadOk != res) + if (c_oSerConstants::ReadOk != res) return res; if (!oSettingsCustom.IsEmpty()) @@ -10066,7 +9971,7 @@ int BinaryFileReader::ReadMainTable() int nOldPos = m_oBufferedStream.GetPos(); m_oBufferedStream.Seek(nStyleOffset); res = oBinaryStyleTableReader.Read(); - if(c_oSerConstants::ReadOk != res) + if (c_oSerConstants::ReadOk != res) return res; } Binary_CommentsTableReader oBinary_CommentsTableReader(m_oBufferedStream, m_oFileWriter); @@ -10076,7 +9981,7 @@ int BinaryFileReader::ReadMainTable() int nOldPos = m_oBufferedStream.GetPos(); m_oBufferedStream.Seek(nCommentsOffset); res = oBinary_CommentsTableReader.Read(); - if(c_oSerConstants::ReadOk != res) + if (c_oSerConstants::ReadOk != res) return res; } Binary_CommentsTableReader oBinary_DocumentCommentsTableReader(m_oBufferedStream, m_oFileWriter); @@ -10085,7 +9990,7 @@ int BinaryFileReader::ReadMainTable() int nOldPos = m_oBufferedStream.GetPos(); m_oBufferedStream.Seek(nDocumentCommentsOffset); res = oBinary_DocumentCommentsTableReader.Read(); - if(c_oSerConstants::ReadOk != res) + if (c_oSerConstants::ReadOk != res) return res; } @@ -10309,7 +10214,7 @@ int BinaryFileReader::ReadMainTable() for (size_t i = 0; i < m_oFileWriter.get_headers_footers_writer().m_aHeaders.size(); ++i) { Writers::HdrFtrItem* pHeader = m_oFileWriter.get_headers_footers_writer().m_aHeaders[i]; - if(false == pHeader->IsEmpty()) + if (false == pHeader->IsEmpty()) { unsigned int rId; m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", pHeader->m_sFilename, std::wstring(), &rId); diff --git a/OOXML/Binary/Document/BinReader/Readers.h b/OOXML/Binary/Document/BinReader/Readers.h index 98f786946f..3e0e3c4fd6 100644 --- a/OOXML/Binary/Document/BinReader/Readers.h +++ b/OOXML/Binary/Document/BinReader/Readers.h @@ -112,15 +112,17 @@ public: Binary_pPrReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter); int Read(long stLen, void* poResult); int ReadContent( BYTE type, long length, void* poResult); + int ReadPPrChange(BYTE type, long length, void* poResult); int ReadInd(BYTE type, long length, void* poResult); int ReadSpacing(BYTE type, long length, void* poResult); int ReadTabs(BYTE type, long length, void* poResult); int ReadTabItem(BYTE type, long length, void* poResult); int ReadNumPr(BYTE type, long length, void* poResult); + int ReadTableCellBorders(BYTE type, long length, void* poResult); + int ReadTableBorders(BYTE type, long length, void* poResult); int ReadBorders(BYTE type, long length, void* poResult); int ReadBorder(BYTE type, long length, void* poResult); - int ReadBorder2(BYTE type, long length, void* poResult); int ReadFramePr(BYTE type, long length, void* poResult); int Read_SecPr(BYTE type, long length, void* poResult); int ReadFootnotePr(BYTE type, long length, void* poResult); @@ -284,10 +286,12 @@ private: Binary_rPrReader oBinary_rPrReader; Binary_tblPrReader oBinary_tblPrReader; NSStringUtils::CStringBuilder* m_pCurWriter; - OOX::Logic::CRunProperty m_oCur_rPr; + + OOX::Logic::CRunProperty m_oCur_rPr; OOX::Logic::CRunProperty m_oMath_rPr; - NSStringUtils::CStringBuilder m_oCur_pPr; - BYTE m_byteLastElemType; + OOX::Logic::CParagraphProperty m_oCur_pPr; + + BYTE m_byteLastElemType; public: Writers::ContentWriter& m_oDocumentWriter; Writers::MediaWriter& m_oMediaWriter; diff --git a/OOXML/Binary/Document/BinWriter/BinWriters.cpp b/OOXML/Binary/Document/BinWriter/BinWriters.cpp index 04bd984cda..e2fb35a3d1 100644 --- a/OOXML/Binary/Document/BinWriter/BinWriters.cpp +++ b/OOXML/Binary/Document/BinWriter/BinWriters.cpp @@ -52,8 +52,9 @@ #include "../../../DocxFormat/App.h" #include "../../../DocxFormat/Core.h" #include "../../../DocxFormat/FontTable.h" - #include "../../../DocxFormat/CustomXml.h" +#include "../../../DocxFormat/Diagram/DiagramData.h" + #include "../../../DocxFormat/Logic/AlternateContent.h" #include "../../../DocxFormat/Logic/Dir.h" #include "../../../DocxFormat/Logic/SmartTag.h" @@ -1257,7 +1258,7 @@ void Binary_pPrWriter::WriteNumPr(const OOX::Logic::CNumPr& numPr, const OOX::Lo { int nCurPos = 0, listNum = numPr.m_oNumID.IsInit() ? numPr.m_oNumID->m_oVal.get_value_or(0) : -1; - if (m_oParamsWriter.m_pEmbeddedNumbering && listNum >= 0) + if (m_oParamsWriter.m_pEmbeddedNumbering && listNum > 0) { std::map::iterator pFind = m_oParamsWriter.m_pNumbering->m_mapEmbeddedNames.back().find(listNum); diff --git a/OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h b/OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h index 86b6122756..72016b38d4 100644 --- a/OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h +++ b/OOXML/Binary/Sheets/Common/BinReaderWriterDefines.h @@ -232,7 +232,8 @@ namespace BinXlsxRW OleSize = 22, ExternalFileKey = 23, ExternalInstanceId = 24, - FileSharing = 25 + FileSharing = 25, + ExternalLinksAutoRefresh = 26 };} namespace c_oSerWorkbookProtection {enum c_oSerWorkbookProtection{ AlgorithmName = 0, @@ -354,7 +355,8 @@ namespace BinXlsxRW Date1904 = 0, DateCompatibility = 1, HidePivotFieldList = 2, - ShowPivotChartFilter = 3 + ShowPivotChartFilter = 3, + UpdateLinks = 4 };} namespace c_oSerWorkbookViewTypes{enum c_oSerWorkbookViewTypes { diff --git a/OOXML/Binary/Sheets/Reader/BinaryWriter.cpp b/OOXML/Binary/Sheets/Reader/BinaryWriter.cpp index d7e2ff8f54..cd2ec38e96 100644 --- a/OOXML/Binary/Sheets/Reader/BinaryWriter.cpp +++ b/OOXML/Binary/Sheets/Reader/BinaryWriter.cpp @@ -2121,6 +2121,12 @@ void BinaryWorkbookTableWriter::WriteWorkbook(OOX::Spreadsheet::CWorkbook& workb WriteSlicerCaches(workbook, pExt->m_oSlicerCachesExt.get()); m_oBcw.WriteItemWithLengthEnd(nCurPos); } + else if (pExt->m_oExternalLinksAutoRefresh.IsInit()) + { + nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::ExternalLinksAutoRefresh); + m_oBcw.m_oStream.WriteBOOL(*pExt->m_oExternalLinksAutoRefresh); + m_oBcw.WriteItemWithLengthEnd(nCurPos); + } } } //Write VbaProject @@ -2297,6 +2303,12 @@ void BinaryWorkbookTableWriter::WriteWorkbookPr(const OOX::Spreadsheet::CWorkboo m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte); m_oBcw.m_oStream.WriteBOOL(workbookPr.m_oShowPivotChartFilter->ToBool()); } + if (workbookPr.m_oUpdateLinks.IsInit()) + { + m_oBcw.m_oStream.WriteBYTE(c_oSerWorkbookPrTypes::UpdateLinks); + m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte); + m_oBcw.m_oStream.WriteBOOL(workbookPr.m_oUpdateLinks->GetValue()); + } } void BinaryWorkbookTableWriter::WriteConnectionTextFields(const OOX::Spreadsheet::CTextFields& textFields) { diff --git a/OOXML/Binary/Sheets/Reader/CellFormatController/CellFormatController.cpp b/OOXML/Binary/Sheets/Reader/CellFormatController/CellFormatController.cpp index eb9861106f..265c6ae7f8 100644 --- a/OOXML/Binary/Sheets/Reader/CellFormatController/CellFormatController.cpp +++ b/OOXML/Binary/Sheets/Reader/CellFormatController/CellFormatController.cpp @@ -40,6 +40,7 @@ #include #include #include +#include const std::wstring DefaultDateFormat = L"dd.mm.yyyy"; const std::wstring DefaultPercentFormat = L"0.0%"; diff --git a/OOXML/Binary/Sheets/Writer/BinaryReader.cpp b/OOXML/Binary/Sheets/Writer/BinaryReader.cpp index 2ac809b7bb..11654e1fc2 100644 --- a/OOXML/Binary/Sheets/Writer/BinaryReader.cpp +++ b/OOXML/Binary/Sheets/Writer/BinaryReader.cpp @@ -2138,6 +2138,18 @@ int BinaryWorkbookTableReader::ReadWorkbookTableContent(BYTE type, long length, m_oWorkbook.m_oFileSharing.Init(); READ1_DEF(length, res, this->ReadFileSharing, m_oWorkbook.m_oFileSharing.GetPointer()); } + else if (c_oSerWorkbookTypes::ExternalLinksAutoRefresh == type) + { + OOX::Drawing::COfficeArtExtension* pOfficeArtExtension = new OOX::Drawing::COfficeArtExtension(); + pOfficeArtExtension->m_oExternalLinksAutoRefresh = m_oBufferedStream.GetBool(); + + pOfficeArtExtension->m_sUri = L"{FCE6A71B-6B00-49CD-AB44-F6B1AE7CDE65}"; + pOfficeArtExtension->m_sAdditionalNamespace = L"xmlns:xxlnp=\"http://schemas.microsoft.com/office/spreadsheetml/2019/extlinksprops\""; + + if (m_oWorkbook.m_oExtLst.IsInit() == false) + m_oWorkbook.m_oExtLst.Init(); + m_oWorkbook.m_oExtLst->m_arrExt.push_back(pOfficeArtExtension); + } else if(c_oSerWorkbookTypes::VbaProject == type) { m_bMacroRead = true; @@ -2719,6 +2731,11 @@ int BinaryWorkbookTableReader::ReadWorkbookPr(BYTE type, long length, void* poRe m_oWorkbook.m_oWorkbookPr->m_oShowPivotChartFilter.Init(); m_oWorkbook.m_oWorkbookPr->m_oShowPivotChartFilter->SetValue(false != m_oBufferedStream.GetBool() ? SimpleTypes::onoffTrue : SimpleTypes::onoffFalse); } + else if (c_oSerWorkbookPrTypes::UpdateLinks == type) + { + m_oWorkbook.m_oWorkbookPr->m_oUpdateLinks.Init(); + m_oWorkbook.m_oWorkbookPr->m_oUpdateLinks->SetValueFromByte(m_oBufferedStream.GetUChar()); + } else res = c_oSerConstants::ReadUnknown; return res; @@ -7745,7 +7762,10 @@ int BinaryFileReader::ReadFile(const std::wstring& sSrcFileName, std::wstring sD CSVWriter oCSVWriter; oCSVWriter.Init(oXlsx, nCodePage, sDelimiter, false); - oCSVWriter.Start(sDstPathCSV); + + bResultOk = oCSVWriter.Start(sDstPathCSV); + if (!bResultOk) return AVS_FILEUTILS_ERROR_CONVERT; + SaveParams oSaveParams(drawingsPath, embeddingsPath, themePath, pOfficeDrawingConverter->GetContentTypes(), &oCSVWriter); try diff --git a/OOXML/Binary/Sheets/Writer/CSVWriter.cpp b/OOXML/Binary/Sheets/Writer/CSVWriter.cpp index aba6139cad..1e0657ed05 100644 --- a/OOXML/Binary/Sheets/Writer/CSVWriter.cpp +++ b/OOXML/Binary/Sheets/Writer/CSVWriter.cpp @@ -60,11 +60,11 @@ public: Impl(OOX::Spreadsheet::CXlsx &oXlsx, unsigned int m_nCodePage, const std::wstring& sDelimiter, bool m_bJSON); ~Impl(); - void Start(const std::wstring &sFileDst); + bool Start(const std::wstring &sFileDst); void WriteSheetStart(OOX::Spreadsheet::CWorksheet* pWorksheet); void WriteRowStart(OOX::Spreadsheet::CRow *pRow); void WriteCell(OOX::Spreadsheet::CCell *pCell); - void WriteRowEnd(OOX::Spreadsheet::CRow* pWorksheet); + void WriteRowEnd(OOX::Spreadsheet::CRow* pWorksheet, bool bLast = false); void WriteSheetEnd(OOX::Spreadsheet::CWorksheet* pWorksheet); void End(); void Close(); @@ -164,7 +164,7 @@ void CSVWriter::Xlsx2Csv(const std::wstring &sFileDst, OOX::Spreadsheet::CXlsx & { impl_->WriteCell(pRow->m_arrItems[j]); } - impl_->WriteRowEnd(pRow); + impl_->WriteRowEnd(pRow, (i == pWorksheet->m_oSheetData->m_arrItems.size() - 1)); } impl_->WriteSheetEnd(pWorksheet); } @@ -172,10 +172,11 @@ void CSVWriter::Xlsx2Csv(const std::wstring &sFileDst, OOX::Spreadsheet::CXlsx & } impl_->End(); } -void CSVWriter::Start(const std::wstring &sFileDst) +bool CSVWriter::Start(const std::wstring &sFileDst) { if (impl_) - impl_->Start(sFileDst); + return impl_->Start(sFileDst); + return false; } void CSVWriter::WriteSheetStart(OOX::Spreadsheet::CWorksheet* pWorksheet) { @@ -192,10 +193,10 @@ void CSVWriter::WriteCell(OOX::Spreadsheet::CCell *pCell) if (impl_) impl_->WriteCell(pCell); } -void CSVWriter::WriteRowEnd(OOX::Spreadsheet::CRow* pWorksheet) +void CSVWriter::WriteRowEnd(OOX::Spreadsheet::CRow* pWorksheet, bool bLast) { if (impl_) - impl_->WriteRowEnd(pWorksheet); + impl_->WriteRowEnd(pWorksheet, bLast); } void CSVWriter::WriteSheetEnd(OOX::Spreadsheet::CWorksheet* pWorksheet) { @@ -631,9 +632,10 @@ CSVWriter::Impl::~Impl() { Close(); } -void CSVWriter::Impl::Start(const std::wstring &sFileDst) +bool CSVWriter::Impl::Start(const std::wstring &sFileDst) { - m_oFile.CreateFileW(sFileDst); + bool res = m_oFile.CreateFileW(sFileDst); + if (!res) return false; // Нужно записать шапку if (46 == m_nCodePage)//todo 46 временно CP_UTF8 @@ -651,6 +653,7 @@ void CSVWriter::Impl::Start(const std::wstring &sFileDst) BYTE arBigEndian[2] = { 0xFE, 0xFF }; m_oFile.WriteFile(arBigEndian, 2); } + return true; } void CSVWriter::Impl::WriteSheetStart(OOX::Spreadsheet::CWorksheet* pWorksheet) { @@ -760,7 +763,7 @@ void CSVWriter::Impl::WriteCell(OOX::Spreadsheet::CCell *pCell) int numFmt = xfs->m_oNumFmtId->GetValue(); GetDefaultFormatCode(numFmt, format_code, format_type); - auto formatTypeIsDateTime = (*format_type == SimpleTypes::Spreadsheet::celltypeDate || + auto formatTypeIsDateTime = format_type && (*format_type == SimpleTypes::Spreadsheet::celltypeDate || *format_type == SimpleTypes::Spreadsheet::celltypeDateTime || SimpleTypes::Spreadsheet::celltypeTime); if (m_oXlsx.m_pStyles->m_oNumFmts.IsInit()) { @@ -811,13 +814,13 @@ void CSVWriter::Impl::WriteCell(OOX::Spreadsheet::CCell *pCell) m_bIsWriteCell = true; m_bStartCell = false; } -void CSVWriter::Impl::WriteRowEnd(OOX::Spreadsheet::CRow* pWorksheet) +void CSVWriter::Impl::WriteRowEnd(OOX::Spreadsheet::CRow* pWorksheet, bool bLast) { if (m_bJSON) WriteFile(&m_oFile, &m_pWriteBuffer, m_nCurrentIndex, g_sEndJson, m_nCodePage); else { - while (m_nColDimension > m_nColCurrent) // todooo - прописывать в бинарнике dimension - и данные брать оттуда + while (m_nColDimension > m_nColCurrent && !bLast) // todooo - прописывать в бинарнике dimension - и данные брать оттуда { // Write delimiter ++m_nColCurrent; @@ -1009,12 +1012,16 @@ std::wstring CSVWriter::Impl::ConvertValueCellToString(const std::wstring &value format_string += L"."; format_string += std::to_wstring(numberFormat.count_float); } - if (numberFormat.bPercent) format_string += L"%"; - std::wstring strEnd = format_code.substr(pos_end + 1); XmlUtils::replace_all(strEnd, L"\\", L""); - + format_string += numberFormat.bFloat ? L"f" : L"ld"; + if (numberFormat.bPercent) + { + format_string += L"%%"; + XmlUtils::replace_all(strEnd, L"%", L""); + } + format_string += strEnd; numberFormat.format_string = format_string; diff --git a/OOXML/Binary/Sheets/Writer/CSVWriter.h b/OOXML/Binary/Sheets/Writer/CSVWriter.h index 0288ec73f7..2c1ba37b14 100644 --- a/OOXML/Binary/Sheets/Writer/CSVWriter.h +++ b/OOXML/Binary/Sheets/Writer/CSVWriter.h @@ -57,11 +57,11 @@ public: void Init(OOX::Spreadsheet::CXlsx &oXlsx, unsigned int nCodePage, const std::wstring& wcDelimiter, bool bJSON); - void Start(const std::wstring &sFileDst); + bool Start(const std::wstring &sFileDst); void WriteSheetStart(OOX::Spreadsheet::CWorksheet* pWorksheet); void WriteRowStart(OOX::Spreadsheet::CRow *pRow); void WriteCell(OOX::Spreadsheet::CCell *pCell); - void WriteRowEnd(OOX::Spreadsheet::CRow* pWorksheet); + void WriteRowEnd(OOX::Spreadsheet::CRow* pWorksheet, bool bLast = false); void WriteSheetEnd(OOX::Spreadsheet::CWorksheet* pWorksheet); void End(); void Close(); diff --git a/OOXML/Common/ComplexTypes.cpp b/OOXML/Common/ComplexTypes.cpp index 5d044f3a06..169af369dd 100644 --- a/OOXML/Common/ComplexTypes.cpp +++ b/OOXML/Common/ComplexTypes.cpp @@ -118,58 +118,58 @@ namespace Word { std::wstring sResult; + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } if ( m_oColor.IsInit() ) { sResult += L"w:color=\""; sResult += m_oColor->ToStringNoAlpha(); sResult += L"\" "; } - if ( m_oFrame.IsInit() ) - { - sResult += L"w:frame=\""; - sResult += m_oFrame->ToString(); - sResult += L"\" "; - } - if ( m_oShadow.IsInit() ) - { - sResult += L"w:shadow=\""; - sResult += m_oShadow->ToString(); - sResult += L"\" "; - } - if ( m_oSpace.IsInit() ) - { - sResult += L"w:space=\""; - sResult += m_oSpace->ToString(); - sResult += L"\" "; - } - if ( m_oSz.IsInit() ) - { - sResult += L"w:sz=\""; - sResult += m_oSz->ToString(); - sResult += L"\" "; - } - if ( m_oThemeColor.IsInit() ) + if (m_oThemeColor.IsInit()) { sResult += L"w:themeColor=\""; sResult += m_oThemeColor->ToString(); sResult += L"\" "; } - if ( m_oThemeShade.IsInit() ) - { - sResult += L"w:themeShade=\""; - sResult += m_oThemeShade->ToString(); - sResult += L"\" "; - } - if ( m_oThemeTint.IsInit() ) + if (m_oThemeTint.IsInit()) { sResult += L"w:themeTint=\""; sResult += m_oThemeTint->ToString(); sResult += L"\" "; } - if ( m_oVal.IsInit() ) + if (m_oThemeShade.IsInit()) { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); + sResult += L"w:themeShade=\""; + sResult += m_oThemeShade->ToString(); + sResult += L"\" "; + } + if (m_oSz.IsInit()) + { + sResult += L"w:sz=\""; + sResult += m_oSz->ToString(); + sResult += L"\" "; + } + if (m_oSpace.IsInit()) + { + sResult += L"w:space=\""; + sResult += m_oSpace->ToString(); + sResult += L"\" "; + } + if (m_oShadow.IsInit()) + { + sResult += L"w:shadow=\""; + sResult += m_oShadow->ToString(); + sResult += L"\" "; + } + if ( m_oFrame.IsInit() ) + { + sResult += L"w:frame=\""; + sResult += m_oFrame->ToString(); sResult += L"\" "; } return sResult; @@ -2666,6 +2666,12 @@ namespace Word { std::wstring sResult; + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } if (m_oLeader.IsInit()) { sResult += L"w:leader=\""; @@ -2678,12 +2684,6 @@ namespace Word sResult += m_oPos->ToString(); sResult += L"\" "; } - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } return sResult; } diff --git a/OOXML/DocxFormat/CustomXml.cpp b/OOXML/DocxFormat/CustomXml.cpp index 07b68dff9a..49f96d5e5c 100644 --- a/OOXML/DocxFormat/CustomXml.cpp +++ b/OOXML/DocxFormat/CustomXml.cpp @@ -56,11 +56,11 @@ namespace OOX } void CCustomXMLProps::CShemaRef::fromXML(XmlUtils::CXmlNode& oNode) { - XmlMacroReadAttributeBase( oNode, _T("ds:uri"), m_sUri ); + XmlMacroReadAttributeBase( oNode, L"ds:uri", m_sUri ); } std::wstring CCustomXMLProps::CShemaRef::toXML() const { - std::wstring sResult = _T(""); + std::wstring sResult = L""; return sResult; } EElementType CCustomXMLProps::CShemaRef::getType() const @@ -119,12 +119,14 @@ namespace OOX void CCustomXMLProps::CShemaRefs::fromXML(XmlUtils::CXmlNode& oNode) { std::vector oNodes; - if ( oNode.GetNodes( _T("ds:schemaRef"), oNodes ) ) + if (oNode.GetNodes(L"*", oNodes)) { - for ( size_t nIndex = 0; nIndex < oNodes.size(); nIndex++ ) + for (size_t i = 0; i < oNodes.size(); ++i) { - XmlUtils::CXmlNode & oItem = oNodes[nIndex]; - if ( oItem.IsValid() ) + XmlUtils::CXmlNode& oItem = oNodes[i]; + + std::wstring sName = XmlUtils::GetNameNoNS(oItem.GetName()); + if ( L"schemaRef" == sName ) { CShemaRef *oShemeRef = new CShemaRef(oItem); if (oShemeRef) m_arrItems.push_back( oShemeRef ); @@ -134,12 +136,12 @@ namespace OOX } std::wstring CCustomXMLProps::CShemaRefs::toXML() const { - std::wstring sResult = _T(""); + std::wstring sResult = L""; for ( size_t nIndex = 0; nIndex < m_arrItems.size(); nIndex++ ) sResult += m_arrItems[nIndex]->toXML(); - sResult += _T(""); + sResult += L""; return sResult; } @@ -167,25 +169,25 @@ namespace OOX } void CCustomXMLProps::fromXML(XmlUtils::CXmlNode& oNode) { - if (_T("ds:datastoreItem") == oNode.GetName()) + if (L"datastoreItem" == XmlUtils::GetNameNoNS(oNode.GetName())); { - m_oItemID = oNode.ReadAttribute(_T("ds:itemID")); + m_oItemID = oNode.ReadAttribute(L"ds:itemID"); XmlUtils::CXmlNode oItem; - if (oNode.GetNode(_T("ds:schemaRefs"), oItem)) + if (oNode.GetNode(L"ds:schemaRefs", oItem)) m_oShemaRefs = oItem; } } std::wstring CCustomXMLProps::toXML() const { - std::wstring sXml = _T(""); + sXml += L"\" xmlns:ds=\"http://schemas.openxmlformats.org/officeDocument/2006/customXml\">"; if (m_oShemaRefs.IsInit()) sXml += m_oShemaRefs->toXML(); - sXml += _T(""); + sXml += L""; return sXml; } @@ -200,7 +202,7 @@ namespace OOX { NSFile::CFileBinary::SaveToFile(oFilePath.GetPath(), toXML()); - oContent.Registration( type().OverrideType(), OOX::CPath(L"customXml"), oFilePath.GetFilename() ); + oContent.Registration( type().OverrideType(), OOX::CPath(L"customXml"), oFilePath.GetFilename()); } EElementType CCustomXMLProps::getType() const { diff --git a/OOXML/DocxFormat/Drawing/DrawingExt.cpp b/OOXML/DocxFormat/Drawing/DrawingExt.cpp index 90aee2b188..6df2034cac 100644 --- a/OOXML/DocxFormat/Drawing/DrawingExt.cpp +++ b/OOXML/DocxFormat/Drawing/DrawingExt.cpp @@ -216,7 +216,8 @@ namespace OOX *m_sUri == L"{19B8F6BF-5375-455C-9EA6-DF929625EA0E}" || *m_sUri == L"{725AE2AE-9491-48be-B2B4-4EB974FC3084}" || *m_sUri == L"{231B7EB2-2AFC-4442-B178-5FFDF5851E7C}" || - *m_sUri == L"http://schemas.microsoft.com/office/drawing/2008/diagram")) + *m_sUri == L"{FCE6A71B-6B00-49CD-AB44-F6B1AE7CDE65}" || + *m_sUri == L"http://schemas.microsoft.com/office/drawing/2008/diagram")) { int nCurDepth = oReader.GetDepth(); while (oReader.ReadNextSiblingNode(nCurDepth)) @@ -333,6 +334,12 @@ namespace OOX { m_oUserProtectedRanges = oReader; } + else if (sName == L"externalLinksPr") + { + WritingElement_ReadAttributes_Start_No_NS(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"autoRefresh", m_oExternalLinksAutoRefresh) + WritingElement_ReadAttributes_End_No_NS(oReader) + } } } else @@ -515,6 +522,19 @@ namespace OOX m_oChartFiltering->toXML(writer); sResult += writer.GetData().c_str(); } + if (m_oExternalLinksAutoRefresh.IsInit()) + { + NSStringUtils::CStringBuilder writer; + writer.StartNode(L"xxlnp:externalLinksPr"); + writer.StartAttributes(); + + writer.WriteAttribute(L"autoRefresh", *m_oExternalLinksAutoRefresh); + + writer.EndAttributes(); + writer.EndNode(L"xxlnp:externalLinksPr"); + sResult += writer.GetData().c_str(); + + } sResult += L""; return sResult; diff --git a/OOXML/DocxFormat/Drawing/DrawingExt.h b/OOXML/DocxFormat/Drawing/DrawingExt.h index 4d43332336..dc4a638a8f 100644 --- a/OOXML/DocxFormat/Drawing/DrawingExt.h +++ b/OOXML/DocxFormat/Drawing/DrawingExt.h @@ -163,6 +163,7 @@ namespace OOX nullable m_oUserProtectedRanges; + nullable_bool m_oExternalLinksAutoRefresh; }; //-------------------------------------------------------------------------------- diff --git a/OOXML/DocxFormat/Logic/ParagraphProperty.cpp b/OOXML/DocxFormat/Logic/ParagraphProperty.cpp index 08d3ad033c..cc53b9a5a7 100644 --- a/OOXML/DocxFormat/Logic/ParagraphProperty.cpp +++ b/OOXML/DocxFormat/Logic/ParagraphProperty.cpp @@ -183,51 +183,43 @@ namespace OOX std::wstring CPBdr::toXML() const { std::wstring sResult = L""; - + if (m_oTop.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oLeft.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oBottom.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oRight.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oBetween.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } if ( m_oBar.IsInit() ) { sResult += L"ToString(); sResult += L"/>"; } - - if ( m_oBetween.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oBottom.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oLeft.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oRight.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oTop.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - sResult += L""; - return sResult; } EElementType CPBdr::getType() const @@ -481,6 +473,59 @@ namespace OOX fromXML( (XmlUtils::CXmlLiteReader&)oReader ); return *this; } + void CParagraphProperty::Clear() + { + m_bPPrChange = false; + + m_oAdjustRightInd.reset(); + m_oAutoSpaceDE.reset(); + m_oAutoSpaceDN.reset(); + m_oBidi.reset(); + m_oCnfStyle.reset(); + m_oContextualSpacing.reset(); + m_oDivID.reset(); + m_oFramePr.reset(); + m_oInd.reset(); + m_oJc.reset(); + m_oKeepLines.reset(); + m_oKeepNext.reset(); + m_oKinsoku.reset(); + m_oMirrorIndents.reset(); + m_oNumPr.reset(); + m_oOutlineLvl.reset(); + m_oOverflowPunct.reset(); + m_oPageBreakBefore.reset(); + m_oPBdr.reset(); + m_oPPrChange.reset(); + m_oPStyle.reset(); + m_oRPr.reset(); + m_oSectPr.reset(); + m_oShd.reset(); + m_oSnapToGrid.reset(); + m_oSpacing.reset(); + m_oSuppressAutoHyphens.reset(); + m_oSuppressLineNumbers.reset(); + m_oSuppressOverlap.reset(); + m_oTabs.reset(); + m_oTextAlignment.reset(); + m_oTextboxTightWrap.reset(); + m_oTextDirection.reset(); + m_oTopLinePunct.reset(); + m_oWidowControl.reset(); + m_oWordWrap.reset(); + } + bool CParagraphProperty::IsNoEmpty() + { + return (m_oAdjustRightInd.IsInit() || m_oAutoSpaceDE.IsInit() || m_oAutoSpaceDN.IsInit() || + m_oBidi.IsInit() || m_oCnfStyle.IsInit() || m_oContextualSpacing.IsInit() || m_oDivID.IsInit() || + m_oFramePr.IsInit() || m_oInd.IsInit() || m_oJc.IsInit() || m_oKeepLines.IsInit() || m_oKeepNext.IsInit() || + m_oKinsoku.IsInit() || m_oMirrorIndents.IsInit() || m_oNumPr.IsInit() || m_oOutlineLvl.IsInit() || + m_oOverflowPunct.IsInit() || m_oPageBreakBefore.IsInit() || m_oPBdr.IsInit() || m_oPPrChange.IsInit() || + m_oPStyle.IsInit() || m_oRPr.IsInit() || m_oSectPr.IsInit() || m_oShd.IsInit() || m_oSnapToGrid.IsInit() || + m_oSpacing.IsInit() || m_oSuppressAutoHyphens.IsInit() || m_oSuppressLineNumbers.IsInit() || m_oSuppressOverlap.IsInit() || m_oTabs.IsInit() || + m_oTextAlignment.IsInit() || m_oTextboxTightWrap.IsInit() || m_oTextDirection.IsInit() || m_oTopLinePunct.IsInit() || + m_oWidowControl.IsInit() || m_oWordWrap.IsInit() ); + } void CParagraphProperty::fromXML(XmlUtils::CXmlNode& oNode) {//??? где используется ? if ( L"w:pPr" != oNode.GetName() ) @@ -649,233 +694,206 @@ namespace OOX { std::wstring sResult = L""; - if ( m_oAdjustRightInd.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oAutoSpaceDE.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oAutoSpaceDN.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oBidi.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oCnfStyle.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oContextualSpacing.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oDivID.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oFramePr.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oInd.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oJc.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oKeepLines.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oKeepNext.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oKinsoku.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oMirrorIndents.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oNumPr.IsInit() ) - sResult += m_oNumPr->toXML(); - - if ( m_oOutlineLvl.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oOverflowPunct.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oPageBreakBefore.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oPBdr.IsInit() ) - sResult += m_oPBdr->toXML(); - - if ( !m_bPPrChange && m_oPPrChange.IsInit() ) - sResult += m_oPPrChange->toXML(); - - if ( m_oPStyle.IsInit() ) + if (m_oPStyle.IsInit()) { sResult += L"ToString(); sResult += L"/>"; } - - if ( !m_bPPrChange && m_oRPr.IsInit() ) - sResult += m_oRPr->toXML(); - - if ( !m_bPPrChange && m_oSectPr.IsInit() ) - sResult += m_oSectPr->toXML(); - - if ( m_oShd.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oSnapToGrid.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oSpacing.IsInit() ) + if (m_oKeepNext.IsInit()) { - sResult += L"ToString(); - sResult += L"/>"; + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oKeepLines.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oPageBreakBefore.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oFramePr.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oWidowControl.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oNumPr.IsInit()) + { + sResult += m_oNumPr->toXML(); + } + if (m_oSuppressLineNumbers.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oPBdr.IsInit()) + { + sResult += m_oPBdr->toXML(); + } + if (m_oShd.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oTabs.IsInit()) + { + sResult += m_oTabs->toXML(); } - if ( m_oSuppressAutoHyphens.IsInit() ) { sResult += L"ToString(); sResult += L"/>"; } - - if ( m_oSuppressLineNumbers.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oSuppressOverlap.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oTabs.IsInit() ) - sResult += m_oTabs->toXML(); - - if ( m_oTextAlignment.IsInit() ) + if (m_oKinsoku.IsInit()) { - sResult += L"ToString(); - sResult += L"/>"; + sResult += L"ToString(); + sResult += L"/>"; } - - if ( m_oTextboxTightWrap.IsInit() ) + if (m_oWordWrap.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oOverflowPunct.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oTopLinePunct.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oAutoSpaceDE.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oAutoSpaceDN.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oBidi.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oAdjustRightInd.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oSnapToGrid.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oSpacing.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oInd.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oContextualSpacing.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oMirrorIndents.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oSuppressOverlap.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oJc.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oTextDirection.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oTextAlignment.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oTextboxTightWrap.IsInit()) { sResult += L"ToString(); - sResult += L"/>"; + sResult += m_oTextboxTightWrap->ToString(); + sResult += L"/>"; } - - if ( m_oTextDirection.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oTopLinePunct.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oWidowControl.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oWordWrap.IsInit() ) + if (m_oOutlineLvl.IsInit()) { - sResult += L"ToString(); - sResult += L"/>"; + sResult += L"ToString(); + sResult += L"/>"; } + if (m_oDivID.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if ( m_oCnfStyle.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if ( !m_bPPrChange && m_oRPr.IsInit() ) + sResult += m_oRPr->toXML(); + + if ( !m_bPPrChange && m_oSectPr.IsInit() ) + sResult += m_oSectPr->toXML(); + + if ( !m_bPPrChange && m_oPPrChange.IsInit() ) + sResult += m_oPPrChange->toXML(); sResult += L""; diff --git a/OOXML/DocxFormat/Logic/ParagraphProperty.h b/OOXML/DocxFormat/Logic/ParagraphProperty.h index 9a07db967d..cf1314edc4 100644 --- a/OOXML/DocxFormat/Logic/ParagraphProperty.h +++ b/OOXML/DocxFormat/Logic/ParagraphProperty.h @@ -30,8 +30,6 @@ * */ #pragma once -#ifndef OOX_LOGIC_PARAGRAPH_PROPERTY_INCLUDE_H_ -#define OOX_LOGIC_PARAGRAPH_PROPERTY_INCLUDE_H_ #include "../../Base/Nullable.h" #include "./../WritingElement.h" @@ -89,9 +87,9 @@ namespace OOX virtual EElementType getType() const; public: - nullable m_oIlvl; - nullable m_oIns; - nullable m_oNumID; + nullable m_oIlvl; + nullable m_oIns; + nullable m_oNumID; }; //-------------------------------------------------------------------------------- @@ -105,15 +103,10 @@ namespace OOX CPBdr(); virtual ~CPBdr(); - public: - virtual void fromXML(XmlUtils::CXmlNode& oNode); - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - virtual std::wstring toXML() const; - virtual EElementType getType() const; static const CPBdr Merge(const CPBdr& oPrev, const CPBdr& oCurrent); @@ -131,7 +124,6 @@ namespace OOX return oResult; } - public: nullable m_oBar; nullable m_oBetween; nullable m_oBottom; @@ -155,7 +147,6 @@ namespace OOX const CPPrChange& operator =(const XmlUtils::CXmlLiteReader& oReader); virtual ~CPPrChange(); - public: virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual std::wstring toXML() const; @@ -193,7 +184,6 @@ namespace OOX virtual std::wstring toXML() const; virtual EElementType getType() const; - public: std::vector m_arrTabs; }; @@ -208,6 +198,9 @@ namespace OOX CParagraphProperty(XmlUtils::CXmlLiteReader& oReader); virtual ~CParagraphProperty(); + bool IsNoEmpty(); + void Clear(); + const CParagraphProperty& operator =(const XmlUtils::CXmlNode &oNode); const CParagraphProperty& operator =(const XmlUtils::CXmlLiteReader &oReader); @@ -231,49 +224,45 @@ namespace OOX return oResult; } - - //-------------------------------------------------------------------------------------------------------- - - bool m_bPPrChange; +//-------------------------------------------------------------------------------------------------------- + bool m_bPPrChange = false; nullable m_oAdjustRightInd; nullable m_oAutoSpaceDE; nullable m_oAutoSpaceDN; nullable m_oBidi; - nullable m_oCnfStyle; + nullable m_oCnfStyle; nullable m_oContextualSpacing; - nullable m_oDivID; - nullable m_oFramePr; - nullable m_oInd; - nullable m_oJc; + nullable m_oDivID; + nullable m_oFramePr; + nullable m_oInd; + nullable m_oJc; nullable m_oKeepLines; nullable m_oKeepNext; nullable m_oKinsoku; nullable m_oMirrorIndents; - nullable m_oNumPr; - nullable m_oOutlineLvl; + nullable m_oNumPr; + nullable m_oOutlineLvl; nullable m_oOverflowPunct; nullable m_oPageBreakBefore; - nullable m_oPBdr; - nullable m_oPPrChange; - nullable m_oPStyle; - nullable m_oRPr; - nullable m_oSectPr; - nullable m_oShd; + nullable m_oPBdr; + nullable m_oPPrChange; + nullable m_oPStyle; + nullable m_oRPr; + nullable m_oSectPr; + nullable m_oShd; nullable m_oSnapToGrid; - nullable m_oSpacing; + nullable m_oSpacing; nullable m_oSuppressAutoHyphens; nullable m_oSuppressLineNumbers; nullable m_oSuppressOverlap; - nullable m_oTabs; - nullable m_oTextAlignment; - nullable m_oTextboxTightWrap; - nullable m_oTextDirection; + nullable m_oTabs; + nullable m_oTextAlignment; + nullable m_oTextboxTightWrap; + nullable m_oTextDirection; nullable m_oTopLinePunct; nullable m_oWidowControl; nullable m_oWordWrap; }; - } // namespace Logic } // namespace OOX -#endif // OOX_LOGIC_PARAGRAPH_PROPERTY_INCLUDE_H_ diff --git a/OOXML/DocxFormat/Logic/SectionProperty.h b/OOXML/DocxFormat/Logic/SectionProperty.h index 29a112a7d8..2d2fdeb8dc 100644 --- a/OOXML/DocxFormat/Logic/SectionProperty.h +++ b/OOXML/DocxFormat/Logic/SectionProperty.h @@ -509,33 +509,33 @@ namespace OOX public: bool m_bSectPrChange; - nullable m_oRsidDel; - nullable m_oRsidR; - nullable m_oRsidRPr; - nullable m_oRsidSect; + nullable m_oRsidDel; + nullable m_oRsidR; + nullable m_oRsidRPr; + nullable m_oRsidSect; - nullable m_oBidi; - nullable m_oCols; - nullable m_oDocGrid; - nullable m_oEndnotePr; - std::vector m_arrFooterReference; - nullable m_oFootnotePr; - nullable m_oFormProt; - std::vector m_arrHeaderReference; - nullable m_oLnNumType; - nullable m_oNoEndnote; - nullable m_oPaperSrc; - nullable m_oPgBorders; - nullable m_oPgMar; - nullable m_oPgNumType; - nullable m_oPgSz; - nullable m_oPrinterSettings; - nullable m_oRtlGutter; - nullable m_oSectPrChange; - nullable m_oTextDirection; - nullable m_oTitlePg; - nullable m_oType; - nullable m_oVAlign; + nullable m_oBidi; + nullable m_oCols; + nullable m_oDocGrid; + nullable m_oEndnotePr; + std::vector m_arrFooterReference; + nullable m_oFootnotePr; + nullable m_oFormProt; + std::vector m_arrHeaderReference; + nullable m_oLnNumType; + nullable m_oNoEndnote; + nullable m_oPaperSrc; + nullable m_oPgBorders; + nullable m_oPgMar; + nullable m_oPgNumType; + nullable m_oPgSz; + nullable m_oPrinterSettings; + nullable m_oRtlGutter; + nullable m_oSectPrChange; + nullable m_oTextDirection; + nullable m_oTitlePg; + nullable m_oType; + nullable m_oVAlign; }; } // namespace Logic diff --git a/OOXML/DocxFormat/Logic/TableProperty.cpp b/OOXML/DocxFormat/Logic/TableProperty.cpp index c823a35e52..97c64d34b7 100644 --- a/OOXML/DocxFormat/Logic/TableProperty.cpp +++ b/OOXML/DocxFormat/Logic/TableProperty.cpp @@ -778,48 +778,42 @@ namespace OOX { std::wstring sResult = L""; + if (m_oTop.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } + if (m_oStart.IsInit()) + { + sResult += L"ToString(); + sResult += L"/>"; + } if ( m_oBottom.IsInit() ) { sResult += L"ToString(); sResult += L"/>"; } - if ( m_oEnd.IsInit() ) { sResult += L"ToString(); sResult += L"/>"; } - if ( m_oInsideH.IsInit() ) { sResult += L"ToString(); sResult += L"/>"; } - if ( m_oInsideV.IsInit() ) { sResult += L"ToString(); sResult += L"/>"; } - - if ( m_oStart.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oTop.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - sResult += L""; return sResult; @@ -1580,13 +1574,13 @@ namespace OOX { std::wstring sResult = L""; + WritingElement_WriteNode_1( L""; diff --git a/OOXML/DocxFormat/Logic/TableProperty.h b/OOXML/DocxFormat/Logic/TableProperty.h index 4b54e437a6..5bd3541983 100644 --- a/OOXML/DocxFormat/Logic/TableProperty.h +++ b/OOXML/DocxFormat/Logic/TableProperty.h @@ -215,8 +215,6 @@ namespace OOX return oResult; } - - public: nullable m_oBottom; nullable m_oEnd; nullable m_oInsideH; @@ -333,26 +331,26 @@ namespace OOX } public: - bool m_bTblPrChange; + bool m_bTblPrChange = false; - nullable m_oBidiVisual; - nullable m_oJc; - nullable m_oShade; - nullable m_oTblBorders; - nullable m_oTblCaption; - nullable m_oTblCellMar; - nullable m_oTblCellSpacing; - nullable m_oTblDescription; - nullable m_oTblInd; - nullable m_oTblLayout; - nullable m_oTblLook; - nullable m_oTblOverlap; - nullable m_oTblpPr; - nullable m_oTblPrChange; - nullable m_oTblStyle; - nullable m_oTblStyleColBandSize; - nullable m_oTblStyleRowBandSize; - nullable m_oTblW; + nullable m_oBidiVisual; + nullable m_oJc; + nullable m_oShade; + nullable m_oTblBorders; + nullable m_oTblCaption; + nullable m_oTblCellMar; + nullable m_oTblCellSpacing; + nullable m_oTblDescription; + nullable m_oTblInd; + nullable m_oTblLayout; + nullable m_oTblLook; + nullable m_oTblOverlap; + nullable m_oTblpPr; + nullable m_oTblPrChange; + nullable m_oTblStyle; + nullable m_oTblStyleColBandSize; + nullable m_oTblStyleRowBandSize; + nullable m_oTblW; }; } // namespace Logic diff --git a/OOXML/PPTXFormat/Logic/Fills/BlipFill.cpp b/OOXML/PPTXFormat/Logic/Fills/BlipFill.cpp index 51f8c8db2d..f6bd6f2f66 100644 --- a/OOXML/PPTXFormat/Logic/Fills/BlipFill.cpp +++ b/OOXML/PPTXFormat/Logic/Fills/BlipFill.cpp @@ -418,8 +418,12 @@ namespace PPTX { OOX::CPath pathUrl = strImagePath; strImagePath = pathUrl.GetPath(); + + if (std::wstring::npos == strImagePath.find(pReader->m_strFolder)) + { + strImagePath.clear(); + } } - NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strImagePath, additionalFile, oleData, strOrigBase64); // ------------------- diff --git a/OOXML/PPTXFormat/Logic/HeadingVariant.cpp b/OOXML/PPTXFormat/Logic/HeadingVariant.cpp index a4d0d1c4d3..a39d19a047 100644 --- a/OOXML/PPTXFormat/Logic/HeadingVariant.cpp +++ b/OOXML/PPTXFormat/Logic/HeadingVariant.cpp @@ -39,7 +39,7 @@ namespace PPTX { void HeadingVariant::fromXML(XmlUtils::CXmlNode& node) { - XmlUtils::CXmlNode oNode = node.ReadNodeNoNS(_T("i4")); + XmlUtils::CXmlNode oNode = node.ReadNodeNoNS(L"i4"); if (oNode.IsValid()) { m_type = L"i4"; @@ -48,38 +48,38 @@ namespace PPTX else { m_type = L"lpstr"; - m_strContent = node.ReadNodeNoNS(_T("lpstr")).GetTextExt(); + m_strContent = node.ReadNodeNoNS(L"lpstr").GetTextExt(); } } std::wstring HeadingVariant::toXML() const { - if (m_type.IsInit() && (m_type->get() == _T("i4"))) + if (m_type.IsInit() && (m_type->get() == L"i4")) { - return _T("") + std::to_wstring(*m_iContent) + _T(""); + return L"" + std::to_wstring(*m_iContent) + L""; } - return _T("") + *m_strContent + _T(""); + return L"" + *m_strContent + L""; } void HeadingVariant::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("vt:variant")); + pWriter->StartNode(L"vt:variant"); pWriter->EndAttributes(); - if (m_type.IsInit() && (m_type->get() == _T("i4"))) + if (m_type.IsInit() && (m_type->get() == L"i4")) { - pWriter->WriteNodeValue(_T("vt:i4"), *m_iContent); + pWriter->WriteNodeValue(L"vt:i4", *m_iContent); } else { - pWriter->WriteNodeValue(_T("vt:lpstr"), *m_strContent); + pWriter->WriteNodeValue(L"vt:lpstr", *m_strContent); } - pWriter->EndNode(_T("vt:variant")); + pWriter->EndNode(L"vt:variant"); } void HeadingVariant::FillParentPointersForChilds() {} void CVariantVStream::fromXML(XmlUtils::CXmlNode& node) { - XmlMacroReadAttributeBase(node, _T("version"), m_strVersion); + XmlMacroReadAttributeBase(node, L"version", m_strVersion); m_strContent = node.GetTextExt(); } std::wstring CVariantVStream::toXML() const @@ -88,14 +88,14 @@ namespace PPTX } void CVariantVStream::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("vt:vstream")); + pWriter->StartNode(L"vt:vstream"); pWriter->StartAttributes(); pWriter->WriteAttribute2(L"version", m_strVersion); pWriter->EndAttributes(); pWriter->WriteStringXML(*m_strContent); - pWriter->EndNode(_T("vt:vstream")); + pWriter->EndNode(L"vt:vstream"); } void CVariantVStream::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -149,7 +149,7 @@ namespace PPTX case vtVariant: { std::vector oNodes; - if (node.GetNodes(_T("*"), oNodes)) + if (node.GetNodes(L"*", oNodes)) { size_t nCount = oNodes.size(); for (size_t i = 0; i < nCount; ++i) @@ -455,12 +455,12 @@ namespace PPTX void CVariantVector::fromXML(XmlUtils::CXmlNode& node) { std::wstring sBaseType; - XmlMacroReadAttributeBase(node, _T("baseType"), sBaseType); + XmlMacroReadAttributeBase(node, L"baseType", sBaseType); m_eBaseType = CVariant::getTypeByString(sBaseType); - XmlMacroReadAttributeBase(node, _T("size"), m_nSize); + XmlMacroReadAttributeBase(node, L"size", m_nSize); std::vector oNodes; - if (node.GetNodes(_T("*"), oNodes)) + if (node.GetNodes(L"*", oNodes)) { size_t nCount = oNodes.size(); for (size_t i = 0; i < nCount; ++i) @@ -478,7 +478,7 @@ namespace PPTX } void CVariantVector::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("vt:vector")); + pWriter->StartNode(L"vt:vector"); pWriter->StartAttributes(); pWriter->WriteAttribute(L"baseType", CVariant::getStringByType(getVariantType())); pWriter->WriteAttribute(L"size", m_nSize); @@ -489,7 +489,7 @@ namespace PPTX arrVariants[i].toXmlWriterContent(pWriter); } - pWriter->EndNode(_T("vt:vector")); + pWriter->EndNode(L"vt:vector"); } void CVariantVector::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -549,13 +549,13 @@ namespace PPTX void CVariantArray::fromXML(XmlUtils::CXmlNode& node) { std::wstring sBaseType; - XmlMacroReadAttributeBase(node, _T("baseType"), sBaseType); + XmlMacroReadAttributeBase(node, L"baseType", sBaseType); m_eBaseType = CVariant::getTypeByString(sBaseType); - XmlMacroReadAttributeBase(node, _T("lBounds"), m_strLBounds); - XmlMacroReadAttributeBase(node, _T("uBounds"), m_strUBounds); + XmlMacroReadAttributeBase(node, L"lBounds", m_strLBounds); + XmlMacroReadAttributeBase(node, L"uBounds", m_strUBounds); std::vector oNodes; - if (node.GetNodes(_T("*"), oNodes)) + if (node.GetNodes(L"*", oNodes)) { size_t nCount = oNodes.size(); for (size_t i = 0; i < nCount; ++i) @@ -573,7 +573,7 @@ namespace PPTX } void CVariantArray::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("vt:array")); + pWriter->StartNode(L"vt:array"); pWriter->StartAttributes(); pWriter->WriteAttribute2(L"lBounds", m_strLBounds); pWriter->WriteAttribute2(L"uBounds", m_strUBounds); @@ -585,7 +585,7 @@ namespace PPTX arrVariants[i].toXmlWriterContent(pWriter); } - pWriter->EndNode(_T("vt:array")); + pWriter->EndNode(L"vt:array"); } void CVariantArray::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -646,13 +646,13 @@ namespace PPTX void CustomProperty::fromXML(XmlUtils::CXmlNode& node) { - XmlMacroReadAttributeBase(node, _T("fmtid"), m_strFmtid); - XmlMacroReadAttributeBase(node, _T("pid"), m_nPid); - XmlMacroReadAttributeBase(node, _T("name"), m_strName); - XmlMacroReadAttributeBase(node, _T("linkTarget"), m_strLinkTarget); + XmlMacroReadAttributeBase(node, L"fmtid", m_strFmtid); + XmlMacroReadAttributeBase(node, L"pid", m_nPid); + XmlMacroReadAttributeBase(node, L"name", m_strName); + XmlMacroReadAttributeBase(node, L"linkTarget", m_strLinkTarget); std::vector oNodes; - if (node.GetNodes(_T("*"), oNodes)) + if (node.GetNodes(L"*", oNodes)) { size_t nCount = oNodes.size(); for (size_t i = 0; i < nCount; ++i) @@ -668,7 +668,7 @@ namespace PPTX } void CustomProperty::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("property")); + pWriter->StartNode(L"property"); pWriter->StartAttributes(); pWriter->WriteAttribute2(L"fmtid", m_strFmtid); pWriter->WriteAttribute(L"pid", m_nPid); @@ -681,7 +681,7 @@ namespace PPTX m_oContent->toXmlWriterContent(pWriter); } - pWriter->EndNode(_T("property")); + pWriter->EndNode(L"property"); } void CustomProperty::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -752,14 +752,21 @@ namespace PPTX oNode.FromXmlFile(filename.m_strFilename); std::vector oNodes; - oNode.GetNodes(_T("property"), oNodes); - size_t nCount = oNodes.size(); - for (size_t i = 0; i < nCount; ++i) + if (oNode.GetNodes(L"*", oNodes)) { - XmlUtils::CXmlNode & oProperty = oNodes[i]; + for (size_t i = 0; i < oNodes.size(); ++i) + { + XmlUtils::CXmlNode& oItem = oNodes[i]; - m_arProperties.emplace_back(); - m_arProperties.back().fromXML(oProperty); + std::wstring sName = XmlUtils::GetNameNoNS(oItem.GetName()); + if (L"property" == sName) + { + XmlUtils::CXmlNode& oProperty = oNodes[i]; + + m_arProperties.emplace_back(); + m_arProperties.back().fromXML(oProperty); + } + } } } void CustomProperties::write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const @@ -793,11 +800,11 @@ namespace PPTX void CustomProperties::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("Properties")); + pWriter->StartNode(L"Properties"); pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("xmlns"), PPTX::g_Namespaces.cup.m_strLink); - pWriter->WriteAttribute(_T("xmlns:vt"), PPTX::g_Namespaces.vt.m_strLink); + pWriter->WriteAttribute(L"xmlns", PPTX::g_Namespaces.cup.m_strLink); + pWriter->WriteAttribute(L"xmlns:vt", PPTX::g_Namespaces.vt.m_strLink); pWriter->EndAttributes(); for (size_t i = 0; i < m_arProperties.size(); ++i) @@ -805,7 +812,7 @@ namespace PPTX m_arProperties[i].toXmlWriter(pWriter); } - pWriter->EndNode(_T("Properties")); + pWriter->EndNode(L"Properties"); } void CustomProperties::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) diff --git a/OOXML/PPTXFormat/Logic/SmartArt.cpp b/OOXML/PPTXFormat/Logic/SmartArt.cpp index 29c13fad35..081ab5ff6f 100644 --- a/OOXML/PPTXFormat/Logic/SmartArt.cpp +++ b/OOXML/PPTXFormat/Logic/SmartArt.cpp @@ -113,6 +113,11 @@ namespace PPTX if (!pDiagramData) return false; + if (pDiagramData->m_oDataModel.IsInit()) + m_oDataBg = pDiagramData->m_oDataModel->m_oBg; + + m_pDataContainer = oFileData.smart_dynamic_cast(); + // это smart art ..есть у него drawing или нет - неважно smart_ptr oFileDrawing; OOX::CDiagramDrawing* pDiagramDrawing = NULL; @@ -145,10 +150,10 @@ namespace PPTX if (!m_oDrawing->grpSpPr.xfrm.IsInit()) m_oDrawing->grpSpPr.xfrm = new PPTX::Logic::Xfrm; } - else - { - //parse pDiagramData !! - } + //else + //{ + // //parse pDiagramData !! + //} return true; } void SmartArt::LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter) diff --git a/OOXML/PPTXFormat/Logic/SmartArt.h b/OOXML/PPTXFormat/Logic/SmartArt.h index 6dee749ea6..dcf5c66c82 100644 --- a/OOXML/PPTXFormat/Logic/SmartArt.h +++ b/OOXML/PPTXFormat/Logic/SmartArt.h @@ -36,6 +36,11 @@ namespace OOX { class CDiagramData; + + namespace Diagram + { + class CBg; + } } namespace PPTX @@ -69,8 +74,11 @@ namespace PPTX nullable id_layout; nullable id_style; + nullable m_oDataBg; nullable m_oDrawing; + smart_ptr m_pDrawingContainer; + smart_ptr m_pDataContainer; protected: virtual void FillParentPointersForChilds(); diff --git a/OOXML/Projects/Linux/BinDocument/BinDocument.pro b/OOXML/Projects/Linux/BinDocument/BinDocument.pro index 48686912d4..e82d53635a 100644 --- a/OOXML/Projects/Linux/BinDocument/BinDocument.pro +++ b/OOXML/Projects/Linux/BinDocument/BinDocument.pro @@ -25,7 +25,6 @@ DEFINES += UNICODE \ DONT_WRITE_EMBEDDED_FONTS \ AVS_USE_CONVERT_PPTX_TOCUSTOM_VML -!disable_precompiled_header:CONFIG += precompile_header precompile_header { PRECOMPILED_HEADER = precompiled.h HEADERS += precompiled.h diff --git a/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro b/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro index 2985901e56..bab728679d 100644 --- a/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro +++ b/OOXML/Projects/Linux/DocxFormatLib/DocxFormatLib.pro @@ -22,7 +22,6 @@ DEFINES += UNICODE _UNICODE \ #BOOST include($$PWD/../../../../Common/3dParty/boost/boost.pri) -!disable_precompiled_header:CONFIG += precompile_header precompile_header { PRECOMPILED_HEADER = precompiled.h HEADERS += precompiled.h diff --git a/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro b/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro index 6d7f0d0746..e9aadce779 100644 --- a/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro +++ b/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro @@ -42,7 +42,6 @@ INCLUDEPATH += \ ../../../../../MsBinaryFile/Common/common_xls \ ../../../XlsbFormat -#!disable_precompiled_header:CONFIG += precompile_header #precompile_header { # PRECOMPILED_HEADER = precompiled.h # HEADERS += precompiled.h diff --git a/OOXML/Projects/Linux/XlsbFormatLib/XlsbFormatLib.pro b/OOXML/Projects/Linux/XlsbFormatLib/XlsbFormatLib.pro index ce414b9b87..8c004dfa3c 100644 --- a/OOXML/Projects/Linux/XlsbFormatLib/XlsbFormatLib.pro +++ b/OOXML/Projects/Linux/XlsbFormatLib/XlsbFormatLib.pro @@ -22,7 +22,6 @@ DEFINES += DONT_WRITE_EMBEDDED_FONTS #BOOST include($$PWD/../../../../Common/3dParty/boost/boost.pri) -!disable_precompiled_header:CONFIG += precompile_header precompile_header { PRECOMPILED_HEADER = precompiled.h HEADERS += precompiled.h diff --git a/OOXML/Projects/Linux/XlsbFormatLib/xlsb_format_logic.cpp b/OOXML/Projects/Linux/XlsbFormatLib/xlsb_format_logic.cpp index b72b6cc886..061e8c9424 100644 --- a/OOXML/Projects/Linux/XlsbFormatLib/xlsb_format_logic.cpp +++ b/OOXML/Projects/Linux/XlsbFormatLib/xlsb_format_logic.cpp @@ -118,7 +118,6 @@ #include "../../../XlsbFormat/Biff12_records/EndIconSet.cpp" #include "../../../XlsbFormat/Biff12_records/BeginDatabar.cpp" #include "../../../XlsbFormat/Biff12_records/EndDatabar.cpp" - #include "../../../XlsbFormat/Biff12_records/Color.cpp" #include "../../../XlsbFormat/Biff12_records/BeginColorScale.cpp" #include "../../../XlsbFormat/Biff12_records/EndColorScale.cpp" #include "../../../XlsbFormat/Biff12_records/CFRuleExt.cpp" @@ -685,14 +684,11 @@ #include "../../../XlsbFormat/Biff12_structures/CodeName.cpp" #include "../../../XlsbFormat/Biff12_structures/ACProductVersion.cpp" #include "../../../XlsbFormat/Biff12_structures/FRTProductVersion.cpp" - #include "../../../XlsbFormat/Biff12_structures/RelID.cpp" #include "../../../XlsbFormat/Biff12_structures/BookProtectionFlags.cpp" - #include "../../../XlsbFormat/Biff12_structures/ColSpan.cpp" #include "../../../XlsbFormat/Biff12_structures/Cell.cpp" #include "../../../XlsbFormat/Biff12_structures/GrbitFmla.cpp" #include "../../../XlsbFormat/Biff12_structures/SxOs.cpp" #include "../../../XlsbFormat/Biff12_structures/SxSu.cpp" - #include "../../../XlsbFormat/Biff12_structures/UncheckedSqRfX.cpp" #include "../../../XlsbFormat/Biff12_structures/CFType.cpp" #include "../../../XlsbFormat/Biff12_structures/CFTemp.cpp" #include "../../../XlsbFormat/Biff12_structures/CFOper.cpp" @@ -706,19 +702,9 @@ #include "../../../XlsbFormat/Biff12_structures/PhRun.cpp" #include "../../../XlsbFormat/Biff12_structures/GradientStop.cpp" #include "../../../XlsbFormat/Biff12_structures/Blxf.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTHeader.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTRefs.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTRef.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTSqrefs.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTSqref.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTFormulas.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTFormula.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTParsedFormula.cpp" - #include "../../../XlsbFormat/Biff12_structures/FRTRelID.cpp" #include "../../../XlsbFormat/Biff12_structures/ListType.cpp" #include "../../../XlsbFormat/Biff12_structures/XmlDataType.cpp" #include "../../../XlsbFormat/Biff12_structures/ListTotalRowFunction.cpp" - #include "../../../XlsbFormat/Biff12_structures/DValStrings.cpp" #include "../../../XlsbFormat/Biff12_structures/DBType.cpp" #include "../../../XlsbFormat/Biff12_structures/CmdType.cpp" #include "../../../XlsbFormat/Biff12_structures/PCDISrvFmt.cpp" diff --git a/OOXML/Projects/Windows/XlsbFormatLib/XlsbFormatLib.vcxproj b/OOXML/Projects/Windows/XlsbFormatLib/XlsbFormatLib.vcxproj index b1b6468af3..271bea59a0 100644 --- a/OOXML/Projects/Windows/XlsbFormatLib/XlsbFormatLib.vcxproj +++ b/OOXML/Projects/Windows/XlsbFormatLib/XlsbFormatLib.vcxproj @@ -276,7 +276,6 @@ - @@ -664,26 +663,15 @@ - - - - - - - - - - - @@ -703,7 +691,6 @@ - @@ -717,7 +704,6 @@ - @@ -1309,7 +1295,6 @@ - @@ -1692,8 +1677,6 @@ - - @@ -1703,26 +1686,15 @@ - - - - - - - - - - - @@ -1742,7 +1714,6 @@ - @@ -1756,8 +1727,6 @@ - - diff --git a/OOXML/Projects/Windows/XlsbFormatLib/XlsbFormatLib.vcxproj.filters b/OOXML/Projects/Windows/XlsbFormatLib/XlsbFormatLib.vcxproj.filters index 288b5498ce..b0c46a27e4 100644 --- a/OOXML/Projects/Windows/XlsbFormatLib/XlsbFormatLib.vcxproj.filters +++ b/OOXML/Projects/Windows/XlsbFormatLib/XlsbFormatLib.vcxproj.filters @@ -783,9 +783,6 @@ records - - records - records @@ -1947,9 +1944,6 @@ structures - - structures - structures @@ -1959,9 +1953,6 @@ structures - - structures - structures @@ -1977,36 +1968,9 @@ structures - - structures - - - structures - - - structures - - - structures - structures - - structures - - - structures - - - structures - - - structures - - - structures - structures @@ -2064,9 +2028,6 @@ structures - - structures - structures @@ -2106,9 +2067,6 @@ structures - - structures - structures @@ -3846,9 +3804,6 @@ records - - records - records @@ -4995,12 +4950,6 @@ structures - - structures - - - structures - structures @@ -5028,9 +4977,6 @@ structures - - structures - structures @@ -5040,9 +4986,6 @@ structures - - structures - structures @@ -5058,36 +5001,9 @@ structures - - structures - - - structures - - - structures - - - structures - structures - - structures - - - structures - - - structures - - - structures - - - structures - structures @@ -5145,9 +5061,6 @@ structures - - structures - structures @@ -5187,12 +5100,6 @@ structures - - structures - - - structures - structures diff --git a/OOXML/XlsbFormat/Biff12_records/AFilterDateGroupItem.h b/OOXML/XlsbFormat/Biff12_records/AFilterDateGroupItem.h index 4ff9566cc3..54166e6b0d 100644 --- a/OOXML/XlsbFormat/Biff12_records/AFilterDateGroupItem.h +++ b/OOXML/XlsbFormat/Biff12_records/AFilterDateGroupItem.h @@ -33,7 +33,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/AbsPath15.h b/OOXML/XlsbFormat/Biff12_records/AbsPath15.h index a5ea2ddc9a..4ec20906d6 100644 --- a/OOXML/XlsbFormat/Biff12_records/AbsPath15.h +++ b/OOXML/XlsbFormat/Biff12_records/AbsPath15.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/ActiveX.h b/OOXML/XlsbFormat/Biff12_records/ActiveX.h index ddfc2323c3..d3fb2f6c52 100644 --- a/OOXML/XlsbFormat/Biff12_records/ActiveX.h +++ b/OOXML/XlsbFormat/Biff12_records/ActiveX.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" -#include "../Biff12_structures/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginAFilter.h b/OOXML/XlsbFormat/Biff12_records/BeginAFilter.h index 18d606d436..c030d21a15 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginAFilter.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginAFilter.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginAutoSortScope.h b/OOXML/XlsbFormat/Biff12_records/BeginAutoSortScope.h index 057923cf5e..dcbac3cef3 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginAutoSortScope.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginAutoSortScope.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginCFRule.h b/OOXML/XlsbFormat/Biff12_records/BeginCFRule.h index a5134c4e0c..bec36f246b 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginCFRule.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginCFRule.h @@ -31,14 +31,13 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - #include "../Biff12_structures/CFType.h" #include "../Biff12_structures/CFTemp.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/DXFId.h" -#include "../Biff12_structures/XLWideString.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFParsedFormula.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/DXFId.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFParsedFormula.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginCFRule14.h b/OOXML/XlsbFormat/Biff12_records/BeginCFRule14.h index fee2f4aab0..0ffa37f1a8 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginCFRule14.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginCFRule14.h @@ -36,10 +36,10 @@ #include "../Biff12_structures/CFType.h" #include "../Biff12_structures/CFTemp.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/DXFId.h" -#include "../Biff12_structures/XLWideString.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFParsedFormula.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/DXFId.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFParsedFormula.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginComment.h b/OOXML/XlsbFormat/Biff12_records/BeginComment.h index 944be0f521..e60eb564c2 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginComment.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginComment.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginConditionalFormatting.h b/OOXML/XlsbFormat/Biff12_records/BeginConditionalFormatting.h index 0266b1489b..137465ce21 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginConditionalFormatting.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginConditionalFormatting.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/UncheckedSqRfX.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/UncheckedSqRfX.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginConditionalFormatting14.h b/OOXML/XlsbFormat/Biff12_records/BeginConditionalFormatting14.h index 4efe77ae8d..658c04a5b0 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginConditionalFormatting14.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginConditionalFormatting14.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginDataFeedPr15.h b/OOXML/XlsbFormat/Biff12_records/BeginDataFeedPr15.h index 568a1cca80..5f28d4f82e 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginDataFeedPr15.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginDataFeedPr15.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginDeletedName.h b/OOXML/XlsbFormat/Biff12_records/BeginDeletedName.h index 64d0353b8b..1a813e64b4 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginDeletedName.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginDeletedName.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginDim.h b/OOXML/XlsbFormat/Biff12_records/BeginDim.h index 99940e9c8f..9601b6a320 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginDim.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginDim.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginECDbProps.h b/OOXML/XlsbFormat/Biff12_records/BeginECDbProps.h index c31b4699b1..85b8fc39e4 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginECDbProps.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginECDbProps.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/CmdType.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginECOlapProps.h b/OOXML/XlsbFormat/Biff12_records/BeginECOlapProps.h index 5ef96da3ae..3b10af5817 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginECOlapProps.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginECOlapProps.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/DBType.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginECParam.h b/OOXML/XlsbFormat/Biff12_records/BeginECParam.h index f0ed67bcb1..c56b243dda 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginECParam.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginECParam.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" #include "../Biff12_structures/ParameterParsedFormula.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginECTxtWiz.h b/OOXML/XlsbFormat/Biff12_records/BeginECTxtWiz.h index 6f0de3a47a..26fa4d5228 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginECTxtWiz.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginECTxtWiz.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/ECTxtWizData.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginECTxtWiz15.h b/OOXML/XlsbFormat/Biff12_records/BeginECTxtWiz15.h index 3e06661eeb..4af0a4f1ac 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginECTxtWiz15.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginECTxtWiz15.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/ECTxtWizData.h" -#include "../Biff12_structures/XLWideString.h" #include "../Biff12_structures/FRTBlank.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginECWebProps.h b/OOXML/XlsbFormat/Biff12_records/BeginECWebProps.h index c3c5464534..ec150475e7 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginECWebProps.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginECWebProps.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginExtConn14.h b/OOXML/XlsbFormat/Biff12_records/BeginExtConn14.h index 5206c9de90..e38499cccc 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginExtConn14.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginExtConn14.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginExtConn15.h b/OOXML/XlsbFormat/Biff12_records/BeginExtConn15.h index 39fa02d759..ecc2545a74 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginExtConn15.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginExtConn15.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginExtConnection.h b/OOXML/XlsbFormat/Biff12_records/BeginExtConnection.h index 67e013bb16..b85ecc91c8 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginExtConnection.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginExtConnection.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/DBType.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginHeaderFooter.h b/OOXML/XlsbFormat/Biff12_records/BeginHeaderFooter.h index ce1808a58c..accf8399c9 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginHeaderFooter.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginHeaderFooter.h @@ -31,13 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "../Biff12_structures/CellRangeRef.h" -#include "../Biff12_structures/RelID.h" -#include "../Biff12_structures/XLWideString.h" #include "../../XlsxFormat/WritingElement.h" - - +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginList.h b/OOXML/XlsbFormat/Biff12_records/BeginList.h index c59d820338..161b223ba1 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginList.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginList.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CellRangeRef.h" #include "../Biff12_structures/ListType.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginListCol.h b/OOXML/XlsbFormat/Biff12_records/BeginListCol.h index 35a1f3b967..4865acf9ff 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginListCol.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginListCol.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/ListTotalRowFunction.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginListCols.h b/OOXML/XlsbFormat/Biff12_records/BeginListCols.h index f686e7b730..5d22e256fb 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginListCols.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginListCols.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/ListTotalRowFunction.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginListXmlCPr.h b/OOXML/XlsbFormat/Biff12_records/BeginListXmlCPr.h index 06cdd80630..e10672f3f0 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginListXmlCPr.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginListXmlCPr.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/XmlDataType.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginMG.h b/OOXML/XlsbFormat/Biff12_records/BeginMG.h index 94a45fea09..aaf1dab09e 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginMG.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginMG.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginOledbPr15.h b/OOXML/XlsbFormat/Biff12_records/BeginOledbPr15.h index dfaaca1f33..a9666835b6 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginOledbPr15.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginOledbPr15.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDCalcMem14.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDCalcMem14.h index 1956e6aac9..8fc8766e37 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDCalcMem14.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDCalcMem14.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDFGroup.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDFGroup.h index dce6bce711..53d4b43eb2 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDFGroup.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDFGroup.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PivotParsedFormula.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDField.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDField.h index a98e34264e..d46ac0d83d 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDField.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDField.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/PivotParsedFormula.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLGMember.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLGMember.h index 38eb4d9b21..c21005ba9b 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLGMember.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLGMember.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLGroup.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLGroup.h index 80c30b796d..a9da0a569f 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLGroup.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLGroup.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLevel.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLevel.h index 7586809910..e77b1cf0f8 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLevel.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDHGLevel.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDHierarchy.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDHierarchy.h index 03249c2434..201254b7a8 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDHierarchy.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDHierarchy.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDIRun.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDIRun.h index 1cb2e7864c..a12d47ff5b 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDIRun.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDIRun.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" #include "../Biff12_structures/PCDIDateTime.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDKPI.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDKPI.h index f3164d5bc0..6105e41c72 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDKPI.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDKPI.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDSCPItem.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDSCPItem.h index 33be3dd2d8..b82b1936e3 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDSCPItem.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDSCPItem.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDSCSet.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDSCSet.h index 0b7297f946..2bcfc582f1 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDSCSet.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDSCSet.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" -#include "../Biff12_structures/RelID.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDSDTCQuery.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDSDTCQuery.h index b5aa5cbf18..de0de1d036 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDSDTCQuery.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDSDTCQuery.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDSDTCSet.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDSDTCSet.h index 5ec2cb067a..0c03bad33b 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDSDTCSet.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDSDTCSet.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/SdSetSortOrder.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPCDSRange.h b/OOXML/XlsbFormat/Biff12_records/BeginPCDSRange.h index 36e5ddef76..5d59d69e6d 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPCDSRange.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPCDSRange.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" -#include "../Biff12_structures/RelID.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPivotCacheDef.h b/OOXML/XlsbFormat/Biff12_records/BeginPivotCacheDef.h index b9bb1c06ed..97e4edf440 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPivotCacheDef.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPivotCacheDef.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/RelID.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12//RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPivotCacheID.h b/OOXML/XlsbFormat/Biff12_records/BeginPivotCacheID.h index 90028890b5..dbd5771b78 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPivotCacheID.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPivotCacheID.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "../Biff12_structures/RelID.h" #include "../../XlsxFormat/WritingElement.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12//RelID.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginPivotTableUISettings.h b/OOXML/XlsbFormat/Biff12_records/BeginPivotTableUISettings.h index 048a042ff6..4402bba514 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginPivotTableUISettings.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginPivotTableUISettings.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginRichSortCondition.h b/OOXML/XlsbFormat/Biff12_records/BeginRichSortCondition.h index f677660e0c..ecaeaf31b5 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginRichSortCondition.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginRichSortCondition.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXChange.h b/OOXML/XlsbFormat/Biff12_records/BeginSXChange.h index 1155a309a2..a780d6d9ef 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXChange.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXChange.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" #include "../Biff12_structures/SXMA.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXDI.h b/OOXML/XlsbFormat/Biff12_records/BeginSXDI.h index ccfb05a327..bc23afce42 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXDI.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXDI.h @@ -31,12 +31,12 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/DataConsolidationFunction.h" #include "../Biff12_structures/ShowDataAs.h" #include "../Biff12_structures/PivotNumFmt.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXEdit.h b/OOXML/XlsbFormat/Biff12_records/BeginSXEdit.h index b2400e1341..3e5a734669 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXEdit.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXEdit.h @@ -31,13 +31,13 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/FRTHeader.h" -#include "../Biff12_structures/SXET.h" -#include "../Biff12_structures/XLWideString.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" #include "../Biff12_structures/PCDIDateTime.h" +#include "../Biff12_structures/SXET.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXFilter.h b/OOXML/XlsbFormat/Biff12_records/BeginSXFilter.h index db94f50a59..9bc44ba292 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXFilter.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXFilter.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXLocation.h b/OOXML/XlsbFormat/Biff12_records/BeginSXLocation.h index 9121891451..72a08fa325 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXLocation.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXLocation.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXPI.h b/OOXML/XlsbFormat/Biff12_records/BeginSXPI.h index da4b57a509..f2c6ab120d 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXPI.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXPI.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXTDMP.h b/OOXML/XlsbFormat/Biff12_records/BeginSXTDMP.h index 3f208a401b..a3daad9b1a 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXTDMP.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXTDMP.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXTH.h b/OOXML/XlsbFormat/Biff12_records/BeginSXTH.h index d5145926d1..13adae1161 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXTH.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXTH.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXTHItem.h b/OOXML/XlsbFormat/Biff12_records/BeginSXTHItem.h index bf7f21f4f6..c8b0704d84 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXTHItem.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXTHItem.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXVD.h b/OOXML/XlsbFormat/Biff12_records/BeginSXVD.h index 37316978ec..4c344ac800 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXVD.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXVD.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/SxAxis.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXVDs.h b/OOXML/XlsbFormat/Biff12_records/BeginSXVDs.h index f26c08d422..aaab2f02a8 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXVDs.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXVDs.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXVI.h b/OOXML/XlsbFormat/Biff12_records/BeginSXVI.h index 40b7baf31e..e21debde29 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXVI.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXVI.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" #include "../Biff12_structures/PivotItemType.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXVIs.h b/OOXML/XlsbFormat/Biff12_records/BeginSXVIs.h index 6e86d56ea3..83e109bc37 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXVIs.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXVIs.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXView.h b/OOXML/XlsbFormat/Biff12_records/BeginSXView.h index 70b39e8308..2ffa42efb6 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXView.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXView.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSXView14.h b/OOXML/XlsbFormat/Biff12_records/BeginSXView14.h index 69512ac371..9093c3a0f8 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSXView14.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSXView14.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" #include "../Biff12_structures/SXMA.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSlicer.h b/OOXML/XlsbFormat/Biff12_records/BeginSlicer.h index 4cee2355b9..11cbd4b38f 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSlicer.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSlicer.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheDef.h b/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheDef.h index 3168da5175..3443079e35 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheDef.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheDef.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheID.h b/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheID.h index 2d2a9cc240..ab6228bc0c 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheID.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheID.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheLevelData.h b/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheLevelData.h index 1c9a67f641..4a332c969c 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheLevelData.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSlicerCacheLevelData.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSlicerCachesPivotCacheID.h b/OOXML/XlsbFormat/Biff12_records/BeginSlicerCachesPivotCacheID.h index 2035bf75ed..b03800fc83 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSlicerCachesPivotCacheID.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSlicerCachesPivotCacheID.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12//FRTHeader.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSlicerEx.h b/OOXML/XlsbFormat/Biff12_records/BeginSlicerEx.h index 2b396793dd..bfb2079e27 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSlicerEx.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSlicerEx.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSlicerStyle.h b/OOXML/XlsbFormat/Biff12_records/BeginSlicerStyle.h index 31f9b55981..de91084b7c 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSlicerStyle.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSlicerStyle.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSlicerStyles.h b/OOXML/XlsbFormat/Biff12_records/BeginSlicerStyles.h index 3131fe62eb..54b9924c3e 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSlicerStyles.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSlicerStyles.h @@ -31,12 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" - - +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSortCond.h b/OOXML/XlsbFormat/Biff12_records/BeginSortCond.h index d51bbf61f5..72295c08e0 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSortCond.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSortCond.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "../Biff12_structures/XLWideString.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSortCond14.h b/OOXML/XlsbFormat/Biff12_records/BeginSortCond14.h index e09d34f075..b88d31d6a6 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSortCond14.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSortCond14.h @@ -31,11 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/XLWideString.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSparklineGroup.h b/OOXML/XlsbFormat/Biff12_records/BeginSparklineGroup.h index beca01c1ac..2321bd151d 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSparklineGroup.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSparklineGroup.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/FRTHeader.h" -#include "../Biff12_records/Color.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSupBook.cpp b/OOXML/XlsbFormat/Biff12_records/BeginSupBook.cpp index fd0a037a8f..25e7d9dc88 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSupBook.cpp +++ b/OOXML/XlsbFormat/Biff12_records/BeginSupBook.cpp @@ -31,8 +31,8 @@ */ #include "BeginSupBook.h" -#include "../Biff12_structures/RelID.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" using namespace XLS; diff --git a/OOXML/XlsbFormat/Biff12_records/BeginSxvcells.h b/OOXML/XlsbFormat/Biff12_records/BeginSxvcells.h index f929564e34..4f22d2b18d 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginSxvcells.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginSxvcells.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" #include "../Biff12_structures/SXMA.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginTimelineStyle.h b/OOXML/XlsbFormat/Biff12_records/BeginTimelineStyle.h index 08a3f44a8f..7da4409d87 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginTimelineStyle.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginTimelineStyle.h @@ -31,12 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" - - +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BeginTimelineStyles.h b/OOXML/XlsbFormat/Biff12_records/BeginTimelineStyles.h index 2c8044a2e1..7a43369ce3 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginTimelineStyles.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginTimelineStyles.h @@ -31,11 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" - +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/BeginWebPubItem.h b/OOXML/XlsbFormat/Biff12_records/BeginWebPubItem.h index 3c51008017..66edbabc2e 100644 --- a/OOXML/XlsbFormat/Biff12_records/BeginWebPubItem.h +++ b/OOXML/XlsbFormat/Biff12_records/BeginWebPubItem.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/Tws.h" -#include "../Biff12_structures/CellRangeRef.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BkHim.h b/OOXML/XlsbFormat/Biff12_records/BkHim.h index 059532a9a9..1ce55213bf 100644 --- a/OOXML/XlsbFormat/Biff12_records/BkHim.h +++ b/OOXML/XlsbFormat/Biff12_records/BkHim.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/BundleSh.h b/OOXML/XlsbFormat/Biff12_records/BundleSh.h index 5f89df09d6..68e7c110fc 100644 --- a/OOXML/XlsbFormat/Biff12_records/BundleSh.h +++ b/OOXML/XlsbFormat/Biff12_records/BundleSh.h @@ -31,13 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/XLWideString.h" -#include "../Biff12_structures/RelID.h" - - +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/CFVO14.h b/OOXML/XlsbFormat/Biff12_records/CFVO14.h index 5926f55dba..4659ca3135 100644 --- a/OOXML/XlsbFormat/Biff12_records/CFVO14.h +++ b/OOXML/XlsbFormat/Biff12_records/CFVO14.h @@ -31,13 +31,12 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - #include "../Biff12_structures/CFVOType14.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFVOParsedFormula.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CFVOParsedFormula.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Cell.h b/OOXML/XlsbFormat/Biff12_records/Cell.h index cdba24f27c..d97721b545 100644 --- a/OOXML/XlsbFormat/Biff12_records/Cell.h +++ b/OOXML/XlsbFormat/Biff12_records/Cell.h @@ -35,7 +35,7 @@ #include "../Biff12_structures/Cell.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Color14.h b/OOXML/XlsbFormat/Biff12_records/Color14.h index 0e227077e2..eb45e5ce94 100644 --- a/OOXML/XlsbFormat/Biff12_records/Color14.h +++ b/OOXML/XlsbFormat/Biff12_records/Color14.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "Color.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" diff --git a/OOXML/XlsbFormat/Biff12_records/CommentAuthor.h b/OOXML/XlsbFormat/Biff12_records/CommentAuthor.h index 09264e197f..2805fb5aeb 100644 --- a/OOXML/XlsbFormat/Biff12_records/CommentAuthor.h +++ b/OOXML/XlsbFormat/Biff12_records/CommentAuthor.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" diff --git a/OOXML/XlsbFormat/Biff12_records/CommonRecords.h b/OOXML/XlsbFormat/Biff12_records/CommonRecords.h index 16383ed93d..c8ecbed5cf 100644 --- a/OOXML/XlsbFormat/Biff12_records/CommonRecords.h +++ b/OOXML/XlsbFormat/Biff12_records/CommonRecords.h @@ -58,7 +58,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsi.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsir.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/Qsif.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" #include "../../XlsxFormat/WritingElement.h" diff --git a/OOXML/XlsbFormat/Biff12_records/CsProp.h b/OOXML/XlsbFormat/Biff12_records/CsProp.h index 12f762abf0..01e5864be0 100644 --- a/OOXML/XlsbFormat/Biff12_records/CsProp.h +++ b/OOXML/XlsbFormat/Biff12_records/CsProp.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_records/Color.h" #include "../Biff12_structures/CodeName.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/CustomFilter.h b/OOXML/XlsbFormat/Biff12_records/CustomFilter.h index 4090a31b7a..2319197c19 100644 --- a/OOXML/XlsbFormat/Biff12_records/CustomFilter.h +++ b/OOXML/XlsbFormat/Biff12_records/CustomFilter.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/CustomFilter14.h b/OOXML/XlsbFormat/Biff12_records/CustomFilter14.h index f8604bb62a..0535f36d29 100644 --- a/OOXML/XlsbFormat/Biff12_records/CustomFilter14.h +++ b/OOXML/XlsbFormat/Biff12_records/CustomFilter14.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/CustomRichFilter.h b/OOXML/XlsbFormat/Biff12_records/CustomRichFilter.h index e51b59977c..9534e561f8 100644 --- a/OOXML/XlsbFormat/Biff12_records/CustomRichFilter.h +++ b/OOXML/XlsbFormat/Biff12_records/CustomRichFilter.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/DRef.h b/OOXML/XlsbFormat/Biff12_records/DRef.h index 808326806e..f3f178076b 100644 --- a/OOXML/XlsbFormat/Biff12_records/DRef.h +++ b/OOXML/XlsbFormat/Biff12_records/DRef.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" -#include "../Biff12_structures/CellRangeRef.h" -#include "../Biff12_structures/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/DValList.h b/OOXML/XlsbFormat/Biff12_records/DValList.h index 4ad23bb83a..3206a03e55 100644 --- a/OOXML/XlsbFormat/Biff12_records/DValList.h +++ b/OOXML/XlsbFormat/Biff12_records/DValList.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/DbCommand15.h b/OOXML/XlsbFormat/Biff12_records/DbCommand15.h index ba577ad0cd..a905fd31c0 100644 --- a/OOXML/XlsbFormat/Biff12_records/DbCommand15.h +++ b/OOXML/XlsbFormat/Biff12_records/DbCommand15.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/DbTable15.h b/OOXML/XlsbFormat/Biff12_records/DbTable15.h index 757bb15a0f..501504fdd6 100644 --- a/OOXML/XlsbFormat/Biff12_records/DbTable15.h +++ b/OOXML/XlsbFormat/Biff12_records/DbTable15.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Drawing.h b/OOXML/XlsbFormat/Biff12_records/Drawing.h index 05c5fb7b64..2846d4403c 100644 --- a/OOXML/XlsbFormat/Biff12_records/Drawing.h +++ b/OOXML/XlsbFormat/Biff12_records/Drawing.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/DynamicFilter.h b/OOXML/XlsbFormat/Biff12_records/DynamicFilter.h index d435db35bc..081e28ca5d 100644 --- a/OOXML/XlsbFormat/Biff12_records/DynamicFilter.h +++ b/OOXML/XlsbFormat/Biff12_records/DynamicFilter.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/DynamicRichFilter.h b/OOXML/XlsbFormat/Biff12_records/DynamicRichFilter.h index 97d1f12946..3bde07a580 100644 --- a/OOXML/XlsbFormat/Biff12_records/DynamicRichFilter.h +++ b/OOXML/XlsbFormat/Biff12_records/DynamicRichFilter.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/EndISXTHRws.h b/OOXML/XlsbFormat/Biff12_records/EndISXTHRws.h index f207300f6a..1e40001e7e 100644 --- a/OOXML/XlsbFormat/Biff12_records/EndISXTHRws.h +++ b/OOXML/XlsbFormat/Biff12_records/EndISXTHRws.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/EndISXVDRws.h b/OOXML/XlsbFormat/Biff12_records/EndISXVDRws.h index c2a4ad002b..ca23bbe987 100644 --- a/OOXML/XlsbFormat/Biff12_records/EndISXVDRws.h +++ b/OOXML/XlsbFormat/Biff12_records/EndISXVDRws.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/ExternCell.h b/OOXML/XlsbFormat/Biff12_records/ExternCell.h index 4174c0239b..04b4e430eb 100644 --- a/OOXML/XlsbFormat/Biff12_records/ExternCell.h +++ b/OOXML/XlsbFormat/Biff12_records/ExternCell.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/FieldListActiveItem.h b/OOXML/XlsbFormat/Biff12_records/FieldListActiveItem.h index ba5eeb225d..841e2bade5 100644 --- a/OOXML/XlsbFormat/Biff12_records/FieldListActiveItem.h +++ b/OOXML/XlsbFormat/Biff12_records/FieldListActiveItem.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/FileSharingIso.h b/OOXML/XlsbFormat/Biff12_records/FileSharingIso.h index bb084f58dd..e51fb7564e 100644 --- a/OOXML/XlsbFormat/Biff12_records/FileSharingIso.h +++ b/OOXML/XlsbFormat/Biff12_records/FileSharingIso.h @@ -32,10 +32,9 @@ #pragma once #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/XLWideString.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Boolean.h" #include "../Biff12_structures/IsoPasswordData.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Boolean.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/FileVersion.h b/OOXML/XlsbFormat/Biff12_records/FileVersion.h index 3d354f018d..e13041951b 100644 --- a/OOXML/XlsbFormat/Biff12_records/FileVersion.h +++ b/OOXML/XlsbFormat/Biff12_records/FileVersion.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/Fill.h b/OOXML/XlsbFormat/Biff12_records/Fill.h index 6f7aec1e8e..932f05f22d 100644 --- a/OOXML/XlsbFormat/Biff12_records/Fill.h +++ b/OOXML/XlsbFormat/Biff12_records/Fill.h @@ -32,9 +32,9 @@ #pragma once #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "Color.h" #include "../Biff12_structures/GradientStop.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" diff --git a/OOXML/XlsbFormat/Biff12_records/Filter.h b/OOXML/XlsbFormat/Biff12_records/Filter.h index 2f0e85061a..bf49256db7 100644 --- a/OOXML/XlsbFormat/Biff12_records/Filter.h +++ b/OOXML/XlsbFormat/Biff12_records/Filter.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Filter14.h b/OOXML/XlsbFormat/Biff12_records/Filter14.h index a744937a9c..3d3ef0e142 100644 --- a/OOXML/XlsbFormat/Biff12_records/Filter14.h +++ b/OOXML/XlsbFormat/Biff12_records/Filter14.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Fmla.h b/OOXML/XlsbFormat/Biff12_records/Fmla.h index 85695104a0..f8cf568be4 100644 --- a/OOXML/XlsbFormat/Biff12_records/Fmla.h +++ b/OOXML/XlsbFormat/Biff12_records/Fmla.h @@ -31,14 +31,13 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - #include "../Biff12_structures/Cell.h" -#include "../Biff12_structures/XLWideString.h" #include "../Biff12_structures/GrbitFmla.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CellParsedFormula.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CellParsedFormula.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/Fmt.h b/OOXML/XlsbFormat/Biff12_records/Fmt.h index 0e616676a2..7602249152 100644 --- a/OOXML/XlsbFormat/Biff12_records/Fmt.h +++ b/OOXML/XlsbFormat/Biff12_records/Fmt.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/FnGroup.h b/OOXML/XlsbFormat/Biff12_records/FnGroup.h index 9c0ca77bbd..ed946bad2a 100644 --- a/OOXML/XlsbFormat/Biff12_records/FnGroup.h +++ b/OOXML/XlsbFormat/Biff12_records/FnGroup.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/HLink.h b/OOXML/XlsbFormat/Biff12_records/HLink.h index 1660ec96eb..5ec9db5c59 100644 --- a/OOXML/XlsbFormat/Biff12_records/HLink.h +++ b/OOXML/XlsbFormat/Biff12_records/HLink.h @@ -31,11 +31,13 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "../Biff12_structures/CellRangeRef.h" -#include "../Biff12_structures/RelID.h" -#include "../Biff12_structures/XLWideString.h" #include "../../XlsxFormat/WritingElement.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" + + diff --git a/OOXML/XlsbFormat/Biff12_records/ItemUniqueName.h b/OOXML/XlsbFormat/Biff12_records/ItemUniqueName.h index 97f6cdc23f..61ce7a7a3a 100644 --- a/OOXML/XlsbFormat/Biff12_records/ItemUniqueName.h +++ b/OOXML/XlsbFormat/Biff12_records/ItemUniqueName.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" #include "../Biff12_structures/FRTBlank.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/LegacyDrawing.h b/OOXML/XlsbFormat/Biff12_records/LegacyDrawing.h index d870172922..3a87c17dcc 100644 --- a/OOXML/XlsbFormat/Biff12_records/LegacyDrawing.h +++ b/OOXML/XlsbFormat/Biff12_records/LegacyDrawing.h @@ -31,11 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/RelID.h" - +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/LegacyDrawingHF.h b/OOXML/XlsbFormat/Biff12_records/LegacyDrawingHF.h index 6c3f479724..630b1aac45 100644 --- a/OOXML/XlsbFormat/Biff12_records/LegacyDrawingHF.h +++ b/OOXML/XlsbFormat/Biff12_records/LegacyDrawingHF.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/List14.h b/OOXML/XlsbFormat/Biff12_records/List14.h index 7cc972a436..87866f3514 100644 --- a/OOXML/XlsbFormat/Biff12_records/List14.h +++ b/OOXML/XlsbFormat/Biff12_records/List14.h @@ -33,8 +33,8 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" #include "../Biff12_structures/FRTBlank.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/ListPart.h b/OOXML/XlsbFormat/Biff12_records/ListPart.h index 14ecb25125..abb2e77814 100644 --- a/OOXML/XlsbFormat/Biff12_records/ListPart.h +++ b/OOXML/XlsbFormat/Biff12_records/ListPart.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/MRUColor.h b/OOXML/XlsbFormat/Biff12_records/MRUColor.h index da69d18e2f..c613a8d138 100644 --- a/OOXML/XlsbFormat/Biff12_records/MRUColor.h +++ b/OOXML/XlsbFormat/Biff12_records/MRUColor.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "Color.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" diff --git a/OOXML/XlsbFormat/Biff12_records/MergeCell.h b/OOXML/XlsbFormat/Biff12_records/MergeCell.h index 001d5f5157..f3cd412439 100644 --- a/OOXML/XlsbFormat/Biff12_records/MergeCell.h +++ b/OOXML/XlsbFormat/Biff12_records/MergeCell.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/OleObject.h b/OOXML/XlsbFormat/Biff12_records/OleObject.h index 940c5dba75..dbc2e3ecee 100644 --- a/OOXML/XlsbFormat/Biff12_records/OleObject.h +++ b/OOXML/XlsbFormat/Biff12_records/OleObject.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" -#include "../Biff12_structures/RelID.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/ObjectParsedFormula.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/OleSize.h b/OOXML/XlsbFormat/Biff12_records/OleSize.h index 15643a5a89..d9a1532db7 100644 --- a/OOXML/XlsbFormat/Biff12_records/OleSize.h +++ b/OOXML/XlsbFormat/Biff12_records/OleSize.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/PCDCalcMem15.h b/OOXML/XlsbFormat/Biff12_records/PCDCalcMem15.h index 677a9e0971..8098763990 100644 --- a/OOXML/XlsbFormat/Biff12_records/PCDCalcMem15.h +++ b/OOXML/XlsbFormat/Biff12_records/PCDCalcMem15.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/PCDField14.h b/OOXML/XlsbFormat/Biff12_records/PCDField14.h index 1873b345ba..e26fc3faca 100644 --- a/OOXML/XlsbFormat/Biff12_records/PCDField14.h +++ b/OOXML/XlsbFormat/Biff12_records/PCDField14.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/PCDH14.h b/OOXML/XlsbFormat/Biff12_records/PCDH14.h index 07b4d88eba..a72433f0c4 100644 --- a/OOXML/XlsbFormat/Biff12_records/PCDH14.h +++ b/OOXML/XlsbFormat/Biff12_records/PCDH14.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/PCDIAString.h b/OOXML/XlsbFormat/Biff12_records/PCDIAString.h index 17d9ef2389..4a599f9094 100644 --- a/OOXML/XlsbFormat/Biff12_records/PCDIAString.h +++ b/OOXML/XlsbFormat/Biff12_records/PCDIAString.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/PCDIAddlInfo.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/PCDIString.h b/OOXML/XlsbFormat/Biff12_records/PCDIString.h index e0ee069c36..5006515495 100644 --- a/OOXML/XlsbFormat/Biff12_records/PCDIString.h +++ b/OOXML/XlsbFormat/Biff12_records/PCDIString.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/PCDISrvFmt.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/PCDSFCIEntry.h b/OOXML/XlsbFormat/Biff12_records/PCDSFCIEntry.h index bf146230d3..c6a17abe68 100644 --- a/OOXML/XlsbFormat/Biff12_records/PCDSFCIEntry.h +++ b/OOXML/XlsbFormat/Biff12_records/PCDSFCIEntry.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/PCRRecord.cpp b/OOXML/XlsbFormat/Biff12_records/PCRRecord.cpp index 7e088271a5..30fc17c2d1 100644 --- a/OOXML/XlsbFormat/Biff12_records/PCRRecord.cpp +++ b/OOXML/XlsbFormat/Biff12_records/PCRRecord.cpp @@ -31,9 +31,9 @@ */ #include "PCRRecord.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" #include "../Biff12_structures/PCDIDateTime.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" using namespace XLS; diff --git a/OOXML/XlsbFormat/Biff12_records/PivotCacheConnectionName.h b/OOXML/XlsbFormat/Biff12_records/PivotCacheConnectionName.h index 792ec91df9..c3b6e0b23a 100644 --- a/OOXML/XlsbFormat/Biff12_records/PivotCacheConnectionName.h +++ b/OOXML/XlsbFormat/Biff12_records/PivotCacheConnectionName.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/PlaceholderName.h b/OOXML/XlsbFormat/Biff12_records/PlaceholderName.h index f7cd83bba8..a28cf97b15 100644 --- a/OOXML/XlsbFormat/Biff12_records/PlaceholderName.h +++ b/OOXML/XlsbFormat/Biff12_records/PlaceholderName.h @@ -31,10 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_records/Qsi15.h b/OOXML/XlsbFormat/Biff12_records/Qsi15.h index 3775f37347..2ea9fc9bc8 100644 --- a/OOXML/XlsbFormat/Biff12_records/Qsi15.h +++ b/OOXML/XlsbFormat/Biff12_records/Qsi15.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" #include "../Biff12_structures/FRTBlank.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/RangePr15.h b/OOXML/XlsbFormat/Biff12_records/RangePr15.h index 0894c34810..a1420b27bf 100644 --- a/OOXML/XlsbFormat/Biff12_records/RangePr15.h +++ b/OOXML/XlsbFormat/Biff12_records/RangePr15.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/RangeProtection.h b/OOXML/XlsbFormat/Biff12_records/RangeProtection.h index 6f7b9bf0f8..0f7bc84559 100644 --- a/OOXML/XlsbFormat/Biff12_records/RangeProtection.h +++ b/OOXML/XlsbFormat/Biff12_records/RangeProtection.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/UncheckedSqRfX.h" #include "../Biff12_structures/RangeProtectionTitleSDRel.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/UncheckedSqRfX.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/RangeProtectionIso.h b/OOXML/XlsbFormat/Biff12_records/RangeProtectionIso.h index ecf9939e49..f1a8daf9ff 100644 --- a/OOXML/XlsbFormat/Biff12_records/RangeProtectionIso.h +++ b/OOXML/XlsbFormat/Biff12_records/RangeProtectionIso.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/UncheckedSqRfX.h" #include "../Biff12_structures/RangeProtectionTitleSDRel.h" #include "../Biff12_structures/IsoPasswordData.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/UncheckedSqRfX.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/RichFilter.h b/OOXML/XlsbFormat/Biff12_records/RichFilter.h index c2645ee6d1..e74ce17e89 100644 --- a/OOXML/XlsbFormat/Biff12_records/RichFilter.h +++ b/OOXML/XlsbFormat/Biff12_records/RichFilter.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/RichFilterDateGroupItem.h b/OOXML/XlsbFormat/Biff12_records/RichFilterDateGroupItem.h index ea63117516..d1516a224b 100644 --- a/OOXML/XlsbFormat/Biff12_records/RichFilterDateGroupItem.h +++ b/OOXML/XlsbFormat/Biff12_records/RichFilterDateGroupItem.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SXDI14.h b/OOXML/XlsbFormat/Biff12_records/SXDI14.h index e42fd5e62c..0e5c3e9b47 100644 --- a/OOXML/XlsbFormat/Biff12_records/SXDI14.h +++ b/OOXML/XlsbFormat/Biff12_records/SXDI14.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" #include "../Biff12_structures/ShowDataAs.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SXTupleItems.h b/OOXML/XlsbFormat/Biff12_records/SXTupleItems.h index 7725b3abda..5fc989d7b3 100644 --- a/OOXML/XlsbFormat/Biff12_records/SXTupleItems.h +++ b/OOXML/XlsbFormat/Biff12_records/SXTupleItems.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SXTupleSetHeaderItem.h b/OOXML/XlsbFormat/Biff12_records/SXTupleSetHeaderItem.h index 25d04c4b57..801323f10c 100644 --- a/OOXML/XlsbFormat/Biff12_records/SXTupleSetHeaderItem.h +++ b/OOXML/XlsbFormat/Biff12_records/SXTupleSetHeaderItem.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SXTupleSetRowItem.h b/OOXML/XlsbFormat/Biff12_records/SXTupleSetRowItem.h index 0a922e368f..3e81c92d72 100644 --- a/OOXML/XlsbFormat/Biff12_records/SXTupleSetRowItem.h +++ b/OOXML/XlsbFormat/Biff12_records/SXTupleSetRowItem.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/FRTBlank.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SlicerCacheOlapItem.h b/OOXML/XlsbFormat/Biff12_records/SlicerCacheOlapItem.h index 03e04da4fb..5d6b8f920b 100644 --- a/OOXML/XlsbFormat/Biff12_records/SlicerCacheOlapItem.h +++ b/OOXML/XlsbFormat/Biff12_records/SlicerCacheOlapItem.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SlicerCacheSelection.h b/OOXML/XlsbFormat/Biff12_records/SlicerCacheSelection.h index 476cbcbb24..e6acc5d341 100644 --- a/OOXML/XlsbFormat/Biff12_records/SlicerCacheSelection.h +++ b/OOXML/XlsbFormat/Biff12_records/SlicerCacheSelection.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Sparkline.h b/OOXML/XlsbFormat/Biff12_records/Sparkline.h index 2d6a9c4eb3..3476ac5298 100644 --- a/OOXML/XlsbFormat/Biff12_records/Sparkline.h +++ b/OOXML/XlsbFormat/Biff12_records/Sparkline.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Style.cpp b/OOXML/XlsbFormat/Biff12_records/Style.cpp index 65a572f742..a4953fab4c 100644 --- a/OOXML/XlsbFormat/Biff12_records/Style.cpp +++ b/OOXML/XlsbFormat/Biff12_records/Style.cpp @@ -31,7 +31,7 @@ */ #include "Style.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" using namespace XLS; diff --git a/OOXML/XlsbFormat/Biff12_records/SupBookSrc.h b/OOXML/XlsbFormat/Biff12_records/SupBookSrc.h index 7c760e2172..6484d6d43d 100644 --- a/OOXML/XlsbFormat/Biff12_records/SupBookSrc.h +++ b/OOXML/XlsbFormat/Biff12_records/SupBookSrc.h @@ -31,11 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/RelID.h" - +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/RelID.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SupName.h b/OOXML/XlsbFormat/Biff12_records/SupName.h index 04da2505f2..ca6120f5e8 100644 --- a/OOXML/XlsbFormat/Biff12_records/SupName.h +++ b/OOXML/XlsbFormat/Biff12_records/SupName.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SupNameStart.h b/OOXML/XlsbFormat/Biff12_records/SupNameStart.h index e3f5bf4fa1..e617f28806 100644 --- a/OOXML/XlsbFormat/Biff12_records/SupNameStart.h +++ b/OOXML/XlsbFormat/Biff12_records/SupNameStart.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SupTabs.h b/OOXML/XlsbFormat/Biff12_records/SupTabs.h index 301176ce38..a8691072ef 100644 --- a/OOXML/XlsbFormat/Biff12_records/SupTabs.h +++ b/OOXML/XlsbFormat/Biff12_records/SupTabs.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/SxvcellStr.h b/OOXML/XlsbFormat/Biff12_records/SxvcellStr.h index a75ef2cdf7..94c4d1e374 100644 --- a/OOXML/XlsbFormat/Biff12_records/SxvcellStr.h +++ b/OOXML/XlsbFormat/Biff12_records/SxvcellStr.h @@ -31,11 +31,11 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" #include "../Biff12_structures/PCDISrvFmt.h" -#include "../Biff12_structures/XLWideString.h" #include "../Biff12_structures/FRTBlank.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/TableSlicerCacheID.h b/OOXML/XlsbFormat/Biff12_records/TableSlicerCacheID.h index 2fe7222d70..23e327476b 100644 --- a/OOXML/XlsbFormat/Biff12_records/TableSlicerCacheID.h +++ b/OOXML/XlsbFormat/Biff12_records/TableSlicerCacheID.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/TableStyleClient.h b/OOXML/XlsbFormat/Biff12_records/TableStyleClient.h index a3f3255303..3babb1a66c 100644 --- a/OOXML/XlsbFormat/Biff12_records/TableStyleClient.h +++ b/OOXML/XlsbFormat/Biff12_records/TableStyleClient.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/TextPr15.h b/OOXML/XlsbFormat/Biff12_records/TextPr15.h index 033eb539a8..e97032eab3 100644 --- a/OOXML/XlsbFormat/Biff12_records/TextPr15.h +++ b/OOXML/XlsbFormat/Biff12_records/TextPr15.h @@ -31,9 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_structures/FRTHeader.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/FRTHeader.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Top10Filter.h b/OOXML/XlsbFormat/Biff12_records/Top10Filter.h index 7fb7517363..b0ec467195 100644 --- a/OOXML/XlsbFormat/Biff12_records/Top10Filter.h +++ b/OOXML/XlsbFormat/Biff12_records/Top10Filter.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/Top10RichFilter.h b/OOXML/XlsbFormat/Biff12_records/Top10RichFilter.h index a910931e89..9f5c35aa59 100644 --- a/OOXML/XlsbFormat/Biff12_records/Top10RichFilter.h +++ b/OOXML/XlsbFormat/Biff12_records/Top10RichFilter.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" -#include "../Biff12_structures/XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/WsDim.h b/OOXML/XlsbFormat/Biff12_records/WsDim.h index 11667712b4..7f70ee01de 100644 --- a/OOXML/XlsbFormat/Biff12_records/WsDim.h +++ b/OOXML/XlsbFormat/Biff12_records/WsDim.h @@ -31,11 +31,9 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" - -#include "../Biff12_structures/CellRangeRef.h" - +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_records/WsProp.cpp b/OOXML/XlsbFormat/Biff12_records/WsProp.cpp index fdac4ad7b1..423cf5b780 100644 --- a/OOXML/XlsbFormat/Biff12_records/WsProp.cpp +++ b/OOXML/XlsbFormat/Biff12_records/WsProp.cpp @@ -31,7 +31,7 @@ */ #include "WsProp.h" -#include "../Biff12_structures/CellRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRef.h" using namespace XLS; diff --git a/OOXML/XlsbFormat/Biff12_records/WsProp.h b/OOXML/XlsbFormat/Biff12_records/WsProp.h index 515b422e3a..9c6769e3d8 100644 --- a/OOXML/XlsbFormat/Biff12_records/WsProp.h +++ b/OOXML/XlsbFormat/Biff12_records/WsProp.h @@ -31,10 +31,10 @@ */ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" #include "../../XlsxFormat/WritingElement.h" -#include "../Biff12_records/Color.h" #include "../Biff12_structures/CodeName.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/Blxf.h b/OOXML/XlsbFormat/Biff12_structures/Blxf.h index 9b46ec39b3..f64eb8a32b 100644 --- a/OOXML/XlsbFormat/Biff12_structures/Blxf.h +++ b/OOXML/XlsbFormat/Biff12_structures/Blxf.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "../Biff12_records/Color.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/CodeName.h b/OOXML/XlsbFormat/Biff12_structures/CodeName.h index 586cd6bbdf..930ab46bed 100644 --- a/OOXML/XlsbFormat/Biff12_structures/CodeName.h +++ b/OOXML/XlsbFormat/Biff12_structures/CodeName.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/DDEItemProperties.h b/OOXML/XlsbFormat/Biff12_structures/DDEItemProperties.h index d5ea22dc4a..056f8d6c1b 100644 --- a/OOXML/XlsbFormat/Biff12_structures/DDEItemProperties.h +++ b/OOXML/XlsbFormat/Biff12_structures/DDEItemProperties.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/ExternalNameProperties.h b/OOXML/XlsbFormat/Biff12_structures/ExternalNameProperties.h index b647b77952..6a9dd57e5d 100644 --- a/OOXML/XlsbFormat/Biff12_structures/ExternalNameProperties.h +++ b/OOXML/XlsbFormat/Biff12_structures/ExternalNameProperties.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/GradientStop.h b/OOXML/XlsbFormat/Biff12_structures/GradientStop.h index 9e31442a77..d8c82c6765 100644 --- a/OOXML/XlsbFormat/Biff12_structures/GradientStop.h +++ b/OOXML/XlsbFormat/Biff12_structures/GradientStop.h @@ -32,10 +32,10 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "../Biff12_records/Color.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/Xnum.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/IsoPasswordData.h b/OOXML/XlsbFormat/Biff12_structures/IsoPasswordData.h index b4effb33c3..f998e3f749 100644 --- a/OOXML/XlsbFormat/Biff12_structures/IsoPasswordData.h +++ b/OOXML/XlsbFormat/Biff12_structures/IsoPasswordData.h @@ -31,10 +31,10 @@ */ #pragma once +#include "LPByteBuf.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "LPByteBuf.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/OLEItemProperties.h b/OOXML/XlsbFormat/Biff12_structures/OLEItemProperties.h index af5005cf12..ad2fc83233 100644 --- a/OOXML/XlsbFormat/Biff12_structures/OLEItemProperties.h +++ b/OOXML/XlsbFormat/Biff12_structures/OLEItemProperties.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/PCDCalcMemCommon.h b/OOXML/XlsbFormat/Biff12_structures/PCDCalcMemCommon.h index 55bc9de5c3..0b5ce3b0a1 100644 --- a/OOXML/XlsbFormat/Biff12_structures/PCDCalcMemCommon.h +++ b/OOXML/XlsbFormat/Biff12_structures/PCDCalcMemCommon.h @@ -32,9 +32,9 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/PCDIAddlInfo.h b/OOXML/XlsbFormat/Biff12_structures/PCDIAddlInfo.h index baaef92b33..329da6a4ba 100644 --- a/OOXML/XlsbFormat/Biff12_structures/PCDIAddlInfo.h +++ b/OOXML/XlsbFormat/Biff12_structures/PCDIAddlInfo.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/PRFilter.h b/OOXML/XlsbFormat/Biff12_structures/PRFilter.h index e882909866..7814eea780 100644 --- a/OOXML/XlsbFormat/Biff12_structures/PRFilter.h +++ b/OOXML/XlsbFormat/Biff12_structures/PRFilter.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/PRuleHeaderData.h b/OOXML/XlsbFormat/Biff12_structures/PRuleHeaderData.h index ca7febe74c..318e74a6b2 100644 --- a/OOXML/XlsbFormat/Biff12_structures/PRuleHeaderData.h +++ b/OOXML/XlsbFormat/Biff12_structures/PRuleHeaderData.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "CellRangeRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRangeRef.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/SxAxis.h" namespace XLSB diff --git a/OOXML/XlsbFormat/Biff12_structures/RangeProtectionTitleSDRel.h b/OOXML/XlsbFormat/Biff12_structures/RangeProtectionTitleSDRel.h index cefc866657..3af8b94ea8 100644 --- a/OOXML/XlsbFormat/Biff12_structures/RangeProtectionTitleSDRel.h +++ b/OOXML/XlsbFormat/Biff12_structures/RangeProtectionTitleSDRel.h @@ -32,10 +32,10 @@ #pragma once -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/SecurityDescriptor.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/SecurityDescriptor.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/RichStr.h b/OOXML/XlsbFormat/Biff12_structures/RichStr.h index 7f09118d03..df2a68b86f 100644 --- a/OOXML/XlsbFormat/Biff12_structures/RichStr.h +++ b/OOXML/XlsbFormat/Biff12_structures/RichStr.h @@ -32,7 +32,7 @@ #pragma once -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" #include "StrRun.h" #include "PhRun.h" diff --git a/OOXML/XlsbFormat/Biff12_structures/SlicerCacheLevelData.h b/OOXML/XlsbFormat/Biff12_structures/SlicerCacheLevelData.h index cc34fec65e..cc134d65d4 100644 --- a/OOXML/XlsbFormat/Biff12_structures/SlicerCacheLevelData.h +++ b/OOXML/XlsbFormat/Biff12_structures/SlicerCacheLevelData.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/SlicerCacheNativeItemStruct.h b/OOXML/XlsbFormat/Biff12_structures/SlicerCacheNativeItemStruct.h index df440e089e..1a356cd18f 100644 --- a/OOXML/XlsbFormat/Biff12_structures/SlicerCacheNativeItemStruct.h +++ b/OOXML/XlsbFormat/Biff12_structures/SlicerCacheNativeItemStruct.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_structures/SlicerCachePivotTable.h b/OOXML/XlsbFormat/Biff12_structures/SlicerCachePivotTable.h index c487625fb2..336f8c6094 100644 --- a/OOXML/XlsbFormat/Biff12_structures/SlicerCachePivotTable.h +++ b/OOXML/XlsbFormat/Biff12_structures/SlicerCachePivotTable.h @@ -34,7 +34,7 @@ #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BiffStructure.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/BiffRecord.h" -#include "XLWideString.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/XLWideString.h" namespace XLSB { diff --git a/OOXML/XlsbFormat/Biff12_unions/COLORSCALE.cpp b/OOXML/XlsbFormat/Biff12_unions/COLORSCALE.cpp index a7f21a6bfe..283c7e2c94 100644 --- a/OOXML/XlsbFormat/Biff12_unions/COLORSCALE.cpp +++ b/OOXML/XlsbFormat/Biff12_unions/COLORSCALE.cpp @@ -35,8 +35,8 @@ #include "ACFILTERS.h" #include "../Biff12_records/BeginColorScale.h" #include "../Biff12_unions/uCFVO.h" -#include "../Biff12_records/Color.h" #include "../Biff12_records/EndColorScale.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" using namespace XLS; diff --git a/OOXML/XlsbFormat/Biff12_unions/DATABAR.cpp b/OOXML/XlsbFormat/Biff12_unions/DATABAR.cpp index 7019c718dd..827867107e 100644 --- a/OOXML/XlsbFormat/Biff12_unions/DATABAR.cpp +++ b/OOXML/XlsbFormat/Biff12_unions/DATABAR.cpp @@ -33,8 +33,8 @@ #include "DATABAR.h" #include "../Biff12_records/BeginDatabar.h" #include "../Biff12_unions/uCFVO.h" -#include "../Biff12_records/Color.h" #include "../Biff12_records/EndDatabar.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" using namespace XLS; diff --git a/OOXML/XlsbFormat/Biff12_unions/EXTERNVALUEDATA.cpp b/OOXML/XlsbFormat/Biff12_unions/EXTERNVALUEDATA.cpp index 66da8680a2..330b68e696 100644 --- a/OOXML/XlsbFormat/Biff12_unions/EXTERNVALUEDATA.cpp +++ b/OOXML/XlsbFormat/Biff12_unions/EXTERNVALUEDATA.cpp @@ -32,7 +32,7 @@ #include "EXTERNVALUEDATA.h" #include "../Biff12_records/ExternCell.h" -#include "../Biff12_structures/CellRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRef.h" using namespace XLS; diff --git a/OOXML/XlsbFormat/Biff12_unions/FMLACELL.cpp b/OOXML/XlsbFormat/Biff12_unions/FMLACELL.cpp index 0df5b7cacb..841f3cd9b2 100644 --- a/OOXML/XlsbFormat/Biff12_unions/FMLACELL.cpp +++ b/OOXML/XlsbFormat/Biff12_unions/FMLACELL.cpp @@ -33,7 +33,7 @@ #include "FMLACELL.h" #include "../Biff12_records/CommonRecords.h" #include "../Biff12_records/Fmla.h" -#include "../Biff12_structures/CellRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRef.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CellRangeRef.h" using namespace XLS; diff --git a/OOXML/XlsbFormat/Biff12_unions/SHRFMLACELL.cpp b/OOXML/XlsbFormat/Biff12_unions/SHRFMLACELL.cpp index f7436910c8..2c4097d4ff 100644 --- a/OOXML/XlsbFormat/Biff12_unions/SHRFMLACELL.cpp +++ b/OOXML/XlsbFormat/Biff12_unions/SHRFMLACELL.cpp @@ -32,7 +32,7 @@ #include "SHRFMLACELL.h" #include "../Biff12_records/CommonRecords.h" -#include "../Biff12_structures/CellRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRef.h" #include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/CellRangeRef.h" using namespace XLS; diff --git a/OOXML/XlsxFormat/Styles/rPr.cpp b/OOXML/XlsxFormat/Styles/rPr.cpp index fb57085289..d52f711c01 100644 --- a/OOXML/XlsxFormat/Styles/rPr.cpp +++ b/OOXML/XlsxFormat/Styles/rPr.cpp @@ -34,7 +34,7 @@ #include "../../Binary/Presentation/BinaryFileReaderWriter.h" #include "Fonts.h" -#include "../../XlsbFormat/Biff12_records/Color.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/Color.h" #include "../../XlsbFormat/Biff12_records/IndexedColor.h" #include "../../XlsbFormat/Biff12_records/MRUColor.h" diff --git a/OOXML/XlsxFormat/Workbook/WorkbookPr.h b/OOXML/XlsxFormat/Workbook/WorkbookPr.h index 86132084bd..db7b068222 100644 --- a/OOXML/XlsxFormat/Workbook/WorkbookPr.h +++ b/OOXML/XlsxFormat/Workbook/WorkbookPr.h @@ -91,7 +91,7 @@ namespace OOX nullable m_oShowInkAnnotation; nullable m_oShowObjects; nullable m_oShowPivotChartFilter; - nullable m_oUpdateLinks; + nullable m_oUpdateLinks; }; class CWorkbookProtection : public WritingElement { diff --git a/OOXML/XlsxFormat/Worksheets/SheetData.cpp b/OOXML/XlsxFormat/Worksheets/SheetData.cpp index 532ebaa2b8..0fe3b4d841 100644 --- a/OOXML/XlsxFormat/Worksheets/SheetData.cpp +++ b/OOXML/XlsxFormat/Worksheets/SheetData.cpp @@ -61,7 +61,7 @@ #include "../../XlsbFormat/Biff12_records/ValueMeta.h" #include "../../XlsbFormat/Biff12_records/Cell.h" #include "../../XlsbFormat/Biff12_records/Fmla.h" -#include "../../XlsbFormat/Biff12_structures/CellRef.h" +#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_structures/BIFF12/CellRef.h" #include #include @@ -2756,7 +2756,7 @@ namespace OOX } else if (XLSB::rt_EndSheetData == nType) { - fromXLSBToXmlRowEnd(pRow, pCSVWriter, oStreamWriter); + fromXLSBToXmlRowEnd(pRow, pCSVWriter, oStreamWriter, true); RELEASEOBJECT(pRow); oStream.XlsbSkipRecord(); break; @@ -2790,7 +2790,7 @@ namespace OOX pCSVWriter->WriteRowStart(pRow); } } - void CSheetData::fromXLSBToXmlRowEnd (CRow* pRow, CSVWriter* pCSVWriter, NSFile::CStreamWriter& oStreamWriter) + void CSheetData::fromXLSBToXmlRowEnd (CRow* pRow, CSVWriter* pCSVWriter, NSFile::CStreamWriter& oStreamWriter, bool bLastRow) { if(pRow) { @@ -2800,7 +2800,7 @@ namespace OOX } else { - pCSVWriter->WriteRowEnd(pRow); + pCSVWriter->WriteRowEnd(pRow, bLastRow); } } } diff --git a/OOXML/XlsxFormat/Worksheets/SheetData.h b/OOXML/XlsxFormat/Worksheets/SheetData.h index d34d17d2fd..5bf61bfa7f 100644 --- a/OOXML/XlsxFormat/Worksheets/SheetData.h +++ b/OOXML/XlsxFormat/Worksheets/SheetData.h @@ -337,7 +337,7 @@ namespace OOX private: void fromXLSBToXmlCell (CCell& pCell, CSVWriter* pCSVWriter, NSFile::CStreamWriter& oStreamWriter); void fromXLSBToXmlRowStart (CRow* pRow, CSVWriter* pCSVWriter, NSFile::CStreamWriter& oStreamWriter); - void fromXLSBToXmlRowEnd (CRow* pRow, CSVWriter* pCSVWriter, NSFile::CStreamWriter& oStreamWriter); + void fromXLSBToXmlRowEnd (CRow* pRow, CSVWriter* pCSVWriter, NSFile::CStreamWriter& oStreamWriter, bool bLastRow = false); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); diff --git a/OdfFile/Projects/Linux/OdfFormatLib.pro b/OdfFile/Projects/Linux/OdfFormatLib.pro index 0686858077..357aaa0dcf 100644 --- a/OdfFile/Projects/Linux/OdfFormatLib.pro +++ b/OdfFile/Projects/Linux/OdfFormatLib.pro @@ -25,7 +25,6 @@ DEFINES += UNICODE \ INCLUDEPATH += ../../Common -!disable_precompiled_header:CONFIG += precompile_header precompile_header { PRECOMPILED_HEADER = precompiled.h HEADERS += precompiled.h diff --git a/OdfFile/Projects/Windows/cpxml.vcxproj b/OdfFile/Projects/Windows/cpxml.vcxproj index ce87db13a4..1779c5000c 100644 --- a/OdfFile/Projects/Windows/cpxml.vcxproj +++ b/OdfFile/Projects/Windows/cpxml.vcxproj @@ -93,7 +93,7 @@ $(Platform)\$(Configuration)\Xml\ $(Platform)\$(Configuration)\Xml\ - ..\..\..\Common\3dParty\boost\build\win_32\include;$(IncludePath) + ..\..\..\Common\3dParty\boost\build\win_64\include;$(IncludePath) ..\..\..\Common\3dParty\boost\build\win_64\lib;$(LibraryPath) diff --git a/OdfFile/Reader/Converter/docx_conversion_context.cpp b/OdfFile/Reader/Converter/docx_conversion_context.cpp index 7a49bc0509..3f43a5fbd5 100644 --- a/OdfFile/Reader/Converter/docx_conversion_context.cpp +++ b/OdfFile/Reader/Converter/docx_conversion_context.cpp @@ -227,7 +227,7 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId) state_.in_run_ = true; output_stream() << L""; - start_changes(); + start_changes(true); if (!state_.text_properties_stack_.empty() || parenStyleId.length() > 0) { @@ -252,20 +252,20 @@ void docx_conversion_context::start_paragraph(bool is_header) if (state_.in_paragraph_) finish_paragraph(); + start_changes(false); output_stream() << L""; in_header_ = is_header; is_rtl_ = false; state_.in_paragraph_ = true; - start_changes(); } void docx_conversion_context::finish_paragraph() { if (state_.in_paragraph_) { - end_changes(); + end_changes(true); if (false == current_process_comment_ && false == get_comments_context().ref_end_.empty()) { @@ -282,6 +282,7 @@ void docx_conversion_context::finish_paragraph() get_comments_context().ref_end_.clear(); } output_stream() << L""; + end_changes(false); } in_header_ = false; @@ -317,7 +318,7 @@ void docx_conversion_context::end_math_formula() if (!math_content.empty()) { - output_stream() << L"" << math_content << L""; + output_stream() << math_content; } } void docx_conversion_context::start_sdt(int type) @@ -2390,6 +2391,7 @@ void docx_conversion_context::start_text_changes (const std::wstring &id) { output_stream() << L""; state.active = true; + state.in_para = true; } if (state.type == 2) @@ -2413,7 +2415,7 @@ void docx_conversion_context::start_text_changes (const std::wstring &id) } } -void docx_conversion_context::start_changes() +void docx_conversion_context::start_changes(bool in_para) { if (map_current_changes_.empty()) return; if (current_process_comment_) return; @@ -2432,6 +2434,8 @@ void docx_conversion_context::start_changes() if (state.type == 0) continue; //unknown change ... todooo if (state.active) continue; + state.in_para = in_para; + std::wstring change_attr; change_attr += L" w:date=\"" + state.date + L"\""; change_attr += L" w:author=\"" + state.author + L"\""; @@ -2543,7 +2547,7 @@ void docx_conversion_context::start_changes() } } -void docx_conversion_context::end_changes() +void docx_conversion_context::end_changes(bool in_para) { if (current_process_comment_) return; if (current_process_note_) return; @@ -2552,10 +2556,11 @@ void docx_conversion_context::end_changes() { text_tracked_context::_state &state = it->second; - if (state.type == 0) continue; //unknown change ... libra format change skip - if (state.type == 3) continue; - if (!state.active) continue; - + if (state.type == 0) continue; //unknown change ... libra format change skip + if (state.type == 3) continue; + if (!state.active) continue; + if (state.in_para != in_para) continue; + if (state.in_drawing != get_drawing_state_content()) continue; diff --git a/OdfFile/Reader/Converter/docx_conversion_context.h b/OdfFile/Reader/Converter/docx_conversion_context.h index 45b9e14554..895252b8e5 100644 --- a/OdfFile/Reader/Converter/docx_conversion_context.h +++ b/OdfFile/Reader/Converter/docx_conversion_context.h @@ -525,6 +525,7 @@ public: bool active = false; bool in_drawing = false; bool out_active = false; + bool in_para = false; _UINT32 oox_id = 0; void clear() @@ -986,8 +987,8 @@ public: bool delayed_converting_; bool convert_delayed_enabled_; - void start_changes(); - void end_changes(); + void start_changes(bool in_para); + void end_changes(bool in_para); void add_jsaProject(const std::string &content); diff --git a/OdfFile/Reader/Converter/oox_conversion_context.cpp b/OdfFile/Reader/Converter/oox_conversion_context.cpp index fbd47c20f0..9ec757fcee 100644 --- a/OdfFile/Reader/Converter/oox_conversion_context.cpp +++ b/OdfFile/Reader/Converter/oox_conversion_context.cpp @@ -252,7 +252,7 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri } math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) : - base_font_size_(12), fonts_container_(fonts), is_need_e_(false) + base_font_size_(12), fonts_container_(fonts) { graphRPR_ = graphic; @@ -263,11 +263,29 @@ void math_context::start() { text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties()); - text_properties_->content_.style_font_name_ = L"Cambria Math"; + text_properties_->content_.fo_font_family_ = base_font_name_.empty() ? L"Cambria Math" : base_font_name_; text_properties_->content_.fo_font_size_ = odf_types::length(base_font_size_, odf_types::length::pt); + + math_stream_ << L""; + + math_stream_ << L""; + + start_level(); } std::wstring math_context::end() { + end_level(); + + math_stream_ << L""; std::wstring math = math_stream_.str(); math_stream_.str( std::wstring() ); diff --git a/OdfFile/Reader/Converter/oox_conversion_context.h b/OdfFile/Reader/Converter/oox_conversion_context.h index fd62b0ce9f..d69c13cb2b 100644 --- a/OdfFile/Reader/Converter/oox_conversion_context.h +++ b/OdfFile/Reader/Converter/oox_conversion_context.h @@ -194,16 +194,29 @@ private: std::wstringstream & math_style_stream() { return math_style_stream_; } odf_reader::fonts_container & fonts_container_; - int base_font_size_; + int base_font_size_ = 12; + std::wstring base_font_name_; + int base_alignment_ = 1; //center + bool base_font_bold_ = false; + bool base_font_italic_ = false; + odf_reader::style_text_properties_ptr text_properties_; - std::wstring nsRPr_; - bool graphRPR_; + std::wstring nsRPr_; + bool graphRPR_; - bool is_need_e_; + struct _state + { + bool is_need_e_ = false; + bool bMatrix = false; + }; + std::vector<_state> levels; + + void start_level() { _state state; levels.push_back(state); } + void end_level() { if (!levels.empty()) levels.pop_back(); } private: - std::wstringstream math_stream_; - std::wstringstream math_style_stream_; + std::wstringstream math_stream_; + std::wstringstream math_style_stream_; }; } diff --git a/OdfFile/Reader/Format/chart_build_oox.cpp b/OdfFile/Reader/Format/chart_build_oox.cpp index d2a3da13a7..ba7a000c76 100644 --- a/OdfFile/Reader/Format/chart_build_oox.cpp +++ b/OdfFile/Reader/Format/chart_build_oox.cpp @@ -202,7 +202,12 @@ void object_odf_context::xlsx_convert(oox::xlsx_conversion_context & Context) } else if (object_type_ == 3 && office_math_) { - Context.get_math_context().base_font_size_ = baseFontHeight_; + Context.get_math_context().base_font_name_ = baseFontName_; + Context.get_math_context().base_font_size_ = baseFontHeight_; + Context.get_math_context().base_alignment_ = baseAlignment_; + Context.get_math_context().base_font_italic_ = baseFontItalic_; + Context.get_math_context().base_font_bold_ = baseFontBold_; + Context.get_math_context().start(); office_math_->oox_convert(Context.get_math_context()); } @@ -250,7 +255,11 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context) Context.reset_context_state(); Context.get_math_context().base_font_size_ = baseFontHeight_; - + Context.get_math_context().base_font_name_ = baseFontName_; + Context.get_math_context().base_alignment_ = baseAlignment_; + Context.get_math_context().base_font_italic_ = baseFontItalic_; + Context.get_math_context().base_font_bold_ = baseFontBold_; + Context.start_math_formula(); office_math_->oox_convert(Context.get_math_context()); Context.end_math_formula(); @@ -291,7 +300,12 @@ void object_odf_context::pptx_convert(oox::pptx_conversion_context & Context) } else if (object_type_ == 3 && office_math_) { - Context.get_math_context().base_font_size_ = baseFontHeight_; + Context.get_math_context().base_font_size_ = baseFontHeight_; + Context.get_math_context().base_font_name_ = baseFontName_; + Context.get_math_context().base_alignment_ = baseAlignment_; + Context.get_math_context().base_font_italic_ = baseFontItalic_; + Context.get_math_context().base_font_bold_ = baseFontBold_; + Context.get_math_context().start(); office_math_->oox_convert(Context.get_math_context()); } @@ -620,17 +634,41 @@ process_build_object::process_build_object(object_odf_context & object_odf, odf_ ,number_styles_ (document->odf_context().numberStyles()) ,num_format_context_(document->odf_context()) { - _CP_OPT(std::wstring) sFontHeight = settings_.find_by_name(L"BaseFontHeight"); + _CP_OPT(std::wstring) sAlignment = settings_.find_by_name(L"Alignment"); + _CP_OPT(std::wstring) sFontHeight = settings_.find_by_name(L"BaseFontHeight"); + _CP_OPT(std::wstring) sFontName = settings_.find_by_name(L"FontNameText"); - if (sFontHeight) + _CP_OPT(std::wstring) sFontBold, sFontItalic; + if (!sFontName) { - try - { - object_odf_context_.baseFontHeight_ = boost::lexical_cast(*sFontHeight); - } - catch(...) - { - } + sFontName = settings_.find_by_name(L"FontNameVariables"); + if (!sFontName) + sFontName = settings_.find_by_name(L"FontNameFunctions"); + if (!sFontName) + sFontName = settings_.find_by_name(L"FontNameNumbers"); + } + else + { + sFontBold = settings_.find_by_name(L"FontTextIsBold"); + sFontItalic = settings_.find_by_name(L"FontTextIsItalic"); + } + try + { + if (sFontHeight) + object_odf_context_.baseFontHeight_ = boost::lexical_cast(*sFontHeight); + if (sAlignment) + object_odf_context_.baseAlignment_ = boost::lexical_cast(*sAlignment); + if ((sFontBold) && (*sFontBold == L"true")) + object_odf_context_.baseFontBold_ = true; + if ((sFontItalic) && (*sFontItalic == L"true")) + object_odf_context_.baseFontItalic_ = true; + } + catch (...) + { + } + if (sFontName) + { + object_odf_context_.baseFontName_ = *sFontName; } } void process_build_object::ApplyChartProperties(std::wstring style, chart_format_properties_ptr & propertiesOut) diff --git a/OdfFile/Reader/Format/chart_build_oox.h b/OdfFile/Reader/Format/chart_build_oox.h index f953048c1a..9b7c88073e 100644 --- a/OdfFile/Reader/Format/chart_build_oox.h +++ b/OdfFile/Reader/Format/chart_build_oox.h @@ -128,7 +128,11 @@ public: office_spreadsheet *office_spreadsheet_; table_table *table_table_; - int baseFontHeight_; + bool baseFontItalic_ = false; + bool baseFontBold_ = false; + int baseFontHeight_ = 12; + int baseAlignment_ = 1; + std::wstring baseFontName_; std::wstring baseRef_; //--------------------------------------------------------------- odf_types::chart_class::type class_; diff --git a/OdfFile/Reader/Format/draw_frame_docx.cpp b/OdfFile/Reader/Format/draw_frame_docx.cpp index 2e01b8fc27..64e4e50bf5 100644 --- a/OdfFile/Reader/Format/draw_frame_docx.cpp +++ b/OdfFile/Reader/Format/draw_frame_docx.cpp @@ -1750,10 +1750,10 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) if (in_frame) { - drawing->type = oox::typeShape; + drawing->type = oox::typeShape; drawing->additional.push_back(_property(L"fit-to-size", true)); - drawing->additional.push_back(_property(L"text-content", std::wstring(L"") + + drawing->additional.push_back(_property(L"text-content", std::wstring(L"") + content + std::wstring(L""))); } else @@ -1761,17 +1761,11 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) drawing->type = oox::typeUnknown; //not drawing if (runState) Context.finish_run(); - //if (pState == false) - { - Context.output_stream() << L""; - Context.output_stream() << L""; - } - Context.output_stream() << content; - //if (pState == false) - { - Context.output_stream() << L""; - } + Context.output_stream() << L""; + Context.output_stream() << content; + Context.output_stream() << L""; + if (runState) Context.add_new_run(_T("")); } Context.get_drawing_context().clear_stream_frame(); diff --git a/OdfFile/Reader/Format/draw_frame_pptx.cpp b/OdfFile/Reader/Format/draw_frame_pptx.cpp index 5007daa175..25f07009e0 100644 --- a/OdfFile/Reader/Format/draw_frame_pptx.cpp +++ b/OdfFile/Reader/Format/draw_frame_pptx.cpp @@ -412,10 +412,8 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context) { std::wstring text_content = L""; text_content += L""; - text_content += L""; - text_content += L""; text_content += math_content; - text_content += L""; + text_content += L""; if (bNewObject) { diff --git a/OdfFile/Reader/Format/draw_frame_xlsx.cpp b/OdfFile/Reader/Format/draw_frame_xlsx.cpp index 4e97dfd18a..4ae6cdcef1 100644 --- a/OdfFile/Reader/Format/draw_frame_xlsx.cpp +++ b/OdfFile/Reader/Format/draw_frame_xlsx.cpp @@ -402,10 +402,8 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context) { std::wstring text_content = L""; text_content += L""; - text_content += L""; - text_content += L""; text_content += math_content; - text_content += L""; + text_content += L""; if (bNewObject) { diff --git a/OdfFile/Reader/Format/math_layout_elements.cpp b/OdfFile/Reader/Format/math_layout_elements.cpp index 32ef3285aa..8b535aa63e 100644 --- a/OdfFile/Reader/Format/math_layout_elements.cpp +++ b/OdfFile/Reader/Format/math_layout_elements.cpp @@ -94,7 +94,8 @@ void math_mrow::oox_convert(oox::math_context & Context) bDPr = true; } - bool need_e_old = Context.is_need_e_, need_e = false; + bool need_e = false; + if (bDPr) { Context.output_stream() << L""; @@ -117,19 +118,21 @@ void math_mrow::oox_convert(oox::math_context & Context) need_e = true; } - else need_e = Context.is_need_e_; - - Context.is_need_e_ = false; + else + need_e = Context.levels.back().is_need_e_; if (need_e) { Context.output_stream() << L""; } - for (int i = i_start; i < i_end ; i++) - { - office_math_element* math_element = dynamic_cast(content_[i].get()); - math_element->oox_convert(Context); - } + Context.start_level(); + for (int i = i_start; i < i_end ; i++) + { + office_math_element* math_element = dynamic_cast(content_[i].get()); + math_element->oox_convert(Context); + } + Context.end_level(); + if (need_e) { Context.output_stream() << L""; @@ -138,7 +141,6 @@ void math_mrow::oox_convert(oox::math_context & Context) { Context.output_stream() << L""; } - Context.is_need_e_ = need_e_old; } //--------------------------------------------------------------- const wchar_t * math_mfrac::ns = L"math"; @@ -160,36 +162,38 @@ void math_mfrac::oox_convert(oox::math_context & Context) { return; } - bool need_e = Context.is_need_e_; - if (need_e) + if (Context.levels.back().is_need_e_) { Context.output_stream() << L""; } - Context.is_need_e_ = false; - office_math_element* math_element = NULL; Context.output_stream() << L""; Context.output_stream() << L""; + Context.start_level(); math_element = dynamic_cast(content_[0].get()); math_element->oox_convert(Context); + + Context.end_level(); Context.output_stream() << L""; - Context.is_need_e_ = false; Context.output_stream() << L""; + + Context.start_level(); math_element = dynamic_cast(content_[1].get()); math_element->oox_convert(Context); + + Context.end_level(); Context.output_stream() << L""; Context.output_stream() << L""; - if (need_e) + if (Context.levels.back().is_need_e_) { Context.output_stream() << L""; } - Context.is_need_e_ = need_e; } //--------------------------------------------------------------- const wchar_t * math_msqrt::ns = L"math"; @@ -219,12 +223,13 @@ void math_msqrt::oox_convert(oox::math_context & Context) strm << L""; - Context.is_need_e_ = false; + Context.start_level(); for (size_t i = 0 ; i < content_.size(); i++) { office_math_element* math_element = dynamic_cast(content_[i].get()); math_element->oox_convert(Context); } + Context.end_level(); strm << L""; strm << L""; } @@ -257,14 +262,14 @@ void math_mroot::oox_convert(oox::math_context & Context) strm << L""; math_element = dynamic_cast(content_[1].get()); math_element->oox_convert(Context); - strm << L""; - - Context.is_need_e_ = false; + strm << L""; - strm << L""; + strm << L""; + Context.start_level(); math_element = dynamic_cast(content_[0].get()); math_element->oox_convert(Context); - strm << L""; + Context.end_level(); + strm << L""; strm << L""; } @@ -295,7 +300,7 @@ void math_mstyle::oox_convert(oox::math_context & Context) { Context.text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties()); - Context.text_properties_->content_.style_font_name_ = L"Cambria Math"; + Context.text_properties_->content_.fo_font_family_ = Context.base_font_name_.empty() ? L"Cambria Math" : Context.base_font_name_; Context.text_properties_->content_.fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt); if (mathsize_) @@ -326,8 +331,10 @@ void math_mstyle::oox_convert(oox::math_context & Context) } } } - bool need_e_old = Context.is_need_e_; - Context.is_need_e_ = content_.size() > 1 ? true : need_e_old; + bool need_e_old = Context.levels.back().is_need_e_; + Context.start_level(); + + Context.levels.back().is_need_e_ = content_.size() > 1 ? true : need_e_old; for (size_t i = 0; i < content_.size(); i++) { @@ -350,10 +357,10 @@ void math_mstyle::oox_convert(oox::math_context & Context) //reset to default math text props Context.text_properties_ = odf_reader::style_text_properties_ptr(new odf_reader::style_text_properties()); - Context.text_properties_->content_.style_font_name_ = L"Cambria Math"; - Context.text_properties_->content_.fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt); + Context.text_properties_->content_.fo_font_family_ = Context.base_font_name_.empty() ? L"Cambria Math" : Context.base_font_name_; + Context.text_properties_->content_.fo_font_size_ = odf_types::length(Context.base_font_size_, odf_types::length::pt); - Context.is_need_e_ = need_e_old; + Context.end_level(); { std::wstringstream & strm = Context.math_style_stream(); strm.str( std::wstring() ); diff --git a/OdfFile/Reader/Format/math_limit_elements.cpp b/OdfFile/Reader/Format/math_limit_elements.cpp index fbd23b4964..b21fa5f659 100644 --- a/OdfFile/Reader/Format/math_limit_elements.cpp +++ b/OdfFile/Reader/Format/math_limit_elements.cpp @@ -70,17 +70,22 @@ void math_msub::oox_convert(oox::math_context & Context) strm << L""; strm << L""; - Context.is_need_e_ = false; + + Context.start_level(); math_element = dynamic_cast(content_[0].get()); math_element->oox_convert(Context); + + Context.end_level(); strm << L""; strm << L""; - Context.is_need_e_ = false; //?? + Context.start_level(); math_element = dynamic_cast(content_[1].get()); math_element->oox_convert(Context); + + Context.end_level(); strm << L""; strm << L""; @@ -112,15 +117,21 @@ void math_msup::oox_convert(oox::math_context & Context) strm << L""; strm << L""; - Context.is_need_e_ = false; + Context.start_level(); math_element = dynamic_cast(content_[0].get()); math_element->oox_convert(Context); + + Context.end_level(); strm << L""; strm << L""; + Context.start_level(); + math_element = dynamic_cast(content_[1].get()); math_element->oox_convert(Context); + + Context.end_level(); strm << L""; strm << L""; @@ -148,21 +159,31 @@ void math_msubsup::oox_convert(oox::math_context & Context) strm << L""; - Context.is_need_e_ = false; - strm << L""; + Context.start_level(); + math_element = dynamic_cast(content_[0].get()); math_element->oox_convert(Context); + + Context.end_level(); strm << L""; strm << L""; + Context.start_level(); + math_element = dynamic_cast(content_[1].get()); math_element->oox_convert(Context); + + Context.end_level(); strm << L""; strm << L""; + Context.start_level(); + math_element = dynamic_cast(content_[2].get()); math_element->oox_convert(Context); + + Context.end_level(); strm << L""; strm << L""; @@ -362,19 +383,24 @@ void math_mover::oox_convert(oox::math_context & Context) strm << L""; strm << L""; - Context.is_need_e_ = false; - if (content_.size() > index_e && index_e >= 0) { + Context.start_level(); + math_element = dynamic_cast(content_[index_e].get()); math_element->oox_convert(Context); + + Context.end_level(); } strm << L""; strm << L""; if (content_.size() > index_lim && index_lim >= 0) { + Context.start_level(); + math_element = dynamic_cast(content_[index_lim].get()); math_element->oox_convert(Context); + Context.end_level(); } strm << L""; strm << L""; @@ -397,12 +423,11 @@ void math_munder::oox_convert(oox::math_context & Context) {//2 elements std::wostream & strm = Context.output_stream(); - bool need_e = Context.is_need_e_; - if (need_e) + if (Context.levels.back().is_need_e_) { Context.output_stream() << L""; } - Context.is_need_e_ = false; + Context.start_level(); int index_lim = content_.size() > 1 ? 1 : 0; int index_e = content_.size() > 1 ? 0 : -1; @@ -426,11 +451,12 @@ void math_munder::oox_convert(oox::math_context & Context) strm << L""; strm << L""; - if (need_e) + Context.end_level(); + + if (Context.levels.back().is_need_e_) { Context.output_stream() << L""; } - Context.is_need_e_ = need_e; } } } diff --git a/OdfFile/Reader/Format/math_table_elements.cpp b/OdfFile/Reader/Format/math_table_elements.cpp index eff6f693eb..ae73e8d4c7 100644 --- a/OdfFile/Reader/Format/math_table_elements.cpp +++ b/OdfFile/Reader/Format/math_table_elements.cpp @@ -54,20 +54,51 @@ void math_mtable::add_attributes( const xml::attributes_wc_ptr & Attributes ) void math_mtable::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) { - CP_CREATE_ELEMENT(content_); + if (L"mtr" == Name) + { + CP_CREATE_ELEMENT(rows_); + + math_mtr* mtr = rows_.empty() ? NULL : dynamic_cast(rows_.back().get()); + if (mtr) + { + if (mtr->cells_.size() > 1) + bMatrix = true; + } + } + else + { + CP_CREATE_ELEMENT(content_); + } } void math_mtable::oox_convert(oox::math_context & Context) {//0* elements std::wostream & strm = Context.output_stream(); - strm << L""; + if (bMatrix) strm << L""; + else strm << L""; + + Context.start_level(); + + Context.levels.back().bMatrix = bMatrix; + Context.levels.back().is_need_e_ = !bMatrix; + for (size_t i = 0; i < content_.size(); i++) { - office_math_element* math_element = dynamic_cast(content_[i].get()); + office_math_element* math_element = dynamic_cast(content_[i].get()); + math_element->oox_convert(Context); } - strm << L""; + for (size_t i = 0; i < rows_.size(); i++) + { + office_math_element* math_element = dynamic_cast(rows_[i].get()); + + math_element->oox_convert(Context); + } + if (bMatrix) strm << L""; + else strm << L""; + + Context.end_level(); } //---------------------------------------------------------------------------------------------------- @@ -82,38 +113,47 @@ void math_mtr::add_attributes( const xml::attributes_wc_ptr & Attributes ) void math_mtr::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) { - CP_CREATE_ELEMENT(content_); + if (L"mtd" == Name) + { + CP_CREATE_ELEMENT(cells_); + } + else + { + CP_CREATE_ELEMENT(content_); + } } void math_mtr::oox_convert(oox::math_context & Context) {//0* elements std::wostream & strm = Context.output_stream(); + + if (Context.levels.back().is_need_e_) + strm << L""; - strm << L""; + if (Context.levels.back().bMatrix) strm << L""; - bool need_e_old = Context.is_need_e_; + bool bMatrix = Context.levels.back().bMatrix; + + Context.start_level(); + Context.levels.back().is_need_e_ = bMatrix; + Context.levels.back().bMatrix = bMatrix; for (size_t i = 0; i < content_.size(); i++) { - //Context.is_need_e_ = content_.size() > 1 ? true : false; - Context.is_need_e_ = true; - - //math_mrow* row_test = dynamic_cast(content_[i].get()); - //math_munder* munder_test = dynamic_cast(content_[i].get()); - //math_mfrac* frac_test = dynamic_cast(content_[i].get()); - // - //if (row_test || munder_test || frac_test) - // Context.output_stream() << L"";// EqArray записался в числитель вместо знаменателя.docx - дублирование - office_math_element* math_element = dynamic_cast(content_[i].get()); math_element->oox_convert(Context); - - //if (row_test || munder_test || frac_test) - // strm << L""; } - strm << L""; + for (size_t i = 0; i < cells_.size(); i++) + { + office_math_element* math_element = dynamic_cast(cells_[i].get()); + math_element->oox_convert(Context); + } + Context.end_level(); - Context.is_need_e_ = need_e_old; + if (Context.levels.back().bMatrix) strm << L""; + + if (Context.levels.back().is_need_e_) + strm << L""; } //---------------------------------------------------------------------------------------------------- @@ -155,14 +195,20 @@ void math_mtd::oox_convert(oox::math_context & Context) { std::wostream & strm = Context.output_stream(); - strm << L""; - Context.is_need_e_ = false; - for (size_t i = 0; i < content_.size(); i++) - { - office_math_element* math_element = dynamic_cast(content_[i].get()); - math_element->oox_convert(Context); - } - strm << L""; + if (Context.levels.back().is_need_e_) + strm << L""; + + Context.start_level(); + + for (size_t i = 0; i < content_.size(); i++) + { + office_math_element* math_element = dynamic_cast(content_[i].get()); + math_element->oox_convert(Context); + } + Context.end_level(); + + if (Context.levels.back().is_need_e_) + strm << L""; } //---------------------------------------------------------------------------------------------------- diff --git a/OdfFile/Reader/Format/math_table_elements.h b/OdfFile/Reader/Format/math_table_elements.h index 82064c8380..9506998c87 100644 --- a/OdfFile/Reader/Format/math_table_elements.h +++ b/OdfFile/Reader/Format/math_table_elements.h @@ -50,7 +50,10 @@ private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); - office_element_ptr_array content_; + office_element_ptr_array content_; + office_element_ptr_array rows_; + + bool bMatrix = false; }; CP_REGISTER_OFFICE_ELEMENT2(math_mtable); @@ -151,11 +154,11 @@ public: virtual void oox_convert(oox::math_context & Context); + office_element_ptr_array content_; + office_element_ptr_array cells_; private: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); - - office_element_ptr_array content_; }; CP_REGISTER_OFFICE_ELEMENT2(math_mtr); diff --git a/OdfFile/Reader/Format/table_docx.cpp b/OdfFile/Reader/Format/table_docx.cpp index 0a536905e5..9b0e7524df 100644 --- a/OdfFile/Reader/Format/table_docx.cpp +++ b/OdfFile/Reader/Format/table_docx.cpp @@ -202,7 +202,7 @@ void table_table::docx_convert(oox::docx_conversion_context & Context) _Wostream << L""; - Context.start_changes(); //TblPrChange + Context.start_changes(false); //TblPrChange Context.get_table_context().start_table(tableStyleName); diff --git a/OdfFile/Writer/Converter/ConvertDrawing.cpp b/OdfFile/Writer/Converter/ConvertDrawing.cpp index bfb34a138d..6f256deb67 100644 --- a/OdfFile/Writer/Converter/ConvertDrawing.cpp +++ b/OdfFile/Writer/Converter/ConvertDrawing.cpp @@ -37,6 +37,7 @@ #include "../../../OOXML/DocxFormat/VmlDrawing.h" #include "../../../OOXML/DocxFormat/Diagram/DiagramDrawing.h" +#include "../../../OOXML/DocxFormat/Diagram/DiagramData.h" #include "../../../OOXML/DocxFormat/Drawing/DrawingExt.h" #include "../../../OOXML/DocxFormat/Logic/Vml.h" #include "../../../OOXML/XlsxFormat/Chart/ChartDrawing.h" @@ -503,13 +504,36 @@ void OoxConverter::convert(PPTX::Logic::SmartArt *oox_smart_art) odf_context()->drawing_context()->get_size (width, height); odf_context()->drawing_context()->get_position (x, y); - oox_current_child_document = oox_smart_art->m_pDrawingContainer.GetPointer(); - odf_context()->drawing_context()->start_group(); odf_context()->drawing_context()->set_group_size (width, height, width, height); odf_context()->drawing_context()->set_group_position (x, y, cx, cy); + odf_context()->drawing_context()->start_drawing(); + odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect); + + odf_context()->drawing_context()->set_size( width, height); + odf_context()->drawing_context()->set_position(x, y); + + if (oox_smart_art->m_oDataBg.IsInit()) + { + oox_current_child_document = oox_smart_art->m_pDataContainer.GetPointer(); + + if ((oox_smart_art->m_oDataBg->m_oFill.Fill.IsInit()) && + (oox_smart_art->m_oDataBg->m_oFill.m_type != PPTX::Logic::UniFill::noFill)) + { + odf_context()->drawing_context()->start_area_properties(); + { + convert(&oox_smart_art->m_oDataBg->m_oFill); + } + odf_context()->drawing_context()->end_area_properties(); + } + } + odf_context()->drawing_context()->end_shape(); + odf_context()->drawing_context()->end_drawing(); + + oox_current_child_document = oox_smart_art->m_pDrawingContainer.GetPointer(); + for (size_t i = 0; i < oox_smart_art->m_oDrawing->SpTreeElems.size(); i++) { odf_context()->drawing_context()->start_drawing(); diff --git a/OdfFile/Writer/Converter/DocxConverter.cpp b/OdfFile/Writer/Converter/DocxConverter.cpp index d5c5e12f6a..8f53afd6df 100644 --- a/OdfFile/Writer/Converter/DocxConverter.cpp +++ b/OdfFile/Writer/Converter/DocxConverter.cpp @@ -685,7 +685,7 @@ void DocxConverter::convert(OOX::Logic::CSdtContent *oox_sdt) { if (oox_sdt == NULL) return; - for (size_t i = 0; i < oox_sdt->m_arrItems.size(); ++i) + for (size_t i = 0; i < oox_sdt->m_arrItems.size(); ++i) { convert(oox_sdt->m_arrItems[i]); } @@ -754,7 +754,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) id_change_properties.push_back(std::pair (3, id)); } //--------------------------------------------------------------------------------------------------------------------- - if(oox_paragraph->m_oParagraphProperty && odt_context->text_context()->get_list_item_state() == false) + if (oox_paragraph->m_oParagraphProperty && odt_context->text_context()->get_list_item_state() == false) { if (oox_paragraph->m_oParagraphProperty->m_oPStyle.IsInit() && oox_paragraph->m_oParagraphProperty->m_oPStyle->m_sVal.IsInit()) { @@ -797,7 +797,6 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) if (oox_paragraph->m_oParagraphProperty || odt_context->is_empty_section() || current_section_properties) { bStyled = true; - bool bRunPara = oox_paragraph->m_oParagraphProperty ? (oox_paragraph->m_oParagraphProperty->m_oRPr.IsInit() ? true : false) : false; odf_writer::paragraph_format_properties *paragraph_properties = NULL; odf_writer::text_format_properties *text_properties = NULL; @@ -808,9 +807,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) if (state) { paragraph_properties = state->get_paragraph_properties(); - - if (bRunPara) - text_properties = state->get_text_properties(); + text_properties = state->get_text_properties(); if (odt_context->in_drop_cap()) //после буквицы (Nadpis.docx) - нужно накатить свойства параграфа нормального { @@ -835,10 +832,9 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) odt_context->styles_context()->create_style(L"", odf_types::style_family::Paragraph, true, false, -1); paragraph_properties = odt_context->styles_context()->last_state()->get_paragraph_properties(); - if (bRunPara) - text_properties = odt_context->styles_context()->last_state()->get_text_properties(); + text_properties = odt_context->styles_context()->last_state()->get_text_properties(); - if(list_present && list_style_id >= 0) + if (list_present && list_style_id >= 0) { list_style_name = odt_context->styles_context()->lists_styles().get_style_name(list_style_id); odt_context->styles_context()->last_state()->set_list_style_name(list_style_name); @@ -849,7 +845,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) odt_context->end_drop_cap(); } - convert(oox_paragraph->m_oParagraphProperty, paragraph_properties); + convert(oox_paragraph->m_oParagraphProperty, paragraph_properties, text_properties); if (text_properties && oox_paragraph->m_oParagraphProperty) { @@ -866,11 +862,11 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) text_properties_drop_cap->fo_font_size_= odf_types::length(sz, odf_types::length::pt); } } - else - { - //Thesis.docx - convert(oox_paragraph->m_oParagraphProperty->m_oRPr.GetPointer(), text_properties, true); - } + //else + //{ + // //Thesis.docx + // convert(oox_paragraph->m_oParagraphProperty->m_oRPr.GetPointer(), text_properties, true); + //} } } else @@ -879,7 +875,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) //пока - если следующий не параграф - скидываем !!! } - if(list_present) + if (list_present) { odt_context->start_list_item(list_level, list_style_name); } @@ -938,7 +934,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) odt_context->end_paragraph(); } - if(list_present && !odt_context->text_context()->get_KeepNextParagraph()) + if (list_present && !odt_context->text_context()->get_KeepNextParagraph()) { odt_context->end_list_item(); } @@ -1290,11 +1286,8 @@ int DocxConverter::convert(OOX::Logic::CPPrChange *oox_para_prop_change) list_style_name = odt_context->styles_context()->lists_styles().get_style_name(list_style_id); odt_context->styles_context()->last_state()->set_list_style_name(list_style_name); } - convert(oox_para_prop_change->m_pParPr.GetPointer(), paragraph_properties); + convert(oox_para_prop_change->m_pParPr.GetPointer(), paragraph_properties, text_properties); - if (bRunPara) - convert(oox_para_prop_change->m_pParPr->m_oRPr.GetPointer(), text_properties); - odf_writer::odf_style_state_ptr style_state = odt_context->styles_context()->last_state(style_family::Paragraph); if (style_state) style_name = style_state->get_name(); @@ -1431,7 +1424,8 @@ void DocxConverter::convert(OOX::Logic::CSmartTag *oox_tag) convert(oox_tag->m_arrItems[i]); } } -void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf_writer::paragraph_format_properties *paragraph_properties) +void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, + cpdoccore::odf_writer::paragraph_format_properties *paragraph_properties, odf_writer::text_format_properties* text_properties) { odt_context->text_context()->set_KeepNextParagraph(false); @@ -1447,44 +1441,54 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp int outline_level = 0; + bool reDefine = false; if (oox_paragraph_pr->m_oPStyle.IsInit() && oox_paragraph_pr->m_oPStyle->m_sVal.IsInit()) { std::wstring style_name = *oox_paragraph_pr->m_oPStyle->m_sVal; - /////////////////////////find parent properties + std::map::iterator pFind = docx_document->m_oMain.styles->m_mapStyleNames.find(style_name); + if (pFind != docx_document->m_oMain.styles->m_mapStyleNames.end()) + { + if ((docx_document->m_oMain.styles->m_arrStyle[pFind->second]->m_oAutoRedefine.IsInit()) && + (docx_document->m_oMain.styles->m_arrStyle[pFind->second]->m_oAutoRedefine->m_oVal.ToBool())) + { + reDefine = true; + if (oox_paragraph_pr->m_oRPr.IsInit()) + { + convert(oox_paragraph_pr->m_oRPr.GetPointer(), text_properties, true); + } + } + } +//----------------- find parent properties odf_writer::style_paragraph_properties parent_paragraph_properties; odt_context->styles_context()->calc_paragraph_properties(style_name, odf_types::style_family::Paragraph, &parent_paragraph_properties.content_); - odf_writer::style_text_properties parent_text_properties; - odt_context->styles_context()->calc_text_properties(style_name, odf_types::style_family::Paragraph, &parent_text_properties.content_); + odt_context->styles_context()->calc_text_properties(style_name, odf_types::style_family::Paragraph, text_properties); - odf_writer::odf_style_state_ptr style_state; - style_state = odt_context->styles_context()->last_state(); - - odf_writer::odf_drawing_context* drawing_context = odt_context->drawing_context(); - if ((drawing_context) && (false == drawing_context->is_current_empty())) + odf_writer::odf_drawing_context* drawing_context = odt_context->drawing_context(); + if ((drawing_context) && (false == drawing_context->is_current_empty())) // todooo reDefine ??? { paragraph_properties->apply_from(parent_paragraph_properties.content_); - - odf_writer::text_format_properties* text_props = style_state->get_text_properties(); - text_props->apply_from(parent_text_properties.content_); } else { + odf_writer::odf_style_state_ptr style_state = odt_context->styles_context()->last_state(); style_state->set_parent_style_name(style_name); } - if (parent_paragraph_properties.content_.outline_level_) { outline_level = *parent_paragraph_properties.content_.outline_level_; } - //список тож явно ??? угу :( - выше + велосипед для хранения - if (parent_text_properties.content_.fo_font_size_) - { - current_font_size.push_back(parent_text_properties.content_.fo_font_size_->get_length().get_value_unit(odf_types::length::pt)); - } } - + if (!reDefine && oox_paragraph_pr->m_oRPr.IsInit()) + { + convert(oox_paragraph_pr->m_oRPr.GetPointer(), text_properties, true); + } + + if (text_properties && text_properties->fo_font_size_) + { + current_font_size.push_back(text_properties->fo_font_size_->get_length().get_value_unit(odf_types::length::pt)); + } if (oox_paragraph_pr->m_oSpacing.IsInit()) { SimpleTypes::ELineSpacingRule rule = SimpleTypes::linespacingruleAtLeast; @@ -1898,16 +1902,16 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b double footer_cm = footer ? footer->get_value_unit(length::cm) : 0; double length_cm = bottom_cm - footer_cm; - if ( length_cm > 2.4 ) - { - bottom = footer; - footer = length(fabs(length_cm), length::cm); - } - else if ( length_cm < 0 ) + if ( length_cm < 0 ) { footer_min = length(-length_cm, length::cm); footer.reset(); } + else //if(length_cm > 2.4) + { + bottom = footer; + footer = length(fabs(length_cm), length::cm); + } } else { @@ -2689,7 +2693,7 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::te if (oox_run_pr->m_oColor.IsInit()) { - if(oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorAuto) + if (oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorAuto) color = odf_types::color(L"#000000"); else convert(oox_run_pr->m_oColor.GetPointer(), color); @@ -2706,7 +2710,7 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::te if (drawing_context->change_text_box_2_wordart()) { drawing_context->start_area_properties(); - if(gradFill.IsInit()) + if (gradFill.IsInit()) { OoxConverter::convert(gradFill.operator->()); } @@ -2818,12 +2822,12 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::te else text_properties->fo_font_style_ = odf_types::font_style(odf_types::font_style::Normal); } - if (oox_run_pr->m_oSz.IsInit() && oox_run_pr->m_oSz->m_oVal.IsInit() && !is_para_props) + if (oox_run_pr->m_oSz.IsInit() && oox_run_pr->m_oSz->m_oVal.IsInit()) { double font_size_pt = oox_run_pr->m_oSz->m_oVal->ToPoints(); current_font_size.push_back(font_size_pt); - - OoxConverter::convert(font_size_pt, text_properties->fo_font_size_); + + OoxConverter::convert(font_size_pt, text_properties->fo_font_size_); } if (oox_run_pr->m_oKern.IsInit() && oox_run_pr->m_oKern->m_oVal.IsInit()) { @@ -3185,7 +3189,7 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor) if ( oox_anchor->m_oPositionV->m_oAlign.IsInit()) odt_context->drawing_context()->set_vertical_pos(oox_anchor->m_oPositionV->m_oAlign->GetValue()); - else if(oox_anchor->m_oPositionV->m_oPosOffset.IsInit()) + else if (oox_anchor->m_oPositionV->m_oPosOffset.IsInit()) { switch(vert_rel) { @@ -3206,7 +3210,7 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor) if (oox_anchor->m_oPositionH->m_oAlign.IsInit()) odt_context->drawing_context()->set_horizontal_pos(oox_anchor->m_oPositionH->m_oAlign->GetValue()); - else if(oox_anchor->m_oPositionH->m_oPosOffset.IsInit()) + else if (oox_anchor->m_oPositionH->m_oPosOffset.IsInit()) { odt_context->drawing_context()->set_horizontal_pos(oox_anchor->m_oPositionH->m_oPosOffset->ToPoints()); switch(horiz_rel) @@ -3282,7 +3286,7 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor) { odt_context->drawing_context()->set_wrap_style(odf_types::style_wrap::RunThrough); } - if(bBackground)//эффект_штурмовика.docx + if (bBackground)//эффект_штурмовика.docx { odt_context->drawing_context()->set_object_background(true); } @@ -3399,7 +3403,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor *color, delete oRgbColor; } } - if(theme_color && result == false) + if (theme_color && result == false) { std::map::iterator pFind = docx_document->m_pTheme->themeElements.clrScheme.Scheme.find(theme_color->ToString()); @@ -3653,7 +3657,7 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style, OOX::CStyles *styles) } } - convert(¶Props, paragraph_properties); + convert(¶Props, paragraph_properties, NULL); if (def_style->m_oParPr.IsInit() && def_style->m_oParPr->m_oRPr.IsInit()) { @@ -4003,7 +4007,7 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style) if (oox_style->m_oParPr.IsInit()) { odf_writer::paragraph_format_properties* paragraph_properties = odt_context->styles_context()->table_styles().get_paragraph_properties(); - convert(oox_style->m_oParPr.GetPointer(), paragraph_properties); + convert(oox_style->m_oParPr.GetPointer(), paragraph_properties, NULL); } if (oox_style->m_oTcPr.IsInit()) @@ -4041,7 +4045,7 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style) //сначела отнаследоваться от общих настроек??? convert(oox_style->m_arrTblStylePr[i]->m_oTcPr.GetPointer(), odt_context->styles_context()->table_styles().get_table_cell_properties()); convert(oox_style->m_arrTblStylePr[i]->m_oRunPr.GetPointer(),odt_context->styles_context()->table_styles().get_text_properties()); - convert(oox_style->m_arrTblStylePr[i]->m_oParPr.GetPointer(),odt_context->styles_context()->table_styles().get_paragraph_properties()); + convert(oox_style->m_arrTblStylePr[i]->m_oParPr.GetPointer(),odt_context->styles_context()->table_styles().get_paragraph_properties(), NULL); //nullable m_oTblPr; //nullable m_oTrPr; @@ -4132,7 +4136,7 @@ void DocxConverter::convert(OOX::CStyle *oox_style) } } - convert(oox_style->m_oParPr.GetPointer(), paragraph_properties); + convert(oox_style->m_oParPr.GetPointer(), paragraph_properties, NULL); if (oox_style->m_oParPr->m_oNumPr.IsInit()) { @@ -4180,7 +4184,7 @@ void DocxConverter::convert(OOX::CStyle *oox_style) void DocxConverter::convert(OOX::Logic::CCommentRangeStart* oox_comm_start) { - if(oox_comm_start == NULL)return; + if (oox_comm_start == NULL)return; if (oox_comm_start->m_oId.IsInit() == false) return; int oox_comm_id = oox_comm_start->m_oId->GetValue(); @@ -4200,7 +4204,7 @@ void DocxConverter::convert(OOX::Logic::CCommentRangeStart* oox_comm_start) void DocxConverter::convert(OOX::Logic::CCommentRangeEnd* oox_comm_end) { - if(oox_comm_end == NULL)return; + if (oox_comm_end == NULL)return; if (oox_comm_end->m_oId.IsInit() == false) return; int oox_comm_id = oox_comm_end->m_oId->GetValue(); @@ -4444,7 +4448,7 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table) convert(oox_table->m_oTableProperties, styled_table ); - if(oox_table->m_oTableProperties && oox_table->m_oTableProperties->m_oTblpPr.IsInit()) + if (oox_table->m_oTableProperties && oox_table->m_oTableProperties->m_oTblpPr.IsInit()) { if (oox_table->m_oTableProperties->m_oTblpPr->m_oTblpX.IsInit()) { @@ -4845,7 +4849,7 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer } table_properties->content_.table_align_ = odf_types::table_align(odf_types::table_align::Left); } - else if(oox_table_pr->m_oTblpPr.IsInit()) //отступы, обтекание есть + else if (oox_table_pr->m_oTblpPr.IsInit()) //отступы, обтекание есть { table_properties->content_.table_align_ = odf_types::table_align(odf_types::table_align::Left); @@ -4880,7 +4884,7 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer table_properties->content_.table_align_ = odf_types::table_align(odf_types::table_align::Left); } - if(oox_table_pr->m_oJc.IsInit() && oox_table_pr->m_oJc->m_oVal.IsInit()) + if (oox_table_pr->m_oJc.IsInit() && oox_table_pr->m_oJc->m_oVal.IsInit()) { switch(oox_table_pr->m_oJc->m_oVal->GetValue()) { diff --git a/OdfFile/Writer/Converter/DocxConverter.h b/OdfFile/Writer/Converter/DocxConverter.h index e834429490..0a5816beb1 100644 --- a/OdfFile/Writer/Converter/DocxConverter.h +++ b/OdfFile/Writer/Converter/DocxConverter.h @@ -195,7 +195,7 @@ namespace Oox2Odf void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name = L"", bool bAlways = false); void convert(OOX::Logic::CParagraph *oox_paragraph); void convert(OOX::Logic::CRun *oox_run); - void convert(OOX::Logic::CParagraphProperty *oox_para_prop, odf_writer::paragraph_format_properties *paragraph_properties); + void convert(OOX::Logic::CParagraphProperty *oox_para_prop, odf_writer::paragraph_format_properties *paragraph_properties, odf_writer::text_format_properties* text_properties); void convert(ComplexTypes::Word::CFramePr *oox_frame_pr, odf_writer::paragraph_format_properties *paragraph_properties); void convert(OOX::Logic::CRunProperty *oox_run_prop, odf_writer::text_format_properties *text_properties, bool is_para_props = false); void convert(OOX::Logic::CFldSimple *oox_fld); diff --git a/OdfFile/Writer/Format/odf_page_layout_context.cpp b/OdfFile/Writer/Format/odf_page_layout_context.cpp index 178b39ecb5..b5b29b6066 100644 --- a/OdfFile/Writer/Format/odf_page_layout_context.cpp +++ b/OdfFile/Writer/Format/odf_page_layout_context.cpp @@ -260,7 +260,7 @@ void odf_page_layout_context::set_footer_size(_CP_OPT(length) length_, _CP_OPT(o { if (layout_state_list_.size() < 1) return; - layout_state_list_.back().footer_size_ = length_; + //layout_state_list_.back().footer_size_ = length_; layout_state_list_.back().footer_min_size_ = length_min; //собственно в layout встроим позднее - по факту наличия хоть одного колонтитула return; diff --git a/OdfFile/Writer/Format/odt_conversion_context.cpp b/OdfFile/Writer/Format/odt_conversion_context.cpp index 06a6c9bcf6..af1e07c068 100644 --- a/OdfFile/Writer/Format/odt_conversion_context.cpp +++ b/OdfFile/Writer/Format/odt_conversion_context.cpp @@ -1270,8 +1270,6 @@ void odt_conversion_context::flush_section() } void odt_conversion_context::start_run(bool styled) { - if (is_hyperlink_ && text_context_.size() > 0) return; - if (!current_fields.empty() && current_fields.back().status == 1 && false == current_fields.back().in_span && current_fields.back().type < 0xff) { current_fields.back().status = 2; @@ -1304,8 +1302,6 @@ void odt_conversion_context::start_run(bool styled) } void odt_conversion_context::end_run() { - if (is_hyperlink_ && text_context_.size() > 0) return; - if (!current_fields.empty() && current_fields.back().status == 1 && current_fields.back().in_span) { end_field(); diff --git a/OfficeCryptReader/source/ECMACryptFile.cpp b/OfficeCryptReader/source/ECMACryptFile.cpp index d320169d55..8f5384d171 100644 --- a/OfficeCryptReader/source/ECMACryptFile.cpp +++ b/OfficeCryptReader/source/ECMACryptFile.cpp @@ -942,9 +942,10 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s } } //------------------------------------------------------------------- + bool result = true; if (bLargeFile) { - pStorageNew->Save(file_name_out); + result = pStorageNew->Save(file_name_out); pStorageNew->Close(); delete pStorageNew; } @@ -974,7 +975,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s // } ////test back---------------------------------------------------------------------------------test back - return true; + return result; } bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const std::wstring &file_name_out, const std::wstring &password, bool & bDataIntegrity) { diff --git a/PdfFile/PdfFile.cpp b/PdfFile/PdfFile.cpp index 4b3098c4ec..e8ebde50ca 100644 --- a/PdfFile/PdfFile.cpp +++ b/PdfFile/PdfFile.cpp @@ -853,7 +853,7 @@ void CPdfFile::CreatePdf(bool isPDFA) int CPdfFile::SaveToFile(const std::wstring& wsPath) { if (!m_pInternal->pWriter) - return 0; + return 1; return m_pInternal->pWriter->SaveToFile(wsPath); } void CPdfFile::SetPassword(const std::wstring& wsPassword) diff --git a/PdfFile/PdfWriter.cpp b/PdfFile/PdfWriter.cpp index 5533ea9bd4..d627d7bc04 100644 --- a/PdfFile/PdfWriter.cpp +++ b/PdfFile/PdfWriter.cpp @@ -1953,6 +1953,8 @@ bool CPdfWriter::UpdateFont() if (m_oFont.IsBold() && !m_pFont->IsBold()) m_oFont.SetNeedDoBold(true); } + else + return false; } return true; } diff --git a/PdfFile/SrcWriter/Document.cpp b/PdfFile/SrcWriter/Document.cpp index c6a04f1770..c8a95ce8af 100644 --- a/PdfFile/SrcWriter/Document.cpp +++ b/PdfFile/SrcWriter/Document.cpp @@ -44,6 +44,7 @@ #include "Font14.h" #include "FontCidTT.h" #include "FontTT.h" +#include "FontTTWriter.h" #include "Shading.h" #include "Pattern.h" #include "AcroForm.h" @@ -610,7 +611,11 @@ namespace PdfWriter if (pFont) return pFont; - pFont = new CFontCidTrueType(m_pXref, this, wsFontPath, unIndex); + CFontFileTrueType* pFontTT = CFontFileTrueType::LoadFromFile(wsFontPath, unIndex); + if (!pFontTT) + return NULL; + + pFont = new CFontCidTrueType(m_pXref, this, wsFontPath, unIndex, pFontTT); if (!pFont) return NULL; diff --git a/PdfFile/SrcWriter/FontCidTT.cpp b/PdfFile/SrcWriter/FontCidTT.cpp index b3273cde47..062c2d6db5 100644 --- a/PdfFile/SrcWriter/FontCidTT.cpp +++ b/PdfFile/SrcWriter/FontCidTT.cpp @@ -71,10 +71,9 @@ namespace PdfWriter //---------------------------------------------------------------------------------------- // CFontFileBase //---------------------------------------------------------------------------------------- - CFontCidTrueType::CFontCidTrueType(CXref* pXref, CDocument* pDocument, const std::wstring& wsFontPath, unsigned int unIndex) : CFontDict(pXref, pDocument) + CFontCidTrueType::CFontCidTrueType(CXref* pXref, CDocument* pDocument, const std::wstring& wsFontPath, unsigned int unIndex, CFontFileTrueType* pFontTT) : CFontDict(pXref, pDocument) { m_bNeedAddFontName = true; - CFontFileTrueType* pFontTT = CFontFileTrueType::LoadFromFile(wsFontPath, unIndex); m_pFontFile = pFontTT; m_wsFontPath = wsFontPath; @@ -99,7 +98,7 @@ namespace PdfWriter CreateCIDFont2(pFont); m_pFace = NULL; - m_pFaceMemory = NULL; + m_pFaceMemory = NULL; m_nGlyphsCount = 0; m_nSymbolicCmap = -1; m_ushCodesCount = 0; diff --git a/PdfFile/SrcWriter/FontCidTT.h b/PdfFile/SrcWriter/FontCidTT.h index f07bc02928..cea4f5e167 100644 --- a/PdfFile/SrcWriter/FontCidTT.h +++ b/PdfFile/SrcWriter/FontCidTT.h @@ -99,7 +99,7 @@ namespace PdfWriter { public: - CFontCidTrueType(CXref* pXref, CDocument* pDocument, const std::wstring& wsFontPath, unsigned int unIndex); + CFontCidTrueType(CXref* pXref, CDocument* pDocument, const std::wstring& wsFontPath, unsigned int unIndex, CFontFileTrueType* pFontTT); ~CFontCidTrueType(); unsigned short EncodeUnicode(const unsigned int& unUnicode); unsigned short EncodeGID(const unsigned int& unGID, const unsigned int* pUnicodes, const unsigned int& unCount); diff --git a/PdfFile/test/test.cpp b/PdfFile/test/test.cpp index 7f6095167f..384936877d 100644 --- a/PdfFile/test/test.cpp +++ b/PdfFile/test/test.cpp @@ -100,6 +100,16 @@ int main() pCertificate = NSCertificate::FromFiles(wsPrivateKeyFile, sPrivateFilePassword, wsCertificateFile, sCertificateFilePassword); } + if (true) + { + pdfFile.CreatePdf(); + pdfFile.OnlineWordToPdfFromBinary(NSFile::GetProcessDirectory() + L"/pdf.bin", wsDstFile); + + RELEASEINTERFACE(pApplicationFonts); + RELEASEOBJECT(pCertificate); + return 0; + } + if (false) { pdfFile.CreatePdf(); @@ -151,7 +161,7 @@ int main() if (pCertificate) pdfFile.Sign(10, 70, 50, 50, NSFile::GetProcessDirectory() + L"/test.png", pCertificate); - pdfFile.SaveToFile(wsDstFile); + int nRes = pdfFile.SaveToFile(wsDstFile); RELEASEINTERFACE(pApplicationFonts); RELEASEOBJECT(pCertificate); diff --git a/RtfFile/Format/ConvertationManager.cpp b/RtfFile/Format/ConvertationManager.cpp index ea66d5edf2..a6d7686054 100644 --- a/RtfFile/Format/ConvertationManager.cpp +++ b/RtfFile/Format/ConvertationManager.cpp @@ -94,20 +94,8 @@ _UINT32 RtfConvertationManager::ConvertRtfToOOX( std::wstring sSrcFileName, std: m_poRtfReader = &oReader; m_poOOXWriter = &oWriter; - //m_poRtfReader->m_convertationManager = this; - if (false == oReader.Load( )) return AVS_FILEUTILS_ERROR_CONVERT; - //сохранение будет поэлементое в обработчике OnCompleteItemRtf - //надо только завершить - //if( true == m_bParseFirstItem ) - //{ - // m_bParseFirstItem = false; - // oWriter.SaveByItemStart( ); - //} - //m_poOOXWriter->SaveByItem(); - //oWriter.SaveByItemEnd( ); - oWriter.Save(); NSDirectory::DeleteDirectory(oReader.m_sTempFolder); @@ -146,17 +134,19 @@ _UINT32 RtfConvertationManager::ConvertOOXToRtf( std::wstring sDstFileName, std: m_poOOXReader->m_convertationManager = this; - bool succes = oReader.Parse( ); - if( true == succes) + bool result = oReader.Parse( ); + if( result ) { - succes = oWriter.Save( ); + result = oWriter.Save( ); } NSDirectory::DeleteDirectory(oReader.m_sTempFolder); NSDirectory::DeleteDirectory(oWriter.m_sTempFolder); - if( true == succes) return 0; - return AVS_FILEUTILS_ERROR_CONVERT; + if ( result ) + return 0; + else + return AVS_FILEUTILS_ERROR_CONVERT; } void RtfConvertationManager::OnCompleteItemRtf() { diff --git a/RtfFile/Format/RtfWriter.cpp b/RtfFile/Format/RtfWriter.cpp index fcafb405e9..68b91329b7 100644 --- a/RtfFile/Format/RtfWriter.cpp +++ b/RtfFile/Format/RtfWriter.cpp @@ -183,6 +183,7 @@ bool RtfWriter::SaveByItem() } bool RtfWriter::SaveByItemEnd() { + bool result = true; //окончательно дописываем темповый файл RELEASEOBJECT( m_oCurTempFileWriter ); @@ -272,7 +273,9 @@ bool RtfWriter::SaveByItemEnd() oTargetFileWriter.Write( &nEndFile, 1); } catch(...) - {} + { + result = false; + } for (size_t i = 0; i < m_aTempFiles.size(); i++ ) Utils::RemoveDirOrFile( m_aTempFiles[i] ); @@ -283,7 +286,8 @@ bool RtfWriter::SaveByItemEnd() Utils::RemoveDirOrFile( m_aTempFilesSectPr[i] ); m_aTempFilesSectPr.clear(); - return true; + + return result; } int RtfWriter::GetCount() { diff --git a/RtfFile/OOXml/Reader/OOXParagraphElementReaders.cpp b/RtfFile/OOXml/Reader/OOXParagraphElementReaders.cpp index 9dbdf33b37..d731763751 100644 --- a/RtfFile/OOXml/Reader/OOXParagraphElementReaders.cpp +++ b/RtfFile/OOXml/Reader/OOXParagraphElementReaders.cpp @@ -1428,7 +1428,7 @@ bool OOXpPrReader::Parse( ReaderParameter oParam, RtfParagraphProperty& oOutputP } if( m_ooxParaProps->m_oRPr.IsInit() ) - { + {// ??? todooo сохранять текстовые ствойсва и использовать там где в run нет этих свойств OOXrPrReader orPrReader(m_ooxParaProps->m_oRPr.GetPointer()); orPrReader.Parse( oParam, oOutputProperty.m_oCharProperty ); } diff --git a/RtfFile/Projects/Windows/Win32/RtfFormatLib.vcxproj b/RtfFile/Projects/Windows/Win32/RtfFormatLib.vcxproj index 71f3b8759c..1e03bbbf14 100644 --- a/RtfFile/Projects/Windows/Win32/RtfFormatLib.vcxproj +++ b/RtfFile/Projects/Windows/Win32/RtfFormatLib.vcxproj @@ -75,7 +75,7 @@ $(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ - ..\..\..\..\Common\3dParty\boost\build\win_64\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\..\Common\3dParty\boost\build\win_64\include $(SolutionDir)$(Configuration)\ diff --git a/Test/Applications/x2tTester/README.md b/Test/Applications/x2tTester/README.md index 9cc8babc57..0fc7d3c21b 100644 --- a/Test/Applications/x2tTester/README.md +++ b/Test/Applications/x2tTester/README.md @@ -27,6 +27,9 @@ You need to create an xml configuration file. It must contain: # (non-required) is delete successful conversions files (default - 0) + # (non-required) trough conversion (format) -> (*t format) -> (output formats) (default - 0). Directory with *t files - outputDirectory/_t. + + # (non-required) timestamp in report file name (default - 1) diff --git a/Test/Applications/x2tTester/x2tTester.cpp b/Test/Applications/x2tTester/x2tTester.cpp index 3969256cbc..3eef2e3b27 100644 --- a/Test/Applications/x2tTester/x2tTester.cpp +++ b/Test/Applications/x2tTester/x2tTester.cpp @@ -8,189 +8,126 @@ class CConverter; CFormatsList::CFormatsList() { } +CFormatsList::CFormatsList(const CFormatsList& list) +{ + *this = list; +} -std::vector CFormatsList::GetDocuments() const +CFormatsList& CFormatsList::operator=(const CFormatsList& list) +{ + m_documents.clear(); + m_presentations.clear(); + m_spreadsheets.clear(); + m_images.clear(); + m_crossplatform.clear(); + + for(auto& val : list.m_documents) + m_documents.push_back(val); + + for(auto& val : list.m_presentations) + m_presentations.push_back(val); + + for(auto& val : list.m_spreadsheets) + m_spreadsheets.push_back(val); + + for(auto& val : list.m_images) + m_images.push_back(val); + + for(auto& val : list.m_crossplatform) + m_crossplatform.push_back(val); + + m_pdf = list.m_pdf; + return *this; +} + +std::vector CFormatsList::GetDocuments() const { return m_documents; } -std::vector CFormatsList::GetPresentations() const +std::vector CFormatsList::GetPresentations() const { return m_presentations; } -std::vector CFormatsList::GetSpreadsheets() const +std::vector CFormatsList::GetSpreadsheets() const { return m_spreadsheets; } -std::vector CFormatsList::GetCrossplatform() const +std::vector CFormatsList::GetCrossplatform() const { return m_crossplatform; } -std::vector CFormatsList::GetImages() const +std::vector CFormatsList::GetImages() const { return m_images; } -int CFormatsList::GetPdf() const +std::wstring CFormatsList::GetPdf() const { return m_pdf; } -bool CFormatsList::IsDocument(int format) const +bool CFormatsList::IsDocument(const std::wstring& ext) const { - return std::find(m_documents.begin(), m_documents.end(), format) != m_documents.end(); + return std::find(m_documents.begin(), m_documents.end(), ext) != m_documents.end(); } -bool CFormatsList::IsPresentation(int format) const +bool CFormatsList::IsPresentation(const std::wstring& ext) const { - return std::find(m_presentations.begin(), m_presentations.end(), format) != m_presentations.end(); + return std::find(m_presentations.begin(), m_presentations.end(), ext) != m_presentations.end(); } -bool CFormatsList::IsSpreadsheet(int format) const +bool CFormatsList::IsSpreadsheet(const std::wstring& ext) const { - return std::find(m_spreadsheets.begin(), m_spreadsheets.end(), format) != m_spreadsheets.end(); + return std::find(m_spreadsheets.begin(), m_spreadsheets.end(), ext) != m_spreadsheets.end(); } -bool CFormatsList::IsCrossplatform(int format) const +bool CFormatsList::IsCrossplatform(const std::wstring& ext) const { - return std::find(m_crossplatform.begin(), m_crossplatform.end(), format) != m_crossplatform.end(); + return std::find(m_crossplatform.begin(), m_crossplatform.end(), ext) != m_crossplatform.end(); } -bool CFormatsList::IsImage(int format) const +bool CFormatsList::IsImage(const std::wstring& ext) const { - return std::find(m_images.begin(), m_images.end(), format) != m_images.end(); + return std::find(m_images.begin(), m_images.end(), ext) != m_images.end(); } -bool CFormatsList::IsPdf(int format) const +bool CFormatsList::IsPdf(const std::wstring& ext) const { - return format == m_pdf; + return ext == m_pdf; } -void CFormatsList::SetDefault() +void CFormatsList::AddDocument(const std::wstring& ext) { - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX_FLAT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX_PACKAGE); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCXF); - - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX_PACKAGE); - - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_FLAT); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_PACKAGE); - - m_crossplatform.push_back(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU); - m_crossplatform.push_back(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS); - - m_images.push_back(AVS_OFFICESTUDIO_FILE_IMAGE_JPG); - m_images.push_back(AVS_OFFICESTUDIO_FILE_IMAGE_PNG); - - m_pdf = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF; + m_documents.push_back(ext); +} +void CFormatsList::AddPresentation(const std::wstring& ext) +{ + m_presentations.push_back(ext); +} +void CFormatsList::AddSpreadsheet(const std::wstring& ext) +{ + m_spreadsheets.push_back(ext); +} +void CFormatsList::AddCrossplatform(const std::wstring& ext) +{ + m_crossplatform.push_back(ext); +} +void CFormatsList::AddImage(const std::wstring& ext) +{ + m_images.push_back(ext); } -void CFormatsList::SetOutput() +std::vector CFormatsList::GetAllExts() const { - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX); -// m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML); -// m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2); -// m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_MOBI); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM); -// m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT); -// m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT); -// m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX_FLAT); -// m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER); -// m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX_PACKAGE); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM); - m_documents.push_back(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCXF); + std::vector all_formats; - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX); -// m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM); -// m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT); - m_presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP); -// presentations.push_back(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX_PACKAGE); - - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX); -// m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM); -// m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB); -// m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT); - m_spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS); -// spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_FLAT); -// spreadsheets.push_back(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_PACKAGE); - - m_crossplatform.push_back(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU); - m_crossplatform.push_back(AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS); - - m_images.push_back(AVS_OFFICESTUDIO_FILE_IMAGE_JPG); - m_images.push_back(AVS_OFFICESTUDIO_FILE_IMAGE_PNG); - - m_pdf = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF; -} -std::vector CFormatsList::AllFormats() const -{ - std::vector all_formats; - - for(auto val : m_documents) + for(auto& val : m_documents) all_formats.push_back(val); - for(auto val : m_presentations) + for(auto& val : m_presentations) all_formats.push_back(val); - for(auto val : m_spreadsheets) + for(auto& val : m_spreadsheets) all_formats.push_back(val); - for(auto val : m_images) + for(auto& val : m_images) all_formats.push_back(val); - for(auto val : m_crossplatform) + for(auto& val : m_crossplatform) all_formats.push_back(val); all_formats.push_back(m_pdf); @@ -198,6 +135,126 @@ std::vector CFormatsList::AllFormats() const return all_formats; } +CFormatsList CFormatsList::GetDefaultExts() +{ + CFormatsList list; + + list.m_documents.push_back(L"doct"); + list.m_documents.push_back(L"doc"); + list.m_documents.push_back(L"docm"); + list.m_documents.push_back(L"docx"); + list.m_documents.push_back(L"docxf"); + list.m_documents.push_back(L"dot"); + list.m_documents.push_back(L"dotm"); + list.m_documents.push_back(L"dotx"); + list.m_documents.push_back(L"epub"); + list.m_documents.push_back(L"fb2"); + list.m_documents.push_back(L"fodt"); + list.m_documents.push_back(L"htm"); + list.m_documents.push_back(L"html"); + list.m_documents.push_back(L"mht"); + list.m_documents.push_back(L"odt"); + list.m_documents.push_back(L"ott"); + list.m_documents.push_back(L"oxps"); + list.m_documents.push_back(L"rtf"); + list.m_documents.push_back(L"stw"); + list.m_documents.push_back(L"sxw"); + list.m_documents.push_back(L"txt"); + list.m_documents.push_back(L"wps"); + list.m_documents.push_back(L"wpt"); + + list.m_presentations.push_back(L"pptt"); + list.m_presentations.push_back(L"dps"); + list.m_presentations.push_back(L"dpt"); + list.m_presentations.push_back(L"fodp"); + list.m_presentations.push_back(L"odp"); + list.m_presentations.push_back(L"otp"); + list.m_presentations.push_back(L"pot"); + list.m_presentations.push_back(L"potm"); + list.m_presentations.push_back(L"potx"); + list.m_presentations.push_back(L"pps"); + list.m_presentations.push_back(L"ppsm"); + list.m_presentations.push_back(L"ppsx"); + list.m_presentations.push_back(L"ppt"); + list.m_presentations.push_back(L"pptm"); + list.m_presentations.push_back(L"pptx"); + list.m_presentations.push_back(L"sxi"); + + list.m_spreadsheets.push_back(L"xlst"); + list.m_spreadsheets.push_back(L"csv"); + list.m_spreadsheets.push_back(L"et"); + list.m_spreadsheets.push_back(L"ett"); + list.m_spreadsheets.push_back(L"fods"); + list.m_spreadsheets.push_back(L"ods"); + list.m_spreadsheets.push_back(L"ots"); + list.m_spreadsheets.push_back(L"sxc"); + list.m_spreadsheets.push_back(L"xls"); + list.m_spreadsheets.push_back(L"xlsb"); + list.m_spreadsheets.push_back(L"xlsm"); + list.m_spreadsheets.push_back(L"xlsx"); + list.m_spreadsheets.push_back(L"xlt"); + list.m_spreadsheets.push_back(L"xltm"); + list.m_spreadsheets.push_back(L"xltx"); + + list.m_crossplatform.push_back(L"djvu"); + list.m_crossplatform.push_back(L"xps"); + + list.m_images.push_back(L"jpg"); + list.m_images.push_back(L"png"); + + list.m_pdf = L"pdf"; + + return list; +} + +CFormatsList CFormatsList::GetOutputExts() +{ + CFormatsList list; + + list.m_documents.push_back(L"doct"); + list.m_documents.push_back(L"docm"); + list.m_documents.push_back(L"docx"); + list.m_documents.push_back(L"docxf"); + list.m_documents.push_back(L"dotm"); + list.m_documents.push_back(L"dotx"); + list.m_documents.push_back(L"epub"); + list.m_documents.push_back(L"fb2"); + list.m_documents.push_back(L"html"); + list.m_documents.push_back(L"odt"); + list.m_documents.push_back(L"ott"); + list.m_documents.push_back(L"rtf"); + list.m_documents.push_back(L"txt"); + + list.m_presentations.push_back(L"pptt"); + list.m_presentations.push_back(L"odp"); + list.m_presentations.push_back(L"otp"); + list.m_presentations.push_back(L"potm"); + list.m_presentations.push_back(L"potx"); + list.m_presentations.push_back(L"ppsm"); + list.m_presentations.push_back(L"ppsx"); + list.m_presentations.push_back(L"pptm"); + list.m_presentations.push_back(L"pptx"); + + list.m_spreadsheets.push_back(L"xlst"); + list.m_spreadsheets.push_back(L"csv"); + list.m_spreadsheets.push_back(L"ods"); + list.m_spreadsheets.push_back(L"ots"); + list.m_spreadsheets.push_back(L"xlsm"); + list.m_spreadsheets.push_back(L"xlsx"); + list.m_spreadsheets.push_back(L"xltm"); + list.m_spreadsheets.push_back(L"xltx"); + + list.m_crossplatform.push_back(L"djvu"); + list.m_crossplatform.push_back(L"xps"); + + list.m_images.push_back(L"jpg"); + list.m_images.push_back(L"png"); + + list.m_pdf = L"pdf"; + + return list; +} + Cx2tTester::Cx2tTester(const std::wstring& configPath) { m_bIsUseSystemFonts = true; @@ -206,13 +263,16 @@ Cx2tTester::Cx2tTester(const std::wstring& configPath) m_bIsDeleteOk = false; m_bIsFilenameCsvTxtParams = true; m_bIsFilenamePassword = true; + m_bTroughConversion = false; m_defaultCsvDelimiter = L";"; m_defaultCsvTxtEndcoding = L"UTF-8"; - m_inputFormatsList.SetDefault(); - m_outputFormatsList.SetOutput(); + m_inputFormatsList = CFormatsList::GetDefaultExts(); + m_outputFormatsList = CFormatsList::GetOutputExts(); m_timeout = 5 * 60; // 5 min SetConfig(configPath); m_errorsXmlDirectory = m_outputDirectory + FILE_SEPARATOR_STR + L"_errors"; + m_troughConversionDirectory = m_outputDirectory + FILE_SEPARATOR_STR + L"_t"; + m_fontsDirectory = NSFile::GetProcessDirectory() + FILE_SEPARATOR_STR + L"fonts"; // CorrectPathW works strange with directories starts with "./" @@ -298,6 +358,7 @@ void Cx2tTester::SetConfig(const std::wstring& configPath) else if(name == L"timeout" && !node.GetText().empty()) m_timeout = std::stoi(node.GetText()); else if(name == L"filenameCsvTxtParams" && !node.GetText().empty()) m_bIsFilenameCsvTxtParams = std::stoi(node.GetText()); else if(name == L"filenamePassword" && !node.GetText().empty()) m_bIsFilenamePassword = std::stoi(node.GetText()); + else if(name == L"troughConversion" && !node.GetText().empty()) m_bTroughConversion = std::stoi(node.GetText()); else if(name == L"defaultCsvTxtEncoding" && !node.GetText().empty()) m_defaultCsvTxtEndcoding = node.GetText(); else if(name == L"defaultCsvDelimiter" && !node.GetText().empty()) m_defaultCsvDelimiter = (wchar_t)std::stoi(node.GetText(), nullptr, 16); else if(name == L"inputFilesList" && !node.GetText().empty()) @@ -324,14 +385,14 @@ void Cx2tTester::SetConfig(const std::wstring& configPath) default_input_formats = false; std::wstring extensions = node.GetText(); extensions += L' '; - m_inputFormats = ParseExtensionsString(extensions, m_inputFormatsList); + m_inputExts = ParseExtensionsString(extensions, m_inputFormatsList); } else if(name == L"output" && !node.GetText().empty()) { default_output_formats = false; std::wstring extensions = node.GetText(); extensions += L' '; - m_outputFormats = ParseExtensionsString(extensions, m_outputFormatsList); + m_outputExts = ParseExtensionsString(extensions, m_outputFormatsList); } else if (name == L"fonts") { @@ -352,12 +413,10 @@ void Cx2tTester::SetConfig(const std::wstring& configPath) } if(default_input_formats) - m_inputFormats = m_inputFormatsList.AllFormats(); + m_inputExts = m_inputFormatsList.GetAllExts(); if(default_output_formats) - m_outputFormats = m_outputFormatsList.AllFormats(); - - + m_outputExts = m_outputFormatsList.GetAllExts(); } void Cx2tTester::Start() { @@ -365,9 +424,8 @@ void Cx2tTester::Start() m_timeStart = NSTimers::GetTickCount(); // check fonts - std::wstring fonts_directory = NSFile::GetProcessDirectory() + FILE_SEPARATOR_STR + L"fonts"; CApplicationFontsWorker fonts_worker; - fonts_worker.m_sDirectory = fonts_directory; + fonts_worker.m_sDirectory = m_fontsDirectory; if (!NSDirectory::Exists(fonts_worker.m_sDirectory)) NSDirectory::CreateDirectory(fonts_worker.m_sDirectory); @@ -387,6 +445,7 @@ void Cx2tTester::Start() m_outputDirectory = CorrectPathW(m_outputDirectory); m_errorsXmlDirectory = CorrectPathW(m_errorsXmlDirectory); + m_troughConversionDirectory = CorrectPathW(m_troughConversionDirectory); // setup & clear output folder if(NSDirectory::Exists(m_outputDirectory)) @@ -406,12 +465,10 @@ void Cx2tTester::Start() { std::wstring& input_file = files[i]; std::wstring input_filename = NSFile::GetFileName(input_file); - std::wstring input_ext = NSFile::GetFileExtention(input_file); - int input_format = COfficeFileFormatChecker::GetFormatByExtension(L'.' + input_ext); // if no format in input formats - skip - if(std::find(m_inputFormats.begin(), m_inputFormats.end(), input_format) == m_inputFormats.end() + if(std::find(m_inputExts.begin(), m_inputExts.end(), input_ext) == m_inputExts.end() || (std::find(m_inputFiles.begin(), m_inputFiles.end(), input_filename) == m_inputFiles.end() && !m_inputFiles.empty())) { @@ -423,49 +480,77 @@ void Cx2tTester::Start() if(files.size() < m_maxProc) m_maxProc = files.size(); + // conversion in _t directory -> _t directory to output + if(m_bTroughConversion) + { + if(NSDirectory::Exists(m_troughConversionDirectory)) + NSDirectory::DeleteDirectory(m_troughConversionDirectory); + + NSDirectory::CreateDirectory(m_troughConversionDirectory); + + auto copy_outputDirectory = m_outputDirectory; + auto copy_outputExts = m_outputExts; + + m_outputDirectory = m_troughConversionDirectory; + m_outputExts = {L"doct", L"xlst", L"pptt"}; + + Convert(files, true); + + m_outputDirectory = copy_outputDirectory; + m_outputExts = copy_outputExts; + m_inputDirectory = m_troughConversionDirectory; + + files = NSDirectory::GetFiles(m_troughConversionDirectory, true); + } + + Convert(files); + WriteTime(); +} + +void Cx2tTester::Convert(const std::vector& files, bool bNoDirectory) +{ for(int i = 0; i < files.size(); i++) { - std::wstring& input_file = files[i]; + const std::wstring& input_file = files[i]; std::wstring input_filename = NSFile::GetFileName(input_file); - - std::wstring input_ext = L'.' + NSFile::GetFileExtention(input_file); - int input_format = COfficeFileFormatChecker::GetFormatByExtension(input_ext); - + std::wstring input_ext = NSFile::GetFileExtention(input_file); std::wstring input_file_directory = NSFile::GetDirectoryName(input_file); // takes full directory after input folder std::wstring input_subfolders = input_file_directory.substr(m_inputDirectory.size(), input_file_directory.size() - m_inputDirectory.size()); - std::wstring output_files_directory = m_outputDirectory + input_subfolders + FILE_SEPARATOR_STR + input_filename; + std::wstring output_files_directory = m_outputDirectory + input_subfolders; + if(!bNoDirectory) + output_files_directory += FILE_SEPARATOR_STR + input_filename; // setup output_formats for file - std::vector output_file_formats; + std::vector output_file_exts; - for(auto format : m_outputFormats) + for(auto& ext : m_outputExts) { // documents -> documents - if(((m_outputFormatsList.IsDocument(format) && m_inputFormatsList.IsDocument(input_format)) + if(((m_outputFormatsList.IsDocument(ext) && m_inputFormatsList.IsDocument(input_ext)) // spreadsheets -> spreadsheets - || (m_outputFormatsList.IsSpreadsheet(format) && m_inputFormatsList.IsSpreadsheet(input_format)) + || (m_outputFormatsList.IsSpreadsheet(ext) && m_inputFormatsList.IsSpreadsheet(input_ext)) //presentations -> presentations - || (m_outputFormatsList.IsPresentation(format) && m_inputFormatsList.IsPresentation(input_format)) + || (m_outputFormatsList.IsPresentation(ext) && m_inputFormatsList.IsPresentation(input_ext)) // xps -> docx - || (format == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX && input_format == AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS) + || (ext == L"docx" && input_ext == L"xps") // pdf -> docx - || (format == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX && m_inputFormatsList.IsPdf(input_format)) + || (ext == L"docx" && m_inputFormatsList.IsPdf(input_ext)) // all formats -> images - || m_outputFormatsList.IsImage(format) + || m_outputFormatsList.IsImage(ext) // all formats -> pdf - || m_outputFormatsList.IsPdf(format)) + || m_outputFormatsList.IsPdf(ext)) // input format != output format - && format != input_format) + && ext != input_ext) { - output_file_formats.push_back(format); + output_file_exts.push_back(ext); } } - if(output_file_formats.empty()) + if(output_file_exts.empty()) continue; // setup & clear output subfolder @@ -477,8 +562,8 @@ void Cx2tTester::Start() // setup csv & txt additional params if(m_bIsFilenameCsvTxtParams - || input_format == AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT - || input_format == AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV) + || input_ext == L"txt" + || input_ext == L"csv") { std::wstring find_str = L"[cp"; size_t pos1 = input_filename.find(find_str); @@ -495,7 +580,7 @@ void Cx2tTester::Start() break; } - if(m_bIsFilenameCsvTxtParams || input_format == AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV) + if(m_bIsFilenameCsvTxtParams || input_ext == L"csv") { std::wstring find_str = L"[del%"; size_t pos1 = input_filename.find(find_str); @@ -525,10 +610,10 @@ void Cx2tTester::Start() // setup & start new coverter CConverter *converter = new CConverter(this); converter->SetInputFile(input_file); - converter->SetInputFormat(input_format); + converter->SetInputExt(input_ext); converter->SetOutputFilesDirectory(output_files_directory); - converter->SetOutputFormats(output_file_formats); - converter->SetFontsDirectory(fonts_directory); + converter->SetOutputExts(output_file_exts); + converter->SetFontsDirectory(m_fontsDirectory); converter->SetX2tPath(m_x2tPath); converter->SetErrorsOnly(m_bIsErrorsOnly); converter->SetDeleteOk(m_bIsDeleteOk); @@ -549,8 +634,6 @@ void Cx2tTester::Start() // waiting all procs end while(!IsAllFree()) NSThreads::Sleep(150); - - WriteTime(); } void Cx2tTester::WriteReportHeader() { @@ -610,31 +693,29 @@ bool Cx2tTester::IsAllFree() return m_currentProc == 0; } -std::vector Cx2tTester::ParseExtensionsString(std::wstring extensions, const CFormatsList& fl) +std::vector Cx2tTester::ParseExtensionsString(std::wstring extensions, const CFormatsList& fl) { - std::vector formats; + std::vector exts; int pos = 0; while ((pos = extensions.find(' ')) != std::wstring::npos) { std::wstring ext = extensions.substr(0, pos); if(ext == L"documents") - formats = fl.GetDocuments(); + exts = fl.GetDocuments(); else if(ext == L"presentations") - formats = fl.GetPresentations(); + exts = fl.GetPresentations(); else if(ext == L"spreadsheets") - formats = fl.GetSpreadsheets(); + exts = fl.GetSpreadsheets(); + + else if (pos != 0) + exts.push_back(ext); - else - { - int format = COfficeFileFormatChecker::GetFormatByExtension(L'.' + ext); - formats.push_back(format); - } extensions.erase(0, pos + 1); } - return formats; + return exts; } CConverter::CConverter(Cx2tTester* internal) : m_internal(internal) @@ -649,17 +730,17 @@ void CConverter::SetInputFile(const std::wstring& inputFile) { m_inputFile = inputFile; } -void CConverter::SetInputFormat(int inputFormat) +void CConverter::SetInputExt(const std::wstring& inputExt) { - m_inputFormat = inputFormat; + m_inputExt = inputExt; } void CConverter::SetOutputFilesDirectory(const std::wstring& outputFilesDirectory) { m_outputFilesDirectory = outputFilesDirectory; } -void CConverter::SetOutputFormats(const std::vector outputFormats) +void CConverter::SetOutputExts(const std::vector& outputExts) { - m_outputFormats = outputFormats; + m_outputExts = outputExts; } void CConverter::SetFontsDirectory(const std::wstring& fontsDirectory) { @@ -725,11 +806,11 @@ DWORD CConverter::ThreadProc() #endif // WIN32 // input_format in many output exts - for(int i = 0; i < m_outputFormats.size(); i++) + for(int i = 0; i < m_outputExts.size(); i++) { - int& output_format = m_outputFormats[i]; + std::wstring output_ext = L"."+ m_outputExts[i]; + int output_format = checker.GetFormatByExtension(output_ext); - std::wstring output_ext = checker.GetExtensionByType(output_format); std::wstring xml_params_filename = input_filename + L"_" + output_ext + L".xml"; std::wstring xml_params_file = m_outputFilesDirectory + FILE_SEPARATOR_STR + xml_params_filename; @@ -784,7 +865,7 @@ DWORD CConverter::ThreadProc() } // csv & txt needs encoding param - if(m_inputFormat == AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT || m_inputFormat == AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV) + if(m_inputExt == L"txt" || m_inputExt == L"csv") { builder.WriteString(L""); builder.WriteEncodeXmlString(std::to_wstring(m_csvTxtEncoding)); @@ -792,7 +873,7 @@ DWORD CConverter::ThreadProc() } // csv needs delimiter param - if(m_inputFormat == AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV) + if(m_inputExt == L"csv") { builder.WriteString(L""); builder.WriteEncodeXmlString(m_csvDelimiter); @@ -911,7 +992,7 @@ DWORD CConverter::ThreadProc() // output_CS start m_internal->m_outputCS.Enter(); - std::cout << "[" << m_currFile << "/" << m_totalFiles << "](" << i + 1 << "/" << m_outputFormats.size() << ") "; + std::cout << "[" << m_currFile << "/" << m_totalFiles << "](" << i + 1 << "/" << m_outputExts.size() << ") "; std::cout << "(" << m_internal->m_currentProc << " processes now) "; std::cout << input_file_UTF8 << " to " << output_file_UTF8 << " "; diff --git a/Test/Applications/x2tTester/x2tTester.h b/Test/Applications/x2tTester/x2tTester.h index 12d7074667..d01badb32d 100644 --- a/Test/Applications/x2tTester/x2tTester.h +++ b/Test/Applications/x2tTester/x2tTester.h @@ -25,36 +25,44 @@ class CFormatsList { public: CFormatsList(); + CFormatsList(const CFormatsList& list); + CFormatsList& operator=(const CFormatsList& list); - std::vector GetDocuments() const; - std::vector GetPresentations() const; - std::vector GetSpreadsheets() const; - std::vector GetCrossplatform() const; - std::vector GetImages() const; - int GetPdf() const; + std::vector GetDocuments() const; + std::vector GetPresentations() const; + std::vector GetSpreadsheets() const; + std::vector GetCrossplatform() const; + std::vector GetImages() const; + std::wstring GetPdf() const; - bool IsDocument(int format) const; - bool IsPresentation(int format) const; - bool IsSpreadsheet(int format) const; - bool IsCrossplatform(int format) const; - bool IsImage(int format) const; - bool IsPdf(int format) const; + bool IsDocument(const std::wstring& ext) const; + bool IsPresentation(const std::wstring& ext) const; + bool IsSpreadsheet(const std::wstring& ext) const; + bool IsCrossplatform(const std::wstring& ext) const; + bool IsImage(const std::wstring& ext) const; + bool IsPdf(const std::wstring& ext) const; - // all formats - void SetDefault(); + void AddDocument(const std::wstring& ext); + void AddPresentation(const std::wstring& ext); + void AddSpreadsheet(const std::wstring& ext); + void AddCrossplatform(const std::wstring& ext); + void AddImage(const std::wstring& ext); - // all writable formats - void SetOutput(); + std::vector GetAllExts() const; - std::vector AllFormats() const; + // all supported exts + static CFormatsList GetDefaultExts(); + + // all writable exts + static CFormatsList GetOutputExts(); private: - std::vector m_documents; - std::vector m_presentations; - std::vector m_spreadsheets; - std::vector m_crossplatform; - std::vector m_images; - int m_pdf; + std::vector m_documents; + std::vector m_presentations; + std::vector m_spreadsheets; + std::vector m_crossplatform; + std::vector m_images; + std::wstring m_pdf; }; @@ -96,8 +104,9 @@ public: int m_maxProc; private: - // parse string like "docx txt" into vector of formats - std::vector ParseExtensionsString(std::wstring extensions, const CFormatsList& fl); + // parse string like "docx txt" into vector + std::vector ParseExtensionsString(std::wstring extensions, const CFormatsList& fl); + void Convert(const std::vector& files, bool bNoDirectory = false); // takes from config std::wstring m_reportFile; @@ -106,6 +115,8 @@ private: std::wstring m_x2tPath; std::wstring m_errorsXmlDirectory; + std::wstring m_troughConversionDirectory; + std::wstring m_fontsDirectory; // fonts bool m_bIsUseSystemFonts; @@ -114,12 +125,12 @@ private: NSFile::CFileBinary m_reportStream; // takes from config or sets all - std::vector m_inputFormats; - std::vector m_outputFormats; + std::vector m_inputExts; + std::vector m_outputExts; std::vector m_inputFiles; - // list of formats + // lists CFormatsList m_inputFormatsList; CFormatsList m_outputFormatsList; @@ -135,6 +146,9 @@ private: unsigned long m_timeout; unsigned long m_timeStart; + + // format -> *t format -> all formats + bool m_bTroughConversion; }; // generates temp xml, convert, calls m_internal->writeReport @@ -145,9 +159,9 @@ public: virtual ~CConverter(); void SetInputFile(const std::wstring& inputFile); - void SetInputFormat(int inputFormat); + void SetInputExt(const std::wstring& inputExt); void SetOutputFilesDirectory(const std::wstring& outputFilesDirectory); - void SetOutputFormats(const std::vector outputFormats); + void SetOutputExts(const std::vector& outputExts); void SetFontsDirectory(const std::wstring& fontsDirectory); void SetX2tPath(const std::wstring& x2tPath); void SetErrorsOnly(bool bIsErrorsOnly); @@ -163,12 +177,11 @@ public: private: Cx2tTester* m_internal; - std::wstring m_inputFile; - int m_inputFormat; std::wstring m_outputFilesDirectory; - std::vector m_outputFormats; + std::vector m_outputExts; + std::wstring m_inputExt; std::wstring m_fontsDirectory; COfficeFileFormatChecker checker; diff --git a/TxtFile/Source/ConvertDocx2Txt.cpp b/TxtFile/Source/ConvertDocx2Txt.cpp index 085f5bfe3f..4b7dd6f489 100644 --- a/TxtFile/Source/ConvertDocx2Txt.cpp +++ b/TxtFile/Source/ConvertDocx2Txt.cpp @@ -62,10 +62,10 @@ namespace Docx2Txt void convert(); - void writeUtf8 (const std::wstring& path) const; - void writeUnicode (const std::wstring& path) const; - void writeBigEndian (const std::wstring& path) const; - void writeAnsi (const std::wstring& path) const; + bool writeUtf8 (const std::wstring& path) const; + bool writeUnicode (const std::wstring& path) const; + bool writeBigEndian (const std::wstring& path) const; + bool writeAnsi (const std::wstring& path) const; Txt::File m_outputFile; OOX::CDocx m_inputFile; @@ -115,33 +115,32 @@ namespace Docx2Txt return converter_->convert(); } - void Converter::read(const std::wstring & path) + bool Converter::read(const std::wstring & path) { - bool res = converter_->m_inputFile.Read(path); - return; + return converter_->m_inputFile.Read(path); } - void Converter::write(const std::wstring & path) + bool Converter::write(const std::wstring & path) { return converter_->m_outputFile.write(path); } - void Converter::writeUtf8(const std::wstring & path) const + bool Converter::writeUtf8(const std::wstring & path) const { return converter_->writeUtf8(path); } - void Converter::writeUnicode(const std::wstring & path) const + bool Converter::writeUnicode(const std::wstring & path) const { return converter_->writeUnicode(path); } - void Converter::writeBigEndian(const std::wstring & path) const + bool Converter::writeBigEndian(const std::wstring & path) const { return converter_->writeBigEndian(path); } - void Converter::writeAnsi(const std::wstring & path) const + bool Converter::writeAnsi(const std::wstring & path) const { return converter_->writeAnsi(path); } @@ -204,27 +203,21 @@ namespace Docx2Txt } - void Converter_Impl::writeUtf8(const std::wstring& path) const + bool Converter_Impl::writeUtf8(const std::wstring& path) const { - m_outputFile.writeUtf8(path); + return m_outputFile.writeUtf8(path); } - - - void Converter_Impl::writeUnicode(const std::wstring& path) const + bool Converter_Impl::writeUnicode(const std::wstring& path) const { - m_outputFile.writeUnicode(path); + return m_outputFile.writeUnicode(path); } - - - void Converter_Impl::writeBigEndian(const std::wstring& path) const + bool Converter_Impl::writeBigEndian(const std::wstring& path) const { - m_outputFile.writeBigEndian(path); + return m_outputFile.writeBigEndian(path); } - - - void Converter_Impl::writeAnsi(const std::wstring& path) const + bool Converter_Impl::writeAnsi(const std::wstring& path) const { - m_outputFile.writeAnsi(path); + return m_outputFile.writeAnsi(path); } void Converter_Impl::convert(OOX::WritingElement* item, std::vector& textOut, bool bEnter, OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles) diff --git a/TxtFile/Source/ConvertDocx2Txt.h b/TxtFile/Source/ConvertDocx2Txt.h index 3279bff2b7..a8ee8ea276 100644 --- a/TxtFile/Source/ConvertDocx2Txt.h +++ b/TxtFile/Source/ConvertDocx2Txt.h @@ -44,13 +44,13 @@ namespace Docx2Txt void convert(); - void read (const std::wstring& path); - void write (const std::wstring& path); + bool read (const std::wstring& path); + bool write (const std::wstring& path); - void writeUtf8 (const std::wstring& path) const; - void writeUnicode (const std::wstring& path) const; - void writeBigEndian (const std::wstring& path) const; - void writeAnsi (const std::wstring& path) const; + bool writeUtf8 (const std::wstring& path) const; + bool writeUnicode (const std::wstring& path) const; + bool writeBigEndian (const std::wstring& path) const; + bool writeAnsi (const std::wstring& path) const; private: Converter_Impl * converter_; diff --git a/TxtFile/Source/TxtFormat/File.cpp b/TxtFile/Source/TxtFormat/File.cpp index 81ffb75ff8..6194bee903 100644 --- a/TxtFile/Source/TxtFormat/File.cpp +++ b/TxtFile/Source/TxtFormat/File.cpp @@ -189,40 +189,40 @@ namespace Txt m_listContentSize = file.getLinesCount(); } - void File::write(const std::wstring& filename) const + bool File::write(const std::wstring& filename) const { TxtFile file(filename); - file.writeUtf8(NSEncoding::transformFromUnicode(m_listContent, 46)); + return file.writeUtf8(NSEncoding::transformFromUnicode(m_listContent, 46)); } - void File::writeCodePage(const std::wstring& filename, int code_page) const + bool File::writeCodePage(const std::wstring& filename, int code_page) const { TxtFile file(filename); - file.writeAnsiOrCodePage(NSEncoding::transformFromUnicode(m_listContent, code_page)); + return file.writeAnsiOrCodePage(NSEncoding::transformFromUnicode(m_listContent, code_page)); } - void File::writeUtf8(const std::wstring& filename) const + bool File::writeUtf8(const std::wstring& filename) const { TxtFile file(filename); - file.writeUtf8(NSEncoding::transformFromUnicode(m_listContent, 46)); + return file.writeUtf8(NSEncoding::transformFromUnicode(m_listContent, 46)); } - void File::writeUnicode(const std::wstring& filename) const + bool File::writeUnicode(const std::wstring& filename) const { TxtFile file(filename); - file.writeUnicode(m_listContent); + return file.writeUnicode(m_listContent); } - void File::writeBigEndian(const std::wstring& filename) const + bool File::writeBigEndian(const std::wstring& filename) const { TxtFile file(filename); - file.writeBigEndian(m_listContent); + return file.writeBigEndian(m_listContent); } - void File::writeAnsi(const std::wstring& filename) const + bool File::writeAnsi(const std::wstring& filename) const { TxtFile file(filename); - file.writeAnsiOrCodePage(NSEncoding::transformFromUnicode(m_listContent, -1)); + return file.writeAnsiOrCodePage(NSEncoding::transformFromUnicode(m_listContent, -1)); } const bool File::isValid(const std::wstring& filename) const diff --git a/TxtFile/Source/TxtFormat/File.h b/TxtFile/Source/TxtFormat/File.h index dce87c93f6..5d1a1e53a8 100644 --- a/TxtFile/Source/TxtFormat/File.h +++ b/TxtFile/Source/TxtFormat/File.h @@ -45,13 +45,13 @@ namespace Txt void read (const std::wstring& filename); void read (const std::wstring& filename, int code_page); - void write (const std::wstring& filename) const; + bool write (const std::wstring& filename) const; - void writeCodePage (const std::wstring& filename, int code_page) const; - void writeUtf8 (const std::wstring& filename) const; - void writeUnicode (const std::wstring& filename) const; - void writeBigEndian (const std::wstring& filename) const; - void writeAnsi (const std::wstring& filename) const; + bool writeCodePage (const std::wstring& filename, int code_page) const; + bool writeUtf8 (const std::wstring& filename) const; + bool writeUnicode (const std::wstring& filename) const; + bool writeBigEndian (const std::wstring& filename) const; + bool writeAnsi (const std::wstring& filename) const; const bool isValid (const std::wstring& filename) const; diff --git a/TxtFile/Source/TxtFormat/TxtFile.cpp b/TxtFile/Source/TxtFormat/TxtFile.cpp index a17eeff7d2..45d77c9562 100644 --- a/TxtFile/Source/TxtFormat/TxtFile.cpp +++ b/TxtFile/Source/TxtFormat/TxtFile.cpp @@ -192,109 +192,109 @@ const std::vector TxtFile::readUtf8() return result; } -void TxtFile::writeAnsiOrCodePage(const std::vector& content) // === writeUtf8withoutPref также +bool TxtFile::writeAnsiOrCodePage(const std::vector& content) // === writeUtf8withoutPref также { NSFile::CFileBinary file; - if (file.CreateFileW(m_path)) - { - BYTE endLine[2] = {0x0d, 0x0a}; - for (std::vector::const_iterator iter = content.begin(); iter != content.end(); ++iter) - { - file.WriteFile((BYTE*)(*iter).c_str(), (*iter).length()); - file.WriteFile(endLine, 2); + if (!file.CreateFileW(m_path)) return false; - m_linesCount++; - } + BYTE endLine[2] = {0x0d, 0x0a}; + for (std::vector::const_iterator iter = content.begin(); iter != content.end(); ++iter) + { + file.WriteFile((BYTE*)(*iter).c_str(), (*iter).length()); + file.WriteFile(endLine, 2); + + m_linesCount++; } + return true; } -void TxtFile::writeUnicode(const std::vector& content) +bool TxtFile::writeUnicode(const std::vector& content) { NSFile::CFileBinary file; - if (file.CreateFileW(m_path)) + if (!file.CreateFileW(m_path)) return false; + + BYTE Header[2] = {0xff, 0xfe}; + BYTE EndLine[4] = { 0x0d, 0x00, 0x0a, 0x00 }; + + file.WriteFile(Header, 2); + + for (std::vector::const_iterator iter = content.begin(); iter != content.end(); ++iter) { - BYTE Header[2] = {0xff, 0xfe}; - BYTE EndLine[4] = {0x0d, 0x00, 0x0a, 0x00}; - - file.WriteFile(Header,2); + const wchar_t * data = (*iter).c_str(); + int size = (*iter).length(); - for (std::vector::const_iterator iter = content.begin(); iter != content.end(); ++iter) + if (sizeof(wchar_t) == 2) { - const wchar_t * data = (*iter).c_str(); - int size = (*iter).length(); - - if(sizeof(wchar_t) == 2) - { - file.WriteFile((BYTE*)data, size << 1); - } - else - { - //convert Utf 32 to Utf 16 - } - - file.WriteFile(EndLine, 4); - m_linesCount++; + file.WriteFile((BYTE*)data, size << 1); } - file.CloseFile(); - } -} - -void TxtFile::writeBigEndian(const std::vector& content) -{ - NSFile::CFileBinary file; - if (file.CreateFileW(m_path)) - { - BYTE Header[2] = {0xfe, 0xff}; - BYTE EndLine[4] = {0x00, 0x0d, 0x00, 0x0a}; - - file.WriteFile(Header,2); - - for (std::vector::const_iterator iter = content.begin(); iter != content.end(); ++iter) + else { - if(sizeof(wchar_t) == 2) - { - BYTE* data = (BYTE*)(*iter).c_str(); - int size = (*iter).length(); - //swap bytes - for (long i = 0; i < size << 1; i+=2) - { - char v = data[i]; - data[i] = data[i+1]; - data[i+1] = v; - } - file.WriteFile((BYTE*)(*iter).c_str(), size << 1); - } - else - { - //convert Utf 32 to Utf 16 - } - - file.WriteFile(EndLine, 4); - m_linesCount++; + //convert Utf 32 to Utf 16 } - file.CloseFile(); - } -} -void TxtFile::writeUtf8(const std::vector& content) -{ - NSFile::CFileBinary file; - if (file.CreateFileW(m_path)) - { - BYTE Header[3] = {0xef ,0xbb , 0xbf}; - BYTE EndLine[2] = {0x0d ,0x0a}; - - file.WriteFile(Header,3); - - for (std::vector::const_iterator iter = content.begin(); iter != content.end(); ++iter) - { - file.WriteFile((BYTE*)(*iter).c_str(), (*iter).length()); - file.WriteFile((BYTE*)EndLine, 2); - - m_linesCount++; - } - file.CloseFile(); + file.WriteFile(EndLine, 4); + m_linesCount++; } + file.CloseFile(); + return true; +} + +bool TxtFile::writeBigEndian(const std::vector& content) +{ + NSFile::CFileBinary file; + if (!file.CreateFileW(m_path)) return false; + + BYTE Header[2] = {0xfe, 0xff}; + BYTE EndLine[4] = { 0x00, 0x0d, 0x00, 0x0a }; + + file.WriteFile(Header, 2); + + for (std::vector::const_iterator iter = content.begin(); iter != content.end(); ++iter) + { + if (sizeof(wchar_t) == 2) + { + BYTE* data = (BYTE*)(*iter).c_str(); + int size = (*iter).length(); + //swap bytes + for (long i = 0; i < size << 1; i += 2) + { + char v = data[i]; + data[i] = data[i + 1]; + data[i + 1] = v; + } + file.WriteFile((BYTE*)(*iter).c_str(), size << 1); + } + else + { + //convert Utf 32 to Utf 16 + } + + file.WriteFile(EndLine, 4); + m_linesCount++; + } + file.CloseFile(); + return true; +} + +bool TxtFile::writeUtf8(const std::vector& content) +{ + NSFile::CFileBinary file; + if (!file.CreateFileW(m_path)) return false; + + BYTE Header[3] = { 0xef ,0xbb , 0xbf }; + BYTE EndLine[2] = { 0x0d ,0x0a }; + + file.WriteFile(Header, 3); + + for (std::vector::const_iterator iter = content.begin(); iter != content.end(); ++iter) + { + file.WriteFile((BYTE*)(*iter).c_str(), (*iter).length()); + file.WriteFile((BYTE*)EndLine, 2); + + m_linesCount++; + } + file.CloseFile(); + return true; } const bool TxtFile::isUnicode() diff --git a/TxtFile/Source/TxtFormat/TxtFile.h b/TxtFile/Source/TxtFormat/TxtFile.h index bb19559150..6117bd11f1 100644 --- a/TxtFile/Source/TxtFormat/TxtFile.h +++ b/TxtFile/Source/TxtFormat/TxtFile.h @@ -48,10 +48,10 @@ public: const std::vector readBigEndian(); const std::vector readUtf8(); - void writeAnsiOrCodePage (const std::vector& content); - void writeUnicode (const std::vector& content); - void writeBigEndian (const std::vector& content); - void writeUtf8 (const std::vector& content); + bool writeAnsiOrCodePage (const std::vector& content); + bool writeUnicode (const std::vector& content); + bool writeBigEndian (const std::vector& content); + bool writeUtf8 (const std::vector& content); const bool isUnicode(); const bool isBigEndian(); diff --git a/TxtFile/Source/TxtXmlFile.cpp b/TxtFile/Source/TxtXmlFile.cpp index 04b43389a1..2d5e77b77a 100644 --- a/TxtFile/Source/TxtXmlFile.cpp +++ b/TxtFile/Source/TxtXmlFile.cpp @@ -121,35 +121,40 @@ _UINT32 CTxtXmlFile::txt_LoadFromFile(const std::wstring & sSrcFileName, const s _UINT32 CTxtXmlFile::txt_SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcPath, const std::wstring & sXMLOptions) { + bool result = true; + try { Docx2Txt::Converter converter; - converter.read(sSrcPath); - converter.convert(); - - int encoding = ParseTxtOptions(sXMLOptions); - - if (encoding == EncodingType::Utf8) - converter.writeUtf8(sDstFileName); - else if (encoding == EncodingType::Unicode) - converter.writeUnicode(sDstFileName); - else if (encoding == EncodingType::Ansi) - converter.writeAnsi(sDstFileName); - else if (encoding == EncodingType::BigEndian) - converter.writeBigEndian(sDstFileName); - else if (encoding > 0) //code page + result = converter.read(sSrcPath); + if (result) { - converter.write(sDstFileName); + converter.convert(); + + int encoding = ParseTxtOptions(sXMLOptions); + + if (encoding == EncodingType::Utf8) + result = converter.writeUtf8(sDstFileName); + else if (encoding == EncodingType::Unicode) + result = converter.writeUnicode(sDstFileName); + else if (encoding == EncodingType::Ansi) + result = converter.writeAnsi(sDstFileName); + else if (encoding == EncodingType::BigEndian) + result = converter.writeBigEndian(sDstFileName); + else if (encoding > 0) //code page + { + result = converter.write(sDstFileName); + } + else //auto define + result = converter.write(sDstFileName); } - else //auto define - converter.write(sDstFileName); } catch(...) { - return AVS_FILEUTILS_ERROR_CONVERT; + result = false; } - return 0; + return result ? 0 : AVS_FILEUTILS_ERROR_CONVERT; } diff --git a/X2tConverter/src/ASCConverters.cpp b/X2tConverter/src/ASCConverters.cpp index 24fafbfc1c..06e5ebf0bc 100644 --- a/X2tConverter/src/ASCConverters.cpp +++ b/X2tConverter/src/ASCConverters.cpp @@ -3078,11 +3078,12 @@ namespace NExtractTools NSDirectory::CreateDirectory(sTempUnpackedOox); _UINT32 nRes = odf_flat2oox_dir(sFrom, sTempUnpackedOox, sTemp, params); - if(SUCCEEDED_X2T(nRes)) - { - COfficeUtils oCOfficeUtils(NULL); - nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedOox, sTo, true)) ? nRes : AVS_FILEUTILS_ERROR_CONVERT; - } + + if (SUCCEEDED_X2T(nRes)) + { + nRes = dir2zipMscrypt(sTempUnpackedOox, sTo, sTemp, params); + } + return nRes; } _UINT32 odf_flat2oox_dir(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params) @@ -4930,7 +4931,8 @@ namespace NExtractTools IOfficeDrawingFile* pReader = NULL; nRes = PdfDjvuXpsToRenderer(&pReader, &pdfWriter, sFrom, nFormatFrom, sTo, sTemp, params, pApplicationFonts, sPages); - pdfWriter.SaveToFile(sTo); + if (SUCCEEDED_X2T(nRes)) + nRes = S_OK == pdfWriter.SaveToFile(sTo) ? 0 : AVS_FILEUTILS_ERROR_CONVERT; RELEASEOBJECT(pReader); } } diff --git a/X2tConverter/src/cextracttools.cpp b/X2tConverter/src/cextracttools.cpp index 63d253ed4c..c7570adaed 100644 --- a/X2tConverter/src/cextracttools.cpp +++ b/X2tConverter/src/cextracttools.cpp @@ -41,21 +41,21 @@ namespace NExtractTools { TConversionDirection res = TCD_ERROR; - size_t nExt1Pos = sFile1.rfind(_T('.')); - size_t nExt2Pos = sFile2.rfind(_T('.')); + size_t nExt1Pos = sFile1.rfind(L'.'); + size_t nExt2Pos = sFile2.rfind(L'.'); // check for directory (zip task) - size_t nSeparator1Pos = sFile1.rfind(_T('/')); + size_t nSeparator1Pos = sFile1.rfind(L'/'); if (std::wstring::npos == nSeparator1Pos) { - nSeparator1Pos = sFile1.rfind(_T('\\')); + nSeparator1Pos = sFile1.rfind(L'\\'); } // check for directory (unzip task) - int nSeparator2Pos = sFile2.rfind(_T('/')); + int nSeparator2Pos = sFile2.rfind(L'/'); if (std::wstring::npos == nSeparator2Pos) { - nSeparator2Pos = sFile2.rfind(_T('\\')); + nSeparator2Pos = sFile2.rfind(L'\\'); } // check for directory in name @@ -110,11 +110,11 @@ namespace NExtractTools { case AVS_OFFICESTUDIO_FILE_DOCUMENT_XML: { - if (0 == sExt2.compare(_T(".docx"))) + if (0 == sExt2.compare(L".docx") || std::wstring::npos != sExt1.find(L"doc")) { res = TCD_TXT2DOCX; } - else if (0 == sExt2.compare(_T(".xlsx"))) + else if (0 == sExt2.compare(L".xlsx") || std::wstring::npos != sExt1.find(L"xls")) { res = TCD_XML2XLSX; } @@ -126,11 +126,11 @@ namespace NExtractTools case AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM: case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCXF: { - if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOCX2DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOCX2DOCT_BIN; - else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCX2RTF; - else if (0 == sExt2.compare(_T(".odt"))) res = TCD_DOCX2ODT; - else if (0 == sExt2.compare(_T(".docx"))) + if (0 == sExt2.compare(L".doct")) res = TCD_DOCX2DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_DOCX2DOCT_BIN; + else if (0 == sExt2.compare(L".rtf")) res = TCD_DOCX2RTF; + else if (0 == sExt2.compare(L".odt")) res = TCD_DOCX2ODT; + else if (0 == sExt2.compare(L".docx")) { if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX) res = TCD_DOTX2DOCX; @@ -141,42 +141,42 @@ namespace NExtractTools //oform 2 docx ??? //docxf 2 docx ??? } - else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOTM2DOCM; - else if (0 == sExt2.compare(_T(".txt"))) res = TCD_DOCX2TXT; + else if (0 == sExt2.compare(L".docm")) res = TCD_DOTM2DOCM; + else if (0 == sExt2.compare(L".txt")) res = TCD_DOCX2TXT; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX_PACKAGE: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_PACKAGE: case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX_PACKAGE: { - if (0 == sExt2.compare(_T(".doct"))) res = TCD_PKG2BIN_T; - else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PKG2BIN_T; - else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_PKG2BIN_T; - else if (0 == sExt2.compare(_T(".docx"))) res = TCD_PKG2OOXML; - else if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_PKG2OOXML; - else if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PKG2OOXML; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_PKG2BIN; + if (0 == sExt2.compare(L".doct")) res = TCD_PKG2BIN_T; + else if (0 == sExt2.compare(L".pptt")) res = TCD_PKG2BIN_T; + else if (0 == sExt2.compare(L".xlst")) res = TCD_PKG2BIN_T; + else if (0 == sExt2.compare(L".docx")) res = TCD_PKG2OOXML; + else if (0 == sExt2.compare(L".xlsx")) res = TCD_PKG2OOXML; + else if (0 == sExt2.compare(L".pptx")) res = TCD_PKG2OOXML; + else if (0 == sExt2.compare(L".bin")) res = TCD_PKG2BIN; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX_FLAT: { - if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOCXFLAT2DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOCXFLAT2DOCT_BIN; + if (0 == sExt2.compare(L".doct")) res = TCD_DOCXFLAT2DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_DOCXFLAT2DOCT_BIN; }break; case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_FLAT: { - if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLSXFLAT2XLST; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLSXFLAT2XLST_BIN; - else if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLSXFLAT2XLSX; + if (0 == sExt2.compare(L".xlst")) res = TCD_XLSXFLAT2XLST; + else if (0 == sExt2.compare(L".bin")) res = TCD_XLSXFLAT2XLST_BIN; + else if (0 == sExt2.compare(L".xlsx")) res = TCD_XLSXFLAT2XLSX; }break; case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM: { - if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLSX2XLST; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLSX2XLST_BIN; - else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLSX2CSV; - else if (0 == sExt2.compare(_T(".ods"))) res = TCD_XLSX2ODS; - else if (0 == sExt2.compare(_T(".xlsx"))) + if (0 == sExt2.compare(L".xlst")) res = TCD_XLSX2XLST; + else if (0 == sExt2.compare(L".bin")) res = TCD_XLSX2XLST_BIN; + else if (0 == sExt2.compare(L".csv")) res = TCD_XLSX2CSV; + else if (0 == sExt2.compare(L".ods")) res = TCD_XLSX2ODS; + else if (0 == sExt2.compare(L".xlsx")) { if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX) res = TCD_XLTX2XLSX; @@ -185,12 +185,12 @@ namespace NExtractTools if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM) res = TCD_XLTM2XLSX; } - else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLTM2XLSM; - else if (0 == sExt2.compare(_T(".xlsb"))) res = TCD_XLSX2XLSB; + else if (0 == sExt2.compare(L".xlsm")) res = TCD_XLTM2XLSM; + else if (0 == sExt2.compare(L".xlsb")) res = TCD_XLSX2XLSB; }break; case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB: { - if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLSB2XLST; + if (0 == sExt2.compare(L".xlst")) res = TCD_XLSB2XLST; } case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX: case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM: @@ -199,9 +199,9 @@ namespace NExtractTools case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM: case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM: { - if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPTX2PPTT_BIN; - else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPTX2PPTT; - else if (0 == sExt2.compare(_T(".pptx"))) + if (0 == sExt2.compare(L".bin")) res = TCD_PPTX2PPTT_BIN; + else if (0 == sExt2.compare(L".pptt")) res = TCD_PPTX2PPTT; + else if (0 == sExt2.compare(L".pptx")) { if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX) res = TCD_PPSX2PPTX; @@ -214,110 +214,110 @@ namespace NExtractTools if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM) res = TCD_PPSM2PPTX; } - else if (0 == sExt2.compare(_T(".pptm"))) + else if (0 == sExt2.compare(L".pptm")) { if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM) res = TCD_PPSM2PPTM; if (OfficeFileFormatChecker.nFileType == AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM) res = TCD_POTM2PPTM; } - else if (0 == sExt2.compare(_T(".odp"))) res = TCD_PPTX2ODP; + else if (0 == sExt2.compare(L".odp")) res = TCD_PPTX2ODP; }break; case AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY: { - if (0 == sExt2.compare(_T(".oform"))) res = TCD_DOCT2OFORM; - else if (0 == sExt2.compare(_T(".docxf"))) res = TCD_DOCT2DOCXF; - else if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOCT2DOCX; - else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOCT2DOCM; - else if (0 == sExt2.compare(_T(".dotx"))) res = TCD_DOCT2DOTX; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN; - else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCT2RTF; + if (0 == sExt2.compare(L".oform")) res = TCD_DOCT2OFORM; + else if (0 == sExt2.compare(L".docxf")) res = TCD_DOCT2DOCXF; + else if (0 == sExt2.compare(L".docx")) res = TCD_DOCT2DOCX; + else if (0 == sExt2.compare(L".docm")) res = TCD_DOCT2DOCM; + else if (0 == sExt2.compare(L".dotx")) res = TCD_DOCT2DOTX; + else if (0 == sExt2.compare(L".bin")) res = TCD_T2BIN; + else if (0 == sExt2.compare(L".rtf")) res = TCD_DOCT2RTF; }break; case AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY: { - if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLST2XLSX; - else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLST2XLSM; - else if (0 == sExt2.compare(_T(".xltx"))) res = TCD_XLST2XLTX; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN; - else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLST2CSV; + if (0 == sExt2.compare(L".xlsx")) res = TCD_XLST2XLSX; + else if (0 == sExt2.compare(L".xlsm")) res = TCD_XLST2XLSM; + else if (0 == sExt2.compare(L".xltx")) res = TCD_XLST2XLTX; + else if (0 == sExt2.compare(L".bin")) res = TCD_T2BIN; + else if (0 == sExt2.compare(L".csv")) res = TCD_XLST2CSV; }break; case AVS_OFFICESTUDIO_FILE_TEAMLAB_PPTY: { - if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPTT2PPTX; - else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPTT2PPTM; - else if (0 == sExt2.compare(_T(".potx"))) res = TCD_PPTT2POTX; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_T2BIN; + if (0 == sExt2.compare(L".pptx")) res = TCD_PPTT2PPTX; + else if (0 == sExt2.compare(L".pptm")) res = TCD_PPTT2PPTM; + else if (0 == sExt2.compare(L".potx")) res = TCD_PPTT2POTX; + else if (0 == sExt2.compare(L".bin")) res = TCD_T2BIN; }break; case AVS_OFFICESTUDIO_FILE_CANVAS_WORD: { - if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOCT_BIN2DOCX; - else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOCT_BIN2DOCX; - else if (0 == sExt2.compare(_T(".oform"))) res = TCD_DOCT_BIN2DOCX; - else if (0 == sExt2.compare(_T(".dotx"))) res = TCD_DOCT_BIN2DOCX; - else if (0 == sExt2.compare(_T(".doct"))) res = TCD_BIN2T; - else if (0 == sExt2.compare(_T(".rtf"))) res = TCD_DOCT_BIN2RTF; + if (0 == sExt2.compare(L".docx")) res = TCD_DOCT_BIN2DOCX; + else if (0 == sExt2.compare(L".docm")) res = TCD_DOCT_BIN2DOCX; + else if (0 == sExt2.compare(L".oform")) res = TCD_DOCT_BIN2DOCX; + else if (0 == sExt2.compare(L".dotx")) res = TCD_DOCT_BIN2DOCX; + else if (0 == sExt2.compare(L".doct")) res = TCD_BIN2T; + else if (0 == sExt2.compare(L".rtf")) res = TCD_DOCT_BIN2RTF; }break; case AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET: { - if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLST_BIN2XLSX; - else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLST_BIN2XLSX; - else if (0 == sExt2.compare(_T(".xltx"))) res = TCD_XLST_BIN2XLSX; - else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_BIN2T; - else if (0 == sExt2.compare(_T(".csv"))) res = TCD_XLST_BIN2CSV; + if (0 == sExt2.compare(L".xlsx")) res = TCD_XLST_BIN2XLSX; + else if (0 == sExt2.compare(L".xlsm")) res = TCD_XLST_BIN2XLSX; + else if (0 == sExt2.compare(L".xltx")) res = TCD_XLST_BIN2XLSX; + else if (0 == sExt2.compare(L".xlst")) res = TCD_BIN2T; + else if (0 == sExt2.compare(L".csv")) res = TCD_XLST_BIN2CSV; }break; case AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION: { - if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPTT_BIN2PPTX; - else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPTT_BIN2PPTX; - else if (0 == sExt2.compare(_T(".potx"))) res = TCD_PPTT_BIN2PPTX; - else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_BIN2T; + if (0 == sExt2.compare(L".pptx")) res = TCD_PPTT_BIN2PPTX; + else if (0 == sExt2.compare(L".pptm")) res = TCD_PPTT_BIN2PPTX; + else if (0 == sExt2.compare(L".potx")) res = TCD_PPTT_BIN2PPTX; + else if (0 == sExt2.compare(L".pptt")) res = TCD_BIN2T; }break; case AVS_OFFICESTUDIO_FILE_CANVAS_PDF: { - if (0 == sExt2.compare(_T(".pdf"))) res = TCD_BIN2PDF; + if (0 == sExt2.compare(L".pdf")) res = TCD_BIN2PDF; }break; case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV: { - if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_CSV2XLSX; - else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_CSV2XLSX; - else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_CSV2XLST; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_CSV2XLST_BIN; + if (0 == sExt2.compare(L".xlsx")) res = TCD_CSV2XLSX; + else if (0 == sExt2.compare(L".xlsm")) res = TCD_CSV2XLSX; + else if (0 == sExt2.compare(L".xlst")) res = TCD_CSV2XLST; + else if (0 == sExt2.compare(L".bin")) res = TCD_CSV2XLST_BIN; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF: { - if (0 == sExt2.compare(_T(".docx"))) res = TCD_RTF2DOCX; - else if (0 == sExt2.compare(_T(".docm"))) res = TCD_RTF2DOCX; - else if (0 == sExt2.compare(_T(".doct"))) res = TCD_RTF2DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_RTF2DOCT_BIN; + if (0 == sExt2.compare(L".docx")) res = TCD_RTF2DOCX; + else if (0 == sExt2.compare(L".docm")) res = TCD_RTF2DOCX; + else if (0 == sExt2.compare(L".doct")) res = TCD_RTF2DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_RTF2DOCT_BIN; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT: { - if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOC2DOCX; - else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOC2DOCM; - else if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOC2DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOC2DOCT_BIN; + if (0 == sExt2.compare(L".docx")) res = TCD_DOC2DOCX; + else if (0 == sExt2.compare(L".docm")) res = TCD_DOC2DOCM; + else if (0 == sExt2.compare(L".doct")) res = TCD_DOC2DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_DOC2DOCT_BIN; }break; case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS: { - if (0 == sExt2.compare(_T(".xlsx"))) res = TCD_XLS2XLSX; - else if (0 == sExt2.compare(_T(".xlsm"))) res = TCD_XLS2XLSM; - else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_XLS2XLST; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_XLS2XLST_BIN; + if (0 == sExt2.compare(L".xlsx")) res = TCD_XLS2XLSX; + else if (0 == sExt2.compare(L".xlsm")) res = TCD_XLS2XLSM; + else if (0 == sExt2.compare(L".xlst")) res = TCD_XLS2XLST; + else if (0 == sExt2.compare(L".bin")) res = TCD_XLS2XLST_BIN; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT: { - if (0 == sExt2.compare(_T(".docx"))) res = TCD_TXT2DOCX; - else if (0 == sExt2.compare(_T(".docm"))) res = TCD_TXT2DOCX; - else if (0 == sExt2.compare(_T(".doct"))) res = TCD_TXT2DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_TXT2DOCT_BIN; + if (0 == sExt2.compare(L".docx")) res = TCD_TXT2DOCX; + else if (0 == sExt2.compare(L".docm")) res = TCD_TXT2DOCX; + else if (0 == sExt2.compare(L".doct")) res = TCD_TXT2DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_TXT2DOCT_BIN; }break; case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: {//pot,pps - by extension - potx(potm), ppsx(ppsm) - if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPT2PPTX; - else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPT2PPTM; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPT2PPTT_BIN; - else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPT2PPTT; + if (0 == sExt2.compare(L".pptx")) res = TCD_PPT2PPTX; + else if (0 == sExt2.compare(L".pptm")) res = TCD_PPT2PPTM; + else if (0 == sExt2.compare(L".bin")) res = TCD_PPT2PPTT_BIN; + else if (0 == sExt2.compare(L".pptt")) res = TCD_PPT2PPTT; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS: @@ -326,37 +326,37 @@ namespace NExtractTools case AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS: case AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP: { - if (0 == sExt2.compare(_T(".bin"))) res = TCD_ODF2OOT_BIN; - else if (0 == sExt2.compare(_T(".doct")) || - 0 == sExt2.compare(_T(".xlst")) || - 0 == sExt2.compare(_T(".pptt"))) res = TCD_ODF2OOT; - else if (0 == sExt2.compare(_T(".docx")) || - 0 == sExt2.compare(_T(".xlsx")) || - 0 == sExt2.compare(_T(".pptx"))) res = TCD_ODF2OOX; - else if (0 == sExt2.compare(_T(".docm")) || - 0 == sExt2.compare(_T(".xlsm")) || - 0 == sExt2.compare(_T(".pptm"))) res = TCD_ODF2OOX; - else if (0 == sExt2.compare(_T(".odt")) + if (0 == sExt2.compare(L".bin")) res = TCD_ODF2OOT_BIN; + else if (0 == sExt2.compare(L".doct") || + 0 == sExt2.compare(L".xlst") || + 0 == sExt2.compare(L".pptt")) res = TCD_ODF2OOT; + else if (0 == sExt2.compare(L".docx") || + 0 == sExt2.compare(L".xlsx") || + 0 == sExt2.compare(L".pptx")) res = TCD_ODF2OOX; + else if (0 == sExt2.compare(L".docm") || + 0 == sExt2.compare(L".xlsm") || + 0 == sExt2.compare(L".pptm")) res = TCD_ODF2OOX; + else if (0 == sExt2.compare(L".odt") && type == AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT) res = TCD_OTF2ODF; - else if (0 == sExt2.compare(_T(".ods")) + else if (0 == sExt2.compare(L".ods") && type == AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS) res = TCD_OTF2ODF; - else if (0 == sExt2.compare(_T(".odp")) + else if (0 == sExt2.compare(L".odp") && type == AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP) res = TCD_OTF2ODF; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT_FLAT: case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT: case AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP_FLAT: { - if (0 == sExt2.compare(_T(".bin"))) res = TCD_ODF_FLAT2OOT_BIN; - else if (0 == sExt2.compare(_T(".doct")) || - 0 == sExt2.compare(_T(".xlst")) || - 0 == sExt2.compare(_T(".pptt"))) res = TCD_ODF_FLAT2OOT; - else if (0 == sExt2.compare(_T(".docx")) || - 0 == sExt2.compare(_T(".xlsx")) || - 0 == sExt2.compare(_T(".pptx"))) res = TCD_ODF_FLAT2OOX; - else if (0 == sExt2.compare(_T(".docm")) || - 0 == sExt2.compare(_T(".xlsm")) || - 0 == sExt2.compare(_T(".pptm"))) res = TCD_ODF_FLAT2OOX; + if (0 == sExt2.compare(L".bin")) res = TCD_ODF_FLAT2OOT_BIN; + else if (0 == sExt2.compare(L".doct") || + 0 == sExt2.compare(L".xlst") || + 0 == sExt2.compare(L".pptt")) res = TCD_ODF_FLAT2OOT; + else if (0 == sExt2.compare(L".docx") || + 0 == sExt2.compare(L".xlsx") || + 0 == sExt2.compare(L".pptx")) res = TCD_ODF_FLAT2OOX; + else if (0 == sExt2.compare(L".docm") || + 0 == sExt2.compare(L".xlsm") || + 0 == sExt2.compare(L".pptm")) res = TCD_ODF_FLAT2OOX; }break; case AVS_OFFICESTUDIO_FILE_OTHER_MS_VBAPROJECT: { @@ -364,34 +364,34 @@ namespace NExtractTools }break; case AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO: { - if (0 == sExt2.compare(_T(".doct"))) res = TCD_MSCRYPT2DOCT; - else if (0 == sExt2.compare(_T(".xlst"))) res = TCD_MSCRYPT2XLST; - else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_MSCRYPT2PPTT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_MSCRYPT2BIN; + if (0 == sExt2.compare(L".doct")) res = TCD_MSCRYPT2DOCT; + else if (0 == sExt2.compare(L".xlst")) res = TCD_MSCRYPT2XLST; + else if (0 == sExt2.compare(L".pptt")) res = TCD_MSCRYPT2PPTT; + else if (0 == sExt2.compare(L".bin")) res = TCD_MSCRYPT2BIN; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML_IN_CONTAINER: { - if (0 == sExt2.compare(_T(".docx"))) res = TCD_HTMLZIP2DOCX; - else if (0 == sExt2.compare(_T(".doct"))) res = TCD_HTMLZIP2DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_HTMLZIP2DOCT_BIN; + if (0 == sExt2.compare(L".docx")) res = TCD_HTMLZIP2DOCX; + else if (0 == sExt2.compare(L".doct")) res = TCD_HTMLZIP2DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_HTMLZIP2DOCT_BIN; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML: { - if (0 == sExt2.compare(_T(".docx"))) res = TCD_HTML2DOCX; - else if (0 == sExt2.compare(_T(".doct"))) res = TCD_HTML2DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_HTML2DOCT_BIN; + if (0 == sExt2.compare(L".docx")) res = TCD_HTML2DOCX; + else if (0 == sExt2.compare(L".doct")) res = TCD_HTML2DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_HTML2DOCT_BIN; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2: { - if (0 == sExt2.compare(_T(".docx"))) res = TCD_FB22DOCX; - else if (0 == sExt2.compare(_T(".doct"))) res = TCD_FB22DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_FB22DOCT_BIN; + if (0 == sExt2.compare(L".docx")) res = TCD_FB22DOCX; + else if (0 == sExt2.compare(L".doct")) res = TCD_FB22DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_FB22DOCT_BIN; }break; case AVS_OFFICESTUDIO_FILE_DOCUMENT_EPUB: { - if (0 == sExt2.compare(_T(".docx"))) res = TCD_EPUB2DOCX; - else if (0 == sExt2.compare(_T(".doct"))) res = TCD_EPUB2DOCT; - else if (0 == sExt2.compare(_T(".bin"))) res = TCD_EPUB2DOCT_BIN; + if (0 == sExt2.compare(L".docx")) res = TCD_EPUB2DOCX; + else if (0 == sExt2.compare(L".doct")) res = TCD_EPUB2DOCT; + else if (0 == sExt2.compare(L".bin")) res = TCD_EPUB2DOCT_BIN; }break; } } @@ -402,15 +402,15 @@ namespace NExtractTools std::wstring getMailMergeXml(const std::wstring& sJsonPath, int nRecordFrom, int nRecordTo, const std::wstring& sField) { NSStringUtils::CStringBuilder oBuilder; - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L"\" />"); return oBuilder.GetData(); } std::wstring getDoctXml(NSDoctRenderer::DoctRendererFormat::FormatFile eFromType, NSDoctRenderer::DoctRendererFormat::FormatFile eToType, @@ -418,26 +418,26 @@ namespace NExtractTools const std::wstring& sThemeDir, int nTopIndex, const std::wstring& sMailMerge, const InputParams& params) { NSStringUtils::CStringBuilder oBuilder; - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.AddInt((int)eFromType); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.AddInt((int)eToType); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteEncodeXmlString(sTFileSrc.c_str()); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteEncodeXmlString(sPdfBinFile.c_str()); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteEncodeXmlString(params.getFontPath().c_str()); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteEncodeXmlString(sImagesDirectory.c_str()); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteEncodeXmlString(sThemeDir.c_str()); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); if(NULL != params.m_nLcid) { - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.AddInt(*params.m_nLcid); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); } std::wstring sJsonParams; bool bOnlyOnePage = NULL != params.m_oThumbnail && (NULL == params.m_oThumbnail->first || true == *params.m_oThumbnail->first); @@ -454,20 +454,20 @@ namespace NExtractTools } if (!sJsonParams.empty()) { - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteEncodeXmlString(sJsonParams); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); } if (NULL != params.m_sScriptsCacheDirectory) { - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteEncodeXmlString(*params.m_sScriptsCacheDirectory); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); } - oBuilder.WriteString(_T("")); - std::wstring sChangesDir = NSDirectory::GetFolderPath(sTFileSrc) + FILE_SEPARATOR_STR + _T("changes"); + oBuilder.WriteString(L"\">"); + std::wstring sChangesDir = NSDirectory::GetFolderPath(sTFileSrc) + FILE_SEPARATOR_STR + L"changes"; if (NSDirectory::Exists(sChangesDir)) { std::vector aChangesFiles; @@ -484,45 +484,45 @@ namespace NExtractTools for(size_t i = 0; i < aChangesFiles.size(); ++i) { - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteEncodeXmlString(aChangesFiles[i]); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); } } - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); oBuilder.WriteString(sMailMerge); - oBuilder.WriteString(_T("")); + oBuilder.WriteString(L""); return oBuilder.GetData(); } _UINT32 apply_changes(const std::wstring &sBinFrom, const std::wstring &sToResult, NSDoctRenderer::DoctRendererFormat::FormatFile eType, const std::wstring &sThemeDir, std::wstring &sBinTo, const InputParams& params) { std::wstring sBinDir = NSDirectory::GetFolderPath(sBinFrom); - std::wstring sChangesDir = sBinDir + FILE_SEPARATOR_STR + _T("changes"); + std::wstring sChangesDir = sBinDir + FILE_SEPARATOR_STR + L"changes"; if (NSDirectory::Exists(sChangesDir)) { std::wstring sBinFromFileName = NSFile::GetFileName(sBinFrom); std::wstring sBinFromExt = NSFile::GetFileExtention(sBinFromFileName); - sBinTo = sBinDir + FILE_SEPARATOR_STR + sBinFromFileName.substr(0, sBinFromFileName.length() - sBinFromExt.length() - 1) + _T("WithChanges.") + sBinFromExt; - std::wstring sImagesDirectory = sBinDir + FILE_SEPARATOR_STR + _T("media"); + sBinTo = sBinDir + FILE_SEPARATOR_STR + sBinFromFileName.substr(0, sBinFromFileName.length() - sBinFromExt.length() - 1) + L"WithChanges." + sBinFromExt; + std::wstring sImagesDirectory = sBinDir + FILE_SEPARATOR_STR + L"media"; - NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : _T("")); + NSDoctRenderer::CDoctrenderer oDoctRenderer(NULL != params.m_sAllFontsPath ? *params.m_sAllFontsPath : L""); int nChangeIndex = -1; while (true) { - std::wstring sXml = getDoctXml(eType, eType, sBinFrom, sBinTo, sImagesDirectory, sThemeDir, nChangeIndex, _T(""), params); + std::wstring sXml = getDoctXml(eType, eType, sBinFrom, sBinTo, sImagesDirectory, sThemeDir, nChangeIndex, L"", params); std::wstring sResult; oDoctRenderer.Execute(sXml, sResult); bool bContinue = false; - if (!sResult.empty() && -1 != sResult.find(_T("error"))) + if (!sResult.empty() && -1 != sResult.find(L"error")) { - std::wcerr << _T("DoctRenderer:") << sResult << std::endl; + std::wcerr << L"DoctRenderer:" << sResult << std::endl; params.m_bOutputConvertCorrupted = true; int nErrorIndex = -1; - int nErrorIndexStart = sResult.find(_T("index")); + int nErrorIndexStart = sResult.find(L"index"); if (-1 != nErrorIndexStart) { - nErrorIndexStart = sResult.find(_T("\""), nErrorIndexStart + 1); - int nErrorIndexEnd = sResult.find(_T("\""), nErrorIndexStart + 1); + nErrorIndexStart = sResult.find(L"\"", nErrorIndexStart + 1); + int nErrorIndexEnd = sResult.find(L"\"", nErrorIndexStart + 1); nErrorIndex = XmlUtils::GetInteger(sResult.substr(nErrorIndexStart + 1, nErrorIndexEnd - nErrorIndexStart - 1)); } if (nErrorIndex > 0 && nChangeIndex != nErrorIndex) @@ -553,7 +553,7 @@ namespace NExtractTools // NSFile::CFileBinary::Copy(sBinFrom, sBinCopy); std::wstring sToResultDir = NSDirectory::GetFolderPath(sToResult); - std::wstring sTo = sToResultDir + FILE_SEPARATOR_STR + _T("changes.zip"); + std::wstring sTo = sToResultDir + FILE_SEPARATOR_STR + L"changes.zip"; COfficeUtils oCOfficeUtils(NULL); oCOfficeUtils.CompressFileOrDirectory(sChangesDir, sTo); } diff --git a/X2tConverter/src/cextracttools.h b/X2tConverter/src/cextracttools.h index 7eeded8ac6..7d5cdc9923 100644 --- a/X2tConverter/src/cextracttools.h +++ b/X2tConverter/src/cextracttools.h @@ -297,41 +297,41 @@ namespace NExtractTools bool FromXmlNode(XmlUtils::CXmlNode& oNode) { std::vector oXmlNodes; - if(TRUE == oNode.GetChilds(oXmlNodes)) + if (TRUE == oNode.GetChilds(oXmlNodes)) { for(size_t i = 0; i < oXmlNodes.size(); ++i) { XmlUtils::CXmlNode & oXmlNode = oXmlNodes[i]; - if(oXmlNode.IsValid()) + if (oXmlNode.IsValid()) { std::wstring sValue; - if(oXmlNode.GetTextIfExist(sValue)) + if (oXmlNode.GetTextIfExist(sValue)) { std::wstring sName = oXmlNode.GetName(); - if(_T("fileName") == sName) + if (_T("fileName") == sName) fileName = new std::wstring(sValue); - else if(_T("from") == sName) + else if (_T("from") == sName) from = new std::wstring(sValue); - else if(_T("jsonKey") == sName) + else if (_T("jsonKey") == sName) jsonKey = new std::wstring(sValue); - else if(_T("mailFormat") == sName) + else if (_T("mailFormat") == sName) mailFormat = new int(XmlUtils::GetInteger(sValue)); - else if(_T("message") == sName) + else if (_T("message") == sName) message = new std::wstring(sValue); - else if(_T("recordCount") == sName) + else if (_T("recordCount") == sName) recordCount = new int(XmlUtils::GetInteger(sValue)); - else if(_T("recordFrom") == sName) + else if (_T("recordFrom") == sName) recordFrom = new int(XmlUtils::GetInteger(sValue)); - else if(_T("recordTo") == sName) + else if (_T("recordTo") == sName) recordTo = new int(XmlUtils::GetInteger(sValue)); - else if(_T("subject") == sName) + else if (_T("subject") == sName) subject = new std::wstring(sValue); - else if(_T("to") == sName) + else if (_T("to") == sName) to = new std::wstring(sValue); - else if(_T("url") == sName) + else if (_T("url") == sName) url = new std::wstring(sValue); - else if(_T("userid") == sName) + else if (_T("userid") == sName) userid = new std::wstring(sValue); } } @@ -372,7 +372,7 @@ namespace NExtractTools bool FromXmlNode(XmlUtils::CXmlNode& oNode) { std::vector oXmlNodes; - if(TRUE == oNode.GetChilds(oXmlNodes)) + if (TRUE == oNode.GetChilds(oXmlNodes)) { for (size_t i = 0; i < oXmlNodes.size(); ++i) { @@ -380,20 +380,20 @@ namespace NExtractTools if (oXmlNode.IsValid()) { std::wstring sValue; - if(oXmlNode.GetTextIfExist(sValue)) + if (oXmlNode.GetTextIfExist(sValue)) { std::wstring sName = oXmlNode.GetName(); - if(_T("format") == sName) + if (_T("format") == sName) format = new int(XmlUtils::GetInteger(sValue)); - else if(_T("aspect") == sName) + else if (_T("aspect") == sName) aspect = new int(XmlUtils::GetInteger(sValue)); - else if(_T("first") == sName) + else if (_T("first") == sName) first = new bool(XmlUtils::GetBoolean2(sValue)); - else if(_T("zip") == sName) + else if (_T("zip") == sName) zip = new bool(XmlUtils::GetBoolean2(sValue)); - else if(_T("width") == sName) + else if (_T("width") == sName) width = new int(XmlUtils::GetInteger(sValue)); - else if(_T("height") == sName) + else if (_T("height") == sName) height = new int(XmlUtils::GetInteger(sValue)); } } @@ -559,7 +559,7 @@ namespace NExtractTools bool FromXmlFile(const std::wstring& sFilename) { XmlUtils::CXmlNode oRoot; - if(TRUE == oRoot.FromXmlFile(sFilename)) + if (TRUE == oRoot.FromXmlFile(sFilename)) { return FromXmlNode(oRoot); } @@ -571,7 +571,7 @@ namespace NExtractTools bool FromXml(const std::wstring& sXml) { XmlUtils::CXmlNode oRoot; - if(TRUE == oRoot.FromXmlString(sXml)) + if (TRUE == oRoot.FromXmlString(sXml)) { return FromXmlNode(oRoot); } @@ -583,7 +583,7 @@ namespace NExtractTools bool FromXmlNode(XmlUtils::CXmlNode& oRoot) { std::vector oXmlNodes; - if(TRUE == oRoot.GetChilds(oXmlNodes)) + if (TRUE == oRoot.GetChilds(oXmlNodes)) { for (size_t i = 0; i < oXmlNodes.size(); ++i) { @@ -591,149 +591,149 @@ namespace NExtractTools if (oXmlNode.IsValid()) { std::wstring sName = oXmlNode.GetName(); - if(_T("m_oMailMergeSend") == sName) + if (_T("m_oMailMergeSend") == sName) { RELEASEOBJECT(m_oMailMergeSend); m_oMailMergeSend = new InputParamsMailMerge(); m_oMailMergeSend->FromXmlNode(oXmlNode); } - else if(_T("m_oThumbnail") == sName) + else if (_T("m_oThumbnail") == sName) { RELEASEOBJECT(m_oThumbnail); m_oThumbnail = new InputParamsThumbnail(); m_oThumbnail->FromXmlNode(oXmlNode); } - else if(_T("m_oTextParams") == sName) + else if (_T("m_oTextParams") == sName) { RELEASEOBJECT(m_oTextParams); m_oTextParams = new InputParamsText(); m_oTextParams->FromXmlNode(oXmlNode); } - else if(_T("m_oInputLimits") == sName) + else if (_T("m_oInputLimits") == sName) { FromLimitsNode(oXmlNode); } else { std::wstring sValue; - if(oXmlNode.GetTextIfExist(sValue)) + if (oXmlNode.GetTextIfExist(sValue)) { - if(_T("m_sKey") == sName) + if (_T("m_sKey") == sName) { RELEASEOBJECT(m_sKey); m_sKey = new std::wstring(sValue); } - else if(_T("m_sFileFrom") == sName) + else if (_T("m_sFileFrom") == sName) { RELEASEOBJECT(m_sFileFrom); m_sFileFrom = new std::wstring(sValue); } - else if(_T("m_sFileTo") == sName) + else if (_T("m_sFileTo") == sName) { RELEASEOBJECT(m_sFileTo); m_sFileTo = new std::wstring(sValue); } - else if(_T("m_sTitle") == sName) + else if (_T("m_sTitle") == sName) { RELEASEOBJECT(m_sTitle); m_sTitle = new std::wstring(sValue); } - else if(_T("m_nFormatFrom") == sName) + else if (_T("m_nFormatFrom") == sName) { RELEASEOBJECT(m_nFormatFrom); m_nFormatFrom = new int(XmlUtils::GetInteger(sValue)); } - else if(_T("m_nFormatTo") == sName) + else if (_T("m_nFormatTo") == sName) { RELEASEOBJECT(m_nFormatTo); m_nFormatTo = new int(XmlUtils::GetInteger(sValue)); } - else if(_T("m_nCsvTxtEncoding") == sName) + else if (_T("m_nCsvTxtEncoding") == sName) { RELEASEOBJECT(m_nCsvTxtEncoding); m_nCsvTxtEncoding = new int(XmlUtils::GetInteger(sValue)); } - else if(_T("m_nCsvDelimiter") == sName) + else if (_T("m_nCsvDelimiter") == sName) { RELEASEOBJECT(m_nCsvDelimiter); m_nCsvDelimiter = new int(XmlUtils::GetInteger(sValue)); } - else if(_T("m_nCsvDelimiterChar") == sName) + else if (_T("m_nCsvDelimiterChar") == sName) { RELEASEOBJECT(m_sCsvDelimiterChar); m_sCsvDelimiterChar = new std::wstring(sValue); } - else if(_T("m_nLcid") == sName) + else if (_T("m_nLcid") == sName) { RELEASEOBJECT(m_nLcid); m_nLcid = new int(XmlUtils::GetInteger(sValue)); } - else if(_T("m_bPaid") == sName) + else if (_T("m_bPaid") == sName) { RELEASEOBJECT(m_bPaid); m_bPaid = new bool(XmlUtils::GetBoolean2(sValue)); } - else if(_T("m_bFromChanges") == sName) + else if (_T("m_bFromChanges") == sName) { RELEASEOBJECT(m_bFromChanges); m_bFromChanges = new bool(XmlUtils::GetBoolean2(sValue)); } - else if(_T("m_sAllFontsPath") == sName) + else if (_T("m_sAllFontsPath") == sName) { RELEASEOBJECT(m_sAllFontsPath); m_sAllFontsPath = new std::wstring(sValue); } - else if(_T("m_sFontDir") == sName) + else if (_T("m_sFontDir") == sName) { RELEASEOBJECT(m_sFontDir); m_sFontDir = new std::wstring(sValue); } - else if(_T("m_sThemeDir") == sName) + else if (_T("m_sThemeDir") == sName) { RELEASEOBJECT(m_sThemeDir); m_sThemeDir = new std::wstring(sValue); } - else if(_T("m_bDontSaveAdditional") == sName) + else if (_T("m_bDontSaveAdditional") == sName) { RELEASEOBJECT(m_bDontSaveAdditional); m_bDontSaveAdditional = new bool(XmlUtils::GetBoolean2(sValue)); } - else if(_T("m_sJsonParams") == sName) + else if (_T("m_sJsonParams") == sName) { RELEASEOBJECT(m_sJsonParams); m_sJsonParams = new std::wstring(sValue); } - else if(_T("m_sPassword") == sName) + else if (_T("m_sPassword") == sName) { RELEASEOBJECT(m_sPassword); m_sPassword = new std::wstring(sValue); } - else if(_T("m_sSavePassword") == sName) + else if (_T("m_sSavePassword") == sName) { RELEASEOBJECT(m_sSavePassword); m_sSavePassword = new std::wstring(sValue); } - else if(_T("m_sDocumentID") == sName) + else if (_T("m_sDocumentID") == sName) { RELEASEOBJECT(m_sDocumentID); m_sDocumentID = new std::wstring(sValue); } - else if(_T("m_sTempDir") == sName) + else if (_T("m_sTempDir") == sName) { RELEASEOBJECT(m_sTempDir); m_sTempDir = new std::wstring(sValue); } - else if(_T("m_bIsNoBase64") == sName) + else if (_T("m_bIsNoBase64") == sName) { RELEASEOBJECT(m_bIsNoBase64); m_bIsNoBase64 = new bool(XmlUtils::GetBoolean2(sValue)); } - else if(_T("m_bIsPDFA") == sName) + else if (_T("m_bIsPDFA") == sName) { RELEASEOBJECT(m_bIsPDFA); m_bIsPDFA = new bool(XmlUtils::GetBoolean2(sValue)); } - else if(_T("m_sConvertToOrigin") == sName) + else if (_T("m_sConvertToOrigin") == sName) { RELEASEOBJECT(m_sConvertToOrigin); m_sConvertToOrigin = new std::wstring(sValue); @@ -744,7 +744,7 @@ namespace NExtractTools m_sScriptsCacheDirectory = new std::wstring(sValue); } } - else if(_T("m_nCsvDelimiterChar") == sName) + else if (_T("m_nCsvDelimiterChar") == sName) { std::wstring sNil; if (!oXmlNode.GetAttributeIfExist(L"xsi:nil", sNil)) @@ -768,7 +768,7 @@ namespace NExtractTools for(size_t i = 0; i < oLimitsNode.size(); ++i) { XmlUtils::CXmlNode & oLimitNode = oLimitsNode[i]; - if(oLimitNode.IsValid()) + if (oLimitNode.IsValid()) { std::wstring sType; if (oLimitNode.GetAttributeIfExist(L"type", sType)) @@ -844,9 +844,9 @@ namespace NExtractTools int nCsvEncoding = 46;//65001 utf8 std::wstring cDelimiter = L","; - if(NULL != m_nCsvTxtEncoding) + if (NULL != m_nCsvTxtEncoding) nCsvEncoding = *m_nCsvTxtEncoding; - if(NULL != m_nCsvDelimiter) + if (NULL != m_nCsvDelimiter) { switch (*m_nCsvDelimiter) { @@ -857,22 +857,22 @@ namespace NExtractTools case TCSVD_SPACE: cDelimiter = L" "; break; } } - if(NULL != m_sCsvDelimiterChar) + if (NULL != m_sCsvDelimiterChar) { cDelimiter = *m_sCsvDelimiterChar; } int nFileType = 1; - if(NULL != m_nFormatFrom && AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == *m_nFormatFrom) + if (NULL != m_nFormatFrom && AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == *m_nFormatFrom) nFileType = 2; - else if(NULL != m_nFormatFrom && AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB == *m_nFormatFrom) + else if (NULL != m_nFormatFrom && AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB == *m_nFormatFrom) nFileType = 4; std::wstring sSaveType; - if(NULL != m_nFormatTo) + if (NULL != m_nFormatTo) { - if(AVS_OFFICESTUDIO_FILE_OTHER_JSON == *m_nFormatTo) + if (AVS_OFFICESTUDIO_FILE_OTHER_JSON == *m_nFormatTo) sSaveType = _T(" saveFileType='3'"); - else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == *m_nFormatTo) + else if (AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == *m_nFormatTo) nFileType = 2; } sRes = L"replace(nIndex, std::wstring::npos, FileFormatChecker.GetExtensionByType(toFormat)); else m_sFileTo->append(FileFormatChecker.GetExtensionByType(toFormat)); diff --git a/X2tConverter/test/win32Test/X2tConverter_win_test.sln b/X2tConverter/test/win32Test/X2tConverter_win_test.sln index 768024e0f6..3c1f565975 100644 --- a/X2tConverter/test/win32Test/X2tConverter_win_test.sln +++ b/X2tConverter/test/win32Test/X2tConverter_win_test.sln @@ -17,6 +17,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocFormatLib", "..\..\..\MsBinaryFile\Projects\DocFormatLib\Windows\DocFormatLib.vcxproj", "{C5371405-338F-4B70-83BD-2A5CDF64F383}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsbFormatLib", "..\..\..\OOXML\Projects\Windows\XlsbFormatLib\XlsbFormatLib.vcxproj", "{13E13907-49DA-482E-AD58-026D06A5CD11}" + ProjectSection(ProjectDependencies) = postProject + {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} = {77DDC8D7-5B12-4FF2-9629-26AEBCA8436D} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XlsFormatLib", "..\..\..\MsBinaryFile\Projects\XlsFormatLib\Windows\XlsFormat.vcxproj", "{77DDC8D7-5B12-4FF2-9629-26AEBCA8436D}" EndProject diff --git a/X2tConverter/test/win32Test/X2tTest.cpp b/X2tConverter/test/win32Test/X2tTest.cpp index 43ed6feb93..132efa395b 100644 --- a/X2tConverter/test/win32Test/X2tTest.cpp +++ b/X2tConverter/test/win32Test/X2tTest.cpp @@ -59,7 +59,7 @@ #pragma comment(lib, "../../../build/lib/win_64/kernel.lib") #pragma comment(lib, "../../../build/lib/win_64/UnicodeConverter.lib") #endif - #pragma comment(lib, "../../../build/bin/icu/win_64/icuuc.lib") + #pragma comment(lib, "../../../Common/3dParty/icu/win_64/build//icuuc.lib") #elif defined (_WIN32) #if defined(_DEBUG) #pragma comment(lib, "../../../build/lib/win_32/DEBUG/doctrenderer.lib") @@ -90,7 +90,7 @@ #pragma comment(lib, "../../../build/lib/win_32/kernel.lib") #pragma comment(lib, "../../../build/lib/win_32/UnicodeConverter.lib") #endif - #pragma comment(lib, "../../../build/bin/icu/win_32/icuuc.lib") + #pragma comment(lib, "../../../Common/3dParty/icu/win_32/build/icuuc.lib") #endif #include "../../src/main.cpp" \ No newline at end of file