Compare commits

...

12 Commits

Author SHA1 Message Date
465b903ec5 Remove inline methods 2018-04-28 17:48:38 +03:00
c7b45910f8 . 2018-04-28 13:31:44 +03:00
ab1abb96fe [ios][x2t] fixed build 2018-04-28 12:09:15 +03:00
566d9e68e4 OdfFormatReader - decrypt 2018-04-27 20:23:32 +03:00
243b8eccdd [ios][x2t] fixed build 2018-04-27 19:55:37 +03:00
658040f77b [ios][x2t] up test project 2018-04-27 18:01:47 +03:00
a1b738fc42 Merge remote-tracking branch 'origin/hotfix/v5.1.4' into develop 2018-04-27 16:28:03 +03:00
00e9ce56df x2t - fix bug 37579 & bug 37589 2018-04-27 16:00:25 +03:00
2a4ce1f93f x2t - decrtypt Open Office Document 2018-04-27 15:42:25 +03:00
29e3f90ebf v5.1.3 2018-04-26 18:23:51 +03:00
d4a70d306f x2t - fix bug 37589 2018-04-26 18:15:11 +03:00
234459f37c x2t - fix bug 37579 2018-04-25 12:21:46 +03:00
28 changed files with 1091 additions and 780 deletions

View File

@ -46,6 +46,16 @@
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#if defined(_DEBUG)
#pragma comment(lib, "../../build/lib/win_32/DEBUG/graphics.lib")
#pragma comment(lib, "../../build/lib/win_32/DEBUG/kernel.lib")
#pragma comment(lib, "../../build/lib/win_32/DEBUG/UnicodeConverter.lib")
#else
#pragma comment(lib, "../../build/lib/win_32/graphics.lib")
#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")
#endif

View File

@ -450,22 +450,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\build\lib\win_32\DEBUG\graphics.lib"
>
</File>
<File
RelativePath="..\..\build\lib\win_32\DEBUG\kernel.lib"
>
</File>
<File
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath="..\..\build\lib\win_32\DEBUG\UnicodeConverter.lib"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -5,8 +5,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml_wrapper", "..\win32\cpx
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormatReaderLib", "..\win32\cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}"
ProjectSection(ProjectDependencies) = postProject
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfCommon", "..\win32\cpcommon.vcproj", "{609ED938-3CA8-4BED-B363-25096D4C4812}"
@ -19,7 +20,6 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{C27E9A9F-3A17-4482-9C5F-BF15C01E747C} = {C27E9A9F-3A17-4482-9C5F-BF15C01E747C}
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
EndProjectSection

View File

@ -44,6 +44,14 @@
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#if defined(_DEBUG)
#pragma comment(lib, "../../build/lib/win_32/DEBUG/graphics.lib")
#pragma comment(lib, "../../build/lib/win_32/DEBUG/kernel.lib")
#else
#pragma comment(lib, "../../build/lib/win_32/graphics.lib")
#pragma comment(lib, "../../build/lib/win_32/kernel.lib")
#endif
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif

View File

