Compare commits

..

24 Commits

Author SHA1 Message Date
0c29e4d08e Merge branch hotfix/v6.4.1 into master 2021-09-30 12:13:32 +00:00
e7ab7b1558 Fix bug with GetProperty method (#725)
Co-authored-by: Oleg Korshul <Oleg.Korshul@onlyoffice.com>
2021-09-28 12:09:47 +03:00
a7b7484cdf Merge branch hotfix/v6.4.1 into master 2021-09-28 08:01:21 +00:00
88741b4e82 Merge pull request #717 from ONLYOFFICE/fix/v6.4.1-fix-bugs2
Fix/v6.4.1 fix bugs2
2021-09-16 19:09:37 +03:00
76f94eaacc fix bug #52607 2021-09-16 19:08:03 +03:00
c886e0da68 for bug #52560 - restore all pages 2021-09-16 18:43:59 +03:00
4ee53a3e27 Merge pull request #716 from ONLYOFFICE/fix/native-order
Fixed order constants for native editors
2021-09-16 14:29:02 +03:00
22943dcf0b Fixed order constants for native editors 2021-09-16 14:28:12 +03:00
63ff79af7f Update Readme.md (#713) 2021-09-14 17:41:30 +03:00
10d2e2c960 Merge pull request #714 from ONLYOFFICE/fix/v6.4.1-fix-bugs2
Fix/v6.4.1 fix bugs2
2021-09-14 17:23:47 +03:00
2da99edbd6 fix bug #52395 2021-09-14 17:18:07 +03:00
836b6a638b bix bugs 2021-09-14 15:17:23 +03:00
ea59351da8 Fix bug 51756 2021-09-13 19:43:19 +03:00
64bb70bbef Fix signatures 2021-09-13 18:20:25 +03:00
ca8b6d9c5c Fix build with v8 8.7 version 2021-09-13 10:08:28 +03:00
f6e6fb28ef Fix bug 49156 2021-09-09 23:22:01 +03:00
cd82eb40b6 Add oxps files support 2021-09-09 19:26:36 +03:00
771c813936 Fix bug 52397 2021-09-08 10:16:46 +03:00
a4245ef832 Fix bugs with regenerate thumbnails 2021-09-07 16:31:55 +03:00
06136ddd0d Sort fonts by name 2021-09-07 15:59:04 +03:00
390a568555 Merge pull request #712 from ONLYOFFICE/fix/eaFonts
Fix/ea fonts
2021-09-06 20:26:03 +03:00
8d098d9951 Refactoring AllFontsGen (start using CApplicationFontsWorker) 2021-09-06 20:25:12 +03:00
98a8a865fe Refactoring 2021-09-06 09:10:44 +03:00
10348a72f1 Fonts thumbnail for ea 2021-09-05 15:21:18 +03:00
26 changed files with 645 additions and 1348 deletions

View File

@ -630,8 +630,8 @@ namespace DocFileFormat
d = (int)_writeTocLink.find(L" ");
_writeTocLink = _writeTocLink.substr(0, d);
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor = \"");
_writeAfterRun += _writeTocLink;
_writeAfterRun = std::wstring (L"<w:hyperlink w:anchor=\"");
_writeAfterRun += XmlUtils::EncodeXmlString(_writeTocLink);
_writeAfterRun += std::wstring (L"\" w:history=\"1\">");
break;

View File

@ -88,6 +88,11 @@ namespace DocFileFormat
{
m_pBlipStore = static_cast<BlipStoreContainer*>(recBs);
}
for (int i = 0; i < 8; ++i)
{
m_nAdjValues[i] = 0x7fffffff;
}
}
VMLShapeMapping::~VMLShapeMapping()
@ -957,12 +962,14 @@ namespace DocFileFormat
{
if (nAdjValues > 0)
{
std::wstring adjTag = std::to_wstring(m_nAdjValues[0]);
std::wstring adjTag;
for (int i = 1; i < nAdjValues; ++i)
adjTag += L"," + std::to_wstring(m_nAdjValues[i]);
for (int i = 0; i < nAdjValues; ++i)
{
adjTag += L"," + (m_nAdjValues[i] != 0x7fffffff ? std::to_wstring(m_nAdjValues[i]) : L"");
}
m_pXmlWriter->WriteAttribute(L"adj", adjTag);
m_pXmlWriter->WriteAttribute(L"adj", adjTag.substr(1));
}
}

View File

@ -469,11 +469,21 @@ public:
void ExecuteText( RtfDocument& oDocument, RtfReader& oReader, std::wstring sText )
{
XmlUtils::replace_all(sText, L";", L"");
oDocument.m_oRevisionTable.AddItem( sText );
if (std::wstring::npos != sText.find(L";"))
{
m_sCurrent += sText;
XmlUtils::replace_all(m_sCurrent, L";", L"");
oDocument.m_oRevisionTable.AddItem(m_sCurrent);
m_sCurrent.clear();
}
else
{
m_sCurrent += sText;
}
}
private:
std::wstring m_sCurrent;
};
class RtfInfoReader: public RtfAbstractReader

View File

@ -113,3 +113,32 @@ std::wstring RtfListOverrideTable::RenderToOOX(RenderParameter oRenderParameter)
}
return sResult;
}
std::wstring RtfRevisionTable::RenderToRtf(RenderParameter oRenderParameter)
{
if (m_aArray.empty()) return L"";
std::wstring sResult;
sResult += _T("{\\*\\revtbl ");
sResult += L"{Unknown;}";
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_RTF_PARAM_CHAR;
for (size_t i = 0; i < m_aArray.size(); i++)
{
sResult += _T("{");
RtfCharPtr pNewChar(new RtfChar());
pNewChar->setText(m_aArray[i]);
sResult += pNewChar->RenderToRtf(oNewParam);
//sResult += m_aArray[i]
sResult += L";}";
}
sResult += _T("}");
return sResult;
}

View File

@ -449,25 +449,7 @@ public:
class RtfRevisionTable : public IDocumentElement, public ItemContainer<std::wstring>
{
public:
std::wstring RenderToRtf(RenderParameter oRenderParameter)
{
if (m_aArray.empty()) return L"";
std::wstring sResult;
sResult += _T("{\\*\\revtbl ");
sResult += L"{Unknown;}";
for (size_t i = 0; i < m_aArray.size(); i++)
{
sResult += _T("{");
sResult += m_aArray[i] + L";";
sResult += _T("}");
}
sResult += _T("}");
return sResult;
}
std::wstring RenderToRtf(RenderParameter oRenderParameter);
std::wstring RenderToOOX(RenderParameter oRenderParameter)
{
return L"";
@ -485,7 +467,7 @@ public:
if (ind == PROP_DEF || ind > (int)m_aArray.size())
return L"";
return m_aArray[ind];
return XmlUtils::EncodeXmlStringExtend(m_aArray[ind]);
}
};

