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
3f414e86
Commit
3f414e86
authored
Sep 01, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented very first variant of continuation a footnote on the next column.
parent
21d5f451
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
53 deletions
+117
-53
word/Editor/Document.js
word/Editor/Document.js
+5
-3
word/Editor/DocumentContent.js
word/Editor/DocumentContent.js
+29
-15
word/Editor/FootEndNote.js
word/Editor/FootEndNote.js
+7
-3
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+75
-31
word/Editor/Paragraph_Recalculate.js
word/Editor/Paragraph_Recalculate.js
+1
-1
No files found.
word/Editor/Document.js
View file @
3f414e86
...
...
@@ -2260,8 +2260,7 @@ CDocument.prototype.Recalculate_Page = function()
var
StartPos
=
this
.
Get_PageContentStartPos
(
PageIndex
,
StartIndex
);
this
.
Footnotes
.
Reset
(
PageIndex
,
this
.
SectionsInfo
.
Get_SectPr
(
StartIndex
).
SectPr
);
//this.private_RecalculatePageFootnotes(PageIndex);
this
.
private_RecalculatePageFootnotes
(
PageIndex
,
0
);
this
.
Pages
[
PageIndex
].
ResetStartElement
=
this
.
FullRecalc
.
ResetStartElement
;
this
.
Pages
[
PageIndex
].
X
=
StartPos
.
X
;
...
...
@@ -2765,6 +2764,9 @@ CDocument.prototype.Recalculate_PageColumn = function()
if
(
Index
>=
Count
||
_PageIndex
>
PageIndex
||
_ColumnIndex
>
ColumnIndex
)
{
this
.
private_RecalculateShiftFootnotes
(
PageIndex
,
ColumnIndex
);
if
(
Index
<
Count
&&
_PageIndex
===
PageIndex
||
_ColumnIndex
>
ColumnIndex
)
this
.
private_RecalculatePageFootnotes
(
_PageIndex
,
_ColumnIndex
);
}
if
(
true
===
bReDraw
)
...
...
@@ -2863,7 +2865,7 @@ CDocument.prototype.private_RecalculateIsNewSection = function(nPageAbs, nConten
CDocument
.
prototype
.
private_RecalculatePageFootnotes
=
function
(
nPageAbs
,
nColumnAbs
)
{
var
oPageMetrics
=
this
.
Get_PageContentStartPos
(
nPageAbs
);
this
.
Footnotes
.
Recalculate
(
nPageAbs
,
nColumnAbs
,
oPageMetrics
.
YLimit
);
this
.
Footnotes
.
Recalculate
(
nPageAbs
,
nColumnAbs
,
oPageMetrics
.
Y
,
oPageMetrics
.
Y
Limit
);
};
CDocument
.
prototype
.
private_RecalculateShiftFootnotes
=
function
(
nPageAbs
,
nColumnAbs
)
{
...
...
word/Editor/DocumentContent.js
View file @
3f414e86
...
...
@@ -8410,34 +8410,48 @@ CDocumentContent.prototype.Internal_Content_RemoveAll = function()
//-----------------------------------------------------------------------------------
CDocumentContent
.
prototype
.
Get_StartPage_Absolute
=
function
()
{
return
this
.
Get_AbsolutePage
(
0
);
return
this
.
Get_AbsolutePage
(
0
);
};
CDocumentContent
.
prototype
.
Get_StartPage_Relative
=
function
()
{
return
this
.
StartPage
;
return
this
.
StartPage
;
};
CDocumentContent
.
prototype
.
Get_AbsolutePage
=
function
(
CurPage
)
CDocumentContent
.
prototype
.
Set_StartPage
=
function
(
StartPage
,
StartColumn
,
ColumnsCount
)
{
return
this
.
Parent
.
Get_AbsolutePage
(
this
.
StartPage
+
CurPage
);
this
.
StartPage
=
StartPage
;
this
.
StartColumn
=
undefined
!==
StartColumn
?
StartColumn
:
0
;
this
.
ColumnsCount
=
undefined
!==
ColumnsCount
?
ColumnsCount
:
1
;
};
CDocumentContent
.
prototype
.
Get_
AbsoluteColumn
=
function
(
CurPage
)
CDocumentContent
.
prototype
.
Get_
ColumnsCount
=
function
(
)
{
return
(
this
.
StartColumn
+
CurPage
)
-
(((
this
.
StartColumn
+
CurPage
)
/
this
.
ColumnsCount
|
0
)
*
this
.
ColumnsCount
)
;
return
this
.
ColumnsCount
;
};
CDocumentContent
.
prototype
.
Set_StartPage
=
function
(
StartPage
,
StartColumn
,
ColumnsCount
)
CDocumentContent
.
prototype
.
private_GetRelativePageIndex
=
function
(
CurPage
)
{
this
.
StartPage
=
StartPage
;
this
.
StartColumn
=
undefined
!==
StartColumn
?
StartColumn
:
0
;
this
.
ColumnsCount
=
undefined
!==
ColumnsCount
?
ColumnsCount
:
1
;
if
(
!
this
.
ColumnsCount
||
0
===
this
.
ColumnsCount
)
return
this
.
StartPage
+
CurPage
;
return
this
.
StartPage
+
((
this
.
StartColumn
+
CurPage
)
/
this
.
ColumnsCount
|
0
);
};
// Приходит абсолютное значение страницы(по отношению к родительскому классу), на выходе - относительное
CDocumentContent
.
prototype
.
Get_Page_Relative
=
function
(
AbsPage
)
CDocumentContent
.
prototype
.
private_GetAbsolutePageIndex
=
function
(
CurPage
)
{
return
Math
.
min
(
this
.
Pages
.
length
-
1
,
Math
.
max
(
AbsPage
-
this
.
StartPage
,
0
));
return
this
.
Parent
.
Get_AbsolutePage
(
this
.
private_GetRelativePageIndex
(
CurPage
));
};
CDocumentContent
.
prototype
.
Get_
ColumnsCount
=
function
()
CDocumentContent
.
prototype
.
Get_
StartColumn
=
function
()
{
return
this
.
ColumnsCount
;
return
this
.
StartColumn
;
};
CDocumentContent
.
prototype
.
Get_AbsolutePage
=
function
(
CurPage
)
{
return
this
.
private_GetAbsolutePageIndex
(
CurPage
);
};
CDocumentContent
.
prototype
.
Get_AbsoluteColumn
=
function
(
CurPage
)
{
return
this
.
private_GetColumnIndex
(
CurPage
);
};
CDocumentContent
.
prototype
.
private_GetColumnIndex
=
function
(
CurPage
)
{
return
(
this
.
StartColumn
+
CurPage
)
-
(((
this
.
StartColumn
+
CurPage
)
/
this
.
ColumnsCount
|
0
)
*
this
.
ColumnsCount
);
};
//-----------------------------------------------------------------------------------
// Undo/Redo функции
...
...
word/Editor/FootEndNote.js
View file @
3f414e86
...
...
@@ -52,9 +52,13 @@ CFootEndnote.prototype.GetElementPageIndex = function(nPageAbs, nColumnAbs)
var
nStartColumn
=
this
.
StartColumn
;
var
nColumnsCount
=
this
.
ColumnsCount
;
var
nCurPage
=
nColumnAbs
-
nStartColumn
+
(
nPageAbs
-
nStartPage
)
*
nColumnsCount
;
nCurPage
=
Math
.
max
(
0
,
Math
.
min
(
this
.
Pages
.
length
-
1
,
nCurPage
));
return
nCurPage
;
return
Math
.
max
(
0
,
nColumnAbs
-
nStartColumn
+
(
nPageAbs
-
nStartPage
)
*
nColumnsCount
);
};
CFootEndnote
.
prototype
.
Get_PageContentStartPos
=
function
(
nCurPage
)
{
var
nPageAbs
=
this
.
Get_AbsolutePage
(
nCurPage
);
var
nColumnAbs
=
this
.
Get_AbsoluteColumn
(
nCurPage
);
return
this
.
Parent
.
Get_PageContentStartPos
(
nPageAbs
,
nColumnAbs
);
};
CFootEndnote
.
prototype
.
Write_ToBinary2
=
function
(
Writer
)
{
...
...
word/Editor/Footnotes.js
View file @
3f414e86
...
...
@@ -155,23 +155,21 @@ CFootnotesController.prototype.Reset = function(nPageIndex, oSectPr)
/**
* Пересчитываем сноски на заданной странице.
*/
CFootnotesController
.
prototype
.
Recalculate
=
function
(
nPageAbs
,
nColumnAbs
,
YLimit
)
CFootnotesController
.
prototype
.
Recalculate
=
function
(
nPageAbs
,
nColumnAbs
,
Y
,
Y
Limit
)
{
if
(
true
===
this
.
IsEmptyPageColumn
(
nPageAbs
,
nColumnAbs
))
var
oPrevColumn
=
(
nColumnAbs
>
0
?
this
.
Pages
[
nPageAbs
].
Columns
[
nColumnAbs
-
1
]
:
(
nPageAbs
>
0
?
this
.
Pages
[
nPageAbs
-
1
].
Columns
[
this
.
Pages
[
nPageAbs
-
1
].
Columns
.
length
-
1
]
:
null
));
if
(
true
===
this
.
IsEmptyPageColumn
(
nPageAbs
,
nColumnAbs
)
&&
(
null
===
oPrevColumn
||
true
!==
oPrevColumn
.
Continue
))
return
;
var
oPage
=
this
.
Pages
[
nPageAbs
];
var
oColumn
=
oPage
.
Columns
[
nColumnAbs
];
var
oPage
=
this
.
Pages
[
nPageAbs
];
var
oColumn
=
oPage
.
Columns
[
nColumnAbs
];
var
nColumnsCount
=
oPage
.
Columns
.
length
;
var
X
=
oColumn
.
X
;
var
XLimit
=
oColumn
.
XLimit
;
var
_YLimit
=
YLimit
-
oColumn
.
Y
;
oColumn
.
YLimit
=
YLimit
;
// Мы пересчет начинаем с 0, потом просто делаем сдвиг, через функцию Shift.
var
oPrevColumn
=
(
nColumnAbs
>
0
?
oPage
.
Columns
[
nColumnAbs
-
1
]
:
(
nPageAbs
>
0
?
this
.
Pages
[
nPageAbs
-
1
].
Columns
[
this
.
Pages
[
nPageAbs
-
1
].
Colums
.
length
-
1
]
:
null
));
if
(
null
!==
oPrevColumn
&&
true
===
oPrevColumn
.
Continue
&&
oPrevColumn
.
Elements
.
length
>
0
)
{
var
oLastFootnote
=
oPrevColumn
.
Elements
[
oPrevColumn
.
Elements
.
length
-
1
];
...
...
@@ -179,9 +177,10 @@ CFootnotesController.prototype.Recalculate = function(nPageAbs, nColumnAbs, YLim
oColumn
.
Elements
.
splice
(
0
,
0
,
oLastFootnote
);
oColumn
.
ContinuePrev
=
true
;
oColumn
.
Y
=
Y
;
}
var
_YLimit
=
YLimit
-
oColumn
.
Y
;
var
CurY
=
0
;
if
(
oColumn
.
ContinuePrev
)
...
...
@@ -192,7 +191,7 @@ CFootnotesController.prototype.Recalculate = function(nPageAbs, nColumnAbs, YLim
this
.
ContinuationSeparatorFootnote
.
Reset
(
X
,
CurY
,
XLimit
,
_YLimit
);
this
.
ContinuationSeparatorFootnote
.
Set_StartPage
(
nPageAbs
,
nColumnAbs
,
nColumnsCount
);
this
.
ContinuationSeparatorFootnote
.
Recalculate_Page
(
0
,
true
);
oColumn
.
ContinuationSeparator
Footnote
=
this
.
ContinuationSeparatorFootnote
.
Save_RecalculateObject
();
oColumn
.
ContinuationSeparator
RecalculateObject
=
this
.
ContinuationSeparatorFootnote
.
Save_RecalculateObject
();
var
Bounds
=
this
.
ContinuationSeparatorFootnote
.
Get_PageBounds
(
0
);
CurY
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
...
...
@@ -213,6 +212,7 @@ CFootnotesController.prototype.Recalculate = function(nPageAbs, nColumnAbs, YLim
}
}
oColumn
.
YStart
=
CurY
;
for
(
var
nIndex
=
0
;
nIndex
<
oColumn
.
Elements
.
length
;
++
nIndex
)
{
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
...
...
@@ -258,18 +258,32 @@ CFootnotesController.prototype.GetHeight = function(nPageAbs, nColumnAbs)
var
oColumn
=
this
.
Pages
[
nPageAbs
].
Columns
[
nColumnAbs
];
var
nHeight
=
0
;
if
(
null
!==
oColumn
.
SeparatorRecalculateObject
)
if
(
true
===
oColumn
.
ContinuePrev
)
{
if
(
null
!==
oColumn
.
ContinuationSeparatorRecalculateObject
)
{
this
.
ContinuationSeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
ContinuationSeparatorRecalculateObject
);
var
oBounds
=
this
.
ContinuationSeparatorFootnote
.
Get_PageBounds
(
0
);
nHeight
+=
oBounds
.
Bottom
-
oBounds
.
Top
;
}
}
else
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
SeparatorRecalculateObject
);
var
Bounds
=
this
.
SeparatorFootnote
.
Get_PageBounds
(
0
);
nHeight
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
if
(
null
!==
oColumn
.
SeparatorRecalculateObject
)
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
SeparatorRecalculateObject
);
var
oBounds
=
this
.
SeparatorFootnote
.
Get_PageBounds
(
0
);
nHeight
+=
oBounds
.
Bottom
-
oBounds
.
Top
;
}
}
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
var
Bounds
=
Footnote
.
Get_PageBounds
(
0
);
nHeight
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
var
oFootnote
=
oColumn
.
Elements
[
nIndex
];
var
nFootnotePageIndex
=
oFootnote
.
GetElementPageIndex
(
nPageAbs
,
nColumnAbs
);
var
oBounds
=
oFootnote
.
Get_PageBounds
(
nFootnotePageIndex
);
nHeight
+=
oBounds
.
Bottom
-
oBounds
.
Top
;
}
return
nHeight
;
...
...
@@ -292,16 +306,28 @@ CFootnotesController.prototype.Draw = function(nPageAbs, pGraphics)
if
(
!
oColumn
||
oColumn
.
Elements
.
length
<=
0
)
continue
;
if
(
null
!==
this
.
SeparatorFootnote
&&
null
!==
oColumn
.
SeparatorRecalculateObject
)
if
(
true
===
oColumn
.
ContinuePrev
)
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
SeparatorRecalculateObject
);
this
.
SeparatorFootnote
.
Draw
(
nPageAbs
,
pGraphics
);
if
(
null
!==
this
.
ContinuationSeparatorFootnote
&&
null
!==
oColumn
.
ContinuationSeparatorRecalculateObject
)
{
this
.
ContinuationSeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
ContinuationSeparatorRecalculateObject
);
this
.
ContinuationSeparatorFootnote
.
Draw
(
nPageAbs
,
pGraphics
);
}
}
else
{
if
(
null
!==
this
.
SeparatorFootnote
&&
null
!==
oColumn
.
SeparatorRecalculateObject
)
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
SeparatorRecalculateObject
);
this
.
SeparatorFootnote
.
Draw
(
nPageAbs
,
pGraphics
);
}
}
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
Footnote
.
Draw
(
nPageAbs
,
pGraphics
);
var
oFootnote
=
oColumn
.
Elements
[
nIndex
];
var
nFootnotePageIndex
=
oFootnote
.
GetElementPageIndex
(
nPageAbs
,
nColumnIndex
);
oFootnote
.
Draw
(
nFootnotePageIndex
+
oFootnote
.
StartPage
,
pGraphics
);
}
}
};
...
...
@@ -321,17 +347,30 @@ CFootnotesController.prototype.Shift = function(nPageAbs, nColumnAbs, dX, dY)
if
(
!
oColumn
)
return
;
if
(
null
!==
this
.
SeparatorFootnote
&&
null
!==
oColumn
.
SeparatorRecalculateObject
)
if
(
true
===
oColumn
.
ContinuePrev
)
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
SeparatorRecalculateObject
);
this
.
SeparatorFootnote
.
Shift
(
0
,
dX
,
dY
);
oColumn
.
SeparatorRecalculateObject
=
this
.
SeparatorFootnote
.
Save_RecalculateObject
();
if
(
null
!==
this
.
ContinuationSeparatorFootnote
&&
null
!==
oColumn
.
ContinuationSeparatorRecalculateObject
)
{
this
.
ContinuationSeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
ContinuationSeparatorRecalculateObject
);
this
.
ContinuationSeparatorFootnote
.
Shift
(
0
,
dX
,
dY
);
oColumn
.
ContinuationSeparatorRecalculateObject
=
this
.
ContinuationSeparatorFootnote
.
Save_RecalculateObject
();
}
}
else
{
if
(
null
!==
this
.
SeparatorFootnote
&&
null
!==
oColumn
.
SeparatorRecalculateObject
)
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
SeparatorRecalculateObject
);
this
.
SeparatorFootnote
.
Shift
(
0
,
dX
,
dY
);
oColumn
.
SeparatorRecalculateObject
=
this
.
SeparatorFootnote
.
Save_RecalculateObject
();
}
}
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
Footnote
.
Shift
(
0
,
dX
,
dY
);
var
oFootnote
=
oColumn
.
Elements
[
nIndex
];
var
nFootnotePageIndex
=
oFootnote
.
GetElementPageIndex
(
nPageAbs
,
nColumnAbs
);
oFootnote
.
Shift
(
nFootnotePageIndex
,
dX
,
dY
);
}
this
.
NeedShift
=
false
;
...
...
@@ -480,10 +519,13 @@ CFootnotesController.prototype.Refresh_RecalcData2 = function(nRelPageIndex)
this
.
LogicDocument
.
Refresh_RecalcData2
(
nIndex
,
nAbsPageIndex
);
}
};
CFootnotesController
.
prototype
.
Get_PageContentStartPos
=
function
(
Page
Abs
)
CFootnotesController
.
prototype
.
Get_PageContentStartPos
=
function
(
nPageAbs
,
nColumn
Abs
)
{
//TODO: Реализовать
return
{
X
:
0
,
Y
:
0
,
XLimit
:
0
,
YLimit
:
0
};
var
oColumn
=
this
.
private_GetPageColumn
(
nPageAbs
,
nColumnAbs
);
if
(
!
oColumn
)
return
{
X
:
0
,
Y
:
0
,
XLimit
:
0
,
YLimit
:
0
};
return
{
X
:
oColumn
.
X
,
Y
:
oColumn
.
YStart
,
XLimit
:
oColumn
.
XLimit
,
YLimit
:
oColumn
.
YLimit
-
oColumn
.
Y
};
};
CFootnotesController
.
prototype
.
GetCurFootnote
=
function
()
{
...
...
@@ -2873,6 +2915,7 @@ function CFootEndnotePageColumn()
this
.
Y
=
0
;
this
.
XLimit
=
0
;
this
.
YLimit
=
0
;
this
.
YStart
=
0
;
// фактически тут задается высота специальной сноски-разделителя
this
.
Elements
=
[];
this
.
Continue
=
false
;
...
...
@@ -2889,6 +2932,7 @@ CFootEndnotePageColumn.prototype.Reset = function()
this
.
Y
=
0
;
this
.
XLimit
=
0
;
this
.
YLimit
=
0
;
this
.
YStart
=
0
;
this
.
Elements
=
[];
this
.
Continue
=
false
;
...
...
word/Editor/Paragraph_Recalculate.js
View file @
3f414e86
...
...
@@ -1853,7 +1853,7 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
if
(
true
===
RecalcInfo
.
Can_RecalcObject
())
{
RecalcInfo
.
Set_FootnoteReference
(
oFootnote
,
nPageAbs
,
nColumnAbs
);
this
.
Parent
.
Footnotes
.
AddFootnoteToPage
(
nPageAbs
,
nColumnAbs
,
oFootnote
,
this
.
Lines
[
CurLine
].
Bottom
);
this
.
Parent
.
Footnotes
.
AddFootnoteToPage
(
nPageAbs
,
nColumnAbs
,
oFootnote
,
this
.
Pages
[
CurPage
].
Y
+
this
.
Lines
[
CurLine
].
Bottom
);
PRS
.
RecalcResult
=
recalcresult_CurPage
|
recalcresultflags_Column
|
recalcresultflags_Footnotes
;
return
false
;
}
...
...
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