mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 13:24:03 +08:00
Merge branch 'release/v9.4.0' into develop
This commit is contained in:
@ -91,7 +91,7 @@ CPdfReader::CPdfReader(NSFonts::IApplicationFonts* pAppFonts)
|
||||
globalParams->setErrQuiet(gTrue);
|
||||
#endif
|
||||
|
||||
// Создаем менеджер шрифтов с собственным кэшем
|
||||
// Create font manager with its own cache
|
||||
m_pFontManager = InitFontManager(pAppFonts);
|
||||
#ifndef BUILDING_WASM_MODULE
|
||||
globalParams->setupBaseFonts(NULL);
|
||||
@ -196,8 +196,8 @@ bool CPdfReader::LoadFromMemory(NSFonts::IApplicationFonts* pAppFonts, BYTE* dat
|
||||
m_eError = errNone;
|
||||
m_nFileLength = length;
|
||||
|
||||
// Все LoadFromMemory копируют память в свои классы
|
||||
// Кроме того MemStream использует malloc/free память
|
||||
// All LoadFromMemory copy memory into their classes
|
||||
// Also MemStream uses malloc/free memory
|
||||
BYTE* pCopy = (BYTE*)malloc(length);
|
||||
memcpy(pCopy, data, length);
|
||||
data = pCopy;
|
||||
@ -474,8 +474,8 @@ bool CPdfReader::MergePages(BYTE* pData, DWORD nLength, const wchar_t* wsPasswor
|
||||
|
||||
Object obj;
|
||||
obj.initNull();
|
||||
// будет освобожден в деструкторе PDFDoc
|
||||
// Время его жизни > copy и makeSubStream из MemStream
|
||||
// will be freed in PDFDoc destructor
|
||||
// Its lifetime > copy and makeSubStream from MemStream
|
||||
BaseStream *str = new MemStream((char*)pData, 0, nLength, &obj, gTrue);
|
||||
CPdfReaderContext* pContext = new CPdfReaderContext();
|
||||
pContext->m_pDocument = new PDFDoc(str, owner_pswd, user_pswd);
|
||||
@ -494,7 +494,7 @@ bool CPdfReader::MergePages(BYTE* pData, DWORD nLength, const wchar_t* wsPasswor
|
||||
m_eError = pDoc ? pDoc->getErrorCode() : errMemory;
|
||||
if (!pDoc || !pDoc->isOk())
|
||||
{
|
||||
// pData освобождается
|
||||
// pData is freed
|
||||
delete pContext;
|
||||
m_vPDFContext.pop_back();
|
||||
return false;
|
||||
@ -518,7 +518,7 @@ bool CPdfReader::MergePages(const std::wstring& wsFile, const wchar_t* wsPasswor
|
||||
user_pswd = NSStrings::CreateString(wsPassword);
|
||||
}
|
||||
|
||||
// конвертим путь в utf8 - под виндой они сконвертят в юникод, а на остальных - так и надо
|
||||
// convert path to utf8 - on Windows they will convert to unicode, on others - that's what we need
|
||||
std::string sPathUtf8 = U_TO_UTF8(wsFile);
|
||||
|
||||
CPdfReaderContext* pContext = new CPdfReaderContext();
|
||||
@ -680,7 +680,7 @@ void CPdfReader::DrawPageOnRenderer(IRenderer* pRenderer, int _nPageIndex, bool*
|
||||
LONG lRendererType = 0;
|
||||
pRenderer->get_Type(&lRendererType);
|
||||
if (c_nDocxWriter == lRendererType)
|
||||
return; // Без отрисовки Redact при ScanPage
|
||||
return; // No Redact rendering during ScanPage
|
||||
|
||||
Page* pPage = pDoc->getCatalog()->getPage(nPageIndex);
|
||||
PDFRectangle* cropBox = pPage->getCropBox();
|
||||
@ -1104,7 +1104,7 @@ BYTE* CPdfReader::GetStructure()
|
||||
oRes.AddInt(nStartPage);
|
||||
oRes.AddInt(1);
|
||||
oRes.AddDouble(0);
|
||||
oRes.WriteString(std::to_string(iPDF)); // TODO Писать имя файла как Adobe?
|
||||
oRes.WriteString(std::to_string(iPDF)); // TODO Write filename like Adobe?
|
||||
}
|
||||
|
||||
for (int i = 0, num = pList->getLength(); i < num; i++)
|
||||
@ -1124,7 +1124,7 @@ BYTE* CPdfReader::GetStructure()
|
||||
}
|
||||
BYTE* CPdfReader::GetLinks(int _nPageIndex)
|
||||
{
|
||||
// TODO Links должны стать частью Annots
|
||||
// TODO Links should become part of Annots
|
||||
PDFDoc* pDoc = NULL;
|
||||
int nPageIndex = GetPageIndex(_nPageIndex, &pDoc);
|
||||
if (nPageIndex < 0 || !pDoc || !pDoc->getCatalog())
|
||||
@ -1136,7 +1136,7 @@ BYTE* CPdfReader::GetLinks(int _nPageIndex)
|
||||
|
||||
NSWasm::CPageLink oLinks;
|
||||
|
||||
// Гиперссылка
|
||||
// Hyperlink
|
||||
/*
|
||||
Links* pLinks = pDoc->getLinks(nPageIndex);
|
||||
if (pLinks)
|
||||
@ -1222,7 +1222,7 @@ BYTE* CPdfReader::GetLinks(int _nPageIndex)
|
||||
nRotate = -pDoc->getPageRotate(nPageIndex);
|
||||
#endif
|
||||
|
||||
// Текст-ссылка
|
||||
// Text-link
|
||||
TextOutputControl textOutControl;
|
||||
textOutControl.mode = textOutReadingOrder;
|
||||
TextOutputDev* pTextOut = new TextOutputDev(NULL, &textOutControl, gFalse);
|
||||
@ -1407,7 +1407,7 @@ BYTE* CPdfReader::VerifySign(const std::wstring& sFile, ICertificate* pCertifica
|
||||
int nByteOffset = 0;
|
||||
for (int j = 0; j < arrByteOffset.size(); ++j)
|
||||
{
|
||||
// TODO проверка длины файла и ByteRange
|
||||
// TODO check file length and ByteRange
|
||||
memcpy(pDataForVerify + nByteOffset, pFileData + arrByteOffset[j], arrByteLength[j]);
|
||||
nByteOffset += arrByteLength[j];
|
||||
}
|
||||
@ -1425,7 +1425,7 @@ BYTE* CPdfReader::VerifySign(const std::wstring& sFile, ICertificate* pCertifica
|
||||
RELEASEARRAYOBJECTS(pDataForVerify);
|
||||
oObj1.free();
|
||||
|
||||
// Номер аннотации для сопоставления с AP
|
||||
// Annotation number for matching with AP
|
||||
oRes.AddInt(i);
|
||||
oRes.AddInt(nRes);
|
||||
}
|
||||
@ -1524,7 +1524,7 @@ BYTE* CPdfReader::GetButtonIcon(int nBackgroundColor, int _nPageIndex, bool bBas
|
||||
Object oStr, oXObject, oIm;;
|
||||
if (oMK.dictLookup(sMKName.c_str(), &oStr)->isStream())
|
||||
{
|
||||
// Получение единственного XObject из Resources, если возможно
|
||||
// Get single XObject from Resources, if possible
|
||||
Object oResources;
|
||||
if (!oStr.streamGetDict()->lookup("Resources", &oResources)->isDict() || !oResources.dictLookup("XObject", &oXObject)->isDict() ||
|
||||
oXObject.dictGetLength() != 1 || !oXObject.dictGetVal(0, &oIm)->isStream())
|
||||
@ -1536,7 +1536,7 @@ BYTE* CPdfReader::GetButtonIcon(int nBackgroundColor, int _nPageIndex, bool bBas
|
||||
}
|
||||
else if ((oStr.free(), true) && oMK.dictLookup("I", &oStr)->isNull() && oAP.isDict() && (oStr.free(), true) && oAP.dictLookup(arrAPName[j], &oStr)->isStream())
|
||||
{
|
||||
// Получение единственного XObject из Resources, если возможно
|
||||
// Get single XObject from Resources, if possible
|
||||
Object oResources;
|
||||
if (!oStr.streamGetDict()->lookup("Resources", &oResources)->isDict() || !oResources.dictLookup("XObject", &oXObject)->isDict() ||
|
||||
oXObject.dictGetLength() != 1 || !oXObject.dictGetVal(0, &oIm)->isStream())
|
||||
@ -1571,11 +1571,11 @@ BYTE* CPdfReader::GetButtonIcon(int nBackgroundColor, int _nPageIndex, bool bBas
|
||||
{
|
||||
Object oFieldRef;
|
||||
pField->getFieldRef(&oFieldRef);
|
||||
// Номер аннотации для сопоставления с AP
|
||||
// Annotation number for matching with AP
|
||||
oRes.AddInt(oFieldRef.getRefNum() + nStartRefID);
|
||||
oFieldRef.free();
|
||||
|
||||
// Количество иконок 1-3
|
||||
// Number of icons 1-3
|
||||
nMKPos = oRes.GetSize();
|
||||
oRes.AddInt(nMKLength);
|
||||
bFirst = false;
|
||||
@ -2030,7 +2030,7 @@ int GetPageAnnots(PDFDoc* pdfDoc, NSFonts::IFontManager* pFontManager, PdfReader
|
||||
// {
|
||||
// pAnnot = new PdfReader::CAnnotPopup(pdfDoc, &oAnnotRef, nPageIndex, nStartRefID);
|
||||
// }
|
||||
// TODO Все аннотации
|
||||
// TODO All annotations
|
||||
oAnnotRef.free();
|
||||
|
||||
if (pAnnot)
|
||||
|
||||
Reference in New Issue
Block a user