View File

@ -402,7 +402,13 @@ public:
/// \sa GetValue(), GetValueWithDefault(), GetIntValue(), GetIntValueWithDefault(),
/// GetRequiredParameter() and GetRequiredIntParameter()
CRYPTOPP_DLL static void CRYPTOPP_API ThrowIfTypeMismatch(const char *name, const std::type_info &stored, const std::type_info &retrieving)
{if (stored != retrieving) throw ValueTypeMismatch(name, stored, retrieving);}
{
#ifdef DISABLE_TYPE_MISMATCH
return;
#endif
if (stored != retrieving)
throw ValueTypeMismatch(name, stored, retrieving);
}
/// \brief Retrieves a required name/value pair
/// \tparam T class or type

View File

@ -17,6 +17,7 @@ core_ios:DEFINES -= MAC
core_windows:DEFINES -= UNICODE _UNICODE
DEFINES += CRYPTOPP_DISABLE_ASM
DEFINES += DISABLE_TYPE_MISMATCH
core_android {
INCLUDEPATH += $$(ANDROID_NDK_ROOT)/sources/android/cpufeatures

View File

@ -50,6 +50,7 @@
#include <vector>
#include <queue>
#include <limits>
#include <map>
#include <cstring>
@ -91,13 +92,19 @@ class Header
class AllocTable
{
public:
AllocTable();
static const uint64 Eof;
static const uint64 Avail;
static const uint64 Bat;
static const uint64 MetaBat;
uint64 blockSize;
AllocTable();
void clear();
void clear()
{
data.clear();
dirtyBlocks.clear();
}
uint64 count();
uint64 unusedCount();
void resize( uint64 newsize );
@ -116,7 +123,8 @@ class AllocTable
void flush(std::vector<uint64> blocks, StorageIO *const io, int64 bigBlockSize);
private:
std::vector<uint64> data;
std::vector<uint64> dirtyBlocks;
std::map<uint64, char> dirtyBlocks;
bool bMaybeFragmented;
AllocTable( const AllocTable& );
AllocTable& operator=( const AllocTable& );
@ -168,8 +176,10 @@ class DirTree
void deleteEntry(DirEntry *entry, const std::wstring& inFullName, int64 bigBlockSize);
private:
std::vector<DirEntry> entries;
std::vector<uint64> dirtyBlocks;
DirTree( const DirTree& );
std::map<uint64, char> dirtyBlocks;
DirTree( const DirTree& );
DirTree& operator=( const DirTree& );
};
@ -454,8 +464,6 @@ const uint64 AllocTable::MetaBat = 0xfffffffc;
AllocTable::AllocTable()
: blockSize(4096),
data(),
dirtyBlocks(),
bMaybeFragmented(true)
{
// initial size
@ -582,37 +590,30 @@ void AllocTable::save( unsigned char* buffer )
bool AllocTable::isDirty()
{
return (dirtyBlocks.size() > 0);
return (false == dirtyBlocks.empty());
}
void AllocTable::markAsDirty(uint64 dataIndex, int64 bigBlockSize)
{
uint64 dbidx = dataIndex / (bigBlockSize / sizeof(uint32));
for (uint64 idx = 0; idx < static_cast<uint64>(dirtyBlocks.size()); idx++)
{
if (dirtyBlocks[idx] == dbidx)
return;
}
dirtyBlocks.push_back(dbidx);
std::map<uint64, char>::iterator pFind = dirtyBlocks.find(dbidx);
if (pFind == dirtyBlocks.end())
dirtyBlocks.insert(std::make_pair(dbidx, 0));
}
void AllocTable::flush(std::vector<uint64> blocks, StorageIO *const io, int64 bigBlockSize)
{
unsigned char *buffer = new unsigned char[bigBlockSize * blocks.size()];
save(buffer);
memset(buffer, 0, bigBlockSize * blocks.size());
save(buffer);
for (uint64 idx = 0; idx < static_cast<uint64>(blocks.size()); idx++)
{
bool bDirty = false;
for (uint64 idx2 = 0; idx2 < static_cast<uint64>(dirtyBlocks.size()); idx2++)
{
if (dirtyBlocks[idx2] == idx)
{
bDirty = true;
break;
}
}
if (bDirty)
io->saveBigBlock(blocks[idx], 0, &buffer[bigBlockSize*idx], bigBlockSize);
std::map<uint64, char>::iterator pFind = dirtyBlocks.find(idx);
if (pFind != dirtyBlocks.end())
io->saveBigBlock(blocks[idx], 0, &buffer[bigBlockSize * idx], bigBlockSize);
}
dirtyBlocks.clear();
delete[] buffer;
@ -658,8 +659,6 @@ int DirEntry::compare(const std::wstring& name2)
const uint64 DirTree::End = 0xffffffff;
DirTree::DirTree(int64 bigBlockSize)
: entries(),
dirtyBlocks()
{
clear(bigBlockSize);
}
@ -833,7 +832,7 @@ DirEntry* DirTree::entry( const std::wstring& name, bool create, int64 bigBlockS
{
return (DirEntry*)0;
}
// create a new entry
// create a new entry
uint64 parent2 = index;
index = unused();
DirEntry* e = entry( index );
@ -1102,45 +1101,44 @@ void DirTree::save( unsigned char* buffer )
bool DirTree::isDirty()
{
return (dirtyBlocks.size() > 0);
return (dirtyBlocks.empty() == false);
}
void DirTree::markAsDirty(uint64 dataIndex, int64 bigBlockSize)
{
uint64 dbidx = dataIndex / (bigBlockSize / 128);
for (uint64 idx = 0; idx < static_cast<uint64>(dirtyBlocks.size()); idx++)
{
if (dirtyBlocks[idx] == dbidx)
return;
}
dirtyBlocks.push_back(dbidx);
std::map<uint64, char>::iterator pFind = dirtyBlocks.find(dbidx);
if (pFind == dirtyBlocks.end())
dirtyBlocks.insert(std::make_pair(dbidx, 0));
}
void DirTree::flush(std::vector<uint64> blocks, StorageIO *const io, int64 bigBlockSize, uint64 sb_start, uint64 sb_size)
{
uint64 bufLen = size();
unsigned char *buffer = new unsigned char[bufLen];
memset(buffer, 0, bufLen);
save(buffer);
writeU32( buffer + 0x74, (uint32) sb_start );
writeU32( buffer + 0x78, (uint32) sb_size );
for (uint64 idx = 0; idx < static_cast<uint64>(blocks.size()); idx++)
for (uint64 idx = 0; idx < static_cast<uint64>(blocks.size()); idx++)
{
bool bDirty = false;
for (uint64 idx2 = 0; idx2 < static_cast<uint64>(dirtyBlocks.size()); idx2++)
{
if (dirtyBlocks[idx2] == idx)
{
bDirty = true;
break;
}
}
uint64 bytesToWrite = bigBlockSize;
uint64 pos = bigBlockSize*idx;
if ((bufLen - pos) < bytesToWrite)
bytesToWrite = bufLen - pos;
if (bDirty)
io->saveBigBlock(blocks[idx], 0, &buffer[pos], bytesToWrite);
std::map<uint64, char>::iterator pFind = dirtyBlocks.find(idx);
if (pFind != dirtyBlocks.end())
{
uint64 bytesToWrite = bigBlockSize;
uint64 pos = bigBlockSize * idx;
if ((bufLen - pos) < bytesToWrite)
bytesToWrite = bufLen - pos;
io->saveBigBlock(blocks[idx], 0, &buffer[pos], bytesToWrite);
}
}
dirtyBlocks.clear();
delete[] buffer;
@ -1496,7 +1494,9 @@ void StorageIO::flush()
if (header->dirty)
{
unsigned char *buffer = new unsigned char[512];
header->save( buffer );
memset(buffer, 0, 512);
header->save( buffer );
file.seekp( 0 );
file.write( (char*)buffer, 512 );
fileCheck(file);
@ -1519,11 +1519,14 @@ void StorageIO::flush()
{
uint64 nBytes = bbat->blockSize * static_cast<uint64>(mbat_blocks.size());
unsigned char *buffer = new unsigned char[nBytes];
uint64 sIdx = 0;
memset(buffer, 0, nBytes);
uint64 sIdx = 0;
uint64 dcount = 0;
uint64 blockCapacity = bbat->blockSize / sizeof(uint64) - 1;
uint64 blockIdx = 0;
for (unsigned mdIdx = 0; mdIdx < mbat_data.size(); mdIdx++)
for (size_t mdIdx = 0; mdIdx < mbat_data.size(); mdIdx++)
{
writeU32(buffer + sIdx, (uint32) mbat_data[mdIdx]);
sIdx += 4;
@ -1564,9 +1567,10 @@ void StorageIO::close()
if (filesize % 512 != 0)
{
char padding[512];
memset(padding, 0, 512);
file.write(padding, (filesize / 512 + 1 ) * 512 - filesize);
char padding[512] = {};
POLE::uint64 sz = (filesize / 512 + 1) * 512 - filesize;
file.write(padding, sz);
fileCheck(file);
}
}
@ -1718,10 +1722,10 @@ uint64 StorageIO::saveBigBlocks( std::vector<uint64> blocks, uint64 offset, unsi
// write block one by one, seems fast enough
uint64 bytes = 0;
for( size_t i=0; (i < blocks.size() ) & ( bytes<len ); i++ )
for ( size_t i = 0; (i < blocks.size() ) & ( bytes < len ); i++ )
{
uint64 block = blocks[i];
uint64 pos = (bbat->blockSize * ( block+1 ) ) + offset;
uint64 pos = (bbat->blockSize * ( block + 1 ) ) + offset;
uint64 maxWrite = bbat->blockSize - offset;
uint64 tobeWritten = len - bytes;
if (tobeWritten > maxWrite)

View File

@ -73,15 +73,21 @@ namespace OOX
std::wstring toVmlXML() const
{
std::wstring sAnchor;
sAnchor += m_oFrom->m_oCol->ToString() + L",";
sAnchor += std::to_wstring(m_oFrom->m_oColOff->ToPx()) + L",";
sAnchor += m_oFrom->m_oRow->ToString() + L",";
sAnchor += std::to_wstring(m_oFrom->m_oRowOff->ToPx()) + L",";
sAnchor += m_oTo->m_oCol->ToString() + L",";
sAnchor += std::to_wstring(m_oTo->m_oColOff->ToPx()) + L",";
sAnchor += m_oTo->m_oRow->ToString() + L",";
sAnchor += std::to_wstring(m_oTo->m_oRowOff->ToPx());
if (m_oFrom.IsInit())
{
sAnchor += m_oFrom->m_oCol->ToString() + L",";
sAnchor += std::to_wstring(m_oFrom->m_oColOff->ToPx()) + L",";
sAnchor += m_oFrom->m_oRow->ToString() + L",";
sAnchor += std::to_wstring(m_oFrom->m_oRowOff->ToPx()) + L",";
}
if (m_oTo.IsInit())
{
sAnchor += m_oTo->m_oCol->ToString() + L",";
sAnchor += std::to_wstring(m_oTo->m_oColOff->ToPx()) + L",";
sAnchor += m_oTo->m_oRow->ToString() + L",";
sAnchor += std::to_wstring(m_oTo->m_oRowOff->ToPx());
}
return sAnchor;
}

View File

@ -1080,8 +1080,6 @@ bool COfficeFileFormatChecker::isFB2FormatFile(unsigned char* pBuffer,int dwByte
}
bool COfficeFileFormatChecker::isXpsFile(const std::wstring & fileName)
{
const char *xpsFormatLine = "http://schemas.microsoft.com/xps/2005/06/fixedrepresentation";
COfficeUtils OfficeUtils(NULL);
ULONG nBufferSize = 0;
@ -1090,7 +1088,10 @@ bool COfficeFileFormatChecker::isXpsFile(const std::wstring & fileName)
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"_rels/.rels", &pBuffer, nBufferSize);
if (hresult == S_OK && pBuffer != NULL)
{
if ( NULL != strstr((char*)pBuffer, xpsFormatLine) )
// http://schemas.microsoft.com/xps/2005/06/fixedrepresentation
// http://schemas.openxps.org/oxps/v1.0/fixedrepresentation
if (NULL != strstr((char*)pBuffer, "fixedrepresentation") &&
(NULL != strstr((char*)pBuffer, "/xps/") || NULL != strstr((char*)pBuffer, "/oxps/")))
{
nFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS;
}
@ -1099,7 +1100,8 @@ bool COfficeFileFormatChecker::isXpsFile(const std::wstring & fileName)
pBuffer = NULL;
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN) return true;
}else
}
else
{
HRESULT hresult = OfficeUtils.LoadFileFromArchive(fileName, L"_rels/.rels/[0].piece", &pBuffer, nBufferSize);
if (hresult == S_OK && pBuffer != NULL)

File diff suppressed because it is too large Load Diff

View File

@ -53,8 +53,8 @@
#define c_oAscNumFormatType_Fraction 10
#define c_oAscDrawingLayerType_BringToFront 0
#define c_oAscDrawingLayerType_SendToBack 1
#define c_oAscDrawingLayerType_BringForward 2
#define c_oAscDrawingLayerType_BringForward 1
#define c_oAscDrawingLayerType_SendToBack 2
#define c_oAscDrawingLayerType_SendBackward 3
#define c_oAscTransactionState_No -1

View File

@ -581,6 +581,18 @@ namespace NSStringUtils
std::wstring str(m_pData, (int)m_lSizeCur);
return str;
}
std::wstring CStringBuilder::GetSubData(const size_t& start, const size_t& count)
{
if (start >= m_lSizeCur)
return L"";
size_t nCountMax = m_lSizeCur - start;
if (count != std::wstring::npos && count <= nCountMax)
nCountMax = count;
return std::wstring(m_pData + start, nCountMax);
}
wchar_t* CStringBuilder::GetBuffer()
{
return m_pData;

View File

@ -123,6 +123,7 @@ namespace NSStringUtils
void ClearNoAttack();
std::wstring GetData();
std::wstring GetSubData(const size_t& start = 0, const size_t& count = std::wstring::npos);
wchar_t* GetBuffer();
void RemoveLastSpaces();

View File

@ -352,4 +352,85 @@ namespace NSStringExt
return pUtf16;
}
class CStringUnicodeIterator_private
{
public:
const wchar_t* m_str;
size_t m_str_len;
size_t m_index;
public:
CStringUnicodeIterator_private(const std::wstring& str)
{
m_str = str.c_str();
m_str_len = str.length();
m_index = 0;
}
inline bool IsLeadingSurrogateChar(const unsigned int& nCharCode)
{
return (nCharCode >= 0xD800 && nCharCode <= 0xDFFF);
}
inline unsigned int DecodeSurrogateChar(const unsigned int& nLeadingChar, const unsigned int& nTrailingChar)
{
if (nLeadingChar < 0xDC00 && nTrailingChar >= 0xDC00 && nTrailingChar <= 0xDFFF)
return 0x10000 + ((nLeadingChar & 0x3FF) << 10) | (nTrailingChar & 0x3FF);
else
return 0;
}
};
CStringUnicodeIterator::CStringUnicodeIterator(const std::wstring& string)
{
m_internal = new CStringUnicodeIterator_private(string);
}
bool CStringUnicodeIterator::Check()
{
return (m_internal->m_index < m_internal->m_str_len) ? true : false;
}
void CStringUnicodeIterator::Next()
{
if (this->m_internal->m_index >= this->m_internal->m_str_len)
return;
if (2 != sizeof(wchar_t))
{
m_internal->m_index++;
}
else
{
if (!m_internal->IsLeadingSurrogateChar((unsigned int)m_internal->m_str[m_internal->m_index]))
{
m_internal->m_index++;
return;
}
m_internal->m_index += 2;
}
}
unsigned int CStringUnicodeIterator::Value()
{
if (m_internal->m_index >= m_internal->m_str_len)
return 0;
if (2 != sizeof(wchar_t))
{
return (unsigned int)m_internal->m_str[m_internal->m_index];
}
else
{
unsigned int nCharCode = (unsigned int)m_internal->m_str[m_internal->m_index];
if (!m_internal->IsLeadingSurrogateChar(nCharCode))
return nCharCode;
if (m_internal->m_index == (m_internal->m_str_len - 1))
return nCharCode;
unsigned int nTrailingChar = (unsigned int)m_internal->m_str[m_internal->m_index + 1];
return m_internal->DecodeSurrogateChar(nCharCode, nTrailingChar);
}
}
}

View File

@ -132,7 +132,20 @@ namespace NSStringExt
static std::wstring GetUnicodeFromUTF32(const unsigned int* pData, long lCount);
static unsigned int* GetUtf32FromUnicode(const std::wstring& wsUnicodeText, unsigned int& unLen);
static unsigned short* GetUtf16FromUnicode(const std::wstring& wsUnicodeText, unsigned int& unLen, const bool& isLE = true);
};
};
class CStringUnicodeIterator_private;
class KERNEL_DECL CStringUnicodeIterator
{
private:
CStringUnicodeIterator_private* m_internal;
public:
CStringUnicodeIterator(const std::wstring& string);
bool Check();
void Next();
unsigned int Value();
};
}
namespace NSStringExt

View File

@ -308,6 +308,7 @@ namespace NSDoctRenderer
}
CDocBuilderValue::CDocBuilderValue(const CDocBuilderValue& src)
{
m_internal = new CDocBuilderValue_Private();
m_internal->m_value = src.m_internal->m_value;
}
CDocBuilderValue& CDocBuilderValue::operator=(const CDocBuilderValue& src)

View File

@ -20,11 +20,11 @@
-(JSValue*) AddImageInChanges : (JSValue*)img;
-(JSValue*) ConsoleLog : (JSValue*)message;
-(JSValue*) SaveChanges : (JSValue*)param : (JSValue*)delete_index : (JSValue*)count;
-(JSValue*) zipOpenFile : (JSValue*)name;
-(JSValue*) zipOpenFileBase64 : (JSValue*)name;
-(JSValue*) zipGetFileAsString : (JSValue*)name;
-(JSValue*) zipGetFileAsBinary : (JSValue*)name;
-(JSValue*) zipCloseFile;
-(JSValue*) ZipOpen : (JSValue*)name;
-(JSValue*) ZipOpenBase64 : (JSValue*)name;
-(JSValue*) ZipFileAsString : (JSValue*)name;
-(JSValue*) ZipFileAsBinary : (JSValue*)name;
-(JSValue*) ZipClose;
-(JSValue*) GetImageUrl : (JSValue*)url;
-(JSValue*) GetImagesPath;
@ -59,11 +59,11 @@ 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(zipOpenFile, zipOpenFile)
FUNCTION_WRAPPER_JS_1(zipOpenFileBase64, zipOpenFileBase64)
FUNCTION_WRAPPER_JS_1(zipGetFileAsString, zipGetFileAsString)
FUNCTION_WRAPPER_JS_1(zipGetFileAsBinary, zipGetFileAsBinary)
FUNCTION_WRAPPER_JS(zipCloseFile, zipCloseFile);
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)

View File

@ -124,7 +124,7 @@ namespace NSGraphics
{
v8::EscapableHandleScope handle_scope(isolate);
v8::Local<v8::ObjectTemplate> result = v8::ObjectTemplate::New();
v8::Local<v8::ObjectTemplate> result = v8::ObjectTemplate::New(isolate);
result->SetInternalFieldCount(1);
v8::Isolate* current = v8::Isolate::GetCurrent();

View File

@ -6,6 +6,7 @@
#include "v8.h"
#include "libplatform/libplatform.h"
#include "src/base/sys-info.h"
#ifdef V8_VERSION_87_PLUS
#define kV8NormalString v8::NewStringType::kNormal
@ -118,6 +119,15 @@ public:
m_pAllocator = new MallocArrayBufferAllocator();
#endif
create_params.array_buffer_allocator = m_pAllocator;
int64_t nMaxVirtualMemory = v8::base::SysInfo::AmountOfVirtualMemory();
if (0 == nMaxVirtualMemory)
nMaxVirtualMemory = 4000000000; // 4Gb
create_params.constraints.ConfigureDefaults(
v8::base::SysInfo::AmountOfPhysicalMemory(),
nMaxVirtualMemory);
return v8::Isolate::New(create_params);
}
};

