Commit adafb270 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@51251 954022d7-b5bf-4e40-9824-e11837661b57
parent 7e61fb3e
......@@ -6651,8 +6651,11 @@ Paragraph.prototype =
}
},
Cursor_MoveTo_Drawing : function(Id)
Cursor_MoveTo_Drawing : function(Id, bBefore)
{
if ( undefined === bBefore )
bBefore = true;
// Ставим курсор перед автофигурой с заданным Id
var Pos = -1;
var Count = this.Content.length;
......@@ -6666,6 +6669,9 @@ Paragraph.prototype =
if ( -1 === Pos )
return;
if ( true != bBefore )
Pos = Pos + 1;
this.Set_ContentPos( Pos, true, -1 );
this.RecalculateCurPos();
this.CurPos.RealX = this.CurPos.X;
......
......@@ -3478,6 +3478,12 @@ function ParaDrawing(W, H, GraphicObj, DrawingDocument, DocumentContent, Parent)
ParaDrawing.prototype =
{
Search_GetId : function(bNext, bCurrent)
{
// TODO: Реализовать
return null;
},
canRotate: function()
{
return isRealObject(this.GraphicObj) && typeof this.GraphicObj.canRotate == "function" && this.GraphicObj.canRotate();
......@@ -4451,11 +4457,11 @@ ParaDrawing.prototype =
editor.WordControl.m_oLogicDocument.Recalculate();
},
GoTo_Text : function()
GoTo_Text : function(bBefore)
{
if ( undefined != this.Parent && null != this.Parent )
{
this.Parent.Cursor_MoveTo_Drawing( this.Id );
this.Parent.Cursor_MoveTo_Drawing( this.Id, bBefore );
this.Parent.Document_SetThisElementCurrent();
}
},
......
......@@ -273,7 +273,12 @@ CDocument.prototype.Search_GetId = function(bNext)
if ( docpostype_DrawingObjects === this.CurPos.Type )
{
var ParaDrawing = this.DrawingObjects.getMajorParaDrawing();
ParaDrawing.Parent.Document_SetThisElementCurrent();
var Id = ParaDrawing.Search_GetId( bNext, true );
if ( null != Id )
return Id;
ParaDrawing.GoTo_Text( true === bNext ? false : true );
}
if ( docpostype_Content === this.CurPos.Type )
......@@ -362,16 +367,21 @@ CDocumentContent.prototype.Search = function(Str, Props, SearchEngine, Type)
CDocumentContent.prototype.Search_GetId = function(bNext, bCurrent)
{
// Получим Id найденного элемента
var Id = null;
if ( true === bCurrent )
{
// Получим Id найденного элемента
if ( docpostype_DrawingObjects === this.CurPos.Type )
{
var ParaDrawing = this.LogicDocument.DrawingObjects.getMajorParaDrawing();
ParaDrawing.Parent.Document_SetThisElementCurrent();
}
var ParaDrawing = this.DrawingObjects.getMajorParaDrawing();
var Id = null;
Id = ParaDrawing.Search_GetId( bNext, true );
if ( null != Id )
return Id;
ParaDrawing.GoTo_Text( true === bNext ? false : true );
}
var Pos = this.CurPos.ContentPos;
if ( true === this.Selection.Use && selectionflag_Common === this.Selection.Flag )
......@@ -930,6 +940,7 @@ Paragraph.prototype.Search_GetId = function(bNext, bCurrent)
if ( true === bNext )
{
// Найдем ближайший элемент среди найденных элементов в самом параграфе
for ( var ElemId in this.SearchResults )
{
var Element = this.SearchResults[ElemId];
......@@ -939,6 +950,21 @@ Paragraph.prototype.Search_GetId = function(bNext, bCurrent)
NearElementId = ElemId;
}
}
var StartPos = Pos;
var EndPos = ( null === NearElementId ? this.Content.length - 1 : Element.StartPos );
// Проверяем автофигуры между StartPos и EndPos
for ( var TempPos = StartPos; TempPos < EndPos; TempPos++ )
{
var Item = this.Content[TempPos];
if ( para_Drawing === Item.Type )
{
var TempElementId = Item.Search_GetId( true, false );
if ( null != TempElementId )
return TempElementId;
}
}
}
else
{
......@@ -951,6 +977,21 @@ Paragraph.prototype.Search_GetId = function(bNext, bCurrent)
NearElementId = ElemId;
}
}
var StartPos = ( null === NearElementId ? 0 : Element.EndPos );
var EndPos = Pos;
// Проверяем автофигуры между StartPos и EndPos
for ( var TempPos = EndPos; TempPos > StartPos; TempPos-- )
{
var Item = this.Content[TempPos];
if ( para_Drawing === Item.Type )
{
var TempElementId = Item.Search_GetId( false, false );
if ( null != TempElementId )
return TempElementId;
}
}
}
return NearElementId;
......
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