Commit 3b5a57b6 authored by Sergey Luzyanin's avatar Sergey Luzyanin Committed by Alexander.Trofimov

Добавлены скрипты для мобильной версии.

Добавлен скрипт для сборки sdk презентаций для мобильной версии.
parent a435919d
......@@ -163,6 +163,17 @@ module.exports = function(grunt) {
if (!nomap) {
sdkOpt['variable_renaming_report'] = packageFile['compile']['sdk']['log'] + '/variable.map';
sdkOpt['property_renaming_report'] = packageFile['compile']['sdk']['log'] + '/property.map';
}
if (grunt.option('mobile')) {
var excludeFiles = packageFile['compile']['sdk']['exclude_mobile']
srcFiles = srcFiles.filter(function(item) {
return -1 === excludeFiles.indexOf(item);
});
var mobileFiles = packageFile['compile']['sdk']['mobile'];
if(mobileFiles){
srcFiles = mobileFiles.concat(srcFiles);
}
}
if (grunt.option('private')) {
......@@ -171,12 +182,7 @@ module.exports = function(grunt) {
if (grunt.option('desktop')) {
srcFiles.concat(packageFile['compile']['sdk']['desktop']);
}
if (grunt.option('exclude_mobile')) {
var excludeFiles = packageFile['compile']['sdk']['exclude_mobile']
srcFiles = srcFiles.filter(function(item) {
return -1 === excludeFiles.indexOf(item);
});
}
var cc = require('google-closure-compiler').compiler;
cc.prototype.spawnOptions = {env: {'JAVA_OPTS': '-Xms2048m'}};
......
CD /D %~dp0
call npm install -g grunt-cli
call npm install
call grunt --level=WHITESPACE_ONLY --nomap=true --formatting=PRETTY_PRINT --mobile=true
pause
\ No newline at end of file
......@@ -153,7 +153,28 @@
"../common/Local/common.js",
"../slide/Local/api.js"
],
"exclude_mobile": [],
"mobile": [
"../../web-apps/vendor/xregexp/xregexp-all-min.js",
"../common/Native/native.js",
"../common/browser.js",
"../common/Native/jquery_native.js",
"../common/Native/Wrappers/memory.js",
"../common/Native/Wrappers/TextMeasurerWrapper.js",
"../common/Native/Wrappers/DrawingStream.js",
"../common/Native/Wrappers/ShapeDrawer.js",
"../common/Native/Wrappers/Overlay.js",
"../slide/Native/native.js",
"../slide/Native/Wrappers/api.js",
"../slide/Native/Wrappers/HtmlPage.js",
"../slide/Native/Wrappers/DrawingDocument.js"
],
"exclude_mobile": [
"../common/browser.js",
"../word/Drawing/ShapeDrawer.js",
"../word/Drawing/Overlay.js",
"../slide/Drawing/HtmlPage.js",
"../slide/Drawing/DrawingDocument.js"
],
"dst": "../slide/sdk-all.js",
"externs": [
"../common/Build/Externs.js",
......
......@@ -233,8 +233,17 @@ document.createComment = function() { return undefined; };
document.documentElement = _null_object;
document.body = _null_object;
var native;
if(typeof NativeEngine === "undefined")
{
native = CreateNativeEngine();
}
else
{
native = NativeEngine;
}
var native = CreateNativeEngine();
window.native = native;
window["native"] = native;
......
"use strict";
var g_fontManager = new CFontManager();
g_fontManager.Initialize(true);
var TRACK_CIRCLE_RADIUS = 5;
var TRACK_RECT_SIZE2 = 4;
var TRACK_RECT_SIZE = 8;
var TRACK_DISTANCE_ROTATE = 25;
var TRACK_ADJUSTMENT_SIZE = 10;
var FOCUS_OBJECT_THUMBNAILS = 0;
var FOCUS_OBJECT_MAIN = 1;
var FOCUS_OBJECT_NOTES = 2;
var COMMENT_WIDTH = 18;
var COMMENT_HEIGHT = 16;
function CTableMarkup(Table)
{
this.Internal =
{
RowIndex : 0,
CellIndex : 0,
PageNum : 0
};
this.Table = Table;
this.X = 0; // Смещение таблицы от начала страницы до первой колонки
this.Cols = []; // массив ширин колонок
this.Margins = []; // массив левых и правых маргинов
this.Rows = []; // массив позиций, высот строк(для данной страницы)
// Rows = [ { Y : , H : }, ... ]
this.CurCol = 0; // текущая колонка
this.CurRow = 0; // текущая строка
this.TransformX = 0;
this.TransformY = 0;
}
CTableMarkup.prototype =
{
CreateDublicate : function()
{
var obj = new CTableMarkup(this.Table);
obj.Internal = { RowIndex : this.Internal.RowIndex, CellIndex : this.Internal.CellIndex, PageNum : this.Internal.PageNum };
obj.X = this.X;
var len = this.Cols.length;
for (var i = 0; i < len; i++)
obj.Cols[i] = this.Cols[i];
len = this.Margins.length;
for (var i = 0; i < len; i++)
obj.Margins[i] = { Left : this.Margins[i].Left, Right : this.Margins[i].Right };
len = this.Rows.length;
for (var i = 0; i < len; i++)
obj.Rows[i] = { Y : this.Rows[i].Y, H : this.Rows[i].H };
obj.CurRow = this.CurRow;
obj.CurCol = this.CurCol;
return obj;
},
CorrectFrom : function()
{
this.X += this.TransformX;
var _len = this.Rows.length;
for (var i = 0; i < _len; i++)
{
this.Rows[i].Y += this.TransformY;
}
},
CorrectTo : function()
{
this.X -= this.TransformX;
var _len = this.Rows.length;
for (var i = 0; i < _len; i++)
{
this.Rows[i].Y -= this.TransformY;
}
},
Get_X : function()
{
return this.X;
},
Get_Y : function()
{
var _Y = 0;
if (this.Rows.length > 0)
{
_Y = this.Rows[0].Y;
}
return _Y;
}
};
function CTableOutline(Table, PageNum, X, Y, W, H)
{
this.Table = Table;
this.PageNum = PageNum;
this.X = X;
this.Y = Y;
this.W = W;
this.H = H;
}
function _rect()
{
this.x = 0;
this.y = 0;
this.w = 0;
this.h = 0;
}
function CDrawingPage()
{
this.left = 0;
this.top = 0;
this.right = 0;
this.bottom = 0;
this.cachedImage = null;
}
function CDrawingDocument()
{
this.IsLockObjectsEnable = false;
this.m_oWordControl = null;
this.m_oLogicDocument = null;
this.SlidesCount = 0;
this.IsEmptyPresentation = false;
this.SlideCurrent = -1;
this.Native = window["native"];
this.m_sLockedCursorType = "";
this.UpdateTargetFromPaint = false;
this.TextMatrix = null;
this.CanvasHitContext = CreateHitControl();
this.TargetCursorColor = {R: 0, G: 0, B: 0};
this.AutoShapesTrack = new CAutoshapeTrack();
this.RenderPage = function(nPageIndex)
{
var _graphics = new CDrawingStream();
this.m_oWordControl.m_oLogicDocument.DrawPage(nPageIndex, _graphics);
}
this.AfterLoad = function()
{
this.m_oWordControl = this;
this.Api = window.editor;
this.m_oApi = this.Api;
this.m_oApi.DocumentUrl = "";
this.LogicDocument = window.editor.WordControl.m_oLogicDocument;
this.LogicDocument.DrawingDocument = this;
}
this.Start_CollaborationEditing = function()
{
this.Native["DD_Start_CollaborationEditing"]();
}
this.IsMobileVersion = function()
{
return true;
}
this.ConvertCoordsToAnotherPage = function(x, y)
{
return {X: x, Y: y};
};
this.SetCursorType = function(sType, Data)
{
var sResultCursorType = sType;
if ("" == this.m_sLockedCursorType)
{
if (this.m_oWordControl.m_oApi.isPaintFormat && (("default" == sType) || ("text" == sType)))
sResultCursorType = kCurFormatPainterWord;
else
sResultCursorType = sType;
}
else
sResultCursorType = this.m_sLockedCursorType;
if ( "undefined" === typeof(Data) || null === Data )
Data = new CMouseMoveData();
this.Native["DD_SetCursorType"](sResultCursorType, Data);
}
this.LockCursorType = function(sType)
{
this.m_sLockedCursorType = sType;
this.Native["DD_LockCursorType"](sType);
}
this.LockCursorTypeCur = function()
{
this.m_sLockedCursorType = this.Native["DD_LockCursorType"]();
}
this.UnlockCursorType = function()
{
this.m_sLockedCursorType = "";
this.Native["DD_UnlockCursorType"]();
}
this.OnStartRecalculate = function(pageCount)
{
this.Native["DD_OnStartRecalculate"](pageCount);
}
this.SetTargetColor = function(r, g, b)
{
this.Native["DD_SetTargetColor"](r, g, b);
}
this.StartTrackTable = function()
{};
this.OnRecalculatePage = function(index, pageObject)
{
this.Native["DD_OnRecalculatePage"](index, pageObject.Width, pageObject.Height);
}
this.OnEndRecalculate = function()
{
this.Native["DD_OnEndRecalculate"]();
}
this.ChangePageAttack = function(pageIndex)
{
}
this.InitGuiCanvasTextProps = function(div_id)
{
}
this.DrawGuiCanvasTextProps = function(props)
{
}
this.DrawSearch = function(overlay)
{
}
this.DrawSearchCur = function(overlay, place)
{
}
this.StopRenderingPage = function(pageIndex)
{
}
this.ClearCachePages = function()
{
this.Native["DD_ClearCachePages"]();
}
this.FirePaint = function()
{
this.Native["DD_FirePaint"]();
}
this.ConvertCoordsFromCursor2 = function(x, y)
{
return this.Native["DD_ConvertCoordsFromCursor2"]();
}
this.IsCursorInTableCur = function(x, y, page)
{
return false;
}
this.ConvertCoordsToCursorWR = function(x, y, pageIndex, transform)
{
return this.Native["DD_ConvertCoordsToCursorWR"]();
}
this.ConvertCoordsToCursorWR_2 = function(x, y)
{
return this.Native["DD_ConvertCoordsToCursorWR_2"]();
}
this.ConvertCoordsToCursorWR_Comment = function(x, y)
{
return this.Native["DD_ConvertCoordsToCursorWR_Comment"]();
}
this.ConvertCoordsToCursor = function(x, y)
{
return this.Native["DD_ConvertCoordsToCursor"]();
}
this.TargetStart = function()
{
return this.Native["DD_TargetStart"]();
}
this.TargetEnd = function()
{
return this.Native["DD_TargetEnd"]();
}
this.UpdateTargetNoAttack = function()
{
}
this.CheckTargetDraw = function(x, y)
{
return this.Native["DD_CheckTargetDraw"](x, y);
}
this.UpdateTarget = function(x, y, pageIndex)
{
return this.Native["DD_UpdateTarget"](x, y, pageIndex);
}
this.SetTargetSize = function(size)
{
return this.Native["DD_SetTargetSize"](size);
}
this.DrawTarget = function()
{
return this.Native["DD_DrawTarget"]();
}
this.TargetShow = function()
{
return this.Native["DD_TargetShow"]();
}
this.CheckTargetShow = function()
{
return this.Native["DD_CheckTargetShow"]();
}
this.SetCurrentPage = function(PageIndex)
{
return this.Native["DD_SetCurrentPage"](PageIndex);
}
this.SelectEnabled = function(bIsEnabled)
{
return this.Native["DD_SelectEnabled"](bIsEnabled);
}
this.SelectClear = function()
{
return this.Native["DD_SelectClear"]();
}
this.SearchClear = function()
{
return this.Native["DD_SearchClear"]();
}
this.AddPageSearch = function(findText, rects)
{
return this.Native["DD_AddPageSearch"](findText, rects);
}
this.StartSearch = function()
{
this.Native["DD_StartSearch"]();
}
this.EndSearch = function(bIsChange)
{
this.Native["DD_EndSearch"](bIsChange);
}
this.AddPageSelection = function(pageIndex, x, y, width, height)
{
this.Native["DD_AddPageSelection"](pageIndex, x, y, width, height);
}
this.SelectShow = function()
{
this.Native["DD_SelectShow"]();
}
this.Set_RulerState_Table = function(markup, transform)
{
this.Native["DD_Set_RulerState_Table"](markup, transform);
}
this.Set_RulerState_Paragraph = function(obj, margins)
{
this.Native["DD_Set_RulerState_Paragraph"](obj, margins);
}
this.Update_ParaTab = function(Default_Tab, ParaTabs)
{
this.Native["DD_Update_ParaTab"](Default_Tab, ParaTabs);
}
this.UpdateTableRuler = function(isCols, index, position)
{
this.Native["DD_UpdateTableRuler"](isCols, index, position);
}
this.GetDotsPerMM = function(value)
{
this.Native["DD_GetDotsPerMM"](value);
}
this.GetMMPerDot = function(value)
{
return value / this.GetDotsPerMM( 1 );
}
this.GetVisibleMMHeight = function()
{
return this.Native["DD_GetVisibleMMHeight"]();
}
// вот оооочень важная функция. она выкидывает из кэша неиспользуемые шрифты
this.CheckFontCache = function()
{
return this.Native["DD_CheckFontCache"]();
}
this.CheckFontNeeds = function()
{
}
this.CorrectRulerPosition = function(pos)
{
return this.Native["DD_CorrectRulerPosition"](pos);
}
// вот здесь весь трекинг
this.DrawTrack = function(type, matrix, left, top, width, height, isLine, canRotate, isNoMove)
{
this.AutoShapesTrack.DrawTrack(type, matrix, left, top, width, height, isLine, canRotate, isNoMove);
}
this.LockSlide = function(slideNum)
{
this.Native["DD_LockSlide"](slideNum);
}
this.UnLockSlide = function(slideNum)
{
this.Native["DD_UnLockSlide"](slideNum);
}
this.DrawTrackSelectShapes = function(x, y, w, h)
{
this.AutoShapesTrack.DrawTrackSelectShapes(x, y, w, h);
}
this.DrawAdjustment = function(matrix, x, y, bTextWarp)
{
this.AutoShapesTrack.DrawAdjustment(matrix, x, y, bTextWarp);
}
// cursor
this.UpdateTargetTransform = function(matrix)
{
if (matrix)
{
if (null == this.TextMatrix)
this.TextMatrix = new CMatrix();
this.TextMatrix.sx = matrix.sx;
this.TextMatrix.shy = matrix.shy;
this.TextMatrix.shx = matrix.shx;
this.TextMatrix.sy = matrix.sy;
this.TextMatrix.tx = matrix.tx;
this.TextMatrix.ty = matrix.ty;
this.Native["DD_UpdateTargetTransform"](matrix.sx, matrix.shy, matrix.shx, matrix.sy, matrix.tx, matrix.ty);
}
else
{
this.TextMatrix = null;
this.Native["DD_RemoveTargetTransform"]();
}
}
this.UpdateThumbnailsAttack = function()
{
//this.m_oWordControl.Thumbnails.RecalculateAll();
}
this.CheckGuiControlColors = function(bIsAttack)
{
}
this.SendControlColors = function(bIsAttack)
{
}
this.SendThemeColorScheme = function()
{
}
this.DrawImageTextureFillShape = function(url)
{
}
this.DrawImageTextureFillSlide = function(url)
{
}
this.DrawImageTextureFillTextArt = function(url)
{
}
this.InitGuiCanvasShape = function(div_id)
{
}
this.InitGuiCanvasSlide = function(div_id)
{
}
this.InitGuiCanvasTextArt = function(div_id)
{
}
this.CheckTableStyles = function()
{
}
this.OnSelectEnd = function()
{
}
this.GetCommentWidth = function(type)
{
}
this.GetCommentHeight = function(type)
{
}
// collaborative targets
this.Collaborative_UpdateTarget = function(_id, _x, _y, _size, _page, _transform, is_from_paint)
{
this.Native["DD_Collaborative_UpdateTarget"](_id, _x, _y, _size, _page, _transform, is_from_paint);
};
this.Collaborative_RemoveTarget = function(_id)
{
this.Native["DD_Collaborative_RemoveTarget"](_id);
};
this.Collaborative_TargetsUpdate = function(bIsChangePosition)
{
this.Native["DD_Collaborative_TargetsUpdate"](bIsChangePosition);
};
}
"use strict";
var g_dDpiX = 96.0;
var g_dDpiY = 96.0;
var g_dKoef_mm_to_pix = g_dDpiX / 25.4;
var g_dKoef_pix_to_mm = 25.4 / g_dDpiX;
var g_bIsMobile = AscBrowser.isMobile;
var g_bIsMouseUpLockedSend = false;
var Page_Width = 297;
var Page_Height = 210;
var X_Left_Margin = 30; // 3 cm
var X_Right_Margin = 15; // 1.5 cm
var Y_Bottom_Margin = 20; // 2 cm
var Y_Top_Margin = 20; // 2 cm
var Y_Default_Header = 12.5; // 1.25 cm
var Y_Default_Footer = 12.5; // 1.25 cm
var X_Left_Field = X_Left_Margin;
var X_Right_Field = Page_Width - X_Right_Margin;
var Y_Bottom_Field = Page_Height - Y_Bottom_Margin;
var Y_Top_Field = Y_Top_Margin;
var GlobalSkinTeamlab = {
Name : "classic",
RulersButton : true,
NavigationButtons : true,
BackgroundColor : "#B0B0B0",
BackgroundColorThumbnails : "#EBEBEB",
RulerDark : "#B0B0B0",
RulerLight : "EDEDED",
RulerOutline : "#929292",
RulerMarkersFillColor : "#E7E7E7",
PageOutline : "#81878F",
STYLE_THUMBNAIL_WIDTH : 80,
STYLE_THUMBNAIL_HEIGHT : 40,
BorderSplitterColor : "#787878",
SupportNotes : true,
SplitterWidthMM : 1.5,
ThumbnailScrollWidthNullIfNoScrolling : true
};
var GlobalSkinFlat = {
Name : "flat",
RulersButton : false,
NavigationButtons : false,
BackgroundColor : "#F4F4F4",
BackgroundColorThumbnails : "#F4F4F4",
RulerDark : "#CFCFCF",
RulerLight : "#FFFFFF",
RulerOutline : "#BBBEC2",
RulerMarkersFillColor : "#FFFFFF",
PageOutline : "#BBBEC2",
STYLE_THUMBNAIL_WIDTH : 109,
STYLE_THUMBNAIL_HEIGHT : 45,
BorderSplitterColor : "#CBCBCB",
SupportNotes : false,
SplitterWidthMM : 1,
ThumbnailScrollWidthNullIfNoScrolling : false
};
var GlobalSkin = GlobalSkinTeamlab;
function CEditorPage(api)
{
// ------------------------------------------------------------------
this.Name = "";
this.IsSupportNotes = false;
this.EditorType = "presentations";
this.X = 0;
this.Y = 0;
this.Width = 10;
this.Height = 10;
this.m_oDrawingDocument = new CDrawingDocument();
this.m_oLogicDocument = null;
this.m_oDrawingDocument.m_oWordControl = this;
this.m_oDrawingDocument.m_oLogicDocument = this.m_oLogicDocument;
this.m_oApi = api;
this.Native = window["native"];
this.MainScrollLock = function()
{
}
this.MainScrollUnLock = function()
{
}
this.checkBodySize = function()
{
}
this.Init = function()
{
}
this.CheckLayouts = function(){
}
this.CheckRetinaDisplay = function()
{
}
this.CheckRetinaElement = function(htmlElem)
{
}
this.ShowOverlay = function()
{
}
this.UnShowOverlay = function()
{
}
this.CheckUnShowOverlay = function()
{
}
this.CheckShowOverlay = function()
{
}
this.initEvents = function()
{
}
this.initEvents2MobileAdvances = function()
{
}
this.onButtonRulersClick = function()
{
}
this.HideRulers = function()
{
}
this.zoom_FitToWidth = function()
{
}
this.zoom_FitToPage = function()
{
}
this.zoom_Fire = function(type)
{
}
this.zoom_Out = function()
{
}
this.zoom_In = function()
{
}
this.DisableRulerMarkers = function()
{
}
this.EnableRulerMarkers = function()
{
}
this.ToSearchResult = function()
{
}
this.onButtonTabsClick = function()
{
}
this.onButtonTabsDraw = function()
{
}
this.onPrevPage = function()
{
}
this.onNextPage = function()
{
}
this.horRulerMouseDown = function(e)
{
}
this.horRulerMouseUp = function(e)
{
}
this.horRulerMouseMove = function(e)
{
}
this.verRulerMouseDown = function(e)
{
}
this.verRulerMouseUp = function(e)
{
}
this.verRulerMouseMove = function(e)
{
}
this.SelectWheel = function()
{
}
this.createSplitterDiv = function(bIsVert)
{
}
this.onBodyMouseDown = function(e)
{
}
this.onBodyMouseMove = function(e)
{
}
this.OnResizeSplitter = function()
{
}
this.onBodyMouseUp = function(e)
{
}
this.onMouseDown = function(e)
{
}
this.onMouseMove = function(e)
{
}
this.onMouseMove2 = function()
{
}
this.onMouseUp = function(e, bIsWindow)
{
}
this.onMouseUpExternal = function(x, y)
{
}
this.onMouseWhell = function(e)
{
}
this.onKeyUp = function(e)
{
}
this.onKeyDown = function(e)
{
}
this.onKeyDownNoActiveControl = function(e)
{
}
this.onKeyDownTBIM = function(e)
{
}
this.DisableTextEATextboxAttack = function()
{
}
this.onKeyPress = function(e)
{
}
// -------------------------------------------------------- //
// -----------------end demonstration---------------------- //
// -------------------------------------------------------- //
this.verticalScroll = function(sender,scrollPositionY,maxY,isAtTop,isAtBottom)
{
}
this.verticalScrollMouseUp = function(sender, e)
{
}
this.CorrectSpeedVerticalScroll = function(newScrollPos)
{
}
this.CorrectVerticalScrollByYDelta = function(delta)
{
}
this.horizontalScroll = function(sender,scrollPositionX,maxX,isAtLeft,isAtRight)
{
}
this.UpdateScrolls = function()
{
}
this.OnRePaintAttack = function()
{
}
this.DeleteVerticalScroll = function()
{
}
this.OnResize = function(isAttack)
{
}
this.OnResize2 = function(isAttack)
{
}
this.checkNeedRules = function()
{
}
this.checkNeedHorScroll = function()
{
}
this.StartUpdateOverlay = function()
{
}
this.EndUpdateOverlay = function()
{
}
this.OnUpdateOverlay = function()
{
}
this.GetDrawingPageInfo = function(nPageIndex)
{
}
this.OnCalculatePagesPlace = function()
{
}
this.OnPaint = function()
{
}
this.CheckFontCache = function()
{
}
this.OnScroll = function()
{
}
this.CheckZoom = function()
{
}
this.CalculateDocumentSize = function(bIsAttack)
{
}
this.CheckCalculateDocumentSize = function(_bounds)
{
}
this.InitDocument = function(bIsEmpty)
{
}
this.InitControl = function()
{
}
this.StartMainTimer = function()
{
}
this.onTimerScroll = function(isThUpdateSync)
{
}
this.onTimerScroll_sync = function(isThUpdateSync)
{
}
this.UpdateHorRuler = function()
{
}
this.UpdateVerRuler = function()
{
}
this.SetCurrentPage = function()
{
}
this.UpdateHorRulerBack = function()
{
}
this.UpdateVerRulerBack = function()
{
}
this.CreateBackgroundHorRuler = function(margins)
{
}
this.CreateBackgroundVerRuler = function(margins)
{
}
this.ThemeGenerateThumbnails = function(_master)
{
}
this.CheckLayouts = function(bIsAttack)
{
}
this.GoToPage = function(lPageNum)
{
this.Native["WC_GoToPage"](lPageNum);
}
this.GetVerticalScrollTo = function(y)
{
}
this.GetHorizontalScrollTo = function(x)
{
}
// -------------------------------------------------------- //
// -------------------- east asian fonts ------------------ //
// -------------------------------------------------------- //
this.ReinitTB = function()
{
}
this.SetTextBoxMode = function(isEA)
{
}
this.TextBoxFocus = function()
{
}
this.OnTextBoxInput = function()
{
}
this.CheckTextBoxSize = function()
{
}
this.TextBoxOnKeyDown = function(e)
{
}
this.onChangeTB = function()
{
}
this.CheckTextBoxInputPos = function()
{
}
this.SaveDocument = function()
{
}
}
function sendStatus(Message)
{
editor.sync_StatusMessage(Message);
}
\ No newline at end of file
var global_memory_stream_menu = CreateNativeMemoryStream();
// endsectionPr -----------------------------------------------------------------------------------------
// font engine -------------------------------------
var FONT_ITALIC_ANGLE = 0.3090169943749;
var FT_ENCODING_UNICODE = 1970170211;
var FT_ENCODING_NONE = 0;
var FT_ENCODING_MS_SYMBOL = 1937337698;
var FT_ENCODING_APPLE_ROMAN = 1634889070;
var LOAD_MODE = 40970;
var REND_MODE = 0;
var FontStyle =
{
FontStyleRegular: 0,
FontStyleBold: 1,
FontStyleItalic: 2,
FontStyleBoldItalic: 3,
FontStyleUnderline: 4,
FontStyleStrikeout: 8
};
var EGlyphState =
{
glyphstateNormal: 0,
glyphstateDeafault: 1,
glyphstateMiss: 2
};
function CPoint1()
{
this.fX = 0;
this.fY = 0;
this.fWidth = 0;
this.fHeight = 0;
};
function CPoint2()
{
this.fLeft = 0;
this.fTop = 0;
this.fRight = 0;
this.fBottom = 0;
};
function CFontManager()
{
this.m_oLibrary = {};
this.Initialize = function(){};
};
function CStylesPainter()
{
this.STYLE_THUMBNAIL_WIDTH = GlobalSkin.STYLE_THUMBNAIL_WIDTH;
this.STYLE_THUMBNAIL_HEIGHT = GlobalSkin.STYLE_THUMBNAIL_HEIGHT;
this.CurrentTranslate = null;
this.IsRetinaEnabled = false;
this.defaultStyles = [];
this.docStyles = [];
this.mergedStyles = [];
}
CStylesPainter.prototype =
{
GenerateStyles: function(_api, ds)
{
if (_api.WordControl.bIsRetinaSupport)
{
this.STYLE_THUMBNAIL_WIDTH <<= 1;
this.STYLE_THUMBNAIL_HEIGHT <<= 1;
this.IsRetinaEnabled = true;
}
this.CurrentTranslate = _api.CurrentTranslate;
var _stream = global_memory_stream_menu;
var _graphics = new CDrawingStream();
_api.WordControl.m_oDrawingDocument.Native["DD_PrepareNativeDraw"]();
this.GenerateDefaultStyles(_api, ds, _graphics);
this.GenerateDocumentStyles(_api, _graphics);
// стили сформированы. осталось просто сформировать единый список
var _count_default = this.defaultStyles.length;
var _count_doc = 0;
if (null != this.docStyles)
_count_doc = this.docStyles.length;
var aPriorityStyles = [];
var fAddToPriorityStyles = function(style){
var index = style.Style.uiPriority;
if(null == index)
index = 0;
var aSubArray = aPriorityStyles[index];
if(null == aSubArray)
{
aSubArray = [];
aPriorityStyles[index] = aSubArray;
}
aSubArray.push(style);
};
var _map_document = {};
for (var i = 0; i < _count_doc; i++)
{
var style = this.docStyles[i];
_map_document[style.Name] = 1;
fAddToPriorityStyles(style);
}
for (var i = 0; i < _count_default; i++)
{
var style = this.defaultStyles[i];
if(null == _map_document[style.Name])
fAddToPriorityStyles(style);
}
this.mergedStyles = [];
for(var index in aPriorityStyles)
{
var aSubArray = aPriorityStyles[index];
aSubArray.sort(function(a, b){
if(a.Name < b.Name)
return -1;
else if(a.Name > b.Name)
return 1;
else
return 0;
});
for(var i = 0, length = aSubArray.length; i < length; ++i)
{
this.mergedStyles.push(aSubArray[i]);
}
}
var _count = this.mergedStyles.length;
for (var i = 0; i < _count; i++)
{
this.drawStyle(_graphics, this.mergedStyles[i].Style, _api);
}
_stream["ClearNoAttack"]();
_stream["WriteByte"](1);
_api.WordControl.m_oDrawingDocument.Native["DD_EndNativeDraw"](_stream);
},
GenerateDefaultStyles: function(_api, ds, _graphics)
{
var styles = ds;
for (var i in styles)
{
var style = styles[i];
if (true == style.qFormat)
{
this.defaultStyles.push({ Name: style.Name, Style: style });
//this.drawStyle(_graphics, style, _api);
}
}
},
GenerateDocumentStyles: function(_api, _graphics)
{
if (_api.WordControl.m_oLogicDocument == null)
return;
var __Styles = _api.WordControl.m_oLogicDocument.Get_Styles();
var styles = __Styles.Style;
if (styles == null)
return;
for (var i in styles)
{
var style = styles[i];
if (true == style.qFormat)
{
// как только меняется сериалайзер - меняется и код здесь. Да, не очень удобно,
// зато быстро делается
var formalStyle = i.toLowerCase().replace(/\s/g, "");
var res = formalStyle.match(/^heading([1-9][0-9]*)$/);
var index = (res) ? res[1] - 1 : -1;
var _dr_style = __Styles.Get_Pr(i, styletype_Paragraph);
_dr_style.Name = style.Name;
_dr_style.Id = i;
//this.drawStyle(_graphics, _dr_style, _api);
var _name = _dr_style.Name;
// алгоритм смены имени
if (style.Default)
{
switch (style.Default)
{
case 1:
break;
case 2:
_name = "No List";
break;
case 3:
_name = "Normal";
break;
case 4:
_name = "Normal Table";
break;
}
}
else if (index != -1)
{
_name = "Heading ".concat(index + 1);
}
this.docStyles.push({ Name: _name, Style: _dr_style });
}
}
},
drawStyle: function(graphics, style, _api)
{
var _w_px = this.STYLE_THUMBNAIL_WIDTH;
var _h_px = this.STYLE_THUMBNAIL_HEIGHT;
var dKoefToMM = g_dKoef_pix_to_mm;
if (AscBrowser.isRetina)
{
_w_px *= 2;
_h_px *= 2;
dKoefToMM /= 2;
}
_api.WordControl.m_oDrawingDocument.Native["DD_StartNativeDraw"](_w_px, _h_px, _w_px * dKoefToMM, _h_px * dKoefToMM);
g_oTableId.m_bTurnOff = true;
History.TurnOff();
var oldDefTabStop = Default_Tab_Stop;
Default_Tab_Stop = 1;
var hdr = new CHeaderFooter(_api.WordControl.m_oLogicDocument.HdrFtr, _api.WordControl.m_oLogicDocument, _api.WordControl.m_oDrawingDocument, hdrftr_Header);
var _dc = hdr.Content;//new CDocumentContent(editor.WordControl.m_oLogicDocument, editor.WordControl.m_oDrawingDocument, 0, 0, 0, 0, false, true, false);
var par = new Paragraph(_api.WordControl.m_oDrawingDocument, _dc, 0, 0, 0, 0, false);
var run = new ParaRun(par, false);
for (var i = 0; i < style.Name.length; i++)
{
run.Add_ToContent(i, new ParaText(style.Name.charAt(i)), false);
}
_dc.Internal_Content_Add(0, par, false);
par.Add_ToContent(0, run);
par.Style_Add(style.Id, false);
par.Set_Align(align_Left);
par.Set_Tabs(new CParaTabs());
var _brdL = style.ParaPr.Brd.Left;
if ( undefined !== _brdL && null !== _brdL )
{
var brdL = new CDocumentBorder();
brdL.Set_FromObject(_brdL);
brdL.Space = 0;
par.Set_Border(brdL, historyitem_Paragraph_Borders_Left);
}
var _brdT = style.ParaPr.Brd.Top;
if ( undefined !== _brdT && null !== _brdT )
{
var brd = new CDocumentBorder();
brd.Set_FromObject(_brdT);
brd.Space = 0;
par.Set_Border(brd, historyitem_Paragraph_Borders_Top);
}
var _brdB = style.ParaPr.Brd.Bottom;
if ( undefined !== _brdB && null !== _brdB )
{
var brd = new CDocumentBorder();
brd.Set_FromObject(_brdB);
brd.Space = 0;
par.Set_Border(brd, historyitem_Paragraph_Borders_Bottom);
}
var _brdR = style.ParaPr.Brd.Right;
if ( undefined !== _brdR && null !== _brdR )
{
var brd = new CDocumentBorder();
brd.Set_FromObject(_brdR);
brd.Space = 0;
par.Set_Border(brd, historyitem_Paragraph_Borders_Right);
}
var _ind = new CParaInd();
_ind.FirstLine = 0;
_ind.Left = 0;
_ind.Right = 0;
par.Set_Ind(_ind, false);
var _sp = new CParaSpacing();
_sp.Line = 1;
_sp.LineRule = linerule_Auto;
_sp.Before = 0;
_sp.BeforeAutoSpacing = false;
_sp.After = 0;
_sp.AfterAutoSpacing = false;
par.Set_Spacing(_sp, false);
_dc.Reset(0, 0, 10000, 10000);
_dc.Recalculate_Page(0, true);
_dc.Reset(0, 0, par.Lines[0].Ranges[0].W + 0.001, 10000);
_dc.Recalculate_Page(0, true);
var y = 0;
var b = dKoefToMM * _h_px;
var w = dKoefToMM * _w_px;
var off = 10 * dKoefToMM;
var off2 = 5 * dKoefToMM;
var off3 = 1 * dKoefToMM;
graphics.transform(1,0,0,1,0,0);
graphics.save();
graphics._s();
graphics._m(off2, y + off3);
graphics._l(w - off, y + off3);
graphics._l(w - off, b - off3);
graphics._l(off2, b - off3);
graphics._z();
graphics.clip();
var baseline = par.Lines[0].Y;
par.Shift(0, off + 0.5, y + 0.75 * (b - y) - baseline);
par.Draw(0, graphics);
graphics.restore();
Default_Tab_Stop = oldDefTabStop;
g_oTableId.m_bTurnOff = false;
History.TurnOn();
var _stream = global_memory_stream_menu;
_stream["ClearNoAttack"]();
_stream["WriteByte"](0);
_stream["WriteString2"](style.Name);
_api.WordControl.m_oDrawingDocument.Native["DD_EndNativeDraw"](_stream);
graphics.ClearParams();
}
};
window["use_native_fonts_only"] = true;
// -------------------------------------------------
// declarate unused methods and objects
window["ftm"] = FT_Memory;
asc_docs_api.prototype["Native_Editor_Initialize_Settings"] = function(_params)
{
window["NativeSupportTimeouts"] = true;
if (!_params)
return;
var _current = { pos : 0 };
var _continue = true;
while (_continue)
{
var _attr = _params[_current.pos++];
switch (_attr)
{
case 0:
{
GlobalSkin.STYLE_THUMBNAIL_WIDTH = _params[_current.pos++];
break;
}
case 1:
{
GlobalSkin.STYLE_THUMBNAIL_HEIGHT = _params[_current.pos++];
break;
}
case 2:
{
TABLE_STYLE_WIDTH_PIX = _params[_current.pos++];
break;
}
case 3:
{
TABLE_STYLE_HEIGHT_PIX = _params[_current.pos++];
break;
}
case 4:
{
this.chartPreviewManager.CHART_PREVIEW_WIDTH_PIX = _params[_current.pos++];
break;
}
case 5:
{
this.chartPreviewManager.CHART_PREVIEW_HEIGHT_PIX = _params[_current.pos++];
break;
}
case 6:
{
var _val = _params[_current.pos++];
if (_val === true)
{
this.ShowParaMarks = false;
CollaborativeEditing.m_bGlobalLock = true;
this.isViewMode = true;
this.WordControl.m_oDrawingDocument.IsViewMode = true;
}
break;
}
case 100:
{
this.WordControl.m_oDrawingDocument.IsRetina = _params[_current.pos++];
break;
}
case 101:
{
this.WordControl.m_oDrawingDocument.IsMobile = _params[_current.pos++];
window.AscAlwaysSaveAspectOnResizeTrack = true;
break;
}
case 255:
default:
{
_continue = false;
break;
}
}
}
AscBrowser.isRetina = this.WordControl.m_oDrawingDocument.IsRetina;
if (this.WordControl.m_oDrawingDocument.IsRetina && this.WordControl.m_oDrawingDocument.IsMobile)
{
TRACK_DISTANCE_ROTATE <<= 1;
}
};
asc_docs_api.prototype["CheckSlideBounds"] = function(nSlideIndex){
var oBoundsChecker = new CSlideBoundsChecker();
this.WordControl.m_oLogicDocument.Draw(nSlideIndex, oBoundsChecker);
var oBounds = oBoundsChecker.Bounds;
return [
oBounds.min_x, oBounds.max_x, oBounds.min_y, oBounds.max_y
]
}
asc_docs_api.prototype["GetNativePageMeta"] = function(pageIndex)
{
this.WordControl.m_oDrawingDocument.RenderPage(pageIndex);
};
// FT_Common
function _FT_Common()
{
this.UintToInt = function(v)
{
return (v>2147483647)?v-4294967296:v;
};
this.UShort_To_Short = function(v)
{
return (v>32767)?v-65536:v;
};
this.IntToUInt = function(v)
{
return (v<0)?v+4294967296:v;
};
this.Short_To_UShort = function(v)
{
return (v<0)?v+65536:v;
};
this.memset = function(d,v,s)
{
for (var i=0;i<s;i++)
d[i]=v;
};
this.memcpy = function(d,s,l)
{
for (var i=0;i<l;i++)
d[i]=s[i];
};
this.memset_p = function(d,v,s)
{
var _d = d.data;
var _e = d.pos+s;
for (var i=d.pos;i<_e;i++)
_d[i]=v;
};
this.memcpy_p = function(d,s,l)
{
var _d1=d.data;
var _p1=d.pos;
var _d2=s.data;
var _p2=s.pos;
for (var i=0;i<l;i++)
_d1[_p1++]=_d2[_p2++];
};
this.memcpy_p2 = function(d,s,p,l)
{
var _d1=d.data;
var _p1=d.pos;
var _p2=p;
for (var i=0;i<l;i++)
_d1[_p1++]=s[_p2++];
};
this.realloc = function(memory, pointer, cur_count, new_count)
{
var ret = { block: null, err : 0, size : new_count};
if (cur_count < 0 || new_count < 0)
{
/* may help catch/prevent nasty security issues */
ret.err = 6;
}
else if (new_count == 0)
{
ret.block = null;
}
else if (cur_count == 0)
{
ret.block = memory.Alloc(new_count);
}
else
{
var block2 = memory.Alloc(new_count);
FT_Common.memcpy_p(block2, pointer, cur_count);
ret.block = block2;
}
return ret;
};
this.realloc_long = function(memory, pointer, cur_count, new_count)
{
var ret = { block: null, err : 0, size : new_count};
if (cur_count < 0 || new_count < 0)
{
/* may help catch/prevent nasty security issues */
ret.err = 6;
}
else if (new_count == 0)
{
ret.block = null;
}
else if (cur_count == 0)
{
ret.block = CreateIntArray(new_count);
}
else
{
var block2 = CreateIntArray(new_count);
for (var i = 0; i < cur_count; i++)
block2[i] = pointer[i];
ret.block = block2;
}
return ret;
};
}
var FT_Common = new _FT_Common();
\ No newline at end of file
function Call_CheckSlideBounds(nSlideIndex){
return _api.CheckSlideBounds(nSlideIndex);
};
\ No newline at end of file
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