Skip to content

Commit d83cbfc

Browse files
Merge remote-tracking branch 'origin/hotfix/v8.3.2' into release/v9.0.0
2 parents e1274da + 3723ba0 commit d83cbfc

File tree

12 files changed

+89
-16
lines changed

12 files changed

+89
-16
lines changed

DesktopEditor/agg-2.4/include/agg_pixfmt_rgba.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ namespace agg
207207
}
208208

209209
p[Order::A] = (value_type)((alpha + a) - ((alpha * a + base_mask) >> base_shift));
210-
p[Order::R] = (value_type)((alpha * cr + a * r - ((a * r * alpha + base_mask) >> base_shift)) / p[Order::A]);
211-
p[Order::G] = (value_type)((alpha * cg + a * g - ((a * g * alpha + base_mask) >> base_shift)) / p[Order::A]);
212-
p[Order::B] = (value_type)((alpha * cb + a * b - ((a * b * alpha + base_mask) >> base_shift)) / p[Order::A]);
210+
if (r != cr) p[Order::R] = (value_type)((alpha * cr + a * r - ((a * r * alpha + base_mask) >> base_shift)) / p[Order::A]);
211+
if (g != cg) p[Order::G] = (value_type)((alpha * cg + a * g - ((a * g * alpha + base_mask) >> base_shift)) / p[Order::A]);
212+
if (b != cb) p[Order::B] = (value_type)((alpha * cb + a * b - ((a * b * alpha + base_mask) >> base_shift)) / p[Order::A]);
213213
}
214214

215215
static AGG_INLINE void blend_pix_subpix(value_type* p,

DesktopEditor/doctrenderer/addon/docbuilder_addon.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#define DOC_BUILDER_ADDON_PRIVATE
3434

3535
#include <string>
36+
#include "../docbuilder.h"
3637

3738
namespace NSDoctRenderer
3839
{
@@ -46,11 +47,11 @@ namespace NSDoctRenderer
4647
m_sWorkDirectory = sWorkDir;
4748
}
4849
public:
49-
std::wstring GetX2tSaveAddon()
50+
std::wstring GetX2tSaveAddon(NSDoctRenderer::CDocBuilder* builder, const int& filetype)
5051
{
5152
return L"";
5253
}
53-
int GetX2tPreSaveError()
54+
int GetX2tPreSaveError(NSDoctRenderer::CDocBuilder* builder, const int& filetype)
5455
{
5556
return 0;
5657
}

DesktopEditor/doctrenderer/app_builder/main.cpp

+36
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "./../common_deploy.h"
3434
#include "../docbuilder.h"
3535
#include "../../common/File.h"
36+
#include "../../common/SystemUtils.h"
3637

3738
#ifdef LINUX
3839
#include "../../../DesktopEditor/common/File.h"
@@ -78,6 +79,13 @@ void parse_args(NSDoctRenderer::CDocBuilder* builder, int argc, char *argv[])
7879
}
7980
}
8081

82+
bool CheckLicense(const std::wstring& sSrc, const std::wstring& sDst)
83+
{
84+
NSFile::CFileBinary::Remove(sDst);
85+
NSFile::CFileBinary::Copy(sSrc, sDst);
86+
return NSFile::CFileBinary::Exists(sDst);
87+
}
88+
8189
#ifdef WIN32
8290
int wmain(int argc, wchar_t *argv[])
8391
#else
@@ -89,6 +97,7 @@ int main(int argc, char *argv[])
8997