@ -337,10 +337,6 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\DesktopEditor\common\Base64.cpp"
>
</File>
<File
RelativePath="..\..\Common\OfficeFileFormatChecker.h"
>
@ -361,27 +357,7 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\common\String.cpp"
>
</File>
<File
RelativePath="..\..\Common\DocxFormat\Source\Base\unicode_util.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
>
</File>
</Filter>
<File
RelativePath="..\..\build\lib\win_32\graphics.lib"
>
</File>
<File
RelativePath="..\..\build\lib\win_32\DEBUG\kernel.lib"
>
</File>
<File
RelativePath="OdfFileTest.cpp"
>
@ -394,6 +370,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Common\DocxFormat\Source\Base\unicode_util.cpp"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -148,8 +148,8 @@ odf_document::Impl::Impl(xml::sax * Reader, const std::wstring & tempPath):
}
}
odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & tempPath, const std::wstring & Password, const ProgressCallback* CallBack) :
context_(new odf_read_context()), pCallBack(CallBack), bUserStopConvert (0), bError(false)
odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & tempPath, const std::wstring & password, const ProgressCallback* callBack) :
context_(new odf_read_context()), pCallBack(callBack), bUserStopConvert (0), bError(false)
{
office_mime_type_ = 0;
@ -178,12 +178,12 @@ odf_document::Impl::Impl(const std::wstring & srcPath, const std::wstring & temp
if (false == map_encryptions_.empty())
{
if (Password.empty()) return;
if (password.empty()) return;
//decrypt files
tmp_folder_ = NSDirectory::CreateDirectoryWithUniqueName(tempPath);
bError = !decrypt_folder(base_folder_, tmp_folder_);
bError = !decrypt_folder(password, base_folder_, tmp_folder_);
if (bError)
return;
@ -248,7 +248,7 @@ odf_document::Impl::~Impl()
NSDirectory::DeleteDirectory(tmp_folder_);
}
bool odf_document::Impl::decrypt_folder (const std::wstring & srcPath, const std::wstring & dstPath)
bool odf_document::Impl::decrypt_folder (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath)
{
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(srcPath, false);
std::vector<std::wstring> arDirectories = NSDirectory::GetDirectories(srcPath);
@ -261,7 +261,7 @@ bool odf_document::Impl::decrypt_folder (const std::wstring & srcPath, const std
std::map<std::wstring, std::pair<office_element_ptr, int>>::iterator pFind = map_encryptions_.find(arFiles[i]);
if ( pFind != map_encryptions_.end() )
{
result = decrypt_file(arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
result = decrypt_file(password, arFiles[i], dstPath + FILE_SEPARATOR_STR + sFileName, pFind->second.first, pFind->second.second);
if (false == result)
break;
@ -277,7 +277,7 @@ bool odf_document::Impl::decrypt_folder (const std::wstring & srcPath, const std
NSDirectory::CreateDirectory(dstPath + FILE_SEPARATOR_STR + sDirName);
result = decrypt_folder(arDirectories[i], dstPath + FILE_SEPARATOR_STR + sDirName);
result = decrypt_folder(password, arDirectories[i], dstPath + FILE_SEPARATOR_STR + sDirName);
}
return result;
}
@ -297,14 +297,11 @@ std::string DecodeBase64(const std::wstring & value1)
}
return result;
}
bool odf_document::Impl::decrypt_file (const std::wstring & srcPath, const std::wstring & dstPath, office_element_ptr element, int size )
bool odf_document::Impl::decrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, office_element_ptr element, int file_size )
{
manifest_encryption_data* encryption_data = dynamic_cast<manifest_encryption_data*>(element.get());
if (!encryption_data) return false;
//std::wstring checksum_;
//std::wstring checksum_type_;
manifest_algorithm* algorithm = dynamic_cast<manifest_algorithm*>(encryption_data->algorithm_.get());
manifest_key_derivation* key_derivation = dynamic_cast<manifest_key_derivation*>(encryption_data->key_derivation_.get());
manifest_start_key_generation* start_key_generation = dynamic_cast<manifest_start_key_generation*>(encryption_data->start_key_generation_.get());
@ -312,86 +309,77 @@ bool odf_document::Impl::decrypt_file (const std::wstring & srcPath, const std::
CRYPT::ODFDecryptor decryptor;
CRYPT::_odfCryptData cryptData;
cryptData.saltValue = DecodeBase64(key_derivation->salt_);
cryptData.saltSize = cryptData.saltValue.length();
cryptData.spinCount = key_derivation->iteration_count_;
//------------------------------------------------------------------------------------------
if (std::wstring::npos != start_key_generation->start_key_generation_name_.find(L"sha"))
if (key_derivation)
{
if (std::wstring::npos != start_key_generation->start_key_generation_name_.find(L"512"))
{
cryptData.hashAlgorithm = CRYPT_METHOD::SHA512;
cryptData.hashSize = 40; //320 bit
}
if (std::wstring::npos != start_key_generation->start_key_generation_name_.find(L"256"))
{
cryptData.hashAlgorithm = CRYPT_METHOD::SHA256;
cryptData.hashSize = 40; //320 bit
}
else
{
cryptData.hashAlgorithm = CRYPT_METHOD::SHA1;
cryptData.hashSize = 20; //160 bit
}
}
else
{
cryptData.hashAlgorithm = CRYPT_METHOD::MD5; //????
cryptData.hashSize = 16; //128 bit
cryptData.saltValue = DecodeBase64(key_derivation->salt_);
cryptData.spinCount = key_derivation->iteration_count_;
cryptData.keySize = key_derivation->key_size_;
}
//------------------------------------------------------------------------------------------
cryptData.initializationVector = DecodeBase64(algorithm->initialisation_vector_);
if (start_key_generation)
{
if (std::wstring::npos != start_key_generation->start_key_generation_name_.find(L"sha"))
{
if (std::wstring::npos != start_key_generation->start_key_generation_name_.find(L"512"))
{
cryptData.start_hashAlgorithm = CRYPT_METHOD::SHA512;
}
if (std::wstring::npos != start_key_generation->start_key_generation_name_.find(L"256"))
{
cryptData.start_hashAlgorithm = CRYPT_METHOD::SHA256;
}
}
cryptData.start_hashSize = start_key_generation->key_size_;
}
//------------------------------------------------------------------------------------------
if (algorithm)
{
cryptData.initializationVector = DecodeBase64(algorithm->initialisation_vector_);
if (std::wstring::npos != algorithm->algorithm_name.find(L"aes"))
{
if (std::wstring::npos != algorithm->algorithm_name.find(L"cbc"))
cryptData.cipherAlgorithm = CRYPT_METHOD::AES_CBC;
else
cryptData.cipherAlgorithm = CRYPT_METHOD::AES_ECB;//??
if (std::wstring::npos != algorithm->algorithm_name.find(L"512"))
cryptData.keySize = 512 /8;
else if (std::wstring::npos != algorithm->algorithm_name.find(L"256"))
cryptData.keySize = 256 /8;
else
cryptData.keySize = 128 /8; //??
}
else if (std::wstring::npos != algorithm->algorithm_name.find(L"blowfish"))
{
cryptData.cipherAlgorithm = CRYPT_METHOD::Blowfish;//CFB
if (std::wstring::npos != algorithm->algorithm_name_.find(L"aes"))
{
if (std::wstring::npos != algorithm->algorithm_name_.find(L"cbc"))
cryptData.cipherAlgorithm = CRYPT_METHOD::AES_CBC;
else
cryptData.cipherAlgorithm = CRYPT_METHOD::AES_ECB;//??
}
else if (std::wstring::npos != algorithm->algorithm_name_.find(L"blowfish"))
{
cryptData.cipherAlgorithm = CRYPT_METHOD::Blowfish_CFB;
}
}
//------------------------------------------------------------------------------------------
cryptData.checksum = DecodeBase64(encryption_data->checksum_);
if (std::wstring::npos != encryption_data->checksum_type_.find(L"sha"))
if (encryption_data)
{
if (std::wstring::npos != start_key_generation->start_key_generation_name_.find(L"512"))
cryptData.checksum = DecodeBase64(encryption_data->checksum_);
cryptData.checksum_hashAlgorithm = CRYPT_METHOD::SHA1;
if (std::wstring::npos != encryption_data->checksum_type_.find(L"sha"))
{
cryptData.checksum_hashAlgorithm = CRYPT_METHOD::SHA512;
if (std::wstring::npos != encryption_data->checksum_type_.find(L"512"))
{
cryptData.checksum_hashAlgorithm = CRYPT_METHOD::SHA512;
}
if (std::wstring::npos != encryption_data->checksum_type_.find(L"256"))
{
cryptData.checksum_hashAlgorithm = CRYPT_METHOD::SHA256;
}
}
if (std::wstring::npos != start_key_generation->start_key_generation_name_.find(L"256"))
size_t nPosChecksumSize = encryption_data->checksum_type_.find(L"-");
if (std::wstring::npos == nPosChecksumSize)
nPosChecksumSize = encryption_data->checksum_type_.find(L"/");
if (std::wstring::npos != nPosChecksumSize)
{
cryptData.checksum_hashAlgorithm = CRYPT_METHOD::SHA256;
}
else
{
cryptData.checksum_hashAlgorithm = CRYPT_METHOD::SHA1;
}
}
else
{
cryptData.checksum_hashAlgorithm = CRYPT_METHOD::MD5; //????
}
size_t nPosChecksumSize = encryption_data->checksum_type_.find(L"-");
if (std::wstring::npos != nPosChecksumSize)
{
std::wstring strSize = encryption_data->checksum_type_.substr(nPosChecksumSize + 1);
if (strSize == L"1k")
{
cryptData.checksum_size = 1024;
}
else
{
//???
std::wstring strSize = encryption_data->checksum_type_.substr(nPosChecksumSize + 1);
if (strSize == L"1k")
{
cryptData.checksum_size = 1024;
}
else
{
//???
}
}
}
@ -401,42 +389,31 @@ bool odf_document::Impl::decrypt_file (const std::wstring & srcPath, const std::
return false;
DWORD dwSizeRead = 0;
_UINT64 lengthData, lengthRead = file_inp.GetFileSize();
_UINT64 lengthRead = file_inp.GetFileSize();
unsigned char* data = new unsigned char[lengthRead];
unsigned char* data_out = NULL;
file_inp.ReadFile(data, lengthRead, dwSizeRead);
cryptData.input = std::string((char*)data, cryptData.checksum_size) ;
//------------------------------------------------------------------------------------------
decryptor.SetCryptData(cryptData);
if (!decryptor.SetPassword(L"password"))
{
return false;
}
bool result = decryptor.Decrypt(password, data, dwSizeRead, data_out, file_size);
delete []data;
//------------------------------------------------------------------------------------------------------------
int readData = dwSizeRead;// - 8;
lengthData = *((_UINT64*)data);
bool result = false;
decryptor.Decrypt(data /*+ 8*/, readData, data_out, 0);//todoo сделать покусочное чтение декриптование
if (data_out)
if (result && data_out)
{
NSFile::CFileBinary file_out;
file_out.CreateFileW(dstPath);
file_out.WriteFile(data_out, lengthData);
file_out.WriteFile(data_out, file_size);
file_out.CloseFile();
delete []data_out;
result = true;
delete []data_out;
return result;
}
delete []data;
return result;
}
const std::wstring & odf_document::Impl::get_temp_folder() const

View File

@ -97,8 +97,8 @@ private:
void parse_manifests(office_element *element);
void parse_settings (office_element *element);
bool decrypt_folder (const std::wstring & srcPath, const std::wstring & dstPath);
bool decrypt_file (const std::wstring & srcPath, const std::wstring & dstPath, office_element_ptr data, int size );
bool decrypt_folder (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath);
bool decrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, office_element_ptr data, int size );
content_xml_t_ptr content_xml_;
content_xml_t_ptr styles_xml_;

View File

@ -164,6 +164,7 @@ void manifest_encryption_data::add_attributes( const xml::attributes_wc_ptr & At
{
checksum_type_ = checksum_type_.substr(nFind + 1);
}
checksum_type_ = XmlUtils::GetLower(checksum_type_);
}
void manifest_encryption_data::add_child_element(cpdoccore::xml::sax *Reader, const std::wstring &Ns, const std::wstring &Name)
{
@ -187,14 +188,15 @@ const wchar_t * manifest_algorithm::name = L"algorithm";
void manifest_algorithm::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"manifest:algorithm-name", algorithm_name, std::wstring(L""));
CP_APPLY_ATTR(L"manifest:algorithm-name", algorithm_name_, std::wstring(L""));
CP_APPLY_ATTR(L"manifest:initialisation-vector", initialisation_vector_, std::wstring(L""));
size_t nFind = algorithm_name.find(L"#");
size_t nFind = algorithm_name_.find(L"#");
if (nFind != std::wstring::npos)
{
algorithm_name = algorithm_name.substr(nFind + 1);
algorithm_name_ = algorithm_name_.substr(nFind + 1);
}
algorithm_name_ = XmlUtils::GetLower(algorithm_name_);
}
// manifest:key-derivation
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -205,7 +207,7 @@ void manifest_key_derivation::add_attributes( const xml::attributes_wc_ptr & Att
{
CP_APPLY_ATTR(L"manifest:key-derivation-name", key_derivation_name_, std::wstring(L""));
CP_APPLY_ATTR(L"manifest:key-size", key_size_, 16);
CP_APPLY_ATTR(L"manifest:iteration-count", iteration_count_, 100000);
CP_APPLY_ATTR(L"manifest:iteration-count", iteration_count_, 1024);
CP_APPLY_ATTR(L"manifest:salt", salt_, std::wstring(L""));
size_t nFind = key_derivation_name_.find(L"#");
@ -213,6 +215,7 @@ void manifest_key_derivation::add_attributes( const xml::attributes_wc_ptr & Att
{
key_derivation_name_ = key_derivation_name_.substr(nFind + 1);
}
key_derivation_name_ = XmlUtils::GetLower(key_derivation_name_);
}
// manifest:start-key-generation
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -229,6 +232,7 @@ void manifest_start_key_generation::add_attributes( const xml::attributes_wc_ptr
{
start_key_generation_name_ = start_key_generation_name_.substr(nFind + 1);
}
start_key_generation_name_ = XmlUtils::GetLower(start_key_generation_name_);
}
}
}

View File

@ -253,7 +253,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
std::wstring algorithm_name;
std::wstring algorithm_name_;
std::wstring initialisation_vector_;
};
CP_REGISTER_OFFICE_ELEMENT2(manifest_algorithm);

View File

@ -46,6 +46,16 @@
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#if defined(_DEBUG)
#pragma comment(lib, "../../build/lib/win_32/DEBUG/graphics.lib")
#pragma comment(lib, "../../build/lib/win_32/DEBUG/kernel.lib")
#pragma comment(lib, "../../build/lib/win_32/DEBUG/UnicodeConverter.lib")
#else
#pragma comment(lib, "../../build/lib/win_32/graphics.lib")
#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")
#endif

View File

@ -8,11 +8,11 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileWriterTest", "OdfFileWTest.vcproj", "{FBA8446A-150F-4A10-B4DA-1022048D6473}"
ProjectSection(ProjectDependencies) = postProject
{609ED938-3CA8-4BED-B363-25096D4C4812} = {609ED938-3CA8-4BED-B363-25096D4C4812}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{BEE01B53-244A-44E6-8947-ED9342D9247E} = {BEE01B53-244A-44E6-8947-ED9342D9247E}
{E5A67556-44DA-4481-8F87-0A3AEDBD20DD} = {E5A67556-44DA-4481-8F87-0A3AEDBD20DD}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\DocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"

View File

@ -67,7 +67,7 @@
Name="VCLinkerTool"
AdditionalDependencies="&#x0D;&#x0A;Rpcrt4.lib"
LinkIncremental="2"
IgnoreDefaultLibraryNames="MSVCRTD.lib"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
@ -333,38 +333,6 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\DesktopEditor\common\Base64.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\common\Directory.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\common\File.cpp"
>
</File>
<File
RelativePath="..\..\Common\FileDownloader\FileDownloader.cpp"
>
</File>
<File
RelativePath="..\..\Common\FileDownloader\FileDownloader_win.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\common\Path.cpp"
>
</File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
@ -377,50 +345,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\common\String.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\common\StringBuilder.cpp"
>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<Filter
Name="oox"
>
@ -490,14 +414,6 @@
</File>
</Filter>
</Filter>
<File
RelativePath="..\..\build\lib\win_32\graphics.lib"
>
</File>
<File
RelativePath="..\..\build\lib\win_32\kernel.lib"
>
</File>
<File
RelativePath=".\OdfFileWTest.cpp"
>

View File

@ -1027,11 +1027,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorkbookView *oox_book_views)
{
int table_id = oox_book_views->m_oActiveTab->GetValue();
std::map<int, OOX::Spreadsheet::CSheet*>::iterator pFind = Workbook->m_oSheets->mapSheets.find(table_id);
if (pFind != Workbook->m_oSheets->mapSheets.end())
if (table_id >= 0 && table_id < Workbook->m_oSheets->m_arrItems.size())
{
ods_context->settings_context()->add_property(L"ActiveTable", L"string", pFind->second->m_oName.get2());
ods_context->settings_context()->add_property(L"ActiveTable", L"string",
Workbook->m_oSheets->m_arrItems[table_id]->m_oName.get2());
}
}
if (oox_book_views->m_oShowSheetTabs.IsInit())

View File

@ -1191,7 +1191,7 @@ namespace NSBinPptxRW
std::to_wstring(nIndexTheme + 1) + L".xml\"/>";
m_pWriter->WriteString(s);
}
void CRelsGenerator::StartNotesMaster(int nIndexTheme)
void CRelsGenerator::StartThemeNotesMaster(int nIndexTheme)
{
m_pWriter->WriteString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
m_pWriter->WriteString(_T("<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">"));
@ -1280,6 +1280,12 @@ namespace NSBinPptxRW
m_pWriter->WriteString(strRels);
}
void CRelsGenerator::WriteNotesMaster()
{
std::wstring strRels0 = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\" Target=\"notesMasters/notesMaster1.xml\"/>";
m_pWriter->WriteString(strRels0);
}
void CRelsGenerator::WritePresentationComments(int nComment)
{
std::wstring strRels = L"<Relationship Id=\"rId" + std::to_wstring( m_lNextRelsID++ ) +
@ -1288,14 +1294,8 @@ namespace NSBinPptxRW
m_pWriter->WriteString(strRels);
}
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject, bool bIsJsaProject)
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsVbaProject, bool bIsJsaProject)
{
if (bIsNotesMaster)
{
std::wstring strRels0 = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\" Target=\"notesMasters/notesMaster1.xml\"/>";
m_pWriter->WriteString(strRels0);
}
std::wstring strRels1 = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps\" Target=\"presProps.xml\" />";
std::wstring strRels2 = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
@ -1326,10 +1326,6 @@ namespace NSBinPptxRW
m_pWriter->WriteString(strRels5);
}
}
int CRelsGenerator::GetNextId()
{
return m_lNextRelsID;
}
void CRelsGenerator::CloseRels()
{
m_pWriter->WriteString(_T("</Relationships>"));

View File

@ -401,10 +401,10 @@ namespace NSBinPptxRW
{
private:
CStringWriter* m_pWriter;
int m_lNextRelsID;
std::map<std::wstring, _relsGeneratorInfo> m_mapImages;
std::map<std::wstring, int> m_mapLinks;
public:
size_t m_lNextRelsID;
CImageManager2* m_pManager;
CRelsGenerator(CImageManager2* pManager = NULL);
@ -418,19 +418,20 @@ namespace NSBinPptxRW
void StartLayout (int nIndexTheme);
void StartSlide (int nIndexSlide, int nIndexLayout, int nIndexNotes);
void StartNotes (int nIndexSlide);
void StartNotesMaster(int nIndexTheme);
void StartThemeNotesMaster(int nIndexTheme);
void WriteMasters (int nCount);
void WriteThemes (int nCount);
void WriteSlides (int nCount);
void WriteNotesMaster();
void WriteSlideComments (int nComment);
void WritePresentationComments (int nComment);
int WriteChart (int nChartNumber, _INT32 lDocType);
int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode);
int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit);
void EndPresentationRels (bool bIsCommentsAuthors = false, bool bIsNotesMaster = false, bool bIsVbaProject = false, bool bIsJsaProject = false );
int GetNextId ();
void EndPresentationRels (bool bIsCommentsAuthors = false, bool bIsVbaProject = false, bool bIsJsaProject = false );
void CloseRels ();
void AddRels (const std::wstring& strRels);

