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
30622193
Commit
30622193
authored
Aug 15, 2016
by
Sergey Luzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inserting drawings in cell-builder
parent
781cb930
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
805 additions
and
1400 deletions
+805
-1400
build/configs/webexcel.json
build/configs/webexcel.json
+2
-0
build/configs/webpowerpoint.json
build/configs/webpowerpoint.json
+1
-0
cell/apiBuilder.js
cell/apiBuilder.js
+292
-205
common/Drawings/Format/ChartSpace.js
common/Drawings/Format/ChartSpace.js
+75
-0
common/Drawings/Format/Constants.js
common/Drawings/Format/Constants.js
+3
-0
common/Drawings/Format/GraphicObjectBase.js
common/Drawings/Format/GraphicObjectBase.js
+25
-0
common/Drawings/Format/GroupShape.js
common/Drawings/Format/GroupShape.js
+78
-0
common/Drawings/Format/Image.js
common/Drawings/Format/Image.js
+82
-1
common/Drawings/Format/Shape.js
common/Drawings/Format/Shape.js
+78
-0
slide/apiBuilder.js
slide/apiBuilder.js
+63
-1147
word/apiBuilder.js
word/apiBuilder.js
+106
-47
No files found.
build/configs/webexcel.json
View file @
30622193
...
...
@@ -174,6 +174,8 @@
"../word/Math/borderBox.js"
,
"../word/apiCommon.js"
,
"../word/apiBuilder.js"
,
"../slide/apiBuilder.js"
,
"../cell/apiBuilder.js"
,
"../common/clipboard_base.js"
,
...
...
build/configs/webpowerpoint.json
View file @
30622193
...
...
@@ -163,6 +163,7 @@
"../slide/apiCommon.js"
,
"../word/apiCommon.js"
,
"../word/apiBuilder.js"
,
"../slide/apiBuilder.js"
,
"../common/clipboard_base.js"
,
"../common/text_input.js"
,
...
...
cell/apiBuilder.js
View file @
30622193
...
...
@@ -62,26 +62,36 @@
* Class representing a graphical object.
* @constructor
*/
function
ApiDrawing
(
Drawing
)
{
function
ApiDrawing
(
Drawing
)
{
this
.
Drawing
=
Drawing
;
}
/**
*
This type specifies the types, create charts
* @
typedef {("bar" | "barStacked" | "barStackedPercent" | "bar3D" | "barStacked3D" | "barStackedPercent3D" | "barStackedPercent3DPerspective" | "horizontalBar" | "horizontalBarStacked" | "horizontalBarStackedPercent" | "horizontalBar3D" | "horizontalBarStacked3D" | "horizontalBarStackedPercent3D" | "lineNormal" | "lineStacked" | "lineStackedPercent" | "line3D" | "pie" | "pie3D" | "doughnut" | "scatter" | "stock" | "area" | "areaStacked" | "areaStackedPercent")} ChartType
*
Class representing a shape.
* @
constructor
*/
function
ApiShape
(
oShape
){
ApiShape
.
superclass
.
constructor
.
call
(
this
,
oShape
);
}
AscCommon
.
extendClass
(
ApiShape
,
ApiDrawing
);
/**
* Class representing a
Chart
.
* Class representing a
image
.
* @constructor
*
*/
function
ApiChart
(
Chart
)
{
ApiChart
.
superclass
.
constructor
.
call
(
this
,
Chart
.
parent
);
this
.
Chart
=
Chart
;
function
ApiImage
(
oImage
){
ApiImage
.
superclass
.
constructor
.
call
(
this
,
oImage
);
}
AscCommon
.
extendClass
(
ApiImage
,
ApiDrawing
);
/**
* Class representing a chart.
* @constructor
*/
function
ApiChart
(
oChart
){
ApiChart
.
superclass
.
constructor
.
call
(
this
,
oChart
);
}
AscCommon
.
extendClass
(
ApiChart
,
ApiDrawing
);
/**
...
...
@@ -94,6 +104,10 @@
return
new
ApiWorksheet
(
this
.
wbModel
.
getWorksheet
(
index
),
this
.
wb
.
getWorksheet
(
index
,
true
));
};
Api
.
prototype
.
CreateNewHistoryPoint
=
function
(){
History
.
Create_NewPoint
();
};
/**
* Returns an object that represents the active cell
* @memberof ApiWorksheet
...
...
@@ -160,16 +174,16 @@
* @param {bool} bInRows
* @param {ChartType} sType
* @param {number} nStyleIndex
* @param {EMU} nExtX
* @param {EMU} nExtY
* @param {number} nFromCol
* @param {EMU} nColOffset
* @param {number} nFromRow
* @param {number} nToCol
* @param {number} nToRow
* @returns {ApiCahrt}
* @param {EMU} nRowOffset
* @returns {ApiChart}
*/
ApiWorksheet
.
prototype
.
AddChart
=
function
(
sDataRange
,
bInRows
,
sType
,
nStyleIndex
,
nFromCol
,
nFromRow
,
nToCol
,
nToRow
)
{
History
.
Create_NewPoint
();
function
(
sDataRange
,
bInRows
,
sType
,
nStyleIndex
,
nExtX
,
nExtY
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
)
{
var
settings
=
new
AscCommon
.
asc_ChartSettings
();
switch
(
sType
)
{
case
"
bar
"
:
...
...
@@ -302,17 +316,53 @@
settings
.
inColumns
=
!
bInRows
;
settings
.
range
=
sDataRange
;
var
oChart
=
AscFormat
.
DrawingObjectsController
.
prototype
.
getChartSpace
(
this
.
worksheet
,
settings
);
oChart
.
setBDeleted
(
false
);
oChart
.
setWorksheet
(
this
.
worksheet
);
oChart
.
setBFromSerialize
(
true
);
oChart
.
addToDrawingObjects
();
oChart
.
setDrawingBaseCoords
(
nFromCol
,
0
,
nFromRow
,
0
,
nToCol
,
0
,
nToRow
,
0
,
0
,
0
,
0
,
0
);
private_SetCoords
(
oChart
,
this
.
worksheet
,
nExtX
,
nExtY
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
);
if
(
AscFormat
.
isRealNumber
(
nStyleIndex
))
{
oChart
.
setStyle
(
nStyleIndex
);
}
return
new
ApiChart
(
oChart
);
};
/**
* Create a shape.
* @memberof Api
* @param {ShapeType} [sType="rect"]
* @param {EMU} nWidth
* @param {EMU} nHeight
* @param {ApiFill} oFill
* @param {ApiStroke} oStroke
* @param {number} nFromCol
* @param {EMU} nColOffset
* @param {number} nFromRow
* @param {EMU} nRowOffset
* @returns {ApiShape}
* */
ApiWorksheet
.
prototype
.
AddShape
=
function
(
sType
,
nWidth
,
nHeight
,
oFill
,
oStroke
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
){
var
oShape
=
AscFormat
.
builder_CreateShape
(
sType
,
nWidth
/
36000
,
nHeight
/
36000
,
oFill
.
UniFill
,
oStroke
.
Ln
,
null
,
this
.
worksheet
.
theme
,
this
.
worksheet
.
DrawingDocument
,
false
);
private_SetCoords
(
oShape
,
this
.
worksheet
,
nWidth
,
nHeight
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
);
return
new
ApiShape
(
oShape
);
};
/**
* Create a image.
* @memberof Api
* @param {string} sImageSrc
* @param {EMU} nWidth
* @param {EMU} nHeight
* @param {number} nFromCol
* @param {EMU} nColOffset
* @param {number} nFromRow
* @param {EMU} nRowOffset
* @returns {ApiImage}
*/
ApiWorksheet
.
prototype
.
AddImage
=
function
(
sImageSrc
,
nWidth
,
nHeight
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
){
var
oImage
=
AscFormat
.
DrawingObjectsController
.
prototype
.
createImage
(
sImageSrc
,
0
,
0
,
nWidth
/
36000
,
nHeight
/
36000
);
private_SetCoords
(
oImage
,
this
.
worksheet
,
nWidth
,
nHeight
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
);
return
new
ApiImage
(
AscFormat
.
DrawingObjectsController
.
prototype
.
createImage
(
sImageSrc
,
0
,
0
,
nWidth
/
36000
,
nHeight
/
36000
));
};
/**
* Get cell row
* @memberof ApiRange
...
...
@@ -384,150 +434,177 @@
ApiChart
.
prototype
.
CreateTitle
=
function
(
sTitle
,
nFontSize
){
if
(
!
this
.
Chart
)
//------------------------------------------------------------------------------------------------------------------
//
// ApiDrawing
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"drawing"}
*/
ApiDrawing
.
prototype
.
GetClassType
=
function
()
{
return
null
;
}
if
(
typeof
sTitle
===
"
string
"
&&
sTitle
.
length
>
0
){
var
oTitle
=
new
AscFormat
.
CTitle
();
oTitle
.
setTx
(
new
AscFormat
.
CChartText
());
oTitle
.
setOverlay
(
false
);
var
oTextBody
=
AscFormat
.
CreateTextBodyFromString
(
sTitle
,
this
.
Chart
.
getDrawingDocument
(),
oTitle
.
tx
);
if
(
AscFormat
.
isRealNumber
(
nFontSize
)){
oTextBody
.
content
.
Set_ApplyToAll
(
true
);
oTextBody
.
content
.
Paragraph_Add
(
new
ParaTextPr
({
FontSize
:
nFontSize
}));
oTextBody
.
content
.
Set_ApplyToAll
(
false
);
}
oTitle
.
tx
.
setRich
(
oTextBody
);
return
oTitle
;
}
return
null
;
return
"
drawing
"
;
};
/**
* Specifies a chart title
* @param {string} sTitle
* @param {number} nFontSize
* Set the size of the bounding box.
* @param {EMU} nWidth
* @param {EMU} nHeight
*/
ApiChart
.
prototype
.
SetTitle
=
function
(
sTitle
,
nFontSize
)
ApiDrawing
.
prototype
.
SetSize
=
function
(
nWidth
,
nHeight
)
{
if
(
this
.
Chart
)
var
fWidth
=
nWidth
/
36000.0
;
var
fHeight
=
nHeight
/
36000.0
;
if
(
this
.
Drawing
&&
this
.
Drawing
.
spPr
&&
this
.
Drawing
.
spPr
.
xfrm
)
{
this
.
Chart
.
chart
.
setTitle
(
this
.
CreateTitle
(
sTitle
,
nFontSize
));
this
.
Drawing
.
spPr
.
xfrm
.
setExtX
(
fWidth
);
this
.
Drawing
.
spPr
.
xfrm
.
setExtY
(
fHeight
);
this
.
Drawing
.
setDrawingBaseExt
(
fWidth
,
fHeight
);
}
};
/**
* Specifies a horizontal axis title
* @param {string} sTitle
* @param {number} nFontSize
* Set drawing's position
* @param {number} nFromCol
* @param {EMU} nColOffset
* @param {number} nFromRow
* @param {EMU} nRowOffset
* */
ApiChart
.
prototype
.
SetHorAxisTitle
=
function
(
sTitle
,
nFontSize
)
{
if
(
this
.
Chart
)
{
var
horAxis
=
this
.
Chart
.
chart
.
plotArea
.
getHorizontalAxis
();
if
(
horAxis
)
{
horAxis
.
setTitle
(
this
.
CreateTitle
(
sTitle
,
nFontSize
));
}
}
ApiDrawing
.
prototype
.
SetPosition
=
function
(
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
){
this
.
Drawing
.
setDrawingBaseType
(
AscCommon
.
c_oAscCellAnchorType
.
cellanchorOneCell
);
this
.
Drawing
.
setDrawingBaseCoords
(
nFromCol
,
nColOffset
/
36000.0
,
nFromRow
,
nRowOffset
/
36000.0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiImage
//
//------------------------------------------------------------------------------------------------------------------
/**
* Specifies a vertical axis title
* @param {string} sTitle
* @param {number} nFontSize
* */
ApiChart
.
prototype
.
SetVerAxisTitle
=
function
(
sTitle
,
nFontSize
)
{
if
(
this
.
Chart
)
{
var
verAxis
=
this
.
Chart
.
chart
.
plotArea
.
getVerticalAxis
();
if
(
verAxis
)
{
if
(
typeof
sTitle
===
"
string
"
&&
sTitle
.
length
>
0
)
{
verAxis
.
setTitle
(
this
.
CreateTitle
(
sTitle
,
nFontSize
));
if
(
verAxis
.
title
){
var
_body_pr
=
new
AscFormat
.
CBodyPr
();
_body_pr
.
reset
();
if
(
!
verAxis
.
title
.
txPr
)
{
verAxis
.
title
.
setTxPr
(
AscFormat
.
CreateTextBodyFromString
(
""
,
this
.
Chart
.
getDrawingDocument
(),
verAxis
.
title
));
}
var
_text_body
=
verAxis
.
title
.
txPr
;
_text_body
.
setBodyPr
(
_body_pr
);
verAxis
.
title
.
setOverlay
(
false
);
}
}
else
* Get the type of this class.
* @returns {"image"}
*/
ApiImage
.
prototype
.
GetClassType
=
function
()
{
verAxis
.
setTitle
(
null
);
}
}
}
return
"
image
"
;
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiShape
//
//------------------------------------------------------------------------------------------------------------------
/**
* Specifies a legend position
* @param {"left" | "top" | "right" | "bottom" | "none"} sLegendPos
* */
ApiChart
.
prototype
.
SetLegendPos
=
function
(
sLegendPos
)
{
if
(
this
.
Chart
&&
this
.
Chart
.
chart
)
* Get the type of this class.
* @returns {"shape"}
*/
ApiShape
.
prototype
.
GetClassType
=
function
()
{
if
(
sLegendPos
===
"
none
"
)
return
"
shape
"
;
};
/**
* Get content of this shape.
* @returns {?ApiDocumentContent}
*/
ApiShape
.
prototype
.
GetDocContent
=
function
()
{
if
(
this
.
Chart
.
chart
.
legend
)
var
oApi
=
Asc
.
editor
;
if
(
oApi
&&
this
.
Drawing
&&
this
.
Drawing
.
txBody
&&
this
.
Drawing
.
txBody
.
content
)
{
this
.
Chart
.
chart
.
setLegend
(
null
);
return
oApi
.
private_CreateApiDocContent
(
this
.
Drawing
.
txBody
.
content
);
}
}
else
return
null
;
};
/**
* Set shape's content vertical align
* @param {VerticalTextAlign} VerticalAlign
*/
ApiShape
.
prototype
.
SetVerticalTextAlign
=
function
(
VerticalAlign
)
{
var
nLegendPos
=
null
;
switch
(
sLegendPos
)
if
(
this
.
Shape
)
{
case
"
left
"
:
switch
(
VerticalAlign
)
{
nLegendPos
=
Asc
.
c_oAscChartLegendShowSettings
.
left
;
break
;
}
case
"
top
"
:
{
nLegendPos
=
Asc
.
c_oAscChartLegendShowSettings
.
top
;
this
.
Shape
.
setVerticalAlign
(
4
)
;
break
;
}
case
"
right
"
:
case
"
center
"
:
{
nLegendPos
=
Asc
.
c_oAscChartLegendShowSettings
.
right
;
this
.
Shape
.
setVerticalAlign
(
1
)
;
break
;
}
case
"
bottom
"
:
{
nLegendPos
=
Asc
.
c_oAscChartLegendShowSettings
.
bottom
;
this
.
Shape
.
setVerticalAlign
(
0
)
;
break
;
}
}
if
(
null
!==
nLegendPos
)
}
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiChart
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"chart"}
*/
ApiChart
.
prototype
.
GetClassType
=
function
()
{
if
(
!
this
.
Chart
.
chart
.
legend
)
return
"
chart
"
;
};
/**
* Specifies a chart title
* @param {string} sTitle
* @param {hps} nFontSize
*/
ApiChart
.
prototype
.
SetTitle
=
function
(
sTitle
,
nFontSize
)
{
this
.
Chart
.
chart
.
setLegend
(
new
AscFormat
.
CLegend
());
}
if
(
this
.
Chart
.
chart
.
legend
.
legendPos
!==
nLegendPos
)
this
.
Chart
.
chart
.
legend
.
setLegendPos
(
nLegendPos
);
if
(
this
.
Chart
.
chart
.
legend
.
overlay
!==
false
)
AscFormat
.
builder_SetChartTitle
(
this
.
Chart
,
sTitle
,
nFontSize
);
};
/**
* Specifies a horizontal axis title
* @param {string} sTitle
* @param {hps} nFontSize
* */
ApiChart
.
prototype
.
SetHorAxisTitle
=
function
(
sTitle
,
nFontSize
)
{
this
.
Chart
.
chart
.
legend
.
setOverlay
(
false
);
}
}
}
}
AscFormat
.
builder_SetChartHorAxisTitle
(
this
.
Chart
,
sTitle
,
nFontSize
);
};
/**
* Specifies a vertical axis title
* @param {string} sTitle
* @param {hps} nFontSize
* */
ApiChart
.
prototype
.
SetVerAxisTitle
=
function
(
sTitle
,
nFontSize
)
{
AscFormat
.
builder_SetChartVertAxisTitle
(
this
.
Chart
,
sTitle
,
nFontSize
);
};
/**
* Specifies a legend position
* @param {"left" | "top" | "right" | "bottom" | "none"} sLegendPos
* */
ApiChart
.
prototype
.
SetLegendPos
=
function
(
sLegendPos
)
{
AscFormat
.
builder_SetChartLegendPos
(
this
.
Chart
,
sLegendPos
);
};
/**
...
...
@@ -538,32 +615,10 @@
* */
ApiChart
.
prototype
.
SetShowDataLabels
=
function
(
bShowSerName
,
bShowCatName
,
bShowVal
)
{
if
(
this
.
Chart
&&
this
.
Chart
.
chart
&&
this
.
Chart
.
chart
.
plotArea
&&
this
.
Chart
.
chart
.
plotArea
.
charts
[
0
])
{
var
oChart
=
this
.
Chart
.
chart
.
plotArea
.
charts
[
0
];
if
(
false
==
bShowSerName
&&
false
==
bShowCatName
&&
false
==
bShowVal
)
{
if
(
oChart
.
dLbls
)
{
oChart
.
setDLbls
(
null
);
}
}
if
(
!
oChart
.
dLbls
)
{
oChart
.
setDLbls
(
new
AscFormat
.
CDLbls
());
}
oChart
.
dLbls
.
setSeparator
(
"
,
"
);
oChart
.
dLbls
.
setShowSerName
(
true
==
bShowSerName
);
oChart
.
dLbls
.
setShowCatName
(
true
==
bShowCatName
);
oChart
.
dLbls
.
setShowVal
(
true
==
bShowVal
);
oChart
.
dLbls
.
setShowLegendKey
(
false
);
//oChart.dLbls.setShowPercent(false);
oChart
.
dLbls
.
setShowBubbleSize
(
false
);
}
AscFormat
.
builder_SetShowDataLabels
(
this
.
Chart
,
bShowSerName
,
bShowCatName
,
bShowVal
);
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Export
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Api
.
prototype
[
"
GetActiveSheet
"
]
=
Api
.
prototype
.
GetActiveSheet
;
ApiWorksheet
.
prototype
[
"
GetActiveCell
"
]
=
ApiWorksheet
.
prototype
.
GetActiveCell
;
...
...
@@ -573,6 +628,8 @@
ApiWorksheet
.
prototype
[
"
FormatAsTable
"
]
=
ApiWorksheet
.
prototype
.
FormatAsTable
;
ApiWorksheet
.
prototype
[
"
SetColumnWidth
"
]
=
ApiWorksheet
.
prototype
.
SetColumnWidth
;
ApiWorksheet
.
prototype
[
"
AddChart
"
]
=
ApiWorksheet
.
prototype
.
AddChart
;
ApiWorksheet
.
prototype
[
"
AddShape
"
]
=
ApiWorksheet
.
prototype
.
AddShape
;
ApiWorksheet
.
prototype
[
"
AddImage
"
]
=
ApiWorksheet
.
prototype
.
AddImage
;
ApiRange
.
prototype
[
"
GetRow
"
]
=
ApiRange
.
prototype
.
GetRow
;
ApiRange
.
prototype
[
"
GetCol
"
]
=
ApiRange
.
prototype
.
GetCol
;
...
...
@@ -583,9 +640,39 @@
ApiRange
.
prototype
[
"
SetAlignVertical
"
]
=
ApiRange
.
prototype
.
SetAlignVertical
;
ApiRange
.
prototype
[
"
SetAlignHorizontal
"
]
=
ApiRange
.
prototype
.
SetAlignHorizontal
;
ApiDrawing
.
prototype
[
"
GetClassType
"
]
=
ApiDrawing
.
prototype
.
GetClassType
;
ApiDrawing
.
prototype
[
"
SetSize
"
]
=
ApiDrawing
.
prototype
.
SetSize
;
ApiDrawing
.
prototype
[
"
SetPosition
"
]
=
ApiDrawing
.
prototype
.
SetPosition
;
ApiImage
.
prototype
[
"
GetClassType
"
]
=
ApiImage
.
prototype
.
GetClassType
;
ApiShape
.
prototype
[
"
GetClassType
"
]
=
ApiShape
.
prototype
.
GetClassType
;
ApiShape
.
prototype
[
"
GetDocContent
"
]
=
ApiShape
.
prototype
.
GetDocContent
;
ApiShape
.
prototype
[
"
SetVerticalTextAlign
"
]
=
ApiShape
.
prototype
.
SetVerticalTextAlign
;
ApiChart
.
prototype
[
"
GetClassType
"
]
=
ApiChart
.
prototype
.
GetClassType
;
ApiChart
.
prototype
[
"
SetTitle
"
]
=
ApiChart
.
prototype
.
SetTitle
;
ApiChart
.
prototype
[
"
SetHorAxisTitle
"
]
=
ApiChart
.
prototype
.
SetHorAxisTitle
;
ApiChart
.
prototype
[
"
SetVerAxisTitle
"
]
=
ApiChart
.
prototype
.
SetVerAxisTitle
;
ApiChart
.
prototype
[
"
SetLegendPos
"
]
=
ApiChart
.
prototype
.
SetLegendPos
;
ApiChart
.
prototype
[
"
SetShowDataLabels
"
]
=
ApiChart
.
prototype
.
SetShowDataLabels
;
function
private_SetCoords
(
oDrawing
,
oWorksheet
,
nExtX
,
nExtY
,
nFromCol
,
nColOffset
,
nFromRow
,
nRowOffset
){
oDrawing
.
x
=
0
;
oDrawing
.
y
=
0
;
oDrawing
.
extX
=
0
;
oDrawing
.
extY
=
0
;
AscFormat
.
CheckSpPrXfrm
(
oDrawing
);
oDrawing
.
spPr
.
xfrm
.
setExtX
(
nExtX
/
36000.0
);
oDrawing
.
spPr
.
xfrm
.
setExtY
(
nExtY
/
36000.0
);
oDrawing
.
setBDeleted
(
false
);
oDrawing
.
setWorksheet
(
oWorksheet
);
oDrawing
.
setBFromSerialize
(
true
);
oDrawing
.
addToDrawingObjects
();
oDrawing
.
setDrawingBaseType
(
AscCommon
.
c_oAscCellAnchorType
.
cellanchorOneCell
);
oDrawing
.
setDrawingBaseCoords
(
nFromCol
,
nColOffset
/
36000.0
,
nFromRow
,
nRowOffset
/
36000.0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
oDrawing
.
setDrawingBaseExt
(
nExtX
/
36000.0
,
nExtY
/
36000.0
);
}
}(
window
,
null
));
common/Drawings/Format/ChartSpace.js
View file @
30622193
...
...
@@ -9690,6 +9690,26 @@ CChartSpace.prototype.Undo = function(data)
{
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
data
.
OldPr
.
X
;
this
.
drawingBase
.
Pos
.
Y
=
data
.
OldPr
.
Y
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
data
.
OldPr
.
cx
;
this
.
drawingBase
.
ext
.
cy
=
data
.
OldPr
.
cy
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
if
(
this
.
drawingBase
){
this
.
drawingBase
.
Type
=
data
.
OldPr
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
data
.
oldPr
;
...
...
@@ -9826,6 +9846,26 @@ CChartSpace.prototype.Redo = function(data)
{
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
data
.
NewPr
.
X
;
this
.
drawingBase
.
Pos
.
Y
=
data
.
NewPr
.
Y
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
data
.
NewPr
.
cx
;
this
.
drawingBase
.
ext
.
cy
=
data
.
NewPr
.
cy
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
if
(
this
.
drawingBase
){
this
.
drawingBase
.
Type
=
data
.
NewPr
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
data
.
newPr
;
...
...
@@ -9964,6 +10004,21 @@ CChartSpace.prototype.Save_Changes = function(data, w)
w
.
WriteLong
(
data
.
Type
);
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
w
.
WriteDouble
(
data
.
NewPr
.
X
);
w
.
WriteDouble
(
data
.
NewPr
.
Y
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
w
.
WriteDouble
(
data
.
NewPr
.
cx
);
w
.
WriteDouble
(
data
.
NewPr
.
cy
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
w
.
WriteLong
(
data
.
NewPr
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
w
.
WriteLong
(
data
.
newPr
);
...
...
@@ -10108,6 +10163,26 @@ CChartSpace.prototype.Load_Changes = function(r)
var
type
=
r
.
GetLong
();
switch
(
type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
r
.
GetDouble
();
this
.
drawingBase
.
Pos
.
Y
=
r
.
GetDouble
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
r
.
GetDouble
();
this
.
drawingBase
.
ext
.
cy
=
r
.
GetDouble
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
if
(
this
.
drawingBase
){
this
.
drawingBase
.
Type
=
r
.
GetLong
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
r
.
GetLong
();
...
...
common/Drawings/Format/Constants.js
View file @
30622193
...
...
@@ -1010,6 +1010,9 @@
window
[
'
AscDFH
'
].
historyitem_AutoShapes_RemoveFromDrawingObjects
=
1004
;
window
[
'
AscDFH
'
].
historyitem_AutoShapes_SetBFromSerialize
=
1009
;
window
[
'
AscDFH
'
].
historyitem_AutoShapes_SetLocks
=
1010
;
window
[
'
AscDFH
'
].
historyitem_AutoShapes_SetDrawingBaseType
=
1011
;
window
[
'
AscDFH
'
].
historyitem_AutoShapes_SetDrawingBaseExt
=
1012
;
window
[
'
AscDFH
'
].
historyitem_AutoShapes_SetDrawingBasePos
=
1013
;
window
[
'
AscDFH
'
].
historyitem_CommonChart_RemoveSeries
=
1005
;
window
[
'
AscDFH
'
].
historyitem_CommonSeries_RemoveDPt
=
1006
;
window
[
'
AscDFH
'
].
historyitem_CommonLit_RemoveDPt
=
1007
;
...
...
common/Drawings/Format/GraphicObjectBase.js
View file @
30622193
...
...
@@ -391,6 +391,31 @@
CGraphicObjectBase
.
prototype
.
getAllFonts
=
function
(
mapUrl
){
};
CGraphicObjectBase
.
prototype
.
getAllRasterImages
=
function
(
mapUrl
){
};
CGraphicObjectBase
.
prototype
.
setDrawingBaseType
=
function
(
nType
){
if
(
this
.
drawingBase
){
History
.
Add
(
this
,
{
Type
:
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
,
OldPr
:
this
.
drawingBase
.
Type
,
NewPr
:
nType
});
this
.
drawingBase
.
Type
=
nType
;
}
};
CGraphicObjectBase
.
prototype
.
setDrawingBasePos
=
function
(
fPosX
,
fPosY
){
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
History
.
Add
(
this
,
{
Type
:
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
,
OldPr
:
{
X
:
this
.
drawingBase
.
Pos
.
X
,
Y
:
this
.
drawingBase
.
Pos
.
Y
},
NewPr
:
{
X
:
fPosX
,
Y
:
fPosY
}});
this
.
drawingBase
.
Pos
.
X
=
fPosX
;
this
.
drawingBase
.
Pos
.
Y
=
fPosY
;
}
};
CGraphicObjectBase
.
prototype
.
setDrawingBaseExt
=
function
(
fExtX
,
fExtY
){
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
History
.
Add
(
this
,
{
Type
:
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
,
OldPr
:
{
cx
:
this
.
drawingBase
.
ext
.
cx
,
cy
:
this
.
drawingBase
.
ext
.
cy
},
NewPr
:
{
cx
:
fExtX
,
cy
:
fExtY
}});
this
.
drawingBase
.
ext
.
cx
=
fExtX
;
this
.
drawingBase
.
ext
.
cy
=
fExtY
;
}
};
window
[
'
AscFormat
'
]
=
window
[
'
AscFormat
'
]
||
{};
window
[
'
AscFormat
'
].
CGraphicObjectBase
=
CGraphicObjectBase
;
window
[
'
AscFormat
'
].
CGraphicBounds
=
CGraphicBounds
;
...
...
common/Drawings/Format/GroupShape.js
View file @
30622193
...
...
@@ -1764,6 +1764,26 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
{
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
data
.
OldPr
.
X
;
this
.
drawingBase
.
Pos
.
Y
=
data
.
OldPr
.
Y
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
data
.
OldPr
.
cx
;
this
.
drawingBase
.
ext
.
cy
=
data
.
OldPr
.
cy
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
if
(
this
.
drawingBase
){
this
.
drawingBase
.
Type
=
data
.
OldPr
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
data
.
oldPr
;
...
...
@@ -1861,6 +1881,26 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
{
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
data
.
NewPr
.
X
;
this
.
drawingBase
.
Pos
.
Y
=
data
.
NewPr
.
Y
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
data
.
NewPr
.
cx
;
this
.
drawingBase
.
ext
.
cy
=
data
.
NewPr
.
cy
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
if
(
this
.
drawingBase
){
this
.
drawingBase
.
Type
=
data
.
NewPr
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
data
.
newPr
;
...
...
@@ -1961,6 +2001,22 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
w
.
WriteLong
(
data
.
Type
);
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
w
.
WriteDouble
(
data
.
NewPr
.
X
);
w
.
WriteDouble
(
data
.
NewPr
.
Y
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
w
.
WriteDouble
(
data
.
NewPr
.
cx
);
w
.
WriteDouble
(
data
.
NewPr
.
cy
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
w
.
WriteLong
(
data
.
NewPr
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
w
.
WriteLong
(
data
.
newPr
);
...
...
@@ -2037,6 +2093,28 @@ AscCommon.extendClass(CGroupShape, AscFormat.CGraphicObjectBase);
var
type
=
r
.
GetLong
();
switch
(
type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
r
.
GetDouble
();
this
.
drawingBase
.
Pos
.
Y
=
r
.
GetDouble
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
r
.
GetDouble
();
this
.
drawingBase
.
ext
.
cy
=
r
.
GetDouble
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:
{
if
(
this
.
drawingBase
)
{
this
.
drawingBase
.
Type
=
r
.
GetLong
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
r
.
GetLong
();
...
...
common/Drawings/Format/Image.js
View file @
30622193
...
...
@@ -695,6 +695,28 @@ CImageShape.prototype.Undo = function(data)
{
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
data
.
OldPr
.
X
;
this
.
drawingBase
.
Pos
.
Y
=
data
.
OldPr
.
Y
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
data
.
OldPr
.
cx
;
this
.
drawingBase
.
ext
.
cy
=
data
.
OldPr
.
cy
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:
{
if
(
this
.
drawingBase
)
{
this
.
drawingBase
.
Type
=
data
.
OldPr
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
data
.
oldPr
;
...
...
@@ -797,7 +819,28 @@ CImageShape.prototype.Redo = function(data)
{
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
data
.
NewPr
.
X
;
this
.
drawingBase
.
Pos
.
Y
=
data
.
NewPr
.
Y
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
data
.
NewPr
.
cx
;
this
.
drawingBase
.
ext
.
cy
=
data
.
NewPr
.
cy
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:
{
if
(
this
.
drawingBase
)
{
this
.
drawingBase
.
Type
=
data
.
NewPr
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
data
.
newPr
;
...
...
@@ -902,6 +945,22 @@ CImageShape.prototype.Save_Changes = function(data, w)
w
.
WriteLong
(
data
.
Type
);
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
w
.
WriteDouble
(
data
.
NewPr
.
X
);
w
.
WriteDouble
(
data
.
NewPr
.
Y
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
w
.
WriteDouble
(
data
.
NewPr
.
cx
);
w
.
WriteDouble
(
data
.
NewPr
.
cy
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:
{
w
.
WriteLong
(
data
.
NewPr
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
w
.
WriteLong
(
data
.
newPr
);
...
...
@@ -998,6 +1057,28 @@ CImageShape.prototype.Load_Changes = function(r)
var
type
=
r
.
GetLong
();
switch
(
type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
r
.
GetDouble
();
this
.
drawingBase
.
Pos
.
Y
=
r
.
GetDouble
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
r
.
GetDouble
();
this
.
drawingBase
.
ext
.
cy
=
r
.
GetDouble
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:
{
if
(
this
.
drawingBase
)
{
this
.
drawingBase
.
Type
=
r
.
GetLong
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
r
.
GetLong
();
...
...
common/Drawings/Format/Shape.js
View file @
30622193
...
...
@@ -4999,6 +4999,26 @@ CShape.prototype.Undo = function (data)
{
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
data
.
OldPr
.
X
;
this
.
drawingBase
.
Pos
.
Y
=
data
.
OldPr
.
Y
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
data
.
OldPr
.
cx
;
this
.
drawingBase
.
ext
.
cy
=
data
.
OldPr
.
cy
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
if
(
this
.
drawingBase
){
this
.
drawingBase
.
Type
=
data
.
OldPr
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
data
.
oldPr
;
...
...
@@ -5111,6 +5131,26 @@ CShape.prototype.Redo = function (data)
{
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
data
.
NewPr
.
X
;
this
.
drawingBase
.
Pos
.
Y
=
data
.
NewPr
.
Y
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
data
.
NewPr
.
cx
;
this
.
drawingBase
.
ext
.
cy
=
data
.
NewPr
.
cy
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:{
if
(
this
.
drawingBase
){
this
.
drawingBase
.
Type
=
data
.
NewPr
;
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
data
.
newPr
;
...
...
@@ -5223,6 +5263,22 @@ CShape.prototype.Save_Changes = function (data, w)
w
.
WriteLong
(
data
.
Type
);
switch
(
data
.
Type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
w
.
WriteDouble
(
data
.
NewPr
.
X
);
w
.
WriteDouble
(
data
.
NewPr
.
Y
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
w
.
WriteDouble
(
data
.
NewPr
.
cx
);
w
.
WriteDouble
(
data
.
NewPr
.
cy
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:
{
w
.
WriteLong
(
data
.
NewPr
);
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
w
.
WriteLong
(
data
.
newPr
);
...
...
@@ -5307,6 +5363,28 @@ CShape.prototype.Load_Changes = function (r)
var
type
=
r
.
GetLong
();
switch
(
type
)
{
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBasePos
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
Pos
){
this
.
drawingBase
.
Pos
.
X
=
r
.
GetDouble
();
this
.
drawingBase
.
Pos
.
Y
=
r
.
GetDouble
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseExt
:{
if
(
this
.
drawingBase
&&
this
.
drawingBase
.
ext
){
this
.
drawingBase
.
ext
.
cx
=
r
.
GetDouble
();
this
.
drawingBase
.
ext
.
cy
=
r
.
GetDouble
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetDrawingBaseType
:
{
if
(
this
.
drawingBase
)
{
this
.
drawingBase
.
Type
=
r
.
GetLong
();
}
break
;
}
case
AscDFH
.
historyitem_AutoShapes_SetLocks
:
{
this
.
locks
=
r
.
GetLong
();
...
...
slide/apiBuilder.js
View file @
30622193
...
...
@@ -38,7 +38,7 @@
* @class
* @name Api
*/
var
Api
=
window
[
"
Asc
"
][
"
asc_docs_api
"
];
var
Api
=
window
[
"
Asc
"
][
"
asc_docs_api
"
]
||
window
[
"
Asc
"
][
"
spreadsheet_api
"
]
;
/**
* Class representing a presentation.
...
...
@@ -101,135 +101,6 @@
}
AscCommon
.
extendClass
(
ApiGroup
,
ApiDrawing
);
/**
* Class representing a base class for color types
* @constructor
*/
function
ApiUniColor
(
Unicolor
)
{
this
.
Unicolor
=
Unicolor
;
}
/**
* Class representing RGB color
* @constructor
*/
function
ApiRGBColor
(
r
,
g
,
b
)
{
ApiRGBColor
.
superclass
.
constructor
.
call
(
this
,
AscFormat
.
CreateUniColorRGB
(
r
,
g
,
b
));
}
AscCommon
.
extendClass
(
ApiRGBColor
,
ApiUniColor
);
/**
* Class representing a Scheme Color
* @constructor
*/
function
ApiSchemeColor
(
sColorId
)
{
ApiSchemeColor
.
superclass
.
constructor
.
call
(
this
,
AscFormat
.
builder_CreateSchemeColor
(
sColorId
));
}
AscCommon
.
extendClass
(
ApiSchemeColor
,
ApiUniColor
);
/**
* Class representing a Preset Color
* @constructor
* */
function
ApiPresetColor
(
sPresetColor
)
{
ApiPresetColor
.
superclass
.
constructor
.
call
(
this
,
AscFormat
.
builder_CreatePresetColor
(
sPresetColor
));
}
AscCommon
.
extendClass
(
ApiPresetColor
,
ApiUniColor
);
/**
* Class represent a base class fill
* @constructor
* */
function
ApiFill
(
UniFill
)
{
this
.
UniFill
=
UniFill
;
}
/**
* Class represent a stroke class
* @constructor
*/
function
ApiStroke
(
oLn
)
{
this
.
Ln
=
oLn
;
}
/**
* Class represent gradient stop
* @constructor
* */
function
ApiGradientStop
(
oApiUniColor
,
pos
)
{
this
.
Gs
=
AscFormat
.
builder_CreateGradientStop
(
oApiUniColor
.
Unicolor
,
pos
);
}
/**
* Class representing a container for paragraphs
* @param Document
* @constructor
*/
function
ApiDrawingContent
(
Document
)
{
this
.
Document
=
Document
;
}
/**
* Class representing a paragraph properties.
* @constructor
*/
function
ApiParaPr
(
Parent
,
ParaPr
)
{
this
.
Parent
=
Parent
;
this
.
ParaPr
=
ParaPr
;
}
/*
* Class representing paragraph bullet
* @constructor
* */
function
ApiBullet
(
Bullet
)
{
this
.
Bullet
=
Bullet
;
}
/**
* Class representing a paragraph.
* @constructor
* @extends {ApiParaPr}
*/
function
ApiParagraph
(
Paragraph
)
{
ApiParagraph
.
superclass
.
constructor
.
call
(
this
,
this
,
Paragraph
.
Pr
.
Copy
());
this
.
Paragraph
=
Paragraph
;
}
AscCommon
.
extendClass
(
ApiParagraph
,
ApiParaPr
);
/**
* Class representing a text properties.
* @constructor
*/
function
ApiTextPr
(
Parent
,
TextPr
)
{
this
.
Parent
=
Parent
;
this
.
TextPr
=
TextPr
;
}
/**
* Class representing a small text block calling 'run'.
* @constructor
* @extends {ApiTextPr}
*/
function
ApiRun
(
Run
)
{
ApiRun
.
superclass
.
constructor
.
call
(
this
,
this
,
Run
.
Pr
.
Copy
());
this
.
Run
=
Run
;
}
AscCommon
.
extendClass
(
ApiRun
,
ApiTextPr
);
/**
* Twentieths of a point (equivalent to 1/1440th of an inch).
...
...
@@ -415,133 +286,6 @@
return
null
;
};
/**
* Create a RGB color
* @memberof Api
* @param {byte} r
* @param {byte} g
* @param {byte} b
* @returns {ApiRGBColor}
*/
Api
.
prototype
.
CreateRGBColor
=
function
(
r
,
g
,
b
)
{
return
new
ApiRGBColor
(
r
,
g
,
b
);
};
/**
* Create a scheme color
* @memberof Api
* @param {SchemeColorId} sSchemeColorId
* @returns {ApiSchemeColor}
*/
Api
.
prototype
.
CreateSchemeColor
=
function
(
sSchemeColorId
)
{
return
new
ApiSchemeColor
(
sSchemeColorId
);
};
/**
* Create preset color
* @memberof Api
* @param {PresetColor} sPresetColor
* @returns {ApiPresetColor};
* */
Api
.
prototype
.
CreatePresetColor
=
function
(
sPresetColor
)
{
return
new
ApiPresetColor
(
sPresetColor
);
};
/**
* Create a solid fill
* @memberof Api
* @param {ApiUniColor} oUniColor
* @returns {ApiFill}
* */
Api
.
prototype
.
CreateSolidFill
=
function
(
oUniColor
)
{
return
new
ApiFill
(
AscFormat
.
CreateUniFillByUniColor
(
oUniColor
.
Unicolor
));
};
/**
* Create a linear gradient fill
* @memberof Api
* @param {Array} aGradientStop
* @param {PositiveFixedAngle} Angle
* @returns {ApiFill}
*/
Api
.
prototype
.
CreateLinearGradientFill
=
function
(
aGradientStop
,
Angle
)
{
return
new
ApiFill
(
AscFormat
.
builder_CreateLinearGradient
(
aGradientStop
,
Angle
));
};
/**
* Create a radial gradient fill
* @memberof Api
* @param {Array} aGradientStop
* @returns {ApiFill}
*/
Api
.
prototype
.
CreateRadialGradientFill
=
function
(
aGradientStop
)
{
return
new
ApiFill
(
AscFormat
.
builder_CreateRadialGradient
(
aGradientStop
));
};
/**
* Create a pattern fill
* @memberof Api
* @param {PatternType} sPatternType
* @param {ApiUniColor} BgColor
* @param {ApiUniColor} FgColor
* @returns {ApiFill}
*/
Api
.
prototype
.
CreatePatternFill
=
function
(
sPatternType
,
BgColor
,
FgColor
)
{
return
new
ApiFill
(
AscFormat
.
builder_CreatePatternFill
(
sPatternType
,
BgColor
,
FgColor
));
};
/**
* Create a blip fill
* @memberof Api
* @param {string} sImageUrl
* @param {BlipFillType} sBlipFillType
* @returns {ApiFill}
* */
Api
.
prototype
.
CreateBlipFill
=
function
(
sImageUrl
,
sBlipFillType
)
{
return
new
ApiFill
(
AscFormat
.
builder_CreateBlipFill
(
sImageUrl
,
sBlipFillType
));
};
/**
* Create no fill
* @memberof Api
* @returns {ApiFill}
* */
Api
.
prototype
.
CreateNoFill
=
function
()
{
return
new
ApiFill
(
AscFormat
.
CreateNoFillUniFill
());
};
/**
* Create a stroke
* @memberof Api
* @param {EMU} nWidth
* @param {ApiFill} oFill
* @returns {ApiStroke}
* */
Api
.
prototype
.
CreateStroke
=
function
(
nWidth
,
oFill
)
{
return
new
ApiStroke
(
AscFormat
.
builder_CreateLine
(
nWidth
,
oFill
));
};
/**
* Create a stroke
* @memberof Api
* @param {ApiUniColor} oUniColor
* @param {PositivePercentage} nPos
* @returns {ApiGradientStop}
* */
Api
.
prototype
.
CreateGradientStop
=
function
(
oUniColor
,
nPos
)
{
return
new
ApiGradientStop
(
oUniColor
,
nPos
);
};
/**
* Create a new paragraph.
...
...
@@ -550,92 +294,9 @@
*/
Api
.
prototype
.
CreateParagraph
=
function
()
{
return
new
ApiParagraph
(
new
Paragraph
(
private_GetDrawingDocument
(),
null
,
0
,
0
,
0
,
0
,
0
,
true
));
return
this
.
private_CreateApiParagraph
(
new
Paragraph
(
private_GetDrawingDocument
(),
null
));
};
/**
* Create a new text block.
* @memberof Api
* @returns {ApiRun}
*/
Api
.
prototype
.
CreateRun
=
function
()
{
return
new
ApiRun
(
new
ParaRun
(
null
,
false
));
};
/**
* Create a new bullet
* @memberof Api
* @returns {ApiBullet}
* */
Api
.
CreateBullet
=
function
(
sSymbol
){
var
oBullet
=
new
AscFormat
.
CBullet
();
oBullet
.
bulletType
=
new
AscFormat
.
CBulletType
();
if
(
typeof
sSymbol
===
"
string
"
&&
sSymbol
.
length
>
0
){
oBullet
.
bulletType
.
type
=
AscFormat
.
BULLET_TYPE_BULLET_CHAR
;
oBullet
.
bulletType
.
Char
=
sSymbol
[
0
];
}
else
{
oBullet
.
bulletType
.
type
=
AscFormat
.
BULLET_TYPE_BULLET_NONE
;
}
};
/**
* Create a new numbering
* @memberof Api
* @param {BulletType} sType
* @param {number} nStartAt
* @returns {ApiBullet}
* */
Api
.
CreateNumbering
=
function
(
sType
,
nStartAt
){
var
oBullet
=
new
AscFormat
.
CBullet
();
oBullet
.
bulletType
=
new
AscFormat
.
CBulletType
();
oBullet
.
bulletType
.
type
=
AscFormat
.
BULLET_TYPE_BULLET_AUTONUM
;
switch
(
sType
){
case
"
ArabicPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
12
;
break
;
}
case
"
ArabicParenR
"
:{
oBullet
.
bulletType
.
AutoNumType
=
11
;
break
;
}
case
"
RomanUcPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
34
;
break
;
}
case
"
RomanLcPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
31
;
break
;
}
case
"
AlphaLcParenR
"
:{
oBullet
.
bulletType
.
AutoNumType
=
1
;
break
;
}
case
"
AlphaLcPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
2
;
break
;
}
case
"
AlphaUcParenR
"
:{
oBullet
.
bulletType
.
AutoNumType
=
4
;
break
;
}
case
"
AlphaUcPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
5
;
break
;
}
case
"
None
"
:{
oBullet
.
bulletType
.
type
=
AscFormat
.
BULLET_TYPE_BULLET_NONE
;
}
}
if
(
oBullet
.
bulletType
.
type
===
AscFormat
.
BULLET_TYPE_BULLET_AUTONUM
){
if
(
AscFormat
.
isRealNumber
(
nStartAt
)){
oBullet
.
bulletType
.
startAt
=
nStartAt
;
}
}
return
new
ApiBullet
(
oBullet
);
};
//------------------------------------------------------------------------------------------------------------------
//
...
...
@@ -769,6 +430,7 @@
/**
* Getting slide width
* @returns {EMU}
* */
ApiSlide
.
prototype
.
GetWidth
=
function
(){
if
(
this
.
Slide
){
...
...
@@ -779,6 +441,7 @@
/**
* Getting slide height
* @returns {EMU}
* */
ApiSlide
.
prototype
.
GetHeight
=
function
(){
if
(
this
.
Slide
){
...
...
@@ -786,623 +449,103 @@
}
return
0
;
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiDrawing
Content
// ApiDrawing
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"drawingContent"}
*/
ApiDrawingContent
.
prototype
.
GetClassType
=
function
()
{
return
"
drawingContent
"
;
};
/**
* Get the number of elements.
* @returns {number}
*/
ApiDrawingContent
.
prototype
.
GetElementsCount
=
function
()
{
return
this
.
Document
.
Content
.
length
;
};
/**
* Get element by position
* @returns {ApiParagraph}
* @returns {"drawing"}
*/
ApiDrawing
Content
.
prototype
.
GetElement
=
function
(
nPos
)
ApiDrawing
.
prototype
.
GetClassType
=
function
(
)
{
if
(
!
this
.
Document
.
Content
[
nPos
])
return
null
;
var
Type
=
this
.
Document
.
Content
[
nPos
].
Get_Type
();
if
(
type_Paragraph
===
Type
)
return
new
ApiParagraph
(
this
.
Document
.
Content
[
nPos
]);
return
null
;
return
"
drawing
"
;
};
/**
*
Add paragraph or table by position
* @param {
number} nPos
* @param {
ApiParagraph} oElemen
t
*
Set the size of the bounding box.
* @param {
EMU} nWidth
* @param {
EMU} nHeigh
t
*/
ApiDrawing
Content
.
prototype
.
AddElement
=
function
(
nPos
,
oElemen
t
)
ApiDrawing
.
prototype
.
SetSize
=
function
(
nWidth
,
nHeigh
t
)
{
if
(
oElement
instanceof
ApiParagraph
)
var
fWidth
=
private_EMU2MM
(
nWidth
);
var
fHeight
=
private_EMU2MM
(
nHeight
);
if
(
this
.
Drawing
&&
this
.
Drawing
.
spPr
&&
this
.
Drawing
.
spPr
.
xfrm
)
{
this
.
Document
.
Internal_Content_Add
(
nPos
,
oElement
.
private_GetImpl
(),
false
);
this
.
Drawing
.
spPr
.
xfrm
.
setExtX
(
fWidth
);
this
.
Drawing
.
spPr
.
xfrm
.
setExtY
(
fHeight
);
}
};
/**
* Push paragraph or table
* @param {ApiParagraph} oElement
* Set the size of the bounding box.
* @param {EMU} nPosX
* @param {EMU} nPosY
*/
ApiDrawing
Content
.
prototype
.
Push
=
function
(
oElement
)
ApiDrawing
.
prototype
.
SetPosition
=
function
(
nPosX
,
nPosY
)
{
if
(
oElement
instanceof
ApiParagraph
)
var
fPosX
=
private_EMU2MM
(
nPosX
);
var
fPosY
=
private_EMU2MM
(
nPosY
);
if
(
this
.
Drawing
&&
this
.
Drawing
.
spPr
&&
this
.
Drawing
.
spPr
.
xfrm
)
{
this
.
D
ocument
.
Internal_Content_Add
(
this
.
Document
.
Content
.
length
,
oElement
.
private_GetImpl
(),
false
);
return
true
;
this
.
D
rawing
.
spPr
.
xfrm
.
setOffX
(
fPosX
);
this
.
Drawing
.
spPr
.
xfrm
.
setOffY
(
fPosY
)
;
}
return
false
;
};
/**
* Remove all elements from the current document.
*/
ApiDrawingContent
.
prototype
.
RemoveAllElements
=
function
()
{
this
.
Document
.
Content
=
[];
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiImage
//
//------------------------------------------------------------------------------------------------------------------
/**
*
Remove element by specified position
.
* @
param {number} nPos
*
Get the type of this class
.
* @
returns {"image"}
*/
Api
DrawingContent
.
prototype
.
RemoveElement
=
function
(
nPos
)
Api
Image
.
prototype
.
GetClassType
=
function
(
)
{
if
(
nPos
<
0
||
nPos
>=
this
.
GetElementsCount
())
return
;
this
.
Document
.
Internal_Content_Remove
(
nPos
,
1
);
return
"
image
"
;
};
//------------------------------------------------------------------------------------------------------------------
//
// Api
Paragraph
// Api
Shape
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"
document
"}
* @returns {"
shape
"}
*/
Api
Paragraph
.
prototype
.
GetClassType
=
function
()
Api
Shape
.
prototype
.
GetClassType
=
function
()
{
return
"
paragraph
"
;
return
"
shape
"
;
};
/**
* Add text
* @param {string} [sText=""]
* @returns {ApiRun}
* Get content of this shape.
* @returns {?ApiDocumentContent}
*/
Api
Paragraph
.
prototype
.
AddText
=
function
(
sText
)
Api
Shape
.
prototype
.
GetDocContent
=
function
(
)
{
var
oRun
=
new
ParaRun
(
this
.
Paragraph
,
false
);
if
(
!
sText
||
!
sText
.
length
)
return
new
ApiRun
(
oRun
);
for
(
var
nPos
=
0
,
nCount
=
sText
.
length
;
nPos
<
nCount
;
++
nPos
)
var
oApi
=
private_GetApi
();
if
(
oApi
&&
this
.
Drawing
&&
this
.
Drawing
.
txBody
&&
this
.
Drawing
.
txBody
.
content
)
{
var
nChar
=
sText
.
charAt
(
nPos
);
if
(
"
"
==
nChar
)
oRun
.
Add_ToContent
(
nPos
,
new
ParaSpace
(),
false
);
else
oRun
.
Add_ToContent
(
nPos
,
new
ParaText
(
nChar
),
false
);
return
oApi
.
private_CreateApiDocContent
(
this
.
Drawing
.
txBody
.
content
);
}
private_PushElementToParagraph
(
this
.
Paragraph
,
oRun
);
return
new
ApiRun
(
oRun
);
return
null
;
};
/**
* Get paragraph properties.
* @returns {ApiParaPr}
*/
ApiParagraph
.
prototype
.
GetParaPr
=
function
()
{
return
new
ApiParaPr
(
this
,
this
.
Paragraph
.
Pr
.
Copy
());
};
/**
* Get the number of elements in the current paragraph.
* @returns {number}
*/
ApiParagraph
.
prototype
.
GetElementsCount
=
function
()
{
// TODO: ParaEnd
return
this
.
Paragraph
.
Content
.
length
-
1
;
};
/**
* Get the element of the paragraph content by specified position.
* @param {number} nPos
* @returns {?ParagraphContent}
*/
ApiParagraph
.
prototype
.
GetElement
=
function
(
nPos
)
{
// TODO: ParaEnd
if
(
nPos
<
0
||
nPos
>=
this
.
Paragraph
.
Content
.
length
-
1
)
return
null
;
var
oElement
=
this
.
Paragraph
.
Content
[
nPos
];
if
(
oElement
instanceof
ParaRun
)
return
new
ApiRun
(
oElement
);
else
return
null
;
};
/**
* Remove element by specified position.
* @param {number} nPos
*/
ApiParagraph
.
prototype
.
RemoveElement
=
function
(
nPos
)
{
if
(
nPos
<
0
||
nPos
>=
this
.
Paragraph
.
Content
.
length
-
1
)
return
;
this
.
Paragraph
.
Remove_FromContent
(
nPos
,
1
);
};
/**
* Remove all elements.
*/
ApiParagraph
.
prototype
.
RemoveAllElements
=
function
()
{
if
(
this
.
Paragraph
.
Content
.
length
>
1
)
this
.
Paragraph
.
Remove_FromContent
(
0
,
this
.
Paragraph
.
Content
.
length
-
1
);
};
/**
* Add an element to paragraph content.
* @param {ParagraphContent} oElement
* @param {number} [nPos] If this value is not specified then element will be added to the end of this paragraph.
* @returns {boolean} Returns <code>false</code> if the type of <code>oElement</code> is not supported by paragraph
* content.
*/
ApiParagraph
.
prototype
.
AddElement
=
function
(
oElement
,
nPos
)
{
// TODO: ParaEnd
if
(
!
(
oElement
instanceof
ApiRun
)
||
nPos
<
0
||
nPos
>
this
.
Paragraph
.
Content
.
length
-
1
)
return
false
;
var
oParaElement
=
oElement
.
private_GetImpl
();
if
(
undefined
!==
nPos
)
{
this
.
Paragraph
.
Add_ToContent
(
nPos
,
oParaElement
);
}
else
{
private_PushElementToParagraph
(
this
.
Paragraph
,
oParaElement
);
}
return
true
;
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiRun
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"run"}
*/
ApiRun
.
prototype
.
GetClassType
=
function
()
{
return
"
run
"
;
};
/**
* Get the text properties of the current run.
* @returns {ApiTextPr}
*/
ApiRun
.
prototype
.
GetTextPr
=
function
()
{
return
new
ApiTextPr
(
this
,
this
.
Run
.
Pr
.
Copy
());
};
/**
* Remove all content from the current run.
*/
ApiRun
.
prototype
.
ClearContent
=
function
()
{
this
.
Run
.
Remove_FromContent
(
0
,
this
.
Run
.
Content
.
length
);
};
/**
* Add text to this run.
* @param {string} sText
*/
ApiRun
.
prototype
.
AddText
=
function
(
sText
)
{
if
(
!
sText
||
!
sText
.
length
)
return
;
var
nLastPos
=
this
.
Run
.
Content
.
length
;
for
(
var
nPos
=
0
,
nCount
=
sText
.
length
;
nPos
<
nCount
;
++
nPos
)
{
var
nChar
=
sText
.
charAt
(
nPos
);
if
(
"
"
==
nChar
)
this
.
Run
.
Add_ToContent
(
nLastPos
+
nPos
,
new
ParaSpace
(),
false
);
else
this
.
Run
.
Add_ToContent
(
nLastPos
+
nPos
,
new
ParaText
(
nChar
),
false
);
}
};
/**
* Add a tab stop.
*/
ApiRun
.
prototype
.
AddTabStop
=
function
()
{
this
.
Run
.
Add_ToContent
(
this
.
Run
.
Content
.
length
,
new
ParaTab
());
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiTextPr
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"textPr"}
*/
ApiTextPr
.
prototype
.
GetClassType
=
function
()
{
return
"
textPr
"
;
};
/**
* Set the bold property.
* @param {boolean} isBold
*/
ApiTextPr
.
prototype
.
SetBold
=
function
(
isBold
)
{
this
.
TextPr
.
Bold
=
isBold
;
this
.
private_OnChange
();
};
/**
* Set the italic property.
* @param {boolean} isItalic
*/
ApiTextPr
.
prototype
.
SetItalic
=
function
(
isItalic
)
{
this
.
TextPr
.
Italic
=
isItalic
;
this
.
private_OnChange
();
};
/**
* Specify that the contents of this run shall be displayed with a single horizontal line through the center of
* the line.
* @param {boolean} isStrikeout
*/
ApiTextPr
.
prototype
.
SetStrikeout
=
function
(
isStrikeout
)
{
this
.
TextPr
.
Strikeout
=
isStrikeout
;
this
.
private_OnChange
();
};
/**
* Specify that the contents of this run should be displayed along with an underline appearing directly below the
* character height (less all spacing above and below the characters on the line).
* @param {boolean} isUnderline
*/
ApiTextPr
.
prototype
.
SetUnderline
=
function
(
isUnderline
)
{
this
.
TextPr
.
Underline
=
isUnderline
;
this
.
private_OnChange
();
};
/**
* Set all 4 font slots with the specified font family.
* @param {string} sFontFamily
*/
ApiTextPr
.
prototype
.
SetFontFamily
=
function
(
sFontFamily
)
{
this
.
TextPr
.
RFonts
.
Set_All
(
sFontFamily
,
-
1
);
this
.
private_OnChange
();
};
/**
* Set the font size.
* @param {hps} nSize
*/
ApiTextPr
.
prototype
.
SetFontSize
=
function
(
nSize
)
{
this
.
TextPr
.
FontSize
=
private_GetHps
(
nSize
);
this
.
private_OnChange
();
};
/**
* Set text color in the rgb format.
* @param {ApiFill} oFill
*
*/
ApiTextPr
.
prototype
.
SetFill
=
function
(
oFill
)
{
this
.
TextPr
.
Unifill
=
oFill
.
UniFill
;
this
.
private_OnChange
();
};
/**
* Specifies the alignment which shall be applied to the contents of this run in relation to the default
* appearance of the run's text.
* @param {("baseline" | "subscript" | "superscript")} sType
*/
ApiTextPr
.
prototype
.
SetVertAlign
=
function
(
sType
)
{
if
(
"
baseline
"
===
sType
)
this
.
TextPr
.
VertAlign
=
AscCommon
.
vertalign_Baseline
;
else
if
(
"
subscript
"
===
sType
)
this
.
TextPr
.
VertAlign
=
AscCommon
.
vertalign_SubScript
;
else
if
(
"
superscript
"
===
sType
)
this
.
TextPr
.
VertAlign
=
AscCommon
.
vertalign_SuperScript
;
this
.
private_OnChange
();
};
/**
* Set text spacing.
* @param {twips} nSpacing
*/
ApiTextPr
.
prototype
.
SetSpacing
=
function
(
nSpacing
)
{
this
.
TextPr
.
Spacing
=
private_Twips2MM
(
nSpacing
);
this
.
private_OnChange
();
};
/**
* Specify that the contents of this run shall be displayed with two horizontal lines through each character
* displayed on the line.
* @param {boolean} isDoubleStrikeout
*/
ApiTextPr
.
prototype
.
SetDoubleStrikeout
=
function
(
isDoubleStrikeout
)
{
this
.
TextPr
.
DStrikeout
=
isDoubleStrikeout
;
this
.
private_OnChange
();
};
/**
* Specify that any lowercase characters in this text run shall be formatted for display only as their capital
* letter character equivalents.
* @param {boolean} isCaps
*/
ApiTextPr
.
prototype
.
SetCaps
=
function
(
isCaps
)
{
this
.
TextPr
.
Caps
=
isCaps
;
this
.
private_OnChange
();
};
/**
* Specify that all small letter characters in this text run shall be formatted for display only as their capital
* letter character equivalents in a font size two points smaller than the actual font size specified for this text.
* @param {boolean} isSmallCaps
*/
ApiTextPr
.
prototype
.
SetSmallCaps
=
function
(
isSmallCaps
)
{
this
.
TextPr
.
SmallCaps
=
isSmallCaps
;
this
.
private_OnChange
();
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiParaPr
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"paraPr"}
*/
ApiParaPr
.
prototype
.
GetClassType
=
function
()
{
return
"
paraPr
"
;
};
/**
* Set left indentation.
* @param {twips} nValue
*/
ApiParaPr
.
prototype
.
SetIndLeft
=
function
(
nValue
)
{
this
.
ParaPr
.
Ind
.
Left
=
private_Twips2MM
(
nValue
);
this
.
private_OnChange
();
};
/**
* Set right indentation.
* @param {twips} nValue
*/
ApiParaPr
.
prototype
.
SetIndRight
=
function
(
nValue
)
{
this
.
ParaPr
.
Ind
.
Right
=
private_Twips2MM
(
nValue
);
this
.
private_OnChange
();
};
/**
* Set first line indentation.
* @param {twips} nValue
*/
ApiParaPr
.
prototype
.
SetIndFirstLine
=
function
(
nValue
)
{
this
.
ParaPr
.
Ind
.
FirstLine
=
private_Twips2MM
(
nValue
);
this
.
private_OnChange
();
};
/**
* Set paragraph justification
* @param {("left" | "right" | "both" | "center")} sJc
*/
ApiParaPr
.
prototype
.
SetJc
=
function
(
sJc
)
{
this
.
ParaPr
.
Jc
=
private_GetParaAlign
(
sJc
);
this
.
private_OnChange
();
};
/**
* Set paragraph line spacing. If the value of the <code>sLineRule</code> parameter is either <code>"atLeast"</code>
* or <code>"exact"</code>, then the value of <code>nLine</code> shall be interpreted as twentieths of a point. If
* the value of the <code>sLineRule</code> parameter is <code>"auto"</code>, then the value of the <code>nLine</code>
* attribute shall be interpreted as 240ths of a line.
* @param {(twips | line240)} nLine
* @param {("auto" | "atLeast" | "exact")} sLineRule
*/
ApiParaPr
.
prototype
.
SetSpacingLine
=
function
(
nLine
,
sLineRule
)
{
if
(
undefined
!==
nLine
&&
undefined
!==
sLineRule
)
{
if
(
"
auto
"
===
sLineRule
)
{
this
.
ParaPr
.
Spacing
.
LineRule
=
Asc
.
linerule_Auto
;
this
.
ParaPr
.
Spacing
.
Line
=
nLine
/
240.0
;
}
else
if
(
"
atLeast
"
===
sLineRule
)
{
this
.
ParaPr
.
Spacing
.
LineRule
=
Asc
.
linerule_AtLeast
;
this
.
ParaPr
.
Spacing
.
Line
=
private_Twips2MM
(
nLine
);
}
else
if
(
"
exact
"
===
sLineRule
)
{
this
.
ParaPr
.
Spacing
.
LineRule
=
Asc
.
linerule_Exact
;
this
.
ParaPr
.
Spacing
.
Line
=
private_Twips2MM
(
nLine
);
}
}
this
.
private_OnChange
();
};
/**
* Set paragraph spacing before. If the value of the <code>isBeforeAuto</code> parameter is <code>true</code>, then
* any value of the <code>nBefore</code> is ignored. If <code>isBeforeAuto</code> parameter is not specified, then it
* will be interpreted as <code>false</code>.
* @param {twips} nBefore
* @param {boolean} [isBeforeAuto=false]
*/
ApiParaPr
.
prototype
.
SetSpacingBefore
=
function
(
nBefore
,
isBeforeAuto
)
{
if
(
undefined
!==
nBefore
)
this
.
ParaPr
.
Spacing
.
Before
=
private_Twips2MM
(
nBefore
);
if
(
undefined
!==
isBeforeAuto
)
this
.
ParaPr
.
Spacing
.
BeforeAutoSpacing
=
isBeforeAuto
;
this
.
private_OnChange
();
};
/**
* Set paragraph spacing after. If the value of the <code>isAfterAuto</code> parameter is <code>true</code>, then
* any value of the <code>nAfter</code> is ignored. If <code>isAfterAuto</code> parameter is not specified, then it
* will be interpreted as <code>false</code>.
* @param {twips} nAfter
* @param {boolean} [isAfterAuto=false]
*/
ApiParaPr
.
prototype
.
SetSpacingAfter
=
function
(
nAfter
,
isAfterAuto
)
{
if
(
undefined
!==
nAfter
)
this
.
ParaPr
.
Spacing
.
After
=
private_Twips2MM
(
nAfter
);
if
(
undefined
!==
isAfterAuto
)
this
.
ParaPr
.
Spacing
.
AfterAutoSpacing
=
isAfterAuto
;
this
.
private_OnChange
();
};
/*
* Set paragraph's bullet
* @param {ApiBullet} oBullet
* */
ApiParaPr
.
prototype
.
SetBullet
=
function
(
oBullet
){
if
(
oBullet
){
this
.
ParaPr
.
Bullet
=
oBullet
.
Bullet
;
this
.
private_OnChange
();
}
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiDrawing
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"drawing"}
*/
ApiDrawing
.
prototype
.
GetClassType
=
function
()
{
return
"
drawing
"
;
};
/**
* Set the size of the bounding box.
* @param {EMU} nWidth
* @param {EMU} nHeight
*/
ApiDrawing
.
prototype
.
SetSize
=
function
(
nWidth
,
nHeight
)
{
var
fWidth
=
private_EMU2MM
(
nWidth
);
var
fHeight
=
private_EMU2MM
(
nHeight
);
if
(
this
.
Drawing
&&
this
.
Drawing
.
spPr
&&
this
.
Drawing
.
spPr
.
xfrm
)
{
this
.
Drawing
.
spPr
.
xfrm
.
setExtX
(
fWidth
);
this
.
Drawing
.
spPr
.
xfrm
.
setExtY
(
fHeight
);
}
};
/**
* Set the size of the bounding box.
* @param {EMU} nPosX
* @param {EMU} nPosY
*/
ApiDrawing
.
prototype
.
SetPosition
=
function
(
nPosX
,
nPosY
)
{
var
fPosX
=
private_EMU2MM
(
nPosX
);
var
fPosY
=
private_EMU2MM
(
nPosY
);
if
(
this
.
Drawing
&&
this
.
Drawing
.
spPr
&&
this
.
Drawing
.
spPr
.
xfrm
)
{
this
.
Drawing
.
spPr
.
xfrm
.
setOffX
(
fPosX
);
this
.
Drawing
.
spPr
.
xfrm
.
setOffY
(
fPosY
);
}
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiImage
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"image"}
*/
ApiImage
.
prototype
.
GetClassType
=
function
()
{
return
"
image
"
;
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiShape
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"shape"}
*/
ApiShape
.
prototype
.
GetClassType
=
function
()
{
return
"
shape
"
;
};
/**
* Get content of this shape.
* @returns {?ApiDrawingContent}
*/
ApiShape
.
prototype
.
GetDocContent
=
function
()
{
if
(
this
.
Drawing
&&
this
.
Drawing
.
txBody
&&
this
.
Drawing
.
txBody
.
content
)
{
return
new
ApiDrawingContent
(
this
.
Drawing
.
txBody
.
content
);
}
return
null
;
};
/**
* Set shape's content vertical align
* @param {VerticalTextAlign} VerticalAlign
* Set shape's content vertical align
* @param {VerticalTextAlign} VerticalAlign
*/
ApiShape
.
prototype
.
SetVerticalTextAlign
=
function
(
VerticalAlign
)
{
...
...
@@ -1493,103 +636,6 @@
AscFormat
.
builder_SetShowDataLabels
(
this
.
Chart
,
bShowSerName
,
bShowCatName
,
bShowVal
);
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiFill
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"fill"}
*/
ApiFill
.
prototype
.
GetClassType
=
function
()
{
return
"
fill
"
;
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiStroke
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"stroke"}
*/
ApiStroke
.
prototype
.
GetClassType
=
function
()
{
return
"
stroke
"
;
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiGradientStop
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"gradientStop"}
*/
ApiGradientStop
.
prototype
.
GetClassType
=
function
()
{
return
"
gradientStop
"
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiUniColor
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"uniColor"}
*/
ApiUniColor
.
prototype
.
GetClassType
=
function
()
{
return
"
uniColor
"
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiRGBColor
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"rgbColor"}
*/
ApiRGBColor
.
prototype
.
GetClassType
=
function
()
{
return
"
rgbColor
"
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiSchemeColor
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"schemeColor"}
*/
ApiSchemeColor
.
prototype
.
GetClassType
=
function
()
{
return
"
schemeColor
"
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiPresetColor
//
//------------------------------------------------------------------------------------------------------------------
/**
* Get the type of this class.
* @returns {"presetColor"}
*/
ApiPresetColor
.
prototype
.
GetClassType
=
function
()
{
return
"
presetColor
"
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Export
...
...
@@ -1600,19 +646,7 @@
Api
.
prototype
[
"
CreateShape
"
]
=
Api
.
prototype
.
CreateShape
;
Api
.
prototype
[
"
CreateChart
"
]
=
Api
.
prototype
.
CreateChart
;
Api
.
prototype
[
"
CreateGroup
"
]
=
Api
.
prototype
.
CreateGroup
;
Api
.
prototype
[
"
CreateRGBColor
"
]
=
Api
.
prototype
.
CreateRGBColor
;
Api
.
prototype
[
"
CreateSchemeColor
"
]
=
Api
.
prototype
.
CreateSchemeColor
;
Api
.
prototype
[
"
CreatePresetColor
"
]
=
Api
.
prototype
.
CreatePresetColor
;
Api
.
prototype
[
"
CreateSolidFill
"
]
=
Api
.
prototype
.
CreateSolidFill
;
Api
.
prototype
[
"
CreateLinearGradientFill
"
]
=
Api
.
prototype
.
CreateLinearGradientFill
;
Api
.
prototype
[
"
CreateRadialGradientFill
"
]
=
Api
.
prototype
.
CreateRadialGradientFill
;
Api
.
prototype
[
"
CreatePatternFill
"
]
=
Api
.
prototype
.
CreatePatternFill
;
Api
.
prototype
[
"
CreateBlipFill
"
]
=
Api
.
prototype
.
CreateBlipFill
;
Api
.
prototype
[
"
CreateNoFill
"
]
=
Api
.
prototype
.
CreateNoFill
;
Api
.
prototype
[
"
CreateStroke
"
]
=
Api
.
prototype
.
CreateStroke
;
Api
.
prototype
[
"
CreateGradientStop
"
]
=
Api
.
prototype
.
CreateGradientStop
;
Api
.
prototype
[
"
CreateParagraph
"
]
=
Api
.
prototype
.
CreateParagraph
;
Api
.
prototype
[
"
CreateRun
"
]
=
Api
.
prototype
.
CreateRun
;
ApiPresentation
.
prototype
[
"
GetClassType
"
]
=
ApiPresentation
.
prototype
.
GetClassType
;
ApiPresentation
.
prototype
[
"
GetCurSlideIndex
"
]
=
ApiPresentation
.
prototype
.
GetCurSlideIndex
;
...
...
@@ -1628,53 +662,6 @@
ApiSlide
.
prototype
[
"
GetWidth
"
]
=
ApiSlide
.
prototype
.
GetWidth
;
ApiSlide
.
prototype
[
"
GetHeight
"
]
=
ApiSlide
.
prototype
.
GetHeight
;
ApiDrawingContent
.
prototype
[
"
GetClassType
"
]
=
ApiDrawingContent
.
prototype
.
GetClassType
;
ApiDrawingContent
.
prototype
[
"
GetElementsCount
"
]
=
ApiDrawingContent
.
prototype
.
GetElementsCount
;
ApiDrawingContent
.
prototype
[
"
GetElement
"
]
=
ApiDrawingContent
.
prototype
.
GetElement
;
ApiDrawingContent
.
prototype
[
"
AddElement
"
]
=
ApiDrawingContent
.
prototype
.
AddElement
;
ApiDrawingContent
.
prototype
[
"
Push
"
]
=
ApiDrawingContent
.
prototype
.
Push
;
ApiDrawingContent
.
prototype
[
"
RemoveAllElements
"
]
=
ApiDrawingContent
.
prototype
.
RemoveAllElements
;
ApiDrawingContent
.
prototype
[
"
RemoveElement
"
]
=
ApiDrawingContent
.
prototype
.
RemoveElement
;
ApiParagraph
.
prototype
[
"
GetClassType
"
]
=
ApiParagraph
.
prototype
.
GetClassType
;
ApiParagraph
.
prototype
[
"
AddText
"
]
=
ApiParagraph
.
prototype
.
AddText
;
ApiParagraph
.
prototype
[
"
GetParaPr
"
]
=
ApiParagraph
.
prototype
.
GetParaPr
;
ApiParagraph
.
prototype
[
"
GetElementsCount
"
]
=
ApiParagraph
.
prototype
.
GetElementsCount
;
ApiParagraph
.
prototype
[
"
GetElement
"
]
=
ApiParagraph
.
prototype
.
GetElement
;
ApiParagraph
.
prototype
[
"
RemoveElement
"
]
=
ApiParagraph
.
prototype
.
RemoveElement
;
ApiParagraph
.
prototype
[
"
RemoveAllElements
"
]
=
ApiParagraph
.
prototype
.
RemoveAllElements
;
ApiParagraph
.
prototype
[
"
AddElement
"
]
=
ApiParagraph
.
prototype
.
AddElement
;
ApiRun
.
prototype
[
"
GetClassType
"
]
=
ApiRun
.
prototype
.
GetClassType
;
ApiRun
.
prototype
[
"
GetTextPr
"
]
=
ApiRun
.
prototype
.
GetTextPr
;
ApiRun
.
prototype
[
"
ClearContent
"
]
=
ApiRun
.
prototype
.
ClearContent
;
ApiRun
.
prototype
[
"
AddText
"
]
=
ApiRun
.
prototype
.
AddText
;
ApiRun
.
prototype
[
"
AddTabStop
"
]
=
ApiRun
.
prototype
.
AddTabStop
;
ApiTextPr
.
prototype
[
"
GetClassType
"
]
=
ApiTextPr
.
prototype
.
GetClassType
;
ApiTextPr
.
prototype
[
"
SetBold
"
]
=
ApiTextPr
.
prototype
.
SetBold
;
ApiTextPr
.
prototype
[
"
SetItalic
"
]
=
ApiTextPr
.
prototype
.
SetItalic
;
ApiTextPr
.
prototype
[
"
SetStrikeout
"
]
=
ApiTextPr
.
prototype
.
SetStrikeout
;
ApiTextPr
.
prototype
[
"
SetUnderline
"
]
=
ApiTextPr
.
prototype
.
SetUnderline
;
ApiTextPr
.
prototype
[
"
SetFontFamily
"
]
=
ApiTextPr
.
prototype
.
SetFontFamily
;
ApiTextPr
.
prototype
[
"
SetFontSize
"
]
=
ApiTextPr
.
prototype
.
SetFontSize
;
ApiTextPr
.
prototype
[
"
SetFill
"
]
=
ApiTextPr
.
prototype
.
SetFill
;
ApiTextPr
.
prototype
[
"
SetVertAlign
"
]
=
ApiTextPr
.
prototype
.
SetVertAlign
;
ApiTextPr
.
prototype
[
"
SetSpacing
"
]
=
ApiTextPr
.
prototype
.
SetSpacing
;
ApiTextPr
.
prototype
[
"
SetDoubleStrikeout
"
]
=
ApiTextPr
.
prototype
.
SetDoubleStrikeout
;
ApiTextPr
.
prototype
[
"
SetCaps
"
]
=
ApiTextPr
.
prototype
.
SetCaps
;
ApiTextPr
.
prototype
[
"
SetSmallCaps
"
]
=
ApiTextPr
.
prototype
.
SetSmallCaps
;
ApiParaPr
.
prototype
[
"
GetClassType
"
]
=
ApiParaPr
.
prototype
.
GetClassType
;
ApiParaPr
.
prototype
[
"
SetIndLeft
"
]
=
ApiParaPr
.
prototype
.
SetIndLeft
;
ApiParaPr
.
prototype
[
"
SetIndRight
"
]
=
ApiParaPr
.
prototype
.
SetIndRight
;
ApiParaPr
.
prototype
[
"
SetIndFirstLine
"
]
=
ApiParaPr
.
prototype
.
SetIndFirstLine
;
ApiParaPr
.
prototype
[
"
SetJc
"
]
=
ApiParaPr
.
prototype
.
SetJc
;
ApiParaPr
.
prototype
[
"
SetSpacingLine
"
]
=
ApiParaPr
.
prototype
.
SetSpacingLine
;
ApiParaPr
.
prototype
[
"
SetSpacingBefore
"
]
=
ApiParaPr
.
prototype
.
SetSpacingBefore
;
ApiParaPr
.
prototype
[
"
SetSpacingAfter
"
]
=
ApiParaPr
.
prototype
.
SetSpacingAfter
;
ApiParaPr
.
prototype
[
"
SetBullet
"
]
=
ApiParaPr
.
prototype
.
SetBullet
;
ApiDrawing
.
prototype
[
"
GetClassType
"
]
=
ApiDrawing
.
prototype
.
GetClassType
;
ApiDrawing
.
prototype
[
"
SetSize
"
]
=
ApiDrawing
.
prototype
.
SetSize
;
ApiDrawing
.
prototype
[
"
SetPosition
"
]
=
ApiDrawing
.
prototype
.
SetPosition
;
...
...
@@ -1692,20 +679,6 @@
ApiChart
.
prototype
[
"
SetLegendPos
"
]
=
ApiChart
.
prototype
.
SetLegendPos
;
ApiChart
.
prototype
[
"
SetShowDataLabels
"
]
=
ApiChart
.
prototype
.
SetShowDataLabels
;
ApiFill
.
prototype
[
"
GetClassType
"
]
=
ApiFill
.
prototype
.
GetClassType
;
ApiStroke
.
prototype
[
"
GetClassType
"
]
=
ApiStroke
.
prototype
.
GetClassType
;
ApiGradientStop
.
prototype
[
"
GetClassType
"
]
=
ApiGradientStop
.
prototype
.
GetClassType
;
ApiUniColor
.
prototype
[
"
GetClassType
"
]
=
ApiUniColor
.
prototype
.
GetClassType
;
ApiRGBColor
.
prototype
[
"
GetClassType
"
]
=
ApiRGBColor
.
prototype
.
GetClassType
;
ApiSchemeColor
.
prototype
[
"
GetClassType
"
]
=
ApiSchemeColor
.
prototype
.
GetClassType
;
ApiPresetColor
.
prototype
[
"
GetClassType
"
]
=
ApiPresetColor
.
prototype
.
GetClassType
;
function
private_GetCurrentSlide
(){
var
oApiPresentation
=
editor
.
GetPresentation
();
if
(
oApiPresentation
){
...
...
@@ -1724,75 +697,18 @@
return
null
;
}
function
private_PushElementToParagraph
(
oPara
,
oElement
)
{
// Добавляем не в конец из-за рана с символом конца параграфа TODO: ParaEnd
oPara
.
Add_ToContent
(
oPara
.
Content
.
length
-
1
,
oElement
);
}
function
private_GetPresentation
(){
return
editor
.
WordControl
.
m_oLogicDocument
;
}
function
private_Twips2MM
(
twips
)
{
return
25.4
/
72.0
/
20
*
twips
;
}
function
private_EMU2MM
(
EMU
)
{
return
EMU
/
36000.0
;
}
function
private_GetHps
(
hps
)
{
return
Math
.
ceil
(
hps
)
/
2.0
;
}
function
private_GetParaAlign
(
sJc
)
{
if
(
"
left
"
===
sJc
)
return
align_Left
;
else
if
(
"
right
"
===
sJc
)
return
align_Right
;
else
if
(
"
both
"
===
sJc
)
return
align_Justify
;
else
if
(
"
center
"
===
sJc
)
return
align_Center
;
return
undefined
;
function
private_GetApi
(){
return
editor
;
}
ApiParagraph
.
prototype
.
private_GetImpl
=
function
()
{
return
this
.
Paragraph
;
};
ApiParagraph
.
prototype
.
OnChangeParaPr
=
function
(
oApiParaPr
)
{
this
.
Paragraph
.
Set_Pr
(
oApiParaPr
.
ParaPr
);
oApiParaPr
.
ParaPr
=
this
.
Paragraph
.
Pr
.
Copy
();
};
ApiParagraph
.
prototype
.
OnChangeTextPr
=
function
(
oApiTextPr
)
{
this
.
Paragraph
.
TextPr
.
Set_Value
(
oApiTextPr
.
TextPr
);
oApiTextPr
.
TextPr
=
this
.
Paragraph
.
TextPr
.
Value
.
Copy
();
};
ApiRun
.
prototype
.
private_GetImpl
=
function
()
{
return
this
.
Run
;
};
ApiRun
.
prototype
.
OnChangeTextPr
=
function
(
oApiTextPr
)
{
this
.
Run
.
Set_Pr
(
oApiTextPr
.
TextPr
);
oApiTextPr
.
TextPr
=
this
.
Run
.
Pr
.
Copy
();
};
ApiTextPr
.
prototype
.
private_OnChange
=
function
()
{
this
.
Parent
.
OnChangeTextPr
(
this
);
};
ApiParaPr
.
prototype
.
private_OnChange
=
function
()
{
this
.
Parent
.
OnChangeParaPr
(
this
);
};
})(
window
,
null
);
word/apiBuilder.js
View file @
30622193
...
...
@@ -38,7 +38,7 @@
* @class
* @name Api
*/
var
Api
=
window
[
"
Asc
"
][
"
asc_docs_api
"
];
var
Api
=
window
[
"
Asc
"
][
"
asc_docs_api
"
]
||
window
[
"
Asc
"
][
"
spreadsheet_api
"
]
;
/**
* Class representing a container for paragraphs and tables.
...
...
@@ -71,6 +71,16 @@
this
.
ParaPr
=
ParaPr
;
}
/*
* Class representing paragraph bullet
* @constructor
* */
function
ApiBullet
(
Bullet
)
{
this
.
Bullet
=
Bullet
;
}
/**
* Class representing a paragraph.
* @constructor
...
...
@@ -347,7 +357,7 @@
*/
function
ApiStroke
(
oLn
)
{
this
.
Ln
=
oLn
;
this
.
Ln
=
oLn
;
}
...
...
@@ -861,17 +871,10 @@
*/
Api
.
prototype
.
CreateLinearGradientFill
=
function
(
aGradientStop
,
Angle
)
{
var
oUniFill
=
new
AscFormat
.
CUniFill
();
oUniFill
.
fill
=
new
AscFormat
.
CGradFill
();
for
(
var
i
=
0
;
i
<
aGradientStop
.
length
;
++
i
)
{
oUniFill
.
fill
.
colors
.
push
(
aGradientStop
[
i
].
Gs
);
}
oUniFill
.
fill
.
lin
=
new
AscFormat
.
GradLin
();
oUniFill
.
fill
.
lin
.
angle
=
Angle
;
return
new
ApiFill
(
oUniFill
);
return
new
ApiFill
(
AscFormat
.
builder_CreateLinearGradient
(
aGradientStop
,
Angle
));
};
/**
* Create a radial gradient fill
* @memberof Api
...
...
@@ -880,14 +883,7 @@
*/
Api
.
prototype
.
CreateRadialGradientFill
=
function
(
aGradientStop
)
{
var
oUniFill
=
new
AscFormat
.
CUniFill
();
oUniFill
.
fill
=
new
AscFormat
.
CGradFill
();
for
(
var
i
=
0
;
i
<
aGradientStop
.
length
;
++
i
)
{
oUniFill
.
fill
.
colors
.
push
(
aGradientStop
[
i
].
Gs
);
}
oUniFill
.
fill
.
path
=
new
AscFormat
.
GradPath
();
return
new
ApiFill
(
oUniFill
);
return
new
ApiFill
(
AscFormat
.
builder_CreateRadialGradient
(
aGradientStop
));
};
/**
...
...
@@ -898,14 +894,9 @@
* @param {ApiUniColor} FgColor
* @returns {ApiFill}
*/
Api
.
prototype
.
CreatePatternFill
=
function
(
sPatternType
,
BgColor
,
FgColor
)
Api
.
prototype
.
CreatePatternFill
=
function
(
sPatternType
,
BgColor
,
FgColor
)
{
var
oUniFill
=
new
AscFormat
.
CUniFill
();
oUniFill
.
fill
=
new
AscFormat
.
CPattFill
();
oUniFill
.
fill
.
ftype
=
AscCommon
.
global_hatch_offsets
[
sPatternType
];
oUniFill
.
fill
.
fgClr
=
FgColor
.
Unicolor
;
oUniFill
.
fill
.
bgClr
=
BgColor
.
Unicolor
;
return
new
ApiFill
(
oUniFill
);
return
new
ApiFill
(
AscFormat
.
builder_CreatePatternFill
(
sPatternType
,
BgColor
,
FgColor
));
};
/**
...
...
@@ -915,20 +906,9 @@
* @param {BlipFillType} sBlipFillType
* @returns {ApiFill}
* */
Api
.
prototype
.
CreateBlipFill
=
function
(
sImageUrl
,
sBlipFillType
)
{
var
oUniFill
=
new
AscFormat
.
CUniFill
();
oUniFill
.
fill
=
new
AscFormat
.
CBlipFill
();
oUniFill
.
fill
.
RasterImageId
=
sImageUrl
;
if
(
sBlipFillType
===
"
tile
"
)
Api
.
prototype
.
CreateBlipFill
=
function
(
sImageUrl
,
sBlipFillType
)
{
oUniFill
.
fill
.
tile
=
new
AscFormat
.
CBlipFillTile
();
}
else
if
(
sBlipFillType
===
"
stretch
"
)
{
oUniFill
.
fill
.
stretch
=
true
;
}
return
new
ApiFill
(
oUniFill
);
return
new
ApiFill
(
AscFormat
.
builder_CreateBlipFill
(
sImageUrl
,
sBlipFillType
));
};
/**
...
...
@@ -950,14 +930,7 @@
* */
Api
.
prototype
.
CreateStroke
=
function
(
nWidth
,
oFill
)
{
if
(
nWidth
===
0
)
{
return
new
ApiStroke
(
AscFormat
.
CreateNoFillLine
());
}
var
oLn
=
new
AscFormat
.
CLn
();
oLn
.
w
=
nWidth
;
oLn
.
Fill
=
oFill
.
UniFill
;
return
new
ApiStroke
(
oLn
);
return
new
ApiStroke
(
AscFormat
.
builder_CreateLine
(
nWidth
,
oFill
));
};
/**
...
...
@@ -972,6 +945,81 @@
return
new
ApiGradientStop
(
oUniColor
,
nPos
);
};
/**
* Create a new bullet
* @memberof Api
* @returns {ApiBullet}
* */
Api
.
CreateBullet
=
function
(
sSymbol
){
var
oBullet
=
new
AscFormat
.
CBullet
();
oBullet
.
bulletType
=
new
AscFormat
.
CBulletType
();
if
(
typeof
sSymbol
===
"
string
"
&&
sSymbol
.
length
>
0
){
oBullet
.
bulletType
.
type
=
AscFormat
.
BULLET_TYPE_BULLET_CHAR
;
oBullet
.
bulletType
.
Char
=
sSymbol
[
0
];
}
else
{
oBullet
.
bulletType
.
type
=
AscFormat
.
BULLET_TYPE_BULLET_NONE
;
}
};
/**
* Create a new numbering
* @memberof Api
* @param {BulletType} sType
* @param {number} nStartAt
* @returns {ApiBullet}
* */
Api
.
CreateNumbering
=
function
(
sType
,
nStartAt
){
var
oBullet
=
new
AscFormat
.
CBullet
();
oBullet
.
bulletType
=
new
AscFormat
.
CBulletType
();
oBullet
.
bulletType
.
type
=
AscFormat
.
BULLET_TYPE_BULLET_AUTONUM
;
switch
(
sType
){
case
"
ArabicPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
12
;
break
;
}
case
"
ArabicParenR
"
:{
oBullet
.
bulletType
.
AutoNumType
=
11
;
break
;
}
case
"
RomanUcPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
34
;
break
;
}
case
"
RomanLcPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
31
;
break
;
}
case
"
AlphaLcParenR
"
:{
oBullet
.
bulletType
.
AutoNumType
=
1
;
break
;
}
case
"
AlphaLcPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
2
;
break
;
}
case
"
AlphaUcParenR
"
:{
oBullet
.
bulletType
.
AutoNumType
=
4
;
break
;
}
case
"
AlphaUcPeriod
"
:{
oBullet
.
bulletType
.
AutoNumType
=
5
;
break
;
}
case
"
None
"
:{
oBullet
.
bulletType
.
type
=
AscFormat
.
BULLET_TYPE_BULLET_NONE
;
break
;
}
}
if
(
oBullet
.
bulletType
.
type
===
AscFormat
.
BULLET_TYPE_BULLET_AUTONUM
){
if
(
AscFormat
.
isRealNumber
(
nStartAt
)){
oBullet
.
bulletType
.
startAt
=
nStartAt
;
}
}
return
new
ApiBullet
(
oBullet
);
};
//------------------------------------------------------------------------------------------------------------------
//
...
...
@@ -2746,6 +2794,10 @@
this
.
private_OnChange
();
};
//------------------------------------------------------------------------------------------------------------------
//
// ApiNumbering
...
...
@@ -4726,4 +4778,11 @@
this
.
private_OnChange
();
};
Api
.
prototype
.
private_CreateApiParagraph
=
function
(
oParagraph
){
return
new
ApiParagraph
(
oParagraph
);
};
Api
.
prototype
.
private_CreateApiDocContent
=
function
(
oDocContent
){
return
new
ApiDocumentContent
(
oDocContent
);
};
}(
window
,
null
));
\ No newline at end of file
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