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
1906aba4
Commit
1906aba4
authored
Mar 31, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Размер Drawing в процентах
parent
bc736780
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
299 additions
and
29 deletions
+299
-29
common/Drawings/CommonController.js
common/Drawings/CommonController.js
+12
-0
common/Drawings/Format/Constants.js
common/Drawings/Format/Constants.js
+2
-1
common/Drawings/Format/Shape.js
common/Drawings/Format/Shape.js
+99
-1
common/apiCommon.js
common/apiCommon.js
+60
-25
word/Editor/ParagraphContent.js
word/Editor/ParagraphContent.js
+126
-2
No files found.
common/Drawings/CommonController.js
View file @
1906aba4
...
...
@@ -37,6 +37,18 @@ var DISTANCE_TO_TEXT_LEFTRIGHT = 3.2;
function
CheckShapeBodyAutoFitReset
(
oShape
)
{
var
oParaDrawing
=
getParaDrawing
(
oShape
);
if
(
oParaDrawing
)
{
if
(
oParaDrawing
.
SizeRelH
)
{
oParaDrawing
.
SetSizeRelH
(
undefined
);
}
if
(
oParaDrawing
.
SizeRelV
)
{
oParaDrawing
.
SetSizeRelV
(
undefined
);
}
}
if
(
oShape
instanceof
CShape
)
{
var
oPropsToSet
=
null
;
...
...
common/Drawings/Format/Constants.js
View file @
1906aba4
...
...
@@ -1035,7 +1035,8 @@ var historyitem_Drawing_SetEffectExtent = 17;// Устанавливаем Eff
var
historyitem_Drawing_SetParent
=
18
;
// Устанавливаем Parent
var
historyitem_Drawing_SetParaMath
=
19
;
// Добавляем новую формулу для конвертации старого формата в новый
var
historyitem_Drawing_LayoutInCell
=
20
;
// Устанавливаем параметр расположения в таблице
var
historyitem_Drawing_SetSizeRelH
=
21
;
//Ширина объекта в процентах
var
historyitem_Drawing_SetSizeRelV
=
22
;
//Высота объекта в процентах
...
...
common/Drawings/Format/Shape.js
View file @
1906aba4
...
...
@@ -2555,6 +2555,94 @@ CShape.prototype =
this
.
extY
=
this
.
parent
.
Extent
.
H
;
}
}
else
{
var
oParaDrawing
=
getParaDrawing
(
this
);
if
(
oParaDrawing
)
{
if
(
oParaDrawing
.
SizeRelH
||
oParaDrawing
.
SizeRelV
)
{
this
.
m_oSectPr
=
null
;
var
oParentParagraph
=
oParaDrawing
.
Get_ParentParagraph
();
if
(
oParentParagraph
)
{
var
oSectPr
=
oParentParagraph
.
Get_SectPr
();
if
(
oSectPr
)
{
if
(
oParaDrawing
.
SizeRelH
)
{
switch
(
oParaDrawing
.
SizeRelH
.
RelativeFrom
)
{
case
c_oAscRelativeFromH
.
Margin
:
{
this
.
extX
=
oSectPr
.
Get_PageWidth
()
-
oSectPr
.
Get_PageMargin_Left
()
-
oSectPr
.
Get_PageMargin_Right
();
break
;
}
case
c_oAscRelativeFromH
.
Page
:
{
this
.
extX
=
oSectPr
.
Get_PageWidth
();
break
;
}
case
c_oAscRelativeFromH
.
LeftMargin
:
{
this
.
extX
=
oSectPr
.
Get_PageMargin_Left
();
break
;
}
case
c_oAscRelativeFromH
.
RightMargin
:
{
this
.
extX
=
oSectPr
.
Get_PageMargin_Right
();
break
;
}
default
:
{
this
.
extX
=
oSectPr
.
Get_PageMargin_Left
();
break
;
}
}
this
.
extX
*=
oParaDrawing
.
SizeRelH
.
Percent
;
}
if
(
oParaDrawing
.
SizeRelV
)
{
switch
(
oParaDrawing
.
SizeRelV
.
RelativeFrom
)
{
case
c_oAscRelativeFromV
.
Margin
:
{
this
.
extY
=
oSectPr
.
Get_PageHeight
()
-
oSectPr
.
Get_PageMargin_Top
()
-
oSectPr
.
Get_PageMargin_Bottom
();
break
;
}
case
c_oAscRelativeFromV
.
Page
:
{
this
.
extY
=
oSectPr
.
Get_PageHeight
();
break
;
}
case
c_oAscRelativeFromV
.
TopMargin
:
{
this
.
extY
=
oSectPr
.
Get_PageMargin_Top
();
break
;
}
case
c_oAscRelativeFromV
.
BottomMargin
:
{
this
.
extY
=
oSectPr
.
Get_PageMargin_Bottom
();
break
;
}
default
:
{
this
.
extY
=
oSectPr
.
Get_PageMargin_Top
();
break
;
}
}
this
.
extY
*=
oParaDrawing
.
SizeRelV
.
Percent
;
}
this
.
m_oSectPr
=
new
CSectionPr
();
this
.
m_oSectPr
.
Copy
(
oSectPr
);
}
}
}
}
}
}
else
{
...
...
@@ -2942,7 +3030,9 @@ CShape.prototype =
{
var
Width
,
Height
,
Width2
,
Height2
;
var
bRet
=
false
;
if
(
this
.
checkAutofit
())
var
oParaDrawing
=
getParaDrawing
(
this
);
var
bSizRel
=
(
oParaDrawing
&&
(
oParaDrawing
.
SizeRelH
||
oParaDrawing
.
SizeRelV
));
if
(
this
.
checkAutofit
()
||
bSizRel
)
{
if
(
oSectPr
)
{
...
...
@@ -2951,6 +3041,10 @@ CShape.prototype =
this
.
recalcBounds
();
this
.
recalcText
();
this
.
recalcGeometry
();
if
(
bSizRel
)
{
this
.
recalcTransform
();
}
bRet
=
true
;
}
else
...
...
@@ -2967,6 +3061,10 @@ CShape.prototype =
this
.
recalcBounds
();
this
.
recalcText
();
this
.
recalcGeometry
();
if
(
bSizRel
)
{
this
.
recalcTransform
();
}
}
return
bRet
;
}
...
...
common/apiCommon.js
View file @
1906aba4
...
...
@@ -22,7 +22,7 @@
* Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"
use strict
"
;
"
use strict
"
;
(
/**
* @param {Window} window
...
...
@@ -1954,6 +1954,9 @@
this
.
PositionH
=
(
undefined
!=
obj
.
PositionH
)
?
new
CImagePositionH
(
obj
.
PositionH
)
:
undefined
;
this
.
PositionV
=
(
undefined
!=
obj
.
PositionV
)
?
new
CImagePositionV
(
obj
.
PositionV
)
:
undefined
;
this
.
SizeRelH
=
(
undefined
!=
obj
.
SizeRelH
)
?
new
CImagePositionH
(
obj
.
SizeRelH
)
:
undefined
;
this
.
SizeRelV
=
(
undefined
!=
obj
.
SizeRelV
)
?
new
CImagePositionH
(
obj
.
SizeRelV
)
:
undefined
;
this
.
Internal_Position
=
(
undefined
!=
obj
.
Internal_Position
)
?
obj
.
Internal_Position
:
null
;
this
.
ImageUrl
=
(
undefined
!=
obj
.
ImageUrl
)
?
obj
.
ImageUrl
:
null
;
...
...
@@ -1982,6 +1985,10 @@
this
.
Position
=
undefined
;
this
.
PositionH
=
undefined
;
this
.
PositionV
=
undefined
;
this
.
SizeRelH
=
undefined
;
this
.
SizeRelV
=
undefined
;
this
.
Internal_Position
=
null
;
this
.
ImageUrl
=
null
;
this
.
Locked
=
false
;
...
...
@@ -2027,6 +2034,27 @@
asc_putPositionH
:
function
(
v
)
{
this
.
PositionH
=
v
;
},
asc_getPositionV
:
function
()
{
return
this
.
PositionV
;
},
asc_putPositionV
:
function
(
v
)
{
this
.
PositionV
=
v
;
},
asc_getSizeRelH
:
function
()
{
return
this
.
SizeRelH
;
},
asc_putSizeRelH
:
function
(
v
)
{
this
.
SizeRelH
=
v
;
},
asc_getSizeRelV
:
function
()
{
return
this
.
SizeRelV
;
},
asc_putSizeRelV
:
function
(
v
)
{
this
.
SizeRelV
=
v
;
},
asc_getValue_X
:
function
(
RelativeFrom
)
{
if
(
null
!=
this
.
Internal_Position
)
return
this
.
Internal_Position
.
Calculate_X_Value
(
RelativeFrom
);
return
0
;
},
asc_getValue_Y
:
function
(
RelativeFrom
)
{
if
(
null
!=
this
.
Internal_Position
)
return
this
.
Internal_Position
.
Calculate_Y_Value
(
RelativeFrom
);
return
0
;
},
...
...
@@ -2134,6 +2162,13 @@
prot
[
"
put_PositionH
"
]
=
prot
[
"
asc_putPositionH
"
]
=
prot
.
asc_putPositionH
;
prot
[
"
get_PositionV
"
]
=
prot
[
"
asc_getPositionV
"
]
=
prot
.
asc_getPositionV
;
prot
[
"
put_PositionV
"
]
=
prot
[
"
asc_putPositionV
"
]
=
prot
.
asc_putPositionV
;
prot
[
"
get_SizeRelH
"
]
=
prot
[
"
asc_getSizeRelH
"
]
=
prot
.
asc_getSizeRelH
;
prot
[
"
put_SizeRelH
"
]
=
prot
[
"
asc_putSizeRelH
"
]
=
prot
.
asc_putSizeRelH
;
prot
[
"
get_SizeRelV
"
]
=
prot
[
"
asc_getSizeRelV
"
]
=
prot
.
asc_getSizeRelV
;
prot
[
"
put_SizeRelV
"
]
=
prot
[
"
asc_putSizeRelV
"
]
=
prot
.
asc_putSizeRelV
;
prot
[
"
get_Value_X
"
]
=
prot
[
"
asc_getValue_X
"
]
=
prot
.
asc_getValue_X
;
prot
[
"
get_Value_Y
"
]
=
prot
[
"
asc_getValue_Y
"
]
=
prot
.
asc_getValue_Y
;
prot
[
"
get_ImageUrl
"
]
=
prot
[
"
asc_getImageUrl
"
]
=
prot
.
asc_getImageUrl
;
...
...
word/Editor/ParagraphContent.js
View file @
1906aba4
...
...
@@ -4087,6 +4087,10 @@ function ParaDrawing(W, H, GraphicObj, DrawingDocument, DocumentContent, Parent)
B
:
0
};
this
.
SizeRelH
=
undefined
;
this
.
SizeRelV
=
undefined
;
//{RelativeFrom : c_oAscRelativeFromH.Column, Percent: ST_PositivePercentage}
this
.
AllowOverlap
=
true
;
//привязка к параграфу
...
...
@@ -4280,6 +4284,26 @@ ParaDrawing.prototype =
Percent
:
this
.
PositionV
.
Percent
};
if
(
this
.
SizeRelH
)
{
Props
.
SizeRelH
=
{
RelativeFrom
:
this
.
SizeRelH
.
RelativeFrom
,
Percent
:
this
.
SizeRelH
.
Percent
};
}
if
(
this
.
SizeRelV
)
{
Props
.
SizeRelV
=
{
RelativeFrom
:
this
.
SizeRelV
.
RelativeFrom
,
Percent
:
this
.
SizeRelV
.
Percent
};
}
Props
.
Internal_Position
=
this
.
Internal_Position
;
Props
.
Locked
=
this
.
Lock
.
Is_Locked
();
...
...
@@ -4394,6 +4418,19 @@ ParaDrawing.prototype =
}
},
SetSizeRelH
:
function
(
oSize
)
{
History
.
Add
(
this
,
{
Type
:
historyitem_Drawing_SetSizeRelH
,
Old
:
this
.
SizeRelH
,
New
:
oSize
});
this
.
SizeRelH
=
oSize
;
},
SetSizeRelV
:
function
(
oSize
)
{
History
.
Add
(
this
,
{
Type
:
historyitem_Drawing_SetSizeRelV
,
Old
:
this
.
SizeRelV
,
New
:
oSize
});
this
.
SizeRelV
=
oSize
;
},
getXfrmExtX
:
function
()
{
if
(
isRealObject
(
this
.
GraphicObj
)
&&
isRealObject
(
this
.
GraphicObj
.
spPr
)
&&
isRealObject
(
this
.
GraphicObj
.
spPr
.
xfrm
))
...
...
@@ -4504,6 +4541,15 @@ ParaDrawing.prototype =
}
}
}
if
(
undefined
!=
Props
.
SizeRelH
)
{
this
.
SetSizeRelH
({
RelativeFrom
:
Props
.
SizeRelH
.
RelativeFrom
,
Percent
:
Props
.
SizeRelH
.
Percent
});
}
if
(
undefined
!=
Props
.
SizeRelV
)
{
this
.
SetSizeRelV
({
RelativeFrom
:
Props
.
SizeRelV
.
RelativeFrom
,
Percent
:
Props
.
SizeRelV
.
Percent
});
}
if
(
bNeedUpdateWH
)
{
this
.
setExtent
(
newW
,
newH
);
...
...
@@ -4579,7 +4625,7 @@ ParaDrawing.prototype =
this
.
Height
=
0
;
return
;
}
if
(
isRealNumber
(
this
.
Extent
.
W
)
&&
isRealNumber
(
this
.
Extent
.
H
)
&&
(
!
this
.
GraphicObj
.
checkAutofit
||
!
this
.
GraphicObj
.
checkAutofit
()))
if
(
isRealNumber
(
this
.
Extent
.
W
)
&&
isRealNumber
(
this
.
Extent
.
H
)
&&
(
!
this
.
GraphicObj
.
checkAutofit
||
!
this
.
GraphicObj
.
checkAutofit
())
&&
!
this
.
SizeRelH
&&
!
this
.
SizeRelV
)
{
this
.
Width
=
this
.
Extent
.
W
;
this
.
Height
=
this
.
Extent
.
H
;
...
...
@@ -5268,7 +5314,6 @@ ParaDrawing.prototype =
{
if
(
this
.
GraphicObj
.
CheckNeedRecalcAutoFit
(
oSectPr
))
{
//this.GraphicObj.recalculate();
if
(
this
.
GraphicObj
)
{
this
.
GraphicObj
.
recalcWrapPolygon
&&
this
.
GraphicObj
.
recalcWrapPolygon
();
...
...
@@ -5286,6 +5331,16 @@ ParaDrawing.prototype =
switch
(
Type
)
{
case
historyitem_Drawing_SetSizeRelH
:
{
this
.
SizeRelH
=
Data
.
Old
;
break
;
}
case
historyitem_Drawing_SetSizeRelV
:
{
this
.
SizeRelV
=
Data
.
Old
;
break
;
}
case
historyitem_Drawing_SetEffectExtent
:
{
this
.
EffectExtent
.
L
=
Data
.
OldEE
.
L
;
...
...
@@ -5433,6 +5488,16 @@ ParaDrawing.prototype =
switch
(
Type
)
{
case
historyitem_Drawing_SetSizeRelH
:
{
this
.
SizeRelH
=
Data
.
New
;
break
;
}
case
historyitem_Drawing_SetSizeRelV
:
{
this
.
SizeRelV
=
Data
.
New
;
break
;
}
case
historyitem_Drawing_SetEffectExtent
:
{
this
.
EffectExtent
.
L
=
Data
.
NewEE
.
L
;
...
...
@@ -5605,6 +5670,22 @@ ParaDrawing.prototype =
}
break
;
}
case
historyitem_Drawing_SetSizeRelH
:
case
historyitem_Drawing_SetSizeRelV
:
{
if
(
this
.
GraphicObj
)
{
this
.
GraphicObj
.
handleUpdateExtents
&&
this
.
GraphicObj
.
handleUpdateExtents
();
this
.
GraphicObj
.
addToRecalculate
();
}
var
Run
=
this
.
Parent
.
Get_DrawingObjectRun
(
this
.
Id
);
if
(
Run
)
{
Run
.
RecalcInfo
.
Measure
=
true
;
}
break
;
}
case
historyitem_Drawing_WrappingType
:
{
if
(
this
.
GraphicObj
)
...
...
@@ -5824,6 +5905,21 @@ ParaDrawing.prototype =
switch
(
Type
)
{
case
historyitem_Drawing_SetSizeRelH
:
case
historyitem_Drawing_SetSizeRelV
:
{
if
(
Data
.
New
)
{
Writer
.
WriteBool
(
true
);
Writer
.
WriteLong
(
Data
.
New
.
RelativeFrom
);
Writer
.
WriteDouble
(
Data
.
New
.
Percent
);
}
else
{
Writer
.
WriteBool
(
false
);
}
break
;
}
case
historyitem_Drawing_SetEffectExtent
:
{
writeDouble
(
Writer
,
Data
.
NewEE
.
L
);
...
...
@@ -6003,6 +6099,34 @@ ParaDrawing.prototype =
switch
(
Type
)
{
case
historyitem_Drawing_SetSizeRelH
:
{
if
(
Reader
.
GetBool
())
{
this
.
SizeRelH
=
{};
this
.
SizeRelH
.
RelativeFrom
=
Reader
.
GetLong
();
this
.
SizeRelH
.
Percent
=
Reader
.
GetDouble
();
}
else
{
this
.
SizeRelH
=
undefined
;
}
break
;
}
case
historyitem_Drawing_SetSizeRelV
:
{
if
(
Reader
.
GetBool
())
{
this
.
SizeRelV
=
{};
this
.
SizeRelV
.
RelativeFrom
=
Reader
.
GetLong
();
this
.
SizeRelV
.
Percent
=
Reader
.
GetDouble
();
}
else
{
this
.
SizeRelV
=
undefined
;
}
break
;
}
case
historyitem_Drawing_SetEffectExtent
:
{
this
.
EffectExtent
.
L
=
readDouble
(
Reader
);
...
...
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