9098
bool bIsHelp = false;
9199
bool bIsFonts = false;
100+
bool bIsLicense = false;
92101
for (int i = 0; i < argc; ++i)
93102
{
94103
#ifdef WIN32
@@ -121,6 +130,33 @@ int main(int argc, char *argv[])
121130
{
122131
bIsFonts = true;
123132
}
133+
else if (sParam == "-register")
134+
{
135+
bIsLicense = true;
136+
}
137+
else
138+
{
139+
if (bIsLicense)
140+
{
141+
std::wstring sLicensePathSrc = UTF8_TO_U(sParam);
142+
if (!NSFile::CFileBinary::Exists(sLicensePathSrc))
143+
return 1;
144+
145+
std::wstring sLicensePath = NSSystemUtils::GetEnvVariable(L"ONLYOFFICE_BUILDER_LICENSE");
146+
if (CheckLicense(sLicensePathSrc, sLicensePath))
147+
return 0;
148+
149+
sLicensePath = NSFile::GetProcessDirectory() + L"/license.xml";
150+
if (CheckLicense(sLicensePathSrc, sLicensePath))
151+
return 0;
152+
153+
sLicensePath = NSSystemUtils::GetAppDataDir() + L"/docbuilder/license.xml";
154+
if (CheckLicense(sLicensePathSrc, sLicensePath))
155+
return 0;
156+
157+
return 1;
158+
}
159+
}
124160
}
125161

126162
if (bIsFonts)

DesktopEditor/doctrenderer/docbuilder.h

+7
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,13 @@ namespace NSDoctRenderer
475475
*/
476476
void SetPropertyW(const wchar_t* param, const wchar_t* value);
477477

