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
c80061d1
Commit
c80061d1
authored
Sep 09, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented increasing index number of footnotes on the page.
parent
5847f774
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
67 deletions
+46
-67
word/Editor/FootEndNote.js
word/Editor/FootEndNote.js
+10
-0
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+16
-61
word/Editor/ParagraphContent.js
word/Editor/ParagraphContent.js
+13
-4
word/Editor/Paragraph_Recalculate.js
word/Editor/Paragraph_Recalculate.js
+5
-0
word/Editor/Run.js
word/Editor/Run.js
+2
-2
No files found.
word/Editor/FootEndNote.js
View file @
c80061d1
...
...
@@ -41,6 +41,8 @@
function
CFootEndnote
(
DocumentController
)
{
CFootEndnote
.
superclass
.
constructor
.
call
(
this
,
DocumentController
,
DocumentController
?
DocumentController
.
Get_DrawingDocument
()
:
undefined
,
0
,
0
,
0
,
0
,
true
,
false
,
false
);
this
.
Number
=
1
;
}
AscCommon
.
extendClass
(
CFootEndnote
,
CDocumentContent
);
...
...
@@ -74,6 +76,14 @@ CFootEndnote.prototype.Read_FromBinary2 = function(Reader)
Reader
.
GetLong
();
// Должен вернуть historyitem_type_DocumentContent
CFootEndnote
.
superclass
.
Read_FromBinary2
.
call
(
this
,
Reader
);
};
CFootEndnote
.
prototype
.
SetNumber
=
function
(
nNumber
)
{
this
.
Number
=
nNumber
;
};
CFootEndnote
.
prototype
.
GetNumber
=
function
()
{
return
this
.
Number
;
};
//--------------------------------------------------------export----------------------------------------------------
window
[
'
AscCommonWord
'
]
=
window
[
'
AscCommonWord
'
]
||
{};
...
...
word/Editor/Footnotes.js
View file @
c80061d1
...
...
@@ -392,75 +392,30 @@ CFootnotesController.prototype.Shift = function(nPageAbs, nColumnAbs, dX, dY)
oFootnote
.
Shift
(
nFootnotePageIndex
,
dX
,
dY
);
}
};
/**
* Добавляем заданную сноску на страницу для пересчета.
* @param {number} nPageAbs
* @param {number} nColumnAbs
* @param {CFootEndnote} oFootnote
* @param {number} dBottom
*/
CFootnotesController
.
prototype
.
AddFootnoteToPage
=
function
(
nPageAbs
,
nColumnAbs
,
oFootnote
,
dBottom
)
{
var
oColumn
=
this
.
private_GetPageColumn
(
nPageAbs
,
nColumnAbs
);
if
(
!
oColumn
)
return
;
// TODO: Проверить ссылку с предыдущей колонки
if
(
oColumn
.
Elements
.
length
<=
0
||
oColumn
.
Y
<
dBottom
)
oColumn
.
Y
=
dBottom
;
oColumn
.
Elements
.
push
(
oFootnote
);
};
/**
* Убираем заданную сноску со страницы при пересчетею..
* @param {number} nPageAbs
* @param {number} nColumnAbs
* @param {CFootEndnote} oFootnote
*/
CFootnotesController
.
prototype
.
RemoveFootnoteFromPage
=
function
(
nPageAbs
,
nColumnAbs
,
oFootnote
)
CFootnotesController
.
prototype
.
GetFootnoteNumberOnPage
=
function
(
nPageAbs
,
nColumnAbs
)
{
var
oColumn
=
this
.
private_GetPageColumn
(
nPageAbs
,
nColumnAbs
);
if
(
!
oColumn
)
return
;
for
(
var
n
Index
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
// Случай, когда своя отдельная нумерация на каждой странице
// Мы делаем не совсем как в Word, если у нас происходит ситуация, что ссылка на сноску на одной странице, а сама
// сноска на следующей, тогда у этих страниц нумерация общая, в Word ставится номер "1" в такой ситуации, и становится
// непонятно, потому что есть две ссылки с номером 1 на странице, ссылающиеся на разные сноски.
for
(
var
n
ColumnIndex
=
nColumnAbs
;
nColumnIndex
>=
0
;
--
nColum
nIndex
)
{
if
(
oColumn
.
Elements
[
nIndex
]
===
oFootnote
)
{
oColumn
.
Elements
.
splice
(
nIndex
,
1
);
return
;
}
}
};
CFootnotesController
.
prototype
.
GetFootnoteNumberOnPage
=
function
(
nPageAbs
,
nColumnAbs
,
oFootnote
)
{
var
oPage
=
this
.
Pages
[
nPageAbs
];
if
(
!
oPage
)
return
1
;
var
oColumn
=
this
.
private_GetPageColumn
(
nPageAbs
,
nColumnIndex
);
var
nFootnoteIndex
=
1
;
for
(
var
nColumnIndex
=
0
,
nColumnsCount
=
oPage
.
Columns
.
length
;
nColumnIndex
<=
Math
.
min
(
nColumnAbs
,
nColumnsCount
-
1
);
++
nColumnIndex
)
{
var
oColumn
=
oPage
.
Columns
[
nColumnIndex
];
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
if
(
oColumn
.
Elements
.
length
>
0
)
{
var
oCurFootnote
=
oColumn
.
Elements
[
nIndex
];
// Сноски начинающиеся не на данной колонке мы не учитываем
if
(
0
===
oCurFootnote
.
GetElementPageIndex
(
nPageAbs
,
nColumnIndex
))
{
if
(
oFootnote
&&
oFootnote
===
oCurFootnote
)
return
nFootnoteIndex
;
var
oFootnote
=
oColumn
.
Elements
[
oColumn
.
Elements
.
length
-
1
];
var
nStartPage
=
oFootnote
.
Get_StartPage_Absolute
();
nFootnoteIndex
++
;
}
if
(
nStartPage
>=
nPageAbs
||
(
nStartPage
===
nPageAbs
-
1
&&
true
!==
oFootnote
.
Is_ContentOnFirstPage
()))
return
oFootnote
.
GetNumber
()
+
1
;
else
return
1
;
}
}
return
nFootnoteIndex
;
return
1
;
};
/**
* Проверяем, используется заданная сноска в документе.
...
...
word/Editor/ParagraphContent.js
View file @
c80061d1
...
...
@@ -7641,14 +7641,15 @@ ParaFootnoteReference.prototype.Get_Footnote = function()
{
return
this
.
Footnote
;
};
ParaFootnoteReference
.
prototype
.
UpdateNumber
=
function
(
nPageAbs
,
nColumnAbs
)
ParaFootnoteReference
.
prototype
.
UpdateNumber
=
function
(
nPageAbs
,
nColumnAbs
,
nAdditional
)
{
if
(
this
.
Footnote
)
{
var
oLogicDocument
=
this
.
Footnote
.
Get_LogicDocument
();
var
oFootnotesController
=
oLogicDocument
.
GetFootnotesController
();
this
.
Number
=
oFootnotesController
.
GetFootnoteNumberOnPage
(
nPageAbs
,
nColumnAbs
,
this
.
Footnote
)
;
this
.
Number
=
oFootnotesController
.
GetFootnoteNumberOnPage
(
nPageAbs
,
nColumnAbs
)
+
nAdditional
;
this
.
private_Measure
();
this
.
Footnote
.
SetNumber
(
this
.
Number
);
}
};
ParaFootnoteReference
.
prototype
.
private_Measure
=
function
()
...
...
@@ -7689,15 +7690,23 @@ function ParaFootnoteRef(Footnote)
ParaFootnoteRef
.
superclass
.
constructor
.
call
(
this
,
Footnote
);
}
AscCommon
.
extendClass
(
ParaFootnoteRef
,
ParaFootnoteReference
);
ParaFootnoteRef
.
prototype
.
Type
=
para_FootnoteRef
;
ParaFootnoteRef
.
prototype
.
Type
=
para_FootnoteRef
;
ParaFootnoteRef
.
prototype
.
Get_Type
=
function
()
{
return
para_FootnoteRef
;
};
ParaFootnoteRef
.
prototype
.
Copy
=
function
()
ParaFootnoteRef
.
prototype
.
Copy
=
function
()
{
return
new
ParaFootnoteRef
(
this
.
Get_Footnote
());
};
ParaFootnoteRef
.
prototype
.
UpdateNumber
=
function
()
{
if
(
this
.
Footnote
)
{
this
.
Number
=
this
.
Footnote
.
GetNumber
();
this
.
private_Measure
();
}
};
/**
* Класс представляющий собой разделитель (который в основном используется для сносок).
...
...
word/Editor/Paragraph_Recalculate.js
View file @
c80061d1
...
...
@@ -3014,6 +3014,11 @@ CParagraphRecalculateStateWrap.prototype =
this
.
Footnotes
.
push
({
FootnoteReference
:
FootnoteReference
,
Pos
:
Pos
});
},
GetFootnoteReferencesCount
:
function
()
{
return
this
.
Footnotes
.
length
;
},
SetFast
:
function
(
bValue
)
{
this
.
Fast
=
bValue
;
...
...
word/Editor/Run.js
View file @
c80061d1
...
...
@@ -2343,12 +2343,12 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
if
(
para_FootnoteReference
===
ItemType
)
{
Item
.
UpdateNumber
(
P
ara
.
Get_AbsolutePage
(
PRS
.
Page
),
Para
.
Get_AbsoluteColumn
(
PRS
.
Page
));
Item
.
UpdateNumber
(
P
RS
.
PageAbs
,
PRS
.
ColumnAbs
,
PRS
.
GetFootnoteReferencesCount
(
));
PRS
.
Add_FootnoteReference
(
Item
,
Pos
);
}
else
if
(
para_FootnoteRef
===
ItemType
)
{
Item
.
UpdateNumber
(
Para
.
Get_AbsolutePage
(
PRS
.
Page
),
Para
.
Get_AbsoluteColumn
(
PRS
.
Page
)
);
Item
.
UpdateNumber
();
}
// При проверке, убирается ли слово, мы должны учитывать ширину предшествующих пробелов.
...
...
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