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
c312b994
Commit
c312b994
authored
Apr 05, 2016
by
AnnaPavlovaOnlyOffice
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4 from ONLYOFFICE/feature/math-forced-break
Feature/math forced break
parents
f2b509a8
926c3511
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
263 additions
and
586 deletions
+263
-586
word/Editor/Math.js
word/Editor/Math.js
+44
-135
word/Math/base.js
word/Math/base.js
+15
-50
word/Math/borderBox.js
word/Math/borderBox.js
+0
-24
word/Math/degree.js
word/Math/degree.js
+12
-32
word/Math/fraction.js
word/Math/fraction.js
+80
-38
word/Math/limit.js
word/Math/limit.js
+10
-30
word/Math/mathContent.js
word/Math/mathContent.js
+30
-45
word/Math/mathTypes.js
word/Math/mathTypes.js
+0
-24
word/Math/matrix.js
word/Math/matrix.js
+5
-32
word/Math/nary.js
word/Math/nary.js
+27
-40
word/Math/operators.js
word/Math/operators.js
+26
-109
word/Math/radical.js
word/Math/radical.js
+14
-27
No files found.
word/Editor/Math.js
View file @
c312b994
This diff is collapsed.
Click to expand it.
word/Math/base.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
/**
...
...
@@ -47,7 +23,6 @@ function CMathBase(bInside)
this
.
CtrPrp
=
new
CTextPr
();
this
.
CompiledCtrPrp
=
new
CTextPr
();
this
.
TextPrControlLetter
=
new
CTextPr
();
//this.CtrPr = new CCtrPr();
this
.
ArgSize
=
new
CMathArgSize
();
...
...
@@ -283,33 +258,29 @@ CMathBase.prototype.align = function(pos_x, pos_y)
if
(
this
.
alignment
.
hgt
[
pos_x
]
==
MCJC_CENTER
)
{
var
maxAsc
=
0
;
var
_ascent
;
for
(
var
j
=
0
;
j
<
this
.
nCol
;
j
++
)
{
_ascent
=
this
.
elements
[
pos_x
][
j
].
size
.
ascent
;
var
_ascent
=
this
.
elements
[
pos_x
][
j
].
size
.
ascent
;
maxAsc
=
(
maxAsc
>
_ascent
)
?
maxAsc
:
_ascent
;
}
PosAlign
.
y
=
(
maxAsc
-
this
.
elements
[
pos_x
][
pos_y
].
size
.
ascent
)
;
PosAlign
.
y
=
maxAsc
-
this
.
elements
[
pos_x
][
pos_y
].
size
.
ascent
;
}
else
else
if
(
this
.
alignment
.
hgt
[
pos_x
]
==
MCJC_LEFT
)
{
PosAlign
.
y
=
0
;
}
else
// MCJC_RIGHT
{
var
maxH
=
0
;
var
_h
;
for
(
var
j
=
0
;
j
<
this
.
nCol
;
j
++
)
{
_h
=
this
.
elements
[
pos_x
][
j
].
size
.
height
;
var
_h
=
this
.
elements
[
pos_x
][
j
].
size
.
height
;
maxH
=
(
maxH
>
_h
)
?
maxH
:
_h
;
}
var
coeffHgt
;
if
(
this
.
alignment
.
hgt
[
pos_x
]
==
MCJC_RIGHT
)
coeffHgt
=
1
;
else
coeffHgt
=
0
;
PosAlign
.
y
=
(
maxH
-
this
.
elements
[
pos_x
][
pos_y
].
size
.
height
)
*
coeffHgt
;
PosAlign
.
y
=
maxH
-
this
.
elements
[
pos_x
][
pos_y
].
size
.
height
;
}
var
maxW
=
0
;
...
...
@@ -321,16 +292,10 @@ CMathBase.prototype.align = function(pos_x, pos_y)
if
(
this
.
alignment
.
wdt
[
pos_y
]
==
MCJC_CENTER
)
PosAlign
.
x
=
(
maxW
-
this
.
elements
[
pos_x
][
pos_y
].
size
.
width
)
*
0.5
;
else
{
var
coeffWdt
;
if
(
this
.
alignment
.
wdt
[
pos_y
]
==
MCJC_RIGHT
)
coeffWdt
=
1
;
else
coeffWdt
=
0
;
PosAlign
.
x
=
(
maxW
-
this
.
elements
[
pos_x
][
pos_y
].
size
.
width
)
*
coeffWdt
;
}
else
if
(
this
.
alignment
.
hgt
[
pos_x
]
==
MCJC_LEFT
)
PosAlign
.
x
=
0
;
else
// MCJC_RIGHT
PosAlign
.
x
=
maxW
-
this
.
elements
[
pos_x
][
pos_y
].
size
.
width
;
return
PosAlign
;
};
...
...
@@ -2022,7 +1987,7 @@ CMathBase.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var
bContainCompareOper
=
PRS
.
bContainCompareOper
;
var
bOneLine
=
PRS
.
bMath_OneLine
;
var
MathFirstItem
=
PRS
.
MathFirstItem
;
this
.
bOneLine
=
this
.
bCanBreak
==
false
||
PRS
.
bMath_OneLine
==
true
;
if
(
this
.
kind
!==
MATH_DELIMITER
)
...
...
@@ -2055,7 +2020,7 @@ CMathBase.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this
.
recalculateSize
(
g_oTextMeasurer
);
this
.
UpdatePRS_OneLine
(
PRS
,
WordLen
,
MathFirstItem
);
this
.
UpdatePRS_OneLine
(
PRS
,
WordLen
,
PRS
.
MathFirstItem
);
this
.
Bounds
.
SetWidth
(
0
,
0
,
this
.
size
.
width
);
this
.
Bounds
.
UpdateMetrics
(
0
,
0
,
this
.
size
);
}
...
...
word/Math/borderBox.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
function
CMathBreak
()
...
...
word/Math/degree.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
function
CMathDegreePr
()
...
...
@@ -109,12 +85,14 @@ CDegreeBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsI
var
ArgSzDegr
=
ArgSize
.
Copy
();
ArgSzDegr
.
Decrease
();
var
RPIDegr
=
RPI
.
Copy
();
RPIDegr
.
bDecreasedComp
=
true
;
this
.
bNaryInline
=
RPI
.
bNaryInline
;
this
.
iterContent
.
PreRecalc
(
this
,
ParaMath
,
ArgSzDegr
,
RPIDegr
);
var
bDecreasedComp
=
RPI
.
bDecreasedComp
;
RPI
.
bDecreasedComp
=
true
;
this
.
iterContent
.
PreRecalc
(
this
,
ParaMath
,
ArgSzDegr
,
RPI
);
RPI
.
bDecreasedComp
=
bDecreasedComp
;
};
CDegreeBase
.
prototype
.
Resize
=
function
(
oMeasure
,
RPI
)
{
...
...
@@ -560,11 +538,13 @@ CIterators.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsIn
this
.
Set_CompiledCtrPrp
(
Parent
,
ParaMath
,
RPI
);
var
RPI_ITER
=
RPI
.
Copy
();
RPI_ITER
.
bDecreasedComp
=
true
;
var
bDecreasedComp
=
RPI
.
bDecreasedComp
;
RPI
.
bDecreasedComp
=
true
;
this
.
iterUp
.
PreRecalc
(
this
,
ParaMath
,
ArgSzIters
,
RPI
);
this
.
iterDn
.
PreRecalc
(
this
,
ParaMath
,
ArgSzIters
,
RPI
);
this
.
iterUp
.
PreRecalc
(
this
,
ParaMath
,
ArgSzIters
,
RPI_ITER
);
this
.
iterDn
.
PreRecalc
(
this
,
ParaMath
,
ArgSzIters
,
RPI_ITER
);
RPI
.
bDecreasedComp
=
bDecreasedComp
;
};
CIterators
.
prototype
.
recalculateSize
=
function
(
oMeasure
,
dH
,
ascent
)
{
...
...
word/Math/fraction.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
function
CMathFractionPr
()
...
...
@@ -114,12 +90,10 @@ CFraction.prototype.drawBarFraction = function(PDSE)
var
numHeight
=
this
.
elements
[
0
][
0
].
size
.
height
;
var
width
=
this
.
size
.
width
-
this
.
GapLeft
-
this
.
GapRight
;
var
PosLine
=
this
.
ParaMath
.
GetLinePosition
(
PDSE
.
Line
,
PDSE
.
Range
);
var
x1
=
this
.
pos
.
x
+
PosLine
.
x
+
this
.
GapLeft
,
x2
=
this
.
pos
.
x
+
PosLine
.
x
+
this
.
GapLeft
+
width
,
x2
=
this
.
pos
.
x
+
PosLine
.
x
+
this
.
size
.
width
-
this
.
GapRight
,
y1
=
this
.
pos
.
y
+
PosLine
.
y
+
numHeight
-
penW
;
if
(
this
.
Pr
.
type
==
BAR_FRACTION
)
...
...
@@ -327,7 +301,12 @@ CFraction.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInf
var
ArgSzNumDen
=
ArgSize
.
Copy
();
if
(
RPI
.
bInline
==
true
&&
(
this
.
Pr
.
type
===
BAR_FRACTION
||
this
.
Pr
.
type
==
NO_BAR_FRACTION
))
// уменьшае размер числителя и знаменателя
var
oMathSettings
=
Get_WordDocumentDefaultMathSettings
();
var
bInlineBarFaction
=
RPI
.
bInline
==
true
&&
(
this
.
Pr
.
type
===
BAR_FRACTION
||
this
.
Pr
.
type
==
NO_BAR_FRACTION
),
bReduceSize
=
(
RPI
.
bSmallFraction
||
RPI
.
bDecreasedComp
==
true
)
&&
true
==
oMathSettings
.
Get_SmallFrac
();
if
(
bInlineBarFaction
||
bReduceSize
)
// уменьшае размер числителя и знаменателя
{
ArgSzNumDen
.
Decrease
();
// для контентов числителя и знаменателя
this
.
ArgSize
.
SetValue
(
-
1
);
// для CtrPrp
...
...
@@ -346,35 +325,78 @@ CFraction.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInf
this
.
ApplyProperties
(
RPI
);
var
NewRPI
=
RPI
.
Copy
();
var
bDecreasedComp
=
RPI
.
bDecreasedComp
,
bSmallFraction
=
RPI
.
bSmallFraction
;
if
(
this
.
Pr
.
type
!==
LINEAR_FRACTION
)
NewRPI
.
bDecreasedComp
=
true
;
RPI
.
bDecreasedComp
=
true
;
RPI
.
bSmallFraction
=
true
;
// setGaps обязательно после того как смержили CtrPrp (Set_CompiledCtrPrp)
if
(
this
.
bInside
==
false
)
GapsInfo
.
setGaps
(
this
,
this
.
TextPrControlLetter
.
FontSize
);
this
.
Numerator
.
PreRecalc
(
this
,
ParaMath
,
ArgSzNumDen
,
NewRPI
);
this
.
Denominator
.
PreRecalc
(
this
,
ParaMath
,
ArgSzNumDen
,
NewRPI
);
this
.
Numerator
.
PreRecalc
(
this
,
ParaMath
,
ArgSzNumDen
,
RPI
);
this
.
Denominator
.
PreRecalc
(
this
,
ParaMath
,
ArgSzNumDen
,
RPI
);
RPI
.
bDecreasedComp
=
bDecreasedComp
;
RPI
.
bSmallFraction
=
bSmallFraction
;
};
CFraction
.
prototype
.
recalculateSize
=
function
(
oMeasure
)
CFraction
.
prototype
.
Recalculate_Range
=
function
(
PRS
,
ParaPr
,
Depth
)
{
var
WordLen
=
PRS
.
WordLen
;
// запоминаем, чтобы внутр мат объекты не увеличили WordLen
var
bContainCompareOper
=
PRS
.
bContainCompareOper
;
var
bOneLine
=
PRS
.
bMath_OneLine
;
this
.
bOneLine
=
this
.
bCanBreak
==
false
||
PRS
.
bMath_OneLine
==
true
;
this
.
BrGapLeft
=
this
.
GapLeft
;
this
.
BrGapRight
=
this
.
GapRight
;
PRS
.
bMath_OneLine
=
this
.
bOneLine
;
this
.
Numerator
.
Recalculate_Reset
(
PRS
.
Range
,
PRS
.
Line
,
PRS
);
// обновим StartLine и StartRange
this
.
Numerator
.
Recalculate_Range
(
PRS
,
ParaPr
,
Depth
);
var
bNumBarFraction
=
PRS
.
bSingleBarFraction
;
this
.
Denominator
.
Recalculate_Reset
(
PRS
.
Range
,
PRS
.
Line
,
PRS
);
this
.
Denominator
.
Recalculate_Range
(
PRS
,
ParaPr
,
Depth
);
var
bDenBarFraction
=
PRS
.
bSingleBarFraction
;
if
(
this
.
Pr
.
type
==
BAR_FRACTION
||
this
.
Pr
.
type
==
NO_BAR_FRACTION
)
this
.
recalculateBarFraction
(
oMeasure
);
this
.
recalculateBarFraction
(
g_oTextMeasurer
,
bNumBarFraction
,
bDenBarFraction
);
else
if
(
this
.
Pr
.
type
==
SKEWED_FRACTION
)
this
.
recalculateSkewed
(
oMeasure
);
this
.
recalculateSkewed
(
g_oTextMeasurer
);
else
if
(
this
.
Pr
.
type
==
LINEAR_FRACTION
)
this
.
recalculateLinear
(
oMeasure
);
this
.
recalculateLinear
(
g_oTextMeasurer
);
this
.
UpdatePRS_OneLine
(
PRS
,
WordLen
,
PRS
.
MathFirstItem
);
this
.
Bounds
.
SetWidth
(
0
,
0
,
this
.
size
.
width
);
this
.
Bounds
.
UpdateMetrics
(
0
,
0
,
this
.
size
);
PRS
.
bMath_OneLine
=
bOneLine
;
PRS
.
bContainCompareOper
=
bContainCompareOper
;
};
CFraction
.
prototype
.
recalculateBarFraction
=
function
(
oMeasure
)
CFraction
.
prototype
.
recalculateBarFraction
=
function
(
oMeasure
,
bNumBarFraction
,
bDenBarFraction
)
{
var
Plh
=
new
CMathText
(
true
);
Plh
.
add
(
0x2B1A
);
this
.
MeasureJustDraw
(
Plh
);
var
num
=
this
.
elements
[
0
][
0
].
size
,
den
=
this
.
elements
[
1
][
0
].
size
;
var
NumWidth
=
bNumBarFraction
?
num
.
width
+
0.25
*
Plh
.
size
.
width
:
num
.
width
;
var
DenWidth
=
bDenBarFraction
?
den
.
width
+
0.25
*
Plh
.
size
.
width
:
den
.
width
;
var
mgCtrPrp
=
this
.
Get_TxtPrControlLetter
();
var
width
=
num
.
width
>
den
.
width
?
num
.
width
:
den
.
w
idth
;
var
width
=
NumWidth
>
DenWidth
?
NumWidth
:
DenW
idth
;
var
height
=
num
.
height
+
den
.
height
;
var
ascent
=
num
.
height
+
this
.
ParaMath
.
GetShiftCenter
(
oMeasure
,
mgCtrPrp
);
...
...
@@ -473,6 +495,26 @@ CFraction.prototype.setPosition = function(pos, PosInfo)
CFraction
.
superclass
.
setPosition
.
call
(
this
,
pos
,
PosInfo
);
}
};
CFraction
.
prototype
.
align
=
function
(
pos_x
,
pos_y
)
{
var
PosAlign
=
new
CMathPosition
();
if
(
this
.
Pr
.
type
==
BAR_FRACTION
||
this
.
Pr
.
type
==
NO_BAR_FRACTION
)
{
var
width
=
this
.
size
.
width
-
this
.
GapLeft
-
this
.
GapRight
;
if
(
pos_x
==
0
)
PosAlign
.
x
=
(
width
-
this
.
Numerator
.
size
.
width
)
*
0.5
;
else
PosAlign
.
x
=
(
width
-
this
.
Denominator
.
size
.
width
)
*
0.5
;
}
else
if
(
this
.
Pr
.
type
==
LINEAR_FRACTION
)
{
PosAlign
.
y
=
this
.
size
.
ascent
-
this
.
elements
[
pos_x
][
pos_y
].
size
.
ascent
;
}
return
PosAlign
;
};
CFraction
.
prototype
.
fillContent
=
function
()
{
this
.
Numerator
=
new
CNumerator
(
this
.
Content
[
0
]);
...
...
word/Math/limit.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
function
CMathLimitPr
()
...
...
@@ -111,10 +87,12 @@ CLimitPrimary.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, Gap
var
ArgSzIter
=
ArgSize
.
Copy
();
ArgSzIter
.
Decrease
();
var
NewRPI
=
RPI
.
Copy
()
;
New
RPI
.
bDecreasedComp
=
true
;
var
bDecreasedComp
=
RPI
.
bDecreasedComp
;
RPI
.
bDecreasedComp
=
true
;
this
.
Iterator
.
PreRecalc
(
this
,
ParaMath
,
ArgSzIter
,
NewRPI
);
this
.
Iterator
.
PreRecalc
(
this
,
ParaMath
,
ArgSzIter
,
RPI
);
RPI
.
bDecreasedComp
=
bDecreasedComp
;
};
CLimitPrimary
.
prototype
.
Resize
=
function
(
oMeasure
,
RPI
)
{
...
...
@@ -367,10 +345,12 @@ CMathFunc.prototype.init = function(props)
};
CMathFunc
.
prototype
.
PreRecalc
=
function
(
Parent
,
ParaMath
,
ArgSize
,
RPI
,
GapsInfo
)
{
var
NewRPI
=
RPI
.
Copy
();
NewRPI
.
bMathFunc
=
true
;
var
bMathFunc
=
RPI
.
bMathFunc
;
RPI
.
bMathFunc
=
true
;
CMathFunc
.
superclass
.
PreRecalc
.
call
(
this
,
Parent
,
ParaMath
,
ArgSize
,
RPI
,
GapsInfo
);
CMathFunc
.
superclass
.
PreRecalc
.
call
(
this
,
Parent
,
ParaMath
,
ArgSize
,
NewRPI
,
GapsInfo
)
;
RPI
.
bMathFunc
=
bMathFunc
;
};
CMathFunc
.
prototype
.
GetLastElement
=
function
()
{
...
...
word/Math/mathContent.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
function
CRPI
()
...
...
@@ -34,22 +10,8 @@ function CRPI()
this
.
bMathFunc
=
false
;
this
.
bRecalcCtrPrp
=
false
;
// пересчет ctrPrp нужен, когда на Undo и тп изменился размер первого Run, а ctrPrp уже для мат объектов пересчитались
this
.
bCorrect_ConvertFontSize
=
false
;
this
.
bSmallFraction
=
false
;
}
CRPI
.
prototype
.
Copy
=
function
()
{
var
RPI
=
new
CRPI
();
RPI
.
bInline
=
this
.
bInline
;
RPI
.
bDecreasedComp
=
this
.
bDecreasedComp
;
RPI
.
bChangeInline
=
this
.
bChangeInline
;
RPI
.
bNaryInline
=
this
.
bNaryInline
;
RPI
.
bEqArray
=
this
.
bEqArray
;
RPI
.
bMathFunc
=
this
.
bMathFunc
;
RPI
.
bRecalcCtrPrp
=
this
.
bRecalcCtrPrp
;
RPI
.
bCorrect_ConvertFontSize
=
this
.
bCorrect_ConvertFontSize
;
return
RPI
;
};
CRPI
.
prototype
.
MergeMathInfo
=
function
(
MathInfo
)
{
this
.
bInline
=
MathInfo
.
bInline
||
(
MathInfo
.
bInternalRanges
==
true
&&
MathInfo
.
bStartRanges
==
false
);
...
...
@@ -1331,10 +1293,9 @@ CMathContent.prototype.Correct_Content = function(bInnerCorrection)
{
bEmptyContent
=
false
;
}
}
if
(
bEmptyContent
)
if
(
bEmptyContent
==
true
&&
this
.
bRoot
==
false
)
{
this
.
Content
[
0
].
fillPlaceholders
();
this
.
Content
[
0
].
Recalc_CompiledPr
(
true
);
...
...
@@ -1497,7 +1458,7 @@ CMathContent.prototype.GetMathTextPrForMenu = function(ContentPos, Depth)
return
this
.
Content
[
pos
].
GetMathTextPrForMenu
(
ContentPos
,
Depth
+
1
);
};
CMathContent
.
prototype
.
Apply_TextPr
=
function
(
TextPr
,
IncFontSize
,
ApplyToAll
,
PosForMenu
)
CMathContent
.
prototype
.
Apply_TextPr
=
function
(
TextPr
,
IncFontSize
,
ApplyToAll
,
StartPos
,
EndPos
)
{
if
(
true
===
ApplyToAll
)
{
...
...
@@ -1508,10 +1469,10 @@ CMathContent.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll,
{
var
StartPos
,
EndPos
,
bMenu
=
false
;
if
(
PosForMenu
!==
undefined
)
if
(
StartPos
!==
undefined
&&
EndPos
!==
undefined
)
{
StartPos
=
PosForMenu
.
StartPos
;
EndPos
=
PosForMenu
.
EndPos
;
StartPos
=
StartPos
;
EndPos
=
EndPos
;
bMenu
=
true
;
}
...
...
@@ -4179,6 +4140,30 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
RangeEndPos
=
Pos
-
1
;
}
var
bSingleBarFraction
=
false
;
for
(
var
Pos
=
0
;
Pos
<
ContentLen
;
Pos
++
)
{
if
(
this
.
Content
[
Pos
].
kind
==
MATH_FRACTION
&&
this
.
Content
[
Pos
].
Pr
.
type
==
BAR_FRACTION
)
{
if
(
bSingleBarFraction
)
{
bSingleBarFraction
=
false
;
break
;
}
bSingleBarFraction
=
true
;
}
else
if
(
!
(
this
.
Content
[
Pos
].
Type
==
para_Math_Run
&&
true
==
this
.
Content
[
Pos
].
Is_Empty
())
)
// не пустой Run, другой мат объект
{
bSingleBarFraction
=
false
;
break
;
}
}
PRS
.
bSingleBarFraction
=
bSingleBarFraction
;
this
.
protected_FillRange
(
CurLine
,
CurRange
,
RangeStartPos
,
RangeEndPos
);
};
CMathContent
.
prototype
.
private_ForceBreakBox
=
function
(
PRS
,
Box
,
_Depth
,
PrevLastPos
,
LastPos
)
...
...
word/Math/mathTypes.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
var
MATH_FRACTION
=
0
;
...
...
word/Math/matrix.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
var
MATH_MC_JC
=
MCJC_CENTER
;
...
...
@@ -1347,17 +1323,15 @@ CEqArray.prototype.getColsCount = function()
};
CEqArray
.
prototype
.
Resize
=
function
(
oMeasure
,
RPI
)
{
// на случай, чтобы не затереть массив
//var CurrAmperWPoints = RPI.AmperWPoints,
// CurrEqArray = RPI.bEqArray;
var
NewRPI
=
RPI
.
Copy
();
NewRPI
.
bEqArray
=
true
;
var
bEqArray
=
RPI
.
bEqArray
;
RPI
.
bEqArray
=
true
;
for
(
var
i
=
0
;
i
<
this
.
nRow
;
i
++
)
this
.
elements
[
i
][
0
].
Resize
(
oMeasure
,
New
RPI
);
this
.
elements
[
i
][
0
].
Resize
(
oMeasure
,
RPI
);
this
.
recalculateSize
(
oMeasure
);
RPI
.
bEqArray
=
bEqArray
;
};
CEqArray
.
prototype
.
getMetrics
=
function
()
{
...
...
@@ -1367,7 +1341,6 @@ CEqArray.prototype.getMetrics = function()
// нумерация начинается с нуля, поэтому все четные точки идут с нечетными номерами в массиве
//var lngW = RPI.Widths.length; // this.nRow
var
EndWidths
=
0
;
var
even
,
// четная точка
...
...
word/Math/nary.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
//величина символа "сигма" не меняется в зависимости от аргумента
...
...
@@ -329,12 +305,14 @@ CNary.prototype.private_GetLimLoc = function()
};
CNary
.
prototype
.
PreRecalc
=
function
(
Parent
,
ParaMath
,
ArgSize
,
RPI
,
GapsInfo
)
{
var
NewRPI
=
RPI
.
Copy
()
;
var
bNaryInline
=
RPI
.
bNaryInline
;
if
(
RPI
.
bInline
||
RPI
.
bDecreasedComp
)
NewRPI
.
bNaryInline
=
true
;
RPI
.
bNaryInline
=
true
;
CNary
.
superclass
.
PreRecalc
.
call
(
this
,
Parent
,
ParaMath
,
ArgSize
,
RPI
,
GapsInfo
);
CNary
.
superclass
.
PreRecalc
.
call
(
this
,
Parent
,
ParaMath
,
ArgSize
,
NewRPI
,
GapsInfo
)
;
RPI
.
bNaryInline
=
bNaryInline
;
};
CNary
.
prototype
.
getSign
=
function
(
chrCode
,
chrType
)
{
...
...
@@ -895,11 +873,14 @@ CNaryUnd.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI)
var
ArgSzUnd
=
ArgSize
.
Copy
();
ArgSzUnd
.
Decrease
();
var
RPIUnd
=
RPI
.
Copy
();
RPIUnd
.
bDecreasedComp
=
true
;
this
.
elements
[
0
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSzUnd
,
RPIUnd
);
this
.
elements
[
1
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSize
,
RPI
);
var
bDecreasedComp
=
RPI
.
bDecreasedComp
;
RPI
.
bDecreasedComp
=
true
;
this
.
elements
[
0
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSzUnd
,
RPI
);
RPI
.
bDecreasedComp
=
bDecreasedComp
;
};
CNaryUnd
.
prototype
.
setBase
=
function
(
base
)
{
...
...
@@ -933,11 +914,14 @@ CNaryOvr.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI)
var
ArgSzOvr
=
ArgSize
.
Copy
();
ArgSzOvr
.
Decrease
();
var
RPIOvr
=
RPI
.
Copy
();
RPIOvr
.
bDecreasedComp
=
true
;
this
.
elements
[
0
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSize
,
RPI
);
this
.
elements
[
1
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSzOvr
,
RPIOvr
);
var
bDecreasedComp
=
RPI
.
bDecreasedComp
;
RPI
.
bDecreasedComp
=
true
;
this
.
elements
[
1
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSzOvr
,
RPI
);
RPI
.
bDecreasedComp
=
bDecreasedComp
;
};
CNaryOvr
.
prototype
.
recalculateSize
=
function
()
{
...
...
@@ -1000,13 +984,16 @@ CNaryUndOvr.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI)
var
ArgSzIter
=
ArgSize
.
Copy
();
ArgSzIter
.
Decrease
();
var
RPI_Iter
=
RPI
.
Copy
();
RPI_Iter
.
bDecreasedComp
=
true
;
this
.
elements
[
1
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSize
,
RPI
);
var
bDecreasedComp
=
RPI
.
bDecreasedComp
;
RPI
.
bDecreasedComp
=
true
;
this
.
elements
[
0
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSzIter
,
RPI_Iter
);
this
.
elements
[
1
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSize
,
RPI
);
this
.
elements
[
2
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSzIter
,
RPI_Iter
);
this
.
elements
[
0
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSzIter
,
RPI
);
this
.
elements
[
2
][
0
].
PreRecalc
(
this
,
ParaMath
,
ArgSzIter
,
RPI
);
RPI
.
bDecreasedComp
=
bDecreasedComp
;
};
CNaryUndOvr
.
prototype
.
recalculateSize
=
function
()
{
...
...
word/Math/operators.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
function
CGlyphOperator
()
...
...
@@ -33,7 +9,6 @@ function CGlyphOperator()
this
.
stretch
=
0
;
this
.
bStretch
=
true
;
this
.
penW
=
1
;
// px
}
CGlyphOperator
.
prototype
.
init
=
function
(
props
)
...
...
@@ -101,7 +76,7 @@ CGlyphOperator.prototype.getCoordinateGlyph = function()
var
X
=
coord
.
XX
,
Y
=
coord
.
YY
,
W
=
this
.
size
.
width
,
H
=
this
.
size
.
height
;
var
bHor
=
this
.
loc
==
0
||
this
.
loc
==
1
;
var
bHor
=
this
.
loc
==
LOCATION_TOP
||
this
.
loc
==
LOCATION_BOT
;
var
glW
=
0
,
glH
=
0
;
if
(
bHor
)
...
...
@@ -187,63 +162,6 @@ CGlyphOperator.prototype.getCoordinateGlyph = function()
}
}
/*if(this.loc == LOCATION_TOP)
{
a1 = 1; b1 = 0; c1 = 0;
a2 = 0; b2 = 1; c2 = 0;
}
else if(this.loc == LOCATION_BOT)
{
a1 = 1; b1 = 0; c1 = 0;
if(bLine)
{
a2 = 0; b2 = 1; c2 = (H - glH)/2;
}
else
{
a2 = 0; b2 = 1; c2 = H - glH;
}
}
else if(this.loc == LOCATION_LEFT)
{
a1 = 0; b1 = 1; c1 = 0;
a2 = 1; b2 = 0; c2 = 0;
}
else if(this.loc == LOCATION_RIGHT)
{
if(bLine)
{
a1 = 0; b1 = 1; c1 = (W - glW)/2;
}
else
{
a1 = 0; b1 = 1; c1 = W - glW;
}
a2 = 1; b2 = 0; c2 = 0;
}
else if(this.loc == LOCATION_SEP)
{
a1 = 0; b1 = 1; c1 = 0;
a2 = 1; b2 = 0; c2 = 0;
}*/
/*var shW = 0,
shH = 0;
if(bHor)
{
a1 = 1; b1 = 0; c1 = 0;
a2 = 0; b2 = 1; c2 = 0;
}
else
{
a1 = 0; b1 = 1; c1 = 0;
a2 = 1; b2 = 0; c2 = 0;
}*/
if
(
this
.
turn
==
1
)
{
a1
*=
-
1
;
b1
*=
-
1
;
c1
+=
glW
;
...
...
@@ -285,7 +203,7 @@ CGlyphOperator.prototype.draw = function(pGraphics, XX, YY, PDSE)
pGraphics
.
p_width
(
this
.
penW
*
1000
);
pGraphics
.
_s
();
this
.
drawPath
(
pGraphics
,
XX
,
YY
,
PDSE
);
this
.
drawPath
(
pGraphics
,
XX
,
YY
,
PDSE
);
pGraphics
.
df
();
pGraphics
.
_s
();
...
...
@@ -2994,7 +2912,6 @@ COperator.prototype.fixSize = function(oMeasure, stretch)
Bold
:
false
//ctrPrp.Bold
};
oMeasure
.
SetFont
(
Font
);
var
bLine
=
this
.
IsLineGlyph
();
...
...
@@ -3028,19 +2945,25 @@ COperator.prototype.fixSize = function(oMeasure, stretch)
}
}
// Height
var
mgCtrPrp
=
this
.
Parent
.
Get_TxtPrControlLetter
();
var
shCenter
=
this
.
ParaMath
.
GetShiftCenter
(
oMeasure
,
mgCtrPrp
);
// Height, Ascent
if
(
this
.
type
===
OPER_ACCENT
)
{
var
letterOperator
=
new
CMathText
(
true
);
letterOperator
.
add
(
this
.
code
);
letterOperator
.
Measure
(
oMeasure
,
ctrPrp
);
if
(
this
.
type
===
OPER_ACCENT
)
{
var
letterX
=
new
CMathText
(
true
);
letterX
.
add
(
0x78
);
letterX
.
Measure
(
oMeasure
,
ctrPrp
);
height
=
letterOperator
.
size
.
ascent
-
letterX
.
size
.
ascent
;
ascent
=
height
/
2
+
shCenter
;
}
else
{
...
...
@@ -3053,17 +2976,16 @@ COperator.prototype.fixSize = function(oMeasure, stretch)
else
height
=
dims
.
Height
;
}
}
// Ascent
var
mgCtrPrp
=
this
.
Parent
.
Get_TxtPrControlLetter
();
var
shCenter
=
this
.
ParaMath
.
GetShiftCenter
(
oMeasure
,
mgCtrPrp
);
if
(
!
bLine
&&
(
this
.
operator
.
loc
==
LOCATION_TOP
||
this
.
operator
.
loc
==
LOCATION_BOT
))
ascent
=
dims
.
Height
/
2
;
if
(
!
bLine
&&
this
.
operator
.
loc
==
LOCATION_TOP
)
ascent
=
dims
.
Height
;
else
if
(
!
bLine
&&
this
.
operator
.
loc
==
LOCATION_BOT
)
ascent
=
this
.
operator
.
size
.
height
;
else
ascent
=
height
/
2
+
shCenter
;
}
this
.
size
.
width
=
width
;
this
.
size
.
height
=
height
;
...
...
@@ -3078,7 +3000,7 @@ COperator.prototype.Resize = function(oMeasure)
{
if
(
this
.
typeOper
!==
OPERATOR_EMPTY
)
{
var
bHor
=
this
.
operator
.
loc
==
0
||
this
.
operator
.
loc
==
1
;
var
bHor
=
this
.
operator
.
loc
==
LOCATION_TOP
||
this
.
operator
.
loc
==
LOCATION_BOT
;
if
(
bHor
)
this
.
fixSize
(
oMeasure
,
this
.
size
.
width
);
...
...
@@ -4135,7 +4057,7 @@ CCharacter.prototype.setCharacter = function(props, defaultProps)
};
CCharacter
.
prototype
.
recalculateSize
=
function
(
oMeasure
)
{
var
Base
=
this
.
Content
[
0
];
var
Base
=
this
.
elements
[
0
]
[
0
];
this
.
operator
.
fixSize
(
oMeasure
,
Base
.
size
.
width
);
...
...
@@ -4164,7 +4086,7 @@ CCharacter.prototype.setPosition = function(pos, PosInfo)
var
PosOper
=
new
CMathPosition
(),
PosBase
=
new
CMathPosition
();
var
Base
=
this
.
Content
[
0
];
var
Base
=
this
.
elements
[
0
]
[
0
];
if
(
this
.
Pr
.
pos
===
LOCATION_TOP
)
{
...
...
@@ -4174,14 +4096,14 @@ CCharacter.prototype.setPosition = function(pos, PosInfo)
this
.
operator
.
setPosition
(
PosOper
);
PosBase
.
x
=
this
.
pos
.
x
+
this
.
GapLeft
+
alignCnt
;
PosBase
.
y
=
this
.
pos
.
y
+
this
.
operator
.
size
.
height
+
Base
.
size
.
ascent
;
PosBase
.
y
=
this
.
pos
.
y
+
this
.
operator
.
size
.
height
;
Base
.
setPosition
(
PosBase
,
PosInfo
);
}
else
if
(
this
.
Pr
.
pos
===
LOCATION_BOT
)
{
PosBase
.
x
=
this
.
pos
.
x
+
this
.
GapLeft
+
alignCnt
;
PosBase
.
y
=
this
.
pos
.
y
+
Base
.
size
.
ascent
;
PosBase
.
y
=
this
.
pos
.
y
;
Base
.
setPosition
(
PosBase
,
PosInfo
);
...
...
@@ -4413,22 +4335,17 @@ CGroupCharacter.prototype.getAscent = function(oMeasure)
{
var
ascent
;
//var shCent = DIV_CENT*this.getCtrPrp().FontSize;
var
ctrPrp
=
this
.
Get_TxtPrControlLetter
();
var
shCent
=
this
.
ParaMath
.
GetShiftCenter
(
oMeasure
,
ctrPrp
);
if
(
this
.
Pr
.
vertJc
===
VJUST_TOP
&&
this
.
Pr
.
pos
===
LOCATION_TOP
)
ascent
=
this
.
operator
.
size
.
ascent
+
shCent
;
//ascent = this.operator.size.ascent + 1.3*shCent;
ascent
=
this
.
operator
.
size
.
ascent
;
else
if
(
this
.
Pr
.
vertJc
===
VJUST_BOT
&&
this
.
Pr
.
pos
===
LOCATION_TOP
)
ascent
=
this
.
operator
.
size
.
height
+
this
.
elements
[
0
][
0
].
size
.
ascent
;
else
if
(
this
.
Pr
.
vertJc
===
VJUST_TOP
&&
this
.
Pr
.
pos
===
LOCATION_BOT
)
ascent
=
this
.
elements
[
0
][
0
].
size
.
ascent
;
else
if
(
this
.
Pr
.
vertJc
===
VJUST_BOT
&&
this
.
Pr
.
pos
===
LOCATION_BOT
)
ascent
=
this
.
elements
[
0
][
0
].
size
.
height
+
shCent
+
this
.
operator
.
size
.
height
-
this
.
operator
.
size
.
ascent
;
//ascent = this.elements[0][0].size.height + 1.55*shCent + this.operator.size.height - this.operator.size.ascent;
ascent
=
this
.
elements
[
0
][
0
].
size
.
height
+
this
.
operator
.
size
.
height
;
return
ascent
;
};
...
...
word/Math/radical.js
View file @
c312b994
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
function
CSignRadical
()
...
...
@@ -195,7 +171,9 @@ CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg, bInline)
var
Symbol5
=
new
CMathText
(
true
);
Symbol5
.
add
(
0x35
);
Symbol5
.
Measure
(
oMeasure
,
CtrPrp
);
// измеряем функцией MeasureJustDraw, чтобы был выставлен Font
this
.
Parent
.
MeasureJustDraw
(
Symbol5
);
var
measureH
=
Symbol5
.
size
.
height
;
...
...
@@ -232,7 +210,9 @@ CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg, bInline)
var
letterG
=
new
CMathText
(
true
);
letterG
.
add
(
0x67
);
letterG
.
Measure
(
oMeasure
,
CtrPrp
);
// измеряем функцией MeasureJustDraw, чтобы был выставлен Font
this
.
Parent
.
MeasureJustDraw
(
letterG
);
var
Descent
=
letterG
.
size
.
height
-
letterG
.
size
.
ascent
;
var
bDescentArg
=
sizeArg
.
height
-
sizeArg
.
ascent
>
0.9
*
Descent
;
...
...
@@ -442,9 +422,16 @@ CRadical.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo
var
ArgSzIter
=
new
CMathArgSize
();
ArgSzIter
.
SetValue
(
-
2
);
this
.
Iterator
.
PreRecalc
(
this
,
ParaMath
,
ArgSzIter
,
RPI
);
this
.
RealBase
.
PreRecalc
(
this
,
ParaMath
,
ArgSize
,
RPI
);
var
bDecreasedComp
=
RPI
.
bDecreasedComp
;
RPI
.
bDecreasedComp
=
true
;
this
.
Iterator
.
PreRecalc
(
this
,
ParaMath
,
ArgSzIter
,
RPI
);
RPI
.
bDecreasedComp
=
bDecreasedComp
;
if
(
this
.
bInside
==
false
)
GapsInfo
.
setGaps
(
this
,
this
.
TextPrControlLetter
.
FontSize
);
};
...
...
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