Skip to content

Commit

Permalink
For bug 65583
Browse files Browse the repository at this point in the history
  • Loading branch information
K0R0L committed Feb 18, 2024
1 parent c0cc683 commit 1c09215
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
19 changes: 11 additions & 8 deletions common/Native/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,33 +249,36 @@ if (window.native && window.native.GetDevicePixelRatio)
window.devicePixelRatio = window.native.GetDevicePixelRatio();

// OPEN
function NativeOpenFileData(data, version, xlsx_file_path, options)
function NativeCreateApi(options)
{
window.NATIVE_DOCUMENT_TYPE = window.native.GetEditorType();
Api = null;

if (options && options["printOptions"] && options["printOptions"]["retina"])
AscBrowser.isRetina = true;
Api = null;

var configApi = {};
if (options && undefined !== options["translate"])
configApi["translate"] = options["translate"];

if (window.NATIVE_DOCUMENT_TYPE === "presentation" || window.NATIVE_DOCUMENT_TYPE === "document")
{
Api = new window["Asc"]["asc_docs_api"](configApi);
Api = new window["Asc"]["asc_docs_api"](configApi);
if (options && options["documentLayout"] && undefined !== options["documentLayout"]["openedAt"])
Api.setOpenedAt(options["documentLayout"]["openedAt"]);
}
else
{
Api = new window["Asc"]["spreadsheet_api"](configApi);
Api = new window["Asc"]["spreadsheet_api"](configApi);
}

if (options && undefined !== options["locale"])
Api.asc_setLocale(options["locale"]);
}

if (window.NATIVE_DOCUMENT_TYPE === "presentation" || window.NATIVE_DOCUMENT_TYPE === "document")
function NativeOpenFileData(data, version, xlsx_file_path, options)
{
NativeCreateApi(options);

if (window.NATIVE_DOCUMENT_TYPE === "presentation" ||
window.NATIVE_DOCUMENT_TYPE === "document")
{
Api.asc_nativeOpenFile(data, version);
}
Expand Down
11 changes: 10 additions & 1 deletion common/Native/native_graphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,16 @@ CNativeGraphics.prototype =
IsPdfRenderer : function()
{
return this.RENDERER_PDF_FLAG;
}
},

CreateLayer : function(opacity)
{
this.Native["CreateLayer"](opacity);
},
BlendLayer : function()
{
this.Native["BlendLayer"]();
}
};

AscCommon.CNativeGraphics = CNativeGraphics;
9 changes: 9 additions & 0 deletions common/apiCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4811,6 +4811,8 @@
this.zoom = 1;
this.calculatezoom = -1;

this.isNativeGlobalAlpha = false;

this.contentObjects = null;

this.CheckParams = function()
Expand Down Expand Up @@ -5124,6 +5126,9 @@
g.create(window["native"], _need_pix_width, _need_pix_height, _need_pix_width / AscCommon.g_dKoef_mm_to_pix, _need_pix_height / AscCommon.g_dKoef_mm_to_pix);
g.CoordTransformOffset(-_bounds_cheker.Bounds.min_x, -_bounds_cheker.Bounds.min_y);
g.transform(1, 0, 0, 1, 0, 0);

if (this.isNativeGlobalAlpha)
g.CreateLayer(this.transparent);
}
else
{
Expand All @@ -5139,7 +5144,11 @@
oShape.draw(g, 0);

if (window["NATIVE_EDITOR_ENJINE"])
{
if (this.isNativeGlobalAlpha)
g.BlendLayer();
this.imageBase64 = g.toDataURL("image/png");
}

AscCommon.IsShapeToImageConverter = false;

Expand Down
19 changes: 19 additions & 0 deletions word/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12838,6 +12838,25 @@ background-repeat: no-repeat;\
return _renderer.Memory.data;
};

window["asc_docs_api"].prototype["asc_nativeGetWatermark"] = function(options)
{
if (options && options["watermark"])
{
if (!this.User)
{
this.User = new AscCommon.asc_CUser();
this.User.setId("TM");
this.User.setUserName("native");
}

this.watermarkDraw = new AscCommon.CWatermarkOnDraw(options["watermark"], this);
this.watermarkDraw.isNativeGlobalAlpha = true;
this.watermarkDraw.generateNative();
return this.watermarkDraw.imageBase64;
}
return "";
};

// cool api (autotests)
window["asc_docs_api"].prototype["Add_Text"] = function(_text)
{
Expand Down

0 comments on commit 1c09215

Please sign in to comment.