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
132336ce
Commit
132336ce
authored
Aug 22, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug with auto save during a composite input. Rework of calculating footnotes with columns.
parent
2a872e61
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
44 deletions
+62
-44
word/Editor/Document.js
word/Editor/Document.js
+22
-15
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+29
-20
word/Editor/History.js
word/Editor/History.js
+5
-3
word/Editor/Paragraph_Recalculate.js
word/Editor/Paragraph_Recalculate.js
+6
-6
No files found.
word/Editor/Document.js
View file @
132336ce
...
...
@@ -909,6 +909,8 @@ function CDocumentRecalcInfo()
this
.
ParaMath
=
null
;
this
.
FootnoteReference
=
null
;
// Ссылка на сноску, которую мы пересчитываем
this
.
FootnotePage
=
0
;
this
.
FootnoteColumn
=
0
;
this
.
AdditionalInfo
=
null
;
}
...
...
@@ -933,6 +935,8 @@ CDocumentRecalcInfo.prototype =
this
.
ParaMath
=
null
;
this
.
FootnoteReference
=
null
;
this
.
FootnotePage
=
0
;
this
.
FootnoteColumn
=
0
;
},
Can_RecalcObject
:
function
()
...
...
@@ -1046,22 +1050,23 @@ CDocumentRecalcInfo.prototype =
this
.
FrameRecalc
=
Value
;
},
Set_FootnoteReference
:
function
(
FootnoteReference
,
PageIndex
)
Set_FootnoteReference
:
function
(
oFootnoteReference
,
nPageAbs
,
nColumnAbs
)
{
this
.
FootnoteReference
=
FootnoteReference
;
this
.
FlowObjectPage
=
PageIndex
;
this
.
FootnoteReference
=
o
FootnoteReference
;
this
.
FlowObjectPage
=
nPageAbs
;
},
Check_FootnoteReference
:
function
(
FootnoteReference
)
Check_FootnoteReference
:
function
(
o
FootnoteReference
)
{
return
(
this
.
FootnoteReference
===
FootnoteReference
?
true
:
false
);
return
(
this
.
FootnoteReference
===
o
FootnoteReference
?
true
:
false
);
},
Reset_FootnoteReference
:
function
()
{
this
.
FootnoteReference
=
null
;
this
.
FlowObjectPage
=
0
;
this
.
FlowObjectPageBreakBefore
=
false
;
this
.
FootnotePage
=
0
;
this
.
FootnoteColumn
=
0
;
this
.
FlowObjectPageBreakBefore
=
false
;
}
};
...
...
@@ -11237,12 +11242,14 @@ CDocument.prototype.Begin_CompositeInput = function()
}
this
.
CompositeInput
=
{
Run
:
oRun
,
Pos
:
oRun
.
State
.
ContentPos
,
Length
:
0
Run
:
oRun
,
Pos
:
oRun
.
State
.
ContentPos
,
Length
:
0
,
CanUndo
:
true
};
oRun
.
Set_CompositeInput
(
this
.
CompositeInput
);
return
true
;
}
...
...
@@ -11266,7 +11273,8 @@ CDocument.prototype.Replace_CompositeText = function(arrCharCodes)
this
.
Document_UpdateSelectionState
();
this
.
Document_UpdateUndoRedoState
();
this
.
History
.
Check_UninonLastPoints
();
if
(
!
this
.
History
.
Check_UninonLastPoints
())
this
.
CompositeInput
.
CanUndo
=
false
;
};
CDocument
.
prototype
.
Set_CursorPosInCompositeText
=
function
(
nPos
)
{
...
...
@@ -11298,16 +11306,15 @@ CDocument.prototype.End_CompositeInput = function()
var
oRun
=
this
.
CompositeInput
.
Run
;
oRun
.
Set_CompositeInput
(
null
);
this
.
CompositeInput
=
null
;
this
.
History
.
Check_UninonLastPoints
();
if
(
0
===
nLen
&&
true
===
this
.
History
.
CanRemoveLastPoint
())
if
(
0
===
nLen
&&
true
===
this
.
History
.
CanRemoveLastPoint
()
&&
true
===
this
.
CompositeInput
.
CanUndo
)
{
this
.
Document_Undo
();
this
.
History
.
Clear_Redo
();
}
this
.
CompositeInput
=
null
;
this
.
Document_UpdateInterfaceState
();
this
.
DrawingDocument
.
ClearCachePages
();
...
...
word/Editor/Footnotes.js
View file @
132336ce
...
...
@@ -180,7 +180,7 @@ CFootnotesController.prototype.Recalculate = function(nPageAbs, nColumnAbs, Y, Y
{
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
Footnote
.
Reset
(
X
,
CurY
,
XLimit
,
10000
);
Footnote
.
Set_StartPage
(
nPageAbs
,
nColumnAbs
,
nColumnCount
);
Footnote
.
Set_StartPage
(
nPageAbs
,
nColumnAbs
,
nColumn
s
Count
);
var
CurPage
=
0
;
var
RecalcResult
=
recalcresult2_NextPage
;
...
...
@@ -212,7 +212,7 @@ CFootnotesController.prototype.GetHeight = function(nPageAbs, nColumnAbs)
nHeight
+=
Bounds
.
Bottom
-
Bounds
.
Top
;
}
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Element
.
length
;
nIndex
<
nCount
;
++
nIndex
)
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Element
s
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
var
Footnote
=
oColumn
.
Elements
[
nIndex
];
var
Bounds
=
Footnote
.
Get_PageBounds
(
0
);
...
...
@@ -223,24 +223,33 @@ CFootnotesController.prototype.GetHeight = function(nPageAbs, nColumnAbs)
};
/**
* Отрисовываем сноски на заданной странице.
* @param {number} nPage
Index
* @param {number} nPage
Abs
* @param {CGraphics} pGraphics
*/
CFootnotesController
.
prototype
.
Draw
=
function
(
nPage
Index
,
pGraphics
)
CFootnotesController
.
prototype
.
Draw
=
function
(
nPage
Abs
,
pGraphics
)
{
if
(
true
===
this
.
Is_EmptyPage
(
nPageIndex
))
var
oPage
=
this
.
Pages
[
nPageAbs
];
if
(
!
oPage
)
return
;
if
(
null
!==
this
.
SeparatorFootnote
&&
null
!==
this
.
Pages
[
nPageIndex
].
SeparatorRecalculateObject
)
var
nColumnsCount
=
oPage
.
Columns
.
length
;
for
(
var
nColumnIndex
=
0
;
nColumnIndex
<
nColumnsCount
;
++
nColumnIndex
)
{
this
.
SeparatorFootnote
.
Load_RecalculateObject
(
this
.
Pages
[
nPageIndex
].
SeparatorRecalculateObject
)
;
this
.
SeparatorFootnote
.
Draw
(
nPageIndex
,
pGraphics
);
}
var
oColumn
=
oPage
.
Columns
[
nColumnIndex
]
;
if
(
!
oColumn
||
oColumn
.
Elements
.
length
<=
0
)
continue
;
for
(
var
nIndex
=
0
;
nIndex
<
this
.
Pages
[
nPageIndex
].
Elements
.
length
;
++
nIndex
)
{
var
Footnote
=
this
.
Pages
[
nPageIndex
].
Elements
[
nIndex
];
Footnote
.
Draw
(
nPageIndex
,
pGraphics
);
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
);
}
}
};
/**
...
...
@@ -286,17 +295,17 @@ CFootnotesController.prototype.AddFootnoteToPage = function(nPageAbs, nColumnAbs
* @param {number} nPageAbs
* @param {CFootEndnote} oFootnote
*/
CFootnotesController
.
prototype
.
RemoveFootnoteFromPage
=
function
(
nPageAbs
,
oFootnote
)
CFootnotesController
.
prototype
.
RemoveFootnoteFromPage
=
function
(
nPageAbs
,
nColumnAbs
,
oFootnote
)
{
if
(
!
this
.
Pages
[
nPageAbs
])
this
.
Pages
[
nPageAbs
]
=
new
CFootEndnotePage
();
var
oColumn
=
this
.
private_GetPageColumn
(
nPageAbs
,
nColumnAbs
);
if
(
!
oColumn
)
return
;
var
oPage
=
this
.
Pages
[
nPageAbs
];
for
(
var
nIndex
=
0
,
nCount
=
oPage
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
for
(
var
nIndex
=
0
,
nCount
=
oColumn
.
Elements
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
if
(
o
Page
.
Elements
[
nIndex
]
===
oFootnote
)
if
(
o
Column
.
Elements
[
nIndex
]
===
oFootnote
)
{
o
Page
.
Elements
.
splice
(
nIndex
,
1
);
o
Column
.
Elements
.
splice
(
nIndex
,
1
);
return
;
}
}
...
...
word/Editor/History.js
View file @
132336ce
...
...
@@ -647,20 +647,20 @@ CHistory.prototype =
// Не объединяем точки в истории, когда отключается пересчет.
// TODO: Неправильно изменяется RecalcIndex
if
(
true
!==
this
.
Document
.
Is_OnRecalculate
())
return
;
return
false
;
// Не объединяем точки истории, если на предыдущей точке произошло сохранение
if
(
this
.
Points
.
length
<
2
||
(
true
!==
this
.
Is_UserSaveMode
()
&&
null
!==
this
.
SavedIndex
&&
this
.
SavedIndex
>=
this
.
Points
.
length
-
2
)
||
(
true
===
this
.
Is_UserSaveMode
()
&&
null
!==
this
.
UserSavedIndex
&&
this
.
UserSavedIndex
>=
this
.
Points
.
length
-
2
))
return
;
return
false
;
var
Point1
=
this
.
Points
[
this
.
Points
.
length
-
2
];
var
Point2
=
this
.
Points
[
this
.
Points
.
length
-
1
];
// Не объединяем слова больше 63 элементов
if
(
Point1
.
Items
.
length
>
63
&&
AscDFH
.
historydescription_Document_AddLetterUnion
===
Point1
.
Description
)
return
;
return
false
;
var
StartIndex1
=
0
;
var
StartIndex2
=
0
;
...
...
@@ -731,6 +731,8 @@ CHistory.prototype =
this
.
Index
+=
DiffIndex
;
this
.
RecIndex
=
Math
.
max
(
-
1
,
this
.
RecIndex
+
DiffIndex
);
}
return
true
;
},
CanRemoveLastPoint
:
function
()
...
...
word/Editor/Paragraph_Recalculate.js
View file @
132336ce
...
...
@@ -1848,11 +1848,12 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
if
(
this
.
Parent
instanceof
CDocument
)
{
var
RecalcInfo
=
this
.
Parent
.
RecalcInfo
;
var
nPageAbs
=
this
.
Get_AbsolutePage
(
CurPage
);
var
nColumnAbs
=
this
.
Get_AbsoluteColumn
(
CurPage
);
if
(
true
===
RecalcInfo
.
Can_RecalcObject
())
{
var
PageAbs
=
this
.
Get_AbsolutePage
(
CurPage
);
RecalcInfo
.
Set_FootnoteReference
(
oFootnote
,
PageAbs
);
this
.
Parent
.
Footnotes
.
AddFootnoteToPage
(
PageAbs
,
oFootnote
);
RecalcInfo
.
Set_FootnoteReference
(
oFootnote
,
nPageAbs
,
nColumnAbs
);
this
.
Parent
.
Footnotes
.
AddFootnoteToPage
(
nPageAbs
,
nColumnAbs
,
oFootnote
);
PRS
.
RecalcResult
=
recalcresult_CurPage
|
recalcresultflags_Column
|
recalcresultflags_Footnotes
;
return
false
;
}
...
...
@@ -1863,8 +1864,7 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
//PRS.RecalcResult
}
var
PageAbs
=
this
.
Get_AbsolutePage
(
CurPage
);
if
(
PageAbs
===
RecalcInfo
.
FlowObjectPage
)
if
(
nPageAbs
===
RecalcInfo
.
FootnotePage
&&
nColumnAbs
===
RecalcInfo
.
FootnoteColumn
)
{
// Все нормально пересчиталось
RecalcInfo
.
Reset_FootnoteReference
();
...
...
@@ -1873,7 +1873,7 @@ Paragraph.prototype.private_RecalculateLineCheckFootnotes = function(CurLine, Cu
{
// TODO: Реализовать
RecalcInfo
.
Set_PageBreaFlowObjectPageBreakBefore
(
true
);
this
.
Parent
.
Footnotes
.
RemoveFootnoteFromPage
(
Page
Abs
,
oFootnote
);
this
.
Parent
.
Footnotes
.
RemoveFootnoteFromPage
(
nPageAbs
,
nColumn
Abs
,
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