View File

@ -38,12 +38,39 @@
#include "../common/Directory.h"
#include "../common/Array.h"
#include "../common/StringBuilder.h"
#include "../common/StringExt.h"
#include "../common/ByteBuilder.h"
#include "../graphics/pro/Fonts.h"
#include "../raster/BgraFrame.h"
#include "../graphics/pro/Graphics.h"
#define ONLYOFFICE_FONTS_VERSION_ 6
#define ONLYOFFICE_FONTS_VERSION_ 7
bool g_sort_font_names(const std::wstring& i, const std::wstring& j)
{
std::wstring s1 = i;
std::wstring s2 = j;
wchar_t symbol;
size_t len = s1.length();
for (size_t c = 0; c < len; ++c)
{
symbol = s1[c];
if (symbol >= 'A' && symbol <= 'Z')
s1[c] = symbol + 'a' - 'A';
}
len = s2.length();
for (size_t c = 0; c < len; ++c)
{
symbol = s2[c];
if (symbol >= 'A' && symbol <= 'Z')
s2[c] = symbol + 'a' - 'A';
}
return s1 < s2;
}
class CApplicationFontsWorker_private
{
@ -98,6 +125,8 @@ public:
std::vector<CFontThumbnail> m_arFonts;
bool m_bIsCheckThumbnailsMode;
std::map<std::wstring, std::wstring> m_mapAlternateEA;
class CFontInfoJS
{
public:
@ -375,6 +404,163 @@ public:
return false;
}
bool IsEastAsianScript(const unsigned int& value)
{
// Bopomofo (3100312F)
// Bopomofo Extended (31A031BF)
// CJK Unified Ideographs (4E009FEA)
// CJK Unified Ideographs Extension A (34004DB5)
// CJK Unified Ideographs Extension B (200002A6D6)
// CJK Unified Ideographs Extension C (2A7002B734)
// CJK Unified Ideographs Extension D (2B7402B81D)
// CJK Unified Ideographs Extension E (2B8202CEA1)
// CJK Unified Ideographs Extension F (2CEB02EBE0)
// CJK Compatibility Ideographs (F900FAFF)
// CJK Compatibility Ideographs Supplement (2F8002FA1F)
// Kangxi Radicals (2F002FDF)
// CJK Radicals Supplement (2E802EFF)
// CJK Strokes (31C031EF)
// Ideographic Description Characters (2FF02FFF)
// Hangul Jamo (110011FF)
// Hangul Jamo Extended-A (A960A97F)
// Hangul Jamo Extended-B (D7B0D7FF)
// Hangul Compatibility Jamo (3130318F)
// Halfwidth and Fullwidth Forms (FF00FFEF)
// Hangul Syllables (AC00D7AF)
// Hiragana (3040309F)
// Kana Extended-A (1B1001B12F)
// Kana Supplement (1B0001B0FF)
// Kanbun (3190319F)
// Katakana (30A030FF)
// Katakana Phonetic Extensions (31F031FF)
// Lisu (A4D0A4FF)
// Miao (16F0016F9F)
// Nushu (1B1701B2FF)
// Tangut (17000187EC)
// Tangut Components (1880018AFF)
// Yi Syllables (A000A48F)
// Yi Radicals (A490A4CF)
return ((0x3100 <= value && value <= 0x312F)
|| (0x31A0 <= value && value <= 0x31BF)
|| (0x4E00 <= value && value <= 0x9FEA)
|| (0x3400 <= value && value <= 0x4DB5)
|| (0x20000 <= value && value <= 0x2A6D6)
|| (0x2A700 <= value && value <= 0x2B734)
|| (0x2B740 <= value && value <= 0x2B81D)
|| (0x2B820 <= value && value <= 0x2CEA1)
|| (0x2CEB0 <= value && value <= 0x2EBE0)
|| (0xF900 <= value && value <= 0xFAFF)
|| (0x2F800 <= value && value <= 0x2FA1F)
|| (0x2F00 <= value && value <= 0x2FDF)
|| (0x2E80 <= value && value <= 0x2EFF)
|| (0x31C0 <= value && value <= 0x31EF)
|| (0x2FF0 <= value && value <= 0x2FFF)
|| (0x1100 <= value && value <= 0x11FF)
|| (0xA960 <= value && value <= 0xA97F)
|| (0xD7B0 <= value && value <= 0xD7FF)
|| (0x3130 <= value && value <= 0x318F)
|| (0xFF00 <= value && value <= 0xFFEF)
|| (0xAC00 <= value && value <= 0xD7AF)
|| (0x3040 <= value && value <= 0x309F)
|| (0x1B100 <= value && value <= 0x1B12F)
|| (0x1B000 <= value && value <= 0x1B0FF)
|| (0x3190 <= value && value <= 0x319F)
|| (0x30A0 <= value && value <= 0x30FF)
|| (0x31F0 <= value && value <= 0x31FF)
|| (0xA4D0 <= value && value <= 0xA4FF)
|| (0x16F00 <= value && value <= 0x16F9F)
|| (0x1B170 <= value && value <= 0x1B2FF)
|| (0x17000 <= value && value <= 0x187EC)
|| (0x18800 <= value && value <= 0x18AFF)
|| (0xA000 <= value && value <= 0xA48F)
|| (0xA490 <= value && value <= 0xA4CF));
}
bool IsEastAsianName(const std::wstring& sName)
{
for (NSStringExt::CStringUnicodeIterator oIterator(sName); oIterator.Check(); oIterator.Next())
{
if (IsEastAsianScript(oIterator.Value()))
return true;
}
return false;
}
void CheckFontAlternateName(NSFonts::CFontInfo* info, std::map<std::wstring, std::wstring>& mapAlternate)
{
if (info->names.empty())
return;
if (!IsEastAsianName(info->m_wsFontName) && IsEastAsianName(info->names[0]))
{
mapAlternate.insert(std::pair<std::wstring, std::wstring>(info->m_wsFontName, info->names[0]));
}
}
std::wstring SaveWebFonts(const std::map<std::wstring, LONG>& mapFontFiles)
{
int nCountFiles = (int)mapFontFiles.size();
BYTE correct16[16] = {0xA0, 0x66, 0xD6, 0x20, 0x14, 0x96, 0x47, 0xfa, 0x95, 0x69, 0xB8, 0x50, 0xB0, 0x41, 0x49, 0x48};
int nCountIdSymbols = (nCountFiles >= 1000) ? 4 : 3;
BYTE encode[32];
std::wstring* pMassFiles2 = new std::wstring[nCountFiles];
int nCurrentId = 0;
for (std::map<std::wstring, LONG>::const_iterator pos = mapFontFiles.begin(); pos != mapFontFiles.end(); pos++)
{
std::wstring strFontId = pos->first;
std::wstring sId = std::to_wstring(nCurrentId++);
int nLenId = (int)sId.length();
while (nLenId < nCountIdSymbols)
{
sId = L"0" + sId;
++nLenId;
}
pMassFiles2[pos->second] = sId;
std::wstring sOutputFile = m_pMain->m_sWebFontsDirectory + L"/" + sId;
NSFile::CFileBinary::Copy(strFontId, sOutputFile);
NSFile::CFileBinary oFileDst;
if (oFileDst.OpenFile(sOutputFile, true))
{
DWORD dwRead = (DWORD)(oFileDst.GetFileSize());
if (dwRead > 32)
dwRead = 32;
DWORD dwWorked = 0;
oFileDst.SeekFile(0);
oFileDst.ReadFile(encode, dwRead, dwWorked);
for (DWORD k = 0; k < dwRead; ++k)
encode[k] ^= correct16[k & 0x0F];
oFileDst.SeekFile(0);
oFileDst.WriteFile(encode, dwRead);
oFileDst.CloseFile();
}
}
NSStringUtils::CStringBuilder oWriterJS;
oWriterJS.WriteString(L"window[\"__fonts_files\"] = [\n");
for (size_t nIndex = 0; nIndex < nCountFiles; ++nIndex)
{
oWriterJS.WriteString(L"\"");
oWriterJS.WriteString(pMassFiles2[nIndex]);
if (nIndex != (nCountFiles - 1))
oWriterJS.WriteString(L"\",\n");
else
oWriterJS.WriteString(L"\"");
}
oWriterJS.WriteString(L"\n];\n\n");
delete [] pMassFiles2;
return oWriterJS.GetData();
}
void SaveAllFontsJS(NSFonts::IApplicationFonts* applicationFonts, int nVersion = -1)
{
if (CheckBreak()) return;
@ -390,6 +576,9 @@ public:
{
NSFonts::CFontInfo* pInfo = *i;
if (m_pMain->m_bIsGenerateThumbnailsEA)
CheckFontAlternateName(pInfo, m_mapAlternateEA);
if (mapFontFiles.find(pInfo->m_wsFontPath) == mapFontFiles.end())
{
mapFontFiles.insert(std::pair<std::wstring, LONG>(pInfo->m_wsFontPath, lFontFiles));
@ -503,6 +692,10 @@ public:
// теперь сортируем шрифты по имени ----------
size_t nCountFonts = arrFonts.size();
#if 1
std::sort(arrFonts.begin(), arrFonts.end(), g_sort_font_names);
#else
for (size_t i = 0; i < nCountFonts; ++i)
{
for (size_t j = i + 1; j < nCountFonts; ++j)
@ -515,6 +708,7 @@ public:
}
}
}
#endif
std::wstring strFontSelectionBin = L"";
// нужно ли скидывать font_selection.bin
@ -534,12 +728,23 @@ public:
// и самое главное. Здесь должен скидываться скрипт для работы со всеми шрифтами.
// все объекты, которые позволят не знать о существующих фонтах
std::wstring sAllFontsPath = m_pMain->m_sDirectory + L"/AllFonts.js";
if (!m_pMain->m_sAllFontsJSPath.empty())
sAllFontsPath = m_pMain->m_sAllFontsJSPath;
if (nVersion != -1)
sAllFontsPath += (L"." + std::to_wstring((int)(nVersion + 1)));
if (m_bIsCheckThumbnailsMode)
sAllFontsPath = L"";
// AllFonts.js для веба точно такой же, но с другими путями
std::wstring sFontFilesWeb = L"";
size_t nFontFilesWeb1 = 0;
size_t nFontFilesWeb2 = 0;
if (!m_pMain->m_sWebFontsDirectory.empty() && !m_pMain->m_sWebAllFontsJSPath.empty())
{
sFontFilesWeb = SaveWebFonts(mapFontFiles);
}
if (!sAllFontsPath.empty())
{
NSStringUtils::CStringBuilder oWriterJS;
@ -550,6 +755,8 @@ public:
oWriterJS.AddInt(nAllFontsVersion);
oWriterJS.WriteString(L";\n\n");
nFontFilesWeb1 = oWriterJS.GetCurSize();
// сначала все файлы
size_t nCountFiles = mapFontFiles.size();
if (nCountFiles == 0)
@ -579,6 +786,8 @@ public:
}
oWriterJS.WriteString(L"\n];\n\n");
nFontFilesWeb2 = oWriterJS.GetCurSize();
delete [] pMassFiles;
}
@ -915,7 +1124,16 @@ public:
oFile.CreateFileW(sAllFontsPath);
oFile.WriteStringUTF8(oWriterJS.GetData(), true);
oFile.CloseFile();
}
if (!sFontFilesWeb.empty())
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(m_pMain->m_sWebAllFontsJSPath);
std::wstring sWebAllFonts = oWriterJS.GetSubData(0, nFontFilesWeb1) + sFontFilesWeb + oWriterJS.GetSubData(nFontFilesWeb2);
oFile.WriteStringUTF8(sWebAllFonts, true);
oFile.CloseFile();
}
}
if (!strFontSelectionBin.empty())
{
@ -1013,32 +1231,56 @@ public:
void SaveThumbnails(NSFonts::IApplicationFonts* applicationFonts)
{
std::vector<std::wstring> arrFiles;
std::vector<double> arrScales;
std::vector<bool> arrEA;
bool bIsNeedCheck = false;
int nCountScales = m_pMain->m_arThumbnailsScales.size();
for (int iX = 0; iX < nCountScales; ++iX)
bool bIsEA = false;
while (true)
{
if (CheckBreak()) return;
for (int iX = 0; iX < nCountScales; ++iX)
{
if (CheckBreak()) return;
double dScale = m_pMain->m_arThumbnailsScales[iX];
double dScale = m_pMain->m_arThumbnailsScales[iX];
std::wstring strThumbnailPath = m_pMain->m_sDirectory + L"/fonts_thumbnail";
std::wstring strThumbnailPath = (m_pMain->m_sThumbnailsDirectory.empty() ?
m_pMain->m_sDirectory : m_pMain->m_sThumbnailsDirectory) + L"/fonts_thumbnail";
if (bIsEA)
strThumbnailPath += L"_ea";
int nScaleOut = (int)(dScale * 100 + 0.5);
int nScaleOut = (int)(dScale * 100 + 0.5);
if (nScaleOut == 100)
strThumbnailPath += L".png";
else if ((nScaleOut % 100) == 0)
strThumbnailPath += L"@" + std::to_wstring((int)(nScaleOut / 100)) + L"x.png";
else if ((nScaleOut % 10) == 0)
strThumbnailPath += L"@" + std::to_wstring((int)(nScaleOut / 100)) + L"." + std::to_wstring((int)((nScaleOut / 10) % 10)) + L"x.png";
else
strThumbnailPath += L"@" + std::to_wstring((int)(nScaleOut / 100)) + L"." + std::to_wstring((int)(nScaleOut % 100)) + L"x.png";
if (nScaleOut == 100)
strThumbnailPath += L".png";
else if ((nScaleOut % 100) == 0)
strThumbnailPath += L"@" + std::to_wstring((int)(nScaleOut / 100)) + L"x.png";
else if ((nScaleOut % 10) == 0)
strThumbnailPath += L"@" + std::to_wstring((int)(nScaleOut / 100)) + L"." + std::to_wstring((int)((nScaleOut / 10) % 10)) + L"x.png";
else
strThumbnailPath += L"@" + std::to_wstring((int)(nScaleOut / 100)) + L"." + std::to_wstring((int)(nScaleOut % 100)) + L"x.png";
arrFiles.push_back(strThumbnailPath);
arrScales.push_back(dScale);
arrFiles.push_back(strThumbnailPath);
arrEA.push_back(bIsEA);
if (!NSFile::CFileBinary::Exists(strThumbnailPath))
bIsNeedCheck = true;
bool bIsFileExist = NSFile::CFileBinary::Exists(strThumbnailPath);
if (bIsFileExist && m_pMain->m_bIsRemoveOldThumbnails)
{
NSFile::CFileBinary::Remove(strThumbnailPath);
bIsFileExist = false;
}
if (!bIsFileExist)
bIsNeedCheck = true;
}
if (bIsEA || !m_pMain->m_bIsGenerateThumbnailsEA)
break;
bIsEA = true;
}
if (!bIsNeedCheck)
@ -1059,11 +1301,12 @@ public:
PrepareForThumbnails(applicationFontsGood);
int nCountFonts = (int)m_arFonts.size();
nCountScales = arrScales.size();
for (int iX = 0; iX < nCountScales; ++iX)
{
if (CheckBreak()) return;
double dScale = m_pMain->m_arThumbnailsScales[iX];
double dScale = arrScales[iX];
std::wstring strThumbnailPath = arrFiles[iX];
if (NSFile::CFileBinary::Exists(strThumbnailPath))
@ -1100,6 +1343,8 @@ public:
pRenderer->put_Width(lWidthPix * 25.4 / dDpi);
pRenderer->put_Height(lHeightPix * 25.4 / dDpi);
bIsEA = arrEA[iX];
for (int index = 0; index < nCountFonts; ++index)
{
if (CheckBreak()) return;
@ -1118,6 +1363,15 @@ public:
std::wstring sFontName = font.m_sName;
if (bIsEA)
{
std::map<std::wstring, std::wstring>::const_iterator iter = m_mapAlternateEA.find(sFontName);
if (iter != m_mapAlternateEA.end())
{
sFontName = iter->second;
}
}
if (bIsSymbol)
{
NSFonts::CFontSelectFormat oSelectFormat;
@ -1136,13 +1390,11 @@ public:
// у нас режим "без квадратов"
// но есть шрифты, в которых символы есть, но нулевой ширины.
// только из-за таких шрифтов делаем заглушку
int nFontNameLen = (int)sFontName.length();
bool bIsExistEmpty = false;
for (int nC = 0; nC < nFontNameLen; nC++)
bool bIsExistEmpty = false;
for (NSStringExt::CStringUnicodeIterator oIterator(sFontName); oIterator.Check(); oIterator.Next())
{
int nCMapIndex = 0;
int nGid = pFile->SetCMapForCharCode(sFontName.at(nC), &nCMapIndex);
int nGid = pFile->SetCMapForCharCode(oIterator.Value(), &nCMapIndex);
if (0 < nGid && 0.0001 > pFile->GetCharWidth(nGid))
{
bIsExistEmpty = true;
@ -1203,6 +1455,9 @@ CApplicationFontsWorker::CApplicationFontsWorker()
m_bIsUseOpenType = true;
m_bIsUseAllVersions = false;
m_bSeparateThumbnails = false;
m_bIsGenerateThumbnailsEA = true;
m_bIsCleanDirectory = true;
m_bIsRemoveOldThumbnails = false;
m_arThumbnailsScales.clear();
m_arThumbnailsScales.push_back(1);
@ -1229,6 +1484,7 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
std::vector<std::string> strFonts;
std::wstring strFontsCheckPath = m_sDirectory + L"/fonts.log";
// читаем "старый" набор шрифтов
if (true)
{
NSFile::CFileBinary oFile;
@ -1281,6 +1537,7 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
#endif
}
// читаем "новый" набор шрифтов
NSFonts::IApplicationFonts* pApplicationF = NSFonts::NSApplication::Create();
std::vector<std::wstring> strFontsW_Cur;
@ -1292,14 +1549,18 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
NSDirectory::GetFiles2(*i, strFontsW_Cur, true);
}
// сортируем (нужно для сравнения для старого набора)
std::sort(strFontsW_Cur.begin(), strFontsW_Cur.end());
bool bIsEqual = true;
// если количество шрифтов в наборах не совпадают - то нужно перегенерировать
if (strFonts.size() != strFontsW_Cur.size())
bIsEqual = false;
if (bIsEqual)
{
// если наборы не совпадают - то нужно перегенерировать
int nCount = (int)strFonts.size();
for (int i = 0; i < nCount; ++i)
{
@ -1313,22 +1574,28 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
if (bIsEqual)
{
// наборы совпадают - скинут ли font_selection.bin
// если нет - нужно перегенерировать
if (!NSFile::CFileBinary::Exists(strFontsSelectionBin))
bIsEqual = false;
}
if (!bIsEqual)
{
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(m_sDirectory, false);
for (std::vector<std::wstring>::iterator fileIter = arFiles.begin(); fileIter != arFiles.end(); fileIter++)
if (m_bIsCleanDirectory)
{
NSFile::CFileBinary::Remove(*fileIter);
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(m_sDirectory, false);
for (std::vector<std::wstring>::iterator fileIter = arFiles.begin(); fileIter != arFiles.end(); fileIter++)
{
NSFile::CFileBinary::Remove(*fileIter);
}
}
int nFlag = 3;
if (!m_bIsUseOpenType)
nFlag = 2;
// формируем новый набор шрифтов
NSStringUtils::CStringBuilder oFontsLog;
#ifdef ONLYOFFICE_FONTS_VERSION_
oFontsLog.WriteString(L"ONLYOFFICE_FONTS_VERSION_");
@ -1342,13 +1609,17 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
oFontsLog.WriteString(L"\n");
}
// читаем шрифты
pApplicationF->InitializeFromArrayFiles(strFontsW_Cur, nFlag);
// скидываем все
m_pInternal->SaveAllFontsJS(pApplicationF, -1);
// поддержка старой версии AllFonts.js
if (m_bIsUseAllVersions)
m_pInternal->SaveAllFontsJS(pApplicationF, 0);
// скидываем новый набор шрифтов
if (!m_pInternal->CheckBreak())
NSFile::CFileBinary::SaveToFile(strFontsCheckPath, oFontsLog.GetData());
}
@ -1358,15 +1629,20 @@ NSFonts::IApplicationFonts* CApplicationFontsWorker::Check()
if (!m_pInternal->m_pBreaker || m_pInternal->m_pBreaker->IsFontsWorkerRunned())
{
// никаких прерываний не было
pApplicationF = NSFonts::NSApplication::Create();
pApplicationF->InitializeFromFolder(m_sDirectory);
}
else
{
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(m_sDirectory, false);
for (std::vector<std::wstring>::iterator fileIter = arFiles.begin(); fileIter != arFiles.end(); fileIter++)
// прервали - подчищаем рабочую директорию
if (m_bIsCleanDirectory)
{
NSFile::CFileBinary::Remove(*fileIter);
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(m_sDirectory, false);
for (std::vector<std::wstring>::iterator fileIter = arFiles.begin(); fileIter != arFiles.end(); fileIter++)
{
NSFile::CFileBinary::Remove(*fileIter);
}
}
}

View File

@ -62,10 +62,24 @@ public:
// нужны ли табнейлы
bool m_bIsNeedThumbnails;
// какой-то табнейл уже есть - нудно ли все равно удалить и перегенерировать?
bool m_bIsRemoveOldThumbnails;
// генерим табнейлы отдельно
bool m_bSeparateThumbnails;
// какие масштабы нудны для табнейлов
// какие масштабы нужны для табнейлов
std::vector<double> m_arThumbnailsScales;
bool m_bIsGenerateThumbnailsEA;
// WEB версия ----
std::wstring m_sThumbnailsDirectory;
std::wstring m_sAllFontsJSPath;
std::wstring m_sWebAllFontsJSPath;
std::wstring m_sWebFontsDirectory;
// ---------------
bool m_bIsCleanDirectory;
private:
CApplicationFontsWorker_private* m_pInternal;

View File

@ -337,7 +337,7 @@ public:
std::wstring sFile = *i;
std::wstring sContentType = L"application/xml";
std::map<std::wstring, std::wstring>::iterator _find = m_content_types.find(sFile);
std::map<std::wstring, std::wstring>::iterator _find = m_content_types.find(L"/" + sFile);
if (_find != m_content_types.end())
{
sContentType = _find->second;

View File

@ -1380,7 +1380,7 @@ private:
if(nSharp == std::wstring::npos)
oXml->WriteString(NSFile::GetFileName(sRef));
else
oXml->WriteString(sRef.c_str() + nSharp + 1);
oXml->WriteEncodeXmlString(sRef.c_str() + nSharp + 1);
}
// Внешняя ссылка
else

View File

@ -14,9 +14,9 @@ SaaS version: [https://www.onlyoffice.com/cloud-office.aspx](https://www.onlyoff
## User Feedback and Support
If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][3].
If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum to find answers to your questions: [forum.onlyoffice.com][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][3].
[1]: http://dev.onlyoffice.org
[1]: https://forum.onlyoffice.com
[2]: https://github.com/ONLYOFFICE/DocumentServer
[3]: http://stackoverflow.com/questions/tagged/onlyoffice
[4]: https://github.com/ONLYOFFICE/DesktopEditors

View File

@ -74,7 +74,10 @@ namespace XPS
std::wstring wsAttr;
ReadAttribute(oReader, L"Type", wsAttr);
if (L"http://schemas.microsoft.com/xps/2005/06/fixedrepresentation" == wsAttr)
// http://schemas.microsoft.com/xps/2005/06/fixedrepresentation
// http://schemas.openxps.org/oxps/v1.0/fixedrepresentation
if (wsAttr.find(L"fixedrepresentation") != std::wstring::npos &&
((wsAttr.find(L"/xps/") != std::wstring::npos) || (wsAttr.find(L"/oxps/") != std::wstring::npos)))
{
ReadAttribute(oReader, L"Target", wsTargetFile);
break;