View File

@ -129,6 +129,11 @@ namespace PPTX2EditorAdvanced
for (size_t nNote = 0; nNote < nCountNoteMasters; ++nNote)
{
smart_ptr<PPTX::NotesMaster> noteMaster = ((*presentation)[presentation->notesMasterIdLst[nNote].rid.get()]).smart_dynamic_cast<PPTX::NotesMaster>();
if (false == noteMaster.IsInit())
{
// такого быть не должно
continue;
}
size_t pPointerNM = (size_t)(noteMaster.operator ->());
std::map<size_t, LONG>::const_iterator pSearchNM = pCommon->notesMasters.find(pPointerNM);

View File

@ -574,7 +574,7 @@ namespace NSBinPptxRW
m_arNotesMasters.push_back(elm);
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartNotesMaster(m_arSlideMasters_Theme.size());
m_oReader.m_pRels->StartThemeNotesMaster(m_arSlideMasters_Theme.size());
bNotesMasterPresent = true;
if (lCount > 0)
@ -798,7 +798,7 @@ namespace NSBinPptxRW
m_oReader.m_pRels->WriteMasters(nCountMasters);
m_oReader.m_pRels->WriteThemes(nCountThemes);
int nCurrentRels = m_oReader.m_pRels->GetNextId();
size_t nCurrentRels = m_oReader.m_pRels->m_lNextRelsID;
m_oPresentation.sldIdLst.clear();
for (LONG i = 0; i < nCountSlides; ++i)
@ -808,10 +808,8 @@ namespace NSBinPptxRW
std::wstring sId = std::to_wstring(256 + i);
m_oPresentation.sldIdLst[i].id = sId;
m_oPresentation.sldIdLst[i].rid = (size_t)nCurrentRels;
++nCurrentRels;
m_oPresentation.sldIdLst[i].rid = nCurrentRels++;
}
m_oReader.m_pRels->WriteSlides(nCountSlides);
m_oPresentation.notesMasterIdLst.clear();
@ -819,8 +817,8 @@ namespace NSBinPptxRW
{
m_oPresentation.notesMasterIdLst.push_back(PPTX::Logic::XmlId(L"p:notesMasterId"));
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
++nCurrentRels;
m_oPresentation.notesMasterIdLst[0].rid = m_oReader.m_pRels->m_lNextRelsID;
m_oReader.m_pRels->WriteNotesMaster();
}
if (m_oPresentation.comments.is_init())
{
@ -841,7 +839,7 @@ namespace NSBinPptxRW
++nComment;
}
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init(), m_oPresentation.m_pJsaProject.is_init());
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), m_oPresentation.m_pVbaProject.is_init(), m_oPresentation.m_pJsaProject.is_init());
m_oReader.m_pRels->CloseRels();
oXmlWriter.ClearNoAttack();

