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
5497b611
Commit
5497b611
authored
May 23, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
работа с оле объектами
parent
7cc488b2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
62 deletions
+96
-62
common/Drawings/TrackObjects/ResizeTracks.js
common/Drawings/TrackObjects/ResizeTracks.js
+6
-10
common/apiBase.js
common/apiBase.js
+7
-4
common/commonDefines.js
common/commonDefines.js
+3
-0
common/plugins.js
common/plugins.js
+74
-44
word/Editor/Document.js
word/Editor/Document.js
+4
-2
word/Editor/DocumentContent.js
word/Editor/DocumentContent.js
+1
-1
word/Editor/GraphicObjects/GraphicObjects.js
word/Editor/GraphicObjects/GraphicObjects.js
+1
-1
No files found.
common/Drawings/TrackObjects/ResizeTracks.js
View file @
5497b611
...
...
@@ -847,19 +847,15 @@ function ResizeTrackShapeImage(originalObject, cardDirection)
}
if
(
this
.
originalObject
.
getObjectType
&&
this
.
originalObject
.
getObjectType
()
===
AscDFH
.
historyitem_type_OleObject
)
{
var
api
;
if
(
Asc
.
editor
)
{
api
=
Asc
.
editor
;
}
var
api
=
window
.
editor
||
window
.
Asc
.
editor
;
if
(
api
)
{
var
pluginData
=
new
Asc
.
CPluginData
();
pluginData
.
setAttribute
(
"
data
"
,
this
.
originalObjec
.
m_sData
);
pluginData
.
setAttribute
(
"
guid
"
,
this
.
originalObjec
.
m_sApplicationId
);
pluginData
.
setAttribute
(
"
width
"
,
this
.
originalObjec
.
extX
);
pluginData
.
setAttribute
(
"
height
"
,
this
.
originalObjec
.
extY
);
pluginData
.
setAttribute
(
"
objectId
"
,
this
.
originalObjec
.
Get_Id
());
pluginData
.
setAttribute
(
"
data
"
,
this
.
originalObjec
t
.
m_sData
);
pluginData
.
setAttribute
(
"
guid
"
,
this
.
originalObjec
t
.
m_sApplicationId
);
pluginData
.
setAttribute
(
"
width
"
,
xfrm
.
extX
);
pluginData
.
setAttribute
(
"
height
"
,
xfrm
.
extY
);
pluginData
.
setAttribute
(
"
objectId
"
,
this
.
originalObjec
t
.
Get_Id
());
api
.
asc_pluginResize
(
pluginData
);
}
}
...
...
common/apiBase.js
View file @
5497b611
...
...
@@ -608,6 +608,7 @@ baseEditorsApi.prototype._uploadCallback = function(error, files) {
};
baseEditorsApi
.
prototype
.
asc_addOleObject
=
function
(
oPluginData
){
Asc
.
CPluginData_wrap
(
oPluginData
);
var
oThis
=
this
;
var
oThis
=
this
;
var
sImgSrc
=
oPluginData
.
getAttribute
(
"
imgSrc
"
);
...
...
@@ -625,8 +626,10 @@ baseEditorsApi.prototype._uploadCallback = function(error, files) {
this
.
asc_checkImageUrlAndAction
(
sImgSrc
,
function
(
oImage
){
oThis
.
asc_addOleObjectAction
(
AscCommon
.
g_oDocumentUrls
.
getImageLocal
(
oImage
.
src
),
sData
,
sGuid
,
fWidth
,
fHeight
,
nWidthPix
,
nHeightPix
);});
};
baseEditorsApi
.
prototype
.
asc_editOleObject
=
function
(
bResize
,
oPluginData
){
baseEditorsApi
.
prototype
.
asc_editOleObject
=
function
(
oPluginData
){
Asc
.
CPluginData_wrap
(
oPluginData
);
var
oThis
=
this
;
var
bResize
=
oPluginData
.
getAttribute
(
"
resize
"
);
var
sImgSrc
=
oPluginData
.
getAttribute
(
"
imgSrc
"
);
var
oOleObject
=
AscCommon
.
g_oTableId
.
Get_ById
(
oPluginData
.
getAttribute
(
"
objectId
"
));
var
nWidthPix
=
oPluginData
.
getAttribute
(
"
widthPix
"
);
...
...
@@ -717,10 +720,10 @@ baseEditorsApi.prototype.asc_pluginsRegister = function(basePath, plugins)
if
(
null
!=
this
.
pluginsManager
)
this
.
pluginsManager
.
register
(
basePath
,
plugins
);
};
baseEditorsApi
.
prototype
.
asc_pluginRun
=
function
(
variation
,
pluginData
)
baseEditorsApi
.
prototype
.
asc_pluginRun
=
function
(
guid
,
variation
,
pluginData
)
{
if
(
null
!=
this
.
pluginsManager
)
this
.
pluginsManager
.
run
(
variation
,
pluginData
);
this
.
pluginsManager
.
run
(
guid
,
variation
,
pluginData
);
};
baseEditorsApi
.
prototype
.
asc_pluginResize
=
function
(
pluginData
)
{
...
...
common/commonDefines.js
View file @
5497b611
...
...
@@ -1471,6 +1471,7 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
{
this
.
description
=
""
;
this
.
url
=
""
;
this
.
baseUrl
=
""
;
this
.
index
=
0
;
// сверху не выставляем. оттуда в каком порядке пришли - в таком порядке и работают
this
.
icons
=
[
"
1x
"
,
"
2x
"
];
...
...
@@ -1493,6 +1494,8 @@ window['Asc']['c_oAscMaxCellOrCommentLength'] = window['Asc'].c_oAscMaxCellOrCom
CPluginVariation
.
prototype
[
"
set_Description
"
]
=
function
(
value
)
{
this
.
description
=
value
;
}
;
CPluginVariation
.
prototype
[
"
get_Url
"
]
=
function
()
{
return
this
.
url
;
};
CPluginVariation
.
prototype
[
"
set_Url
"
]
=
function
(
value
)
{
this
.
url
=
value
;
};
CPluginVariation
.
prototype
[
"
get_BaseUrl
"
]
=
function
()
{
return
this
.
baseUrl
;
};
CPluginVariation
.
prototype
[
"
set_BaseUrl
"
]
=
function
(
value
)
{
this
.
baseUrl
=
value
;
};
CPluginVariation
.
prototype
[
"
get_Icons
"
]
=
function
()
{
return
this
.
icons
;
};
CPluginVariation
.
prototype
[
"
set_Icons
"
]
=
function
(
value
)
{
this
.
icons
=
value
;
};
...
...
common/plugins.js
View file @
5497b611
...
...
@@ -95,12 +95,15 @@
this
.
correctData
(
this
.
startData
);
this
.
show
();
},
runResize
:
function
(
guid
,
data
,
width
,
height
)
runResize
:
function
(
data
)
{
data
.
setAttribute
(
"
resize
"
,
true
);
return
this
.
run
(
data
.
getAttribute
(
"
guid
"
),
0
,
data
);
},
close
:
function
()
{
if
(
!
this
.
current
.
variations
[
0
].
isVisual
)
{
if
(
true
)
{
var
_div
=
document
.
getElementById
(
"
plugin_iframe
"
);
if
(
_div
)
_div
.
parentNode
.
removeChild
(
_div
);
...
...
@@ -117,7 +120,7 @@
show
:
function
()
{
if
(
this
.
current
.
variations
[
0
].
isVisual
)
if
(
this
.
current
.
variations
[
0
].
isVisual
&&
this
.
startData
.
getAttribute
(
"
resize
"
)
!==
true
)
{
this
.
api
.
asc_fireCallback
(
"
asc_onPluginShow
"
,
this
.
current
);
}
...
...
@@ -126,7 +129,8 @@
var
ifr
=
document
.
createElement
(
"
iframe
"
);
ifr
.
name
=
"
plugin_iframe
"
;
ifr
.
id
=
"
plugin_iframe
"
;
ifr
.
src
=
this
.
path
+
this
.
current
.
variations
[
0
].
url
;
var
_add
=
this
.
current
.
variations
[
0
].
baseUrl
==
""
?
this
.
path
:
this
.
current
.
variations
[
0
].
baseUrl
;
ifr
.
src
=
_add
+
this
.
current
.
variations
[
0
].
url
;
ifr
.
style
.
position
=
'
absolute
'
;
ifr
.
style
.
top
=
'
-100px
'
;
ifr
.
style
.
left
=
'
0px
'
;
...
...
@@ -192,6 +196,51 @@
if
(
undefined
==
pluginData
.
getAttribute
(
"
data
"
))
pluginData
.
setAttribute
(
"
data
"
,
""
);
},
loadExtensionPlugins
:
function
(
_plugins
)
{
if
(
!
_plugins
||
_plugins
.
length
<
1
)
return
;
var
_map
=
{};
for
(
var
i
=
0
;
i
<
this
.
plugins
.
length
;
i
++
)
_map
[
this
.
plugins
[
i
].
guid
]
=
true
;
for
(
var
i
=
0
;
i
<
_plugins
.
length
;
i
++
)
{
var
_p
=
new
Asc
.
CPlugin
();
_p
.
name
=
_plugins
[
i
].
name
;
_p
.
guid
=
_plugins
[
i
].
guid
;
if
(
_map
[
_p
.
guid
]
===
true
)
continue
;
for
(
var
j
=
0
;
j
<
_plugins
[
i
].
variations
.
length
;
j
++
)
{
var
_pv
=
new
Asc
.
CPluginVariation
();
for
(
var
k
in
_plugins
[
i
].
variations
[
j
])
{
_pv
[
k
]
=
_plugins
[
i
].
variations
[
j
][
k
];
}
_p
.
variations
.
push
(
_pv
);
}
this
.
plugins
.
push
(
_p
);
}
// добавляем кнопки (тест)
var
_elem
=
document
.
getElementById
(
"
view-left-menu
"
).
childNodes
[
1
];
for
(
var
i
=
0
;
i
<
_plugins
.
length
;
i
++
)
{
var
_button
=
"
<button class='btn btn-category' content-target='' data-toggle='tooltip' data-original-title='' title=''
"
+
"
onclick='window.g_asc_plugins.run(
\"
"
+
_plugins
[
i
].
guid
+
"
\"
)'><span>
"
+
(
i
+
1
)
+
"
</span></button>
"
;
_elem
.
innerHTML
+=
_button
;
}
}
};
...
...
@@ -256,10 +305,25 @@
window
.
g_asc_plugins
.
api
=
api
;
window
.
g_asc_plugins
[
"
api
"
]
=
window
.
g_asc_plugins
.
api
;
window
.
g_asc_plugins
.
api
.
asc_registerCallback
(
'
asc_onDocumentContentReady
'
,
function
(){
setTimeout
(
function
(){
window
.
g_asc_plugins
.
loadExtensionPlugins
(
window
[
"
Asc
"
][
"
extensionPlugins
"
]);
},
10
);
});
return
window
.
g_asc_plugins
;
};
window
[
"
Asc
"
].
CPluginData
=
CPluginData
;
window
[
"
Asc
"
].
CPluginData_wrap
=
function
(
obj
)
{
if
(
!
obj
.
getAttribute
)
obj
.
getAttribute
=
function
(
name
)
{
return
this
[
name
];
}
if
(
!
obj
.
setAttribute
)
obj
.
setAttribute
=
function
(
name
,
value
)
{
return
this
[
name
]
=
value
;
}
};
})(
window
,
undefined
);
// потом удалить!!!
...
...
@@ -268,7 +332,7 @@ function TEST_PLUGINS()
var
_plugins
=
[
{
name
:
"
chess (fen)
"
,
guid
:
"
{FFE1F462-1EA2-4391-990D-4CC84940B754}
"
,
guid
:
"
asc.
{FFE1F462-1EA2-4391-990D-4CC84940B754}
"
,
variations
:
[
{
...
...
@@ -295,7 +359,7 @@ function TEST_PLUGINS()
},
{
name
:
"
glavred
"
,
guid
:
"
{B631E142-E40B-4B4C-90B9-2D00222A286E}
"
,
guid
:
"
asc.
{B631E142-E40B-4B4C-90B9-2D00222A286E}
"
,
variations
:
[
{
...
...
@@ -321,7 +385,7 @@ function TEST_PLUGINS()
},
{
name
:
"
bold
"
,
guid
:
"
{14E46CC2-5E56-429C-9D55-1032B596D928}
"
,
guid
:
"
asc.
{14E46CC2-5E56-429C-9D55-1032B596D928}
"
,
variations
:
[
{
...
...
@@ -347,7 +411,7 @@ function TEST_PLUGINS()
},
{
name
:
"
speech
"
,
guid
:
"
{D71C2EF0-F15B-47C7-80E9-86D671F9C595}
"
,
guid
:
"
asc.
{D71C2EF0-F15B-47C7-80E9-86D671F9C595}
"
,
variations
:
[
{
...
...
@@ -373,7 +437,7 @@ function TEST_PLUGINS()
},
{
name
:
"
youtube
"
,
guid
:
"
{38E022EA-AD92-45FC-B22B-49DF39746DB4}
"
,
guid
:
"
asc.
{38E022EA-AD92-45FC-B22B-49DF39746DB4}
"
,
variations
:
[
{
...
...
@@ -400,39 +464,5 @@ function TEST_PLUGINS()
}
];
var
_pluginsNatural
=
[];
for
(
var
i
=
0
;
i
<
_plugins
.
length
;
i
++
)
{
var
_p
=
new
Asc
.
CPlugin
();
_p
.
name
=
_plugins
[
i
].
name
;
_p
.
guid
=
_plugins
[
i
].
guid
;
for
(
var
j
=
0
;
j
<
_plugins
[
i
].
variations
.
length
;
j
++
)
{
var
_pv
=
new
Asc
.
CPluginVariation
();
for
(
var
k
in
_plugins
[
i
].
variations
[
j
])
{
_pv
[
k
]
=
_plugins
[
i
].
variations
[
j
][
k
];
}
_p
.
variations
.
push
(
_pv
);
}
_pluginsNatural
.
push
(
_p
);
}
window
.
g_asc_plugins
.
api
.
asc_pluginsRegister
(
"
../../../../sdkjs-plugins/
"
,
_pluginsNatural
);
// добавляем кнопки (тест)
var
_elem
=
document
.
getElementById
(
"
view-left-menu
"
).
childNodes
[
1
];
for
(
var
i
=
0
;
i
<
_plugins
.
length
;
i
++
)
{
var
_button
=
"
<button class='btn btn-category' content-target='' data-toggle='tooltip' data-original-title='' title=''
"
+
"
onclick='window.g_asc_plugins.run(
\"
"
+
_plugins
[
i
].
guid
+
"
\"
)'><span>
"
+
(
i
+
1
)
+
"
</span></button>
"
;
_elem
.
innerHTML
+=
_button
;
}
window
.
g_asc_plugins
.
loadExtensionPlugins
(
_plugins
);
}
word/Editor/Document.js
View file @
5497b611
...
...
@@ -4041,7 +4041,7 @@ CDocument.prototype.Add_OleObject = function(W, H, nWidthPix, nHeig
var
Item
=
this
.
Content
[
this
.
CurPos
.
ContentPos
];
if
(
type_Paragraph
==
Item
.
GetType
())
{
var
Drawing
=
new
ParaDrawing
(
W
,
H
,
n
WidthPix
,
nHeightPix
,
n
ull
,
this
.
DrawingDocument
,
this
,
null
);
var
Drawing
=
new
ParaDrawing
(
W
,
H
,
null
,
this
.
DrawingDocument
,
this
,
null
);
var
Image
=
this
.
DrawingObjects
.
createOleObject
(
Data
,
sApplicationId
,
Img
,
0
,
0
,
W
,
H
,
nWidthPix
,
nHeightPix
);
Image
.
setParent
(
Drawing
);
Drawing
.
Set_GraphicObject
(
Image
);
...
...
@@ -4058,7 +4058,9 @@ CDocument.prototype.Add_OleObject = function(W, H, nWidthPix, nHeig
CDocument
.
prototype
.
Edit_OleObject
=
function
(
oOleObject
,
sData
,
sImageUrl
,
nPixWidth
,
nPixHeight
)
{
oOleObject
.
setData
(
sData
);
oOleObject
.
setRasterImageId
(
sImageUrl
);
var
_blipFill
=
new
AscFormat
.
CBlipFill
();
_blipFill
.
RasterImageId
=
sImageUrl
;
oOleObject
.
setBlipFill
(
_blipFill
);
oOleObject
.
setPixSizes
(
nPixWidth
,
nPixHeight
);
};
...
...
word/Editor/DocumentContent.js
View file @
5497b611
...
...
@@ -2270,7 +2270,7 @@ CDocumentContent.prototype.Add_OleObject = function(W, H, nWi
var
Item
=
this
.
Content
[
this
.
CurPos
.
ContentPos
];
if
(
type_Paragraph
==
Item
.
GetType
())
{
var
Drawing
=
new
ParaDrawing
(
W
,
H
,
n
WidthPix
,
nHeightPix
,
n
ull
,
this
.
DrawingDocument
,
this
,
null
);
var
Drawing
=
new
ParaDrawing
(
W
,
H
,
null
,
this
.
DrawingDocument
,
this
,
null
);
var
Image
=
this
.
DrawingObjects
.
createOleObject
(
Data
,
sApplicationId
,
Img
,
0
,
0
,
W
,
H
,
nWidthPix
,
nHeightPix
);
Image
.
setParent
(
Drawing
);
Drawing
.
Set_GraphicObject
(
Image
);
...
...
word/Editor/GraphicObjects/GraphicObjects.js
View file @
5497b611
...
...
@@ -1229,7 +1229,7 @@ CGraphicObjects.prototype =
pluginData
.
setAttribute
(
"
height
"
,
oleObject
.
extY
);
pluginData
.
setAttribute
(
"
widthPix
"
,
oleObject
.
m_nPixWidth
);
pluginData
.
setAttribute
(
"
heightPix
"
,
oleObject
.
m_nPixHeight
);
editor
.
asc_pluginRun
(
0
,
pluginData
);
editor
.
asc_pluginRun
(
oleObject
.
m_sApplicationId
,
0
,
pluginData
);
}
this
.
changeCurrentState
(
new
AscFormat
.
NullState
(
this
));
this
.
document
.
OnMouseUp
(
e
,
x
,
y
,
pageIndex
);
...
...
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