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
ce19969b
Commit
ce19969b
authored
Jun 01, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PptxFormat - fix objects without replacement image
parent
e9805cef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
25 deletions
+39
-25
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
+35
-24
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
+4
-1
No files found.
ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp
View file @
ce19969b
...
@@ -346,8 +346,11 @@ namespace NSBinPptxRW
...
@@ -346,8 +346,11 @@ namespace NSBinPptxRW
{
{
oPathOutput
=
m_strDstMedia
+
FILE_SEPARATOR_STR
+
strImage
+
strExts
;
oPathOutput
=
m_strDstMedia
+
FILE_SEPARATOR_STR
+
strImage
+
strExts
;
if
(
oPathOutput
.
GetPath
()
!=
strInput
)
if
(
oPathOutput
.
GetPath
()
!=
strInput
&&
NSFile
::
CFileBinary
::
Exists
(
strInput
))
CDirectory
::
CopyFile
(
strInput
,
oPathOutput
.
GetPath
());
{
NSFile
::
CFileBinary
::
Copy
(
strInput
,
oPathOutput
.
GetPath
());
oImageManagerInfo
.
sFilepathImage
=
oPathOutput
.
GetPath
();
}
}
}
else
else
{
{
...
@@ -355,8 +358,8 @@ namespace NSBinPptxRW
...
@@ -355,8 +358,8 @@ namespace NSBinPptxRW
strExts
=
_T
(
".png"
);
strExts
=
_T
(
".png"
);
oPathOutput
=
m_strDstMedia
+
FILE_SEPARATOR_STR
+
strImage
+
strExts
;
oPathOutput
=
m_strDstMedia
+
FILE_SEPARATOR_STR
+
strImage
+
strExts
;
SaveImageAsPng
(
strInput
,
oPathOutput
.
GetPath
());
SaveImageAsPng
(
strInput
,
oPathOutput
.
GetPath
());
oImageManagerInfo
.
sFilepathImage
=
oPathOutput
.
GetPath
();
}
}
oImageManagerInfo
.
sFilepathImage
=
oPathOutput
.
GetPath
();
if
((
!
strAdditionalImage
.
empty
()
||
!
oleData
.
empty
()
)
&&
(
nAdditionalType
==
1
))
if
((
!
strAdditionalImage
.
empty
()
||
!
oleData
.
empty
()
)
&&
(
nAdditionalType
==
1
))
{
{
...
@@ -374,13 +377,14 @@ namespace NSBinPptxRW
...
@@ -374,13 +377,14 @@ namespace NSBinPptxRW
if
(
!
oleData
.
empty
())
if
(
!
oleData
.
empty
())
{
{
WriteOleData
(
strAdditionalImageOut
,
oleData
);
WriteOleData
(
strAdditionalImageOut
,
oleData
);
oImageManagerInfo
.
sFilepathAdditional
=
strAdditionalImageOut
;
}
}
else
else
if
(
NSFile
::
CFileBinary
::
Exists
(
strAdditionalImage
))
{
{
CDirectory
::
CopyFile
(
strAdditionalImage
,
strAdditionalImageOut
);
NSFile
::
CFileBinary
::
Copy
(
strAdditionalImage
,
strAdditionalImageOut
);
oImageManagerInfo
.
sFilepathAdditional
=
strAdditionalImageOut
;
}
}
oImageManagerInfo
.
sFilepathAdditional
=
strAdditionalImageOut
;
}
}
else
if
(
!
strAdditionalImage
.
empty
()
&&
nAdditionalType
==
2
)
else
if
(
!
strAdditionalImage
.
empty
()
&&
nAdditionalType
==
2
)
{
{
...
@@ -395,8 +399,11 @@ namespace NSBinPptxRW
...
@@ -395,8 +399,11 @@ namespace NSBinPptxRW
std
::
wstring
strAdditionalImageOut
=
pathOutput
.
GetPath
();
std
::
wstring
strAdditionalImageOut
=
pathOutput
.
GetPath
();
CDirectory
::
CopyFile
(
strAdditionalImage
,
strAdditionalImageOut
);
if
(
NSFile
::
CFileBinary
::
Exists
(
strAdditionalImage
))
oImageManagerInfo
.
sFilepathAdditional
=
strAdditionalImageOut
;
{
NSFile
::
CFileBinary
::
Copy
(
strAdditionalImage
,
strAdditionalImageOut
);
oImageManagerInfo
.
sFilepathAdditional
=
strAdditionalImageOut
;
}
}
}
return
oImageManagerInfo
;
return
oImageManagerInfo
;
...
@@ -1236,24 +1243,28 @@ namespace NSBinPptxRW
...
@@ -1236,24 +1243,28 @@ namespace NSBinPptxRW
if
(
m_pManager
->
m_nDocumentType
==
XMLWRITER_DOC_TYPE_DOCX
)
strImageRelsPath
=
L"media/"
;
if
(
m_pManager
->
m_nDocumentType
==
XMLWRITER_DOC_TYPE_DOCX
)
strImageRelsPath
=
L"media/"
;
else
strImageRelsPath
=
L"../media/"
;
else
strImageRelsPath
=
L"../media/"
;
strImageRelsPath
+=
OOX
::
CPath
(
oImageManagerInfo
.
sFilepathImage
).
GetFilename
();
std
::
map
<
std
::
wstring
,
_relsGeneratorInfo
>::
iterator
pPair
=
m_mapImages
.
find
(
strImageRelsPath
);
if
(
m_mapImages
.
end
()
!=
pPair
)
{
return
pPair
->
second
;
}
_relsGeneratorInfo
oRelsGeneratorInfo
;
_relsGeneratorInfo
oRelsGeneratorInfo
;
oRelsGeneratorInfo
.
nImageRId
=
m_lNextRelsID
++
;
if
(
!
oImageManagerInfo
.
sFilepathImage
.
empty
())
oRelsGeneratorInfo
.
sFilepathImage
=
oImageManagerInfo
.
sFilepathImage
;
{
strImageRelsPath
+=
OOX
::
CPath
(
oImageManagerInfo
.
sFilepathImage
).
GetFilename
();
std
::
wstring
strRid
=
L"rId"
+
std
::
to_wstring
(
oRelsGeneratorInfo
.
nImageRId
);
std
::
map
<
std
::
wstring
,
_relsGeneratorInfo
>::
iterator
pPair
=
m_mapImages
.
find
(
strImageRelsPath
);
m_pWriter
->
WriteString
(
L"<Relationship Id=
\"
"
+
strRid
+
if
(
m_mapImages
.
end
()
!=
pPair
)
L"
\"
Type=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
\"
Target=
\"
"
+
strImageRelsPath
+
{
L"
\"
/>"
);
return
pPair
->
second
;
}
oRelsGeneratorInfo
.
nImageRId
=
m_lNextRelsID
++
;
oRelsGeneratorInfo
.
sFilepathImage
=
oImageManagerInfo
.
sFilepathImage
;
std
::
wstring
strRid
=
L"rId"
+
std
::
to_wstring
(
oRelsGeneratorInfo
.
nImageRId
);
m_pWriter
->
WriteString
(
L"<Relationship Id=
\"
"
+
strRid
+
L"
\"
Type=
\"
http://schemas.openxmlformats.org/officeDocument/2006/relationships/image
\"
Target=
\"
"
+
strImageRelsPath
+
L"
\"
/>"
);
}
if
(
additionalFile
.
is
<
OOX
::
OleObject
>
())
if
(
additionalFile
.
is
<
OOX
::
OleObject
>
())
{
{
...
@@ -1285,7 +1296,7 @@ namespace NSBinPptxRW
...
@@ -1285,7 +1296,7 @@ namespace NSBinPptxRW
}
}
}
}
}
}
if
(
additionalFile
.
is
<
OOX
::
Media
>
())
else
if
(
additionalFile
.
is
<
OOX
::
Media
>
())
{
{
smart_ptr
<
OOX
::
Media
>
mediaFile
=
additionalFile
.
smart_dynamic_cast
<
OOX
::
Media
>
();
smart_ptr
<
OOX
::
Media
>
mediaFile
=
additionalFile
.
smart_dynamic_cast
<
OOX
::
Media
>
();
...
...
ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
View file @
ce19969b
...
@@ -447,7 +447,10 @@ namespace PPTX
...
@@ -447,7 +447,10 @@ namespace PPTX
if
(
!
blip
.
is_init
())
if
(
!
blip
.
is_init
())
blip
=
new
PPTX
::
Logic
::
Blip
();
blip
=
new
PPTX
::
Logic
::
Blip
();
blip
->
embed
=
new
OOX
::
RId
((
size_t
)
oRelsGeneratorInfo
.
nImageRId
);
if
(
oRelsGeneratorInfo
.
nImageRId
>=
0
)
{
blip
->
embed
=
new
OOX
::
RId
((
size_t
)
oRelsGeneratorInfo
.
nImageRId
);
}
if
(
oRelsGeneratorInfo
.
nOleRId
>
0
)
if
(
oRelsGeneratorInfo
.
nOleRId
>
0
)
{
{
...
...
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