Commit 3d544d84 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Переделан механизм поиска: добавлены команды "найти далее", "найти...

Переделан механизм поиска: добавлены команды "найти далее", "найти предыдущий". Доработан тестовый пример. 

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49011 954022d7-b5bf-4e40-9824-e11837661b57
parent 16abe325
......@@ -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;
......@@ -7117,6 +7123,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;
......@@ -7939,6 +7949,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;
......
......@@ -254,6 +254,9 @@ CHeaderFooter.prototype =
Set_CurrentElement : function()
{
this.Parent.CurHdrFtr = this;
this.LogicDocument.CurPos.Type = docpostype_HdrFtr;
this.LogicDocument.Document_UpdateInterfaceState();
this.LogicDocument.Document_UpdateRulersState();
this.LogicDocument.Document_UpdateSelectionState();
......
......@@ -3943,6 +3943,7 @@ Paragraph.prototype =
var CollaborativeChanges = 0;
var StartPagePos = this.Lines[_Page.StartLine].StartPos;
var DrawSearch = editor.WordControl.m_oLogicDocument.SearchEngine.Selection;
// в PDF не рисуем метки совместного редактирования
if ( undefined === pGraphics.RENDERER_PDF_FLAG )
......@@ -4006,6 +4007,8 @@ Paragraph.prototype =
var Item = this.Content[Pos];
var bSearchResult = false;
if ( true === DrawSearch )
{
for ( var SId in this.SearchResults )
{
var SResult = this.SearchResults[SId];
......@@ -4015,6 +4018,7 @@ Paragraph.prototype =
break;
}
}
}
if ( Pos === this.Numbering.Pos )
{
......
......@@ -25,6 +25,10 @@ function CDocumentSearch()
this.Id = 0;
this.Count = 0;
this.Elements = new Array();
this.CurId = -1;
this.Direction = true; // направление true - вперед, false - назад
this.ClearOnRecalc = true; // Флаг, говорящий о том, запустился ли пересчет из-за Replace
this.Selection = false;
}
CDocumentSearch.prototype =
......@@ -67,9 +71,16 @@ CDocumentSearch.prototype =
Paragraph.Document_SetThisElementCurrent();
}
this.CurId = Id;
}
},
Reset_Current : function()
{
this.CurId = -1;
},
Replace : function(NewStr, Id)
{
var Para = this.Elements[Id];
......@@ -95,6 +106,20 @@ CDocumentSearch.prototype =
}
Para.RecalcInfo.Set_Type_0( pararecalc_0_All );
// Удаляем запись о данном элементе
this.Count--;
delete Para.SearchResults[Id];
var ParaCount = 0;
for ( var TempId in Para.SearchResults )
{
ParaCount++;
break;
}
if ( ParaCount <= 0 )
delete this.Elements[Id];
}
}
},
......@@ -112,6 +137,13 @@ CDocumentSearch.prototype =
this.Replace( NewStr, Id );
}
this.Clear();
},
Set_Direction : function(bDirection)
{
this.Direction = bDirection;
}
};
......@@ -124,9 +156,6 @@ CDocument.prototype.Search = function(Str, Props)
this.SearchEngine.Clear();
// Поиск в колонтитулах
this.HdrFtr.Search( Str, Props, this.SearchEngine );
// Поиск в основном документе
var Count = this.Content.length;
for ( var Index = 0; Index < Count; Index++ )
......@@ -134,6 +163,9 @@ CDocument.prototype.Search = function(Str, Props)
this.Content[Index].Search( Str, Props, this.SearchEngine, search_Common );
}
// Поиск в колонтитулах
this.HdrFtr.Search( Str, Props, this.SearchEngine );
this.DrawingDocument.ClearCachePages();
this.DrawingDocument.FirePaint();
......@@ -175,15 +207,27 @@ CDocument.prototype.Search_Replace = function(NewStr, bAll, Id)
{
History.Create_NewPoint();
var AllCount = this.SearchEngine.Count;
if ( true === bAll )
this.SearchEngine.Replace_All( NewStr );
else
this.SearchEngine.Replace( NewStr, Id );
this.SearchEngine.ClearOnRecalc = false;
this.Recalculate();
this.SearchEngine.ClearOnRecalc = true;
this.RecalculateCurPos();
bResult = true;
if ( true === bAll )
editor.sync_ReplaceAllCallback(AllCount);
}
else
{
if ( true === bAll )
editor.sync_ReplaceAllCallback(0);
}
this.Document_UpdateInterfaceState();
......@@ -193,6 +237,88 @@ CDocument.prototype.Search_Replace = function(NewStr, bAll, Id)
return bResult;
};
CDocument.prototype.Search_GetId = function(bNext)
{
this.SearchEngine.Set_Direction( bNext );
// Получим Id найденного элемента
if ( docpostype_DrawingObjects === this.CurPos.Type )
{
var ParaDrawing = this.DrawingObjects.getMajorParaDrawing();
ParaDrawing.Parent.Document_SetThisElementCurrent();
}
if ( docpostype_Content === this.CurPos.Type )
{
var Id = null;
var Pos = this.CurPos.ContentPos;
if ( true === this.Selection.Use && selectionflag_Common === this.Selection.Flag )
Pos = ( true === bNext ? Math.max(this.Selection.StartPos, this.Selection.EndPos) : Math.min(this.Selection.StartPos, this.Selection.EndPos) );
if ( true === bNext )
{
Id = this.Content[Pos].Search_GetId(true, true);
if ( null != Id )
return Id;
Pos++;
var Count = this.Content.length;
while ( Pos < Count )
{
Id = this.Content[Pos].Search_GetId(true, false);
if ( null != Id )
return Id;
Pos++;
}
}
else
{
Id = this.Content[Pos].Search_GetId(false, true);
if ( null != Id )
return Id;
Pos--;
while ( Pos >= 0 )
{
Id = this.Content[Pos].Search_GetId(false, false);
if ( null != Id )
return Id;
Pos--;
}
}
}
else if ( docpostype_HdrFtr === this.CurPos.Type )
{
return this.HdrFtr.Search_GetId( bNext );
}
};
CDocument.prototype.Search_Set_Selection = function(bSelection)
{
var OldValue = this.SearchEngine.Selection;
if ( OldValue === bSelection )
return;
this.SearchEngine.Selection = bSelection;
this.DrawingDocument.ClearCachePages();
this.DrawingDocument.FirePaint();
};
CDocument.prototype.Search_Get_Selection = function()
{
return this.SearchEngine.Selection;
};
//----------------------------------------------------------------------------------------------------------------------
// CDocumentContent
//----------------------------------------------------------------------------------------------------------------------
......@@ -206,6 +332,93 @@ CDocumentContent.prototype.Search = function(Str, Props, SearchEngine, Type)
}
};
CDocumentContent.prototype.Search_GetId = function(bNext, bCurrent)
{
if ( true === bCurrent )
{
// Получим Id найденного элемента
if ( docpostype_DrawingObjects === this.CurPos.Type )
{
var ParaDrawing = this.LogicDocument.DrawingObjects.getMajorParaDrawing();
ParaDrawing.Parent.Document_SetThisElementCurrent();
}
var Id = null;
var Pos = this.CurPos.ContentPos;
if ( true === this.Selection.Use && selectionflag_Common === this.Selection.Flag )
Pos = ( true === bNext ? Math.max(this.Selection.StartPos, this.Selection.EndPos) : Math.min(this.Selection.StartPos, this.Selection.EndPos) );
if ( true === bNext )
{
Id = this.Content[Pos].Search_GetId(true, true);
if ( null != Id )
return Id;
Pos++;
var Count = this.Content.length;
while ( Pos < Count )
{
Id = this.Content[Pos].Search_GetId(true, false);
if ( null != Id )
return Id;
Pos++;
}
}
else
{
Id = this.Content[Pos].Search_GetId(false, true);
if ( null != Id )
return Id;
Pos--;
while ( Pos >= 0 )
{
Id = this.Content[Pos].Search_GetId(false, false);
if ( null != Id )
return Id;
Pos--;
}
}
}
else
{
var Count = this.Content.length;
if ( true === bNext )
{
var Pos = 0;
while ( Pos < Count )
{
Id = this.Content[Pos].Search_GetId(true, false);
if ( null != Id )
return Id;
Pos++;
}
}
else
{
var Pos = Count - 1;
while ( Pos >= 0 )
{
Id = this.Content[Pos].Search_GetId(false, false);
if ( null != Id )
return Id;
Pos--;
}
}
}
return null;
};
//----------------------------------------------------------------------------------------------------------------------
// CHeaderFooter
//----------------------------------------------------------------------------------------------------------------------
......@@ -214,6 +427,11 @@ CHeaderFooter.prototype.Search = function(Str, Props, SearchEngine, Type)
this.Content.Search( Str, Props, SearchEngine, Type );
};
CHeaderFooter.prototype.Search_GetId = function(bNext, bCurrent)
{
return this.Content.Search_GetId( bNext, bCurrent );
};
//----------------------------------------------------------------------------------------------------------------------
// CHeaderFooterController
//----------------------------------------------------------------------------------------------------------------------
......@@ -304,6 +522,91 @@ CHeaderFooterController.prototype.Search = function(Str, Props, SearchEngine)
}
};
CHeaderFooterController.prototype.Search_GetId = function(bNext)
{
var HdrFtrs = new Array();
var CurPos = -1;
if ( null != this.Content[0].Header.First )
{
HdrFtrs.push( this.Content[0].Header.First );
if ( this.CurHdrFtr === this.Content[0].Header.First )
CurPos = HdrFtrs.length - 1;
}
if ( null != this.Content[0].Footer.First )
{
HdrFtrs.push( this.Content[0].Footer.First );
if ( this.CurHdrFtr === this.Content[0].Footer.First )
CurPos = HdrFtrs.length - 1;
}
if ( null === Id && null != this.Content[0].Header.Even && this.Content[0].Header.First != this.Content[0].Header.Even )
{
HdrFtrs.push( this.Content[0].Header.Even );
if ( this.CurHdrFtr === this.Content[0].Header.Even )
CurPos = HdrFtrs.length - 1;
}
if ( null === Id && null != this.Content[0].Footer.Even && this.Content[0].Footer.First != this.Content[0].Footer.Even )
{
HdrFtrs.push( this.Content[0].Footer.Even );
if ( this.CurHdrFtr === this.Content[0].Footer.Even )
CurPos = HdrFtrs.length - 1;
}
if ( null === Id && null != this.Content[0].Header.Odd && this.Content[0].Header.First != this.Content[0].Header.Odd && this.Content[0].Header.First != this.Content[0].Header.Odd )
{
HdrFtrs.push( this.Content[0].Header.Odd );
if ( this.CurHdrFtr === this.Content[0].Header.Odd )
CurPos = HdrFtrs.length - 1;
}
if ( null === Id && null != this.Content[0].Footer.Odd && this.Content[0].Footer.First != this.Content[0].Footer.Odd && this.Content[0].Footer.First != this.Content[0].Footer.Odd )
{
HdrFtrs.push( this.Content[0].Footer.Odd );
if ( this.CurHdrFtr === this.Content[0].Footer.Odd )
CurPos = HdrFtrs.length - 1;
}
var Count = HdrFtrs.length;
if ( -1 != CurPos )
{
var Id = this.CurHdrFtr.Search_GetId( bNext, true );
if ( null != Id )
return Id;
if ( true === bNext )
{
for ( var Index = CurPos + 1; Index < Count; Index++ )
{
Id = HdrFtrs[Index].Search_GetId( bNext, false );
if ( null != Id )
return Id;
}
}
else
{
for ( var Index = CurPos - 1; Index >= 0; Index-- )
{
Id = HdrFtrs[Index].Search_GetId( bNext, false );
if ( null != Id )
return Id;
}
}
}
return null;
};
//----------------------------------------------------------------------------------------------------------------------
// CTable
//----------------------------------------------------------------------------------------------------------------------
......@@ -321,6 +624,99 @@ CTable.prototype.Search = function(Str, Props, SearchEngine, Type)
}
};
CTable.prototype.Search_GetId = function(bNext, bCurrent)
{
if ( true === bCurrent )
{
var Id = null;
var CurRow = 0;
var CurCell = 0;
if ( true === this.Selection.Use && table_Selection_Cell === this.Selection.Type )
{
var Pos = ( true === bNext ? this.Selection.Data[this.Selection.Data.length - 1] : this.Selection.Data[0] );
CurRow = Pos.Row;
CurCell = Pos.CurCell;
}
else
{
Id = this.CurCell.Content.Search_GetId(bNext, true);
CurRow = this.CurCell.Row.Index;
CurCell = this.CurCell.Index;
}
var Rows_Count = this.Content.length;
if ( true === bNext )
{
for ( var _CurRow = CurRow; _CurRow < Rows_Count; _CurRow++ )
{
var Row = this.Content[_CurRow];
var Cells_Count = Row.Get_CellsCount();
var StartCell = ( _CurRow === CurRow ? CurCell + 1 : 0 );
for ( var _CurCell = StartCell; _CurCell < Cells_Count; _CurCell++ )
{
var Cell = Row.Get_Cell(_CurCell);
Id = Cell.Content.Search_GetId( true, false );
if ( null != Id )
return Id;
}
}
}
else
{
for ( var _CurRow = CurRow; _CurRow >= 0; _CurRow-- )
{
var Row = this.Content[_CurRow];
var Cells_Count = Row.Get_CellsCount();
var StartCell = ( _CurRow === CurRow ? CurCell - 1 : Cells_Count - 1 );
for ( var _CurCell = StartCell; _CurCell >= 0; _CurCell-- )
{
var Cell = Row.Get_Cell(_CurCell);
Id = Cell.Content.Search_GetId( true, false );
if ( null != Id )
return Id;
}
}
}
}
else
{
var Rows_Count = this.Content.length;
if ( true === bNext )
{
for ( var _CurRow = 0; _CurRow < Rows_Count; _CurRow++ )
{
var Row = this.Content[_CurRow];
var Cells_Count = Row.Get_CellsCount();
for ( var _CurCell = 0; _CurCell < Cells_Count; _CurCell++ )
{
var Cell = Row.Get_Cell(_CurCell);
Id = Cell.Content.Search_GetId( true, false );
if ( null != Id )
return Id;
}
}
}
else
{
for ( var _CurRow = Rows_Count - 1; _CurRow >= 0; _CurRow-- )
{
var Row = this.Content[_CurRow];
var Cells_Count = Row.Get_CellsCount();
for ( var _CurCell = Cells_Count - 1; _CurCell >= 0; _CurCell-- )
{
var Cell = Row.Get_Cell(_CurCell);
Id = Cell.Content.Search_GetId( true, false );
if ( null != Id )
return Id;
}
}
}
}
return Id;
};
//----------------------------------------------------------------------------------------------------------------------
// Paragraph
//----------------------------------------------------------------------------------------------------------------------
......@@ -472,3 +868,51 @@ Paragraph.prototype.Search = function(Str, Props, SearchEngine, Type)
this.SearchResults[FoundId].ResultStr = ResultStr;
}
};
Paragraph.prototype.Search_GetId = function(bNext, bCurrent)
{
var Pos = -1;
if ( true === bCurrent )
{
Pos = this.CurPos.ContentPos;
if ( true == this.Selection.Use )
Pos = ( true === bNext ? Math.max(this.Selection.StartPos,this.Selection.EndPos) : Math.min(this.Selection.StartPos,this.Selection.EndPos) );
}
else
{
if ( true === bNext )
Pos = -1;
else
Pos = this.Content.length - 1;
}
var NearElementId = null;
var NearElementPos = -1;
if ( true === bNext )
{
for ( var ElemId in this.SearchResults )
{
var Element = this.SearchResults[ElemId];
if ( Pos < Element.StartPos && ( -1 === NearElementPos || NearElementPos > Element.StartPos ) )
{
NearElementPos = Element.StartPos;
NearElementId = ElemId;
}
}
}
else
{
for ( var ElemId in this.SearchResults )
{
var Element = this.SearchResults[ElemId];
if ( Pos >= Element.EndPos && ( -1 === NearElementPos || NearElementPos < Element.EndPos ) )
{
NearElementPos = Element.EndPos;
NearElementId = ElemId;
}
}
}
return NearElementId;
};
\ No newline at end of file
......@@ -2144,6 +2144,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>
......@@ -2794,6 +2950,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"/>
......
......@@ -1631,6 +1631,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)
......@@ -1648,6 +1724,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;
......@@ -1741,6 +1818,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)
......@@ -2660,69 +2739,71 @@ 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, isMatchCase)
{
var SearchEngine = editor.WordControl.m_oLogicDocument.Search( text, { MatchCase : isMatchCase } );
var Id = this.WordControl.m_oLogicDocument.Search_GetId( true );
this.WordControl.m_oDrawingDocument.CurrentSearchNavi = navigator;
this.WordControl.ToSearchResult();
}
asc_docs_api.prototype.stopSearchText = function(){
this.sync_SearchStopCallback();
if ( null != Id )
this.WordControl.m_oLogicDocument.Search_Select( Id );
if (this.WordControl.m_oLogicDocument != null)
this.WordControl.m_oLogicDocument.Search_Stop();
else
this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.StopSearch();
return SearchEngine.Count;
}
// CSearchResult - returns result of searching
function CSearchResult (obj)
asc_docs_api.prototype.asc_findForward = function(isNext)
{
this.Object = obj;
var Id = this.WordControl.m_oLogicDocument.Search_GetId( isNext );
if ( null != Id )
{
this.WordControl.m_oLogicDocument.Search_Select( Id );
return true;
}
return false;
}
CSearchResult.prototype.get_Text = function ()
asc_docs_api.prototype.asc_replaceText = function(replaceWith, isReplaceAll)
{
return this.Object.text;
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");
}
/*----------------------------------------------------------------*/
......@@ -5418,13 +5499,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();
......
......@@ -354,3 +354,10 @@ var c_oAscLineBeginSize = {
var TABLE_STYLE_WIDTH_PIX = 70;
var TABLE_STYLE_HEIGHT_PIX = 50;
var c_oAscDropCap =
{
None : 0,
Drop : 1,
Margin : 2
};
\ No newline at end of file
......@@ -17,6 +17,7 @@ var g_arrLockedInfo = new Array();
var g_oTextPr = new Object(); // CTextPr
var g_oImagePr = new Object();//
var g_nImageWrap = 0;//c_oAscWrapStyle2.Inline;
var g_nParaWrap = 1;//c_oAscWrapStyle2.Square;
var g_bImageCanBeFlow = true;
var g_oTablePr = new Object();
var g_oSpellCheck = new Object();
......@@ -375,7 +376,7 @@ $(document).ready(function(){
}
);
$("#imgW, #imgH, #imgLeft, #imgTop, #imgRight, #imgBottom, #imgX, #imgY, #hafHF, #tblW, #tblCS, #tblMarLeft, #tblMarTop, #tblMarRight, #tblMarBottom, #tblIndentLeft, #tblLeft, #tblTop, #tblRight, #tblBottom, #tblBrdBGColor, #imgURL, #tblDefMarLeft, #tblDefMarTop, #tblDefMarRight, #tblDefMarBottom, #tblX, #tblY, #prFirst, #prLeft, #prRight, #prLineHeight, #prAfter, #prBefore, #hyperToolTip, #hyperUrl, #hyperText, #prTextSpacing, #prTextPosition, #prTextPosition, #imgPositionVPosValueCombo, #imgPositionHPosValueCombo, #tblHeaderRowsCount, #tblPositionVPosValueCombo, #tblPositionHPosValueCombo, #searchString, #replaceString, #prBrdSpaceVals")
$("#imgW, #imgH, #imgLeft, #imgTop, #imgRight, #imgBottom, #imgX, #imgY, #hafHF, #tblW, #tblCS, #tblMarLeft, #tblMarTop, #tblMarRight, #tblMarBottom, #tblIndentLeft, #tblLeft, #tblTop, #tblRight, #tblBottom, #tblBrdBGColor, #imgURL, #tblDefMarLeft, #tblDefMarTop, #tblDefMarRight, #tblDefMarBottom, #tblX, #tblY, #prFirst, #prLeft, #prRight, #prLineHeight, #prAfter, #prBefore, #hyperToolTip, #hyperUrl, #hyperText, #prTextSpacing, #prTextPosition, #prTextPosition, #imgPositionVPosValueCombo, #imgPositionHPosValueCombo, #tblHeaderRowsCount, #tblPositionVPosValueCombo, #tblPositionHPosValueCombo, #searchString, #replaceString, #prBrdSpaceVals, #prFrameHSpace, #prFrameVSpace, #prFramePositionVPosValueCombo, #prFramePositionHPosValueCombo, #prFrameHeightValue, #prFrameWidthValue")
.focus(function(){editor.asc_enableKeyEvents(false);})
.blur(function(){editor.asc_enableKeyEvents(true);})
......@@ -1008,11 +1009,17 @@ $("#td_formatmodel,#td_info, #td_redo, #td_undo, #td_orient, #td_bold, #td_itali
//editor.WordControl.m_oLogicDocument.Document_CreateFontMap();
Menu_Hyperlink_Add();
//Menu_Hyperlink_Add();
editor.WordControl.m_oLogicDocument.Add_DropCap();
//editor.WordControl.m_oLogicDocument.Search_Start(String);
break;
case "td_indent":
//var Time = History.Get_EditingTime(10000);
//alert("Время редактирования " + (Time / 1000) );
editor.IncreaseIndent()
break;
case "td_outdent":
......@@ -1827,6 +1834,17 @@ $(".colorWatch").mouseover(function(){
editor.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
});
editor.asc_registerCallback("asc_onSearchEnd", function()
{
Search_Clear();
});
editor.asc_registerCallback("asc_onReplaceAll", function()
{
var Count = arguments[0];
alert("Сделано " + Count + " замен");
});
$("#hafFP").click(function(){
editor.HeadersAndFooters_DifferentFirstPage(document.getElementById ("hafFP").checked);
......@@ -2791,6 +2809,242 @@ $(".colorWatch").mouseover(function(){
document.getElementById("prKeepNext").checked = elemVal.KeepNext;
document.getElementById("prPageBreak").checked = elemVal.PageBreakBefore;
document.getElementById("prWidowControl").checked = elemVal.WidowControl;
var FramePr = elemVal.get_FramePr();
if ( undefined != FramePr )
{
document.getElementById("prFramePr").style.display = "block";
var bFrameWrap = FramePr.get_Wrap();
if ( true === bFrameWrap )
ParagraphFrame_OnWrapChange( c_oAscWrapStyle2.Square );
else
ParagraphFrame_OnWrapChange( c_oAscWrapStyle2.TopAndBottom );
var FrameW = FramePr.get_W();
if ( undefined === FrameW )
{
document.getElementById("prFrameWidthType").selectedIndex = 0;
ParagraphFrame_OnChangeWidthType( 0 );
}
else
{
document.getElementById("prFrameWidthType").selectedIndex = 1;
ParagraphFrame_OnChangeWidthType( 1 );
document.getElementById("prFrameWidthValue").value = FrameW;
}
var FrameHRule = FramePr.get_HRule();
if ( undefined === FrameHRule )
FrameHRule = linerule_Auto;
switch ( FrameHRule )
{
case linerule_Auto :
{
document.getElementById("prFrameHeightType").selectedIndex = 0;
ParagraphFrame_OnChangeHeightType( 0 );
break;
}
case linerule_AtLeast :
{
document.getElementById("prFrameHeightType").selectedIndex = 1;
document.getElementById("prFrameHeightValue").value = FramePr.get_H();
ParagraphFrame_OnChangeHeightType( 1 );
break;
}
case linerule_Exact :
{
document.getElementById("prFrameHeightType").selectedIndex = 2;
document.getElementById("prFrameHeightValue").value = FramePr.get_H();
ParagraphFrame_OnChangeHeightType( 2 );
break;
}
}
var FrameHAnchor = FramePr.get_HAnchor();
var FrameXAlign = FramePr.get_XAlign();
var FrameX = FramePr.get_X();
if ( undefined != FrameXAlign || undefined === FrameX )
{
document.getElementById('prFramePositionHAlignRadio').checked = true;
document.getElementById('prFramePositionHPosRadio').checked = false;
ParagraphFrame_UpdatePositionH();
if ( undefined === FrameXAlign )
FrameXAlign = c_oAscXAlign.Left;
switch ( FrameXAlign )
{
case c_oAscXAlign.Inside:
case c_oAscXAlign.Outside:
case c_oAscXAlign.Left:
{
document.getElementById('prFramePositionHAlignValueCombo').selectedIndex = 0;
break;
}
case c_oAscXAlign.Center:
{
document.getElementById('prFramePositionHAlignValueCombo').selectedIndex = 1;
break;
}
case c_oAscXAlign.Right:
{
document.getElementById('prFramePositionHAlignValueCombo').selectedIndex = 2;
break;
}
}
switch (FrameHAnchor)
{
case c_oAscHAnchor.Margin :
{
document.getElementById('prFramePositionHAlignTypeCombo').selectedIndex = 0;
break;
}
case c_oAscHAnchor.Page :
{
document.getElementById('prFramePositionHAlignTypeCombo').selectedIndex = 1;
break;
}
case c_oAscHAnchor.Text :
{
document.getElementById('prFramePositionHAlignTypeCombo').selectedIndex = 2;
break;
}
}
}
else
{
document.getElementById('prFramePositionHAlignRadio').checked = false;
document.getElementById('prFramePositionHPosRadio').checked = true;
ParagraphFrame_UpdatePositionH();
if ( undefined === FrameX )
FrameX = 0;
document.getElementById('prFramePositionVPosValueCombo').value = FrameX;
switch (FrameHAnchor)
{
case c_oAscHAnchor.Margin :
{
document.getElementById('prFramePositionHPosTypeCombo').selectedIndex = 0;
break;
}
case c_oAscHAnchor.Page :
{
document.getElementById('prFramePositionHPosTypeCombo').selectedIndex = 1;
break;
}
case c_oAscHAnchor.Text :
{
document.getElementById('prFramePositionHPosTypeCombo').selectedIndex = 2;
break;
}
}
}
var FrameVAnchor = FramePr.get_VAnchor();
var FrameYAlign = FramePr.get_YAlign();
if ( undefined != FrameYAlign )
{
document.getElementById('prFramePositionVAlignRadio').checked = true;
document.getElementById('prFramePositionVPosRadio').checked = false;
ParagraphFrame_UpdatePositionV();
switch ( FrameYAlign )
{
case c_oAscYAlign.Inside:
case c_oAscYAlign.Outside:
case c_oAscYAlign.Inline:
case c_oAscYAlign.Top:
{
document.getElementById('prFramePositionVAlignValueCombo').selectedIndex = 0;
break;
}
case c_oAscYAlign.Center:
{
document.getElementById('prFramePositionVAlignValueCombo').selectedIndex = 1;
break;
}
case c_oAscYAlign.Bottom:
{
document.getElementById('prFramePositionVAlignValueCombo').selectedIndex = 2;
break;
}
}
switch (FrameVAnchor)
{
case c_oAscVAnchor.Margin :
{
document.getElementById('prFramePositionVAlignTypeCombo').selectedIndex = 0;
break;
}
case c_oAscVAnchor.Page :
{
document.getElementById('prFramePositionVAlignTypeCombo').selectedIndex = 1;
break;
}
case c_oAscVAnchor.Text :
{
document.getElementById('prFramePositionVAlignTypeCombo').selectedIndex = 2;
break;
}
}
}
else
{
document.getElementById('prFramePositionVAlignRadio').checked = false;
document.getElementById('prFramePositionVPosRadio').checked = true;
ParagraphFrame_UpdatePositionV();
var FrameY = FramePr.get_Y();
if ( undefined === FrameY )
FrameY = 0;
document.getElementById('prFramePositionVPosValueCombo').value = FrameY;
switch (FrameVAnchor)
{
case c_oAscVAnchor.Margin :
{
document.getElementById('prFramePositionVPosTypeCombo').selectedIndex = 0;
break;
}
case c_oAscVAnchor.Page :
{
document.getElementById('prFramePositionVPosTypeCombo').selectedIndex = 1;
break;
}
case c_oAscVAnchor.Text :
{
document.getElementById('prFramePositionVPosTypeCombo').selectedIndex = 2;
break;
}
}
}
var FrameHSpace = FramePr.get_HSpace();
if ( undefined === FrameHSpace )
FrameHSpace = 0;
document.getElementById('prFrameHSpace').value = FrameHSpace;
var FrameVSpace = FramePr.get_VSpace();
if ( undefined === FrameVSpace )
FrameVSpace = 0;
document.getElementById('prFrameVSpace').value = FrameVSpace;
}
else
{
document.getElementById("prFramePr").style.display = "none";
}
}
else if ( ObjectType == c_oAscTypeSelectElement.Hyperlink )
{
......@@ -3151,6 +3405,122 @@ $(".colorWatch").mouseover(function(){
}
);
$("#prFrameApply").click(function()
{
var FramePr = new CParagraphFrame();
FramePr.put_Wrap( g_nParaWrap );
if ( 0 === document.getElementById('prFrameWidthType').selectedIndex )
FramePr.put_W( undefined );
else
{
var W = parseFloat(document.getElementById("prFrameWidthValue").value);
FramePr.put_W( ( isNaN( W ) ? 0 : W ) );
}
var HRule = document.getElementById("prFrameHeightType").selectedIndex;
switch(HRule)
{
case 0 :
{
FramePr.put_HRule( linerule_Auto );
break;
}
case 1:
{
FramePr.put_HRule( linerule_AtLeast );
var H = parseFloat(document.getElementById("prFrameHeightValue").value);
FramePr.put_H( ( isNaN( H ) ? 0 : H ) );
break;
}
case 2:
{
FramePr.put_HRule( linerule_Exact );
var H = parseFloat(document.getElementById("prFrameHeightValue").value);
FramePr.put_H( ( isNaN( H ) ? 0 : H ) );
break;
}
}
if ( true === document.getElementById("prFramePositionHAlignRadio").checked )
{
var XAlign = document.getElementById("prFramePositionHAlignValueCombo").selectedIndex;
switch (XAlign)
{
case 0: FramePr.put_XAlign(c_oAscXAlign.Left); break;
case 1: FramePr.put_XAlign(c_oAscXAlign.Center); break;
case 2: FramePr.put_XAlign(c_oAscXAlign.Right); break;
}
var HAnchor = document.getElementById("prFramePositionHAlignTypeCombo").selectedIndex;
switch (HAnchor)
{
case 0: FramePr.put_HAnchor(c_oAscHAnchor.Margin); break;
case 1: FramePr.put_HAnchor(c_oAscHAnchor.Page); break;
case 2: FramePr.put_HAnchor(c_oAscHAnchor.Text); break;
}
}
else
{
var X = parseFloat(document.getElementById("prFramePositionHPosValueCombo").value);
FramePr.put_X( ( isNaN( X ) ? 0 : X ) );
var HAnchor = document.getElementById("prFramePositionHPosTypeCombo").selectedIndex;
switch (HAnchor)
{
case 0: FramePr.put_HAnchor(c_oAscHAnchor.Margin); break;
case 1: FramePr.put_HAnchor(c_oAscHAnchor.Page); break;
case 2: FramePr.put_HAnchor(c_oAscHAnchor.Text); break;
}
}
if ( true === document.getElementById("prFramePositionVAlignRadio").checked )
{
var YAlign = document.getElementById("prFramePositionVAlignValueCombo").selectedIndex;
switch(YAlign)
{
case 0: FramePr.put_YAlign( c_oAscYAlign.Top ); break;
case 1: FramePr.put_YAlign( c_oAscYAlign.Center ); break;
case 2: FramePr.put_YAlign( c_oAscYAlign.Bottom ); break;
}
var VAnchor = document.getElementById("prFramePositionVAlignTypeCombo").selectedIndex;
switch(VAnchor)
{
case 0: FramePr.put_VAnchor( c_oAscVAnchor.Margin ); break;
case 1: FramePr.put_VAnchor( c_oAscVAnchor.Page ); break;
case 2: FramePr.put_VAnchor( c_oAscVAnchor.Text ); break;
}
}
else
{
var Y = parseFloat(document.getElementById("prFramePositionVPosValueCombo").value);
FramePr.put_Y( ( isNaN( Y ) ? 0 : Y ) );
var VAnchor = document.getElementById("prFramePositionVPosTypeCombo").selectedIndex;
switch(VAnchor)
{
case 0: FramePr.put_VAnchor( c_oAscVAnchor.Margin ); break;
case 1: FramePr.put_VAnchor( c_oAscVAnchor.Page ); break;
case 2: FramePr.put_VAnchor( c_oAscVAnchor.Text ); break;
}
}
var HSpace = parseFloat(document.getElementById("prFrameHSpace").value);
FramePr.put_HSpace( isNaN( HSpace ) ? 0 : HSpace );
var VSpace = parseFloat(document.getElementById("prFrameVSpace").value);
FramePr.put_VSpace( isNaN( VSpace ) ? 0 : VSpace );
editor.put_FramePr( FramePr );
});
$("#prAddMessage").click(function()
{
editor.asc_coAuthoringChatSendMessage("test message");
......@@ -3780,10 +4150,56 @@ $(".colorWatch").mouseover(function(){
}
);
$("#searchStringButton").click(function(){Search_Start();});
$("#searchStringButton").click(function()
{
var String = document.getElementById("searchString").value;
var MatchCase = document.getElementById("searchMatchCase").checked;
$("#replaceStringButton").click(function(){Search_Replace(false);});
$("#replaceAllStringButton").click(function(){Search_Replace(true);});
editor.asc_findText(String, MatchCase);
Search_Start();
});
$("#searchNext").click(function()
{
editor.asc_findForward(true);
//Search_NextElemet(true);
});
$("#searchPrev").click(function()
{
editor.asc_findForward(false);
//Search_NextElemet(false);
});
$("#searchSelect").click(function()
{
var CurValue = editor.asc_isSelectSearchingResults();
if ( true === CurValue )
{
this.value = "Select All";
editor.asc_selectSearchingResults(false);
}
else
{
this.value = "Remove selection";
editor.asc_selectSearchingResults(true);
}
});
$("#replaceStringButton").click(function()
{
var String = document.getElementById("replaceString").value;
editor.asc_replaceText(String, false);
//Search_Replace(false);
});
$("#replaceAllStringButton").click(function()
{
var String = document.getElementById("replaceString").value;
editor.asc_replaceText(String, true);
//Search_Replace(true);
});
var sProtocol = window.location.protocol;
......@@ -4843,15 +5259,13 @@ var g_SearchCurrentId = null;
function Search_Start()
{
g_SearchCurrentId = null;
var String = document.getElementById("searchString").value;
var MatchCase = document.getElementById("searchMatchCase").checked;
var Div = document.getElementById( "searchResults" );
while ( null != Div.firstChild )
Div.removeChild( Div.firstChild );
var SearchEngine = editor.WordControl.m_oLogicDocument.Search( String, { MatchCase : MatchCase } );
var SearchEngine = editor.WordControl.m_oLogicDocument.SearchEngine;
var SearchResults = SearchEngine.Elements;
for ( var Id in SearchResults )
{
......@@ -4863,6 +5277,23 @@ function Search_Start()
document.getElementById("searchCaption").innerHTML = Caption;
}
function Search_Clear()
{
var Div = document.getElementById( "searchResults" );
while ( null != Div.firstChild )
Div.removeChild( Div.firstChild );
document.getElementById("searchCaption").innerHTML = "\<b\>Search\</b\>";
}
function Search_NextElemet(bNext)
{
var Id = editor.WordControl.m_oLogicDocument.Search_GetId( bNext );
if ( null != Id )
editor.WordControl.m_oLogicDocument.Search_Select( Id );
}
function Search_AddSearchElement(ParentDiv, SearchElement)
{
var ParentNode = ParentDiv;
......@@ -4952,6 +5383,97 @@ function Search_Replace(bAll)
}
}
function ParagraphFrame_OnWrapChange(Wrap)
{
var sEmptyColor = 'RGB(255, 255, 255)';
var sColor = 'RGB(249, 201, 16)';
g_nParaWrap = Wrap;
document.getElementById('prWrapAround_div').style.backgroundColor = sEmptyColor;
document.getElementById('prWrapNone_div').style.backgroundColor = sEmptyColor;
switch(g_nParaWrap)
{
case c_oAscWrapStyle2.Square : document.getElementById('prWrapAround_div').style.backgroundColor = sColor; break;
case c_oAscWrapStyle2.TopAndBottom: document.getElementById('prWrapNone_div').style.backgroundColor = sColor; break;
}
}
function ParagraphFrame_OnChangeWidthType(Value)
{
switch ( Value )
{
case 0 :
{
document.getElementById('prFrameWidthValue').disabled = "disabled";
break;
}
case 1 :
{
document.getElementById('prFrameWidthValue').disabled = 0;
break;
}
}
}
function ParagraphFrame_OnChangeHeightType(Value)
{
switch ( Value )
{
case 0 :
{
document.getElementById('prFrameHeightValue').disabled = "disabled";
break;
}
case 1 :
case 2 :
{
document.getElementById('prFrameHeightValue').disabled = 0;
break;
}
}
}
function ParagraphFrame_UpdatePositionH()
{
if ( document.getElementById('prFramePositionHAlignRadio').checked )
{
document.getElementById('prFramePositionHAlignValueCombo').disabled = 0;
document.getElementById('prFramePositionHAlignTypeCombo').disabled = 0;
document.getElementById('prFramePositionHPosValueCombo').disabled = "disabled";
document.getElementById('prFramePositionHPosTypeCombo').disabled = "disabled";
}
else
{
document.getElementById('prFramePositionHPosValueCombo').disabled = 0;
document.getElementById('prFramePositionHPosTypeCombo').disabled = 0;
document.getElementById('prFramePositionHAlignValueCombo').disabled = "disabled";
document.getElementById('prFramePositionHAlignTypeCombo').disabled = "disabled";
}
}
function ParagraphFrame_UpdatePositionV()
{
if ( document.getElementById('prFramePositionVAlignRadio').checked )
{
document.getElementById('prFramePositionVAlignValueCombo').disabled = 0;
document.getElementById('prFramePositionVAlignTypeCombo').disabled = 0;
document.getElementById('prFramePositionVPosValueCombo').disabled = "disabled";
document.getElementById('prFramePositionVPosTypeCombo').disabled = "disabled";
}
else
{
document.getElementById('prFramePositionVPosValueCombo').disabled = 0;
document.getElementById('prFramePositionVPosTypeCombo').disabled = 0;
document.getElementById('prFramePositionVAlignValueCombo').disabled = "disabled";
document.getElementById('prFramePositionVAlignTypeCombo').disabled = "disabled";
}
}
var global_is_ea_input_mode = false;
function CToolBox()
......
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