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
c30161db
Commit
c30161db
authored
May 23, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1244048c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
130 additions
and
28 deletions
+130
-28
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
+28
-0
ASCOfficePPTXFile/PPTXFormat/Logic/ExtP.h
ASCOfficePPTXFile/PPTXFormat/Logic/ExtP.h
+16
-2
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.cpp
+5
-0
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h
+4
-3
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
+1
-1
ASCOfficePPTXFile/PPTXFormat/Logic/Media/MediaFile.h
ASCOfficePPTXFile/PPTXFormat/Logic/Media/MediaFile.h
+17
-7
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
+44
-7
ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.h
ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.h
+5
-1
ASCOfficePPTXFile/PPTXFormat/Logic/UniMedia.h
ASCOfficePPTXFile/PPTXFormat/Logic/UniMedia.h
+2
-6
Common/DocxFormat/Source/DocxFormat/ContentTypes.h
Common/DocxFormat/Source/DocxFormat/ContentTypes.h
+8
-1
No files found.
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
View file @
c30161db
...
...
@@ -178,7 +178,13 @@ namespace NSBinPptxRW
std
::
map
<
std
::
wstring
,
_imageManager2Info
>::
const_iterator
pPair
=
m_mapImages
.
find
((
strBase64Image
.
empty
())
?
strInput
:
strBase64Image
);
if
(
pPair
!=
m_mapImages
.
end
())
{
smart_ptr
<
OOX
::
Media
>
mediaFile
=
additionalFile
.
smart_dynamic_cast
<
OOX
::
Media
>
();
if
(
mediaFile
.
IsInit
())
mediaFile
->
set_filename
(
pPair
->
second
.
sFilepathAdditional
);
return
pPair
->
second
;
}
std
::
wstring
strExts
=
_T
(
".jpg"
);
int
nIndexExt
=
(
int
)
strInput
.
rfind
(
wchar_t
(
'.'
));
...
...
@@ -1279,7 +1285,29 @@ namespace NSBinPptxRW
}
}
}
if
(
additionalFile
.
is
<
OOX
::
Media
>
())
{
smart_ptr
<
OOX
::
Media
>
mediaFile
=
additionalFile
.
smart_dynamic_cast
<
OOX
::
Media
>
();
std
::
wstring
strMediaRelsPath
;
oRelsGeneratorInfo
.
nMediaRId
=
m_lNextRelsID
++
;
oRelsGeneratorInfo
.
sFilepathOle
=
mediaFile
->
filename
().
GetPath
();
if
(
m_pManager
->
m_nDocumentType
!=
XMLWRITER_DOC_TYPE_XLSX
)
{
std
::
wstring
strRid
=
L"rId"
+
std
::
to_wstring
(
oRelsGeneratorInfo
.
nMediaRId
);
if
(
m_pManager
->
m_nDocumentType
==
XMLWRITER_DOC_TYPE_DOCX
)
strMediaRelsPath
=
L"media/"
;
else
strMediaRelsPath
=
L"../media/"
;
strMediaRelsPath
+=
mediaFile
->
filename
().
GetFilename
();
m_pWriter
->
WriteString
(
L"<Relationship Id=
\"
"
+
strRid
+
L"
\"
Type=
\"
http://schemas.microsoft.com/office/2007/relationships/media
\"
Target=
\"
"
+
strMediaRelsPath
+
L"
\"
/>"
);
}
}
m_mapImages
.
insert
(
std
::
pair
<
std
::
wstring
,
_relsGeneratorInfo
>
(
strImageRelsPath
,
oRelsGeneratorInfo
));
return
oRelsGeneratorInfo
;
}
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/ExtP.h
View file @
c30161db
...
...
@@ -165,12 +165,26 @@ namespace PPTX
XmlUtils
::
CAttribute
oAttr
;
XmlUtils
::
CNodeValue
oValue
;
return
XmlUtils
::
CreateNode
(
_T
(
"p:ext"
)
,
oValue
);
return
XmlUtils
::
CreateNode
(
L"p:ext"
,
oValue
);
}
virtual
void
toXmlWriter
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
{
// TODO:
if
(
link
.
IsInit
()
&&
uri
.
IsInit
())
{
pWriter
->
StartNode
(
L"p:ext"
);
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute
(
L"uri"
,
*
uri
);
pWriter
->
EndAttributes
();
pWriter
->
StartNode
(
L"p14:media"
);
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute
(
L"xmlns:p14"
,
std
::
wstring
(
L"http://schemas.microsoft.com/office/powerpoint/2010/main"
));
pWriter
->
WriteAttribute
(
L"r:embed"
,
link
->
get
());
pWriter
->
EndAttributes
();
pWriter
->
EndNode
(
L"p14:media"
);
pWriter
->
EndNode
(
L"p:ext"
);
}
}
virtual
void
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.cpp
View file @
c30161db
...
...
@@ -224,6 +224,11 @@ namespace PPTX
additionalPath
=
this
->
GetFullOleName
(
OOX
::
RId
(
oleRid
),
pRels
);
additionalType
=
1
;
}
else
if
(
!
mediaRid
.
empty
())
{
additionalPath
=
this
->
GetFullOleName
(
OOX
::
RId
(
mediaRid
),
pRels
);
additionalType
=
2
;
}
else
if
(
!
mediaFilepath
.
empty
())
{
additionalPath
=
mediaFilepath
;
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h
View file @
c30161db
...
...
@@ -67,6 +67,7 @@ namespace PPTX
oleRid
=
oSrc
.
oleRid
;
oleFilepathBin
=
oSrc
.
oleFilepathBin
;
mediaRid
=
oSrc
.
mediaRid
;
mediaFilepath
=
oSrc
.
mediaFilepath
;
return
*
this
;
...
...
@@ -100,11 +101,11 @@ namespace PPTX
nullable
<
OOX
::
RId
>
embed
;
nullable
<
OOX
::
RId
>
link
;
std
::
wstring
m_namespace
;
//internal
std
::
wstring
mediaRid
;
std
::
wstring
mediaFilepath
;
std
::
wstring
oleRid
;
std
::
wstring
mediaFilepath
;
//internal
std
::
wstring
oleFilepathBin
;
std
::
wstring
oleFilepathImage
;
protected:
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
View file @
c30161db
...
...
@@ -457,7 +457,7 @@ namespace PPTX
}
if
(
oRelsGeneratorInfo
.
nMediaRId
>
0
)
{
//blip->nMediaRId = OOX::RId((size_t)oRelsGeneratorInfo.nOle
RId).get();
blip
->
mediaRid
=
OOX
::
RId
((
size_t
)
oRelsGeneratorInfo
.
nMedia
RId
).
get
();
blip
->
mediaFilepath
=
oRelsGeneratorInfo
.
sFilepathMedia
;
}
pReader
->
Skip
(
1
);
// end attribute
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Media/MediaFile.h
View file @
c30161db
...
...
@@ -45,8 +45,9 @@ namespace PPTX
public:
WritingElement_AdditionConstructors
(
MediaFile
)
MediaFile
()
MediaFile
(
std
::
wstring
name_
)
{
name
=
name_
;
}
MediaFile
&
operator
=
(
const
MediaFile
&
oSrc
)
...
...
@@ -75,19 +76,28 @@ namespace PPTX
void
ReadAttributes
(
XmlUtils
::
CXmlLiteReader
&
oReader
)
{
WritingElement_ReadAttributes_Start
(
oReader
)
WritingElement_ReadAttributes_Read_if
(
oReader
,
_T
(
"r:link"
)
,
link
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
_T
(
"contentType"
)
,
contentType
)
WritingElement_ReadAttributes_Read_if
(
oReader
,
L"r:link"
,
link
)
WritingElement_ReadAttributes_Read_else_if
(
oReader
,
L"contentType"
,
contentType
)
WritingElement_ReadAttributes_End
(
oReader
)
}
virtual
std
::
wstring
toXML
()
const
{
XmlUtils
::
CAttribute
oAttr
;
oAttr
.
Write
(
_T
(
"r:link"
)
,
link
.
ToString
());
oAttr
.
Write
(
_T
(
"contentType"
)
,
contentType
);
oAttr
.
Write
(
L"r:link"
,
link
.
ToString
());
oAttr
.
Write
(
L"contentType"
,
contentType
);
return
XmlUtils
::
CreateNode
(
_T
(
"a:"
)
+
name
,
oAttr
);
return
XmlUtils
::
CreateNode
(
L"a:"
+
name
,
oAttr
);
}
public:
virtual
void
toXmlWriter
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
{
pWriter
->
StartNode
(
L"a:"
+
name
);
pWriter
->
StartAttributes
();
pWriter
->
WriteAttribute
(
L"r:link"
,
link
.
ToString
());
pWriter
->
WriteAttribute
(
L"contentType"
,
contentType
);
pWriter
->
EndAttributes
();
pWriter
->
EndNode
(
L"a:"
+
name
);
}
std
::
wstring
name
;
OOX
::
RId
link
;
nullable_string
contentType
;
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Pic.cpp
View file @
c30161db
...
...
@@ -832,16 +832,53 @@ namespace PPTX
}
}
}
if
(
blipFill
.
blip
.
IsInit
()
&&
!
blipFill
.
blip
->
oleRid
.
empty
()
&&
oleObject
.
IsInit
())
if
(
blipFill
.
blip
.
IsInit
()
&&
blipFill
.
additionalFile
.
IsInit
())
{
oleObject
->
m_oId
=
OOX
::
RId
(
blipFill
.
blip
->
oleRid
);
if
(
!
blipFill
.
blip
->
oleRid
.
empty
()
&&
oleObject
.
IsInit
())
{
oleObject
->
m_oId
=
OOX
::
RId
(
blipFill
.
blip
->
oleRid
);
if
(
oleObject
->
m_OleObjectFile
.
IsInit
()
==
false
)
if
(
oleObject
->
m_OleObjectFile
.
IsInit
()
==
false
)
{
oleObject
->
m_OleObjectFile
=
new
OOX
::
OleObject
(
false
,
pReader
->
m_nDocumentType
==
XMLWRITER_DOC_TYPE_DOCX
);
oleObject
->
m_OleObjectFile
->
set_filename
(
blipFill
.
blip
->
oleFilepathBin
);
oleObject
->
m_OleObjectFile
->
set_filename_cache
(
blipFill
.
blip
->
oleFilepathImage
);
}
}
if
(
!
blipFill
.
blip
->
mediaRid
.
empty
())
{
oleObject
->
m_OleObjectFile
=
new
OOX
::
OleObject
(
false
,
pReader
->
m_nDocumentType
==
XMLWRITER_DOC_TYPE_DOCX
);
oleObject
->
m_OleObjectFile
->
set_filename
(
blipFill
.
blip
->
oleFilepathBin
);
oleObject
->
m_OleObjectFile
->
set_filename_cache
(
blipFill
.
blip
->
oleFilepathImage
);
PPTX
::
Logic
::
Ext
ext
;
ext
.
link
=
OOX
::
RId
(
blipFill
.
blip
->
mediaRid
);
ext
.
uri
=
L"{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}"
;
nvPicPr
.
nvPr
.
extLst
.
push_back
(
ext
);
int
nRId
=
-
1
;
if
(
blipFill
.
additionalFile
.
is
<
OOX
::
Audio
>
())
{
nvPicPr
.
nvPr
.
media
.
Media
=
new
PPTX
::
Logic
::
MediaFile
(
L"audioFile"
);
nRId
=
pReader
->
m_pRels
->
WriteRels
(
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"
,
L"NULL"
,
L"External"
);
}
if
(
blipFill
.
additionalFile
.
is
<
OOX
::
Video
>
())
{
nvPicPr
.
nvPr
.
media
.
Media
=
new
PPTX
::
Logic
::
MediaFile
(
L"videoFile"
);
nRId
=
pReader
->
m_pRels
->
WriteRels
(
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"
,
L"NULL"
,
L"External"
);
}
if
(
nvPicPr
.
nvPr
.
media
.
Media
.
IsInit
()
&&
nRId
>
0
)
{
PPTX
::
Logic
::
MediaFile
&
mediaFile
=
nvPicPr
.
nvPr
.
media
.
Media
.
as
<
PPTX
::
Logic
::
MediaFile
>
();
mediaFile
.
link
=
OOX
::
RId
((
size_t
)
nRId
);
}
if
(
nvPicPr
.
cNvPr
.
hlinkClick
.
IsInit
()
==
false
)
nvPicPr
.
cNvPr
.
hlinkClick
.
Init
();
nvPicPr
.
cNvPr
.
hlinkClick
->
id
=
L""
;
nvPicPr
.
cNvPr
.
hlinkClick
->
action
=
L"ppaction://media"
;
}
}
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.h
View file @
c30161db
...
...
@@ -455,7 +455,11 @@ namespace PPTX
pFill
->
blip
->
oleRid
=
OOX
::
RId
((
size_t
)
oRelsGeneratorInfo
.
nOleRId
).
get
();
pFill
->
blip
->
oleFilepathBin
=
oRelsGeneratorInfo
.
sFilepathOle
;
}
if
(
oRelsGeneratorInfo
.
nMediaRId
>
0
)
{
pFill
->
blip
->
mediaRid
=
OOX
::
RId
((
size_t
)
oRelsGeneratorInfo
.
nMediaRId
).
get
();
pFill
->
blip
->
mediaFilepath
=
oRelsGeneratorInfo
.
sFilepathMedia
;
}
pReader
->
Skip
(
1
);
// end attribute
break
;
}
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/UniMedia.h
View file @
c30161db
...
...
@@ -107,16 +107,13 @@ namespace PPTX
return
Media
->
toXML
();
return
_T
(
""
);
}
virtual
void
toPPTY
(
NSBinPptxRW
::
CBinaryFileWriter
*
pWriter
)
const
{
// TODO:
}
virtual
void
to
PPTY
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
virtual
void
to
XmlWriter
(
NSBinPptxRW
::
CXmlWriter
*
pWriter
)
const
{
// TODO:
if
(
Media
.
is_init
())
Media
->
toXmlWriter
(
pWriter
);
}
...
...
@@ -126,8 +123,7 @@ namespace PPTX
template
<
class
T
>
AVSINLINE
const
bool
is
()
const
{
return
Media
.
is
<
T
>
();
}
template
<
class
T
>
AVSINLINE
T
&
as
()
{
return
Media
.
as
<
T
>
();
}
template
<
class
T
>
AVSINLINE
const
T
&
as
()
const
{
return
Media
.
as
<
T
>
();
}
//public:
private:
smart_ptr
<
WrapperWritingElement
>
Media
;
protected:
virtual
void
FillParentPointersForChilds
(){};
...
...
Common/DocxFormat/Source/DocxFormat/ContentTypes.h
View file @
c30161db
...
...
@@ -66,7 +66,14 @@ namespace OOX
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"wmf"
),
_T
(
"image/x-wmf"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"svm"
),
_T
(
"image/svm"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"wav"
),
_T
(
"audio/wav"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"xls"
),
_T
(
"application/vnd.ms-excel"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"wma"
),
_T
(
"audio/x-wma"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"m4a"
),
_T
(
"audio/unknown"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"mp3"
),
_T
(
"audio/mpeg"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"mp4"
),
_T
(
"video/unknown"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"mov"
),
_T
(
"video/unknown"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"avi"
),
_T
(
"video/avi"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"wmv"
),
_T
(
"video/x-wmv"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"xls"
),
_T
(
"application/vnd.ms-excel"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"xlsm"
),
_T
(
"application/vnd.ms-excel.sheet.macroEnabled.12"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"xlsb"
),
_T
(
"application/vnd.ms-excel.sheet.binary.macroEnabled.12"
)));
m_mTable
.
insert
(
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
_T
(
"xlsx"
),
_T
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)));
...
...
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