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
8742163d
Commit
8742163d
authored
Sep 05, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ppsm
parent
212753f8
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
6 deletions
+165
-6
Common/OfficeFileFormatChecker2.cpp
Common/OfficeFileFormatChecker2.cpp
+13
-3
Common/OfficeFileFormats.h
Common/OfficeFileFormats.h
+3
-2
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+133
-0
X2tConverter/src/ASCConverters.h
X2tConverter/src/ASCConverters.h
+4
-0
X2tConverter/src/cextracttools.cpp
X2tConverter/src/cextracttools.cpp
+10
-1
X2tConverter/src/cextracttools.h
X2tConverter/src/cextracttools.h
+2
-0
No files found.
Common/OfficeFileFormatChecker2.cpp
View file @
8742163d
...
...
@@ -394,11 +394,18 @@ bool COfficeFileFormatChecker::isOOXFormatFile(const std::wstring & fileName)
{
nFileType
=
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
;
}
else
if
((
std
::
string
::
npos
!=
strContentTypes
.
find
(
pptmFormatLine
))
||
(
std
::
string
::
npos
!=
strContentTypes
.
find
(
ppsmFormatLine
)))
else
if
(
std
::
string
::
npos
!=
strContentTypes
.
find
(
pptmFormatLine
))
{
nFileType
=
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM
;
}
else
if
(
std
::
string
::
npos
!=
strContentTypes
.
find
(
ppsmFormatLine
))
{
nFileType
=
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
;
}
else
if
(
std
::
string
::
npos
!=
strContentTypes
.
find
(
ppsmFormatLine
))
{
nFileType
=
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
;
}
else
if
(
std
::
string
::
npos
!=
strContentTypes
.
find
(
ppsxFormatLine
))
{
nFileType
=
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX
;
...
...
@@ -562,6 +569,7 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT
:
return
L".ppt"
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP
:
return
L".odp"
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX
:
return
L".ppsx"
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
:
return
L".ppsm"
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX
:
return
L".potx"
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM
:
return
L".potm"
;
...
...
@@ -645,6 +653,8 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring& ext)
return
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
;
if
(
L".pptm"
==
ext
)
return
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM
;
if
(
L".ppsm"
==
ext
)
return
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
;
if
(
L".ppt"
==
ext
)
return
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT
;
if
(
L".odp"
==
ext
)
...
...
Common/OfficeFileFormats.h
View file @
8742163d
...
...
@@ -54,8 +54,9 @@
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0003
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0004
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0005
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0006
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0007
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0006
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0007
#define AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM AVS_OFFICESTUDIO_FILE_PRESENTATION + 0x0008
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET 0x0100
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0001
...
...
X2tConverter/src/ASCConverters.cpp
View file @
8742163d
...
...
@@ -1467,6 +1467,77 @@ namespace NExtractTools
std
::
wstring
sVbaProjectPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"ppt"
+
FILE_SEPARATOR_STR
+
L"vbaProject.bin"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaProjectPath
);
}
return
0
;
}
// ppsm -> pptx
int
ppsm2pptx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
std
::
wstring
sTempUnpackedPPTX
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"pptx_unpacked"
);
NSDirectory
::
CreateDirectory
(
sTempUnpackedPPTX
);
int
nRes
=
ppsm2pptx_dir
(
sFrom
,
sTempUnpackedPPTX
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
sTempUnpackedPPTX
,
sTo
,
true
))
return
0
;
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
ppsm2pptx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
)
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
ExtractToDirectory
(
sFrom
,
sTo
,
NULL
,
0
))
{
std
::
wstring
sContentTypesPath
=
sTo
+
FILE_SEPARATOR_STR
+
_T
(
"[Content_Types].xml"
);
if
(
NSFile
::
CFileBinary
::
Exists
(
sContentTypesPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sContentTypesPath
,
sData
))
{
std
::
wstring
sCTFrom
=
_T
(
"application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml"
);
std
::
wstring
sCTTo
=
_T
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"
);
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
sCTTo
);
sCTFrom
=
L"<Override PartName=
\"
/ppt/vbaProject.bin
\"
ContentType=
\"
application/vnd.ms-office.vbaProject
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
sCTFrom
=
L"<Default Extension=
\"
bin
\"
ContentType=
\"
application/vnd.ms-office.vbaProject
\"
/>"
;
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
L""
);
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sContentTypesPath
,
sData
,
true
)
==
false
)
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
std
::
wstring
sPresentationRelsPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"ppt"
+
FILE_SEPARATOR_STR
+
L"_rels"
+
FILE_SEPARATOR_STR
+
L"presentation.xml.rels"
;
if
(
NSFile
::
CFileBinary
::
Exists
(
sPresentationRelsPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sPresentationRelsPath
,
sData
))
{
int
pos
=
sData
.
find
(
L"vbaProject.bin"
);
if
(
pos
>
0
)
{
int
pos1
=
sData
.
rfind
(
L"<"
,
pos
);
int
pos2
=
sData
.
find
(
L">"
,
pos
);
if
(
pos1
>
0
&&
pos2
>
0
)
{
sData
.
erase
(
sData
.
begin
()
+
pos1
,
sData
.
begin
()
+
pos2
+
1
);
}
}
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sPresentationRelsPath
,
sData
,
true
)
==
false
)
{
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
}
std
::
wstring
sVbaProjectPath
=
sTo
+
FILE_SEPARATOR_STR
+
L"ppt"
+
FILE_SEPARATOR_STR
+
L"vbaProject.bin"
;
NSFile
::
CFileBinary
::
Remove
(
sVbaProjectPath
);
}
return
0
;
}
...
...
@@ -1548,6 +1619,46 @@ namespace NExtractTools
}
}
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
// ppsm -> pptm
int
ppsm2pptm
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
std
::
wstring
sTempUnpackedPPTM
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"pptm_unpacked"
);
NSDirectory
::
CreateDirectory
(
sTempUnpackedPPTM
);
int
nRes
=
ppsm2pptm_dir
(
sFrom
,
sTempUnpackedPPTM
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
sTempUnpackedPPTM
,
sTo
,
true
))
return
0
;
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
ppsm2pptm_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
)
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
ExtractToDirectory
(
sFrom
,
sTo
,
NULL
,
0
))
{
std
::
wstring
sContentTypesPath
=
sTo
+
FILE_SEPARATOR_STR
+
_T
(
"[Content_Types].xml"
);
if
(
NSFile
::
CFileBinary
::
Exists
(
sContentTypesPath
))
{
std
::
wstring
sData
;
if
(
NSFile
::
CFileBinary
::
ReadAllTextUtf8
(
sContentTypesPath
,
sData
))
{
std
::
wstring
sCTFrom
=
_T
(
"application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml"
);
std
::
wstring
sCTTo
=
_T
(
"application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml"
);
sData
=
string_replaceAll
(
sData
,
sCTFrom
,
sCTTo
);
if
(
NSFile
::
CFileBinary
::
SaveToFile
(
sContentTypesPath
,
sData
,
true
))
{
return
0
;
}
}
}
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
// ppt -> pptx
...
...
@@ -2255,6 +2366,7 @@ namespace NExtractTools
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
:
{
return
pptx2pptt_bin
(
sResultDecryptFile
,
sTo
,
sTemp
,
params
);
}
break
;
...
...
@@ -2320,6 +2432,7 @@ namespace NExtractTools
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
:
{
return
fromPresentation
(
sResultDecryptFile
,
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
,
sTemp
,
params
);
}
break
;
...
...
@@ -3191,6 +3304,7 @@ namespace NExtractTools
int
nRes
=
0
;
std
::
wstring
sPptxDir
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"pptx_unpacked"
);
NSDirectory
::
CreateDirectory
(
sPptxDir
);
if
(
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
==
nFormatFrom
)
{
nRes
=
zip2dir
(
sFrom
,
sPptxDir
);
...
...
@@ -3206,6 +3320,17 @@ namespace NExtractTools
nRes
=
zip2dir
(
sFrom
,
sPptxDir
);
}
}
else
if
(
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
==
nFormatFrom
)
{
if
(
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
==
nFormatTo
||
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX
==
nFormatTo
)
{
nRes
=
ppsm2pptx_dir
(
sFrom
,
sPptxDir
,
params
);
}
else
{
nRes
=
zip2dir
(
sFrom
,
sPptxDir
);
}
}
else
if
(
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT
==
nFormatFrom
)
{
nRes
=
ppt2pptx_dir
(
sFrom
,
sPptxDir
,
sTemp
,
params
);
...
...
@@ -3640,10 +3765,18 @@ namespace NExtractTools
{
result
=
potm2pptx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_PPSM2PPTX
:
{
result
=
ppsm2pptx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_POTM2PPTM
:
{
result
=
potm2pptm
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_PPSM2PPTM
:
{
result
=
ppsm2pptm
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
}
break
;
case
TCD_PPTM2PPTX
:
{
result
=
pptm2pptx
(
sFileFrom
,
sFileTo
,
sTempDir
,
oInputParams
);
...
...
X2tConverter/src/ASCConverters.h
View file @
8742163d
...
...
@@ -100,8 +100,12 @@ namespace NExtractTools
int
ppsx2pptx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
);
int
potx2pptx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
);
int
potx2pptx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
);
int
ppsm2pptx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
);
int
ppsm2pptx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
);
int
potm2pptm
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
);
int
potm2pptm_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
);
int
ppsm2pptm
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
);
int
ppsm2pptm_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
);
int
pptm2pptx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
);
int
pptm2pptx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
InputParams
&
params
);
int
potm2pptx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
);
...
...
X2tConverter/src/cextracttools.cpp
View file @
8742163d
...
...
@@ -153,6 +153,7 @@ namespace NExtractTools
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_PPTX2PPTT_BIN
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptt"
)))
res
=
TCD_PPTX2PPTT
;
...
...
@@ -166,8 +167,16 @@ namespace NExtractTools
res
=
TCD_PPTM2PPTX
;
if
(
OfficeFileFormatChecker
.
nFileType
==
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM
)
res
=
TCD_POTM2PPTX
;
if
(
OfficeFileFormatChecker
.
nFileType
==
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
)
res
=
TCD_PPSM2PPTX
;
}
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptm"
)))
{
if
(
OfficeFileFormatChecker
.
nFileType
==
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM
)
res
=
TCD_PPSM2PPTM
;
if
(
OfficeFileFormatChecker
.
nFileType
==
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM
)
res
=
TCD_POTM2PPTM
;
}
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptm"
)))
res
=
TCD_POTM2PPTM
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".odp"
)))
res
=
TCD_PPTX2ODP
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY
:
...
...
X2tConverter/src/cextracttools.h
View file @
8742163d
...
...
@@ -84,7 +84,9 @@ namespace NExtractTools
TCD_POTX2PPTX
,
TCD_PPTM2PPTX
,
TCD_POTM2PPTX
,
TCD_PPSM2PPTX
,
TCD_POTM2PPTM
,
TCD_PPSM2PPTM
,
TCD_ZIPDIR
,
TCD_UNZIPDIR
,
...
...
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