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
04a1c2e0
Commit
04a1c2e0
authored
Aug 25, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked some functions in Footnotes based on columns
parent
67431313
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
56 deletions
+125
-56
word/Editor/Document.js
word/Editor/Document.js
+3
-2
word/Editor/FootEndNote.js
word/Editor/FootEndNote.js
+4
-2
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+117
-51
word/Editor/Paragraph_Recalculate.js
word/Editor/Paragraph_Recalculate.js
+1
-1
No files found.
word/Editor/Document.js
View file @
04a1c2e0
...
...
@@ -1053,7 +1053,8 @@ CDocumentRecalcInfo.prototype =
Set_FootnoteReference
:
function
(
oFootnoteReference
,
nPageAbs
,
nColumnAbs
)
{
this
.
FootnoteReference
=
oFootnoteReference
;
this
.
FlowObjectPage
=
nPageAbs
;
this
.
FootnotePage
=
nPageAbs
;
this
.
FootnoteColumn
=
nColumnAbs
;
},
Check_FootnoteReference
:
function
(
oFootnoteReference
)
...
...
@@ -2867,7 +2868,7 @@ CDocument.prototype.private_RecalculateShiftFootnotes = function(nPageAbs, nColu
{
var
dFootnotesHeight
=
this
.
Footnotes
.
GetHeight
(
nPageAbs
,
nColumnAbs
);
var
oPageMetrics
=
this
.
Get_PageContentStartPos
(
nPageAbs
);
this
.
Footnotes
.
Shift
(
nPageAbs
,
0
,
oPageMetrics
.
YLimit
-
dFootnotesHeight
);
this
.
Footnotes
.
Shift
(
nPageAbs
,
nColumnAbs
,
0
,
oPageMetrics
.
YLimit
-
dFootnotesHeight
);
};
CDocument
.
prototype
.
private_RecalculateFlowTable
=
function
(
RecalcInfo
)
{
...
...
word/Editor/FootEndNote.js
View file @
04a1c2e0
...
...
@@ -45,11 +45,13 @@ function CFootEndnote(DocumentController)
AscCommon
.
extendClass
(
CFootEndnote
,
CDocumentContent
);
CFootEndnote
.
prototype
.
GetRelaitivePageIndex
=
function
(
Page
Abs
)
CFootEndnote
.
prototype
.
GetRelaitivePageIndex
=
function
(
nPageAbs
,
nColumn
Abs
)
{
// TODO: Переделать с учетом колонок
var
StartPageAbs
=
this
.
Get_StartPage_Absolute
();
var
PagesCount
=
this
.
Get_PagesCount
();
return
Math
.
max
(
0
,
Math
.
min
(
PagesCount
-
1
,
PageAbs
-
StartPageAbs
));
return
Math
.
max
(
0
,
Math
.
min
(
PagesCount
-
1
,
n
PageAbs
-
StartPageAbs
));
};
CFootEndnote
.
prototype
.
Write_ToBinary2
=
function
(
Writer
)
{
...
...
word/Editor/Footnotes.js
View file @
04a1c2e0
...
...
@@ -254,25 +254,27 @@ CFootnotesController.prototype.Draw = function(nPageAbs, pGraphics)
};
/**
* Сдвигаем все рассчитанные позиции на заданной странице.
* @param {number} nPageIndex
* @param {number} nPageAbs
* @param {number} nColumnAbs
* @param {number} dX
* @param {number} dY
*/
CFootnotesController
.
prototype
.
Shift
=
function
(
nPage
Index
,
dX
,
dY
)
CFootnotesController
.
prototype
.
Shift
=
function
(
nPage
Abs
,
nColumnAbs
,
dX
,
dY
)
{
if
(
true
===
this
.
Is_EmptyPage
(
nPageIndex
))
var
oColumn
=
this
.
private_GetPageColumn
(
nPageAbs
,
nColumnAbs
);
if
(
!
oColumn
)
return
;
if
(
null
!==
this
.
SeparatorFootnote
&&
null
!==
this
.
Pages
[
nPageIndex
]
.
SeparatorRecalculateObject
)
if
(
null
!==
this
.
SeparatorFootnote
&&
null
!==
oColumn
.
SeparatorRecalculateObject
)
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
this
.
Pages
[
nPageIndex
]
.
SeparatorRecalculateObject
);
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
oColumn
.
SeparatorRecalculateObject
);
this
.
SeparatorFootnote
.
Shift
(
0
,
dX
,
dY
);
this
.
Pages
[
nPageIndex
]
.
SeparatorRecalculateObject
=
this
.
SeparatorFootnote
.
Save_RecalculateObject
();
oColumn
.
SeparatorRecalculateObject
=
this
.
SeparatorFootnote
.
Save_RecalculateObject
();
}
for
(
var
nIndex
=
0
;
nIndex
<
this
.
Pages
[
nPageIndex
].
Elements
.
length
;
++
nIndex
)
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
Footnote
=
this
.
Pages
[
nPageIndex
]
.
Elements
[
nIndex
];
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
Footnote
.
Shift
(
0
,
dX
,
dY
);
}
};
...
...
@@ -293,6 +295,7 @@ CFootnotesController.prototype.AddFootnoteToPage = function(nPageAbs, nColumnAbs
/**
* Убираем заданную сноску со страницы при пересчетею..
* @param {number} nPageAbs
* @param {number} nColumnAbs
* @param {CFootEndnote} oFootnote
*/
CFootnotesController
.
prototype
.
RemoveFootnoteFromPage
=
function
(
nPageAbs
,
nColumnAbs
,
oFootnote
)
...
...
@@ -374,7 +377,7 @@ CFootnotesController.prototype.OnContentReDraw = function(StartPageAbs, EndPageA
* @param {number} nPageIndex
* @returns {boolean}
*/
CFootnotesController
.
prototype
.
Is
_
EmptyPage
=
function
(
nPageIndex
)
CFootnotesController
.
prototype
.
IsEmptyPage
=
function
(
nPageIndex
)
{
var
oPage
=
this
.
Pages
[
nPageIndex
];
if
(
!
oPage
)
...
...
@@ -469,25 +472,44 @@ CFootnotesController.prototype.GetNearestPos = function(X, Y, PageAbs, bAnchor,
* Проверяем попадание в сноски на заданной странице.
* @param X
* @param Y
* @param PageAbs
* @param
n
PageAbs
* @returns {boolean}
*/
CFootnotesController
.
prototype
.
CheckHitInFootnote
=
function
(
X
,
Y
,
PageAbs
)
CFootnotesController
.
prototype
.
CheckHitInFootnote
=
function
(
X
,
Y
,
n
PageAbs
)
{
if
(
true
===
this
.
Is
_EmptyPage
(
PageAbs
))
if
(
true
===
this
.
Is
EmptyPage
(
n
PageAbs
))
return
false
;
var
Page
=
this
.
Pages
[
PageAbs
];
for
(
var
nIndex
=
0
;
nIndex
<
Page
.
Elements
.
length
;
++
nIndex
)
var
oPage
=
this
.
Pages
[
nPageAbs
];
var
oColumn
=
null
;
for
(
var
nColumnIndex
=
0
,
nColumnsCount
=
oPage
.
Columns
.
length
;
nColumnIndex
<
nColumnsCount
;
++
nColumnIndex
)
{
var
Footnote
=
Page
.
Elements
[
nIndex
];
var
Bounds
=
Footnote
.
Get_PageBounds
(
0
);
if
(
nColumnIndex
<
nColumnsCount
-
1
)
{
if
(
X
<
(
oPage
.
Columns
[
nColumnIndex
].
XLimit
+
oPage
.
Columns
[
nColumnIndex
+
1
].
X
)
/
2
)
{
oColumn
=
oPage
.
Columns
[
nColumnIndex
];
break
;
}
}
else
{
oColumn
=
oPage
.
Columns
[
nColumnIndex
];
}
}
if
(
!
oColumn
)
return
false
;
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
oFootnote
=
oColumn
.
Elements
[
nIndex
];
var
oBounds
=
oFootnote
.
Get_PageBounds
(
0
);
if
(
Bounds
.
Top
<=
Y
)
if
(
o
Bounds
.
Top
<=
Y
)
return
true
;
}
return
false
;
};
CFootnotesController
.
prototype
.
GetAllParagraphs
=
function
(
Props
,
ParaArray
)
...
...
@@ -724,33 +746,54 @@ CFootnotesController.prototype.private_GetPageColumn = function(nPageAbs, nColum
if
(
!
oPage
)
return
null
;
var
oColumn
=
oPage
.
Columns
[
nColumnAbs
]
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
,
n
PageAbs
)
{
if
(
true
===
this
.
Is
_EmptyPage
(
PageAbs
))
if
(
true
===
this
.
Is
EmptyPage
(
n
PageAbs
))
return
null
;
var
Page
=
this
.
Pages
[
PageAbs
];
for
(
var
nIndex
=
Page
.
Elements
.
length
-
1
;
nIndex
>=
0
;
--
nIndex
)
var
oPage
=
this
.
Pages
[
nPageAbs
];
var
oColumn
=
null
;
var
nColumnIndex
=
0
;
for
(
var
nColumnsCount
=
oPage
.
Columns
.
length
;
nColumnIndex
<
nColumnsCount
;
++
nColumnIndex
)
{
var
Footnote
=
Page
.
Elements
[
nIndex
];
var
Bounds
=
Footnote
.
Get_PageBounds
(
0
);
if
(
nColumnIndex
<
nColumnsCount
-
1
)
{
if
(
X
<
(
oPage
.
Columns
[
nColumnIndex
].
XLimit
+
oPage
.
Columns
[
nColumnIndex
+
1
].
X
)
/
2
)
{
oColumn
=
oPage
.
Columns
[
nColumnIndex
];
break
;
}
}
else
{
oColumn
=
oPage
.
Columns
[
nColumnIndex
];
break
;
}
}
if
(
!
oColumn
)
return
null
;
if
(
Bounds
.
Top
<=
Y
||
0
===
nIndex
)
for
(
var
nIndex
=
oColumn
.
Elements
.
length
-
1
;
nIndex
>=
0
;
--
nIndex
)
{
var
oFootnote
=
oColumn
.
Elements
[
nIndex
];
var
oBounds
=
oFootnote
.
Get_PageBounds
(
0
);
if
(
oBounds
.
Top
<=
Y
||
0
===
nIndex
)
return
{
Footnote
:
Footnote
,
Footnote
:
o
Footnote
,
Index
:
nIndex
,
Page
:
PageAbs
Page
:
nPageAbs
,
Column
:
nColumnIndex
};
}
return
null
;
};
CFootnotesController
.
prototype
.
private_GetFootnoteByXY
=
function
(
X
,
Y
,
PageAbs
)
...
...
@@ -783,8 +826,8 @@ CFootnotesController.prototype.private_GetFootnoteByXY = function(X, Y, PageAbs)
};
CFootnotesController
.
prototype
.
private_GetFootnotesRange
=
function
(
Start
,
End
)
{
var
oResult
=
[]
;
if
(
Start
.
Page
>
End
.
Page
)
var
oResult
=
{}
;
if
(
Start
.
Page
>
End
.
Page
||
(
Start
.
Page
===
End
.
Page
&&
Start
.
Column
>
End
.
Column
)
||
(
Start
.
Page
===
End
.
Page
&&
Start
.
Column
===
End
.
Column
&&
Start
.
Index
>
End
.
Index
)
)
{
var
Temp
=
Start
;
Start
=
End
;
...
...
@@ -793,33 +836,52 @@ CFootnotesController.prototype.private_GetFootnotesRange = function(Start, End)
if
(
Start
.
Page
===
End
.
Page
)
{
if
(
Start
.
Index
<=
End
.
Index
)
this
.
private_GetFootnotesOnPage
(
Start
.
Page
,
Start
.
Index
,
End
.
Index
,
oResult
);
else
this
.
private_GetFootnotesOnPage
(
Start
.
Page
,
End
.
Index
,
Start
.
Index
,
oResult
);
this
.
private_GetFootnotesOnPage
(
Start
.
Page
,
Start
.
Column
,
End
.
Column
,
Start
.
Index
,
End
.
Index
,
oResult
);
}
else
{
this
.
private_GetFootnotesOnPage
(
Start
.
Page
,
Start
.
Index
,
-
1
,
oResult
);
this
.
private_GetFootnotesOnPage
(
Start
.
Page
,
Start
.
Column
,
-
1
,
Start
.
Index
,
-
1
,
oResult
);
for
(
var
CurPage
=
Start
.
Page
+
1
;
CurPage
<=
End
.
Page
-
1
;
++
CurPage
)
{
this
.
private_GetFootnotesOnPage
(
CurPage
,
-
1
,
-
1
,
oResult
);
this
.
private_GetFootnotesOnPage
(
CurPage
,
-
1
,
-
1
,
-
1
,
-
1
,
oResult
);
}
this
.
private_GetFootnotesOnPage
(
End
.
Page
,
-
1
,
End
.
Index
,
oResult
);
this
.
private_GetFootnotesOnPage
(
End
.
Page
,
-
1
,
End
.
Column
,
-
1
,
End
.
Index
,
oResult
);
}
return
oResult
;
};
CFootnotesController
.
prototype
.
private_GetFootnotesOnPage
=
function
(
PageAbs
,
StartIndex
,
EndIndex
,
oFootnotes
)
CFootnotesController
.
prototype
.
private_GetFootnotesOnPage
=
function
(
nPageAbs
,
nColumnStart
,
nColumnEnd
,
nStartIndex
,
nEndIndex
,
oFootnotes
)
{
var
oPage
=
this
.
Pages
[
nPageAbs
];
if
(
!
oPage
)
return
;
var
_nColumnStart
=
-
1
===
nColumnStart
?
0
:
nColumnStart
;
var
_nColumnEnd
=
-
1
===
nColumnEnd
?
oPage
.
Columns
.
length
-
1
:
nColumnEnd
;
var
_nStartIndex
=
-
1
===
nColumnStart
||
-
1
===
nStartIndex
?
0
:
nStartIndex
;
var
_nEndIndex
=
-
1
===
nColumnEnd
||
-
1
===
nEndIndex
?
oPage
.
Columns
[
_nColumnEnd
].
Elements
.
length
-
1
:
nEndIndex
;
for
(
var
nColIndex
=
_nColumnStart
;
nColIndex
<=
_nColumnEnd
;
++
nColIndex
)
{
var
nSIndex
=
nColIndex
===
_nColumnStart
?
_nStartIndex
:
0
;
var
nEIndex
=
nColIndex
===
_nColumnEnd
?
_nEndIndex
:
oPage
.
Columns
[
nColIndex
].
Elements
.
length
-
1
;
this
.
private_GetFootnotesOnPageColumn
(
nPageAbs
,
nColIndex
,
nSIndex
,
nEIndex
,
oFootnotes
);
}
};
CFootnotesController
.
prototype
.
private_GetFootnotesOnPageColumn
=
function
(
nPageAbs
,
nColumnAbs
,
StartIndex
,
EndIndex
,
oFootnotes
)
{
var
Page
=
this
.
Pages
[
PageAbs
];
var
oColumn
=
this
.
private_GetPageColumn
(
nPageAbs
,
nColumnAbs
);
var
_StartIndex
=
-
1
===
StartIndex
?
0
:
StartIndex
;
var
_EndIndex
=
-
1
===
EndIndex
?
Page
.
Elements
.
length
-
1
:
EndIndex
;
var
_EndIndex
=
-
1
===
EndIndex
?
oColumn
.
Elements
.
length
-
1
:
EndIndex
;
for
(
var
nIndex
=
_StartIndex
;
nIndex
<=
_EndIndex
;
++
nIndex
)
{
var
oFootnote
=
Page
.
Elements
[
nIndex
];
var
oFootnote
=
oColumn
.
Elements
[
nIndex
];
oFootnotes
[
oFootnote
.
Get_Id
()]
=
oFootnote
;
}
};
...
...
@@ -2016,19 +2078,23 @@ CFootnotesController.prototype.IsEmptySelection = function(bCheckHidden)
return
oFootnote
.
Selection_IsEmpty
(
bCheckHidden
);
};
CFootnotesController
.
prototype
.
DrawSelectionOnPage
=
function
(
PageAbs
)
CFootnotesController
.
prototype
.
DrawSelectionOnPage
=
function
(
n
PageAbs
)
{
if
(
true
!==
this
.
Selection
.
Use
||
true
===
this
.
Is
_EmptyPage
(
PageAbs
))
if
(
true
!==
this
.
Selection
.
Use
||
true
===
this
.
Is
EmptyPage
(
n
PageAbs
))
return
;
var
Page
=
this
.
Pages
[
PageAbs
];
for
(
var
n
Index
=
0
,
nCount
=
Page
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
var
oPage
=
this
.
Pages
[
n
PageAbs
];
for
(
var
n
ColumnIndex
=
0
,
nColumnsCount
=
oPage
.
Columns
.
length
;
nColumnIndex
<
nColumnsCount
;
++
nColum
nIndex
)
{
var
oFootnote
=
Page
.
Elements
[
nIndex
];
var
oColumn
=
oPage
.
Columns
[
nColumnIndex
];
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
oFootnote
=
oColumn
.
Elements
[
nIndex
];
if
(
oFootnote
===
this
.
Selection
.
Footnotes
[
oFootnote
.
Get_Id
()])
{
var
PageRel
=
oFootnote
.
GetRelaitivePageIndex
(
PageAbs
);
oFootnote
.
Selection_Draw_Page
(
PageRel
);
var
nPageRel
=
oFootnote
.
GetRelaitivePageIndex
(
nPageAbs
,
nColumnIndex
);
oFootnote
.
Selection_Draw_Page
(
nPageRel
);
}
}
}
};
...
...
word/Editor/Paragraph_Recalculate.js
View file @
04a1c2e0
...
...
@@ -1872,7 +1872,7 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
else
{
// TODO: Реализовать
RecalcInfo
.
Set_PageBrea
FlowObjectPageBrea
kBefore
(
true
);
RecalcInfo
.
Set_PageBreakBefore
(
true
);
this
.
Parent
.
Footnotes
.
RemoveFootnoteFromPage
(
nPageAbs
,
nColumnAbs
,
oFootnote
);
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