Commit 7d0c0af5 authored by Sergey Luzyanin's avatar Sergey Luzyanin

Add Watermark

parent c312b994
......@@ -2889,6 +2889,18 @@ Workbook.prototype.DeserializeHistory = function(aChanges, fCallback){
for (var k = 0, length3 = item.oData.elem.length; k < length3; ++k)
oFontMap[item.oData.elem[k]] = 1;
}
if(g_oUndoRedoWorkbook == item.oClass && historyitem_Common_AddWatermark == item.nActionType)
{
var oWsModel = window["Asc"]["editor"].wbModel.aWorksheets[0];
if(oWsModel)
{
var objectRender = new DrawingObjects();
var oNewDrawing = objectRender.createDrawingObject(c_oAscCellAnchorType.cellanchorAbsolute);
var oImage = DrawingObjectsController.prototype.createWatermarkImage();
oNewDrawing.graphicObject = oImage;
oWsModel.Drawings.push(oNewDrawing);
}
}
aUndoRedoElems.push(item);
}
......
......@@ -110,6 +110,33 @@ function CDistance(L, T, R, B)
this.B = B;
}
function HistoryInterface()
{
this.m_aChanges = [];
this.m_oBinaryWriter = new CMemory();
}
HistoryInterface.prototype.Add = function(Class, Data)
{
var Binary_Pos = this.m_oBinaryWriter.GetCurPosition();
this.m_oBinaryWriter.WriteString2(Class.Get_Id());
Class.Save_Changes( Data, this.m_oBinaryWriter );
var Binary_Len = this.m_oBinaryWriter.GetCurPosition() - Binary_Pos;
this.m_aChanges.push(Binary_Len + ";" + this.m_oBinaryWriter.GetBase64Memory2(Binary_Pos, Binary_Len));
};
HistoryInterface.prototype.GetResultChanges = function()
{
return this.m_aChanges;
};
HistoryInterface.prototype.Is_On = function()
{
return true;
};HistoryInterface.prototype.Is_On = function()
{
return true;
};
function checkObjectInArray(aObjects, oObject)
{
var i;
......@@ -801,6 +828,13 @@ DrawingObjectsController.prototype =
{
return this.getLeftTopSelectedFromArray(this.getDrawingObjects(), pageIndex);
},
createWatermarkImage: function(sImageUrl)
{
return ExecuteNoHistory(function(){
return this.createImage(sImageUrl, 0, 0, 45.6, 101.6);
}, this, []);
},
getFromTargetTextObjectContextMenuPosition: function(oTargetTextObject, pageIndex)
{
......
......@@ -496,6 +496,8 @@ var historyitem_ClrScheme_AddClr = 2462;
var historyitem_ClrScheme_SetName = 2463;
var historyitem_ClrMap_SetClr = 2464;
var historyitem_Common_AddWatermark = 100390;
var historyitem_ExtraClrScheme_SetClrScheme = 2465;
var historyitem_ExtraClrScheme_SetClrMap = 2466;
......
......@@ -4705,6 +4705,18 @@ CPresentation.prototype =
switch ( Type )
{
case historyitem_Common_AddWatermark:
{
if(this.Slides[0])
{
var sUrl = Reader.GetString2();
var oDrawing = this.Slides[0].graphicObjects.createWatermarkImage(sUrl);
oDrawing.spPr.xfrm.offX = (this.Width - oDrawing.spPr.extX)/2;
oDrawing.spPr.xfrm.offY = (this.Height - oDrawing.spPr.extY)/2;
this.Slides[0].cSld.spTree.push(oDrawing);
}
break;
}
case historyitem_Presentation_SetShowPr:
{
if(Reader.GetBool()){
......
......@@ -14014,6 +14014,13 @@ CDocument.prototype =
switch ( Type )
{
case historyitem_Common_AddWatermark:
{
var sUrl = Reader.GetString2();
var oParaDrawing = this.DrawingObjects.getTrialImage(sUrl);
break;
}
case historyitem_Document_AddItem:
{
// Long : Количество элементов
......
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"use strict";
function CBoundsRectForMath(oDrawing)
......@@ -317,6 +317,48 @@ CGraphicObjects.prototype =
return;
},
createWatermarkImage: DrawingObjectsController.prototype.createWatermarkImage,
getTrialImage: function(sImageUrl)
{
return ExecuteNoHistory(function(){
var oParaDrawing = new ParaDrawing();
oParaDrawing.Set_RelativeHeight(251659264);
oParaDrawing.Set_PositionH(c_oAscRelativeFromH.Page, true, c_oAscAlignH.Center, undefined);
oParaDrawing.Set_PositionV(c_oAscRelativeFromV.Page, true, c_oAscAlignV.Center, undefined);
oParaDrawing.Set_WrappingType(WRAPPING_TYPE_NONE);
oParaDrawing.Set_BehindDoc( false );
oParaDrawing.Set_Distance( 3.2, 0, 3.2, 0 );
var oShape = this.createWatermarkImage(sImageUrl);
oShape.setParent(oParaDrawing);
oParaDrawing.Set_GraphicObject(oShape);
return oParaDrawing;
}, this, []);
},
getTrialChanges: function()
{
var oOldHistory = History;
var oInterfaceHistory = new HistoryInterface();
History = oInterfaceHistory;
var oParaDrawing = new ParaDrawing();
oParaDrawing.Set_RelativeHeight(251659264);
oParaDrawing.Set_PositionH(c_oAscRelativeFromH.Page, true, c_oAscAlignH.Center, undefined);
oParaDrawing.Set_PositionV(c_oAscRelativeFromV.Page, true, c_oAscAlignV.Center, undefined);
oParaDrawing.Set_WrappingType(WRAPPING_TYPE_NONE);
oParaDrawing.Set_BehindDoc( false );
oParaDrawing.Set_Distance( 3.2, 0, 3.2, 0 );
var oShape = this.createWatermarkImage();
oShape.setParent(oParaDrawing);
oParaDrawing.Set_GraphicObject(oShape);
this.document.Content[0].Add(oParaDrawing);
History = oOldHistory;
return oInterfaceHistory.GetResultChanges();
},
recalculate_: function(data)
{
if(data.All)
......
......@@ -231,6 +231,15 @@ asc_docs_api.prototype.asc_addImage = function()
asc_docs_api.prototype.asc_isOffline = function()
{
return true;
};
//Получаем изменения добавления ватермарка для триальной версии
asc_docs_api.prototype.asc_getTrialChanges = function()
{
if (this.WordControl.m_oLogicDocument != null)
{
return this.WordControl.m_oLogicDocument.DrawingObjects.getTrialChanges();
}
};
asc_docs_api.prototype["asc_addImage"] = asc_docs_api.prototype.asc_addImage;
......@@ -239,7 +248,8 @@ asc_docs_api.prototype["AddImage"] = asc_docs_api.prototype.AddImage;
asc_docs_api.prototype["asc_Save"] = asc_docs_api.prototype.asc_Save;
asc_docs_api.prototype["asc_DownloadAs"] = asc_docs_api.prototype.asc_DownloadAs;
asc_docs_api.prototype["asc_isOffline"] = asc_docs_api.prototype.asc_isOffline;
asc_docs_api.prototype["SetDocumentModified"] = asc_docs_api.prototype.SetDocumentModified;
asc_docs_api.prototype["SetDocumentModified"] = asc_docs_api.prototype.SetDocumentModified;
asc_docs_api.prototype["asc_getTrialChanges"] = asc_docs_api.prototype.asc_getTrialChanges;
window["DesktopOfflineAppDocumentAddImageEnd"] = function(url)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment