Commit b8476340 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov
parent 36609806
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -17975,7 +17975,10 @@ PasteProcessor.prototype =
if(text_decoration)
{
if(-1 != text_decoration.indexOf("underline"))
underline = true;
underline = true;
else if(-1 != text_decoration.indexOf("none") && node.parentElement && node.parentElement.nodeName.toLowerCase() == "a")
underline = false;
if(-1 != text_decoration.indexOf("line-through"))
Strikeout = true;
}
......@@ -19032,7 +19035,23 @@ PasteProcessor.prototype =
TextPr.Unifill = CreateUniFillSchemeColorWidthTint(11, 0);
TextPr.Underline = true;
oHyperlink.Apply_TextPr( TextPr, undefined, true );
}
}
//проставляем rStyle
if(oHyperlink.Content && oHyperlink.Content.length)
{
if(this.oLogicDocument && this.oLogicDocument.Styles && this.oLogicDocument.Styles.Default && this.oLogicDocument.Styles.Default.Hyperlink && this.oLogicDocument.Styles.Style)
{
var hyperLinkStyle = this.oLogicDocument.Styles.Default.Hyperlink;
for(var k = 0; k < oHyperlink.Content.length; k++)
{
if(oHyperlink.Content[k].Type == para_Run)
oHyperlink.Content[k].Set_RStyle(hyperLinkStyle);
}
}
}
this._Paragraph_Add(oHyperlink);
}
}
......@@ -20849,6 +20868,11 @@ var c_oAscBorderStyles = {
Medium : 12,
Thick : 13
};
var c_oAscBorderType = {
Hor : 1,
Ver : 2,
Diag : 3
};
// PageOrientation
var c_oAscPageOrientation = {
PagePortrait : 1,
......@@ -45969,6 +45993,29 @@ var historyitem_type_ParaComment = 54;
//Типы изменений в классе CTheme
function CreateFontRef(idx, color)
{
var ret = new FontRef();
ret.idx = idx;
ret.Color = color;
return ret;
}
function CreateStyleRef(idx, color)
{
var ret = new StyleRef();
ret.idx = idx;
ret.Color = color;
return ret;
}
function CreatePresetColor(id)
{
var ret = new CPrstColor();
ret.idx = id;
return ret;
}
function sRGB_to_scRGB(value)
{
......@@ -47645,6 +47692,10 @@ CSchemeColor.prototype =
RGBA = colors[colorMap[this.id]].color.RGBA;
else if ( colors[this.id] != null)
RGBA = colors[this.id].color.RGBA;
if(!RGBA)
{
RGBA = {R: 0, G: 0, B: 0, A: 255};
}
var _RGBA = this.RGBA;
if(this.RGBA.needRecalc)
{
......@@ -47833,6 +47884,23 @@ CUniColor.prototype =
Refresh_RecalcData: function()
{},
checkPhColor: function(unicolor)
{
if(this.color && this.color.type === COLOR_TYPE_SCHEME && this.color.id === 14)
{
if(unicolor)
{
if(unicolor.color)
{
this.color = unicolor.color.createDuplicate();
}
if(unicolor.Mods)
{
this.Mods = unicolor.Mods.createDuplicate();
}
}
}
},
check: function(theme, colorMap)
{
......@@ -50417,6 +50485,59 @@ CUniFill.prototype =
}
},
checkPhColor: function(unicolor)
{
if(this.fill)
{
switch(this.fill.type)
{
case FILL_TYPE_NONE:
{
break;
}
case FILL_TYPE_BLIP:
{
break;
}
case FILL_TYPE_NOFILL:
{
break;
}
case FILL_TYPE_SOLID:
{
if(this.fill.color && this.fill.color)
{
this.fill.color.checkPhColor(unicolor);
}
break;
}
case FILL_TYPE_GRAD:
{
for(var i = 0; i < this.fill.colors.length; ++i)
{
if(this.fill.colors[i] && this.fill.colors[i].color)
{
this.fill.colors[i].color.checkPhColor(unicolor);
}
}
break;
}
case FILL_TYPE_PATT:
{
if(this.fill.bgClr)
{
this.fill.bgClr.checkPhColor(unicolor);
}
if(this.fill.fgClr)
{
this.fill.fgClr.checkPhColor(unicolor);
}
break;
}
}
}
},
checkWordMods: function()
{
return this.fill && this.fill.checkWordMods();
......@@ -53808,8 +53929,8 @@ function CreateDefaultShapeStyle(preset)
var tx_color = b_line;
var unicolor;
var style = new CShapeStyle();
style.setLnRef(new StyleRef());
style.lnRef.setIdx(b_line ? 1 : 2);
var lnRef = new StyleRef();
lnRef.setIdx(b_line ? 1 : 2);
unicolor = new CUniColor();
unicolor.setColor(new CSchemeColor());
......@@ -53819,30 +53940,36 @@ function CreateDefaultShapeStyle(preset)
mod.setVal(50000);
unicolor.setMods(new CColorModifiers());
unicolor.Mods.addMod(mod);
style.lnRef.setColor(unicolor);
lnRef.setColor(unicolor);
style.setLnRef(lnRef);
var fillRef = new StyleRef();
unicolor = new CUniColor();
unicolor.setColor(new CSchemeColor());
unicolor.color.setId(g_clr_accent1);
style.setFillRef(new StyleRef());
style.fillRef.setIdx(b_line ? 0 : 1);
style.fillRef.setColor(unicolor);
fillRef.setIdx(b_line ? 0 : 1);
fillRef.setColor(unicolor);
style.setFillRef(fillRef);
var effectRef = new StyleRef();
unicolor = new CUniColor();
unicolor.setColor(new CSchemeColor());
unicolor.color.setId(g_clr_accent1);
style.setEffectRef(new StyleRef());
style.effectRef.setIdx(0);
style.effectRef.setColor(unicolor);
effectRef.setIdx(0);
effectRef.setColor(unicolor);
style.setEffectRef(effectRef);
var fontRef = new FontRef();
unicolor = new CUniColor();
unicolor.setColor(new CSchemeColor());
unicolor.color.setId(tx_color ? 15 : 12);
style.setFontRef(new FontRef());
style.fontRef.setIdx(fntStyleInd_minor);
style.fontRef.setColor(unicolor);
fontRef.setIdx(fntStyleInd_minor);
fontRef.setColor(unicolor);
style.setFontRef(fontRef);
return style;
}
......@@ -55132,15 +55259,6 @@ function ClrMap()
for (var i = g_clr_MIN; i <= g_clr_MAX; i++)
this.color_map[i] = null;
this.createDuplicate = function()
{
var _copy = new ClrMap();
for(var _color_index = g_clr_MIN; _color_index <= this.color_map.length; ++_color_index)
{
_copy.color_map[_color_index] = this.color_map[_color_index];
}
return _copy;
};
if(typeof g_oIdCounter != "undefined" && typeof g_oTableId != "undefined" && g_oTableId && g_oIdCounter)
{
......@@ -55160,6 +55278,33 @@ ClrMap.prototype =
Refresh_RecalcData: function()
{},
createDuplicate: function()
{
var _copy = new ClrMap();
for(var _color_index = g_clr_MIN; _color_index <= this.color_map.length; ++_color_index)
{
_copy.color_map[_color_index] = this.color_map[_color_index];
}
return _copy;
},
compare: function(other)
{
if(!other)
return false;
for(var i = g_clr_MIN; i < this.color_map.length; ++i)
{
if(this.color_map[i] !== other.color_map[i])
{
return false;
}
}
return true;
},
getObjectType: function()
{
return historyitem_type_ClrMap;
......@@ -55787,25 +55932,7 @@ function FmtScheme()
this.effectStyleLst = null;
this.bgFillStyleLst = [];
this.GetFillStyle = function(number)
{
if (number >= 1 && number <= 999)
{
var ret = this.fillStyleLst[number - 1];
if (undefined === ret)
return null;
return ret.createDuplicate();
}
else if (number >= 1001)
{
var ret = this.bgFillStyleLst[number - 1001];
if (undefined === ret)
return null;
return ret.createDuplicate();
}
return null;
}
}
......@@ -55819,6 +55946,30 @@ FmtScheme.prototype =
Refresh_RecalcData: function()
{},
GetFillStyle: function(number, unicolor)
{
if (number >= 1 && number <= 999)
{
var ret = this.fillStyleLst[number - 1];
if (!ret)
return null;
var ret2 = ret.createDuplicate();
ret2.checkPhColor(unicolor);
return ret2;
}
else if (number >= 1001)
{
var ret = this.bgFillStyleLst[number - 1001];
if (!ret)
return null;
var ret2 = ret.createDuplicate();
ret2.checkPhColor(unicolor);
return ret2;
}
return null;
},
getObjectType: function()
{
return historyitem_type_FormatScheme;
......@@ -56201,19 +56352,49 @@ CTheme.prototype =
typeof minor_font.cs === "string" && minor_font.latin.length > 0 && (AllFonts[minor_font.cs] = 1);
},
getFillStyle: function(idx)
getFillStyle: function(idx, unicolor)
{
if (this.themeElements.fmtScheme.fillStyleLst[idx-1])
if(idx === 0 || idx === 1000)
{
return CreateNoFillUniFill();
}
var ret;
if (idx >= 1 && idx <= 999)
{
if (this.themeElements.fmtScheme.fillStyleLst[idx-1])
{
ret = this.themeElements.fmtScheme.fillStyleLst[idx-1].createDuplicate();
if(ret)
{
ret.checkPhColor(unicolor);
return ret;
}
}
}
else if (idx >= 1001)
{
return this.themeElements.fmtScheme.fillStyleLst[idx-1].createDuplicate();
if (this.themeElements.fmtScheme.bgFillStyleLst[idx-1])
{
ret = this.themeElements.fmtScheme.bgFillStyleLst[idx-1].createDuplicate();
if(ret)
{
ret.checkPhColor(unicolor);
return ret;
}
}
}
return new CUniFill();
return CreateSolidFillRGBA(0, 0, 0, 255);
},
getLnStyle: function(idx)
getLnStyle: function(idx, unicolor)
{
if (this.themeElements.fmtScheme.lnStyleLst[idx-1])
{
return this.themeElements.fmtScheme.lnStyleLst[idx-1].createDuplicate();
var ret = this.themeElements.fmtScheme.lnStyleLst[idx-1].createDuplicate();
if(ret.Fill)
{
ret.Fill.checkPhColor(unicolor);
}
return ret;
}
return new CLn();
},
......@@ -160323,7 +160504,9 @@ ParaComment.prototype =
if ( comment_type_HdrFtr === Comment.m_oTypeInfo.Type )
{
var HdrFtr = Comment.m_oTypeInfo.Data;
Page = HdrFtr.RecalcInfo.CurPage;
if (-1 !== HdrFtr.RecalcInfo.CurPage)
Page = HdrFtr.RecalcInfo.CurPage;
}
if ( true === this.Start )
......@@ -161050,6 +161233,11 @@ CHistory.prototype =
Check_UninonLastPoints : function()
{
// Не объединяем точки в истории, когда отключается пересчет.
// TODO: Неправильно изменяется RecalcIndex
if (true === this.Document.TurnOffRecalc)
return;
// Не объединяем точки истории, если на предыдущей точке произошло сохранение
if ( this.Points.length < 2 )
return;
......@@ -161172,28 +161360,43 @@ CHistory.prototype =
Is_SimpleChanges : function()
{
if (this.Index - this.RecIndex !== 1)
return [];
if ( this.Index >= 0 && this.Points[this.Index].Items.length > 0 )
var Count, Items;
if (this.Index - this.RecIndex !== 1 && this.RecIndex >= -1)
{
Items = [];
Count = 0;
for (var PointIndex = this.RecIndex + 1; PointIndex <= this.Index; PointIndex++)
{
Items = Items.concat(this.Points[PointIndex].Items);
Count += this.Points[PointIndex].Items.length;
}
}
else if (this.Index >= 0)
{
// Считываем изменения, начиная с последней точки, и смотрим что надо пересчитать.
var Point = this.Points[this.Index];
var Class = Point.Items[0].Class;
var Count = Point.Items.length;
Count = Point.Items.length;
Items = Point.Items;
}
else
return [];
if (Items.length > 0)
{
var Class = Items[0].Class;
// Смотрим, чтобы класс, в котором произошли все изменения был один и тот же
for ( var Index = 1; Index < Count; Index++ )
for (var Index = 1; Index < Count; Index++)
{
var Item = Point.Items[Index];
var Item = Items[Index];
if ( Class !== Item.Class )
if (Class !== Item.Class)
return [];
}
if ( Class instanceof ParaRun && Class.Is_SimpleChanges(Point.Items) )
return Point.Items;
if (Class instanceof ParaRun && Class.Is_SimpleChanges(Items))
return Items;
}
return [];
......@@ -180594,26 +180797,50 @@ ParaRun.prototype.Is_SimpleChanges = function(Changes)
if ( para_Math_Run === this.Type )
return false;
if ( Changes.length !== 1 || undefined === Changes[0].Data.Items || Changes[0].Data.Items.length !== 1 )
return false;
var ParaPos = null;
var Type = Changes[0].Data.Type;
var Item = Changes[0].Data.Items[0];
var Count = Changes.length;
for (var Index = 0; Index < Count; Index++)
{
var Data = Changes[Index].Data;
if ( undefined === Item )
return false;
if (undefined === Data.Items || 1 !== Data.Items.length)
return false;
// Добавление/удаление картинок может изменить размер строки. Добавление/удаление переноса строки/страницы/колонки
// нельзя обсчитывать функцией Recalculate_Fast.
// TODO: Но на самом деле стоило бы сделать нормальную проверку на высоту строки в функции Recalculate_Fast
var ItemType = Item.Type;
if ( para_Drawing === ItemType || para_NewLine === ItemType )
return false;
var Type = Data.Type;
var Item = Data.Items[0];
if ( historyitem_ParaRun_AddItem === Type || historyitem_ParaRun_RemoveItem === Type )
return true;
if (undefined === Item)
return false;
return false;
if (historyitem_ParaRun_AddItem !== Type && historyitem_ParaRun_RemoveItem !== Type)
return false;
// Добавление/удаление картинок может изменить размер строки. Добавление/удаление переноса строки/страницы/колонки
// нельзя обсчитывать функцией Recalculate_Fast.
// TODO: Но на самом деле стоило бы сделать нормальную проверку на высоту строки в функции Recalculate_Fast
var ItemType = Item.Type;
if (para_Drawing === ItemType || para_NewLine === ItemType)
return false;
// Проверяем, что все изменения произошли в одном и том же отрезке
var CurParaPos = this.Get_SimpleChanges_ParaPos([Changes[Index]]);
if (null === CurParaPos)
return false;
if (null === ParaPos)
ParaPos = CurParaPos;
else if (ParaPos.Line !== CurParaPos.Line || ParaPos.Range !== CurParaPos.Range)
return false;
}
if (Changes.length > 1)
{
// Все изменения одинаковые здесь, достаточно оставить одно
Changes.length = 1;
}
return true;
};
// Возвращаем строку и отрезок, в котором произошли простейшие изменения
......@@ -184776,7 +185003,10 @@ ParaRun.prototype.Apply_Pr = function(TextPr)
}
if ( undefined !== TextPr.Unifill )
this.Set_Unifill( null === TextPr.Unifill ? undefined : TextPr.Unifill );
{
this.Set_Unifill(null === TextPr.Unifill ? undefined : TextPr.Unifill);
this.Set_Color(undefined);
}
if ( undefined != TextPr.VertAlign )
this.Set_VertAlign( null === TextPr.VertAlign ? undefined : TextPr.VertAlign );
......@@ -187510,7 +187740,7 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI,
this.Parent = Parent;
// обновляем позиции start и end для Range
this.Lines[0].Add_Range(0, RangeStartPos, RangeEndPos);
//this.Lines[0].Add_Range(0, RangeStartPos, RangeEndPos);
var oWPrp = this.Get_CompiledPr(true);
......@@ -189355,7 +189585,7 @@ function Paragraph(DrawingDocument, Parent, PageNum, X, Y, XLimit, YLimit, bFrom
this.Prev = null;
this.Next = null;
this.Index = -1;
this.Index = -1; // перед тем как пользоваться этим параметром нужно у родительского класса вызывать this.Parent.Update_ContentIndexing();
this.Parent = Parent;
this.PageNum = PageNum;
......@@ -195857,12 +196087,10 @@ Paragraph.prototype =
this.Internal_Content_Remove( HyperPos );
var TextPr = new CTextPr();
TextPr.RStyle = null;
if(!this.bFromDocument)
{
TextPr.Unifill = null;
TextPr.Underline = null;
}
TextPr.RStyle = null;
TextPr.Underline = null;
TextPr.Color = null;
TextPr.Unifill = null;
for ( var CurPos = 0; CurPos < ContentLen; CurPos++ )
{
......@@ -198839,8 +199067,8 @@ Paragraph.prototype =
if ( this.bFromDocument && this.LogicDocument && true === this.LogicDocument.Spelling.Use )
this.SpellChecker.Document_UpdateInterfaceState( StartPos, EndPos );
var HyperPos = -1;
var Math = null;
var Hyperlinks = [];
var Math = null;
if ( true === this.Selection.Use )
{
......@@ -198857,33 +199085,27 @@ Paragraph.prototype =
var Element = this.Content[CurPos];
if ( true !== Element.Selection_IsEmpty() && para_Hyperlink !== Element.Type )
break;
continue;
else if ( true !== Element.Selection_IsEmpty() && para_Hyperlink === Element.Type )
{
if ( -1 === HyperPos )
HyperPos = CurPos;
else
break;
Hyperlinks.push(CurPos);
}
}
if ( this.Selection.StartPos === this.Selection.EndPos && para_Hyperlink === this.Content[this.Selection.StartPos].Type )
HyperPos = this.Selection.StartPos;
if (this.Selection.StartPos === this.Selection.EndPos && para_Math === this.Content[this.Selection.EndPos].Type )
Math = this.Content[this.Selection.EndPos];
}
else
{
if (para_Hyperlink === this.Content[this.CurPos.ContentPos].Type)
HyperPos = this.CurPos.ContentPos;
Hyperlinks.push(this.CurPos.ContentPos);
else if (para_Math === this.Content[this.CurPos.ContentPos].Type)
Math = this.Content[this.CurPos.ContentPos];
}
if ( -1 !== HyperPos )
for (var HyperIndex = 0, HyperCount = Hyperlinks.length; HyperIndex < HyperCount; HyperIndex++)
{
var Hyperlink = this.Content[HyperPos];
var Hyperlink = this.Content[Hyperlinks[HyperIndex]];
var HyperText = new CParagraphGetText();
Hyperlink.Get_Text( HyperText );
......@@ -198937,6 +199159,7 @@ Paragraph.prototype =
//-----------------------------------------------------------------------------------
Document_SetThisElementCurrent : function(bUpdateStates)
{
this.Parent.Update_ConentIndexing();
this.Parent.Set_CurrentElement( this.Index, bUpdateStates );
},
......@@ -198944,6 +199167,7 @@ Paragraph.prototype =
{
var Parent = this.Parent;
Parent.Update_ConentIndexing();
if ( docpostype_Content === Parent.CurPos.Type && false === Parent.Selection.Use && this.Index === Parent.CurPos.ContentPos && Parent.Content[this.Index] === this )
return this.Parent.Is_ThisElementCurrent();
......@@ -200591,6 +200815,7 @@ Paragraph.prototype =
Get_ParentObject_or_DocumentPos : function()
{
this.Parent.Update_ConentIndexing();
return this.Parent.Get_ParentObject_or_DocumentPos(this.Index);
},
......@@ -208547,7 +208772,7 @@ CHeaderFooter.prototype =
Set_Page : function(Page_abs)
{
if ( Page_abs !== this.RecalcInfo.CurPage )
if (Page_abs !== this.RecalcInfo.CurPage && undefined !== this.LogicDocument.Pages[Page_abs])
{
// Возможна ситуация, когда у нас колонтитул был рассчитан для заданной страницы, но на ней сейчас данный
// колонтитул не используется. Запрещаем менять у данного колонтитула текущую страницу на заданную.
......@@ -211334,6 +211559,8 @@ function CDocument(DrawingDocument)
this.NeedUpdateTarget = false;
this.ReindexStartPos = -1;
// Класс для работы с колонтитулами
this.HdrFtr = new CHeaderFooterController(this, this.DrawingDocument);
......@@ -211576,6 +211803,25 @@ CDocument.prototype =
return true;
},
Update_ConentIndexing : function()
{
if (-1 !== this.ReindexStartPos)
{
for (var Index = this.ReindexStartPos, Count = this.Content.length; Index < Count; Index++)
{
this.Content[Index].Index = Index;
}
this.ReindexStartPos = -1;
}
},
protected_ReindexContent : function(StartPos)
{
if (-1 === this.ReindexStartPos || this.ReindexStartPos > StartPos)
this.ReindexStartPos = StartPos;
},
Get_PageContentStartPos : function (PageIndex, ElementIndex)
{
if (undefined === ElementIndex && undefined !== this.Pages[PageIndex])
......@@ -212807,9 +213053,6 @@ CDocument.prototype =
{
// Обновляем курсор сначала, чтобы обновить текущую страницу
this.RecalculateCurPos();
this.Document_UpdateInterfaceState();
this.Document_UpdateRulersState();
this.NeedUpdateTarget = false;
}
},
......@@ -220216,8 +220459,6 @@ CDocument.prototype =
{
if (!window.USER_AGENT_SAFARI_MACOS)
{
this.Create_NewHistoryPoint();
window.GlobalPasteFlag = true;
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
//не возвращаем true чтобы не было preventDefault
......@@ -220226,8 +220467,6 @@ CDocument.prototype =
{
if (0 === window.GlobalPasteFlagCounter)
{
this.Create_NewHistoryPoint();
SafariIntervalFocus();
window.GlobalPasteFlag = true;
Editor_Paste(this.DrawingDocument.m_oWordControl.m_oApi, true);
......@@ -220909,7 +221148,6 @@ CDocument.prototype =
var Comment_X = this.Get_PageLimits(PageIndex).XLimit;
var Para = g_oTableId.Get_ById( Comment.StartId );
var TextTransform = Para.Get_ParentTextTransform();
if (TextTransform)
{
......@@ -221208,6 +221446,9 @@ CDocument.prototype =
// Проверим, что последний элемент не таблица
if ( type_Table == this.Content[this.Content.length - 1].GetType() )
this.Internal_Content_Add(this.Content.length, new Paragraph( this.DrawingDocument, this, 0, 0, 0, 0, 0 ) );
// Запоминаем, что нам нужно произвести переиндексацию элементов
this.protected_ReindexContent(Position);
},
Internal_Content_Remove : function(Position, Count)
......@@ -221253,6 +221494,9 @@ CDocument.prototype =
// Проверим не является ли рамкой последний параграф
this.Check_FramePrLastParagraph();
// Запоминаем, что нам нужно произвести переиндексацию элементов
this.protected_ReindexContent(Position);
return ChangePos;
},
......@@ -224878,6 +225122,8 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split,
this.m_oContentChanges = new CContentChanges(); // список изменений(добавление/удаление элементов)
this.StartState = null;
this.ReindexStartPos = -1;
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id );
......@@ -224954,7 +225200,24 @@ CDocumentContent.prototype =
// Данную функцию используют внутренние классы, для определения следующей позиции.
// Данный класс запрашивает следующую позицию у своего родителя.
Update_ConentIndexing : function()
{
if (-1 !== this.ReindexStartPos)
{
for (var Index = this.ReindexStartPos, Count = this.Content.length; Index < Count; Index++)
{
this.Content[Index].Index = Index;
}
this.ReindexStartPos = -1;
}
},
protected_ReindexContent : function(StartPos)
{
if (-1 === this.ReindexStartPos || this.ReindexStartPos > StartPos)
this.ReindexStartPos = StartPos;
},
Get_PageContentStartPos : function (PageNum)
{
......@@ -232805,6 +233068,8 @@ CDocumentContent.prototype =
// Проверим, что последний элемент не таблица
if ( false != bCheckTable && type_Table == this.Content[this.Content.length - 1].GetType() )
this.Internal_Content_Add(this.Content.length, new Paragraph( this.DrawingDocument, this, 0, 50, 50, this.XLimit, this.YLimit, this.bPresentation === true ) );
this.protected_ReindexContent(Position);
},
Internal_Content_Remove : function(Position, Count)
......@@ -232836,6 +233101,8 @@ CDocumentContent.prototype =
// Проверим, что последний элемент не таблица
if ( type_Table == this.Content[this.Content.length - 1].GetType() )
this.Internal_Content_Add(this.Content.length, new Paragraph( this.DrawingDocument, this, 0, 50, 50, this.XLimit, this.YLimit, this.bPresentation === true ) );
this.protected_ReindexContent(Position);
},
Clear_ContentChanges : function()
......@@ -234499,7 +234766,7 @@ function CTable(DrawingDocument, Parent, Inline, PageNum, X, Y, XLimit, YLimit,
this.Prev = null;
this.Next = null;
this.Index = -1;
this.Index = -1; // перед тем как пользоваться этим параметром нужно у родительского класса вызывать this.Parent.Update_ContentIndexing();
this.Inline = Inline;
this.Lock = new CLock();
......@@ -239009,6 +239276,7 @@ CTable.prototype =
Document_SetThisElementCurrent : function(bUpdateStates)
{
this.Parent.Update_ConentIndexing();
this.Parent.Set_CurrentElement( this.Index, bUpdateStates );
},
......@@ -291629,19 +291897,19 @@ CArrowDrawer.prototype.InitSize = function ( sizeW, sizeH, is_retina ) {
_len -= 2;
}
ctx_tInactive.putImageData( _data, 0, 0 );
ctx_tInactive.putImageData( _data, 0, -1 );
ctx_lInactive.translate( _radx - 1, _rady + 2 );
ctx_lInactive.translate( _radx, _rady + 1 );
ctx_lInactive.rotate( -Math.PI / 2 );
ctx_lInactive.translate( -_radx, -_rady );
ctx_lInactive.drawImage( this.ImageTop[index], 0, 0 );
ctx_rInactive.translate( _radx + 2, _rady + 1 );
ctx_rInactive.translate( _radx + 1, _rady );
ctx_rInactive.rotate( Math.PI / 2 );
ctx_rInactive.translate( -_radx, -_rady );
ctx_rInactive.drawImage( this.ImageTop[index], 0, 0 );
ctx_bInactive.translate( _radx + 1, _rady + 3 );
ctx_bInactive.translate( _radx + 1, _rady + 1 );
ctx_bInactive.rotate( Math.PI );
ctx_bInactive.translate( -_radx, -_rady );
ctx_bInactive.drawImage( this.ImageTop[index], 0, 0 );
......@@ -291662,13 +291930,13 @@ CArrowDrawer.prototype.drawArrow = function ( type, mode, ctx, w, h ) {
var img = this.ImageTop[mode],
x = 0, y = 0, is_vertical = true,
bottomRightDelta = 1,
xDeltaIMG = 0, yDeltaIMG = 0, xDeltaBORDER = 0.5, yDeltaBORDER = 2.5;
xDeltaIMG = 0, yDeltaIMG = 0, xDeltaBORDER = 0.5, yDeltaBORDER = 1.5;
switch ( type ) {
case ScrollArrowType.ARROW_LEFT:
{
x = 1;
y = -2;
y = -1;
is_vertical = false;
img = this.ImageLeft[mode];
break;
......@@ -291677,18 +291945,18 @@ CArrowDrawer.prototype.drawArrow = function ( type, mode, ctx, w, h ) {
{
is_vertical = false;
x = w - this.SizeW - bottomRightDelta;
y = -2;
y = -1;
img = this.ImageRight[mode];
break;
}
case ScrollArrowType.ARROW_BOTTOM:
{
y = h - this.SizeH - bottomRightDelta - 2;
y = h - this.SizeH - bottomRightDelta - 1;
img = this.ImageBottom[mode];
break;
}
default:
y = -1;
y = 0;
break;
}
......@@ -291698,7 +291966,7 @@ CArrowDrawer.prototype.drawArrow = function ( type, mode, ctx, w, h ) {
ctx.fillStyle = this.ColorBackNone;
ctx.fillRect( x + 0, y + 0, strokeW + xDeltaBORDER + 1, strokeH + yDeltaBORDER + 1 );
ctx.fillRect( x, y, strokeW + xDeltaBORDER + 1, strokeH + yDeltaBORDER + 1 );
ctx.beginPath();
switch ( mode ) {
......@@ -292093,7 +292361,7 @@ ScrollObject.prototype = {
if ( this.isVerticalScroll ) {
if ( this.settings.showArrows ) {
this.verticalTrackHeight = this.canvasH - this.arrowPosition * 2;
this.scroller.y = this.arrowPosition + 1;
this.scroller.y = this.arrowPosition;
}
else {
this.verticalTrackHeight = this.canvasH;
......@@ -292102,7 +292370,7 @@ ScrollObject.prototype = {
var percentInViewV;
percentInViewV = (this.maxScrollY + this.paneHeight ) / this.paneHeight;
this.scroller.h = Math.ceil( 1 / percentInViewV * this.verticalTrackHeight ) + 1;
this.scroller.h = Math.ceil( 1 / percentInViewV * this.verticalTrackHeight );
if ( this.scroller.h < this.settings.scrollerMinHeight )
this.scroller.h = this.settings.scrollerMinHeight;
......@@ -292112,7 +292380,7 @@ ScrollObject.prototype = {
if ( startpos ) {
this.scroller.y = startpos / this.scrollCoeff + this.arrowPosition;
}
this.dragMaxY = this.canvasH - this.arrowPosition - this.scroller.h;
this.dragMaxY = this.canvasH - this.arrowPosition - this.scroller.h + 1;
this.dragMinY = this.arrowPosition;
}
......@@ -292209,7 +292477,7 @@ ScrollObject.prototype = {
evt.scrollD = evt.scrollPositionY = that.scrollVCurrentY;
evt.maxScrollY = that.maxScrollY;
that._drawArrow();
// that._drawArrow();
that._draw();
that.handleEvents( "onscrollvertical", evt );
}
......@@ -292253,7 +292521,7 @@ ScrollObject.prototype = {
evt.scrollD = evt.scrollPositionX = that.scrollHCurrentX;
evt.maxScrollX = that.maxScrollX;
that._drawArrow();
// that._drawArrow();
that._draw();
that.handleEvents( "onscrollhorizontal", evt );
}
......@@ -292301,10 +292569,12 @@ ScrollObject.prototype = {
this.scroller.y = this.dragMaxY;
var arrow = this.settings.showArrows ? this.arrowPosition : 0;
if ( this.scroller.y + this.scroller.h > this.canvasH - arrow - 2 ) {
this.scroller.y -= Math.abs( this.canvasH - arrow - 2 - this.scroller.y - this.scroller.h );
if ( this.scroller.y + this.scroller.h > this.canvasH - arrow ) {
this.scroller.y -= Math.abs( this.canvasH - arrow - this.scroller.y - this.scroller.h );
}
this.scroller.y = Math.round(this.scroller.y);
if ( vend ) {
this.moveble = true;
}
......@@ -292325,10 +292595,12 @@ ScrollObject.prototype = {
this.scroller.y = this.dragMaxY;
var arrow = this.settings.showArrows ? this.arrowPosition : 0;
if ( this.scroller.y + this.scroller.h > this.canvasH - arrow - 2 ) {
this.scroller.y -= Math.abs( this.canvasH - arrow - 2 - this.scroller.y - this.scroller.h );
if ( this.scroller.y + this.scroller.h > this.canvasH - arrow ) {
this.scroller.y -= Math.abs( this.canvasH - arrow - this.scroller.y - this.scroller.h );
}
this.scroller.y = Math.round(this.scroller.y);
this._scrollV( this, {}, destY, false, false );
},
scrollByX:function ( delta ) {
......@@ -292359,6 +292631,13 @@ ScrollObject.prototype = {
else if ( this.scroller.x > this.dragMaxX )
this.scroller.x = this.dragMaxX;
var arrow = this.settings.showArrows ? this.arrowPosition : 0;
if ( this.scroller.x + this.scroller.w > this.canvasW - arrow ) {
this.scroller.x -= Math.abs( this.canvasW - arrow - this.scroller.x - this.scroller.w );
}
this.scroller.x = Math.round(this.scroller.x);
if ( hend ) {
this.moveble = true;
}
......@@ -292378,6 +292657,13 @@ ScrollObject.prototype = {
else if ( this.scroller.x > this.dragMaxX )
this.scroller.x = this.dragMaxX;
var arrow = this.settings.showArrows ? this.arrowPosition : 0;
if ( this.scroller.x + this.scroller.w > this.canvasW - arrow ) {
this.scroller.x -= Math.abs( this.canvasW - arrow - this.scroller.x - this.scroller.w );
}
this.scroller.x = Math.round(this.scroller.x);
this._scrollH( this, {}, destX, false, false );
},
scrollTo:function ( destX, destY ) {
......@@ -292652,13 +292938,13 @@ ScrollObject.prototype = {
if ( _y < arrow ) {
_y = arrow;
}
var _b = (that.scroller.y + that.scroller.h) >> 0;
var _b = Math.round(that.scroller.y + that.scroller.h)// >> 0;
if ( _b > (that.canvasH - arrow - 1) ) {
_b = that.canvasH - arrow - 1;
}
if ( _b > _y ) {
that.roundRect( that.scroller.x - 0.5, _y + 0.5, that.scroller.w - 1, _b - _y + 1 );
that.roundRect( that.scroller.x - 0.5, _y + 0.5, that.scroller.w - 1, that.scroller.h - 1, 0 );
}
}
else if ( that.isHorizontalScroll && that.maxScrollX != 0 ) {
......@@ -292668,11 +292954,11 @@ ScrollObject.prototype = {
}
var _r = (that.scroller.x + that.scroller.w) >> 0;
if ( _r > (that.canvasW - arrow - 2) ) {
_r = that.canvasW - arrow - 2;
_r = that.canvasW - arrow - 1;
}
if ( _r > _x ) {
that.roundRect( _x + 0.5, that.scroller.y - 0.5, _r - _x + 1, that.scroller.h - 1 );
that.roundRect( _x + 0.5, that.scroller.y - 0.5, that.scroller.w - 1, that.scroller.h - 1, 0 );
}
}
}
......@@ -292696,7 +292982,7 @@ ScrollObject.prototype = {
_h = this.canvasH - (_y << 1);
if ( _h > 0 ) {
this.context.rect( 0, _y, this.canvasW, _h + 1 );
this.context.rect( 0, _y, this.canvasW, _h/* + 1*/ );
}
}
else if ( this.isHorizontalScroll ) {
......@@ -292704,7 +292990,7 @@ ScrollObject.prototype = {
_w = this.canvasW - (_x << 1);
if ( _w > 0 ) {
this.context.rect( _x - 1, 0, _w + 1, this.canvasH );
this.context.rect( _x/* - 1*/, 0, _w /*+ 1*/, this.canvasH );
}
}
......@@ -343438,6 +343724,11 @@ var c_oAscBorderStyles = {
Medium : 12,
Thick : 13
};
var c_oAscBorderType = {
Hor : 1,
Ver : 2,
Diag : 3
};
// PageOrientation
var c_oAscPageOrientation = {
PagePortrait : 1,
......@@ -343484,8 +343775,7 @@ var c_oAscAsyncAction = {
DownloadAs : 6,
Print : 7, // конвертация в PDF и сохранение у пользователя
UploadImage : 8,
ApplyChanges : 9, // применение изменений от другого пользователя.
PrepareToSave : 10 // Подготовка к сохранению
ApplyChanges : 9 // применение изменений от другого пользователя.
};
//files type for Saving & DownloadAs
var c_oAscFileType = {
......@@ -347586,11 +347876,11 @@ function OnSave_Callback2(e)
editor.canSave = true;
editor.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
// Снимаем лок с функции сохранения на сервере
editor.CoAuthoringApi.unSaveChanges();
editor.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
// Обновляем состояние возможности сохранения документа
editor._onUpdateDocumentCanSave();
}
......@@ -347617,14 +347907,15 @@ asc_docs_api.prototype.asc_Save = function (isAutoSave)
asc_docs_api.prototype.asc_OnSaveEnd = function (isDocumentSaved) {
// Если не автосохранение, то не забываем закрыть Block-сообщение
if (!this.isAutoSave)
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
// if (!this.isAutoSave)
// this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
this.canSave = true;
this.isAutoSave = false;
this.CoAuthoringApi.unSaveChanges();
if (!isDocumentSaved)
this.CoAuthoringApi.disconnect();
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
// Обновляем состояние возможности сохранения документа
this._onUpdateDocumentCanSave();
};
......@@ -347640,85 +347931,85 @@ function safe_Apply_Changes()
}
}
function OnSave_Callback(e)
{
var nState;
if ( false == e["saveLock"] ) {
if (editor.isAutoSave) {
editor.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.PrepareToSave);
}
if ( c_oAscCollaborativeMarksShowType.LastChanges === editor.CollaborativeMarksShowType )
CollaborativeEditing.Clear_CollaborativeMarks();
// Принимаем чужие изменения
safe_Apply_Changes();
// Сохраняем файл на сервер
var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument);
if (undefined != window['qtDocBridge']) {
var data = oBinaryFileWriter.Write();
// push data to native QT code
window['qtDocBridge']['savedDocument'] (data);
} else {
/*var oAdditionalData = {};
oAdditionalData["c"] = "save";
oAdditionalData["id"] = documentId;
oAdditionalData["userid"] = documentUserId;
oAdditionalData["vkey"] = documentVKey;
oAdditionalData["outputformat"] = documentFormatSave;
if(c_oAscFileType.TXT == documentFormatSaveTxtCodepage)
oAdditionalData["codepage"] = documentFormatSaveTxtCodepage;
oAdditionalData["innersave"] = true;
var data = oBinaryFileWriter.Write();
oAdditionalData["savetype"] = "completeall";
////uncoment to save changes only instead send file complete
//var data = JSON.stringify( CollaborativeEditing.Get_SelfChanges() );
//oAdditionalData["savetype"] = "changes";
oAdditionalData["data"] = data;
sendCommand(editor, function(incomeObject){
if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject["data"], true);
}, oAdditionalData);*/
}
// Пересылаем свои изменения
CollaborativeEditing.Send_Changes();
//Обратно выставляем, что документ не модифицирован
editor.SetUnchangedDocument();
// Заканчиваем сохранение, т.к. мы хотим дать пользователю продолжать набирать документ
// Но сохранять до прихода ответа от сервера не сможет
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.PrepareToSave);
// Если не автосохранение, то продолжаем показывать Block-сообщение
if (!editor.isAutoSave)
editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
editor.asc_OnSaveEnd(true);
} else {
nState = editor.CoAuthoringApi.get_state();
if (3 === nState) {
// Отключаемся от сохранения, соединение потеряно
if (!editor.isAutoSave) {
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.PrepareToSave);
editor.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
}
editor.isAutoSave = false;
editor.canSave = true;
} else {
// Если автосохранение, то не будем ждать ответа, а просто перезапустим таймер на немного
if (editor.isAutoSave) {
editor.isAutoSave = false;
editor.canSave = true;
return;
}
setTimeout( function(){ editor.CoAuthoringApi.askSaveChanges( OnSave_Callback ); }, 1000 );
}
}
}
//_*function*_ OnSave_Callback(e)
//{
// var nState;
// if ( false == e["saveLock"] ) {
// if (editor.isAutoSave) {
// editor.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
// editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.PrepareToSave);
// }
//
// if ( c_oAscCollaborativeMarksShowType.LastChanges === editor.CollaborativeMarksShowType )
// CollaborativeEditing.Clear_CollaborativeMarks();
//
// // Принимаем чужие изменения
// safe_Apply_Changes();
//
// // Сохраняем файл на сервер
// var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument);
//
// if (undefined != window['qtDocBridge']) {
// var data = oBinaryFileWriter.Write();
// // push data to native QT code
// window['qtDocBridge']['savedDocument'] (data);
//
// } else {
// /*var oAdditionalData = {};
// oAdditionalData["c"] = "save";
// oAdditionalData["id"] = documentId;
// oAdditionalData["userid"] = documentUserId;
// oAdditionalData["vkey"] = documentVKey;
// oAdditionalData["outputformat"] = documentFormatSave;
// if(c_oAscFileType.TXT == documentFormatSaveTxtCodepage)
// oAdditionalData["codepage"] = documentFormatSaveTxtCodepage;
// oAdditionalData["innersave"] = true;
// var data = oBinaryFileWriter.Write();
// oAdditionalData["savetype"] = "completeall";
// ////uncoment to save changes only instead send file complete
// //var data = JSON.stringify( CollaborativeEditing.Get_SelfChanges() );
// //oAdditionalData["savetype"] = "changes";
// oAdditionalData["data"] = data;
// sendCommand(editor, function(incomeObject){
// if(null != incomeObject && "save" == incomeObject["type"])
// editor.processSavedFile(incomeObject["data"], true);
// }, oAdditionalData);*/
// }
//
// // Пересылаем свои изменения
// CollaborativeEditing.Send_Changes();
// //Обратно выставляем, что документ не модифицирован
// editor.SetUnchangedDocument();
//
// // Заканчиваем сохранение, т.к. мы хотим дать пользователю продолжать набирать документ
// // Но сохранять до прихода ответа от сервера не сможет
// editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.PrepareToSave);
// // Если не автосохранение, то продолжаем показывать Block-сообщение
// if (!editor.isAutoSave)
// editor.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Save);
// editor.asc_OnSaveEnd(true);
// } else {
// nState = editor.CoAuthoringApi.get_state();
// if (3 === nState) {
// // Отключаемся от сохранения, соединение потеряно
// if (!editor.isAutoSave) {
// editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.PrepareToSave);
// editor.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
// }
// editor.isAutoSave = false;
// editor.canSave = true;
// } else {
// // Если автосохранение, то не будем ждать ответа, а просто перезапустим таймер на немного
// if (editor.isAutoSave) {
// editor.isAutoSave = false;
// editor.canSave = true;
// return;
// }
//
// setTimeout( function(){ editor.CoAuthoringApi.askSaveChanges( OnSave_Callback ); }, 1000 );
// }
// }
//}
asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем число соответствующее своему формату.
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);
......@@ -351294,6 +351585,7 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function()
{
this.isPasteFonts_Images = false;
this.pasteImageMap = null;
History.Create_NewPoint();
this.pasteCallback();
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
......@@ -351519,6 +351811,7 @@ asc_docs_api.prototype.pre_Paste = function(_fonts, _images, callback)
{
// никаких евентов. ничего грузить не нужно. сделано для сафари под макОс.
// там при LongActions теряется фокус и вставляются пробелы
History.Create_NewPoint();
this.pasteCallback();
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
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