Compare commits

..

12 Commits

Author SHA1 Message Date
7c83535528 Merge branch hotfix/v7.0.1 into master 2022-02-22 08:13:32 +00:00
35a86586ab Merge pull request #849 from ONLYOFFICE/fix/bug-55460
Fix bug #55460
2022-02-15 11:51:25 +03:00
00fa7e7afe Fix bug #55460 2022-02-15 11:38:54 +03:00
dc574f6606 [x2t] For bug 55284 2022-02-06 13:02:42 +03:00
c886341ac1 Fix bug 53831 2022-02-04 15:03:06 +03:00
4a93c91011 Fix bug 47558 2022-01-28 11:39:25 +03:00
209a3874c8 Merge pull request #832 from ONLYOFFICE/fix/v7.0.1-fix-bugs
fix bug #55027
2022-01-21 15:34:22 +03:00
abc74e21d0 fix bug #55027 2022-01-21 15:33:26 +03:00
e78b399810 Merge pull request #830 from ONLYOFFICE/fix/v7.0-fix-bugs
Fix/v7.0 fix bugs
2022-01-19 11:39:52 +03:00
1f976ae79a Merge branch release/v7.0.0 into master 2022-01-17 14:18:57 +00:00
4b9da896ab fix bug #54485 2022-01-13 18:12:26 +03:00
6561216356 fix bug #54819 2022-01-11 19:10:16 +03:00
12 changed files with 537 additions and 435 deletions

View File

@ -3535,6 +3535,10 @@ int Binary_CustomsTableReader::ReadCustomContent(BYTE type, long length, void* p
{
pCustomXMLProps->m_oCustomXmlContent = m_oBufferedStream.GetString3(length);
}
else if (c_oSerCustoms::ContentA == type)
{
pCustomXMLProps->m_oCustomXmlContentA = m_oBufferedStream.GetString2A();
}
else
res = c_oSerConstants::ReadUnknown;
return res;

View File

@ -1158,7 +1158,8 @@ extern int g_nCurFormatVersion;
Custom = 0,
ItemId = 1,
Uri = 2,
Content = 3
Content = 3,
ContentA = 4
};}
namespace c_oSerApp{enum c_oSerApp
{

View File

@ -9058,11 +9058,8 @@ void BinaryCustomsTableWriter::Write(OOX::CDocument* pDocument)
}
}
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerCustoms::Content);
std::wstring sXml = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)pCustomXml->m_sXmlA.c_str(), pCustomXml->m_sXmlA.length());
m_oBcw.m_oStream.WriteStringW3(sXml);
int nCurPos2 = m_oBcw.WriteItemStart(c_oSerCustoms::ContentA);
m_oBcw.m_oStream.WriteStringA(pCustomXml->m_sXmlA);
m_oBcw.WriteItemEnd(nCurPos2);
m_oBcw.WriteItemEnd(nCurPos);

View File

@ -628,9 +628,16 @@ namespace PPT_FORMAT
//string rect
int nRectCount = (int)pPPTShape->m_arStringTextRects.size();
if (0 != nRectCount)
if (0 != nRectCount && !pPPTShape->m_arStringTextRects[0].empty())
{
pFormulaConverter.ConvertTextRect(pPPTShape->m_arStringTextRects[0]);
if (pPPTShape->m_eType == PPTShapes::sptCNotchedCircularArrow)
{
pFormulaConverter.SetTextRectDefault();
}
else
{
pFormulaConverter.ConvertTextRect(pPPTShape->m_arStringTextRects[0]);
}
}
int nHandlesCount = (int)pPPTShape->m_arHandles.size();

View File

