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
c7dec2d2
Commit
c7dec2d2
authored
Aug 30, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t ver 2.0.2.390
parent
3d9308d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
57 deletions
+87
-57
X2tConverter/build/Qt/X2tConverter.pro
X2tConverter/build/Qt/X2tConverter.pro
+1
-1
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+86
-56
No files found.
X2tConverter/build/Qt/X2tConverter.pro
View file @
c7dec2d2
...
...
@@ -7,7 +7,7 @@
QT
-=
core
QT
-=
gui
VERSION
=
2.0
.
2.3
89
VERSION
=
2.0
.
2.3
90
DEFINES
+=
INTVER
=
$$
VERSION
TEMPLATE
=
app
...
...
X2tConverter/src/ASCConverters.cpp
View file @
c7dec2d2
...
...
@@ -920,13 +920,25 @@ namespace NExtractTools
FileSystem
::
Directory
::
CreateDirectory
(
sResultDocxDir
);
int
n
Res
=
doc2docx_dir
(
sFrom
,
sResultDocxDir
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
n
Res
))
long
h
Res
=
doc2docx_dir
(
sFrom
,
sResultDocxDir
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
h
Res
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
sResultDocxDir
,
sTo
,
-
1
))
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
doc2docx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
...
...
@@ -958,7 +970,7 @@ namespace NExtractTools
FileSystem
::
Directory
::
CreateDirectory
(
sResultDoctDir
);
int
nRes
=
doc2doct_bin
(
sFrom
,
sResultDoctFileEditor
,
sTemp
,
params
);
long
nRes
=
doc2doct_bin
(
sFrom
,
sResultDoctFileEditor
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
...
...
@@ -979,7 +991,9 @@ namespace NExtractTools
COfficeDocFile
docFile
;
docFile
.
m_sTempFolder
=
sTemp
;
if
(
docFile
.
LoadFromFile
(
sFrom
,
sResultDocxDir
,
params
.
getPassword
(),
NULL
)
==
S_OK
)
long
nRes
=
docFile
.
LoadFromFile
(
sFrom
,
sResultDocxDir
,
params
.
getPassword
(),
NULL
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
BinDocxRW
::
CDocxSerializer
m_oCDocxSerializer
;
...
...
@@ -991,7 +1005,18 @@ namespace NExtractTools
int
res
=
m_oCDocxSerializer
.
saveToFile
(
std_string2string
(
sTo
),
std_string2string
(
sResultDocxDir
),
std_string2string
(
xml_options
))
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
return
res
;
}
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
;
}
...
...
@@ -1298,12 +1323,13 @@ namespace NExtractTools
}
int
mscrypt2oox
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
//decrypt to sTo
std
::
wstring
password
=
params
.
getPassword
();
//decrypt to sTo
ECMACryptReader
cryptReader
;
if
(
cryptReader
.
DecryptOfficeFile
(
sFrom
,
sTo
,
params
.
getPassword
()
)
==
false
)
if
(
cryptReader
.
DecryptOfficeFile
(
sFrom
,
sTo
,
password
)
==
false
)
{
if
(
params
.
getPassword
()
.
empty
())
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
else
return
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
if
(
password
.
empty
())
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
else
return
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
}
return
S_OK
;
...
...
@@ -1341,56 +1367,60 @@ namespace NExtractTools
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
fromMscrypt
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
int
fromMscrypt
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
{
std
::
wstring
password
=
params
.
getPassword
();
if
(
password
.
empty
())
{
if
(
!
params
.
getDontSaveAdditional
())
{
copyOrigin
(
sFrom
,
sTo
);
}
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
}
std
::
wstring
sResultDecryptFile
=
sTemp
+
FILE_SEPARATOR_STR
+
L"uncrypt_file.oox"
;
COfficeFileFormatChecker
OfficeFileFormatChecker
;
if
(
OfficeFileFormatChecker
.
isOfficeFile
(
sFrom
))
{
if
(
OfficeFileFormatChecker
.
nFileType
==
AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO
)
{
int
nRes
=
mscrypt2oox
(
sFrom
,
sResultDecryptFile
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeFileFormatChecker
OfficeFileFormatChecker
;
if
(
OfficeFileFormatChecker
.
isOfficeFile
(
sResultDecryptFile
))
{
switch
(
OfficeFileFormatChecker
.
nFileType
)
{
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX
:
{
return
fromDocument
(
sResultDecryptFile
,
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX
,
sTemp
,
params
);
}
break
;
case
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX
:
{
return
fromSpreadsheet
(
sResultDecryptFile
,
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX
,
sTemp
,
params
);
}
break
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX
:
{
return
fromPresentation
(
sResultDecryptFile
,
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
,
sTemp
,
params
);
}
break
;
}
}
}
else
if
(
AVS_FILEUTILS_ERROR_CONVERT_DRM
==
nRes
&&
!
params
.
getDontSaveAdditional
())
{
copyOrigin
(
sFrom
,
sTo
);
}
}
else
{
copyOrigin
(
sFrom
,
sTo
);
}
}
else
{
return
AVS_FILEUTILS_ERROR_CONVERT_UNKNOWN_FORMAT
;
}
return
0
;
long
nRes
=
mscrypt2oox
(
sFrom
,
sResultDecryptFile
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeFileFormatChecker
OfficeFileFormatChecker
;
if
(
OfficeFileFormatChecker
.
isOfficeFile
(
sResultDecryptFile
))
{
switch
(
OfficeFileFormatChecker
.
nFileType
)
{
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX
:
{
return
fromDocument
(
sResultDecryptFile
,
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX
,
sTemp
,
params
);
}
break
;
case
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX
:
{
return
fromSpreadsheet
(
sResultDecryptFile
,
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX
,
sTemp
,
params
);
}
break
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
:
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX
:
{
return
fromPresentation
(
sResultDecryptFile
,
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX
,
sTemp
,
params
);
}
break
;
}
}
}
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
nRes
;
}
//html
int
html2doct_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
InputParams
&
params
)
...
...
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