Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
50cd3804
Commit
50cd3804
authored
May 18, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on moving the cursor in the new class CInlineLevelSdt.
parent
b13152a7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
114 deletions
+28
-114
word/Editor/Comments.js
word/Editor/Comments.js
+4
-0
word/Editor/Field.js
word/Editor/Field.js
+5
-1
word/Editor/Math.js
word/Editor/Math.js
+4
-0
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+4
-85
word/Editor/ParagraphContentBase.js
word/Editor/ParagraphContentBase.js
+4
-0
word/Editor/StructuredDocumentTags/InlineLevel.js
word/Editor/StructuredDocumentTags/InlineLevel.js
+7
-28
No files found.
word/Editor/Comments.js
View file @
50cd3804
...
...
@@ -1168,6 +1168,10 @@ ParaComment.prototype.IsCommentStart = function()
{
return
this
.
Start
;
};
ParaComment
.
prototype
.
IsStopCursorOnEntryExit
=
function
()
{
return
false
;
};
//----------------------------------------------------------------------------------------------------------------------
// Разное
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/Field.js
View file @
50cd3804
...
...
@@ -618,7 +618,11 @@ ParaField.prototype.Read_FromBinary2 = function(Reader)
if
(
editor
)
editor
.
WordControl
.
m_oLogicDocument
.
Register_Field
(
this
);
};
//----------------------------------------------------------------------------------------------------------------------
ParaField
.
prototype
.
IsStopCursorOnEntryExit
=
function
()
{
return
true
;
};
//--------------------------------------------------------export----------------------------------------------------
window
[
'
AscCommonWord
'
]
=
window
[
'
AscCommonWord
'
]
||
{};
window
[
'
AscCommonWord
'
].
ParaField
=
ParaField
;
word/Editor/Math.js
View file @
50cd3804
...
...
@@ -3357,6 +3357,10 @@ ParaMath.prototype.SetContentPosition = function(DocPos, Depth, Flag)
{
return
this
.
Root
.
SetContentPosition
(
DocPos
,
Depth
,
Flag
);
};
ParaMath
.
prototype
.
IsStopCursorOnEntryExit
=
function
()
{
return
true
;
};
function
MatGetKoeffArgSize
(
FontSize
,
ArgSize
)
{
...
...
word/Editor/Paragraph.js
View file @
50cd3804
...
...
@@ -3637,7 +3637,7 @@ Paragraph.prototype.Correct_ContentPos2 = function()
}
// Если курсор находится в начале или конце гиперссылки, тогда выводим его из гиперссылки
while
(
CurPos
>
0
&&
para_Run
!==
this
.
Content
[
CurPos
].
Type
&&
para_Math
!==
this
.
Content
[
CurPos
].
Type
&&
para_Field
!==
this
.
Content
[
CurPos
].
Type
&&
true
===
this
.
Content
[
CurPos
].
Cursor_Is_Start
())
while
(
CurPos
>
0
&&
para_Run
!==
this
.
Content
[
CurPos
].
Type
&&
para_Math
!==
this
.
Content
[
CurPos
].
Type
&&
para_Field
!==
this
.
Content
[
CurPos
].
Type
&&
para_InlineLevelSdt
!==
this
.
Content
[
CurPos
].
Type
&&
true
===
this
.
Content
[
CurPos
].
Cursor_Is_Start
())
{
if
(
false
===
this
.
Content
[
CurPos
-
1
].
Is_CursorPlaceable
())
break
;
...
...
@@ -3646,7 +3646,7 @@ Paragraph.prototype.Correct_ContentPos2 = function()
this
.
Content
[
CurPos
].
MoveCursorToEndPos
();
}
while
(
CurPos
<
Count
&&
para_Run
!==
this
.
Content
[
CurPos
].
Type
&&
para_Math
!==
this
.
Content
[
CurPos
].
Type
&&
para_Field
!==
this
.
Content
[
CurPos
].
Type
&&
true
===
this
.
Content
[
CurPos
].
Cursor_Is_End
())
while
(
CurPos
<
Count
&&
para_Run
!==
this
.
Content
[
CurPos
].
Type
&&
para_Math
!==
this
.
Content
[
CurPos
].
Type
&&
para_Field
!==
this
.
Content
[
CurPos
].
Type
&&
para_InlineLevelSdt
!==
this
.
Content
[
CurPos
].
Type
&&
true
===
this
.
Content
[
CurPos
].
Cursor_Is_End
())
{
if
(
false
===
this
.
Content
[
CurPos
+
1
].
Is_CursorPlaceable
())
break
;
...
...
@@ -4335,7 +4335,7 @@ Paragraph.prototype.Get_LeftPos = function(SearchPos, ContentPos)
CurPos
--
;
if
(
CurPos
>=
0
&&
(
para_Math
===
this
.
Content
[
CurPos
+
1
].
Type
||
para_Field
===
this
.
Content
[
CurPos
+
1
].
Type
))
if
(
CurPos
>=
0
&&
this
.
Content
[
CurPos
+
1
].
IsStopCursorOnEntryExit
(
))
{
// При выходе из формулы встаем в конец рана
this
.
Content
[
CurPos
].
Get_EndPos
(
false
,
SearchPos
.
Pos
,
Depth
+
1
);
...
...
@@ -4371,7 +4371,7 @@ Paragraph.prototype.Get_RightPos = function(SearchPos, ContentPos, StepEnd)
CurPos
++
;
var
Count
=
this
.
Content
.
length
;
if
(
CurPos
<
Count
&&
(
para_Math
===
this
.
Content
[
CurPos
-
1
].
Type
||
para_Field
===
this
.
Content
[
CurPos
-
1
].
Type
))
if
(
CurPos
<
Count
&&
this
.
Content
[
CurPos
-
1
].
IsStopCursorOnEntryExit
(
))
{
// При выходе из формулы встаем в конец рана
this
.
Content
[
CurPos
].
Get_StartPos
(
SearchPos
.
Pos
,
Depth
+
1
);
...
...
@@ -5101,87 +5101,6 @@ Paragraph.prototype.Cursor_MoveTo_Drawing = function(Id, bBefore)
this
.
CurPos
.
RealX
=
this
.
CurPos
.
X
;
this
.
CurPos
.
RealY
=
this
.
CurPos
.
Y
;
};
Paragraph
.
prototype
.
Set_ContentPos
=
function
(
Pos
,
bCorrectPos
,
Line
)
{
this
.
CurPos
.
ContentPos
=
Math
.
max
(
0
,
Math
.
min
(
this
.
Content
.
length
-
1
,
Pos
));
this
.
CurPos
.
Line
=
(
undefined
===
Line
?
-
1
:
Line
);
if
(
false
!=
bCorrectPos
)
this
.
Internal_Correct_ContentPos
();
};
Paragraph
.
prototype
.
Internal_Correct_ContentPos
=
function
()
{
// 1. Ищем ближайший справа элемент
// Это делается для того, чтобы если мы находимся в конце гиперссылки выйти из нее.
var
Count
=
this
.
Content
.
length
;
var
CurPos
=
this
.
CurPos
.
ContentPos
;
var
TempPos
=
CurPos
;
while
(
TempPos
>=
0
&&
TempPos
<
Count
&&
undefined
===
this
.
Content
[
TempPos
].
CurLine
)
TempPos
--
;
var
CurLine
=
(
this
.
CurPos
.
Line
===
-
1
?
(
TempPos
>=
0
&&
TempPos
<
Count
?
this
.
Content
[
TempPos
].
CurLine
:
-
1
)
:
this
.
CurPos
.
Line
);
while
(
CurPos
<
Count
-
1
)
{
var
Item
=
this
.
Content
[
CurPos
];
var
ItemType
=
Item
.
Type
;
if
(
para_Text
===
ItemType
||
para_Space
===
ItemType
||
para_End
===
ItemType
||
para_Tab
===
ItemType
||
(
para_Drawing
===
ItemType
&&
true
===
Item
.
Is_Inline
()
)
||
para_PageNum
===
ItemType
||
para_NewLine
===
ItemType
||
para_HyperlinkStart
===
ItemType
||
para_Math
===
ItemType
)
break
;
CurPos
++
;
}
// 2. Ищем ближайший слева (текcт, пробел, картинку, нумерацию и т.д.)
// Смещаемся к концу ближайшего левого элемента, чтобы продолжался набор с
// настройками левого ближайшего элемента.
while
(
CurPos
>
0
)
{
CurPos
--
;
var
Item
=
this
.
Content
[
CurPos
];
var
ItemType
=
Item
.
Type
;
var
bEnd
=
false
;
if
(
para_Text
===
ItemType
||
para_Space
===
ItemType
||
para_End
===
ItemType
||
para_Tab
===
ItemType
||
(
para_Drawing
===
ItemType
&&
true
===
Item
.
Is_Inline
()
)
||
para_PageNum
===
ItemType
||
para_NewLine
===
ItemType
||
para_Math
===
ItemType
)
{
this
.
CurPos
.
ContentPos
=
CurPos
+
1
;
bEnd
=
true
;
}
else
if
(
para_HyperlinkEnd
===
ItemType
)
{
while
(
CurPos
<
Count
-
1
&&
para_TextPr
===
this
.
Content
[
CurPos
+
1
].
Type
)
CurPos
++
;
this
.
CurPos
.
ContentPos
=
CurPos
+
1
;
bEnd
=
true
;
}
if
(
true
===
bEnd
)
{
TempPos
=
CurPos
;
while
(
TempPos
>=
0
&&
TempPos
<
Count
&&
undefined
===
this
.
Content
[
TempPos
].
CurLine
)
TempPos
--
;
var
NewLine
=
(
TempPos
>=
0
&&
TempPos
<
Count
?
this
.
Content
[
TempPos
].
CurLine
:
-
1
);
if
(
NewLine
!=
CurLine
&&
-
1
!=
CurLine
)
this
.
CurPos
.
Line
=
CurLine
;
return
;
}
}
// 3. Если мы попали в начало параграфа, тогда пропускаем все TextPr
if
(
CurPos
<=
0
)
{
CurPos
=
0
;
while
(
para_TextPr
===
this
.
Content
[
CurPos
].
Type
||
para_CollaborativeChangesEnd
===
this
.
Content
[
CurPos
].
Type
||
para_CollaborativeChangesStart
===
this
.
Content
[
CurPos
].
Type
)
CurPos
++
;
this
.
CurPos
.
ContentPos
=
CurPos
;
}
};
Paragraph
.
prototype
.
GetCurPosXY
=
function
()
{
return
{
X
:
this
.
CurPos
.
RealX
,
Y
:
this
.
CurPos
.
RealY
};
...
...
word/Editor/ParagraphContentBase.js
View file @
50cd3804
...
...
@@ -42,6 +42,10 @@ CParagraphContentBase.prototype.IsParagraphContentElement = function()
{
return
true
;
};
CParagraphContentBase
.
prototype
.
IsStopCursorOnEntryExit
=
function
()
{
return
false
;
};
/**
* Это базовый класс для элементов содержимого(контент) параграфа, у которых есть свое содержимое.
...
...
word/Editor/StructuredDocumentTags/InlineLevel.js
View file @
50cd3804
...
...
@@ -273,37 +273,11 @@ CInlineLevelSdt.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
oRangeBounds
.
Y1
+=
Dy
;
}
};
CInlineLevelSdt
.
prototype
.
Get_LeftPos
=
function
(
SearchPos
,
ContentPos
,
Depth
,
UseContentPos
)
{
var
bResult
=
CParagraphContentWithParagraphLikeContent
.
prototype
.
Get_LeftPos
.
call
(
this
,
SearchPos
,
ContentPos
,
Depth
,
UseContentPos
);
if
(
true
!==
bResult
&&
this
.
Paragraph
&&
this
.
Paragraph
.
LogicDocument
&&
true
===
this
.
Paragraph
.
LogicDocument
.
IsFillingFormMode
())
{
this
.
Get_StartPos
(
SearchPos
.
Pos
,
Depth
);
SearchPos
.
Found
=
true
;
return
true
;
}
return
bResult
;
};
CInlineLevelSdt
.
prototype
.
Get_RightPos
=
function
(
SearchPos
,
ContentPos
,
Depth
,
UseContentPos
,
StepEnd
)
{
var
bResult
=
CParagraphContentWithParagraphLikeContent
.
prototype
.
Get_RightPos
.
call
(
this
,
SearchPos
,
ContentPos
,
Depth
,
UseContentPos
,
StepEnd
);
if
(
true
!==
bResult
&&
this
.
Paragraph
&&
this
.
Paragraph
.
LogicDocument
&&
true
===
this
.
Paragraph
.
LogicDocument
.
IsFillingFormMode
())
{
this
.
Get_EndPos
(
false
,
SearchPos
.
Pos
,
Depth
);
SearchPos
.
Found
=
true
;
return
true
;
}
return
bResult
;
};
CInlineLevelSdt
.
prototype
.
Get_WordStartPos
=
function
(
SearchPos
,
ContentPos
,
Depth
,
UseContentPos
)
{
var
bResult
=
CParagraphContentWithParagraphLikeContent
.
prototype
.
Get_WordStartPos
.
call
(
this
,
SearchPos
,
ContentPos
,
Depth
,
UseContentPos
);
if
(
true
!==
bResult
&&
this
.
Paragraph
&&
this
.
Paragraph
.
LogicDocument
&&
true
===
this
.
Paragraph
.
LogicDocument
.
IsFillingFormMode
()
)
if
(
true
!==
bResult
&&
this
.
Paragraph
&&
this
.
Paragraph
.
LogicDocument
)
{
this
.
Get_StartPos
(
SearchPos
.
Pos
,
Depth
);
SearchPos
.
Found
=
true
;
...
...
@@ -316,7 +290,7 @@ CInlineLevelSdt.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth
{
var
bResult
=
CParagraphContentWithParagraphLikeContent
.
prototype
.
Get_WordEndPos
.
call
(
this
,
SearchPos
,
ContentPos
,
Depth
,
UseContentPos
,
StepEnd
);
if
(
true
!==
bResult
&&
this
.
Paragraph
&&
this
.
Paragraph
.
LogicDocument
&&
true
===
this
.
Paragraph
.
LogicDocument
.
IsFillingFormMode
()
)
if
(
true
!==
bResult
&&
this
.
Paragraph
&&
this
.
Paragraph
.
LogicDocument
)
{
this
.
Get_EndPos
(
false
,
SearchPos
.
Pos
,
Depth
);
SearchPos
.
Found
=
true
;
...
...
@@ -478,6 +452,11 @@ CInlineLevelSdt.prototype.Write_ToBinary = function(Writer)
Writer
.
WriteLong
(
this
.
Type
);
Writer
.
WriteString2
(
this
.
Id
);
};
//----------------------------------------------------------------------------------------------------------------------
CInlineLevelSdt
.
prototype
.
IsStopCursorOnEntryExit
=
function
()
{
return
true
;
};
//--------------------------------------------------------export--------------------------------------------------------
window
[
'
AscCommonWord
'
]
=
window
[
'
AscCommonWord
'
]
||
{};
window
[
'
AscCommonWord
'
].
CInlineLevelSdt
=
CInlineLevelSdt
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment