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
a96213fc
Commit
a96213fc
authored
Dec 21, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented new function for removing all footnotes from document.
parent
4d05af70
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
8 deletions
+107
-8
common/HistoryCommon.js
common/HistoryCommon.js
+4
-0
word/Editor/Document.js
word/Editor/Document.js
+89
-7
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+1
-0
word/Editor/Run.js
word/Editor/Run.js
+9
-1
word/api.js
word/api.js
+4
-0
No files found.
common/HistoryCommon.js
View file @
a96213fc
...
...
@@ -1007,6 +1007,9 @@
case
AscDFH
.
historydescription_Document_SetFootnotePr
:
sString
=
"
Document_SetFootnotePr
"
;
break
;
case
AscDFH
.
historydescription_Document_RemoveAllFootnotes
:
sString
=
"
Document_RemoveAllFootnotes
"
;
break
;
}
return
sString
;
...
...
@@ -2808,6 +2811,7 @@
window
[
'
AscDFH
'
].
historydescription_Document_AddPageCount
=
0x013b
;
window
[
'
AscDFH
'
].
historydescription_Document_AddFootnote
=
0x013c
;
window
[
'
AscDFH
'
].
historydescription_Document_SetFootnotePr
=
0x013d
;
window
[
'
AscDFH
'
].
historydescription_Document_RemoveAllFootnotes
=
0x013e
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
...
...
word/Editor/Document.js
View file @
a96213fc
...
...
@@ -11082,6 +11082,51 @@ CDocument.prototype.AddFootnote = function(sText)
}
}
};
CDocument
.
prototype
.
RemoveAllFootnotes
=
function
()
{
var
nDocPosType
=
this
.
Get_DocPosType
();
if
(
docpostype_Content
!==
nDocPosType
&&
docpostype_Footnotes
!==
nDocPosType
)
return
;
var
oEngine
=
new
CDocumentFootnotesRangeEngine
(
true
);
oEngine
.
Init
(
null
,
null
);
var
arrParagraphs
=
this
.
Get_AllParagraphs
({
OnlyMainDocument
:
true
,
All
:
true
});
for
(
var
nIndex
=
0
,
nCount
=
arrParagraphs
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
arrParagraphs
[
nIndex
].
Get_FootnotesList
(
oEngine
);
}
var
arrFootnotes
=
oEngine
.
GetRange
();
var
arrParagraphs
=
oEngine
.
GetParagraphs
();
var
arrRuns
=
oEngine
.
GetRuns
();
var
arrRefs
=
oEngine
.
GetRefs
();
if
(
arrRuns
.
length
!==
arrRefs
.
length
||
arrFootnotes
.
length
!==
arrRuns
.
length
)
return
;
if
(
false
===
this
.
Document_Is_SelectionLocked
(
changestype_None
,
{
Type
:
changestype_2_ElementsArray_and_Type
,
Elements
:
arrParagraphs
,
CheckType
:
changestype_Paragraph_Content
},
true
))
{
this
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_RemoveAllFootnotes
);
for
(
var
nIndex
=
0
,
nCount
=
arrFootnotes
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
oRef
=
arrRefs
[
nIndex
];
var
oRun
=
arrRuns
[
nIndex
];
oRun
.
RemoveElement
(
oRef
);
}
this
.
Recalculate
();
if
(
docpostype_Footnotes
===
nDocPosType
)
{
this
.
CurPos
.
Type
=
docpostype_Content
;
if
(
arrRuns
.
length
>
0
)
arrRuns
[
0
].
Make_ThisElementCurrent
();
}
}
};
CDocument
.
prototype
.
GetFootnotesController
=
function
()
{
return
this
.
Footnotes
;
...
...
@@ -16746,20 +16791,26 @@ CDocumentNumberingInfoEngine.prototype.Get_NumInfo = function()
return
this
.
NumInfo
;
};
function
CDocumentFootnotesRangeEngine
()
function
CDocumentFootnotesRangeEngine
(
bExtendedInfo
)
{
this
.
m_oFirstFootnote
=
null
;
// Если не задана ищем с начала
this
.
m_oLastFootnote
=
null
;
// Если не задана ищем до конца
this
.
m_arrFootnotes
=
[];
this
.
m_bForceStop
=
false
;
this
.
m_arrFootnotes
=
[];
this
.
m_bForceStop
=
false
;
this
.
m_bExtendedInfo
=
(
true
===
bExtendedInfo
?
true
:
false
);
this
.
m_arrParagraphs
=
[];
this
.
m_oCurParagraph
=
null
;
this
.
m_arrRuns
=
[];
this
.
m_arrRefs
=
[];
}
CDocumentFootnotesRangeEngine
.
prototype
.
Init
=
function
(
oFirstFootnote
,
oLastFootnote
)
{
this
.
m_oFirstFootnote
=
oFirstFootnote
?
oFirstFootnote
:
null
;
this
.
m_oLastFootnote
=
oLastFootnote
?
oLastFootnote
:
null
;
};
CDocumentFootnotesRangeEngine
.
prototype
.
Add
=
function
(
oFootnote
)
CDocumentFootnotesRangeEngine
.
prototype
.
Add
=
function
(
oFootnote
,
oFootnoteRef
,
oRun
)
{
if
(
!
oFootnote
||
true
===
this
.
m_bForceStop
)
return
;
...
...
@@ -16767,18 +16818,18 @@ CDocumentFootnotesRangeEngine.prototype.Add = function(oFootnote)
if
(
this
.
m_arrFootnotes
.
length
<=
0
&&
null
!==
this
.
m_oFirstFootnote
)
{
if
(
this
.
m_oFirstFootnote
===
oFootnote
)
this
.
m_arrFootnotes
.
push
(
oFootnote
);
this
.
private_AddFootnote
(
oFootnote
,
oFootnoteRef
,
oRun
);
else
if
(
this
.
m_oLastFootnote
===
oFootnote
)
this
.
m_bForceStop
=
true
;
}
else
if
(
this
.
m_arrFootnotes
.
length
>=
1
&&
null
!==
this
.
m_oLastFootnote
)
{
if
(
this
.
m_oLastFootnote
!==
this
.
m_arrFootnotes
[
this
.
m_arrFootnotes
.
length
-
1
])
this
.
m_arrFootnotes
.
push
(
oFootnote
);
this
.
private_AddFootnote
(
oFootnote
,
oFootnoteRef
,
oRun
);
}
else
{
this
.
m_arrFootnotes
.
push
(
oFootnote
);
this
.
private_AddFootnote
(
oFootnote
,
oFootnoteRef
,
oRun
);
}
};
CDocumentFootnotesRangeEngine
.
prototype
.
IsRangeFull
=
function
()
...
...
@@ -16795,6 +16846,37 @@ CDocumentFootnotesRangeEngine.prototype.GetRange = function()
{
return
this
.
m_arrFootnotes
;
};
CDocumentFootnotesRangeEngine
.
prototype
.
GetParagraphs
=
function
()
{
return
this
.
m_arrParagraphs
;
};
CDocumentFootnotesRangeEngine
.
prototype
.
SetCurrentParagraph
=
function
(
oParagraph
)
{
this
.
m_oCurParagraph
=
oParagraph
;
};
CDocumentFootnotesRangeEngine
.
prototype
.
private_AddFootnote
=
function
(
oFootnote
,
oFootnoteRef
,
oRun
)
{
this
.
m_arrFootnotes
.
push
(
oFootnote
);
if
(
true
===
this
.
m_bExtendedInfo
)
{
this
.
m_arrRuns
.
push
(
oRun
);
this
.
m_arrRefs
.
push
(
oFootnoteRef
);
// Добавляем в общий список используемых параграфов
var
nCount
=
this
.
m_arrParagraphs
.
length
;
if
(
nCount
<=
0
||
this
.
m_arrParagraphs
[
nCount
-
1
]
!==
this
.
m_oCurParagraph
)
this
.
m_arrParagraphs
[
nCount
]
=
this
.
m_oCurParagraph
;
}
};
CDocumentFootnotesRangeEngine
.
prototype
.
GetRuns
=
function
()
{
return
this
.
m_arrRuns
;
};
CDocumentFootnotesRangeEngine
.
prototype
.
GetRefs
=
function
()
{
return
this
.
m_arrRefs
;
};
//-------------------------------------------------------------export---------------------------------------------------
...
...
word/Editor/Paragraph.js
View file @
a96213fc
...
...
@@ -12039,6 +12039,7 @@ Paragraph.prototype.private_CompareBorderSettings = function(Pr1, Pr2)
};
Paragraph
.
prototype
.
Get_FootnotesList
=
function
(
oEngine
)
{
oEngine
.
SetCurrentParagraph
(
this
);
for
(
var
nIndex
=
0
,
nCount
=
this
.
Content
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
if
(
this
.
Content
[
nIndex
].
Get_FootnotesList
)
...
...
word/Editor/Run.js
View file @
a96213fc
...
...
@@ -8989,7 +8989,7 @@ ParaRun.prototype.Get_FootnotesList = function(oEngine)
var
oItem
=
this
.
Content
[
nIndex
];
if
(
para_FootnoteReference
===
oItem
.
Type
)
{
oEngine
.
Add
(
oItem
.
Get_Footnote
());
oEngine
.
Add
(
oItem
.
Get_Footnote
()
,
oItem
,
this
);
}
}
};
...
...
@@ -9007,6 +9007,14 @@ ParaRun.prototype.GetParaEnd = function()
return
null
;
};
ParaRun
.
prototype
.
RemoveElement
=
function
(
oElement
)
{
for
(
var
nIndex
=
0
,
nCount
=
this
.
Content
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
if
(
oElement
===
this
.
Content
[
nIndex
])
return
this
.
Remove_FromContent
(
nIndex
,
1
,
true
);
}
};
function
CParaRunStartState
(
Run
)
{
...
...
word/api.js
View file @
a96213fc
...
...
@@ -3782,6 +3782,10 @@ background-repeat: no-repeat;\
{
return
this
.
WordControl
.
m_oLogicDocument
.
AddFootnote
(
sText
);
};
asc_docs_api
.
prototype
.
asc_RemoveAllFootnotes
=
function
()
{
this
.
WordControl
.
m_oLogicDocument
.
RemoveAllFootnotes
();
};
asc_docs_api
.
prototype
[
"
asc_AddFootnote
"
]
=
asc_docs_api
.
prototype
.
asc_AddFootnote
;
asc_docs_api
.
prototype
[
"
asc_GetFootnoteProps
"
]
=
asc_docs_api
.
prototype
.
asc_GetFootnoteProps
;
asc_docs_api
.
prototype
[
"
asc_SetFootnoteProps
"
]
=
asc_docs_api
.
prototype
.
asc_SetFootnoteProps
;
...
...
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