478+
/**
479+
* GetProperty method.
480+
* @param param The parameter name in the Unicode format, the value is always --argument.
481+
* @return int value for property
482+
*/
483+
int GetPropertyInt(const wchar_t* param);
484+
478485
/**
479486
* Writes data to the log file. It is used for logs in JS code.
480487
* @param path The path to the file where all the logs will be written.

DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import platform
44
import atexit
5+
import subprocess
56

67
OBJECT_HANDLE = ctypes.c_void_p
78
STRING_HANDLE = ctypes.c_void_p
@@ -608,8 +609,14 @@ class Graphics:
608609
PNG = _IMAGE_MASK + 0x0005
609610
BMP = _IMAGE_MASK + 0x0008
610611

611-
builder_path = os.path.dirname(os.path.realpath(__file__))
612+
builder_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib')
612613
_loadLibrary(builder_path)
613614
CDocBuilder.Initialize(builder_path)
614615

616+
def registerLibrary(license_path):
617+
docbuilder_bin = os.path.dirname(os.path.realpath(__file__)) + "/lib/docbuilder"
618+
if ("windows" == platform.system().lower()):
619+
docbuilder_bin += ".exe"
620+
return subprocess.call([docbuilder_bin, "-register", license_path], stderr=subprocess.STDOUT, shell=True)
621+
615622
atexit.register(CDocBuilder.Dispose)

DesktopEditor/doctrenderer/docbuilder_p.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,15 @@ namespace NSDoctRenderer
15961596
return this->SetProperty(sA.c_str(), value);
15971597
}
15981598

1599+
int CDocBuilder::GetPropertyInt(const wchar_t* param)
1600+
{
1601+
std::wstring sParam = std::wstring(param);
1602+
std::string sParamA = U_TO_UTF8(sParam);
1603+
if ("--save-use-only-names" == sParamA)
1604+
return m_pInternal->m_bIsServerSafeVersion ? 1 : 0;
1605+
return -1;
1606+
}
1607+
15991608
void CDocBuilder::Initialize(const wchar_t* directory)
16001609
{
16011610
std::wstring sDirectory = L"";

DesktopEditor/doctrenderer/docbuilder_p.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ namespace NSDoctRenderer
10031003

10041004
CDocBuilderAddon oSaveAddon(m_sX2tPath);
10051005

1006-
int nPreSaveError = oSaveAddon.GetX2tPreSaveError();
1006+
int nPreSaveError = oSaveAddon.GetX2tPreSaveError(m_pParent, m_nFileType);
10071007
if (0 != nPreSaveError)
10081008
return nPreSaveError;
10091009

@@ -1090,7 +1090,7 @@ namespace NSDoctRenderer
10901090
if (!sOptions.empty())
10911091
oBuilder.WriteString(UTF8_TO_U(sOptions));
10921092

1093-
oBuilder.WriteString(oSaveAddon.GetX2tSaveAddon());
1093+
oBuilder.WriteString(oSaveAddon.GetX2tSaveAddon(m_pParent, m_nFileType));
10941094

10951095
oBuilder.WriteString(L"</TaskQueueDataConvert>");
10961096

DesktopEditor/fontengine/TextShaper.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,13 @@ namespace NSShaper
693693
g_userfeatures_init = true;
694694
}
695695

696+
// Turn on ligatures on arabic script
697+
if (nScript == HB_SCRIPT_ARABIC ||
698+
nScript == HB_SCRIPT_SYRIAC)
699+
{
700+
nFeatures |= 1;
701+
}
702+
696703
// font
697704
hb_font_t* pFont;
698705
if (NULL == font)

DesktopEditor/fontengine/js/cpp/text.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,13 @@ WASM_EXPORT unsigned char* ASC_HB_ShapeText(FT_Face pFace, hb_font_t* pFont, cha
594594
g_userfeatures_init = true;
595595
}
596596

597+
// Turn on ligatures on arabic script
598+
if (nScript == HB_SCRIPT_ARABIC ||
599+
nScript == HB_SCRIPT_SYRIAC)
600+
{
601+
nFeatures |= 1;
602+
}
603+
597604
// font
598605
if (NULL == pFont)
599606
{

OOXML/XlsxFormat/Worksheets/SheetData.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -2912,6 +2912,8 @@ namespace OOX
29122912
XLSB::XLWideString str;
29132913
if(m_oValue.IsInit())
29142914
str = m_oValue->m_sText;
2915+
else
2916+
str = L"";
29152917
*CellRecord << str;
29162918
}
29172919
else

PdfFile/PdfEditor.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,7 @@ bool CPdfEditor::EditPage(int nPageIndex, bool bSet, bool bActualPos)
963963
{
964964
Object oRes;
965965
char* chKey2 = oTemp.dictGetKey(nIndex);
966-
if (strcmp("Font", chKey2) == 0 || strcmp("ExtGState", chKey2) == 0 || strcmp("XObject", chKey2) == 0 || strcmp("Shading", chKey2) == 0 || strcmp("Pattern", chKey2) == 0)
967-
oTemp.dictGetVal(nIndex, &oRes);
968-
else
969-
oTemp.dictGetValNF(nIndex, &oRes);
966+
oTemp.dictGetVal(nIndex, &oRes);
970967
DictToCDictObject(&oRes, pDict, false, chKey2);
971968
oRes.free();
972969
}

PdfFile/test/test.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ TEST_F(CPdfFileTest, EditPdf)
372372

373373
TEST_F(CPdfFileTest, EditPdfFromBase64)
374374
{
375-
//GTEST_SKIP();
375+
GTEST_SKIP();
376376

377377
NSFonts::NSApplicationFontStream::SetGlobalMemoryStorage(NSFonts::NSApplicationFontStream::CreateDefaultGlobalMemoryStorage());
378378

@@ -417,14 +417,14 @@ TEST_F(CPdfFileTest, EditPdfFromBase64)
417417

418418
TEST_F(CPdfFileTest, EditPdfFromBin)
419419
{
420-
GTEST_SKIP();
420+
// GTEST_SKIP();
421421

422422
LoadFromFile();
423423
ASSERT_TRUE(pdfFile->EditPdf(wsDstFile));
424424

425425
// чтение бинарника
426426
NSFile::CFileBinary oFile;
427-
ASSERT_TRUE(oFile.OpenFile(NSFile::GetProcessDirectory() + L"/changes0.json"));
427+
ASSERT_TRUE(oFile.OpenFile(NSFile::GetProcessDirectory() + L"/changes.bin"));
428428

429429
DWORD dwFileSize = oFile.GetFileSize();
430430
BYTE* pFileContent = new BYTE[dwFileSize];
@@ -440,7 +440,7 @@ TEST_F(CPdfFileTest, EditPdfFromBin)
440440

441441
CConvertFromBinParams* pParams = new CConvertFromBinParams();
442442
pParams->m_sMediaDirectory = NSFile::GetProcessDirectory();
443-
pdfFile->AddToPdfFromBinary(pFileContent, dwReaded, pParams);
443+
pdfFile->AddToPdfFromBinary(pFileContent + 4, dwReaded - 4, pParams);
444444

445445
RELEASEOBJECT(pParams);
446446
RELEASEARRAYOBJECTS(pFileContent);

0 commit comments

Comments
 (0)