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
37a3900a
Commit
37a3900a
authored
Jun 21, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented function for finding and selecting the next/previous filling form.
parent
653fabca
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
336 additions
and
44 deletions
+336
-44
word/Editor/Document.js
word/Editor/Document.js
+13
-43
word/Editor/DocumentContentBase.js
word/Editor/DocumentContentBase.js
+56
-0
word/Editor/DocumentContentElementBase.js
word/Editor/DocumentContentElementBase.js
+4
-0
word/Editor/Field.js
word/Editor/Field.js
+22
-0
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+60
-1
word/Editor/ParagraphContentBase.js
word/Editor/ParagraphContentBase.js
+63
-0
word/Editor/StructuredDocumentTags/BlockLevel.js
word/Editor/StructuredDocumentTags/BlockLevel.js
+22
-0
word/Editor/StructuredDocumentTags/InlineLevel.js
word/Editor/StructuredDocumentTags/InlineLevel.js
+19
-0
word/Editor/Table.js
word/Editor/Table.js
+77
-0
No files found.
word/Editor/Document.js
View file @
37a3900a
...
...
@@ -15145,55 +15145,25 @@ CDocument.prototype.IsFormFieldEditing = function()
return
false
;
};
CDocument
.
prototype
.
MoveToFillingForm
=
function
(
b
Next
)
CDocument
.
prototype
.
MoveToFillingForm
=
function
(
is
Next
)
{
var
arrAllFields
=
this
.
GetAllFormTextFields
();
if
(
arrAllFields
.
length
<=
0
)
return
;
var
oRes
=
this
.
FindNextFillingForm
(
isNext
,
true
,
true
);
this
.
RemoveSelection
();
if
(
!
oRes
)
oRes
=
this
.
FindNextFillingForm
(
isNext
,
true
,
false
);
var
oInfo
=
this
.
GetSelectedElementsInfo
();
var
oField
=
oInfo
.
Get_Field
();
var
oForm
=
null
;
if
(
!
oField
||
!
oField
.
IsFillingForm
())
if
(
oRes
)
{
oForm
=
arrAllFields
[
0
];
}
else
{
for
(
var
nIndex
=
0
,
nCount
=
arrAllFields
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
if
(
oField
===
arrAllFields
[
nIndex
])
{
if
(
bNext
)
{
if
(
nIndex
<
nCount
-
1
)
oForm
=
arrAllFields
[
nIndex
+
1
];
else
oForm
=
arrAllFields
[
0
];
}
else
{
if
(
nIndex
>
0
)
oForm
=
arrAllFields
[
0
];
else
oForm
=
arrAllFields
[
nCount
-
1
];
}
this
.
RemoveSelection
();
break
;
}
if
(
oRes
instanceof
CBlockLevelSdt
||
oRes
instanceof
CInlineLevelSdt
)
{
oRes
.
SelectContentControl
();
}
else
if
(
oRes
instanceof
ParaField
)
{
oRes
.
SelectThisElement
();
}
}
if
(
oForm
)
{
oForm
.
MoveCursorToStartPos
();
if
(
oForm
.
Content
.
length
>=
0
&&
para_Run
===
oForm
.
Content
[
0
].
Type
)
oForm
.
Content
[
0
].
Make_ThisElementCurrent
();
this
.
Document_UpdateInterfaceState
();
this
.
Document_UpdateSelectionState
();
}
};
CDocument
.
prototype
.
SelectContentControl
=
function
(
Id
)
...
...
word/Editor/DocumentContentBase.js
View file @
37a3900a
...
...
@@ -760,4 +760,60 @@ CDocumentContentBase.prototype.GetLastRangeVisibleBounds = function()
};
return
this
.
Content
[
this
.
Content
.
length
-
1
].
GetLastRangeVisibleBounds
();
};
CDocumentContentBase
.
prototype
.
FindNextFillingForm
=
function
(
isNext
,
isCurrent
,
isStart
)
{
var
nCurPos
=
this
.
Selection
.
Use
===
true
?
this
.
Selection
.
StartPos
:
this
.
CurPos
.
ContentPos
;
var
nStartPos
=
0
;
var
nEndPos
=
this
.
Content
.
length
-
1
;
if
(
isCurrent
)
{
if
(
isStart
)
{
nStartPos
=
nCurPos
;
nEndPos
=
isNext
?
this
.
Content
.
length
-
1
:
0
;
}
else
{
nStartPos
=
isNext
?
0
:
this
.
Content
.
length
-
1
;
nEndPos
=
nCurPos
;
}
}
else
{
if
(
isNext
)
{
nStartPos
=
0
;
nEndPos
=
this
.
Content
.
length
-
1
;
}
else
{
nStartPos
=
this
.
Content
.
length
-
1
;
nEndPos
=
0
;
}
}
if
(
isNext
)
{
for
(
var
nIndex
=
nStartPos
;
nIndex
<=
nEndPos
;
++
nIndex
)
{
var
oRes
=
this
.
Content
[
nIndex
].
FindNextFillingForm
(
true
,
isCurrent
&&
nIndex
===
nCurPos
?
true
:
false
,
isStart
);
if
(
oRes
)
return
oRes
;
}
}
else
{
for
(
var
nIndex
=
nStartPos
;
nIndex
>=
nEndPos
;
--
nIndex
)
{
var
oRes
=
this
.
Content
[
nIndex
].
FindNextFillingForm
(
false
,
isCurrent
&&
nIndex
===
nCurPos
?
true
:
false
,
isStart
);
if
(
oRes
)
return
oRes
;
}
}
return
null
;
};
\ No newline at end of file
word/Editor/DocumentContentElementBase.js
View file @
37a3900a
...
...
@@ -654,6 +654,10 @@ CDocumentContentElementBase.prototype.GetLastRangeVisibleBounds = function()
XLimit
:
0
};
};
CDocumentContentElementBase
.
prototype
.
FindNextFillingForm
=
function
(
isNext
,
isCurrent
,
isStart
)
{
return
null
;
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/Field.js
View file @
37a3900a
...
...
@@ -467,6 +467,28 @@ ParaField.prototype.IsFillingForm = function()
return
false
;
};
ParaField
.
prototype
.
FindNextFillingForm
=
function
(
isNext
,
isCurrent
,
isStart
)
{
if
(
!
this
.
IsFillingForm
())
return
CParagraphContentWithParagraphLikeContent
.
prototype
.
FindNextFillingForm
.
apply
(
this
,
arguments
);
if
(
isCurrent
&&
true
===
this
.
IsSelectedAll
())
{
if
(
isNext
)
return
CParagraphContentWithParagraphLikeContent
.
prototype
.
FindNextFillingForm
.
apply
(
this
,
arguments
);
return
null
;
}
if
(
!
isCurrent
&&
isNext
)
return
this
;
var
oRes
=
CParagraphContentWithParagraphLikeContent
.
prototype
.
FindNextFillingForm
.
apply
(
this
,
arguments
);
if
(
!
oRes
&&
!
isNext
)
return
this
;
return
null
;
};
//----------------------------------------------------------------------------------------------------------------------
// Функции совместного редактирования
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/Paragraph.js
View file @
37a3900a
...
...
@@ -5214,7 +5214,7 @@ Paragraph.prototype.Correct_Content = function(_StartPos, _EndPos, bDoNotDeleteE
{
var
CurElement
=
this
.
Content
[
CurPos
];
if
((
para_Hyperlink
===
CurElement
.
Type
||
para_Math
===
CurElement
.
Type
||
para_Field
===
CurElement
.
Type
)
&&
true
===
CurElement
.
Is_Empty
()
&&
true
!==
CurElement
.
Is_CheckingNearestPos
())
if
((
para_Hyperlink
===
CurElement
.
Type
||
para_Math
===
CurElement
.
Type
||
para_Field
===
CurElement
.
Type
||
para_InlineLevelSdt
===
CurElement
.
Type
)
&&
true
===
CurElement
.
Is_Empty
()
&&
true
!==
CurElement
.
Is_CheckingNearestPos
())
{
this
.
Internal_Content_Remove
(
CurPos
);
}
...
...
@@ -10857,6 +10857,65 @@ Paragraph.prototype.GetLastRangeVisibleBounds = function()
return
{
X
:
X
,
Y
:
Y
,
W
:
W
,
H
:
H
,
BaseLine
:
B
,
XLimit
:
XLimit
};
};
Paragraph
.
prototype
.
FindNextFillingForm
=
function
(
isNext
,
isCurrent
,
isStart
)
{
var
nCurPos
=
this
.
Selection
.
Use
===
true
?
this
.
Selection
.
StartPos
:
this
.
CurPos
.
ContentPos
;
var
nStartPos
=
0
,
nEndPos
=
0
;
if
(
isCurrent
)
{
if
(
isStart
)
{
nStartPos
=
nCurPos
;
nEndPos
=
isNext
?
this
.
Content
.
length
-
1
:
0
;
}
else
{
nStartPos
=
isNext
?
0
:
this
.
Content
.
length
-
1
;
nEndPos
=
nCurPos
;
}
}
else
{
if
(
isNext
)
{
nStartPos
=
0
;
nEndPos
=
this
.
Content
.
length
-
1
;
}
else
{
nStartPos
=
this
.
Content
.
length
-
1
;
nEndPos
=
0
;
}
}
if
(
isNext
)
{
for
(
var
nIndex
=
nStartPos
;
nIndex
<=
nEndPos
;
++
nIndex
)
{
if
(
this
.
Content
[
nIndex
].
FindNextFillingForm
)
{
var
oRes
=
this
.
Content
[
nIndex
].
FindNextFillingForm
(
true
,
isCurrent
&&
nIndex
===
nCurPos
?
true
:
false
,
isStart
);
if
(
oRes
)
return
oRes
;
}
}
}
else
{
for
(
var
nIndex
=
nStartPos
;
nIndex
>=
nEndPos
;
--
nIndex
)
{
if
(
this
.
Content
[
nIndex
].
FindNextFillingForm
)
{
var
oRes
=
this
.
Content
[
nIndex
].
FindNextFillingForm
(
false
,
isCurrent
&&
nIndex
===
nCurPos
?
true
:
false
,
isStart
);
if
(
oRes
)
return
oRes
;
}
}
}
return
null
;
};
//----------------------------------------------------------------------------------------------------------------------
Paragraph
.
prototype
.
private_ResetSelection
=
function
()
{
...
...
word/Editor/ParagraphContentBase.js
View file @
37a3900a
...
...
@@ -2230,6 +2230,9 @@ CParagraphContentWithParagraphLikeContent.prototype.Selection_DrawRange = functi
};
CParagraphContentWithParagraphLikeContent
.
prototype
.
IsSelectionEmpty
=
function
(
CheckEnd
)
{
if
(
this
.
Content
.
length
<=
0
)
return
true
;
var
StartPos
=
this
.
State
.
Selection
.
StartPos
;
var
EndPos
=
this
.
State
.
Selection
.
EndPos
;
...
...
@@ -2753,6 +2756,7 @@ CParagraphContentWithParagraphLikeContent.prototype.SelectThisElement = function
this
.
Paragraph
.
Selection
.
Use
=
true
;
this
.
Paragraph
.
Selection
.
Start
=
false
;
this
.
Paragraph
.
Set_ParaContentPos
(
StartPos
,
true
,
-
1
,
-
1
);
this
.
Paragraph
.
Set_SelectionContentPos
(
StartPos
,
EndPos
,
false
);
this
.
Paragraph
.
Document_SetThisElementCurrent
(
false
);
...
...
@@ -2807,6 +2811,65 @@ CParagraphContentWithParagraphLikeContent.prototype.ReplaceAllWithText = functio
this
.
Add_ToContent
(
0
,
oRun
);
this
.
MoveCursorToStartPos
();
};
CParagraphContentWithParagraphLikeContent
.
prototype
.
FindNextFillingForm
=
function
(
isNext
,
isCurrent
,
isStart
)
{
var
nCurPos
=
this
.
Selection
.
Use
===
true
?
this
.
Selection
.
EndPos
:
this
.
State
.
ContentPos
;
var
nStartPos
=
0
,
nEndPos
=
0
;
if
(
isCurrent
)
{
if
(
isStart
)
{
nStartPos
=
nCurPos
;
nEndPos
=
isNext
?
this
.
Content
.
length
-
1
:
0
;
}
else
{
nStartPos
=
isNext
?
0
:
this
.
Content
.
length
-
1
;
nEndPos
=
nCurPos
;
}
}
else
{
if
(
isNext
)
{
nStartPos
=
0
;
nEndPos
=
this
.
Content
.
length
-
1
;
}
else
{
nStartPos
=
this
.
Content
.
length
-
1
;
nEndPos
=
0
;
}
}
if
(
isNext
)
{
for
(
var
nIndex
=
nStartPos
;
nIndex
<=
nEndPos
;
++
nIndex
)
{
if
(
this
.
Content
[
nIndex
].
FindNextFillingForm
)
{
var
oRes
=
this
.
Content
[
nIndex
].
FindNextFillingForm
(
true
,
isCurrent
&&
nIndex
===
nCurPos
?
true
:
false
,
isStart
);
if
(
oRes
)
return
oRes
;
}
}
}
else
{
for
(
var
nIndex
=
nStartPos
;
nIndex
>=
nEndPos
;
--
nIndex
)
{
if
(
this
.
Content
[
nIndex
].
FindNextFillingForm
)
{
var
oRes
=
this
.
Content
[
nIndex
].
FindNextFillingForm
(
false
,
isCurrent
&&
nIndex
===
nCurPos
?
true
:
false
,
isStart
);
if
(
oRes
)
return
oRes
;
}
}
}
return
null
;
};
//----------------------------------------------------------------------------------------------------------------------
// Функции, которые должны быть реализованы в классах наследниках
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/StructuredDocumentTags/BlockLevel.js
View file @
37a3900a
...
...
@@ -711,6 +711,28 @@ CBlockLevelSdt.prototype.GetLastRangeVisibleBounds = function()
{
return
this
.
Content
.
GetLastRangeVisibleBounds
();
};
CBlockLevelSdt
.
prototype
.
FindNextFillingForm
=
function
(
isNext
,
isCurrent
,
isStart
)
{
if
(
isCurrent
&&
true
===
this
.
IsSelectedAll
())
{
if
(
isNext
)
return
this
.
Content
.
FindNextFillingForm
(
isNext
,
isCurrent
,
isStart
);
return
null
;
}
if
(
!
isCurrent
&&
isNext
)
return
this
;
var
oRes
=
this
.
Content
.
FindNextFillingForm
(
isNext
,
isCurrent
,
isStart
);
if
(
oRes
)
return
oRes
;
if
(
!
isNext
)
return
this
;
return
null
;
};
//----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt
.
prototype
.
Is_HdrFtr
=
function
(
bReturnHdrFtr
)
{
...
...
word/Editor/StructuredDocumentTags/InlineLevel.js
View file @
37a3900a
...
...
@@ -301,6 +301,25 @@ CInlineLevelSdt.prototype.RemoveContentControlWrapper = function()
this
.
Remove_FromContent
(
0
,
this
.
Content
.
length
);
};
CInlineLevelSdt
.
prototype
.
FindNextFillingForm
=
function
(
isNext
,
isCurrent
,
isStart
)
{
if
(
isCurrent
&&
true
===
this
.
IsSelectedAll
())
{
if
(
isNext
)
return
CParagraphContentWithParagraphLikeContent
.
prototype
.
FindNextFillingForm
.
apply
(
this
,
arguments
);
return
null
;
}
if
(
!
isCurrent
&&
isNext
)
return
this
;
var
oRes
=
CParagraphContentWithParagraphLikeContent
.
prototype
.
FindNextFillingForm
.
apply
(
this
,
arguments
);
if
(
!
oRes
&&
!
isNext
)
return
this
;
return
null
;
};
//----------------------------------------------------------------------------------------------------------------------
// Выставление настроек
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/Table.js
View file @
37a3900a
...
...
@@ -2968,6 +2968,83 @@ CTable.prototype.GetLastRangeVisibleBounds = function()
return
{
X
:
X_start
,
Y
:
Y
,
W
:
X_end
-
X_start
,
H
:
H
,
BaseLine
:
H
,
XLimit
:
Page
.
XLimit
};
};
CTable
.
prototype
.
FindNextFillingForm
=
function
(
isNext
,
isCurrent
,
isStart
)
{
var
nCurRow
=
this
.
Selection
.
Use
===
true
?
this
.
Selection
.
StartPos
.
Pos
.
Row
:
this
.
CurCell
.
Row
.
Index
;
var
nCurCell
=
this
.
Selection
.
Use
===
true
?
this
.
Selection
.
StartPos
.
Pos
.
Cell
:
this
.
CurCell
.
Index
;
var
nStartRow
=
0
,
nStartCell
=
0
,
nEndRow
=
0
,
nEndCell
=
0
;
if
(
isCurrent
)
{
if
(
isStart
)
{
nStartRow
=
nCurRow
;
nStartCell
=
nCurCell
;
nEndRow
=
isNext
?
this
.
Content
.
length
-
1
:
0
;
nEndCell
=
isNext
?
this
.
Content
[
nEndRow
].
Get_CellsCount
()
-
1
:
0
;
}
else
{
nStartRow
=
isNext
?
0
:
this
.
Content
.
length
-
1
;
nStartCell
=
isNext
?
0
:
this
.
Content
[
nStartRow
].
Get_CellsCount
()
-
1
;
nEndRow
=
nCurRow
;
nEndCell
=
nCurCell
;
}
}
else
{
if
(
isNext
)
{
nStartRow
=
0
;
nStartCell
=
0
;
nEndRow
=
this
.
Content
.
length
-
1
;
nEndCell
=
this
.
Content
[
nEndRow
].
Get_CellsCount
()
-
1
;
}
else
{
nStartRow
=
this
.
Content
.
length
-
1
;
nStartCell
=
this
.
Content
[
nEndRow
].
Get_CellsCount
()
-
1
;
nEndRow
=
0
;
nEndCell
=
0
;
}
}
if
(
isNext
)
{
for
(
var
nRowIndex
=
nStartRow
;
nRowIndex
<=
nEndRow
;
++
nRowIndex
)
{
var
_nStartCell
=
nRowIndex
===
nStartRow
?
nStartCell
:
0
;
var
_nEndCell
=
nRowIndex
===
nEndRow
?
nEndCell
:
this
.
Content
[
nRowIndex
].
Get_CellsCount
()
-
1
;
for
(
var
nCellIndex
=
_nStartCell
;
nCellIndex
<=
_nEndCell
;
++
nCellIndex
)
{
var
oCell
=
this
.
Content
[
nRowIndex
].
Get_Cell
(
nCellIndex
);
var
oRes
=
oCell
.
Content
.
FindNextFillingForm
(
true
,
isCurrent
&&
nCellIndex
===
nCurCell
&&
nRowIndex
===
nCurRow
?
true
:
false
,
isStart
);
if
(
oRes
)
return
oRes
;
}
}
}
else
{
for
(
var
nRowIndex
=
nStartRow
;
nRowIndex
>=
nEndRow
;
--
nRowIndex
)
{
var
_nStartCell
=
nRowIndex
===
nStartRow
?
nStartCell
:
this
.
Content
[
nRowIndex
].
Get_CellsCount
()
-
1
;
var
_nEndCell
=
nRowIndex
===
nEndRow
?
nEndCell
:
0
;
for
(
var
nCellIndex
=
_nStartCell
;
nCellIndex
>=
_nEndCell
;
--
nCellIndex
)
{
var
oCell
=
this
.
Content
[
nRowIndex
].
Get_Cell
(
nCellIndex
);
var
oRes
=
oCell
.
Content
.
FindNextFillingForm
(
false
,
isCurrent
&&
nCellIndex
===
nCurCell
&&
nRowIndex
===
nCurRow
?
true
:
false
,
isStart
);
if
(
oRes
)
return
oRes
;
}
}
}
return
null
;
};
CTable
.
prototype
.
Get_NearestPos
=
function
(
CurPage
,
X
,
Y
,
bAnchor
,
Drawing
)
{
var
Pos
=
this
.
Internal_GetCellByXY
(
X
,
Y
,
CurPage
);
...
...
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