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,13 +4007,16 @@ Paragraph.prototype =
var Item = this.Content[Pos];
var bSearchResult = false;
for ( var SId in this.SearchResults )
if ( true === DrawSearch )
{
var SResult = this.SearchResults[SId];
if ( Pos >= SResult.StartPos && Pos < SResult.EndPos )
for ( var SId in this.SearchResults )
{
bSearchResult = true;
break;
var SResult = this.SearchResults[SId];
if ( Pos >= SResult.StartPos && Pos < SResult.EndPos )
{
bSearchResult = true;
break;
}
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -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();
......
......@@ -353,4 +353,11 @@ var c_oAscLineBeginSize = {
};
var TABLE_STYLE_WIDTH_PIX = 70;
var TABLE_STYLE_HEIGHT_PIX = 50;
\ No newline at end of file
var TABLE_STYLE_HEIGHT_PIX = 50;
var c_oAscDropCap =
{
None : 0,
Drop : 1,
Margin : 2
};
\ No newline at end of file
This diff is collapsed.
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