View File

@ -145,17 +145,15 @@ namespace OOX
int nCurDepth = oReader.GetDepth();
int index = 0;
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if ( _T("sheet") == sName )
if ( _T("sheet") == sName )
{
CSheet* pSheet = new CSheet( oReader );
m_arrItems.push_back( pSheet );
mapSheets.insert(std::make_pair(index++, pSheet));
}
}
@ -170,8 +168,6 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
public:
std::map<int, OOX::Spreadsheet::CSheet*> mapSheets;
};
} //Spreadsheet
} // namespace OOX

View File

@ -80,15 +80,15 @@ void CFileDownloader::Stop()
return m_pInternal->Stop();
}
inline int CFileDownloader::IsSuspended()
int CFileDownloader::IsSuspended()
{
return m_pInternal->IsSuspended();
}
inline int CFileDownloader::IsRunned()
int CFileDownloader::IsRunned()
{
return m_pInternal->IsRunned();
}
inline int CFileDownloader::GetError()
int CFileDownloader::GetError()
{
return m_pInternal->GetError();
}

View File

@ -56,9 +56,9 @@ public:
void Resume();
void Stop();
inline int IsSuspended();
inline int IsRunned();
inline int GetError();
int IsSuspended();
int IsRunned();
int GetError();
int GetPriority();

