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
0f52b44e
Commit
0f52b44e
authored
Aug 19, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue with adding a template through a plugin. Reworking footnotes.
parent
bf2e73df
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
161 additions
and
52 deletions
+161
-52
word/Editor/Document.js
word/Editor/Document.js
+28
-22
word/Editor/DocumentContent.js
word/Editor/DocumentContent.js
+12
-6
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+118
-21
word/Editor/Paragraph_Recalculate.js
word/Editor/Paragraph_Recalculate.js
+2
-2
word/apiBuilder.js
word/apiBuilder.js
+1
-1
No files found.
word/Editor/Document.js
View file @
0f52b44e
...
@@ -1664,18 +1664,19 @@ CDocument.prototype.Get_PageContentStartPos2 = function(StartPageIndex, St
...
@@ -1664,18 +1664,19 @@ CDocument.prototype.Get_PageContentStartPos2 = function(StartPageIndex, St
var
SectPr
=
this
.
SectionsInfo
.
Get_SectPr
(
ElementIndex
).
SectPr
;
var
SectPr
=
this
.
SectionsInfo
.
Get_SectPr
(
ElementIndex
).
SectPr
;
var
FootnotesHeight
=
this
.
Footnotes
.
Get_Height
(
StartPageIndex
);
var
Y
=
SectPr
.
Get_PageMargin_Top
();
var
YLimit
=
SectPr
.
Get_PageHeight
()
-
SectPr
.
Get_PageMargin_Bottom
()
-
FootnotesHeight
;
var
X
=
SectPr
.
Get_PageMargin_Left
();
var
XLimit
=
SectPr
.
Get_PageWidth
()
-
SectPr
.
Get_PageMargin_Right
();
var
ColumnsCount
=
SectPr
.
Get_ColumnsCount
();
var
ColumnsCount
=
SectPr
.
Get_ColumnsCount
();
var
ColumnAbs
=
(
StartColumnIndex
+
ElementPageIndex
)
-
((
StartColumnIndex
+
ElementPageIndex
)
/
ColumnsCount
|
0
)
*
ColumnsCount
;
var
ColumnAbs
=
(
StartColumnIndex
+
ElementPageIndex
)
-
((
StartColumnIndex
+
ElementPageIndex
)
/
ColumnsCount
|
0
)
*
ColumnsCount
;
var
PageAbs
=
StartPageIndex
+
((
StartColumnIndex
+
ElementPageIndex
)
/
ColumnsCount
|
0
);
var
PageAbs
=
StartPageIndex
+
((
StartColumnIndex
+
ElementPageIndex
)
/
ColumnsCount
|
0
);
var
SectionIndex
=
this
.
FullRecalc
.
SectionIndex
;
var
FootnotesHeight
=
this
.
Footnotes
.
GetHeight
(
StartPageIndex
,
ColumnAbs
);
var
Y
=
SectPr
.
Get_PageMargin_Top
();
var
YLimit
=
SectPr
.
Get_PageHeight
()
-
SectPr
.
Get_PageMargin_Bottom
()
-
FootnotesHeight
;
var
X
=
SectPr
.
Get_PageMargin_Left
();
var
XLimit
=
SectPr
.
Get_PageWidth
()
-
SectPr
.
Get_PageMargin_Right
();
var
SectionIndex
=
this
.
FullRecalc
.
SectionIndex
;
if
(
this
.
Pages
[
PageAbs
]
&&
this
.
Pages
[
PageAbs
].
Sections
[
SectionIndex
])
if
(
this
.
Pages
[
PageAbs
]
&&
this
.
Pages
[
PageAbs
].
Sections
[
SectionIndex
])
{
{
Y
=
this
.
Pages
[
PageAbs
].
Sections
[
SectionIndex
].
Get_Y
();
Y
=
this
.
Pages
[
PageAbs
].
Sections
[
SectionIndex
].
Get_Y
();
...
@@ -2251,8 +2252,10 @@ CDocument.prototype.Recalculate_Page = function()
...
@@ -2251,8 +2252,10 @@ CDocument.prototype.Recalculate_Page = function()
//console.log( "Regular Recalc " + PageIndex );
//console.log( "Regular Recalc " + PageIndex );
var
StartPos
=
this
.
Get_PageContentStartPos
(
PageIndex
,
StartIndex
);
var
StartPos
=
this
.
Get_PageContentStartPos
(
PageIndex
,
StartIndex
);
this
.
Footnotes
.
Reset
(
PageIndex
);
this
.
private_RecalculatePageFootnotes
(
PageIndex
);
this
.
Footnotes
.
Reset
(
PageIndex
,
this
.
SectionsInfo
.
Get_SectPr
(
StartIndex
).
SectPr
);
//this.private_RecalculatePageFootnotes(PageIndex);
this
.
Pages
[
PageIndex
].
ResetStartElement
=
this
.
FullRecalc
.
ResetStartElement
;
this
.
Pages
[
PageIndex
].
ResetStartElement
=
this
.
FullRecalc
.
ResetStartElement
;
this
.
Pages
[
PageIndex
].
X
=
StartPos
.
X
;
this
.
Pages
[
PageIndex
].
X
=
StartPos
.
X
;
...
@@ -2459,7 +2462,7 @@ CDocument.prototype.Recalculate_PageColumn = function()
...
@@ -2459,7 +2462,7 @@ CDocument.prototype.Recalculate_PageColumn = function()
if
(
RecalcResult
&
recalcresultflags_Footnotes
)
if
(
RecalcResult
&
recalcresultflags_Footnotes
)
{
{
this
.
private_RecalculatePageFootnotes
(
PageIndex
);
this
.
private_RecalculatePageFootnotes
(
PageIndex
,
ColumnIndex
);
}
}
break
;
break
;
...
@@ -2753,9 +2756,9 @@ CDocument.prototype.Recalculate_PageColumn = function()
...
@@ -2753,9 +2756,9 @@ CDocument.prototype.Recalculate_PageColumn = function()
//console.log("LastRecalc: " + ((new Date().getTime() - this.StartTime) / 1000));
//console.log("LastRecalc: " + ((new Date().getTime() - this.StartTime) / 1000));
}
}
if
(
Index
>=
Count
||
_PageIndex
>
PageIndex
)
if
(
Index
>=
Count
||
_PageIndex
>
PageIndex
||
_ColumnIndex
>
ColumnIndex
)
{
{
this
.
private_RecalculateShiftFootnotes
(
PageIndex
);
this
.
private_RecalculateShiftFootnotes
(
PageIndex
,
ColumnIndex
);
}
}
if
(
true
===
bReDraw
)
if
(
true
===
bReDraw
)
...
@@ -2851,16 +2854,15 @@ CDocument.prototype.private_RecalculateIsNewSection = function(nPageAbs, nConten
...
@@ -2851,16 +2854,15 @@ CDocument.prototype.private_RecalculateIsNewSection = function(nPageAbs, nConten
return
bNewSection
;
return
bNewSection
;
};
};
CDocument
.
prototype
.
private_RecalculatePageFootnotes
=
function
(
PageIndex
)
CDocument
.
prototype
.
private_RecalculatePageFootnotes
=
function
(
nPageAbs
,
nColumnAbs
)
{
{
var
PageMetrics
=
this
.
Get_PageContentStartPos
(
PageIndex
);
this
.
Footnotes
.
Recalculate
(
nPageAbs
,
nColumnAbs
,
0
,
10000
);
this
.
Footnotes
.
Recalculate
(
PageIndex
,
PageMetrics
.
X
,
PageMetrics
.
XLimit
,
0
,
10000
);
};
};
CDocument
.
prototype
.
private_RecalculateShiftFootnotes
=
function
(
PageIndex
)
CDocument
.
prototype
.
private_RecalculateShiftFootnotes
=
function
(
nPageAbs
,
nColumnAbs
)
{
{
var
FootnotesHeight
=
this
.
Footnotes
.
Get_Height
(
PageIndex
);
var
dFootnotesHeight
=
this
.
Footnotes
.
GetHeight
(
nPageAbs
,
nColumnAbs
);
var
PageMetrics
=
this
.
Get_PageContentStartPos
(
PageIndex
);
var
oPageMetrics
=
this
.
Get_PageContentStartPos
(
nPageAbs
);
this
.
Footnotes
.
Shift
(
PageIndex
,
0
,
PageMetrics
.
YLimit
-
FootnotesHeight
);
this
.
Footnotes
.
Shift
(
nPageAbs
,
0
,
oPageMetrics
.
YLimit
-
d
FootnotesHeight
);
};
};
CDocument
.
prototype
.
private_RecalculateFlowTable
=
function
(
RecalcInfo
)
CDocument
.
prototype
.
private_RecalculateFlowTable
=
function
(
RecalcInfo
)
{
{
...
@@ -6764,6 +6766,10 @@ CDocument.prototype.OnKeyDown = function(e)
...
@@ -6764,6 +6766,10 @@ CDocument.prototype.OnKeyDown = function(e)
bUpdateSelection
=
false
;
bUpdateSelection
=
false
;
bRetValue
=
keydownresult_PreventAll
;
bRetValue
=
keydownresult_PreventAll
;
}
}
// else if (e.KeyCode === 113)
// {
// this.AddFootnote();
// }
else
if
(
e
.
KeyCode
==
121
&&
true
===
e
.
ShiftKey
)
// Shift + F10 - контекстное меню
else
if
(
e
.
KeyCode
==
121
&&
true
===
e
.
ShiftKey
)
// Shift + F10 - контекстное меню
{
{
var
X_abs
,
Y_abs
,
oPosition
,
ConvertedPos
;
var
X_abs
,
Y_abs
,
oPosition
,
ConvertedPos
;
...
@@ -7400,7 +7406,7 @@ CDocument.prototype.Internal_Content_Add = function(Position, NewObject, bCheckT
...
@@ -7400,7 +7406,7 @@ CDocument.prototype.Internal_Content_Add = function(Position, NewObject, bCheckT
// Запоминаем, что нам нужно произвести переиндексацию элементов
// Запоминаем, что нам нужно произвести переиндексацию элементов
this
.
private_ReindexContent
(
Position
);
this
.
private_ReindexContent
(
Position
);
};
};
CDocument
.
prototype
.
Internal_Content_Remove
=
function
(
Position
,
Count
)
CDocument
.
prototype
.
Internal_Content_Remove
=
function
(
Position
,
Count
,
bCorrectionCheck
)
{
{
var
ChangePos
=
-
1
;
var
ChangePos
=
-
1
;
...
@@ -7436,7 +7442,7 @@ CDocument.prototype.Internal_Content_Remove = function(Position, Count)
...
@@ -7436,7 +7442,7 @@ CDocument.prototype.Internal_Content_Remove = function(Position, Count)
NextObj
.
Set_DocumentPrev
(
PrevObj
);
NextObj
.
Set_DocumentPrev
(
PrevObj
);
// Проверим, что последний элемент не таблица
// Проверим, что последний элемент не таблица
if
(
type_Table
==
this
.
Content
[
this
.
Content
.
length
-
1
].
GetType
(
))
if
(
false
!==
bCorrectionCheck
&&
(
this
.
Content
.
length
<=
0
||
type_Table
==
this
.
Content
[
this
.
Content
.
length
-
1
].
GetType
()
))
this
.
Internal_Content_Add
(
this
.
Content
.
length
,
new
Paragraph
(
this
.
DrawingDocument
,
this
,
0
,
0
,
0
,
0
,
0
));
this
.
Internal_Content_Add
(
this
.
Content
.
length
,
new
Paragraph
(
this
.
DrawingDocument
,
this
,
0
,
0
,
0
,
0
,
0
));
// Обновим информацию о секциях
// Обновим информацию о секциях
...
...
word/Editor/DocumentContent.js
View file @
0f52b44e
...
@@ -68,6 +68,10 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split,
...
@@ -68,6 +68,10 @@ function CDocumentContent(Parent, DrawingDocument, X, Y, XLimit, YLimit, Split,
this
.
XLimit
=
XLimit
;
this
.
XLimit
=
XLimit
;
this
.
YLimit
=
YLimit
;
this
.
YLimit
=
YLimit
;
this
.
StartPage
=
0
;
this
.
StartColumn
=
0
;
this
.
ColumnsCount
=
1
;
this
.
Parent
=
Parent
;
this
.
Parent
=
Parent
;
this
.
DrawingDocument
=
null
;
this
.
DrawingDocument
=
null
;
...
@@ -8339,7 +8343,7 @@ CDocumentContent.prototype.Internal_Content_Add = function(Position, NewOb
...
@@ -8339,7 +8343,7 @@ CDocumentContent.prototype.Internal_Content_Add = function(Position, NewOb
this
.
private_ReindexContent
(
Position
);
this
.
private_ReindexContent
(
Position
);
};
};
CDocumentContent
.
prototype
.
Internal_Content_Remove
=
function
(
Position
,
Count
)
CDocumentContent
.
prototype
.
Internal_Content_Remove
=
function
(
Position
,
Count
,
bCorrectionCheck
)
{
{
if
(
Position
<
0
||
Position
>=
this
.
Content
.
length
||
Count
<=
0
)
if
(
Position
<
0
||
Position
>=
this
.
Content
.
length
||
Count
<=
0
)
return
;
return
;
...
@@ -8371,7 +8375,7 @@ CDocumentContent.prototype.Internal_Content_Remove = function(Position, Count
...
@@ -8371,7 +8375,7 @@ CDocumentContent.prototype.Internal_Content_Remove = function(Position, Count
NextObj
.
Set_DocumentPrev
(
PrevObj
);
NextObj
.
Set_DocumentPrev
(
PrevObj
);
// Проверим, что последний элемент не таблица
// Проверим, что последний элемент не таблица
if
(
type_Table
==
this
.
Content
[
this
.
Content
.
length
-
1
].
GetType
(
))
if
(
false
!==
bCorrectionCheck
&&
(
this
.
Content
.
length
<=
0
||
type_Table
==
this
.
Content
[
this
.
Content
.
length
-
1
].
GetType
()
))
this
.
Internal_Content_Add
(
this
.
Content
.
length
,
new
Paragraph
(
this
.
DrawingDocument
,
this
,
0
,
50
,
50
,
this
.
XLimit
,
this
.
YLimit
,
this
.
bPresentation
===
true
));
this
.
Internal_Content_Add
(
this
.
Content
.
length
,
new
Paragraph
(
this
.
DrawingDocument
,
this
,
0
,
50
,
50
,
this
.
XLimit
,
this
.
YLimit
,
this
.
bPresentation
===
true
));
this
.
private_ReindexContent
(
Position
);
this
.
private_ReindexContent
(
Position
);
...
@@ -8418,11 +8422,13 @@ CDocumentContent.prototype.Get_AbsolutePage = function(CurPage)
...
@@ -8418,11 +8422,13 @@ CDocumentContent.prototype.Get_AbsolutePage = function(CurPage)
};
};
CDocumentContent
.
prototype
.
Get_AbsoluteColumn
=
function
(
CurPage
)
CDocumentContent
.
prototype
.
Get_AbsoluteColumn
=
function
(
CurPage
)
{
{
return
this
.
Parent
.
Get_AbsoluteColumn
(
this
.
StartPage
+
CurPage
);
return
(
this
.
StartColumn
+
CurPage
)
-
(((
this
.
StartColumn
+
CurPage
)
/
this
.
ColumnsCount
|
0
)
*
this
.
ColumnsCount
);
};
};
CDocumentContent
.
prototype
.
Set_StartPage
=
function
(
StartPage
)
CDocumentContent
.
prototype
.
Set_StartPage
=
function
(
StartPage
,
StartColumn
,
ColumnsCount
)
{
{
this
.
StartPage
=
StartPage
;
this
.
StartPage
=
StartPage
;
this
.
StartColumn
=
undefined
!==
StartColumn
?
StartColumn
:
0
;
this
.
ColumnsCount
=
undefined
!==
ColumnsCount
?
ColumnsCount
:
1
;
};
};
// Приходит абсолютное значение страницы(по отношению к родительскому классу), на выходе - относительное
// Приходит абсолютное значение страницы(по отношению к родительскому классу), на выходе - относительное
CDocumentContent
.
prototype
.
Get_Page_Relative
=
function
(
AbsPage
)
CDocumentContent
.
prototype
.
Get_Page_Relative
=
function
(
AbsPage
)
...
@@ -8431,7 +8437,7 @@ CDocumentContent.prototype.Get_Page_Relative = function(AbsPage)
...
@@ -8431,7 +8437,7 @@ CDocumentContent.prototype.Get_Page_Relative = function(AbsPage)
};
};
CDocumentContent
.
prototype
.
Get_ColumnsCount
=
function
()
CDocumentContent
.
prototype
.
Get_ColumnsCount
=
function
()
{
{
return
1
;
return
this
.
ColumnsCount
;
};
};
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
// Undo/Redo функции
// Undo/Redo функции
...
...
word/Editor/Footnotes.js
View file @
0f52b44e
...
@@ -111,25 +111,55 @@ CFootnotesController.prototype.Create_Footnote = function()
...
@@ -111,25 +111,55 @@ CFootnotesController.prototype.Create_Footnote = function()
/**
/**
* Сбрасываем рассчетные данный для заданной страницы.
* Сбрасываем рассчетные данный для заданной страницы.
* @param {number} nPageIndex
* @param {number} nPageIndex
* @param {CSectionPr} oSectPr
*/
*/
CFootnotesController
.
prototype
.
Reset
=
function
(
nPageIndex
)
CFootnotesController
.
prototype
.
Reset
=
function
(
nPageIndex
,
oSectPr
)
{
{
if
(
!
this
.
Pages
[
nPageIndex
])
if
(
!
this
.
Pages
[
nPageIndex
])
this
.
Pages
[
nPageIndex
]
=
new
CFootEndnotePage
();
this
.
Pages
[
nPageIndex
]
=
new
CFootEndnotePage
();
this
.
Pages
[
nPageIndex
].
Reset
();
var
oPage
=
this
.
Pages
[
nPageIndex
];
oPage
.
Reset
();
var
X
=
oSectPr
.
Get_PageMargin_Left
();
var
XLimit
=
oSectPr
.
Get_PageWidth
()
-
oSectPr
.
Get_PageMargin_Right
();
var
nColumnsCount
=
oSectPr
.
Get_ColumnsCount
();
for
(
var
nColumnIndex
=
0
;
nColumnIndex
<
nColumnsCount
;
++
nColumnIndex
)
{
var
_X
=
X
;
for
(
var
nTempColumnIndex
=
0
;
nTempColumnIndex
<
nColumnIndex
;
++
nTempColumnIndex
)
{
_X
+=
oSectPr
.
Get_ColumnWidth
(
nTempColumnIndex
);
_X
+=
oSectPr
.
Get_ColumnSpace
(
nTempColumnIndex
);
}
var
_XLimit
=
(
nColumnsCount
-
1
!==
nColumnIndex
?
X
+
oSectPr
.
Get_ColumnWidth
(
nColumnIndex
)
:
XLimit
);
var
oColumn
=
new
CFootEndnotePageColumn
();
oColumn
.
X
=
_X
;
oColumn
.
XLimit
=
_XLimit
;
oPage
.
AddColumn
(
oColumn
);
}
oPage
.
X
=
X
;
oPage
.
XLimit
=
XLimit
;
};
};
/**
/**
* Пересчитываем сноски на заданной странице.
* Пересчитываем сноски на заданной странице.
*/
*/
CFootnotesController
.
prototype
.
Recalculate
=
function
(
nPage
Index
,
X
,
XLimit
,
Y
,
YLimit
)
CFootnotesController
.
prototype
.
Recalculate
=
function
(
nPage
Abs
,
nColumnAbs
,
Y
,
YLimit
)
{
{
if
(
!
this
.
Pages
[
nPageIndex
])
if
(
true
===
this
.
IsEmptyPageColumn
(
nPageAbs
,
nColumnAbs
))
this
.
Pages
[
nPageIndex
]
=
new
CFootEndnotePage
();
if
(
true
===
this
.
Is_EmptyPage
(
nPageIndex
))
return
;
return
;
var
oPage
=
this
.
Pages
[
nPageAbs
];
var
oColumn
=
oPage
.
Columns
[
nColumnAbs
];
var
nColumnsCount
=
oPage
.
Columns
.
length
;
var
X
=
oColumn
.
X
;
var
XLimit
=
oColumn
.
XLimit
;
// Мы пересчет начинаем с 0, потом просто делаем сдвиг, через функцию Shift.
// Мы пересчет начинаем с 0, потом просто делаем сдвиг, через функцию Shift.
var
CurY
=
Y
;
var
CurY
=
Y
;
...
@@ -138,19 +168,19 @@ CFootnotesController.prototype.Recalculate = function(nPageIndex, X, XLimit, Y,
...
@@ -138,19 +168,19 @@ CFootnotesController.prototype.Recalculate = function(nPageIndex, X, XLimit, Y,
{
{
this
.
SeparatorFootnote
.
Prepare_RecalculateObject
();
this
.
SeparatorFootnote
.
Prepare_RecalculateObject
();
this
.
SeparatorFootnote
.
Reset
(
X
,
CurY
,
XLimit
,
10000
);
this
.
SeparatorFootnote
.
Reset
(
X
,
CurY
,
XLimit
,
10000
);
this
.
SeparatorFootnote
.
Set_StartPage
(
nPage
Index
);
this
.
SeparatorFootnote
.
Set_StartPage
(
nPage
Abs
,
nColumnAbs
,
nColumnsCount
);
this
.
SeparatorFootnote
.
Recalculate_Page
(
0
,
true
);
this
.
SeparatorFootnote
.
Recalculate_Page
(
0
,
true
);
this
.
Pages
[
nPageIndex
]
.
SeparatorRecalculateObject
=
this
.
SeparatorFootnote
.
Save_RecalculateObject
();
oColumn
.
SeparatorRecalculateObject
=
this
.
SeparatorFootnote
.
Save_RecalculateObject
();
var
Bounds
=
this
.
SeparatorFootnote
.
Get_PageBounds
(
0
);
var
Bounds
=
this
.
SeparatorFootnote
.
Get_PageBounds
(
0
);
CurY
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
CurY
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
}
}
for
(
var
nIndex
=
0
;
nIndex
<
this
.
Pages
[
nPageIndex
]
.
Elements
.
length
;
++
nIndex
)
for
(
var
nIndex
=
0
;
nIndex
<
oColumn
.
Elements
.
length
;
++
nIndex
)
{
{
var
Footnote
=
this
.
Pages
[
nPageIndex
]
.
Elements
[
nIndex
];
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
Footnote
.
Reset
(
X
,
CurY
,
XLimit
,
10000
);
Footnote
.
Reset
(
X
,
CurY
,
XLimit
,
10000
);
Footnote
.
Set_StartPage
(
nPage
Index
);
Footnote
.
Set_StartPage
(
nPage
Abs
,
nColumnAbs
,
nColumnCount
);
var
CurPage
=
0
;
var
CurPage
=
0
;
var
RecalcResult
=
recalcresult2_NextPage
;
var
RecalcResult
=
recalcresult2_NextPage
;
...
@@ -163,25 +193,28 @@ CFootnotesController.prototype.Recalculate = function(nPageIndex, X, XLimit, Y,
...
@@ -163,25 +193,28 @@ CFootnotesController.prototype.Recalculate = function(nPageIndex, X, XLimit, Y,
};
};
/**
/**
* Получаем суммарную высоту, занимаемую сносками на заданной странице.
* Получаем суммарную высоту, занимаемую сносками на заданной странице.
* @param {number} nPageIndex
* @param {number} nPageAbs
* @param {number} nColumnAbs
* @returns {number}
* @returns {number}
*/
*/
CFootnotesController
.
prototype
.
Get
_Height
=
function
(
nPageIndex
)
CFootnotesController
.
prototype
.
Get
Height
=
function
(
nPageAbs
,
nColumnAbs
)
{
{
if
(
true
===
this
.
Is
_EmptyPage
(
nPageIndex
))
if
(
true
===
this
.
Is
EmptyPageColumn
(
nPageAbs
,
nColumnAbs
))
return
0
;
return
0
;
var
nHeight
=
0
;
var
oColumn
=
this
.
Pages
[
nPageAbs
].
Columns
[
nColumnAbs
]
;
if
(
null
!==
this
.
SeparatorFootnote
)
var
nHeight
=
0
;
if
(
null
!==
oColumn
.
SeparatorRecalculateObject
)
{
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
SeparatorRecalculateObject
);
var
Bounds
=
this
.
SeparatorFootnote
.
Get_PageBounds
(
0
);
var
Bounds
=
this
.
SeparatorFootnote
.
Get_PageBounds
(
0
);
nHeight
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
nHeight
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
}
}
for
(
var
nIndex
=
0
;
nIndex
<
this
.
Pages
[
nPageIndex
].
Elements
.
length
;
++
nIndex
)
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Element
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
{
var
Footnote
=
this
.
Pages
[
nPageIndex
]
.
Elements
[
nIndex
];
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
var
Bounds
=
Footnote
.
Get_PageBounds
(
0
);
var
Bounds
=
Footnote
.
Get_PageBounds
(
0
);
nHeight
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
nHeight
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
}
}
...
@@ -237,10 +270,12 @@ CFootnotesController.prototype.Shift = function(nPageIndex, dX, dY)
...
@@ -237,10 +270,12 @@ CFootnotesController.prototype.Shift = function(nPageIndex, dX, dY)
/**
/**
* Добавляем заданную сноску на страницу для пересчета.
* Добавляем заданную сноску на страницу для пересчета.
* @param {number} nPageAbs
* @param {number} nPageAbs
* @param {number} nColumnAbs
* @param {CFootEndnote} oFootnote
* @param {CFootEndnote} oFootnote
*/
*/
CFootnotesController
.
prototype
.
AddFootnoteToPage
=
function
(
nPageAbs
,
oFootnote
)
CFootnotesController
.
prototype
.
AddFootnoteToPage
=
function
(
nPageAbs
,
nColumnAbs
,
oFootnote
)
{
{
if
(
!
this
.
Pages
[
nPageAbs
])
if
(
!
this
.
Pages
[
nPageAbs
])
this
.
Pages
[
nPageAbs
]
=
new
CFootEndnotePage
();
this
.
Pages
[
nPageAbs
]
=
new
CFootEndnotePage
();
...
@@ -331,7 +366,22 @@ CFootnotesController.prototype.OnContentReDraw = function(StartPageAbs, EndPageA
...
@@ -331,7 +366,22 @@ CFootnotesController.prototype.OnContentReDraw = function(StartPageAbs, EndPageA
*/
*/
CFootnotesController
.
prototype
.
Is_EmptyPage
=
function
(
nPageIndex
)
CFootnotesController
.
prototype
.
Is_EmptyPage
=
function
(
nPageIndex
)
{
{
if
(
!
this
.
Pages
[
nPageIndex
]
||
this
.
Pages
[
nPageIndex
].
Elements
.
length
<=
0
)
var
oPage
=
this
.
Pages
[
nPageIndex
];
if
(
!
oPage
)
return
true
;
for
(
var
nColumnIndex
=
0
,
nColumnsCount
=
oPage
.
Columns
.
length
;
nColumnIndex
<
nColumnsCount
;
++
nColumnIndex
)
{
if
(
true
!==
this
.
IsEmptyPageColumn
(
nPageIndex
,
nColumnIndex
))
return
false
;
}
return
true
;
};
CFootnotesController
.
prototype
.
IsEmptyPageColumn
=
function
(
nPageIndex
,
nColumnIndex
)
{
var
oColumn
=
this
.
private_GetPageColumn
(
nPageIndex
,
nColumnIndex
);
if
(
!
oColumn
||
oColumn
.
Elements
.
length
<=
0
)
return
true
;
return
true
;
return
false
;
return
false
;
...
@@ -658,6 +708,18 @@ CFootnotesController.prototype.AddFootnoteRef = function()
...
@@ -658,6 +708,18 @@ CFootnotesController.prototype.AddFootnoteRef = function()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private area
// Private area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CFootnotesController
.
prototype
.
private_GetPageColumn
=
function
(
nPageAbs
,
nColumnAbs
)
{
var
oPage
=
this
.
Pages
[
nPageAbs
];
if
(
!
oPage
)
return
null
;
var
oColumn
=
oPage
.
Columns
[
nColumnAbs
]
if
(
!
oColumn
)
return
null
;
return
oColumn
;
};
CFootnotesController
.
prototype
.
private_GetFootnoteOnPageByXY
=
function
(
X
,
Y
,
PageAbs
)
CFootnotesController
.
prototype
.
private_GetFootnoteOnPageByXY
=
function
(
X
,
Y
,
PageAbs
)
{
{
if
(
true
===
this
.
Is_EmptyPage
(
PageAbs
))
if
(
true
===
this
.
Is_EmptyPage
(
PageAbs
))
...
@@ -2663,6 +2725,33 @@ CFootnotesController.prototype.GetColumnSize = function()
...
@@ -2663,6 +2725,33 @@ CFootnotesController.prototype.GetColumnSize = function()
};
};
function
CFootEndnotePageColumn
()
{
this
.
X
=
0
;
this
.
Y
=
0
;
this
.
XLimit
=
0
;
this
.
YLimit
=
0
;
this
.
Elements
=
[];
this
.
SeparatorRecalculateObject
=
null
;
this
.
ContinuationSeparatorRecalculateObject
=
null
;
this
.
ContinuationNoticeRecalculateObject
=
null
;
}
CFootEndnotePageColumn
.
prototype
.
Reset
=
function
()
{
this
.
X
=
0
;
this
.
Y
=
0
;
this
.
XLimit
=
0
;
this
.
YLimit
=
0
;
this
.
Elements
=
[];
this
.
SeparatorRecalculateObject
=
null
;
this
.
ContinuationSeparatorRecalculateObject
=
null
;
this
.
ContinuationNoticeRecalculateObject
=
null
;
};
function
CFootEndnotePage
()
function
CFootEndnotePage
()
{
{
this
.
X
=
0
;
this
.
X
=
0
;
...
@@ -2675,6 +2764,8 @@ function CFootEndnotePage()
...
@@ -2675,6 +2764,8 @@ function CFootEndnotePage()
this
.
SeparatorRecalculateObject
=
null
;
this
.
SeparatorRecalculateObject
=
null
;
this
.
ContinuationSeparatorRecalculateObject
=
null
;
this
.
ContinuationSeparatorRecalculateObject
=
null
;
this
.
ContinuationNoticeRecalculateObject
=
null
;
this
.
ContinuationNoticeRecalculateObject
=
null
;
this
.
Columns
=
[];
}
}
CFootEndnotePage
.
prototype
.
Reset
=
function
()
CFootEndnotePage
.
prototype
.
Reset
=
function
()
{
{
...
@@ -2688,4 +2779,10 @@ CFootEndnotePage.prototype.Reset = function()
...
@@ -2688,4 +2779,10 @@ CFootEndnotePage.prototype.Reset = function()
this
.
SeparatorRecalculateObject
=
null
;
this
.
SeparatorRecalculateObject
=
null
;
this
.
ContinuationSeparatorRecalculateObject
=
null
;
this
.
ContinuationSeparatorRecalculateObject
=
null
;
this
.
ContinuationNoticeRecalculateObject
=
null
;
this
.
ContinuationNoticeRecalculateObject
=
null
;
this
.
Columns
=
[];
};
CFootEndnotePage
.
prototype
.
AddColumn
=
function
(
oColumn
)
{
this
.
Columns
.
push
(
oColumn
);
};
};
\ No newline at end of file
word/Editor/Paragraph_Recalculate.js
View file @
0f52b44e
...
@@ -1853,7 +1853,7 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
...
@@ -1853,7 +1853,7 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
var
PageAbs
=
this
.
Get_AbsolutePage
(
CurPage
);
var
PageAbs
=
this
.
Get_AbsolutePage
(
CurPage
);
RecalcInfo
.
Set_FootnoteReference
(
oFootnote
,
PageAbs
);
RecalcInfo
.
Set_FootnoteReference
(
oFootnote
,
PageAbs
);
this
.
Parent
.
Footnotes
.
AddFootnoteToPage
(
PageAbs
,
oFootnote
);
this
.
Parent
.
Footnotes
.
AddFootnoteToPage
(
PageAbs
,
oFootnote
);
PRS
.
RecalcResult
=
recalcresult_CurPage
|
recalcresultflags_
Page
|
recalcresultflags_Footnotes
;
PRS
.
RecalcResult
=
recalcresult_CurPage
|
recalcresultflags_
Column
|
recalcresultflags_Footnotes
;
return
false
;
return
false
;
}
}
else
if
(
true
===
RecalcInfo
.
Check_FootnoteReference
(
oFootnote
))
else
if
(
true
===
RecalcInfo
.
Check_FootnoteReference
(
oFootnote
))
...
@@ -1874,7 +1874,7 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
...
@@ -1874,7 +1874,7 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
// TODO: Реализовать
// TODO: Реализовать
RecalcInfo
.
Set_PageBreaFlowObjectPageBreakBefore
(
true
);
RecalcInfo
.
Set_PageBreaFlowObjectPageBreakBefore
(
true
);
this
.
Parent
.
Footnotes
.
RemoveFootnoteFromPage
(
PageAbs
,
oFootnote
);
this
.
Parent
.
Footnotes
.
RemoveFootnoteFromPage
(
PageAbs
,
oFootnote
);
PRS
.
RecalcResult
=
recalcresult_CurPage
|
recalcresultflags_
Page
|
recalcresultflags_Footnotes
;
PRS
.
RecalcResult
=
recalcresult_CurPage
|
recalcresultflags_
Column
|
recalcresultflags_Footnotes
;
return
false
;
return
false
;
}
}
}
}
...
...
word/apiBuilder.js
View file @
0f52b44e
...
@@ -1106,7 +1106,7 @@
...
@@ -1106,7 +1106,7 @@
*/
*/
ApiDocumentContent
.
prototype
.
RemoveAllElements
=
function
()
ApiDocumentContent
.
prototype
.
RemoveAllElements
=
function
()
{
{
this
.
Document
.
Content
=
[]
;
this
.
Document
.
Internal_Content_Remove
(
0
,
this
.
Document
.
Content
.
length
,
false
)
;
};
};
/**
/**
* Remove element by specified position.
* Remove element by specified position.
...
...
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