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
872a522c
Commit
872a522c
authored
Sep 28, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented adding a footnote with custom mark.
parent
264d0000
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
18 deletions
+75
-18
word/Editor/Document.js
word/Editor/Document.js
+38
-12
word/Editor/ParagraphContent.js
word/Editor/ParagraphContent.js
+7
-1
word/Editor/Run.js
word/Editor/Run.js
+30
-5
No files found.
word/Editor/Document.js
View file @
872a522c
...
...
@@ -11425,7 +11425,7 @@ CDocument.prototype.GotoFootnotesOnPage = function(nPageIndex)
return
true
;
};
CDocument
.
prototype
.
AddFootnote
=
function
()
CDocument
.
prototype
.
AddFootnote
=
function
(
sText
)
{
var
nDocPosType
=
this
.
Get_DocPosType
();
if
(
docpostype_Content
!==
nDocPosType
&&
docpostype_Footnotes
!==
nDocPosType
)
...
...
@@ -11442,17 +11442,43 @@ CDocument.prototype.AddFootnote = function()
var
oFootnote
=
this
.
Footnotes
.
CreateFootnote
();
var
oParagraph
=
oFootnote
.
Get_ElementByIndex
(
0
);
if
(
sText
)
{
oParagraph
.
Style_Add
(
oStyles
.
GetDefaultFootnoteText
());
var
oRun
=
new
ParaRun
(
oParagraph
,
false
);
oRun
.
Set_RStyle
(
oStyles
.
GetDefaultFootnoteReference
());
oRun
.
Add_ToContent
(
0
,
new
ParaFootnoteRef
(
oFootnote
));
for
(
var
nIndex
=
0
,
nLen
=
sText
.
length
;
nIndex
<
nLen
;
++
nIndex
)
{
var
nChar
=
sText
.
charAt
(
nIndex
);
if
(
"
"
===
nChar
)
oRun
.
Add_ToContent
(
nIndex
,
new
ParaSpace
(),
true
);
else
oRun
.
Add_ToContent
(
nIndex
,
new
ParaText
(
nChar
),
true
);
}
oParagraph
.
Add_ToContent
(
0
,
oRun
);
oRun
=
new
ParaRun
(
oParagraph
,
false
);
oRun
.
Add_ToContent
(
0
,
new
ParaSpace
());
oParagraph
.
Add_ToContent
(
1
,
oRun
);
oFootnote
.
Cursor_MoveToEndPos
(
false
);
this
.
Paragraph_Add
(
new
ParaFootnoteReference
(
oFootnote
,
true
,
sText
));
}
else
{
oParagraph
.
Style_Add
(
oStyles
.
GetDefaultFootnoteText
());
var
oRun
=
new
ParaRun
(
oParagraph
,
false
);
oRun
.
Set_RStyle
(
oStyles
.
GetDefaultFootnoteReference
());
oRun
.
Add_ToContent
(
0
,
new
ParaFootnoteRef
(
oFootnote
));
oParagraph
.
Add_ToContent
(
0
,
oRun
);
oRun
=
new
ParaRun
(
oParagraph
,
false
);
oRun
.
Add_ToContent
(
0
,
new
ParaSpace
());
oParagraph
.
Add_ToContent
(
1
,
oRun
);
oFootnote
.
Cursor_MoveToEndPos
(
false
);
this
.
Paragraph_Add
(
new
ParaFootnoteReference
(
oFootnote
));
}
this
.
Set_DocPosType
(
docpostype_Footnotes
);
this
.
Footnotes
.
Set_CurrentElement
(
true
,
0
,
oFootnote
);
...
...
word/Editor/ParagraphContent.js
View file @
872a522c
...
...
@@ -7567,13 +7567,15 @@ ParaPresentationNumbering.prototype =
* Класс представляющий ссылку на сноску.
* @param {CFootEndnote} Footnote - Ссылка на сноску.
* @param {string} CustomMark
* @param {string?} CustomText
* @constructor
* @extends {CRunElementBase}
*/
function
ParaFootnoteReference
(
Footnote
,
CustomMark
)
function
ParaFootnoteReference
(
Footnote
,
CustomMark
,
CustomText
)
{
this
.
Footnote
=
Footnote
;
this
.
CustomMark
=
CustomMark
?
CustomMark
:
undefined
;
this
.
CustomText
=
CustomText
?
CustomText
:
undefined
;
this
.
Width
=
0
;
this
.
WidthVisible
=
0
;
...
...
@@ -7748,6 +7750,10 @@ ParaFootnoteReference.prototype.IsCustomMarkFollows = function()
{
return
(
true
===
this
.
CustomMark
?
true
:
false
);
};
ParaFootnoteReference
.
prototype
.
GetCustomText
=
function
()
{
return
this
.
CustomText
;
};
/**
* Класс представляющий номер сноски внутри сноски.
...
...
word/Editor/Run.js
View file @
872a522c
...
...
@@ -444,7 +444,7 @@ ParaRun.prototype.Add = function(Item, bMath)
if
(
para_Run
===
PrevElement
.
Type
&&
DstReviewType
===
PrevElement
.
Get_ReviewType
()
&&
true
===
this
.
Pr
.
Is_Equal
(
PrevElement
.
Pr
)
&&
PrevElement
.
ReviewInfo
&&
true
===
PrevElement
.
ReviewInfo
.
Is_CurrentUser
())
{
PrevElement
.
State
.
ContentPos
=
PrevElement
.
Content
.
length
;
PrevElement
.
Add_ToContent
(
PrevElement
.
Content
.
length
,
Item
,
true
);
PrevElement
.
private_AddItemToRun
(
PrevElement
.
Content
.
length
,
Item
);
PrevElement
.
Make_ThisElementCurrent
();
return
;
}
...
...
@@ -456,7 +456,7 @@ ParaRun.prototype.Add = function(Item, bMath)
if
(
para_Run
===
NextElement
.
Type
&&
DstReviewType
===
NextElement
.
Get_ReviewType
()
&&
true
===
this
.
Pr
.
Is_Equal
(
NextElement
.
Pr
)
&&
NextElement
.
ReviewInfo
&&
true
===
NextElement
.
ReviewInfo
.
Is_CurrentUser
())
{
NextElement
.
State
.
ContentPos
=
0
;
NextElement
.
Add_ToContent
(
0
,
Item
,
true
);
NextElement
.
private_AddItemToRun
(
0
,
Item
);
NextElement
.
Make_ThisElementCurrent
();
return
;
}
...
...
@@ -466,7 +466,7 @@ ParaRun.prototype.Add = function(Item, bMath)
var
NewRun
=
new
ParaRun
(
this
.
Paragraph
,
bMath
);
NewRun
.
Set_Pr
(
this
.
Pr
.
Copy
());
NewRun
.
Set_ReviewType
(
DstReviewType
);
NewRun
.
Add_ToContent
(
0
,
Item
,
true
);
NewRun
.
private_AddItemToRun
(
0
,
Item
);
if
(
0
===
CurPos
)
Parent
.
Add_ToContent
(
RunPos
,
NewRun
);
...
...
@@ -492,7 +492,7 @@ ParaRun.prototype.Add = function(Item, bMath)
{
var
NewRun
=
new
ParaRun
(
this
.
Paragraph
,
bMath
);
NewRun
.
Set_Pr
(
this
.
Pr
.
Copy
());
NewRun
.
Add_ToContent
(
0
,
Item
,
true
);
NewRun
.
private_AddItemToRun
(
0
,
Item
);
// Ищем данный элемент в родительском классе
var
RunPos
=
this
.
private_GetPosInParent
(
this
.
Parent
);
...
...
@@ -500,7 +500,9 @@ ParaRun.prototype.Add = function(Item, bMath)
this
.
Parent
.
Internal_Content_Add
(
RunPos
,
NewRun
,
true
);
}
else
this
.
Add_ToContent
(
this
.
State
.
ContentPos
,
Item
,
true
);
{
this
.
private_AddItemToRun
(
this
.
State
.
ContentPos
,
Item
);
}
};
ParaRun
.
prototype
.
private_SplitRunInCurPos
=
function
()
...
...
@@ -550,6 +552,29 @@ ParaRun.prototype.private_IsCurPosNearFootnoteReference = function()
return
false
;
};
ParaRun
.
prototype
.
private_AddItemToRun
=
function
(
nPos
,
Item
)
{
if
(
para_FootnoteReference
===
Item
.
Type
&&
true
===
Item
.
IsCustomMarkFollows
()
&&
undefined
!==
Item
.
GetCustomText
())
{
this
.
Add_ToContent
(
nPos
,
Item
,
true
);
var
sCustomText
=
Item
.
GetCustomText
();
for
(
var
nIndex
=
0
,
nLen
=
sCustomText
.
length
;
nIndex
<
nLen
;
++
nIndex
)
{
var
nChar
=
sCustomText
.
charAt
(
nIndex
);
if
(
"
"
===
nChar
)
this
.
Add_ToContent
(
nPos
+
1
+
nIndex
,
new
ParaSpace
(),
true
);
else
this
.
Add_ToContent
(
nPos
+
1
+
nIndex
,
new
ParaText
(
nChar
),
true
);
}
}
else
{
this
.
Add_ToContent
(
nPos
,
Item
,
true
);
}
};
ParaRun
.
prototype
.
Remove
=
function
(
Direction
,
bOnAddText
)
{
...
...
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