View File

@ -46,10 +46,14 @@
#include "../../Common/3dParty/cryptopp/filters.h"
#include "../../Common/3dParty/cryptopp/osrng.h"
#include "../../Common/3dParty/cryptopp/hex.h"
#include "../../Common/3dParty/cryptopp/blowfish.h"
#include "../../Common/3dParty/cryptopp/zinflate.h"
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
#include "../../DesktopEditor/common/File.h"
static const unsigned char encrVerifierHashInputBlockKey[8] = { 0xfe, 0xa7, 0xd2, 0x76, 0x3b, 0x4b, 0x9e, 0x79 };
static const unsigned char encrVerifierHashValueBlockKey[8] = { 0xd7, 0xaa, 0x0f, 0x6d, 0x30, 0x61, 0x34, 0x4e };
static const unsigned char encrKeyValueBlockKey[8] = { 0x14, 0x6e, 0x0b, 0xe7, 0xab, 0xac, 0xd0, 0xd6 };
@ -66,10 +70,15 @@ public:
int size;
//-----------------------------------------------------------------------------------
_buf() : ptr(NULL), size(0), bDelete(true){}
_buf(int sz) : ptr(NULL), size(0), bDelete(true)
_buf(int sz, bool zero_set = false) : ptr(NULL), size(0), bDelete(true)
{
ptr = new unsigned char [sz];
size = sz;
if (ptr && zero_set)
{
memset(ptr, 0, size);
}
}
_buf(unsigned char * buf, int sz, bool bDelete_ = true ): ptr(NULL), size(0), bDelete(true)
{
@ -284,36 +293,18 @@ _buf GenerateAgileKey(_buf & salt, _buf & password, _buf & blockKey, int hashSiz
return _buf(pHashBuf.ptr, pHashBuf.size);
}
_buf GenerateOdfKey(_buf & salt, _buf & password, _buf & blockKey, int hashSize, int spin, CRYPT_METHOD::_hashAlgorithm algorithm, int block_index = 0)
_buf GenerateOdfKey(_buf & pSalt, _buf & pPassword, int keySize, int spin, CRYPT_METHOD::_hashAlgorithm algorithm)
{
_buf pHashBuf = HashAppend(salt, password, algorithm);
_buf pKey (keySize);
_buf empty (NULL, 0, false);
for (int i = 0; i < spin; i++)
{
_buf iterator((unsigned char*)&i, 4, false);
pHashBuf = HashAppend(iterator, pHashBuf, algorithm);
}
_buf pPassword_hash = HashAppend(pPassword, empty, algorithm);
pHashBuf = HashAppend(pHashBuf, blockKey, algorithm);
PKCS5_PBKDF2_HMAC<SHA1> pbkdf;
pbkdf.DeriveKey(pKey.ptr, pKey.size, 0, pPassword_hash.ptr, pPassword_hash.size, pSalt.ptr, pSalt.size, spin);
CorrectHashSize(pHashBuf, hashSize, 0x36);
return _buf(pHashBuf.ptr, pHashBuf.size);
//unsigned char *out = NULL;
//SecByteBlock derived(hashSize);
//PKCS5_PBKDF2_HMAC<SHA256> pbkdf2;
//pbkdf2.DeriveKey(
// derived.data(),
// derived.size(),
// 0,
// password.ptr, password.size,
// salt.ptr, salt.size,
// spin);
//
//return _buf(derived.data(), derived.size());
return _buf(pKey.ptr, pKey.size);
}
_buf GenerateHashKey(_buf & salt, _buf & password, int hashSize, int spin, CRYPT_METHOD::_hashAlgorithm algorithm, int block_index = 0)
@ -434,6 +425,11 @@ bool DecryptCipher(_buf & key, _buf & iv, _buf & data_inp, _buf & data_out, CRY
{
rc4Decryption.ProcessData(data_out.ptr, data_inp.ptr, data_inp.size);
}
else if (algorithm == CRYPT_METHOD::Blowfish_CFB)
{
CFB_Mode<Blowfish>::Decryption decryption(key.ptr, key.size, iv.ptr);
decryption.ProcessData(data_out.ptr, data_inp.ptr, data_inp.size);
}
else //AES
{
StreamTransformation *modeDecryption = NULL;
@ -682,8 +678,7 @@ void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*&
_buf pDecryptedKey;
DecryptCipher( agileKey, pSalt, pKeyValue, pDecryptedKey, cryptData.cipherAlgorithm);
_buf iv(cryptData.blockSize);
memset( iv.ptr, 0x00, cryptData.blockSize );
_buf iv(cryptData.blockSize, true);
int i = start_iv_block, sz = 4096, pos = 0;//aes block size = 4096
@ -891,8 +886,7 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
////??? pEncryptedKey == pKeyValue;
//-------------------------------------------------------------------------------------------------
_buf iv(cryptData.blockSize);
memset( iv.ptr, 0x00, cryptData.blockSize );
_buf iv(cryptData.blockSize, true);
int i = 0, sz = 4096, enc_size = 0;
@ -948,83 +942,53 @@ ODFDecryptor::~ODFDecryptor()
{
}
bool ODFDecryptor::SetPassword(std::wstring _password)
{
bVerify = false;
password = _password;
if (password.empty()) return false;
_buf pPassword (password);
_buf pSalt (cryptData.saltValue);
_buf empty (NULL, 0, false);
_buf pEncVerInput (cryptData.input);
_buf pEncVerValue (cryptData.checksum);
_buf pIvi (cryptData.initializationVector);
_buf hashBufIvi = HashAppend(pIvi, empty, cryptData.hashAlgorithm);
//_buf verifierKey1 = GenerateHashKey(pSalt, pPassword, cryptData.hashSize, cryptData.spinCount, cryptData.checksum_hashAlgorithm);
_buf verifierKey = GenerateOdfKey(pSalt, pPassword, pIvi, cryptData.hashSize, cryptData.spinCount, cryptData.checksum_hashAlgorithm);
CorrectHashSize(verifierKey, cryptData.keySize, 0);//??
////--------------------------------------------
_buf decryptedVerifierHashInputBytes;
DecryptCipher(verifierKey, pIvi, pEncVerInput, decryptedVerifierHashInputBytes, cryptData.cipherAlgorithm);
//--------------------------------------------
_buf hashBuf = HashAppend(decryptedVerifierHashInputBytes, empty, cryptData.hashAlgorithm);
//--------------------------------------------
_buf decryptedVerifierHashBytes;
DecryptCipher(verifierKey, pIvi, pEncVerValue, decryptedVerifierHashBytes, cryptData.cipherAlgorithm);
bVerify = (decryptedVerifierHashBytes==hashBuf);
return true;
}
bool ODFDecryptor::IsVerify()
{
return bVerify;
}
void ODFDecryptor::SetCryptData(_odfCryptData & data)
{
cryptData = data;
}
void ODFDecryptor::Decrypt(char* data, const size_t size, const unsigned long start_iv_block)
bool ODFDecryptor::Decrypt(const std::wstring &wpassword, unsigned char* data_inp, int size_inp, unsigned char*& data_out, int &size_out)
{
if (!bVerify) return;
unsigned char* data_out = NULL;
Decrypt((unsigned char*)data, size, data_out, start_iv_block);
if (data_out)
{
memcpy(data, data_out, size);
delete []data_out;
}
}
void ODFDecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*& data_out, unsigned long start_iv_block)
{
data_out = new unsigned char[size];
bVerify = false;
std::string password = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(wpassword);
_buf pPassword (password);
_buf pSalt (cryptData.saltValue);
_buf ivi (cryptData.initializationVector);
_buf empty (NULL, 0, false);
_buf start (cryptData.initializationVector);
_buf hashKey = GenerateOdfKey(pSalt, pPassword, start, cryptData.hashSize, cryptData.spinCount, cryptData.hashAlgorithm, start_iv_block);
CorrectHashSize(hashKey, cryptData.keySize, 0);
_buf pInp(data_inp, size, false);
_buf pOut(data_out, size, false);
_buf ivi(cryptData.initializationVector);
_buf pKey = GenerateOdfKey(pSalt, pPassword, cryptData.keySize, cryptData.spinCount, cryptData.start_hashAlgorithm);
DecryptCipher(hashKey, ivi, pInp, pOut, cryptData.cipherAlgorithm);
_buf pInp(data_inp, size_inp, false);
_buf pOut(size_inp);
if (false == DecryptCipher(pKey, ivi, pInp, pOut, cryptData.cipherAlgorithm))
return false;
_buf pChecksum (cryptData.checksum);
_buf pOutLimit(pOut.ptr, (std::min)(cryptData.checksum_size, pOut.size), false);
_buf pOutHash = HashAppend(pOutLimit, empty, cryptData.checksum_hashAlgorithm);
bVerify = (pChecksum == pOutHash);
try
{
if (bVerify)
{
data_out = new unsigned char[size_out];
Inflator inflator(new ArraySink( data_out, size_out));
inflator.Put(pOut.ptr, pOut.size);
inflator.MessageEnd();
}
}
catch(...)
{
return false;
}
return bVerify;
}

View File

@ -55,7 +55,7 @@ namespace CRYPT_METHOD
AES_CBC,
AES_CFB,
AES_ECB,
Blowfish
Blowfish_CFB
};
}
namespace CRYPT
@ -109,17 +109,16 @@ struct _ecmaCryptData
struct _odfCryptData
{
CRYPT_METHOD::_cipherAlgorithm cipherAlgorithm = CRYPT_METHOD::AES_CBC;
CRYPT_METHOD::_hashAlgorithm hashAlgorithm = CRYPT_METHOD::SHA1;
CRYPT_METHOD::_hashAlgorithm start_hashAlgorithm = CRYPT_METHOD::SHA1;
int start_hashSize = 20;
int spinCount = 100000;
int keySize = 0x10;
int hashSize = 0x14;
int saltSize = 0x10;
int spinCount = 1024;
int keySize = 16;
std::string saltValue;
std::string initializationVector;
std::string input;
std::string checksum;
int checksum_size = 1024;
CRYPT_METHOD::_hashAlgorithm checksum_hashAlgorithm = CRYPT_METHOD::SHA1;
@ -172,27 +171,17 @@ private:
bool bVerify;
};
class ODFDecryptor : public Decryptor
class ODFDecryptor
{
public:
ODFDecryptor();
virtual ~ODFDecryptor();
virtual void Init(const unsigned long val) {}
virtual void Decrypt (char* data, const size_t size, const unsigned long stream_pos, const size_t block_size){}
virtual void Decrypt (char* data, const size_t size, const unsigned long start_iv_block);
virtual bool SetPassword (std::wstring password);
virtual bool IsVerify();
void SetCryptData(_odfCryptData &data);
void Decrypt (unsigned char* data, int size, unsigned char*& data_out, unsigned long start_iv_block);
bool Decrypt (const std::wstring &wpassword, unsigned char* data_inp, int size_inp, unsigned char*& data_out, int &size_out);
private:
std::wstring password;
_odfCryptData cryptData;
bool bVerify;
};

