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
cf2aaa04
Commit
cf2aaa04
authored
Jul 13, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t - add template for decrypt
parent
3e44b5d8
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
342 additions
and
287 deletions
+342
-287
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.cpp
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.cpp
+3
-11
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+48
-13
X2tConverter/src/ASCConverters.h
X2tConverter/src/ASCConverters.h
+34
-31
X2tConverter/src/cextracttools.cpp
X2tConverter/src/cextracttools.cpp
+26
-19
X2tConverter/src/cextracttools.h
X2tConverter/src/cextracttools.h
+6
-1
X2tConverter/src/main.cpp
X2tConverter/src/main.cpp
+225
-212
No files found.
ASCOfficeDocFile/DocDocxConverter/DrawingPrimitives.cpp
View file @
cf2aaa04
...
...
@@ -119,17 +119,6 @@ namespace DocFileFormat
lineWeight
=
reader
->
ReadInt16
();
lineStyle
=
reader
->
ReadInt16
();
}
const
static
int
shemeDefaultColor
[]
=
{
0x00000000
,
0x00FFFFFF
,
0x00FF0000
,
0x0000FF00
,
0x000000FF
,
0x00FFFF00
,
0x00FF00FF
,
0x0000FFFF
,
0x00000000
,
0x00FFFFFF
,
0x00FF0000
,
0x0000FF00
,
0x000000FF
,
0x00FFFF00
,
0x00FF00FF
,
0x0000FFFF
,
0x00800000
,
0x00008000
,
0x00000080
,
0x00808000
,
0x00800080
,
0x00008080
,
0x00C0C0C0
,
0x00808080
,
0x009999FF
,
0x00993366
,
0x00FFFFCC
,
0x00CCFFFF
,
0x00660066
,
0x00FF8080
,
0x000066CC
,
0x00CCCCFF
,
0x00000080
,
0x00FF00FF
,
0x00FFFF00
,
0x0000FFFF
,
0x00800080
,
0x00800000
,
0x00008080
,
0x000000FF
,
0x0000CCFF
,
0x00CCFFFF
,
0x00CCFFCC
,
0x00FFFF99
,
0x0099CCFF
,
0x00FF99CC
,
0x00CC99FF
,
0x00FFCC99
,
0x003366FF
,
0x0033CCCC
,
0x0099CC00
,
0x00FFCC00
,
0x00FF9900
,
0x00FF6600
,
0x00666699
,
0x00969696
,
0x00003366
,
0x00339966
,
0x00003300
,
0x00333300
,
0x00993300
,
0x00993366
,
0x00333399
,
0x00333333
};
long
DrawingPrimitive
::
read_color
(
VirtualStreamReader
*
reader
)
{
...
...
@@ -223,6 +212,7 @@ namespace DocFileFormat
read_fill
(
reader
);
read_shadow
(
reader
);
}
DrawingPrimitiveTextBox
::
DrawingPrimitiveTextBox
(
VirtualStreamReader
*
reader
,
int
length
)
:
DrawingPrimitiveRect
(
reader
,
length
)
{
}
...
...
@@ -253,6 +243,8 @@ namespace DocFileFormat
DrawingPrimitiveCTextBox
::~
DrawingPrimitiveCTextBox
()
{
if
(
polyline
)
delete
polyline
;
if
(
txbx
)
delete
txbx
;
}
DrawingPrimitivePolyline
::
DrawingPrimitivePolyline
(
VirtualStreamReader
*
reader
,
int
length
)
:
DrawingPrimitiveLine
(
reader
,
length
,
false
)
...
...
X2tConverter/src/ASCConverters.cpp
View file @
cf2aaa04
...
...
@@ -142,7 +142,7 @@ namespace NExtractTools
return
nRes
;
}
// bin -> docx dir
int
doct_bin2docx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sToResult
,
const
std
::
wstring
&
sTo
Dir
,
const
std
::
wstring
&
sFontPath
,
bool
bFromChanges
,
const
std
::
wstring
&
sThemeDir
,
const
InputParams
&
params
)
int
doct_bin2docx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sToResult
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sFontPath
,
bool
bFromChanges
,
const
std
::
wstring
&
sThemeDir
,
const
InputParams
&
params
)
{
int
nRes
=
0
;
std
::
wstring
sTargetBin
;
...
...
@@ -162,7 +162,7 @@ namespace NExtractTools
CString
sMediaPath
;
// will be filled by 'CreateDocxFolders' method
CString
sEmbedPath
;
// will be filled by 'CreateDocxFolders' method
CString
sToDir2
=
std_string2string
(
sTo
Dir
);
CString
sToDir2
=
std_string2string
(
sTo
);
m_oCDocxSerializer
.
CreateDocxFolders
(
sToDir2
,
sThemePath
,
sMediaPath
,
sEmbedPath
);
if
(
SUCCEEDED_X2T
(
nRes
))
...
...
@@ -882,13 +882,13 @@ namespace NExtractTools
}
// doc -> docx
int
doc2docx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
)
int
doc2docx
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
InputParams
&
params
)
{
std
::
wstring
sResultDocxDir
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"docx_unpacked"
);
FileSystem
::
Directory
::
CreateDirectory
(
sResultDocxDir
);
int
nRes
=
doc2docx_dir
(
sFrom
,
sResultDocxDir
,
sTemp
);
int
nRes
=
doc2docx_dir
(
sFrom
,
sResultDocxDir
,
sTemp
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
...
...
@@ -897,16 +897,16 @@ namespace NExtractTools
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
doc2docx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
)
int
doc2docx_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
InputParams
&
params
)
{
COfficeDocFile
docFile
;
docFile
.
m_sTempFolder
=
sTemp
;
return
S_OK
==
docFile
.
LoadFromFile
(
sFrom
,
sTo
,
L""
,
NULL
)
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
return
S_OK
==
docFile
.
LoadFromFile
(
sFrom
,
sTo
,
params
.
m_sPassword
?
*
params
.
m_sPassword
:
L""
,
NULL
)
?
0
:
AVS_FILEUTILS_ERROR_CONVERT
;
}
// doc -> doct
int
doc2doct
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
)
int
doc2doct
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Password
,
const
std
::
wstring
&
s
Temp
,
const
std
::
wstring
&
sFontPath
)
{
// Extract docx to temp directory
std
::
wstring
sResultDoctDir
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"doct_unpacked"
);
...
...
@@ -914,7 +914,7 @@ namespace NExtractTools
FileSystem
::
Directory
::
CreateDirectory
(
sResultDoctDir
);
int
nRes
=
doc2doct_bin
(
sFrom
,
sResultDoctFileEditor
,
sTemp
,
sFontPath
);
int
nRes
=
doc2doct_bin
(
sFrom
,
sResultDoctFileEditor
,
s
Password
,
s
Temp
,
sFontPath
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
...
...
@@ -926,7 +926,7 @@ namespace NExtractTools
}
// doc -> doct_bin
int
doc2doct_bin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
)
int
doc2doct_bin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
s
Password
,
const
std
::
wstring
&
s
Temp
,
const
std
::
wstring
&
sFontPath
)
{
std
::
wstring
sResultDocxDir
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"docx_unpacked"
);
...
...
@@ -935,7 +935,7 @@ namespace NExtractTools
COfficeDocFile
docFile
;
docFile
.
m_sTempFolder
=
sTemp
;
if
(
docFile
.
LoadFromFile
(
sFrom
,
sResultDocxDir
,
L""
,
NULL
)
==
S_OK
)
if
(
docFile
.
LoadFromFile
(
sFrom
,
sResultDocxDir
,
sPassword
,
NULL
)
==
S_OK
)
{
BinDocxRW
::
CDocxSerializer
m_oCDocxSerializer
;
...
...
@@ -1216,6 +1216,7 @@ namespace NExtractTools
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
int
xlsx_dir2ods
(
const
std
::
wstring
&
sXlsxDir
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
)
{
std
::
wstring
sTempUnpackedODS
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"ods_unpacked"
);
...
...
@@ -1236,7 +1237,41 @@ namespace NExtractTools
{
}
return
AVS_FILEUTILS_ERROR_CONVERT
;
}
}
int
mscrypt2oot
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
InputParams
&
params
)
{
std
::
wstring
sResultOotDir
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"oot_unpacked"
);
std
::
wstring
sResultOotFileEditor
=
sResultOotDir
+
FILE_SEPARATOR_STR
+
_T
(
"Editor.bin"
);
FileSystem
::
Directory
::
CreateDirectory
(
sResultOotDir
);
int
nRes
=
mscrypt2oot_bin
(
sFrom
,
sResultOotFileEditor
,
sTemp
,
sFontPath
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
nRes
=
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
sResultOotDir
,
sTo
,
-
1
))
?
nRes
:
AVS_FILEUTILS_ERROR_CONVERT
;
}
return
nRes
;
}
int
mscrypt2oot_bin
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
std
::
wstring
&
sFontPath
,
const
InputParams
&
params
)
{
if
(
!
params
.
m_sPassword
)
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
if
(
params
.
m_sPassword
->
empty
())
return
AVS_FILEUTILS_ERROR_CONVERT_DRM
;
//decrypt to temp
std
::
wstring
sResultDecryptDir
=
sTemp
+
FILE_SEPARATOR_STR
+
_T
(
"crypt_unpacked"
);
FileSystem
::
Directory
::
CreateDirectory
(
sResultDecryptDir
);
//convert from format (detect before) to temp binary folder
return
AVS_FILEUTILS_ERROR_CONVERT_PASSWORD
;
}
//html
int
html2doct_dir
(
const
std
::
wstring
&
sFrom
,
const
std
::
wstring
&
sTo
,
const
std
::
wstring
&
sTemp
,
const
InputParams
&
params
)
{
...
...
@@ -1567,7 +1602,7 @@ namespace NExtractTools
}
else
if
(
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC
==
nFormatFrom
)
{
nRes
=
doc2docx_dir
(
sFrom
,
sDocxDir
,
sTemp
);
nRes
=
doc2docx_dir
(
sFrom
,
sDocxDir
,
sTemp
,
params
);
}
else
if
(
AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT
==
nFormatFrom
)
{
...
...
@@ -1890,7 +1925,7 @@ namespace NExtractTools
FileSystem
::
Directory
::
CreateDirectory
(
sResultDocxDir
);
int
nRes
=
xls2xlsx_dir
(
sFrom
,
sResultDocxDir
,
s
FontPath
,
sTemp
,
params
);
int
nRes
=
xls2xlsx_dir
(
sFrom
,
sResultDocxDir
,
s
Temp
,
sFontPath
,
params
);
if
(
SUCCEEDED_X2T
(
nRes
))
{
COfficeUtils
oCOfficeUtils
(
NULL
);
...
...
X2tConverter/src/ASCConverters.h
View file @
cf2aaa04
This diff is collapsed.
Click to expand it.
X2tConverter/src/cextracttools.cpp
View file @
cf2aaa04
...
...
@@ -165,43 +165,43 @@ namespace NExtractTools
}
break
;
case
AVS_OFFICESTUDIO_FILE_CANVAS_PDF
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".pdf"
)))
res
=
TCD_BIN2PDF
;
if
(
0
==
sExt2
.
compare
(
_T
(
".pdf"
)))
res
=
TCD_BIN2PDF
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsx"
)))
res
=
TCD_CSV2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlst"
)))
res
=
TCD_CSV2XLST
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_CSV2XLST_BIN
;
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsx"
)))
res
=
TCD_CSV2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlst"
)))
res
=
TCD_CSV2XLST
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_CSV2XLST_BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_RTF2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_RTF2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_RTF2DOCT_BIN
;
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_RTF2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_RTF2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_RTF2DOCT_BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_DOC2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_DOC2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_DOC2DOCT_BIN
;
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_DOC2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_DOC2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_DOC2DOCT_BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsx"
)))
res
=
TCD_XLS2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlst"
)))
res
=
TCD_XLS2XLST
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_XLS2XLST_BIN
;
if
(
0
==
sExt2
.
compare
(
_T
(
".xlsx"
)))
res
=
TCD_XLS2XLSX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlst"
)))
res
=
TCD_XLS2XLST
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_XLS2XLST_BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_TXT2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_TXT2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_TXT2DOCT_BIN
;
if
(
0
==
sExt2
.
compare
(
_T
(
".docx"
)))
res
=
TCD_TXT2DOCX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_TXT2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_TXT2DOCT_BIN
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".pptx"
)))
res
=
TCD_PPT2PPTX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_PPT2PPTT_BIN
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptt"
)))
res
=
TCD_PPT2PPTT
;
if
(
0
==
sExt2
.
compare
(
_T
(
".pptx"
)))
res
=
TCD_PPT2PPTX
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_PPT2PPTT_BIN
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptt"
)))
res
=
TCD_PPT2PPTT
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT
:
case
AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS
:
...
...
@@ -215,6 +215,13 @@ namespace NExtractTools
0
==
sExt2
.
compare
(
_T
(
".xlsx"
))
||
0
==
sExt2
.
compare
(
_T
(
".pptx"
)))
res
=
TCD_ODF2OOX
;
}
break
;
case
AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO
:
{
if
(
0
==
sExt2
.
compare
(
_T
(
".doct"
)))
res
=
TCD_MSCRYPT2DOCT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".xlst"
)))
res
=
TCD_MSCRYPT2XLST
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".pptt"
)))
res
=
TCD_MSCRYPT2PPTT
;
else
if
(
0
==
sExt2
.
compare
(
_T
(
".bin"
)))
res
=
TCD_MSCRYPT2BIN
;
}
break
;
}
}
}
...
...
X2tConverter/src/cextracttools.h
View file @
cf2aaa04
...
...
@@ -132,7 +132,12 @@ namespace NExtractTools
TCD_XML2DOCX
,
TCD_DOCX2XML
,
//
TCD_MSCRYPT2DOCT
,
TCD_MSCRYPT2XLST
,
TCD_MSCRYPT2PPTT
,
TCD_MSCRYPT2BIN
,
//
TCD_MAILMERGE
,
TCD_T2
,
TCD_DOCT_BIN2
,
...
...
X2tConverter/src/main.cpp
View file @
cf2aaa04
This diff is collapsed.
Click to expand it.
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