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
7bb23d5b
Commit
7bb23d5b
authored
Sep 01, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keeping work in complex fields.
parent
1774119b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
13 deletions
+58
-13
word/Editor/Document.js
word/Editor/Document.js
+18
-8
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+10
-0
word/Editor/Paragraph/ComplexField.js
word/Editor/Paragraph/ComplexField.js
+5
-5
word/Editor/Run.js
word/Editor/Run.js
+25
-0
No files found.
word/Editor/Document.js
View file @
7bb23d5b
...
...
@@ -15503,15 +15503,12 @@ CDocument.prototype.AddField = function(nType, oPr)
if
(
!
oParagraph
)
return
false
;
var
oField
=
new
CComplexField
();
var
oRun
=
new
ParaRun
();
var
oInstr
=
new
ParaInstrText
(
fieldtype_PAGENUM
,
oPr
);
oRun
.
Add_ToContent
(
0
,
oField
.
GetBeginChar
());
oRun
.
Add_ToContent
(
1
,
oInstr
);
oRun
.
Add_ToContent
(
2
,
oField
.
GetSeparateChar
());
var
oRun
=
new
ParaRun
();
oRun
.
Add_ToContent
(
0
,
new
ParaFieldChar
(
fldchartype_Begin
));
oRun
.
Add_ToContent
(
1
,
new
ParaInstrText
(
fieldtype_PAGENUM
,
oPr
));
oRun
.
Add_ToContent
(
2
,
new
ParaFieldChar
(
fldchartype_Separate
));
oRun
.
Add_ToContent
(
3
,
new
ParaText
(
"
1
"
));
oRun
.
Add_ToContent
(
4
,
oField
.
GetEndChar
(
));
oRun
.
Add_ToContent
(
4
,
new
ParaFieldChar
(
fldchartype_End
));
oParagraph
.
Add
(
oRun
);
return
true
;
}
...
...
@@ -15533,6 +15530,19 @@ CDocument.prototype.RegroupComplexFields = function()
this
.
Content
[
nIndex
].
RegroupComplexFields
(
oRegroupManager
);
}
};
CDocument
.
prototype
.
UpdateComplexField
=
function
(
oField
)
{
};
CDocument
.
prototype
.
GetCurrentComplexFields
=
function
()
{
var
oParagraph
=
this
.
GetCurrentParagraph
();
if
(
!
oParagraph
)
return
[];
return
oParagraph
.
GetCurrentComplexFields
();
};
function
TEST_ADDFIELD
()
...
...
word/Editor/Paragraph.js
View file @
7bb23d5b
...
...
@@ -12305,6 +12305,16 @@ Paragraph.prototype.RegroupComplexFields = function(oRegroupManager)
this
.
Content
[
nIndex
].
RegroupComplexFields
(
oRegroupManager
);
}
};
Paragraph
.
prototype
.
GetCurrentComplexFields
=
function
()
{
var
oParaPos
=
this
.
Get_ParaContentPos
(
this
.
Selection
.
Use
,
false
,
false
);
if
(
!
oParaPos
)
return
[];
var
oRun
=
this
.
Get_ClassesByPos
(
oParaPos
);
if
(
!
oRun
||
!
(
oRun
instanceof
ParaRun
))
return
[];
};
var
pararecalc_0_All
=
0
;
var
pararecalc_0_None
=
1
;
...
...
word/Editor/Paragraph/ComplexField.js
View file @
7bb23d5b
...
...
@@ -41,13 +41,13 @@ var fldchartype_Begin = 0;
var
fldchartype_Separate
=
1
;
var
fldchartype_End
=
2
;
function
ParaFieldChar
(
Type
,
ComplexField
)
function
ParaFieldChar
(
Type
)
{
CRunElementBase
.
call
(
this
);
this
.
Use
=
true
;
this
.
CharType
=
undefined
===
Type
?
fldchartype_Begin
:
Type
;
this
.
ComplexField
=
ComplexField
;
this
.
ComplexField
=
null
;
}
ParaFieldChar
.
prototype
=
Object
.
create
(
CRunElementBase
.
prototype
);
ParaFieldChar
.
prototype
.
constructor
=
ParaFieldChar
;
...
...
@@ -134,9 +134,9 @@ ParaInstrText.prototype.GetFieldCode = function()
function
CComplexField
()
{
this
.
BeginChar
=
n
ew
ParaFieldChar
(
fldchartype_Begin
,
this
)
;
this
.
EndChar
=
n
ew
ParaFieldChar
(
fldchartype_End
,
this
)
;
this
.
SeparateChar
=
n
ew
ParaFieldChar
(
fldchartype_Separate
,
this
)
;
this
.
BeginChar
=
n
ull
;
this
.
EndChar
=
n
ull
;
this
.
SeparateChar
=
n
ull
;
this
.
Instruction
=
""
;
}
CComplexField
.
prototype
.
ResetInstruction
=
function
()
...
...
word/Editor/Run.js
View file @
7bb23d5b
...
...
@@ -1079,6 +1079,25 @@ ParaRun.prototype.private_UpdateCompositeInputPositionsOnRemove = function(Pos,
}
};
ParaRun
.
prototype
.
GetLogicDocument
=
function
()
{
if
(
this
.
Paragraph
&&
this
.
Paragraph
.
LogicDocument
)
return
this
.
Paragraph
.
LogicDocument
;
return
editor
.
WordControl
.
m_oLogicDocument
;
};
ParaRun
.
prototype
.
private_CheckNeedRegroupComplexFieldsOnChangeContent
=
function
(
arrItems
)
{
for
(
var
nIndex
=
0
,
nCount
=
arrItems
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
if
(
para_FieldChar
===
arrItems
[
nIndex
].
Type
)
{
var
oLogicDocument
=
this
.
GetLogicDocument
();
oLogicDocument
.
FieldsManager
.
SetNeedRegroupComplexFields
(
true
);
return
;
}
}
};
// Добавляем элемент в позицию с сохранием в историю
ParaRun
.
prototype
.
Add_ToContent
=
function
(
Pos
,
Item
,
UpdatePosition
)
...
...
@@ -1089,6 +1108,8 @@ ParaRun.prototype.Add_ToContent = function(Pos, Item, UpdatePosition)
if
(
true
===
UpdatePosition
)
this
.
private_UpdatePositionsOnAdd
(
Pos
);
this
.
private_CheckNeedRegroupComplexFieldsOnChangeContent
([
Item
]);
// Обновляем позиции в NearestPos
var
NearPosLen
=
this
.
NearPosArray
.
length
;
for
(
var
Index
=
0
;
Index
<
NearPosLen
;
Index
++
)
...
...
@@ -1143,6 +1164,8 @@ ParaRun.prototype.Remove_FromContent = function(Pos, Count, UpdatePosition)
this
.
Content
.
splice
(
Pos
,
Count
);
this
.
private_CheckNeedRegroupComplexFieldsOnChangeContent
(
DeletedItems
);
if
(
true
===
UpdatePosition
)
this
.
private_UpdatePositionsOnRemove
(
Pos
,
Count
);
...
...
@@ -1209,6 +1232,8 @@ ParaRun.prototype.Concat_ToContent = function(NewItems)
// Отмечаем, что надо перемерить элементы в данном ране
this
.
RecalcInfo
.
Measure
=
true
;
this
.
private_CheckNeedRegroupComplexFieldsOnChangeContent
(
NewItems
);
};
// Определим строку и отрезок текущей позиции
...
...
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