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
0808e3c9
Commit
0808e3c9
authored
Apr 12, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Поправил выставление и отдачу в интерфейс размеров автофигур в процетах
parent
bc1dd656
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
249 additions
and
73 deletions
+249
-73
common/Drawings/CommonController.js
common/Drawings/CommonController.js
+190
-21
word/Editor/ParagraphContent.js
word/Editor/ParagraphContent.js
+59
-52
No files found.
common/Drawings/CommonController.js
View file @
0808e3c9
...
...
@@ -35,10 +35,10 @@ var HANDLE_EVENT_MODE_CURSOR = 1;
var
DISTANCE_TO_TEXT_LEFTRIGHT
=
3.2
;
function
CheckShapeBodyAutoFitReset
(
oShape
)
function
CheckShapeBodyAutoFitReset
(
oShape
,
bNoResetRelSize
)
{
var
oParaDrawing
=
getParaDrawing
(
oShape
);
if
(
oParaDrawing
)
if
(
oParaDrawing
&&
!
(
bNoResetRelSize
===
true
)
)
{
if
(
oParaDrawing
.
SizeRelH
)
{
...
...
@@ -111,6 +111,146 @@ function CDistance(L, T, R, B)
}
function
ConvertRelPositionHToRelSize
(
nRelPosition
)
{
switch
(
nRelPosition
)
{
case
c_oAscRelativeFromH
.
InsideMargin
:
{
return
c_oAscSizeRelFromH
.
sizerelfromhInsideMargin
;
}
case
c_oAscRelativeFromH
.
LeftMargin
:
{
return
c_oAscSizeRelFromH
.
sizerelfromhLeftMargin
;
}
case
c_oAscRelativeFromH
.
Margin
:
{
return
c_oAscSizeRelFromH
.
sizerelfromhMargin
;
}
case
c_oAscRelativeFromH
.
OutsideMargin
:
{
return
c_oAscSizeRelFromH
.
sizerelfromhOutsideMargin
;
}
case
c_oAscRelativeFromH
.
Page
:
{
return
c_oAscSizeRelFromH
.
sizerelfromhPage
;
}
case
c_oAscRelativeFromH
.
RightMargin
:
{
return
c_oAscSizeRelFromH
.
sizerelfromhRightMargin
;
}
default
:
{
return
c_oAscSizeRelFromH
.
sizerelfromhPage
;
}
}
}
function
ConvertRelPositionVToRelSize
(
nRelPosition
)
{
switch
(
nRelPosition
)
{
case
c_oAscRelativeFromV
.
BottomMargin
:
{
return
c_oAscSizeRelFromV
.
sizerelfromvBottomMargin
;
}
case
c_oAscRelativeFromV
.
InsideMargin
:
{
return
c_oAscSizeRelFromV
.
sizerelfromvInsideMargin
;
}
case
c_oAscRelativeFromV
.
Margin
:
{
return
c_oAscSizeRelFromV
.
sizerelfromvMargin
;
}
case
c_oAscRelativeFromV
.
OutsideMargin
:
{
return
c_oAscSizeRelFromV
.
sizerelfromvOutsideMargin
;
}
case
c_oAscRelativeFromV
.
Page
:
{
return
c_oAscSizeRelFromV
.
sizerelfromvPage
;
}
case
c_oAscRelativeFromV
.
TopMargin
:
{
return
c_oAscSizeRelFromV
.
sizerelfromvTopMargin
;
}
default
:
{
return
c_oAscSizeRelFromV
.
sizerelfromvMargin
;
}
}
}
function
ConvertRelSizeHToRelPosition
(
nRelSize
)
{
switch
(
nRelSize
)
{
case
c_oAscSizeRelFromH
.
sizerelfromhMargin
:
{
return
c_oAscRelativeFromH
.
Margin
;
}
case
c_oAscSizeRelFromH
.
sizerelfromhPage
:
{
return
c_oAscRelativeFromH
.
Page
;
}
case
c_oAscSizeRelFromH
.
sizerelfromhLeftMargin
:
{
return
c_oAscRelativeFromH
.
LeftMargin
;
}
case
c_oAscSizeRelFromH
.
sizerelfromhRightMargin
:
{
return
c_oAscRelativeFromH
.
RightMargin
;
}
case
c_oAscSizeRelFromH
.
sizerelfromhInsideMargin
:
{
return
c_oAscRelativeFromH
.
InsideMargin
;
}
case
c_oAscSizeRelFromH
.
sizerelfromhOutsideMargin
:
{
return
c_oAscRelativeFromH
.
OutsideMargin
;
}
default
:
{
return
c_oAscRelativeFromH
.
Margin
;
}
}
}
function
ConvertRelSizeVToRelPosition
(
nRelSize
)
{
switch
(
nRelSize
)
{
case
c_oAscSizeRelFromV
.
sizerelfromvMargin
:
{
return
c_oAscRelativeFromV
.
Margin
;
}
case
c_oAscSizeRelFromV
.
sizerelfromvPage
:
{
return
c_oAscRelativeFromV
.
Page
;
}
case
c_oAscSizeRelFromV
.
sizerelfromvTopMargin
:
{
return
c_oAscRelativeFromV
.
TopMargin
;
}
case
c_oAscSizeRelFromV
.
sizerelfromvBottomMargin
:
{
return
c_oAscRelativeFromV
.
BottomMargin
;
}
case
c_oAscSizeRelFromV
.
sizerelfromvInsideMargin
:
{
return
c_oAscRelativeFromV
.
InsideMargin
;
}
case
c_oAscSizeRelFromV
.
sizerelfromvOutsideMargin
:
{
return
c_oAscRelativeFromV
.
OutsideMargin
;
}
default
:
{
return
c_oAscRelativeFromV
.
Margin
;
}
}
}
function
checkObjectInArray
(
aObjects
,
oObject
)
{
...
...
@@ -2072,36 +2212,65 @@ DrawingObjectsController.prototype =
for
(
i
=
0
;
i
<
objects_by_type
.
shapes
.
length
;
++
i
)
{
CheckSpPrXfrm
(
objects_by_type
.
shapes
[
i
]);
objects_by_type
.
shapes
[
i
].
spPr
.
xfrm
.
setExtX
(
props
.
Width
);
objects_by_type
.
shapes
[
i
].
spPr
.
xfrm
.
setExtY
(
props
.
Height
);
CheckShapeBodyAutoFitReset
(
objects_by_type
.
shapes
[
i
]);
if
(
!
props
.
SizeRelH
)
{
objects_by_type
.
shapes
[
i
].
spPr
.
xfrm
.
setExtX
(
props
.
Width
);
if
(
objects_by_type
.
shapes
[
i
].
parent
instanceof
ParaDrawing
)
{
objects_by_type
.
shapes
[
i
].
parent
.
SetSizeRelH
({
RelativeFrom
:
c_oAscSizeRelFromH
.
sizerelfromhPage
,
Percent
:
0
})
}
}
if
(
!
props
.
SizeRelV
)
{
objects_by_type
.
shapes
[
i
].
spPr
.
xfrm
.
setExtY
(
props
.
Height
);
if
(
objects_by_type
.
shapes
[
i
].
parent
instanceof
ParaDrawing
)
{
objects_by_type
.
shapes
[
i
].
parent
.
SetSizeRelV
({
RelativeFrom
:
c_oAscSizeRelFromV
.
sizerelfromvPage
,
Percent
:
0
});
}
}
if
(
objects_by_type
.
shapes
[
i
].
parent
instanceof
ParaDrawing
)
{
var
oDrawing
=
objects_by_type
.
shapes
[
i
].
parent
;
if
(
oDrawing
.
SizeRelH
&&
!
oDrawing
.
SizeRelV
)
{
oDrawing
.
SetSizeRelV
({
RelativeFrom
:
c_oAscSizeRelFromV
.
sizerelfromvPage
,
Percent
:
0
});
}
if
(
oDrawing
.
SizeRelV
&&
!
oDrawing
.
SizeRelH
)
{
oDrawing
.
SetSizeRelH
({
RelativeFrom
:
c_oAscSizeRelFromH
.
sizerelfromhPage
,
Percent
:
0
})
}
}
CheckShapeBodyAutoFitReset
(
objects_by_type
.
shapes
[
i
],
true
);
if
(
objects_by_type
.
shapes
[
i
].
group
)
{
checkObjectInArray
(
aGroups
,
objects_by_type
.
shapes
[
i
].
group
.
getMainGroup
());
}
objects_by_type
.
shapes
[
i
].
checkDrawingBaseCoords
();
}
for
(
i
=
0
;
i
<
objects_by_type
.
images
.
length
;
++
i
)
if
(
!
props
.
SizeRelH
&&
!
props
.
SizeRelV
)
{
CheckSpPrXfrm
(
objects_by_type
.
images
[
i
]);
objects_by_type
.
images
[
i
].
spPr
.
xfrm
.
setExtX
(
props
.
Width
);
objects_by_type
.
images
[
i
].
spPr
.
xfrm
.
setExtY
(
props
.
Height
);
if
(
objects_by_type
.
images
[
i
].
group
)
for
(
i
=
0
;
i
<
objects_by_type
.
images
.
length
;
++
i
)
{
checkObjectInArray
(
aGroups
,
objects_by_type
.
images
[
i
].
group
.
getMainGroup
());
CheckSpPrXfrm
(
objects_by_type
.
images
[
i
]);
objects_by_type
.
images
[
i
].
spPr
.
xfrm
.
setExtX
(
props
.
Width
);
objects_by_type
.
images
[
i
].
spPr
.
xfrm
.
setExtY
(
props
.
Height
);
if
(
objects_by_type
.
images
[
i
].
group
)
{
checkObjectInArray
(
aGroups
,
objects_by_type
.
images
[
i
].
group
.
getMainGroup
());
}
objects_by_type
.
images
[
i
].
checkDrawingBaseCoords
();
}
objects_by_type
.
images
[
i
].
checkDrawingBaseCoords
();
}
for
(
i
=
0
;
i
<
objects_by_type
.
charts
.
length
;
++
i
)
{
CheckSpPrXfrm
(
objects_by_type
.
charts
[
i
]);
objects_by_type
.
charts
[
i
].
spPr
.
xfrm
.
setExtX
(
props
.
Width
);
objects_by_type
.
charts
[
i
].
spPr
.
xfrm
.
setExtY
(
props
.
Height
);
if
(
objects_by_type
.
charts
[
i
].
group
)
for
(
i
=
0
;
i
<
objects_by_type
.
charts
.
length
;
++
i
)
{
checkObjectInArray
(
aGroups
,
objects_by_type
.
charts
[
i
].
group
.
getMainGroup
());
CheckSpPrXfrm
(
objects_by_type
.
charts
[
i
]);
objects_by_type
.
charts
[
i
].
spPr
.
xfrm
.
setExtX
(
props
.
Width
);
objects_by_type
.
charts
[
i
].
spPr
.
xfrm
.
setExtY
(
props
.
Height
);
if
(
objects_by_type
.
charts
[
i
].
group
)
{
checkObjectInArray
(
aGroups
,
objects_by_type
.
charts
[
i
].
group
.
getMainGroup
());
}
objects_by_type
.
charts
[
i
].
checkDrawingBaseCoords
();
}
objects_by_type
.
charts
[
i
].
checkDrawingBaseCoords
();
}
}
...
...
word/Editor/ParagraphContent.js
View file @
0808e3c9
...
...
@@ -4303,21 +4303,21 @@ ParaDrawing.prototype =
if
(
this
.
SizeRelH
)
if
(
this
.
SizeRelH
&&
this
.
SizeRelH
.
Percent
>
0
)
{
Props
.
SizeRelH
=
{
RelativeFrom
:
this
.
SizeRelH
.
RelativeFrom
,
Percent
:
this
.
SizeRelH
.
Percent
RelativeFrom
:
ConvertRelSizeHToRelPosition
(
this
.
SizeRelH
.
RelativeFrom
)
,
Value
:
(
this
.
SizeRelH
.
Percent
*
100
)
>>
0
};
}
if
(
this
.
SizeRelV
)
if
(
this
.
SizeRelV
&&
this
.
SizeRelV
.
Percent
>
0
)
{
Props
.
SizeRelV
=
{
RelativeFrom
:
this
.
SizeRelV
.
RelativeFrom
,
Percent
:
this
.
SizeRelV
.
Percent
RelativeFrom
:
ConvertRelSizeVToRelPosition
(
this
.
SizeRelV
.
RelativeFrom
)
,
Value
:
(
this
.
SizeRelV
.
Percent
*
100
)
>>
0
};
}
...
...
@@ -4479,34 +4479,28 @@ ParaDrawing.prototype =
}
},
Set_Props
:
function
(
Props
)
{
Set_Props
:
function
(
Props
)
{
var
bCheckWrapPolygon
=
false
;
if
(
undefined
!=
Props
.
WrappingStyle
)
{
if
(
drawing_Inline
===
this
.
DrawingType
&&
c_oAscWrapStyle2
.
Inline
!=
Props
.
WrappingStyle
&&
undefined
===
Props
.
Paddings
)
{
this
.
Set_Distance
(
3.2
,
0
,
3.2
,
0
);
if
(
undefined
!=
Props
.
WrappingStyle
)
{
if
(
drawing_Inline
===
this
.
DrawingType
&&
c_oAscWrapStyle2
.
Inline
!=
Props
.
WrappingStyle
&&
undefined
===
Props
.
Paddings
)
{
this
.
Set_Distance
(
3.2
,
0
,
3.2
,
0
);
}
this
.
Set_DrawingType
(
c_oAscWrapStyle2
.
Inline
===
Props
.
WrappingStyle
?
drawing_Inline
:
drawing_Anchor
);
if
(
c_oAscWrapStyle2
.
Inline
===
Props
.
WrappingStyle
)
{
if
(
isRealObject
(
this
.
GraphicObj
.
bounds
)
&&
isRealNumber
(
this
.
GraphicObj
.
bounds
.
w
)
&&
isRealNumber
(
this
.
GraphicObj
.
bounds
.
h
))
{
this
.
Set_DrawingType
(
c_oAscWrapStyle2
.
Inline
===
Props
.
WrappingStyle
?
drawing_Inline
:
drawing_Anchor
);
if
(
c_oAscWrapStyle2
.
Inline
===
Props
.
WrappingStyle
)
{
if
(
isRealObject
(
this
.
GraphicObj
.
bounds
)
&&
isRealNumber
(
this
.
GraphicObj
.
bounds
.
w
)
&&
isRealNumber
(
this
.
GraphicObj
.
bounds
.
h
))
{
this
.
setExtent
(
this
.
GraphicObj
.
bounds
.
w
,
this
.
GraphicObj
.
bounds
.
h
);
}
}
if
(
c_oAscWrapStyle2
.
Behind
===
Props
.
WrappingStyle
||
c_oAscWrapStyle2
.
InFront
===
Props
.
WrappingStyle
)
{
this
.
Set_WrappingType
(
WRAPPING_TYPE_NONE
);
this
.
Set_BehindDoc
(
c_oAscWrapStyle2
.
Behind
===
Props
.
WrappingStyle
?
true
:
false
);
if
(
c_oAscWrapStyle2
.
Behind
===
Props
.
WrappingStyle
||
c_oAscWrapStyle2
.
InFront
===
Props
.
WrappingStyle
)
{
this
.
Set_WrappingType
(
WRAPPING_TYPE_NONE
);
this
.
Set_BehindDoc
(
c_oAscWrapStyle2
.
Behind
===
Props
.
WrappingStyle
?
true
:
false
);
}
else
{
switch
(
Props
.
WrappingStyle
)
{
case
c_oAscWrapStyle2
.
Square
:
this
.
Set_WrappingType
(
WRAPPING_TYPE_SQUARE
);
break
;
else
{
switch
(
Props
.
WrappingStyle
)
{
case
c_oAscWrapStyle2
.
Square
:
this
.
Set_WrappingType
(
WRAPPING_TYPE_SQUARE
);
break
;
case
c_oAscWrapStyle2
.
Tight
:
{
bCheckWrapPolygon
=
true
;
...
...
@@ -4519,54 +4513,67 @@ ParaDrawing.prototype =
bCheckWrapPolygon
=
true
;
break
;
}
case
c_oAscWrapStyle2
.
TopAndBottom
:
this
.
Set_WrappingType
(
WRAPPING_TYPE_TOP_AND_BOTTOM
);
break
;
default
:
this
.
Set_WrappingType
(
WRAPPING_TYPE_SQUARE
);
break
;
case
c_oAscWrapStyle2
.
TopAndBottom
:
this
.
Set_WrappingType
(
WRAPPING_TYPE_TOP_AND_BOTTOM
);
break
;
default
:
this
.
Set_WrappingType
(
WRAPPING_TYPE_SQUARE
);
break
;
}
this
.
Set_BehindDoc
(
false
);
this
.
Set_BehindDoc
(
false
);
}
}
if
(
undefined
!=
Props
.
Paddings
)
this
.
Set_Distance
(
Props
.
Paddings
.
Left
,
Props
.
Paddings
.
Top
,
Props
.
Paddings
.
Right
,
Props
.
Paddings
.
Bottom
);
if
(
undefined
!=
Props
.
Paddings
)
this
.
Set_Distance
(
Props
.
Paddings
.
Left
,
Props
.
Paddings
.
Top
,
Props
.
Paddings
.
Right
,
Props
.
Paddings
.
Bottom
);
if
(
undefined
!=
Props
.
AllowOverlap
)
this
.
Set_AllowOverlap
(
Props
.
AllowOverlap
);
if
(
undefined
!=
Props
.
AllowOverlap
)
this
.
Set_AllowOverlap
(
Props
.
AllowOverlap
);
var
bNeedUpdateWH
=
false
,
newW
=
this
.
Extent
.
W
,
newH
=
this
.
Extent
.
H
;
if
(
undefined
!=
Props
.
PositionH
)
{
this
.
Set_PositionH
(
Props
.
PositionH
.
RelativeFrom
,
Props
.
PositionH
.
UseAlign
,
(
true
===
Props
.
PositionH
.
UseAlign
?
Props
.
PositionH
.
Align
:
Props
.
PositionH
.
Value
),
Props
.
PositionH
.
Percent
);
if
(
Props
.
PositionH
.
UseAlign
)
{
if
(
undefined
!=
Props
.
PositionH
)
{
this
.
Set_PositionH
(
Props
.
PositionH
.
RelativeFrom
,
Props
.
PositionH
.
UseAlign
,
(
true
===
Props
.
PositionH
.
UseAlign
?
Props
.
PositionH
.
Align
:
Props
.
PositionH
.
Value
),
Props
.
PositionH
.
Percent
);
if
(
Props
.
PositionH
.
UseAlign
)
{
bNeedUpdateWH
=
true
;
if
(
isRealObject
(
this
.
GraphicObj
.
bounds
)
&&
isRealNumber
(
this
.
GraphicObj
.
bounds
.
w
))
{
if
(
isRealObject
(
this
.
GraphicObj
.
bounds
)
&&
isRealNumber
(
this
.
GraphicObj
.
bounds
.
w
))
{
newW
=
this
.
GraphicObj
.
bounds
.
w
;
}
}
}
if
(
undefined
!=
Props
.
PositionV
)
{
this
.
Set_PositionV
(
Props
.
PositionV
.
RelativeFrom
,
Props
.
PositionV
.
UseAlign
,
(
true
===
Props
.
PositionV
.
UseAlign
?
Props
.
PositionV
.
Align
:
Props
.
PositionV
.
Value
),
Props
.
PositionV
.
Percent
);
if
(
this
.
PositionV
.
UseAlign
)
{
if
(
undefined
!=
Props
.
PositionV
)
{
this
.
Set_PositionV
(
Props
.
PositionV
.
RelativeFrom
,
Props
.
PositionV
.
UseAlign
,
(
true
===
Props
.
PositionV
.
UseAlign
?
Props
.
PositionV
.
Align
:
Props
.
PositionV
.
Value
),
Props
.
PositionV
.
Percent
);
if
(
this
.
PositionV
.
UseAlign
)
{
bNeedUpdateWH
=
true
;
if
(
isRealObject
(
this
.
GraphicObj
.
bounds
)
&&
isRealNumber
(
this
.
GraphicObj
.
bounds
.
h
))
{
if
(
isRealObject
(
this
.
GraphicObj
.
bounds
)
&&
isRealNumber
(
this
.
GraphicObj
.
bounds
.
h
))
{
newH
=
this
.
GraphicObj
.
bounds
.
h
;
}
}
}
if
(
undefined
!=
Props
.
SizeRelH
)
if
(
undefined
!=
Props
.
SizeRelH
)
{
this
.
SetSizeRelH
({
RelativeFrom
:
ConvertRelPositionHToRelSize
(
Props
.
SizeRelH
.
RelativeFrom
),
Percent
:
Props
.
SizeRelH
.
Value
/
100.0
});
}
if
(
undefined
!=
Props
.
SizeRelV
)
{
this
.
SetSizeRelV
({
RelativeFrom
:
ConvertRelPositionVToRelSize
(
Props
.
SizeRelV
.
RelativeFrom
),
Percent
:
Props
.
SizeRelV
.
Value
/
100.0
});
}
if
(
this
.
SizeRelH
&&
!
this
.
SizeRelV
)
{
this
.
SetSizeRel
H
({
RelativeFrom
:
Props
.
SizeRelH
.
RelativeFrom
,
Percent
:
Props
.
SizeRelH
.
Percent
});
this
.
SetSizeRel
V
({
RelativeFrom
:
c_oAscSizeRelFromV
.
sizerelfromvPage
,
Percent
:
0
});
}
if
(
undefined
!=
Props
.
SizeRelV
)
if
(
this
.
SizeRelV
&&
!
this
.
SizeRelH
)
{
this
.
SetSizeRel
V
({
RelativeFrom
:
Props
.
SizeRelV
.
RelativeFrom
,
Percent
:
Props
.
SizeRelV
.
Percent
});
this
.
SetSizeRel
H
({
RelativeFrom
:
c_oAscSizeRelFromH
.
sizerelfromhPage
,
Percent
:
0
})
}
if
(
bNeedUpdateWH
)
{
this
.
setExtent
(
newW
,
newH
);
...
...
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