Commit d71b82c7 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49036 954022d7-b5bf-4e40-9824-e11837661b57
parent 97d5c7ab
......@@ -577,8 +577,14 @@ CDocument.prototype =
this.DrawingObjects.updateCharts();
// Останавливаем поиск
if ( null != this.SearchInfo.Id )
this.Search_Stop(true);
if ( this.SearchEngine.Count > 0 && false != this.SearchEngine.ClearOnRecalc )
{
this.SearchEngine.Clear();
editor.sync_SearchEndCallback();
this.DrawingDocument.ClearCachePages();
this.DrawingDocument.FirePaint();
}
// Обновляем позицию курсора
this.NeedUpdateTarget = true;
......@@ -729,10 +735,10 @@ CDocument.prototype =
Element.TurnOff_RecalcEvent();
var RecalcResult = recalcresult_NextElement;
var bFlowTable = false;
var bFlow = false;
if ( type_Table === Element.GetType() && true != Element.Is_Inline() )
{
bFlowTable = true;
bFlow = true;
if ( null === this.RecalcInfo.FlowObject )
{
if ( ( 0 === Index && 0 === PageIndex ) || Index != StartIndex )
......@@ -816,6 +822,244 @@ CDocument.prototype =
RecalcResult = recalcresult_NextElement;
}
}
else if ( type_Paragraph === Element.GetType() && true != Element.Is_Inline() )
{
bFlow = true;
if ( null === this.RecalcInfo.FlowObject )
{
var FramePr = Element.Get_FramePr();
// Рассчитаем количество подряд идущих параграфов с одинаковыми FramePr
var FlowCount = 1;
for ( var TempIndex = Index + 1; TempIndex < Count; TempIndex++ )
{
var TempElement = this.Content[TempIndex];
if ( type_Paragraph === TempElement.GetType() && true != TempElement.Is_Inline() )
{
var TempFramePr = TempElement.Get_FramePr();
if ( true === FramePr.Compare( TempFramePr ) )
FlowCount++;
else
break;
}
else
break;
}
// Сначала рассчитаем размер рамки
var FrameH = 0;
var FrameW = -1;
var Frame_XLimit = FramePr.Get_W();
var Frame_YLimit = FramePr.Get_H();
if ( undefined === Frame_XLimit )
Frame_XLimit = Page_Width - X_Left_Margin - X_Right_Margin;
if ( undefined === Frame_YLimit )
Frame_YLimit = Page_Height;
for ( var TempIndex = Index; TempIndex < Index + FlowCount; TempIndex++ )
{
var TempElement = this.Content[TempIndex];
// Получим параметры расположения рамки
TempElement.Set_DocumentIndex( TempIndex );
TempElement.Reset( 0, FrameH, Frame_XLimit, Frame_YLimit, PageIndex );
TempElement.Recalculate_Page( PageIndex );
FrameH = TempElement.Get_PageBounds( PageIndex - TempElement.Get_StartPage_Absolute()).Bottom;
}
if ( -1 === FrameW && 1 === FlowCount && 1 === Element.Lines.length )
{
FrameW = Element.Lines[0].Ranges[0].W;
var ParaPr = Element.Get_CompiledPr2(false).ParaPr;
FrameW += ParaPr.Ind.Left + ParaPr.Ind.FirstLine;
}
else if ( -1 === FrameW )
FrameW = Frame_XLimit;
var FrameHRule = ( undefined === FramePr.HRule ? heightrule_Auto : FramePr.HRule );
switch ( FrameHRule )
{
case heightrule_Auto : break;
case heightrule_AtLeast :
{
if ( FrameH < FramePr.H )
FrameH = FramePr.H;
break;
}
case heightrule_Exact:
{
FrameH = FramePr.H;
break;
}
}
// Теперь зная размеры рамки можем рассчитать ее позицию
var FrameHAnchor = ( FramePr.HAnchor === undefined ? c_oAscHAnchor.Page : FramePr.HAnchor );
var FrameVAnchor = ( FramePr.VAnchor === undefined ? c_oAscVAnchor.Page : FramePr.VAnchor );
// Рассчитаем положение по горизонтали
var FrameX = 0;
if ( undefined != FramePr.XAlign || undefined === FramePr.X )
{
var XAlign = c_oAscXAlign.Left;
if ( undefined != FramePr.XAlign )
XAlign = FramePr.XAlign;
switch ( FrameHAnchor )
{
case c_oAscHAnchor.Page :
{
switch ( XAlign )
{
case c_oAscXAlign.Inside :
case c_oAscXAlign.Outside :
case c_oAscXAlign.Left : FrameX = X_Left_Margin - FrameW; break;
case c_oAscXAlign.Right : FrameX = X_Right_Field; break;
case c_oAscXAlign.Center : FrameX = (Page_Width - FrameW) / 2; break;
}
break;
}
case c_oAscHAnchor.Text :
case c_oAscHAnchor.Margin :
{
switch ( XAlign )
{
case c_oAscXAlign.Inside :
case c_oAscXAlign.Outside :
case c_oAscXAlign.Left : FrameX = X_Left_Margin; break;
case c_oAscXAlign.Right : FrameX = X_Right_Field - FrameW; break;
case c_oAscXAlign.Center : FrameX = (X_Left_Field + X_Right_Field - FrameW) / 2; break;
}
break;
}
}
}
else
{
switch ( FrameHAnchor )
{
case c_oAscHAnchor.Page : FrameX = FramePr.X; break;
case c_oAscHAnchor.Text :
case c_oAscHAnchor.Margin : FrameX = X_Left_Margin + FramePr.X; break;
}
}
if ( FrameW + FrameX > Page_Width )
FrameX = Page_Width - FrameW;
if ( FrameX < 0 )
FrameX = 0;
// Рассчитаем положение по вертикали
var FrameY = 0;
if ( undefined != FramePr.YAlign )
{
var YAlign = FramePr.YAlign;
switch ( FrameVAnchor )
{
case c_oAscVAnchor.Page :
{
switch ( YAlign )
{
case c_oAscYAlign.Inside :
case c_oAscYAlign.Inline :
case c_oAscYAlign.Outside :
case c_oAscYAlign.Top : FrameY = 0; break;
case c_oAscYAlign.Bottom : FrameY = Page_Height - FrameH; break;
case c_oAscYAlign.Center : FrameY = (Page_Height - FrameH) / 2; break;
}
break;
}
case c_oAscVAnchor.Text :
{
FramePr = Y;
break;
}
case c_oAscVAnchor.Margin :
{
switch ( YAlign )
{
case c_oAscYAlign.Inside :
case c_oAscYAlign.Inline :
case c_oAscYAlign.Outside :
case c_oAscYAlign.Top : FrameY = Y_Top_Field; break;
case c_oAscYAlign.Bottom : FrameY = Y_Bottom_Field - FrameH; break;
case c_oAscYAlign.Center : FrameY = (Y_Top_Field + Y_Bottom_Field - FrameH) / 2; break;
}
break;
}
}
}
else
{
var FramePrY = 0;
if ( undefined != FramePr.Y )
FramePrY = FramePr.Y;
switch ( FrameVAnchor )
{
case c_oAscVAnchor.Page : FrameY = FramePrY; break;
case c_oAscVAnchor.Text : FrameY = FramePrY + Y; break;
case c_oAscVAnchor.Margin : FrameY = FramePrY + Y_Top_Field; break;
}
}
if ( FrameH + FrameY > Page_Height )
FrameY = Page_Height - FrameH;
if ( FrameY < 0 )
FrameY = 0;
for ( var TempIndex = Index; TempIndex < Index + FlowCount; TempIndex++ )
{
var TempElement = this.Content[TempIndex];
TempElement.Shift( 0, FrameX, FrameY );
}
var FrameDx = ( undefined === FramePr.HSpace ? 0 : FramePr.HSpace );
var FrameDy = ( undefined === FramePr.VSpace ? 0 : FramePr.VSpace );
this.DrawingObjects.addFloatTable( new CFlowParagraph( Element, FrameX, FrameY, FrameW, FrameH, FrameDx, FrameDy ) );
Index += FlowCount - 1;
if ( FrameY >= Y )
RecalcResult = recalcresult_NextElement;
else
{
this.RecalcInfo.FlowObjectPage = FlowCount;
this.RecalcInfo.FlowObjectPageBreakBefore = false;
this.RecalcInfo.FlowObject = Element;
RecalcResult = recalcresult_CurPage;
}
}
else if ( Element === this.RecalcInfo.FlowObject )
{
Index += this.RecalcInfo.FlowObjectPage - 1;
this.RecalcInfo.FlowObject = null;
this.RecalcInfo.FlowObjectPageBreakBefore = false;
this.RecalcInfo.FlowObjectPage = 0;
RecalcResult = recalcresult_NextElement;
}
else
{
// Пропускаем
RecalcResult = recalcresult_NextElement;
}
}
else
{
if ( ( 0 === Index && 0 === PageIndex ) || Index != StartIndex )
......@@ -862,7 +1106,7 @@ CDocument.prototype =
break;
}
if ( true != bFlowTable )
if ( true != bFlow )
{
var Bounds = Element.Get_PageBounds( PageIndex - Element.Get_StartPage_Absolute() );
Y = Bounds.Bottom;
......@@ -1079,14 +1323,12 @@ CDocument.prototype =
// Рисуем колонтитулы
if ( docpostype_HdrFtr === this.CurPos.Type )
{
pGraphics.put_GlobalAlpha(false);
var PageMetrics = this.Get_PageContentStartPos( nPageIndex );
pGraphics.DrawHeaderEdit( PageMetrics.Y, this.HdrFtr.Lock.Get_Type() );
pGraphics.DrawFooterEdit( PageMetrics.YLimit,this.HdrFtr.Lock.Get_Type() );
}
else
pGraphics.put_GlobalAlpha(true, 0.4);
pGraphics.Start_GlobalAlpha();
this.DrawingObjects.drawBehindDocHdrFtr( nPageIndex, pGraphics );
this.DrawingObjects.drawWrappingObjectsHdrFtr( nPageIndex, pGraphics );
......@@ -1097,7 +1339,7 @@ CDocument.prototype =
if ( docpostype_HdrFtr === this.CurPos.Type )
pGraphics.put_GlobalAlpha(true, 0.4);
else
pGraphics.put_GlobalAlpha(false);
pGraphics.End_GlobalAlpha();
this.DrawingObjects.drawBehindDoc( nPageIndex, pGraphics );
this.DrawingObjects.drawWrappingObjects( nPageIndex, pGraphics );
......@@ -1110,6 +1352,9 @@ CDocument.prototype =
}
this.DrawingObjects.drawBeforeObjects( nPageIndex, pGraphics );
if ( docpostype_HdrFtr === this.CurPos.Type )
pGraphics.put_GlobalAlpha(false, 1.0);
},*/
//**
......@@ -1168,47 +1413,57 @@ CDocument.prototype =
// новый параграф будет без списка).
if ( type_Paragraph == Item.GetType() )
{
// Создаем новый параграф
var NewParagraph = new Paragraph( this.DrawingDocument, this, 0, 0, 0, X_Left_Field, Y_Bottom_Field );
// Проверим позицию в текущем параграфе
if ( true === Item.Cursor_IsEnd() )
// Если текущий параграф пустой и с нумерацией, тогда удаляем нумерацию и отступы левый и первой строки
if ( undefined != Item.Numbering_Get() && true === Item.IsEmpty() )
{
Item.Numbering_Remove();
Item.Set_Ind( { FirstLine : undefined, Left : undefined, Right : Item.Pr.Ind.Right }, true );
}
else
{
var StyleId = Item.Style_Get();
var NextId = undefined;
// Создаем новый параграф
var NewParagraph = new Paragraph( this.DrawingDocument, this, 0, 0, 0, X_Left_Field, Y_Bottom_Field );
if ( undefined != StyleId )
// Проверим позицию в текущем параграфе
if ( true === Item.Cursor_IsEnd() )
{
NextId = this.Styles.Get_Next( StyleId );
var StyleId = Item.Style_Get();
var NextId = undefined;
if ( null === NextId )
NextId = StyleId;
}
if ( undefined != StyleId )
{
NextId = this.Styles.Get_Next( StyleId );
if ( null === NextId )
NextId = StyleId;
}
if ( StyleId === NextId )
{
// Продолжаем (в плане настроек) новый параграф
Item.Continue( NewParagraph );
}
else
{
// Простое добавление стиля, без дополнительных действий
if ( NextId === this.Styles.Get_Default_Paragraph() )
NewParagraph.Style_Remove();
if ( StyleId === NextId )
{
// Продолжаем (в плане настроек) новый параграф
Item.Continue( NewParagraph );
}
else
NewParagraph.Style_Add_Open( NextId );
{
// Простое добавление стиля, без дополнительных действий
if ( NextId === this.Styles.Get_Default_Paragraph() )
NewParagraph.Style_Remove();
else
NewParagraph.Style_Add_Open( NextId );
}
}
}
else
Item.Split( NewParagraph );
else
Item.Split( NewParagraph );
this.Internal_Content_Add( this.CurPos.ContentPos + 1, NewParagraph );
this.Internal_Content_Add( this.CurPos.ContentPos + 1, NewParagraph );
this.CurPos.ContentPos++;
this.CurPos.ContentPos++;
// Отмечаем, что последний измененный элемент - предыдущий параграф
this.ContentLastChangePos = this.CurPos.ContentPos - 1;
// Отмечаем, что последний измененный элемент - предыдущий параграф
this.ContentLastChangePos = this.CurPos.ContentPos - 1;
}
if ( false != bRecalculate )
{
......@@ -1540,6 +1795,25 @@ CDocument.prototype =
this.Document_UpdateRulersState();
},
Add_DropCap : function()
{
var NewParagraph = new Paragraph( this.DrawingDocument, this, 0, 0, 0, X_Right_Field, Y_Bottom_Field );
var OldParagraph = this.Content[this.CurPos.ContentPos];
OldParagraph.Cursor_MoveToStartPos();
OldParagraph.Cursor_MoveRight(1, false, false);
OldParagraph.Split(NewParagraph);
OldParagraph.CompiledPr.NeedRecalc = true;
OldParagraph.Pr.FramePr = new CFramePr();
OldParagraph.Pr.FramePr.Init_Default_DropCap(false);
OldParagraph.Select_All();
OldParagraph.Add( new ParaTextPr( { FontSize : 20 } ) );
this.Internal_Content_Add( this.CurPos.ContentPos + 1, NewParagraph );
this.Recalculate();
},
CheckRange : function(X0, Y0, X1, Y1, _Y0, _Y1, X_lf, X_rf, PageNum)
{
......@@ -1990,7 +2264,7 @@ CDocument.prototype =
{
this.CurPos.ContentPos = StartPos;
if ( Count < 0 && type_Table === this.Content[StartPos].GetType() && true != bOnTextAdd )
if ( Count < 0 && type_Table === this.Content[StartPos].GetType() && table_Selection_Cell === this.Content[StartPos].Selection.Type && true != bOnTextAdd )
{
return this.Table_RemoveRow();
}
......@@ -5096,6 +5370,66 @@ CDocument.prototype =
}
},
Set_ParagraphFramePr : function(FramePr, bDelete)
{
if ( docpostype_HdrFtr === this.CurPos.Type || docpostype_DrawingObjects === this.CurPos.Type )
{
// Никуда, кроме обычного параграфа в верхнем классе CDocument, добавить рамку нельзя
return;
}
else //if ( docpostype_Content === this.CurPos.Type )
{
if ( true === this.Selection.Use )
{
if ( selectionflag_Numbering === this.Selection.Flag )
return;
// Проверим, если у нас все выделенные элементы - параграфы, с одинаковыми настройками
// FramePr, тогда мы можем применить новую настройку FramePr
var StartPos = this.Selection.StartPos;
var EndPos = this.Selection.EndPos;
if ( StartPos > EndPos )
{
StartPos = this.Selection.EndPos;
EndPos = this.Selection.StartPos;
}
var Element = this.Content[StartPos];
if ( type_Paragraph != Element.GetType() || undefined === Element.Get_FramePr() )
return;
var FramePr = Element.Get_FramePr();
for ( var Pos = StartPos + 1; Pos < EndPos; Pos++ )
{
var TempElement = this.Content[Pos];
if ( type_Paragraph != TempElement.GetType() || undefined === TempElement.Get_FramePr() || true != FramePr.Compare( TempElement.Get_FramePr() ) )
return;
}
// Раз дошли до сюда, значит можно у всех выделенных параграфов менять настройку рамки
for ( var Pos = StartPos; Pos < EndPos; Pos++ )
{
this.Content[Pos].Set_FramePr(FramePr, bDelete);
}
}
else
{
var Element = this.Content[this.CurPos.ContentPos];
if ( type_Paragraph != Element.GetType() || undefined === Element.Get_FramePr() )
return;
Element.Set_FramePr(FramePr, bDelete);
}
}
this.Recalculate();
},
Paragraph_IncDecFontSize : function(bIncrease)
{
// Работаем с колонтитулом
......@@ -6569,8 +6903,15 @@ CDocument.prototype =
Selection_Is_TableBorderMove : function()
{
if ( null != this.Selection.Data && true === this.Selection.Data.TableBorder && type_Table == this.Content[this.Selection.Data.Pos].GetType() )
return true;
if ( docpostype_HdrFtr === this.CurPos.Type )
return this.HdrFtr.Selection_Is_TableBorderMove();
else if ( docpostype_DrawingObjects === this.CurPos.Type )
return this.DrawingObjects.selectionIsTableBorder();
else //if ( docpostype_Content === this.CurPos.Type )
{
if ( null != this.Selection.Data && true === this.Selection.Data.TableBorder && type_Table == this.Content[this.Selection.Data.Pos].GetType() )
return true;
}
return false;
},
......@@ -6583,7 +6924,7 @@ CDocument.prototype =
return this.HdrFtr.Selection_Check( X, Y, Page_Abs );
else if ( docpostype_DrawingObjects === this.CurPos.Type )
return this.DrawingObjects.selectionCheck( X, Y, Page_Abs );
else //if ( docpostype_Content === thsi.CurPos.Type )
else //if ( docpostype_Content === this.CurPos.Type )
{
if ( true === this.Selection.Use )
{
......@@ -6812,6 +7153,10 @@ CDocument.prototype =
if ( true === this.History.Is_ExtendDocumentToPos() )
this.History.Clear_Additional();
// Сбрасываем текущий элемент в поиске
if ( this.SearchEngine.Count > 0 )
this.SearchEngine.Reset_Current();
var bUpdateSelection = true;
var bRetValue = false;
......@@ -7447,7 +7792,7 @@ CDocument.prototype =
}
else if ( e.KeyCode == 88 && false === editor.isViewMode && true === e.CtrlKey ) // Ctrl + X - cut
{
if ( false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
if ( false === this.Document_Is_SelectionLocked(changestype_Paragraph_Content) && (window.USER_AGENT_SAFARI_MACOS !== true))
{
this.Create_NewHistoryPoint();
Editor_Copy(this.DrawingDocument.m_oWordControl.m_oApi, true);
......@@ -7634,6 +7979,10 @@ CDocument.prototype =
if ( PageIndex < 0 )
return;
// Сбрасываем текущий элемент в поиске
if ( this.SearchEngine.Count > 0 )
this.SearchEngine.Reset_Current();
// Обработка правой кнопки мыши происходит на событии MouseUp
if ( g_mouse_button_right === e.Button )
return;
......@@ -8408,11 +8757,29 @@ CDocument.prototype =
{
if ( true === this.Selection.Use )
{
if ( this.Selection.StartPos != this.Selection.EndPos )
Info.Set_MixedSelection();
if ( selectionflag_Numbering === this.Selection.Flag )
{
// Текстовые настройки применяем к конкретной нумерации
if ( !(null == this.Selection.Data || this.Selection.Data.length <= 0) )
{
var CurPara = this.Content[this.Selection.Data[0]];
for ( var Index = 0; Index < this.Selection.Data.length; Index++ )
{
if ( this.CurPos.ContentPos === this.Selection.Data[Index] )
CurPara = this.Content[this.Selection.Data[Index]];
}
CurPara.Get_SelectedElementsInfo(Info);
}
}
else
{
this.Content[this.Selection.StartPos].Get_SelectedElementsInfo(Info);
if ( this.Selection.StartPos != this.Selection.EndPos )
Info.Set_MixedSelection();
else
{
this.Content[this.Selection.StartPos].Get_SelectedElementsInfo(Info);
}
}
}
else
......@@ -9124,11 +9491,10 @@ CDocument.prototype =
this.History.Undo();
this.Recalculate( false, false, this.History.RecalculateData );
//**
//MathControl.Recalculate();
//this.Document_UpdateSelectionState();
//**
this.Document_UpdateInterfaceState();
},
......@@ -9142,7 +9508,7 @@ CDocument.prototype =
this.History.Redo();
this.Recalculate( false, false, this.History.RecalculateData );
//this.Document_UpdateSelectionState();
this.Document_UpdateSelectionState();
this.Document_UpdateInterfaceState();
},
......@@ -9215,19 +9581,9 @@ CDocument.prototype =
State.push( DocState );
return State;
},*/
//**
Get_SelectionState : function()
{
return MathControl.Get_SelectionState();
},
Set_SelectionState : function(State)
{
MathControl.Set_SelectionState(State);
},
//**
/*Set_SelectionState : function(State)
{
if ( docpostype_DrawingObjects === this.CurPos.Type )
this.DrawingObjects.resetSelection();
......@@ -9300,6 +9656,17 @@ CDocument.prototype =
}
},*/
//**
Get_SelectionState : function()
{
return MathControl.Get_SelectionState();
},
Set_SelectionState : function(State)
{
MathControl.Set_SelectionState(State);
},
//**
Undo : function(Data)
{
var Type = Data.Type;
......
......@@ -538,6 +538,10 @@ function asc_docs_api(name)
// Spell Checking
this.SpellCheckApi = new CSpellCheckApi();
this.isSpellCheckEnable = true;
// Chart
this.chartTranslate = new asc_CChartTranslate();
/**************************************/
// AutoSave
......@@ -1633,6 +1637,82 @@ CParagraphTabs.prototype.get_Tab = function (Index){ return this.Tabs[Index]; }
CParagraphTabs.prototype.add_Tab = function (Tab){ this.Tabs.push(Tab) }
CParagraphTabs.prototype.clear = function (){ this.Tabs.length = 0; }
function CParagraphFrame(obj)
{
if ( obj )
{
this.DropCap = ( dropcap_None === obj.DropCap ? c_oAscDropCap.None : ( dropcap_Drop === obj.DropCap ? c_oAscDropCap.Drop : ( dropcap_Margin === obj.DropCap ? c_oAscDropCap.Margin : undefined ) ) );
this.H = obj.H;
this.HAnchor = obj.HAnchor;
this.HRule = ( heightrule_AtLeast === obj.HRule ? linerule_AtLeast : ( heightrule_Auto === obj.HRule ? linerule_Auto : ( heightrule_Exact === obj.HRule ? linerule_Exact : undefined ) ) );
this.HSpace = obj.HSpace;
this.Lines = obj.Lines;
this.VAnchor = obj.VAnchor;
this.VSpace = obj.VSpace;
this.W = obj.W;
this.Wrap = ( wrap_Around === obj.Wrap ? true : ( wrap_None === obj.Wrap ? false : undefined ) );
this.X = obj.X;
this.XAlign = obj.XAlign;
this.Y = obj.Y;
this.YAlign = obj.YAlign;
}
else
{
this.DropCap = undefined;
this.H = undefined;
this.HAnchor = undefined;
this.HRule = undefined;
this.HSpace = undefined;
this.Lines = undefined;
this.VAnchor = undefined;
this.VSpace = undefined;
this.W = undefined;
this.Wrap = undefined;
this.X = undefined;
this.XAlign = undefined;
this.Y = undefined;
this.YAlign = undefined;
}
}
CParagraphFrame.prototype.get_DropCap = function () { return this.DropCap; }
CParagraphFrame.prototype.put_DropCap = function (v) { this.DropCap = v; }
CParagraphFrame.prototype.get_H = function () { return this.H; }
CParagraphFrame.prototype.put_H = function (v) { this.H = v; }
CParagraphFrame.prototype.get_HAnchor = function () { return this.HAnchor; }
CParagraphFrame.prototype.put_HAnchor = function (v) { this.HAnchor = v; }
CParagraphFrame.prototype.get_HRule = function () { return this.HRule; }
CParagraphFrame.prototype.put_HRule = function (v) { this.HRule = v; }
CParagraphFrame.prototype.get_HSpace = function () { return this.HSpace; }
CParagraphFrame.prototype.put_HSpace = function (v) { this.HSpace = v; }
CParagraphFrame.prototype.get_Lines = function () { return this.Lines; }
CParagraphFrame.prototype.put_Lines = function (v) { this.Lines = v; }
CParagraphFrame.prototype.get_VAnchor = function () { return this.VAnchor; }
CParagraphFrame.prototype.put_VAnchor = function (v) { this.VAnchor = v; }
CParagraphFrame.prototype.get_VSpace = function () { return this.VSpace; }
CParagraphFrame.prototype.put_VSpace = function (v) { this.VSpace = v; }
CParagraphFrame.prototype.get_W = function () { return this.W; }
CParagraphFrame.prototype.put_W = function (v) { this.W = v; }
CParagraphFrame.prototype.get_Wrap = function () { return this.Wrap; }
CParagraphFrame.prototype.put_Wrap = function (v) { this.Wrap = v; }
CParagraphFrame.prototype.get_X = function () { return this.X; }
CParagraphFrame.prototype.put_X = function (v) { this.X = v; }
CParagraphFrame.prototype.get_XAlign = function () { return this.XAlign; }
CParagraphFrame.prototype.put_XAlign = function (v) { this.XAlign = v; }
CParagraphFrame.prototype.get_Y = function () { return this.Y; }
CParagraphFrame.prototype.put_Y = function (v) { this.Y = v; }
CParagraphFrame.prototype.get_YAlign = function () { return this.YAlign; }
CParagraphFrame.prototype.put_YAlign = function (v) { this.YAlign = v; }
asc_docs_api.prototype.put_FramePr = function(Obj)
{
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
this.WordControl.m_oLogicDocument.Set_ParagraphFramePr( Obj );
}
}
function CParagraphProp (obj)
{
if (obj)
......@@ -1650,6 +1730,7 @@ function CParagraphProp (obj)
this.DefaultTab = Default_Tab_Stop;
this.Locked = (undefined != obj.Locked && null != obj.Locked ) ? obj.Locked : false;
this.CanAddTable = (undefined != obj.CanAddTable ) ? obj.CanAddTable : true;
this.FramePr = (undefined != obj.FramePr ) ? new CParagraphFrame( obj.FramePr ) : undefined;
this.Subscript = (undefined != obj.Subscript) ? obj.Subscript : undefined;
this.Superscript = (undefined != obj.Superscript) ? obj.Superscript : undefined;
......@@ -1743,6 +1824,8 @@ CParagraphProp.prototype.get_Tabs = function () { return this.Tabs; }
CParagraphProp.prototype.put_Tabs = function (v) { this.Tabs = v; }
CParagraphProp.prototype.get_DefaultTab = function () { return this.DefaultTab; }
CParagraphProp.prototype.put_DefaultTab = function (v) { this.DefaultTab = v; }
CParagraphProp.prototype.get_FramePr = function () { return this.FramePr; }
CParagraphProp.prototype.put_FramePr = function (v) { this.FramePr = v; }
// Paragraph properties
function CParagraphPropEx (obj)
......@@ -2662,69 +2745,61 @@ asc_docs_api.prototype.sync_ReturnHeadersCallback = function (headers){
Y: 0//координаты по OY начала последовательности на данной страницы
}
*/
asc_docs_api.prototype.startSearchText = function(what){// "what" means word(s) what we search
this._searchCur = 0;
this.sync_SearchStartCallback();
if (null != this.WordControl.m_oLogicDocument)
this.WordControl.m_oLogicDocument.Search_Start(what);
else
this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.StartSearch(what);
}
asc_docs_api.prototype.gotoSearchResultText = function(navigator){//переход к результату.
asc_docs_api.prototype.asc_findText = function(text, isNext, isMatchCase)
{
var SearchEngine = editor.WordControl.m_oLogicDocument.Search( text, { MatchCase : isMatchCase } );
this.WordControl.m_oDrawingDocument.CurrentSearchNavi = navigator;
this.WordControl.ToSearchResult();
}
asc_docs_api.prototype.stopSearchText = function(){
this.sync_SearchStopCallback();
var Id = this.WordControl.m_oLogicDocument.Search_GetId( isNext );
if (this.WordControl.m_oLogicDocument != null)
this.WordControl.m_oLogicDocument.Search_Stop();
else
this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.StopSearch();
}
if ( null != Id )
this.WordControl.m_oLogicDocument.Search_Select( Id );
// CSearchResult - returns result of searching
function CSearchResult (obj)
{
this.Object = obj;
return SearchEngine.Count;
}
CSearchResult.prototype.get_Text = function ()
asc_docs_api.prototype.asc_replaceText = function(text, replaceWith, isReplaceAll, isMatchCase)
{
return this.Object.text;
editor.WordControl.m_oLogicDocument.Search( text, { MatchCase : isMatchCase } );
if ( true === isReplaceAll )
this.WordControl.m_oLogicDocument.Search_Replace(replaceWith, true, -1);
else
{
var CurId = this.WordControl.m_oLogicDocument.SearchEngine.CurId;
var bDirection = this.WordControl.m_oLogicDocument.SearchEngine.Direction;
if ( -1 != CurId )
this.WordControl.m_oLogicDocument.Search_Replace(replaceWith, false, CurId);
var Id = this.WordControl.m_oLogicDocument.Search_GetId( bDirection );
if ( null != Id )
{
this.WordControl.m_oLogicDocument.Search_Select( Id );
return true;
}
return false;
}
}
CSearchResult.prototype.get_Type = function ()
asc_docs_api.prototype.asc_selectSearchingResults = function(bShow)
{
return this.Object.navigator.Type & 0xFF00;
this.WordControl.m_oLogicDocument.Search_Set_Selection(bShow);
}
CSearchResult.prototype.get_Navigator = function ()
asc_docs_api.prototype.asc_isSelectSearchingResults = function()
{
return this.Object.navigator;
return this.WordControl.m_oLogicDocument.Search_Get_Selection();
}
CSearchResult.prototype.put_Navigator = function (obj)
asc_docs_api.prototype.sync_ReplaceAllCallback = function(Count)
{
this.Object.navigator = obj;
this.asc_fireCallback("asc_onReplaceAll", Count);
}
CSearchResult.prototype.put_Text = function (obj)
asc_docs_api.prototype.sync_SearchEndCallback = function()
{
this.Object.text = obj;
}
// returns: CSearchResult
asc_docs_api.prototype.sync_SearchFoundCallback = function(obj){
this.asc_fireCallback("asc_onSearchFound", new CSearchResult(obj));
}
asc_docs_api.prototype.sync_SearchStartCallback = function(){
this.asc_fireCallback("asc_onSearchStart");
}
asc_docs_api.prototype.sync_SearchStopCallback = function(){
this.asc_fireCallback("asc_onSearchStop");
}
asc_docs_api.prototype.sync_SearchEndCallback = function(){
this.asc_fireCallback("asc_onSearchEnd");
}
/*----------------------------------------------------------------*/
......@@ -2761,7 +2836,7 @@ asc_docs_api.prototype.put_TextPrBold = function(value)
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
//this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Bold : value } ) );
//this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Bold : value } ) );
//**
MathControl.SetTxtPrp( { Bold : value } );
//**
......@@ -2772,7 +2847,7 @@ asc_docs_api.prototype.put_TextPrItalic = function(value)
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
//this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Italic : value } ) );
//this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Italic : value } ) );
//**
MathControl.SetTxtPrp( { Italic : value } );
//**
......@@ -5429,13 +5504,6 @@ asc_docs_api.prototype.asc_enableKeyEvents = function(value){
}
}
asc_docs_api.prototype.asc_findText = function (text, scanByRows, scanForward, isMatchCase, isWholeCell) {
// ToDo add code here
}
asc_docs_api.prototype.asc_replaceText = function (findWhat, replaceWith, isReplaceAll, isMatchCase, isWholeCell) {
// ToDo add code here
}
asc_docs_api.prototype.asyncServerIdStartLoaded = function()
{
this._coSpellCheckInit();
......
......@@ -156,17 +156,21 @@ CMathContent.prototype =
getRunPrp: function(pos)
{
var runPrp = new CMathTextPrp();
var rPrp = null;
if(this.content.length > 1)
{
if(pos == 0)
{
var rPrp = this.content[pos+1].value.getTxtPrp();
rPrp = this.content[pos+1].value.getTxtPrp();
runPrp.Merge(rPrp);
}
else
{
var rPrp = this.content[pos].value.getTxtPrp();
if(this.content[pos].value.empty) // возможность, когда в контенте один CEmpty исключили в начале
rPrp = this.content[pos-1].value.getTxtPrp();
else
rPrp = this.content[pos].value.getTxtPrp();
runPrp.Merge(rPrp);
}
}
......
......@@ -83,6 +83,9 @@
<script src="../Common/FontsFreeType/FontFile.js"></script>
<script src="../Common/FontsFreeType/FontManager.js"></script>
<script src="../Common/apiCommon.js"></script>
<script src="Drawing/Externals.js"></script>
<script src="Drawing/AllFonts.js"></script>
<!--<script src="Drawing/GlobalLoaders.js"></script>-->
......@@ -168,7 +171,6 @@
<script type="text/javascript" src="../Common/SerializeCommonWordExcel.js"></script>
<script type="text/javascript" src="Editor/SerializeCommon.js"></script>
<!---->
<script type = "text/javascript" src ="Math/print.js"></script>
......@@ -1356,6 +1358,19 @@
editor.Init();
//editor.LoadDocument();
window.addEventListener("message", function(event) {
// We only accept messages from ourselves
if (null == event || null == event.data || event.source !== window)
return;
var data = JSON.parse(event.data);
if (null != data && null != data["type"]) {
if (PostMessageType.ExtensionExist == data["type"]) {
editor.SetFontsPath(data["url"]);
}
}
}, false);
window.onresize = function()
{
if (false === editor.bInit_word_control)
......@@ -2166,6 +2181,162 @@
</div>
</div>
</div>
<div style="float:left;border-top: 2px ridge silver;width:300px;" id="prFramePr">
<div style="float:left;width:300px;height:25px;text-align: center;">Frame Properties</div>
<div style="float:left;width:300px;border-top: 2px ridge silver;padding:2px">
<div id="prWrapNone_div" style="float:left;width:54px;height:54px;margin-left:64px" onmousedown="ParagraphFrame_OnWrapChange(c_oAscWrapStyle2.TopAndBottom)">
<img id="prWrapNone" src="menu/img/Wrap_TopAndBottom.PNG" title="None"/>
</div>
<div id="prWrapAround_div" style="float:left;width:54px;height:54px;margin-left:64px" onmousedown="ParagraphFrame_OnWrapChange(c_oAscWrapStyle2.Square)">
<img id="prWrapAround" src="menu/img/Wrap_Square.png" title="Square"/>
</div>
</div>
<div style="float:left;width:300px;border-top: 2px ridge silver;padding:2px">
<div style="float:left;width:300px">
<div style="float:left;width:75px;text-align: right;padding-right:5px">
Width
</div>
<div style="float:left;width:80px">
<select id="prFrameWidthType" style="width:80px" onchange="ParagraphFrame_OnChangeWidthType(this.selectedIndex)">
<option value="0">Auto</option>
<option value="1">Exact</option>
</select>
</div>
<div style="float:left;width:140px;">
<div style="float:left;width:55px;text-align: right;padding-right:5px">
Value
</div>
<div style="float:left;width:80px">
<input id="prFrameWidthValue" style="width:61px;"/>
</div>
</div>
</div>
<div style="float:left;width:300px">
<div style="float:left;width:75px;text-align: right;padding-right:5px">
Height
</div>
<div style="float:left;width:80px">
<select id="prFrameHeightType" style="width:80px" onchange="ParagraphFrame_OnChangeHeightType(this.selectedIndex)">
<option value="0">Auto</option>
<option value="1">At Least</option>
<option value="2">Exact</option>
</select>
</div>
<div style="float:left;width:140px;">
<div style="float:left;width:55px;text-align: right; padding-right:5px">
Value
</div>
<div style="float:left;width:80px">
<input id="prFrameHeightValue" style="width:61px;"/>
</div>
</div>
</div>
</div>
<div style="float:left;width:300px;">
<div style="float:left;width:300px;border-top: 2px ridge silver;">Horizontal position</div>
<div style="float:left;width:300px">
<div style="float:left;width:300px">
<div style="float:left;width:80px">
<div style="float:left;width:80px">
<input id="prFramePositionHAlignRadio" type="radio" onchange="ParagraphFrame_UpdatePositionH()" name="prFramePosH"/>Align
</div>
<div style="float:left;width:80px">
<input id="prFramePositionHPosRadio" type="radio" onchange="ParagraphFrame_UpdatePositionH()" name="prFramePosH"/>Position
</div>
</div>
<div style="float:left;width:80px">
<div style="float:left;width:80px">
<select id="prFramePositionHAlignValueCombo">
<option value="0">Left</option>
<option value="1">Center</option>
<option value="2">Right</option>
</select>
</div>
<div style="float:left;width:80px">
<input id="prFramePositionHPosValueCombo" style="width:61px;"/>
</div>
</div>
<div style="float:left;width:140px">
<div style="float:left;width:140px">
<select id="prFramePositionHAlignTypeCombo">
<option value="0">Margin</option>
<option value="1">Page</option>
<option value="2">Column</option>
</select>
</div>
<div style="float:left;width:140px">
<select id="prFramePositionHPosTypeCombo">
<option value="0">Margin</option>
<option value="1">Page</option>
<option value="2">Column</option>
</select>
</div>
</div>
</div>
</div>
<div style="float:left;width:140px;margin-left: 160px">
<div style="float:left;width:55px;text-align: right; padding-right:5px">
HSpace
</div>
<div style="float:left;width:80px">
<input id="prFrameHSpace" style="width:61px;"/>
</div>
</div>
<div style="float:left;width:300px;border-top: 2px ridge silver;">Vertical position</div>
<div style="float:left;width:300px;">
<div style="float:left;width:300px">
<div style="float:left;width:80px">
<div style="float:left;width:80px">
<input id="prFramePositionVAlignRadio" type="radio" onchange="ParagraphFrame_UpdatePositionV()" name="imgPosV"/>Align
</div>
<div style="float:left;width:80px">
<input id="prFramePositionVPosRadio" type="radio" onchange="ParagraphFrame_UpdatePositionV()" name="imgPosV"/>Position
</div>
</div>
<div style="float:left;width:80px">
<div style="float:left;width:80px">
<select id="prFramePositionVAlignValueCombo">
<option value="0">Top</option>
<option value="1">Center</option>
<option value="2">Bottom</option>
</select>
</div>
<div style="float:left;width:80px">
<input id="prFramePositionVPosValueCombo" style="width:61px;"/>
</div>
</div>
<div style="float:left;width:140px">
<div style="float:left;width:140px">
<select id="prFramePositionVAlignTypeCombo">
<option value="0">Margin</option>
<option value="1">Page</option>
<option value="2">Text</option>
</select>
</div>
<div style="float:left;width:140px">
<select id="prFramePositionVPosTypeCombo">
<option value="0">Margin</option>
<option value="1">Page</option>
<option value="2">Text</option>
</select>
</div>
</div>
</div>
</div>
<div style="float:left;width:140px;margin-left: 160px">
<div style="float:left;width:55px;text-align: right; padding-right:5px">
VSpace
</div>
<div style="float:left;width:80px">
<input id="prFrameVSpace" style="width:61px;"/>
</div>
</div>
</div>
<div style="float:left;width:150px">
<input id="prFrameApply" type="button" value="Apply FramePr"/>
</div>
</div>
<div style="float:left;border-top: 2px ridge silver;width:300px;text-align: center;">
<b>Text</b>
</div>
......@@ -2205,7 +2376,6 @@
<input id="prTextPosition" style="width:30px;" value="0"/> Position
</div>
</div>
<div style="float:left;border-top: 2px ridge silver;width:300px">
<div style="float:left;width:300px;height:25px;padding-left: 10px">Default language</div>
<div style="float:left;width:300px">
......@@ -3180,6 +3350,11 @@
<div style="float:left;width:430px;border-bottom: 2px ridge silver;">
<input id="searchMatchCase" style="flaot:left;" type="checkbox" value="false"/> Match case
</div>
<div style="float:left;width:430px;border-bottom: 2px ridge silver;">
<input id="searchPrev" style="flaot:left;" type="button" value="Prev" />
<input id="searchNext" style="flaot:left;" type="button" value="Next" />
<input id="searchSelect" style="flaot:left;" type="button" value="Select All" />
</div>
<div style="float:left;width:430px;border-bottom: 4px ridge silver;">
<input id="replaceString" style="margin-left:10px;float:left;width:260px;"/>
<input id="replaceStringButton" style="flaot:left;" type="button" value="Replace"/>
......
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