Compare commits

..

12 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
11 changed files with 142 additions and 103 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

@ -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

@ -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

@ -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

@ -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