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
658798bf
Commit
658798bf
authored
Jun 03, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправлен баг с расчетом границ между параграфами.
parent
4681623b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
26 deletions
+36
-26
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+36
-26
No files found.
word/Editor/Paragraph.js
View file @
658798bf
...
...
@@ -1211,26 +1211,6 @@ Paragraph.prototype =
return { X : X, Y : Y, PageNum : this.Get_AbsolutePage(CurPage), Internal : { Line : CurLine, Page : CurPage, Range : CurRange }, Transform : Transform };
},
// Можно ли объединить границы двух параграфов с заданными настройками Pr1, Pr2
Internal_CompareBrd
:
function
(
Pr1
,
Pr2
)
{
// Сначала сравним правую и левую границы параграфов
var
Left_1
=
Math
.
min
(
Pr1
.
Ind
.
Left
,
Pr1
.
Ind
.
Left
+
Pr1
.
Ind
.
FirstLine
);
var
Right_1
=
Pr1
.
Ind
.
Right
;
var
Left_2
=
Math
.
min
(
Pr2
.
Ind
.
Left
,
Pr2
.
Ind
.
Left
+
Pr2
.
Ind
.
FirstLine
);
var
Right_2
=
Pr2
.
Ind
.
Right
;
if
(
Math
.
abs
(
Left_1
-
Left_2
)
>
0.001
||
Math
.
abs
(
Right_1
-
Right_2
)
>
0.001
)
return
false
;
if
(
false
===
Pr1
.
Brd
.
Top
.
Compare
(
Pr2
.
Brd
.
Top
)
||
false
===
Pr1
.
Brd
.
Bottom
.
Compare
(
Pr2
.
Brd
.
Bottom
)
||
false
===
Pr1
.
Brd
.
Left
.
Compare
(
Pr2
.
Brd
.
Left
)
||
false
===
Pr1
.
Brd
.
Right
.
Compare
(
Pr2
.
Brd
.
Right
)
||
false
===
Pr1
.
Brd
.
Between
.
Compare
(
Pr2
.
Brd
.
Between
)
)
return
false
;
return
true
;
},
// Проверяем не пустые ли границы
Internal_Is_NullBorders : function (Borders)
{
...
...
@@ -2366,7 +2346,8 @@ Paragraph.prototype =
if (border_Single === Pr.ParaPr.Brd.Between.Value
&& false === bDrawTop
&& false === bEmptyPageCurrent
&&
true
===
bEmptyPagesBefore
)
&& true === bEmptyPagesBefore
&& false === Pr.ParaPr.Brd.First)
{
bDrawBetween = true;
}
...
...
@@ -7676,7 +7657,7 @@ Paragraph.prototype =
if ( undefined !== FramePr )
{
if ( null === PrevEl || type_Paragraph !== PrevEl.GetType() )
PrevEl
=
null
PrevEl = null
;
else
{
var PrevFramePr = PrevEl.Get_FramePr();
...
...
@@ -7738,10 +7719,15 @@ Paragraph.prototype =
}
}
if
(
false
===
this
.
Internal_Is_NullBorders
(
Pr
.
ParaPr
.
Brd
)
&&
true
===
this
.
Internal_CompareBrd
(
Prev_Pr
,
Pr
.
ParaPr
)
&&
undefined
===
PrevEl
.
Get_SectionPr
()
&&
true
!==
Pr
.
ParaPr
.
PageBreakBefore
)
Pr
.
ParaPr
.
Brd
.
First
=
false
;
if (true === this.private_CompareBorderSettings(Prev_Pr, Pr.ParaPr) && undefined === PrevEl.Get_SectionPr() && true !== Pr.ParaPr.PageBreakBefore)
{
Pr.ParaPr.Brd.First = false;
Pr.ParaPr.Brd.Between = Prev_Pr.Brd.Between.Copy();
}
else
Pr
.
ParaPr
.
Brd
.
First
=
true
;
{
Pr.ParaPr.Brd.First = true;
}
}
else if ( null === PrevEl )
{
...
...
@@ -7794,7 +7780,7 @@ Paragraph.prototype =
}
}
if
(
false
===
this
.
Internal_Is_NullBorders
(
Pr
.
ParaPr
.
Brd
)
&&
true
===
this
.
Internal_CompareBrd
(
Next_Pr
,
Pr
.
ParaPr
)
&&
undefined
===
this
.
Get_SectionPr
()
&&
(
undefined
===
NextEl
.
Get_SectionPr
()
||
true
!==
NextEl
.
IsEmpty
())
&&
true
!==
Next_Pr
.
PageBreakBefore
)
if (
true === this.private_CompareBorderSettings
(Next_Pr, Pr.ParaPr) && undefined === this.Get_SectionPr() && (undefined === NextEl.Get_SectionPr() || true !== NextEl.IsEmpty()) && true !== Next_Pr.PageBreakBefore)
Pr.ParaPr.Brd.Last = false;
else
Pr.ParaPr.Brd.Last = true;
...
...
@@ -13951,6 +13937,30 @@ Paragraph.prototype.Set_ParaPropsForVerticalTextInCell = function(isVerticalText
this.Set_Ind({Left : Left, Right : Right, FirstLine : First}, true);
}
};
/**
* Проверяем можно ли объединить границы двух параграфов с заданными настройками Pr1, Pr2.
*/
Paragraph.prototype.private_CompareBorderSettings = function(Pr1, Pr2)
{
// Сначала сравним правую и левую границы параграфов
var Left_1 = Math.min(Pr1.Ind.Left, Pr1.Ind.Left + Pr1.Ind.FirstLine);
var Right_1 = Pr1.Ind.Right;
var Left_2 = Math.min(Pr2.Ind.Left, Pr2.Ind.Left + Pr2.Ind.FirstLine);
var Right_2 = Pr2.Ind.Right;
if (Math.abs(Left_1 - Left_2) > 0.001 || Math.abs(Right_1 - Right_2) > 0.001)
return false;
// Почему то Word не сравнивает границы между параграфами.
if (false === Pr1.Brd.Top.Compare(Pr2.Brd.Top)
|| false === Pr1.Brd.Bottom.Compare(Pr2.Brd.Bottom)
|| false === Pr1.Brd.Left.Compare(Pr2.Brd.Left)
|| false === Pr1.Brd.Right.Compare(Pr2.Brd.Right))
return false;
return true;
};
var pararecalc_0_All = 0;
var pararecalc_0_None = 1;
...
...
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