View File

@ -282,7 +282,10 @@ void CInflate::Init()
{
inflateInit(&m_internal->m_stream);
}
void CInflate::Init2()
{
inflateInit2(&m_internal->m_stream,-MAX_WBITS);
}
int CInflate::Process(int flush)
{
return inflate(&m_internal->m_stream, flush);

View File

@ -121,6 +121,7 @@ public:
void ClearFuncs();
void Init();
void Init2();
int Process(int flush);
void End();
};

View File

@ -208,8 +208,8 @@
X2tConverter* conv = [[X2tConverter alloc]init];
conv.isNoBase64 = YES;
conv.delimiter = [X2tConverter delimiters].firstObject;
conv.encoding = [NSNumber numberWithInteger:46];
conv.delimiter = @(4);
conv.encoding = @(46);
int result = [conv sdk_csv2xlst_bin:fullFileName nsTo:fullFileNameTo nsFontPath:fontsPath];
if (result != 0) {
NSLog(@"ERROR OPEN CSV : %d",result);

View File

@ -627,10 +627,6 @@
<Filter
Name="Common"
>
<File
RelativePath="..\..\..\DesktopEditor\common\Base64.cpp"
>
</File>
<File
RelativePath="..\..\..\XlsxSerializerCom\Writer\BinaryReader.h"
>
@ -688,44 +684,20 @@
RelativePath="..\..\..\XlsxSerializerCom\Common\Common.h"
>
</File>
<File
RelativePath="..\..\..\DesktopEditor\common\Directory.cpp"
>
</File>
<File
RelativePath="..\..\..\DesktopEditor\common\File.cpp"
>
</File>
<File
RelativePath="..\..\..\Common\FileDownloader\FileDownloader.cpp"
>
</File>
<File
RelativePath="..\..\..\Common\FileDownloader\FileDownloader_win.cpp"
>
</File>
<File
RelativePath="..\..\..\DesktopEditor\common\Path.cpp"
>
</File>
<File
RelativePath="..\..\..\DesktopEditor\common\String.cpp"
>
</File>
<File
RelativePath="..\..\..\DesktopEditor\common\StringBuilder.cpp"
>
</File>
</Filter>
<Filter
Name="_lib"
>
<File
RelativePath="..\..\..\build\lib\win_32\DjVuFile.lib"
>
</File>
<File
RelativePath="..\..\..\build\lib\win_32\doctrenderer.lib"
>
</File>
<File
RelativePath="..\..\..\build\lib\win_32\graphics.lib"
RelativePath="..\..\..\build\lib\win_32\DEBUG\graphics.lib"
>
</File>
<File
@ -741,7 +713,7 @@
>
</File>
<File
RelativePath="..\..\..\build\lib\win_32\kernel.lib"
RelativePath="..\..\..\build\lib\win_32\DEBUG\kernel.lib"
>
</File>
<File
@ -752,6 +724,10 @@
RelativePath="..\..\..\build\lib\win_32\PdfWriter.lib"
>
</File>
<File
RelativePath="..\..\..\build\lib\win_32\DEBUG\UnicodeConverter.lib"
>
</File>
<File
RelativePath="..\..\..\build\lib\win_32\XpsFile.lib"
>
@ -773,10 +749,6 @@
RelativePath="..\..\src\cextracttools.h"
>
</File>
<File
RelativePath="..\..\..\build\lib\win_32\DjVuFile.lib"
>
</File>
<File
RelativePath="..\..\src\main.cpp"
>
@ -785,18 +757,6 @@
RelativePath="..\..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath="..\..\..\build\lib\win_32\UnicodeConverter.lib"
>
</File>
<File
RelativePath="..\..\..\DesktopEditor\xml\src\xmldom.cpp"
>
</File>
<File
RelativePath="..\..\..\DesktopEditor\xml\src\xmllight.cpp"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -142,7 +142,7 @@ namespace CSVWriter
if ( oXlsx.m_pWorkbook )
{
// Get active sheet
if ( oXlsx.m_pWorkbook->m_oBookViews.IsInit() && ! oXlsx.m_pWorkbook->m_oBookViews->m_arrItems.empty())
if ( oXlsx.m_pWorkbook->m_oBookViews.IsInit() && !oXlsx.m_pWorkbook->m_oBookViews->m_arrItems.empty())
{
if ( oXlsx.m_pWorkbook->m_oBookViews->m_arrItems.front()->m_oActiveTab.IsInit())
{
@ -154,16 +154,17 @@ namespace CSVWriter
// Get active sheet rId (для конвертации в CSV нужно использовать name, т.к. это наш бинарник из js-скриптов и еще нет rId
// А для json-а нужно пользовать rId, т.к. при открытии они используются
if ( oXlsx.m_pWorkbook->m_oSheets.IsInit() && ! oXlsx.m_pWorkbook->m_oSheets->m_arrItems.empty())
if ( oXlsx.m_pWorkbook->m_oSheets.IsInit() && !oXlsx.m_pWorkbook->m_oSheets->m_arrItems.empty())
{
std::map<int, OOX::Spreadsheet::CSheet*>::iterator pFind = oXlsx.m_pWorkbook->m_oSheets->mapSheets.find(lActiveSheet);
OOX::Spreadsheet::CSheet *pSheet = NULL;
if (pFind != oXlsx.m_pWorkbook->m_oSheets->mapSheets.end())
pSheet = pFind->second;
if (lActiveSheet >= 0 && lActiveSheet < oXlsx.m_pWorkbook->m_oSheets->m_arrItems.size())
{
oXlsx.m_pWorkbook->m_oSheets->m_arrItems[lActiveSheet];
}
else
{
pSheet = oXlsx.m_pWorkbook->m_oSheets->m_arrItems.front();
}
sSheetRId = bJSON ? pSheet->m_oRid->GetValue() : pSheet->m_oName.get2();
}