@ -550,8 +550,8 @@ void CConditionalFormattingRule::toXML2(NSStringUtils::CStringBuilder& writer, b
std::wstring node_name = bExtendedWrite ? L"x14:cfRule" : L"cfRule";
writer.WriteString(L"<" + node_name);
WritingStringAttrString(L"type", m_oType->ToString());
WritingStringAttrInt(L"priority", m_oPriority->GetValue());
WritingStringNullableAttrString(L"type", m_oType, m_oType->ToString());
WritingStringNullableAttrInt(L"priority", m_oPriority, m_oPriority->GetValue());
if (m_oAboveAverage.IsInit() && false == m_oAboveAverage->ToBool())
writer.WriteString(L" aboveAverage=\"0\"");
if (m_oBottom.IsInit() && true == m_oBottom->ToBool())

View File

@ -860,6 +860,7 @@
#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
// Others
#define ASC_MENU_EVENT_TYPE_FOCUS_OBJECT 26101

View File

@ -57,7 +57,10 @@
#define MAX_PATH 1024
#endif
#define READ_WRITE_FULL_BUFFER_SIZE 10000000 // 10mb
#ifdef __ANDROID__
#define READ_WRITE_FULL
#define USE_LINUX_SENDFILE_INSTEAD_STREAMS
// Available since API level 21.
@ -1217,6 +1220,45 @@ namespace NSFile
if (strSrc == strDst)
return true;
#ifdef READ_WRITE_FULL
BYTE* pFileData = NULL;
DWORD dwChunkSize = READ_WRITE_FULL_BUFFER_SIZE;
CFileBinary oFileSrc;
CFileBinary oFileDst;
if (oFileSrc.OpenFile(strSrc) && oFileDst.CreateFileW(strDst))
{
DWORD dwFileSrcSize = (DWORD)oFileSrc.GetFileSize();
if (dwChunkSize > dwFileSrcSize)
dwChunkSize = dwFileSrcSize;
BYTE* pTempBuffer = new BYTE[dwChunkSize];
DWORD dwProcessedBytes = 0;
while (dwFileSrcSize != 0)
{
oFileSrc.ReadFile(pTempBuffer, dwChunkSize, dwProcessedBytes);
if (dwProcessedBytes != dwChunkSize)
break;
if (!oFileDst.WriteFile(pTempBuffer, dwChunkSize))
break;
dwFileSrcSize -= dwChunkSize;
if (dwChunkSize > dwFileSrcSize)
dwChunkSize = dwFileSrcSize;
}
oFileSrc.CloseFile();
oFileDst.CloseFile();
RELEASEARRAYOBJECTS(pTempBuffer);
if (0 != dwFileSrcSize)
Remove(strDst);
else
return true;
}
#endif
#if !defined(_WIN32) && !defined(_WIN32_WCE) && !defined(_WIN64)
std::string strSrcA = U_TO_UTF8(strSrc);
std::string strDstA = U_TO_UTF8(strDst);

View File

@ -281,16 +281,13 @@ namespace ZLibZipUtils
{
char filename_inzipA[256];
wchar_t filename_inzip[256];
wchar_t* filename_withoutpath;
wchar_t* p;
int err=UNZ_OK;
NSFile::CFileBinary oFile;
FILE *fout=NULL;
void* buf;
uInt size_buf;
wchar_t* filename_withoutpath = NULL;
wchar_t* p = NULL;
int err = UNZ_OK;
unz_file_info file_info;
uLong ratio=0;
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzipA,sizeof(filename_inzipA),NULL,0,NULL,0);
std::wstring filenameW = codepage_issue_fixFromOEM(filename_inzipA);
@ -301,13 +298,6 @@ namespace ZLibZipUtils
return err;
}
size_buf = WRITEBUFFERSIZE;
buf = (void*)malloc(size_buf);
if (buf==NULL)
{
return UNZ_INTERNALERROR;
}
p = filename_withoutpath = filename_inzip;
while ((*p) != '\0')
{
@ -333,10 +323,10 @@ namespace ZLibZipUtils
else
write_filename = filename_withoutpath;
err = unzOpenCurrentFilePassword(uf,password);
err = unzOpenCurrentFilePassword(uf, password);
if (((*popt_overwrite)==0) && (err==UNZ_OK))
{
char rep=0;
char rep = 0;
NSFile::CFileBinary oFileTemp;
if (oFileTemp.OpenFile(write_filename))
{
@ -349,6 +339,36 @@ namespace ZLibZipUtils
if (rep == 'A')
*popt_overwrite=1;
}
//-------------------------------------------------------------------------------------------------
char* current_directory = getcwd(NULL, 0);
if (current_directory)
{
std::string current_path(current_directory);
free(current_directory);
current_path += FILE_SEPARATOR_STRA;
replace_all(current_path, "/", FILE_SEPARATOR_STRA);
replace_all(current_path, "\\", FILE_SEPARATOR_STRA);
std::string filename_inzip(filename_inzipA);
replace_all(filename_inzip, "/", FILE_SEPARATOR_STRA);
replace_all(filename_inzip, "\\", FILE_SEPARATOR_STRA);
std::string norm_path = normalize_path(current_path + filename_inzip);
std::string norm_current_path = normalize_path(current_path);
if (std::string::npos == norm_path.find(norm_current_path))
{
return UNZ_INTERNALERROR;
}
}
//-------------------------------------------------------------------------------------------------
NSFile::CFileBinary oFile;
FILE *fout = NULL;
if ((skip==0) && (err==UNZ_OK))
{
@ -356,33 +376,10 @@ namespace ZLibZipUtils
fout = oFile.GetFileNative();
// some zipfile don't contain directory alone before file
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
if ((fout == NULL) && ((*popt_extract_without_path)==0) &&
(filename_withoutpath!=(wchar_t*)filename_inzip))
{
char* current_directory = getcwd(NULL, 0);
if (current_directory)
{
std::string current_path(current_directory);
free(current_directory);
current_path += FILE_SEPARATOR_STRA;
replace_all(current_path, "/", FILE_SEPARATOR_STRA);
replace_all(current_path, "\\", FILE_SEPARATOR_STRA);
std::string filename_inzip(filename_inzipA);
replace_all(filename_inzip, "/", FILE_SEPARATOR_STRA);
replace_all(filename_inzip, "\\", FILE_SEPARATOR_STRA);
std::string norm_path = normalize_path(current_path + filename_inzip);
std::string norm_current_path = normalize_path(current_path);
if (std::string::npos == norm_path.find(norm_current_path))
{
return UNZ_INTERNALERROR;
}
}
char c=*(filename_withoutpath-1);
*(filename_withoutpath-1)='\0';
makedir(write_filename);
@ -395,41 +392,50 @@ namespace ZLibZipUtils
}
}
if (fout!=NULL)
{
do
{
err = unzReadCurrentFile(uf, buf, size_buf);
if (err<0)
{
break;
}
if (err>0)
if (fwrite(buf,err,1,fout)!=1)
{
err=UNZ_ERRNO;
break;
}
}
while (err>0);
//close вызовется в oFile
//if (fout)
// fclose(fout);
uInt size_buf = WRITEBUFFERSIZE;
void* buf = (void*)malloc(size_buf);
if (err==0)
change_file_date(write_filename,file_info.dosDate,
file_info.tmu_date);
if (buf == NULL)
{
return UNZ_INTERNALERROR;
}
if (err==UNZ_OK)
if (fout != NULL)
{
do
{
err = unzReadCurrentFile(uf, buf, size_buf);
if (err<0)
{
break;
}
if (err>0)
if (fwrite(buf, err, 1, fout) != 1)
{
err=UNZ_ERRNO;
break;
}
}
while (err>0);
//close вызовется в oFile
if (err==0)
{
change_file_date(write_filename, file_info.dosDate, file_info.tmu_date);
}
}
if (err == UNZ_OK)
{
err = unzCloseCurrentFile (uf);
}
else
unzCloseCurrentFile(uf); // don't lose the error
unzCloseCurrentFile(uf); // don't lose the error
free(buf);
}
free(buf);
return err;
}

View File

@ -149,13 +149,20 @@ namespace NSUnicodeConverter
std::wstring toUnicode(const char* sInput, const unsigned int& nInputLen, int nCodePage, bool isExact)
{
std::wstring sRes = L"";
if (!isExact && nInputLen > 0)
if (nInputLen > 0)
{
CFStringEncoding nEncodingCF = CFStringConvertWindowsCodepageToEncoding((unsigned int)nCodePage);
if (kCFStringEncodingInvalidId == nEncodingCF)
{
if (isExact)
{
std::string strInputA(sInput, nInputLen);
sRes = std::wstring(strInputA.begin(), strInputA.end());
}
return sRes;
NSStringEncoding nEncodingNS = CFStringConvertEncodingToNSStringEncoding(nEncodingCF);
}
NSStringEncoding nEncodingNS = CFStringConvertEncodingToNSStringEncoding(nEncodingCF);
NSString* sUnicodeNS = [[NSString alloc] initWithBytes:sInput length:nInputLen encoding:nEncodingNS];
sRes = NSStringToStdstring(sUnicodeNS);
}
@ -164,12 +171,19 @@ namespace NSUnicodeConverter
std::wstring toUnicode(const char* sInput, const unsigned int& nInputLen, const char* converterName, bool isExact)
{
std::wstring sRes = L"";
if (!isExact && nInputLen > 0)
if (nInputLen > 0)
{
NSString* sEncodingCF = StringAToNSString(std::string(converterName));
CFStringEncoding nEncodingCF = CFStringConvertIANACharSetNameToEncoding((CFStringRef)sEncodingCF);
if (kCFStringEncodingInvalidId == nEncodingCF)
{
if (isExact)
{
std::string strInputA(sInput, nInputLen);
sRes = std::wstring(strInputA.begin(), strInputA.end());
}
return sRes;
}
NSStringEncoding nEncodingNS = CFStringConvertEncodingToNSStringEncoding(nEncodingCF);
NSString* sUnicodeNS = [[NSString alloc] initWithBytes:sInput length:nInputLen encoding:nEncodingNS];

View File

@ -26,7 +26,7 @@ build_x2t_as_library {
include(X2tConverter.pri)
build_x2t_as_library {
shared:QMAKE_LFLAGS += -exported_symbols_list $$PWD/../../src/dylib/export
!core_debug:shared:QMAKE_LFLAGS += -exported_symbols_list $$PWD/../../src/dylib/export
}

View File

@ -3747,6 +3747,11 @@ int BinaryWorksheetsTableReader::ReadWorksheet(boost::unordered_map<BYTE, std::v
OOX::Spreadsheet::CSheetProtection oProtection;
READ2_DEF_SPREADSHEET(length, res, this->ReadProtection, &oProtection);
SEEK_TO_POS_END(oProtection);
//-------------------------------------------------------------------------------------------------------------
SEEK_TO_POS_START(c_oSerWorksheetsTypes::ProtectedRanges);
OOX::Spreadsheet::CProtectedRanges oProtectedRanges;
READ1_DEF(length, res, this->ReadProtectedRanges, &oProtectedRanges);
SEEK_TO_POS_END(oProtectedRanges);
//-------------------------------------------------------------------------------------------------------------
SEEK_TO_POS_START(c_oSerWorksheetsTypes::Autofilter);
OOX::Spreadsheet::CAutofilter oAutofilter;
@ -3852,11 +3857,6 @@ int BinaryWorksheetsTableReader::ReadWorksheet(boost::unordered_map<BYTE, std::v
OOX::Spreadsheet::CHyperlinks oHyperlinks;
READ1_DEF(length, res, this->ReadHyperlinks, &oHyperlinks);
SEEK_TO_POS_END(oHyperlinks);
//-------------------------------------------------------------------------------------------------------------
SEEK_TO_POS_START(c_oSerWorksheetsTypes::ProtectedRanges);
OOX::Spreadsheet::CProtectedRanges oProtectedRanges;
READ1_DEF(length, res, this->ReadProtectedRanges, &oProtectedRanges);
SEEK_TO_POS_END(oProtectedRanges);
//-------------------------------------------------------------------------------------------------------------
SEEK_TO_POS_START(c_oSerWorksheetsTypes::PrintOptions);
OOX::Spreadsheet::CPrintOptions oPrintOptions;