Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
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
onlyoffice_core
Commits
846caf6b
Commit
846caf6b
authored
Apr 10, 2016
by
ElenaSubbotina
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormat - embedded docx elements as docx (xml) parts
parent
854b70ae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
6 deletions
+34
-6
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
+3
-0
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
+17
-4
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
+13
-2
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h
+1
-0
No files found.
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
View file @
846caf6b
...
...
@@ -28,6 +28,8 @@ namespace OpenXmlContentTypes
static
const
TCHAR
*
Vml
=
_T
(
"application/vnd.openxmlformats-officedocument.vmlDrawing"
);
static
const
TCHAR
*
Drawing
=
_T
(
"application/vnd.openxmlformats-officedocument.drawing+xml"
);
static
const
TCHAR
*
MSWordDocx
=
_T
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
);
static
const
TCHAR
*
MSExcel
=
_T
(
"application/vnd.ms-excel"
);
static
const
TCHAR
*
MSWord
=
_T
(
"application/msword"
);
static
const
TCHAR
*
MSPowerpoint
=
_T
(
"application/vnd.ms-powerpoint"
);
...
...
@@ -124,6 +126,7 @@ namespace OpenXmlRelationshipTypes
static
const
TCHAR
*
Image
=
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
);
static
const
TCHAR
*
OleObject
=
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
);
static
const
TCHAR
*
GlossaryDocument
=
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"
);
static
const
TCHAR
*
Package
=
_T
(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"
);
}
namespace
MicrosoftWordRelationshipTypes
...
...
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
View file @
846caf6b
...
...
@@ -35,7 +35,9 @@ namespace DocFileFormat
//type
if
(
ole
->
fLinked
)
{
int
relID
=
m_context
->
_docx
->
RegisterExternalOLEObject
(
_caller
,
ole
->
ClipboardFormat
,
ole
->
Link
);
int
relID
=
-
1
;
m_context
->
_docx
->
RegisterExternalOLEObject
(
_caller
,
ole
->
ClipboardFormat
,
ole
->
Link
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"r:id"
),
(
wstring
(
_T
(
"rId"
)
)
+
FormatUtils
::
IntToWideString
(
relID
)
).
c_str
()
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"Type"
),
_T
(
"Link"
)
);
...
...
@@ -43,7 +45,11 @@ namespace DocFileFormat
}
else
{
int
relID
=
m_context
->
_docx
->
RegisterOLEObject
(
_caller
,
ole
->
ClipboardFormat
);
int
relID
=
-
1
;
if
(
ole
->
isEquation
||
ole
->
isEmbedded
)
relID
=
m_context
->
_docx
->
RegisterPackage
(
_caller
,
ole
->
ClipboardFormat
);
else
relID
=
m_context
->
_docx
->
RegisterOLEObject
(
_caller
,
ole
->
ClipboardFormat
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"r:id"
),
(
wstring
(
_T
(
"rId"
)
)
+
FormatUtils
::
IntToWideString
(
relID
)
).
c_str
()
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"Type"
),
_T
(
"Embed"
)
);
...
...
@@ -86,7 +92,7 @@ namespace DocFileFormat
{
objectExt
=
_T
(
".ppt"
);
}
else
if
(
objectType
==
_T
(
"MSWordDocx"
)
)
//???
else
if
(
objectType
==
_T
(
"MSWordDocx"
)
)
{
objectExt
=
_T
(
".docx"
);
}
...
...
@@ -113,7 +119,14 @@ namespace DocFileFormat
{
objectContentType
=
OpenXmlContentTypes
::
MSPowerpoint
;
}
else
if
(
objectType
==
_T
(
"MSWordDocx"
)
)
{
objectContentType
=
OpenXmlContentTypes
::
MSWordDocx
;
}
else
if
(
objectType
==
_T
(
"Equation"
)
)
{
objectContentType
=
OpenXmlContentTypes
::
Xml
;
}
return
objectContentType
;
}
...
...
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
View file @
846caf6b
...
...
@@ -364,7 +364,14 @@ namespace DocFileFormat
return
AddPart
(
mapping
,
_T
(
"word"
),
fileName
,
OleObjectMapping
::
GetContentType
(
objectType
),
OpenXmlRelationshipTypes
::
OleObject
);
}
int
OpenXmlPackage
::
RegisterPackage
(
const
IMapping
*
mapping
,
const
std
::
wstring
&
objectType
)
{
std
::
wstring
fileName
=
(
std
::
wstring
(
_T
(
"embeddings/oleObject"
)
)
+
FormatUtils
::
IntToWideString
(
++
_oleCounter
)
+
OleObjectMapping
::
GetTargetExt
(
objectType
));
DocumentContentTypesFile
.
_defaultTypes
.
insert
(
make_pair
(
OleObjectMapping
::
GetTargetExt
(
objectType
).
erase
(
0
,
1
),
OleObjectMapping
::
GetContentType
(
objectType
)));
return
AddPart
(
mapping
,
_T
(
"word"
),
fileName
,
OleObjectMapping
::
GetContentType
(
objectType
),
OpenXmlRelationshipTypes
::
Package
);
}
int
OpenXmlPackage
::
RegisterExternalOLEObject
(
const
IMapping
*
mapping
,
const
std
::
wstring
&
objectType
,
const
std
::
wstring
&
uri
)
{
std
::
wstring
fullUri
=
std
::
wstring
(
_T
(
"file:///"
))
+
uri
;
...
...
@@ -377,8 +384,12 @@ namespace DocFileFormat
int
OpenXmlPackage
::
AddPart
(
const
std
::
wstring
&
packageDir
,
const
std
::
wstring
&
fileName
,
const
std
::
wstring
&
contentType
,
const
std
::
wstring
&
relationshipType
,
const
std
::
wstring
&
targetMode
)
{
if
(
(
contentType
!=
_T
(
""
)
)
&&
(
contentType
!=
OpenXmlContentTypes
::
OleObject
)
&&
(
contentType
!=
OpenXmlContentTypes
::
MSExcel
)
&&
(
contentType
!=
OpenXmlContentTypes
::
MSWord
)
&&
if
((
contentType
!=
_T
(
""
)
)
&&
(
contentType
!=
OpenXmlContentTypes
::
Xml
)
&&
(
contentType
!=
OpenXmlContentTypes
::
MSWordDocx
)
&&
(
contentType
!=
OpenXmlContentTypes
::
OleObject
)
&&
(
contentType
!=
OpenXmlContentTypes
::
MSExcel
)
&&
(
contentType
!=
OpenXmlContentTypes
::
MSWord
)
&&
(
contentType
!=
OpenXmlContentTypes
::
MSPowerpoint
)
)
{
std
::
wstring
partOverride
;
...
...
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h
View file @
846caf6b
...
...
@@ -147,6 +147,7 @@ namespace DocFileFormat
int
RegisterComments
();
int
RegisterImage
(
const
IMapping
*
mapping
,
Global
::
BlipType
blipType
);
int
RegisterOLEObject
(
const
IMapping
*
mapping
,
const
wstring
&
objectType
);
int
RegisterPackage
(
const
IMapping
*
mapping
,
const
std
::
wstring
&
objectType
);
int
RegisterExternalOLEObject
(
const
IMapping
*
mapping
,
const
wstring
&
objectType
,
const
wstring
&
uri
);
};
}
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