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
122a5cd0
Commit
122a5cd0
authored
Jun 30, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t - return error code by PptConvert
parent
b0994759
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
17 deletions
+61
-17
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+57
-15
X2tConverter/src/main.cpp
X2tConverter/src/main.cpp
+4
-2
No files found.
X2tConverter/src/ASCConverters.cpp
View file @
122a5cd0
...
...
@@ -860,13 +860,26 @@ namespace NExtractTools
NSDirectory
::
CreateDirectory
(
sResultPptxDir
);
int
nRes
=
ppt2pptx_dir
(
sFrom
,
sResultPptxDir
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
int
hRes
=
ppt2pptx_dir
(
sFrom
,
sResultPptxDir
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
hRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
sResultPptxDir
,
sTo
,
true
))
return
0
;
}
else
if
(
AVS_ERROR_DRM
==
hRes
)
{
if
(
!
params
.
getDontSaveAdditional
())
{
copyOrigin
(
sFrom
,
*
params
.
m_sFileTo
);
}
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
}
else
if
(
AVS_ERROR_PASSWORD
==
hRes
)
{
return
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
ppt2pptx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
...
...
@@ -874,7 +887,22 @@ namespace NExtractTools
COfficePPTFile
pptFile
;
pptFile
.
put_TempDirectory
(
sTemp
);
return
S_OK
==
pptFile
.
LoadFromFile
(
sFrom
,
sTo
,
params
.
getPassword
())
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
long
hRes
=
pptFile
.
LoadFromFile
(
sFrom
,
sTo
,
params
.
getPassword
());
if
(
AVS_ERROR_DRM
==
hRes
)
{
if
(
!
params
.
getDontSaveAdditional
())
{
copyOrigin
(
sFrom
,
*
params
.
m_sFileTo
);
}
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
}
else
if
(
AVS_ERROR_PASSWORD
==
hRes
)
{
return
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
}
return
0
==
hRes
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
}
// ppt -> pptt
int
ppt2pptt
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
...
...
@@ -905,13 +933,13 @@ namespace NExtractTools
pptFile
.
put_TempDirectory
(
sTemp
);
if
(
pptFile
.
LoadFromFile
(
sFrom
,
sTempUnpackedPPTX
,
params
.
getPassword
())
!=
S_OK
)
return
AVS_FILEUTILS_ERROR_CONVERT
;
long
nRes
=
pptFile
.
LoadFromFile
(
sFrom
,
sTempUnpackedPPTX
,
params
.
getPassword
())
;
if
(
SUCCEEDED_X2T
(
nRes
))
{
// convert unzipped pptx to unzipped pptt
CPPTXFile
*
pptx_file
=
new
CPPTXFile
(
NULL
,
NULL
,
NULL
,
NULL
);
int
nRes
=
0
;
if
(
pptx_file
)
{
pptx_file
->
SetFontDir
(
params
.
getFontPath
());
...
...
@@ -919,8 +947,22 @@ namespace NExtractTools
delete
pptx_file
;
}
return
nRes
;
}
else
if
(
AVS_ERROR_DRM
==
nRes
)
{
if
(
!
params
.
getDontSaveAdditional
())
{
copyOrigin
(
sFrom
,
*
params
.
m_sFileTo
);
}
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
}
else
if
(
AVS_ERROR_PASSWORD
==
nRes
)
{
return
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
// pptx -> odp
...
...
X2tConverter/src/main.cpp
View file @
122a5cd0
...
...
@@ -138,13 +138,15 @@ static std::wstring utf8_to_unicode(const char *src)
InputParams
oInputParams
;
oInputParams
.
m_sFileFrom
=
new
std
::
wstring
(
sArg1
);
oInputParams
.
m_sFileTo
=
new
std
::
wstring
(
sArg2
);
oInputParams
.
m_sPassword
=
new
std
::
wstring
(
L"password"
);
// get conversion direction from 3rd argument
if
(
argc
>
3
)
{
oInputParams
.
m_sFontDir
=
new
std
::
wstring
(
sArg3
);
}
if
(
argc
>
4
)
{
oInputParams
.
m_sPassword
=
new
std
::
wstring
(
sArg4
);
}
result
=
NExtractTools
::
fromInputParams
(
oInputParams
);
}
...
...
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