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
305ebda7
Commit
305ebda7
authored
Feb 17, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OfficeUtils - add sort for compress
parent
114050c2
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
126 additions
and
128 deletions
+126
-128
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
+2
-2
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
+1
-1
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp
+2
-3
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.vcproj
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.vcproj
+2
-0
ASCOfficeOdfFile/src/docx/docx_package.cpp
ASCOfficeOdfFile/src/docx/docx_package.cpp
+2
-2
ASCOfficeOdfFile/src/odf/draw_frame.cpp
ASCOfficeOdfFile/src/odf/draw_frame.cpp
+1
-1
DesktopEditor/common/Directory.h
DesktopEditor/common/Directory.h
+20
-21
DesktopEditor/common/File.h
DesktopEditor/common/File.h
+0
-1
DesktopEditor/fontengine/ApplicationFonts.cpp
DesktopEditor/fontengine/ApplicationFonts.cpp
+18
-17
DesktopEditor/fontengine/ApplicationFonts.h
DesktopEditor/fontengine/ApplicationFonts.h
+9
-9
OfficeUtils/src/OfficeUtils.cpp
OfficeUtils/src/OfficeUtils.cpp
+3
-3
OfficeUtils/src/OfficeUtils.h
OfficeUtils/src/OfficeUtils.h
+11
-12
OfficeUtils/src/ZipUtilsCP.cpp
OfficeUtils/src/ZipUtilsCP.cpp
+21
-17
OfficeUtils/src/ZipUtilsCP.h
OfficeUtils/src/ZipUtilsCP.h
+5
-10
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+28
-28
X2tConverter/src/cextracttools.cpp
X2tConverter/src/cextracttools.cpp
+1
-1
No files found.
ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
View file @
305ebda7
...
...
@@ -61,7 +61,7 @@ bool BinDocxRW::CDocxSerializer::ConvertDocxToDoct(const std::wstring& sSrcFileN
if
(
S_OK
==
oCOfficeUtils
.
ExtractToDirectory
(
sSrcFileName
,
strDirSrc
,
NULL
,
0
))
if
(
saveToFile
(
strEditorBin
,
strDirSrc
,
sXMLOptions
))
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
strDirDst
,
sDstFileName
,
-
1
))
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
strDirDst
,
sDstFileName
))
return
true
;
return
false
;
}
...
...
@@ -88,7 +88,7 @@ bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const std::wstring& sSrcFileN
if
(
loadFromFile
(
sEditorBin
,
strDirDst
,
sXMLOptions
,
sThemePath
,
sMediaPath
,
sEmbedPath
))
{
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
strDirDst
,
sDstFileName
,
-
1
))
if
(
S_OK
==
oCOfficeUtils
.
CompressFileOrDirectory
(
strDirDst
,
sDstFileName
,
true
))
return
true
;
}
}
...
...
ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
View file @
305ebda7
...
...
@@ -275,7 +275,7 @@ namespace BinXlsxRW{
oXlsx
.
Write
(
oPath
,
sAdditionalContentTypes
);
//zip
COfficeUtils
oOfficeUtils
(
NULL
);
oOfficeUtils
.
CompressFileOrDirectory
(
sTempDir
,
sDstFile
,
-
1
);
oOfficeUtils
.
CompressFileOrDirectory
(
sTempDir
,
sDstFile
,
true
);
//clean
NSDirectory
::
DeleteDirectory
(
sTempDir
);
}
...
...
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp
View file @
305ebda7
...
...
@@ -34,7 +34,6 @@
#include <stdio.h>
#include <tchar.h>
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../src/ConvertOO2OOX.h"
...
...
@@ -55,7 +54,7 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT
hr
=
S_OK
;
//////////////////////////////////////////////////////////////////////////
std
::
wstring
srcFileName
=
argv
[
1
];
std
::
wstring
dstPath
=
argc
>
2
?
argv
[
2
]
:
srcFileName
+
L"-my.
docx"
;
//xlsx ppt
x
std
::
wstring
dstPath
=
argc
>
2
?
argv
[
2
]
:
srcFileName
+
L"-my.
xlsx"
;
//xlsx pptx doc
x
std
::
wstring
outputDir
=
NSDirectory
::
GetFolderPath
(
dstPath
);
...
...
@@ -73,7 +72,7 @@ int _tmain(int argc, _TCHAR* argv[])
if
(
hr
!=
S_OK
)
return
hr
;
if
(
S_OK
!=
oCOfficeUtils
.
CompressFileOrDirectory
(
dstTempPath
.
c_str
(),
dstPath
.
c_str
(),
-
1
))
if
(
S_OK
!=
oCOfficeUtils
.
CompressFileOrDirectory
(
dstTempPath
.
c_str
(),
dstPath
.
c_str
(),
true
))
return
hr
;
NSDirectory
::
DeleteDirectory
(
dstTempPath
);
...
...
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.vcproj
View file @
305ebda7
...
...
@@ -64,6 +64,8 @@
<Tool
Name=
"VCLinkerTool"
AdditionalDependencies=
"gdi32.lib Rpcrt4.lib"
ShowProgress=
"0"
Version=
""
LinkIncremental=
"2"
GenerateDebugInformation=
"true"
SubSystem=
"1"
...
...
ASCOfficeOdfFile/src/docx/docx_package.cpp
View file @
305ebda7
...
...
@@ -47,12 +47,12 @@ docx_content_types_file::docx_content_types_file()
content
()
->
add_default
(
L"jpg"
,
L"image/jpeg"
);
content
()
->
add_default
(
L"png"
,
L"image/png"
);
//
content
()
->
add_override
(
L"/_rels/.rels"
,
L"application/vnd.openxmlformats-package.relationships+xml"
);
content
()
->
add_override
(
L"/word/_rels/document.xml.rels"
,
L"application/vnd.openxmlformats-package.relationships+xml"
);
content
()
->
add_override
(
L"/word/document.xml"
,
L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
);
content
()
->
add_override
(
L"/word/settings.xml"
,
L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"
);
content
()
->
add_override
(
L"/word/styles.xml"
,
L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"
);
content
()
->
add_override
(
L"/word/fontTable.xml"
,
L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"
);
//content()->add_override(L"/word/_rels/document.xml.rels", L"application/vnd.openxmlformats-package.relationships+xml");
//content()->add_override(L"/_rels/.rels", L"application/vnd.openxmlformats-package.relationships+xml");
content
()
->
add_override
(
L"/docProps/app.xml"
,
L"application/vnd.openxmlformats-officedocument.extended-properties+xml"
);
content
()
->
add_override
(
L"/docProps/core.xml"
,
L"application/vnd.openxmlformats-package.core-properties+xml"
);
}
...
...
ASCOfficeOdfFile/src/odf/draw_frame.cpp
View file @
305ebda7
...
...
@@ -381,7 +381,7 @@ std::wstring draw_object::office_convert(odf_document * odfDocument, int type)
std
::
wstring
temp_file
=
folderPath
+
FILE_SEPARATOR_STR
+
href_result
;
COfficeUtils
oCOfficeUtils
(
NULL
);
oCOfficeUtils
.
CompressFileOrDirectory
(
objectOutPath
.
c_str
(),
temp_file
.
c_str
(),
-
1
);
oCOfficeUtils
.
CompressFileOrDirectory
(
objectOutPath
.
c_str
(),
temp_file
.
c_str
(),
true
);
}
NSDirectory
::
DeleteDirectory
(
objectOutPath
);
...
...
DesktopEditor/common/Directory.h
View file @
305ebda7
...
...
@@ -34,7 +34,7 @@
#include <stdio.h>
#include <string>
#include
"Array.h"
#include
<vector>
#include "File.h"
#if defined(_WIN32) || defined (_WIN64)
...
...
@@ -109,9 +109,9 @@ namespace NSDirectory
#endif
#ifdef _IOS
void
GetFiles2_ios
(
std
::
wstring
strDirectory
,
CArray
<
std
::
wstring
>&
oArray
,
bool
bIsRecursion
);
void
GetFiles2_ios
(
std
::
wstring
strDirectory
,
std
::
vector
<
std
::
wstring
>&
oArray
,
bool
bIsRecursion
);
#endif
static
void
GetFiles2
(
std
::
wstring
strDirectory
,
CArray
<
std
::
wstring
>&
oArray
,
bool
bIsRecursion
=
false
)
static
void
GetFiles2
(
std
::
wstring
strDirectory
,
std
::
vector
<
std
::
wstring
>&
oArray
,
bool
bIsRecursion
=
false
)
{
#if defined(_WIN32) || defined (_WIN64)
WIN32_FIND_DATAW
oFD
;
...
...
@@ -128,7 +128,7 @@ namespace NSDirectory
sSpec
=
strDirectory
+
L"
\\
"
+
sSpec
;
if
(
!
(
oFD
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
)
{
oArray
.
Add
(
sSpec
);
oArray
.
push_back
(
sSpec
);
}
else
if
(
bIsRecursion
)
{
...
...
@@ -169,7 +169,7 @@ namespace NSDirectory
if
(
2
==
nType
)
{
std
::
wstring
sName
=
NSFile
::
CUtf8Converter
::
GetUnicodeStringFromUTF8
((
BYTE
*
)
dirp
->
d_name
,
strlen
(
dirp
->
d_name
));
oArray
.
Add
(
strDirectory
+
L"/"
+
sName
);
oArray
.
push_back
(
strDirectory
+
L"/"
+
sName
);
}
if
(
bIsRecursion
&&
(
1
==
nType
))
...
...
@@ -199,7 +199,7 @@ namespace NSDirectory
if
(
DT_REG
==
dirp
->
d_type
)
{
std
::
wstring
sName
=
NSFile
::
CUtf8Converter
::
GetUnicodeStringFromUTF8
((
BYTE
*
)
dirp
->
d_name
,
strlen
(
dirp
->
d_name
));
oArray
.
Add
(
strDirectory
+
L"/"
+
sName
);
oArray
.
push_back
(
strDirectory
+
L"/"
+
sName
);
}
if
(
bIsRecursion
&&
DT_DIR
==
dirp
->
d_type
)
...
...
@@ -218,9 +218,9 @@ namespace NSDirectory
#endif
}
static
CArray
<
std
::
wstring
>
GetFiles
(
std
::
wstring
strDirectory
,
bool
bIsRecursion
=
false
)
static
std
::
vector
<
std
::
wstring
>
GetFiles
(
std
::
wstring
strDirectory
,
bool
bIsRecursion
=
false
)
{
CArray
<
std
::
wstring
>
oArray
;
std
::
vector
<
std
::
wstring
>
oArray
;
if
(
!
strDirectory
.
empty
())
{
...
...
@@ -228,10 +228,9 @@ namespace NSDirectory
}
return
oArray
;
}
static
CArray
<
std
::
wstring
>
GetDirectories
(
std
::
wstring
strDirectory
)
static
std
::
vector
<
std
::
wstring
>
GetDirectories
(
std
::
wstring
strDirectory
)
{
CArray
<
std
::
wstring
>
oArray
;
std
::
vector
<
std
::
wstring
>
oArray
;
#if defined(_WIN32) || defined (_WIN64)
WIN32_FIND_DATAW
oFD
;
...
...
@@ -248,7 +247,7 @@ namespace NSDirectory
sSpec
=
strDirectory
+
L"
\\
"
+
sSpec
;
if
(
oFD
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
oArray
.
Add
(
sSpec
);
oArray
.
push_back
(
sSpec
);
}
}
}
while
(
FindNextFileW
(
hRes
,
&
oFD
)
);
...
...
@@ -280,7 +279,7 @@ namespace NSDirectory
if
(
dirp
->
d_name
[
0
]
!=
'.'
)
{
std
::
wstring
sName
=
NSFile
::
CUtf8Converter
::
GetUnicodeStringFromUTF8
((
BYTE
*
)
dirp
->
d_name
,
strlen
(
dirp
->
d_name
));
oArray
.
Add
(
strDirectory
+
L"/"
+
sName
);
oArray
.
push_back
(
strDirectory
+
L"/"
+
sName
);
}
}
}
...
...
@@ -302,7 +301,7 @@ namespace NSDirectory
if
(
dirp
->
d_name
[
0
]
!=
'.'
)
{
std
::
wstring
sName
=
NSFile
::
CUtf8Converter
::
GetUnicodeStringFromUTF8
((
BYTE
*
)
dirp
->
d_name
,
strlen
(
dirp
->
d_name
));
oArray
.
Add
(
strDirectory
+
L"/"
+
sName
);
oArray
.
push_back
(
strDirectory
+
L"/"
+
sName
);
}
}
}
...
...
@@ -381,13 +380,13 @@ namespace NSDirectory
}
static
void
DeleteDirectory
(
const
std
::
wstring
&
strDirectory
,
bool
deleteRoot
=
true
)
{
CArray
<
std
::
wstring
>
aFiles
=
GetFiles
(
strDirectory
);
for
(
int
i
=
0
;
i
<
aFiles
.
GetCount
();
++
i
)
std
::
vector
<
std
::
wstring
>
aFiles
=
GetFiles
(
strDirectory
);
for
(
size_t
i
=
0
;
i
<
aFiles
.
size
();
++
i
)
{
NSFile
::
CFileBinary
::
Remove
(
aFiles
[
i
]);
}
CArray
<
std
::
wstring
>
aDirectories
=
GetDirectories
(
strDirectory
);
for
(
int
i
=
0
;
i
<
aDirectories
.
GetCount
();
++
i
)
std
::
vector
<
std
::
wstring
>
aDirectories
=
GetDirectories
(
strDirectory
);
for
(
size_t
i
=
0
;
i
<
aDirectories
.
size
();
++
i
)
{
DeleteDirectory
(
aDirectories
[
i
]);
}
...
...
@@ -473,11 +472,11 @@ namespace NSDirectory
static
int
GetFilesCount
(
const
std
::
wstring
&
path
,
const
bool
&
recursive
)
{
CArray
<
std
::
wstring
>
arrFiles
=
NSDirectory
::
GetFiles
(
path
,
recursive
);
std
::
vector
<
std
::
wstring
>
arrFiles
=
NSDirectory
::
GetFiles
(
path
,
recursive
);
#if defined(_WIN32) || defined (_WIN64)
return
arrFiles
.
GetCount
();
return
(
int
)
arrFiles
.
size
();
#endif
return
arrFiles
.
GetCount
()
+
1
;
return
(
int
)
arrFiles
.
size
()
+
1
;
// ???
}
#if !defined(_WIN32) && !defined (_WIN64)
...
...
DesktopEditor/common/File.h
View file @
305ebda7
...
...
@@ -36,7 +36,6 @@
#include <string>
#include <fstream>
#include <time.h>
#include "Array.h"
#include "errno.h"
#include "Base64.h"
#include <time.h>
...
...
DesktopEditor/fontengine/ApplicationFonts.cpp
View file @
305ebda7
...
...
@@ -1327,9 +1327,9 @@ void CFontList::SetDefaultFont(std::wstring& sName)
}
}
void
CFontList
::
LoadFromArrayFiles
(
CArray
<
std
::
wstring
>&
oArray
,
int
nFlag
)
void
CFontList
::
LoadFromArrayFiles
(
std
::
vector
<
std
::
wstring
>&
oArray
,
int
nFlag
)
{
int
nCount
=
oArray
.
GetCount
();
size_t
nCount
=
oArray
.
size
();
FT_Library
pLibrary
=
NULL
;
if
(
FT_Init_FreeType
(
&
pLibrary
))
...
...
@@ -1347,7 +1347,7 @@ void CFontList::LoadFromArrayFiles(CArray<std::wstring>& oArray, int nFlag)
// определяем размер буфера, чтобы не выделять много кусков, а обойтись одним
int
nMaxFontSize
=
0
;
for
(
in
t
nIndex
=
0
;
nIndex
<
nCount
;
++
nIndex
)
for
(
size_
t
nIndex
=
0
;
nIndex
<
nCount
;
++
nIndex
)
{
NSFile
::
CFileBinary
oFile
;
if
(
oFile
.
OpenFile
(
oArray
[
nIndex
]))
...
...
@@ -1356,7 +1356,7 @@ void CFontList::LoadFromArrayFiles(CArray<std::wstring>& oArray, int nFlag)
if
(
nSizeTmp
>
100000000
)
{
// такие огромные шрифты не учитываем
oArray
.
RemoveAt
(
nIndex
);
oArray
.
erase
(
oArray
.
begin
()
+
nIndex
,
oArray
.
begin
()
+
nIndex
+
1
);
nIndex
--
;
nCount
--
;
}
...
...
@@ -1596,7 +1596,7 @@ void CFontList::LoadFromArrayFiles(CArray<std::wstring>& oArray, int nFlag)
}
void
CFontList
::
LoadFromFolder
(
const
std
::
wstring
&
strDirectory
)
{
CArray
<
std
::
wstring
>
oArray
=
NSDirectory
::
GetFiles
(
strDirectory
,
true
);
std
::
vector
<
std
::
wstring
>
oArray
=
NSDirectory
::
GetFiles
(
strDirectory
,
true
);
this
->
LoadFromArrayFiles
(
oArray
);
}
...
...
@@ -1765,7 +1765,7 @@ static long GetNextNameValue(HKEY key, const std::wstring& sSubkey, std::wstring
#endif
CArray
<
std
::
wstring
>
CApplicationFonts
::
GetSetupFontFiles
()
std
::
vector
<
std
::
wstring
>
CApplicationFonts
::
GetSetupFontFiles
()
{
#if defined(_WIN32) || defined (_WIN64)
// Ищем директорию с фонтами (обычно это C:\Windows\Fonts)
...
...
@@ -1792,7 +1792,8 @@ CArray<std::wstring> CApplicationFonts::GetSetupFontFiles()
std
::
wstring
sData
;
std
::
map
<
std
::
wstring
,
bool
>
map_files
;
CArray
<
std
::
wstring
>
oArray
;
std
::
vector
<
std
::
wstring
>
oArray
;
while
(
GetNextNameValue
(
HKEY_LOCAL_MACHINE
,
wsPath
,
sName
,
sData
)
==
ERROR_SUCCESS
)
{
if
(
wsPath
.
length
())
...
...
@@ -1805,7 +1806,7 @@ CArray<std::wstring> CApplicationFonts::GetSetupFontFiles()
if
(
map_files
.
find
(
sData
)
==
map_files
.
end
())
{
oArray
.
Add
(
sData
);
oArray
.
push_back
(
sData
);
map_files
.
insert
(
map_files
.
begin
(),
std
::
pair
<
std
::
wstring
,
bool
>
(
sData
,
true
));
}
continue
;
...
...
@@ -1820,7 +1821,7 @@ CArray<std::wstring> CApplicationFonts::GetSetupFontFiles()
if
(
map_files
.
find
(
sFileInDir
)
==
map_files
.
end
())
{
oArray
.
Add
(
sFileInDir
);
oArray
.
push_back
(
sFileInDir
);
map_files
.
insert
(
map_files
.
begin
(),
std
::
pair
<
std
::
wstring
,
bool
>
(
sFileInDir
,
true
));
}
continue
;
...
...
@@ -1830,14 +1831,14 @@ CArray<std::wstring> CApplicationFonts::GetSetupFontFiles()
#endif
#if defined(__linux__) && !defined(_MAC)
CArray
<
std
::
wstring
>
_array
=
NSDirectory
::
GetFiles
(
L"/usr/share/fonts"
,
true
);
std
::
vector
<
std
::
wstring
>
_array
=
NSDirectory
::
GetFiles
(
L"/usr/share/fonts"
,
true
);
NSDirectory
::
GetFiles2
(
L"/usr/share/X11/fonts"
,
_array
,
true
);
NSDirectory
::
GetFiles2
(
L"/usr/X11R6/lib/X11/fonts"
,
_array
,
true
);
return
_array
;
#endif
#if defined(_MAC) && !defined(_IOS)
CArray
<
std
::
wstring
>
_array
=
NSDirectory
::
GetFiles
(
L"/Library/Fonts"
,
true
);
std
::
vector
<
std
::
wstring
>
_array
=
NSDirectory
::
GetFiles
(
L"/Library/Fonts"
,
true
);
NSDirectory
::
GetFiles2
(
L"/System/Library/Fonts"
,
_array
,
true
);
return
_array
;
#endif
...
...
@@ -1847,11 +1848,11 @@ CArray<std::wstring> CApplicationFonts::GetSetupFontFiles()
return
GetSetupFontFiles_ios
();
#endif
CArray
<
std
::
wstring
>
ret
;
std
::
vector
<
std
::
wstring
>
ret
;
return
ret
;
}
void
CApplicationFonts
::
InitializeFromArrayFiles
(
CArray
<
std
::
wstring
>&
files
,
int
nFlag
)
void
CApplicationFonts
::
InitializeFromArrayFiles
(
std
::
vector
<
std
::
wstring
>&
files
,
int
nFlag
)
{
m_oList
.
LoadFromArrayFiles
(
files
,
nFlag
);
}
...
...
@@ -1860,7 +1861,7 @@ void CApplicationFonts::InitializeFromArrayFiles(CArray<std::wstring>& files, in
void
CApplicationFonts
::
InitFromReg
()
{
CArray
<
std
::
wstring
>
oArray
=
GetSetupFontFiles
();
std
::
vector
<
std
::
wstring
>
oArray
=
GetSetupFontFiles
();
m_oList
.
LoadFromArrayFiles
(
oArray
);
}
...
...
DesktopEditor/fontengine/ApplicationFonts.h
View file @
305ebda7
...
...
@@ -240,13 +240,13 @@ public:
void
ToBuffer
(
BYTE
**
pDstData
,
LONG
*
pLen
,
std
::
wstring
strDirectory
=
L""
,
bool
bIsOnlyFileName
=
false
);
public:
void
LoadFromArrayFiles
(
CArray
<
std
::
wstring
>&
arrFiles
,
int
nFlag
=
0
);
void
LoadFromFolder
(
const
std
::
wstring
&
strDirectory
);
bool
CheckLoadFromFolderBin
(
const
std
::
wstring
&
strDirectory
);
void
Add
(
CFontInfo
*
pInfo
);
CFontInfo
*
GetByParams
(
CFontSelectFormat
&
oSelect
,
bool
bIsDictionaryUse
=
true
);
CArray
<
CFontInfo
*>
GetAllByName
(
const
std
::
wstring
&
strFontName
);
void
SetDefaultFont
(
std
::
wstring
&
sName
);
void
LoadFromArrayFiles
(
std
::
vector
<
std
::
wstring
>&
arrFiles
,
int
nFlag
=
0
);
void
LoadFromFolder
(
const
std
::
wstring
&
strDirectory
);
bool
CheckLoadFromFolderBin
(
const
std
::
wstring
&
strDirectory
);
void
Add
(
CFontInfo
*
pInfo
);
CFontInfo
*
GetByParams
(
CFontSelectFormat
&
oSelect
,
bool
bIsDictionaryUse
=
true
);
CArray
<
CFontInfo
*>
GetAllByName
(
const
std
::
wstring
&
strFontName
);
void
SetDefaultFont
(
std
::
wstring
&
sName
);
};
class
CApplicationFonts
...
...
@@ -268,8 +268,8 @@ public:
void
InitializeFromFolder
(
std
::
wstring
strFolder
,
bool
bIsCheckSelection
=
true
);
void
Initialize
(
bool
bIsCheckSelection
=
true
);
CArray
<
std
::
wstring
>
GetSetupFontFiles
();
void
InitializeFromArrayFiles
(
CArray
<
std
::
wstring
>&
files
,
int
nFlag
=
0
);
std
::
vector
<
std
::
wstring
>
GetSetupFontFiles
();
void
InitializeFromArrayFiles
(
std
::
vector
<
std
::
wstring
>&
files
,
int
nFlag
=
0
);
#if defined(_WIN32) || defined (_WIN64)
void
InitFromReg
();
...
...
OfficeUtils/src/OfficeUtils.cpp
View file @
305ebda7
...
...
@@ -52,12 +52,12 @@ HRESULT COfficeUtils::ExtractToDirectory(const std::wstring& zipFile, const std:
}
HRESULT
COfficeUtils
::
CompressFileOrDirectory
(
const
std
::
wstring
&
name
,
const
std
::
wstring
&
outputFile
,
SHORT
level
)
HRESULT
COfficeUtils
::
CompressFileOrDirectory
(
const
std
::
wstring
&
name
,
const
std
::
wstring
&
outputFile
,
bool
bSorted
,
short
level
)
{
HRESULT
result
=
S_FALSE
;
if
(
NSDirectory
::
Exists
(
name
))
{
if
(
ZLibZipUtils
::
ZipDir
(
name
.
c_str
(),
outputFile
.
c_str
(),
m_fCallback
,
level
)
==
0
)
if
(
ZLibZipUtils
::
ZipDir
(
name
.
c_str
(),
outputFile
.
c_str
(),
m_fCallback
,
bSorted
,
level
)
==
0
)
{
result
=
S_OK
;
}
...
...
@@ -92,7 +92,7 @@ HRESULT COfficeUtils::Uncompress(BYTE* destBuf, ULONG* destSize, BYTE* sourceBuf
}
}
HRESULT
COfficeUtils
::
Compress
(
BYTE
*
destBuf
,
ULONG
*
destSize
,
BYTE
*
sourceBuf
,
ULONG
sourceSize
,
SHORT
level
)
HRESULT
COfficeUtils
::
Compress
(
BYTE
*
destBuf
,
ULONG
*
destSize
,
BYTE
*
sourceBuf
,
ULONG
sourceSize
,
short
level
)
{
if
(
ZLibZipUtils
::
CompressBytes
(
destBuf
,
destSize
,
sourceBuf
,
sourceSize
,
level
)
==
Z_OK
)
{
...
...
OfficeUtils/src/OfficeUtils.h
View file @
305ebda7
...
...
@@ -39,20 +39,19 @@ class COfficeUtils
private:
OnProgressCallback
*
m_fCallback
;
public:
COfficeUtils
(
OnProgressCallback
*
fCallback
);
COfficeUtils
(
OnProgressCallback
*
bCallback
=
NULL
);
public:
HRESULT
ExtractToDirectory
(
const
std
::
wstring
&
zipFile
,
const
std
::
wstring
&
unzipDir
,
wchar_t
*
password
,
short
extract_without_path
);
HRESULT
CompressFileOrDirectory
(
const
std
::
wstring
&
name
,
const
std
::
wstring
&
outputFile
,
bool
bSorted
=
false
,
short
level
=
-
1
);
HRESULT
ExtractToDirectory
(
const
std
::
wstring
&
zipFile
,
const
std
::
wstring
&
unzipDir
,
wchar_t
*
password
,
SHORT
extract_without_path
);
HRESULT
CompressFileOrDirectory
(
const
std
::
wstring
&
name
,
const
std
::
wstring
&
outputFile
,
SHORT
level
);
HRESULT
Uncompress
(
BYTE
*
destBuf
,
ULONG
*
destSize
,
BYTE
*
sourceBuf
,
ULONG
sourceSize
);
HRESULT
Compress
(
BYTE
*
destBuf
,
ULONG
*
destSize
,
BYTE
*
sourceBuf
,
ULONG
sourceSize
,
SHORT
level
);
HRESULT
Uncompress
(
BYTE
*
destBuf
,
ULONG
*
destSize
,
BYTE
*
sourceBuf
,
ULONG
sourceSize
);
HRESULT
Compress
(
BYTE
*
destBuf
,
ULONG
*
destSize
,
BYTE
*
sourceBuf
,
ULONG
sourceSize
,
short
level
=
-
1
);
HRESULT
IsArchive
(
const
std
::
wstring
&
filename
);
HRESULT
IsFileExistInArchive
(
const
std
::
wstring
&
zipFile
,
const
std
::
wstring
&
filePath
);
HRESULT
LoadFileFromArchive
(
const
std
::
wstring
&
zipFile
,
const
std
::
wstring
&
filePath
,
BYTE
**
fileInBytes
,
ULONG
&
nFileSize
);
HRESULT
ExtractFilesToMemory
(
const
std
::
wstring
&
zipFile
,
const
ExtractedFileCallback
&
data_receiver
,
void
*
pParam
,
bool
*
result
);
HRESULT
CompressFilesFromMemory
(
const
std
::
wstring
&
zipFile
,
const
RequestFileCallback
&
data_source
,
void
*
pParam
,
SHORT
compression_level
,
bool
*
result
);
HRESULT
IsArchive
(
const
std
::
wstring
&
filename
);
HRESULT
IsFileExistInArchive
(
const
std
::
wstring
&
zipFile
,
const
std
::
wstring
&
filePath
);
HRESULT
LoadFileFromArchive
(
const
std
::
wstring
&
zipFile
,
const
std
::
wstring
&
filePath
,
BYTE
**
fileInBytes
,
ULONG
&
nFileSize
);
HRESULT
ExtractFilesToMemory
(
const
std
::
wstring
&
zipFile
,
const
ExtractedFileCallback
&
data_receiver
,
void
*
pParam
,
bool
*
result
);
HRESULT
CompressFilesFromMemory
(
const
std
::
wstring
&
zipFile
,
const
RequestFileCallback
&
data_source
,
void
*
pParam
,
short
compression_level
,
bool
*
result
);
};
...
...
OfficeUtils/src/ZipUtilsCP.cpp
View file @
305ebda7
...
...
@@ -499,7 +499,7 @@ int oneZipFile(zipFile & zf, zip_fileinfo & zi, std::wstring & file_name, std::w
}
return
0
;
}
int
ZipDir
(
const
WCHAR
*
dir
,
const
WCHAR
*
outputFile
,
const
OnProgressCallback
*
progress
,
int
compressionLevel
)
int
ZipDir
(
const
WCHAR
*
dir
,
const
WCHAR
*
outputFile
,
const
OnProgressCallback
*
progress
,
bool
sorted
,
int
compressionLevel
)
{
if
(
(
dir
!=
NULL
)
&&
(
outputFile
!=
NULL
)
)
{
...
...
@@ -548,38 +548,40 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
zipDeque
.
pop_front
();
}
CArray
<
std
::
wstring
>
aCurFiles
=
NSDirectory
::
GetFiles
(
szText
);
CArray
<
std
::
wstring
>
aCurDirectories
=
NSDirectory
::
GetDirectories
(
szText
);
std
::
vector
<
std
::
wstring
>
aCurFiles
=
NSDirectory
::
GetFiles
(
szText
);
std
::
vector
<
std
::
wstring
>
aCurDirectories
=
NSDirectory
::
GetDirectories
(
szText
);
for
(
int
i
=
0
;
i
<
aCurDirectories
.
GetCount
();
++
i
)
if
(
sorted
)
{
std
::
wstring
sCurDirectory
=
aCurDirectories
[
i
];
std
::
wstring
sDirName
=
NSSystemPath
::
GetFileName
(
sCurDirectory
);
StringDeque
.
push_back
(
sCurDirectory
);
std
::
sort
(
aCurFiles
.
begin
(),
aCurFiles
.
end
());
std
::
sort
(
aCurDirectories
.
begin
(),
aCurDirectories
.
end
());
}
for
(
size_t
i
=
0
;
i
<
aCurDirectories
.
size
();
++
i
)
{
std
::
wstring
sDirName
=
NSSystemPath
::
GetFileName
(
aCurDirectories
[
i
]);
StringDeque
.
push_back
(
aCurDirectories
[
i
]
);
zipDeque
.
push_back
(
zipDir
+
sDirName
);
}
for
(
int
i
=
0
;
i
<
aCurFiles
.
GetCount
();
++
i
)
for
(
size_t
i
=
0
;
i
<
aCurFiles
.
size
();
++
i
)
{
std
::
wstring
cFileName
=
NSSystemPath
::
GetFileName
(
aCurFiles
[
i
]);
if
(
std
::
wstring
::
npos
!=
cFileName
.
find
(
L"mimetype"
))
// возможно и полное соответствие
{
std
::
wstring
cFilePath
=
aCurFiles
[
i
];
file
=
NSSystemPath
::
Combine
(
szText
,
cFileName
);
zipFileName
=
zipDir
+
cFileName
;
oneZipFile
(
zf
,
zi
,
file
,
zipFileName
,
0
,
compressionLevel
);
aCurFiles
.
RemoveAt
(
i
);
aCurFiles
.
erase
(
aCurFiles
.
begin
()
+
i
,
aCurFiles
.
begin
()
+
i
+
1
);
break
;
}
}
for
(
int
i
=
0
;
i
<
aCurFiles
.
GetCount
();
++
i
)
for
(
size_t
i
=
0
;
i
<
aCurFiles
.
size
();
++
i
)
{
std
::
wstring
cFilePath
=
aCurFiles
[
i
];
std
::
wstring
cFileName
=
NSSystemPath
::
GetFileName
(
cFilePath
);
std
::
wstring
cFileName
=
NSSystemPath
::
GetFileName
(
aCurFiles
[
i
]);
file
=
NSSystemPath
::
Combine
(
szText
,
cFileName
);
zipFileName
=
zipDir
+
cFileName
;
...
...
@@ -953,10 +955,12 @@ int ZipDir( const WCHAR* dir, const WCHAR* outputFile, const OnProgressCallback*
StringDeque
.
pop_front
();
CArray
<
std
::
wstring
>
aCurFiles
=
NSDirectory
::
GetFiles
(
szText
);
filescount
+=
aCurFiles
.
GetCount
();
CArray
<
std
::
wstring
>
aCurDirectories
=
NSDirectory
::
GetDirectories
(
szText
);
for
(
int
i
=
0
;
i
<
aCurDirectories
.
GetCount
();
++
i
)
std
::
vector
<
std
::
wstring
>
aCurFiles
=
NSDirectory
::
GetFiles
(
szText
);
filescount
+=
aCurFiles
.
size
();
std
::
vector
<
std
::
wstring
>
aCurDirectories
=
NSDirectory
::
GetDirectories
(
szText
);
for
(
size_t
i
=
0
;
i
<
aCurDirectories
.
size
();
++
i
)
{
std
::
wstring
sCurDirectory
=
aCurDirectories
[
i
];
StringDeque
.
push_back
(
sCurDirectory
);
...
...
OfficeUtils/src/ZipUtilsCP.h
View file @
305ebda7
...
...
@@ -43,22 +43,17 @@
#include "OfficeUtilsCommon.h"
#include "../../DesktopEditor/common/Types.h"
using
namespace
std
;
//#define ZLIB_WINAPI
//#define CODEPAGE_ISSUE_FIX
#include "zlib-1.2.3/contrib/minizip/unzip.h"
#include "zlib-1.2.3/contrib/minizip/zip.h"
//#pragma comment(lib, "zlibstat.lib")
#include <zlib.h>
//#if defined(_WIN32) || defined (_WIN64)
#include "zlib-1.2.3/contrib/minizip/unzip.h"
#include "zlib-1.2.3/contrib/minizip/zip.h"
//#else
#include <zlib.h>
//#endif
namespace
ZLibZipUtils
{
int
ZipDir
(
const
WCHAR
*
dir
,
const
WCHAR
*
outputFile
,
const
OnProgressCallback
*
progress
,
int
compressionLevel
=
-
1
);
int
ZipDir
(
const
WCHAR
*
dir
,
const
WCHAR
*
outputFile
,
const
OnProgressCallback
*
progress
,
bool
sorted
=
false
,
int
compressionLevel
=
-
1
);
int
ZipFile
(
const
WCHAR
*
inputFile
,
const
WCHAR
*
outputFile
,
int
compressionLevel
=
-
1
);
bool
ClearDirectory
(
const
WCHAR
*
dir
,
bool
delDir
=
false
);
int
UnzipToDir
(
const
WCHAR
*
zipFile
,
const
WCHAR
*
unzipDir
,
const
OnProgressCallback
*
progress
,
const
WCHAR
*
password
=
NULL
,
bool
opt_extract_without_path
=
false
,
bool
clearOutputDirectory
=
false
);
...
...
X2tConverter/src/ASCConverters.cpp
View file @
305ebda7
This diff is collapsed.
Click to expand it.
X2tConverter/src/cextracttools.cpp
View file @
305ebda7
...
...
@@ -360,7 +360,7 @@ namespace NExtractTools
std
::
wstring
sToResultDir
=
NSDirectory
::
GetFolderPath
(
sToResult
);
std
::
wstring
sTo
=
sToResultDir
+
FILE_SEPARATOR_STR
+
_T
(
"changes.zip"
);
COfficeUtils
oCOfficeUtils
(
NULL
);
oCOfficeUtils
.
CompressFileOrDirectory
(
sChangesDir
,
sTo
,
-
1
);
oCOfficeUtils
.
CompressFileOrDirectory
(
sChangesDir
,
sTo
);
}
break
;
}
...
...
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