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
d70f36e3
Commit
d70f36e3
authored
Dec 12, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormat - fix users files
parent
60cf51ad
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
72 deletions
+72
-72
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
+25
-52
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
+3
-1
ASCOfficeDocFile/DocFormatTest/DocFormatTest.cpp
ASCOfficeDocFile/DocFormatTest/DocFormatTest.cpp
+44
-19
No files found.
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
View file @
d70f36e3
...
...
@@ -52,64 +52,33 @@ namespace DocFileFormat
public:
PathParser
(
const
unsigned
char
*
pSegmentInfo
,
unsigned
int
pSegmentInfoSize
,
const
unsigned
char
*
pVertices
,
unsigned
int
pVerticesSize
,
std
::
vector
<
_guides
>
&
guides
)
{
if
((
pSegmentInfo
!=
NULL
)
&&
(
pSegmentInfoSize
>
0
))
{
int
offset
=
6
;
if
((
pSegmentInfo
!=
NULL
)
&&
(
pSegmentInfoSize
>
0
))
{
unsigned
short
nElems
=
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
,
0
,
pSegmentInfoSize
);
unsigned
short
nElemsAlloc
=
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
,
2
,
pSegmentInfoSize
);
unsigned
short
cb
=
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
,
4
,
pSegmentInfoSize
);
// видимо без шапки сразу пишутся все элементы
bool
headerIs
=
((
0xfff0
!=
cb
)
&&
(
cb
>
8
)
||
nElems
>
nElemsAlloc
);
if
(
headerIs
)
{
cb
=
2
;
offset
=
0
;
nElems
=
pSegmentInfoSize
/
2
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
PathSegment
oSegment
=
PathSegment
(
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
+
offset
,
(
i
*
cb
),
pSegmentInfoSize
));
m_arSegments
.
push_back
(
oSegment
);
}
}
else
{
if
((
0xfff0
!=
cb
)
&&
(
8
!=
cb
)
&&
(
4
!=
cb
)
&&
(
2
!=
cb
))
{
cb
=
0xfff0
;
offset
=
0
;
nElems
=
pSegmentInfoSize
/
2
;
}
unsigned
short
cbElement
=
4
;
if
(
0xfff0
==
cb
)
{
cb
=
4
;
if
(
cb
==
0xfff0
)
cbElement
=
2
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
if
(
nElems
==
0
)
{
PathSegment
oSegment
=
PathSegment
(
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
+
offset
,
(
i
*
cb
),
pSegmentInfoSize
));
m_arSegments
.
push_back
(
oSegment
);
}
nElems
=
(
pSegmentInfoSize
-
offset
)
/
cbElement
;
}
else
{
if
((
2
!=
cb
)
&&
(
1
!=
cb
))
cb
=
8
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
PathSegment
oSegment
=
PathSegment
(
FormatUtils
::
BytesToInt32
(
pSegmentInfo
+
offset
,
(
i
*
cb
),
pSegmentInfoSize
));
PathSegment
oSegment
=
PathSegment
(
FormatUtils
::
BytesToInt32
(
pSegmentInfo
+
offset
,
(
i
*
cbElement
),
pSegmentInfoSize
-
offset
));
m_arSegments
.
push_back
(
oSegment
);
}
if
((
long
)
pSegmentInfoSize
<
(
long
)(
cb
*
nElems
))
// Есть несколько файлов с мусором вместо данных
if
((
long
)
pSegmentInfoSize
<
(
long
)(
cb
*
nElems
))
// Есть несколько файлов с мусором вместо данных
m_arSegments
.
clear
();
}
}
}
if
((
NULL
!=
pVertices
)
&&
(
pVerticesSize
>
0
))
{
...
...
@@ -117,19 +86,23 @@ namespace DocFileFormat
unsigned
short
nElemsAlloc
=
FormatUtils
::
BytesToUInt16
(
pVertices
,
2
,
pVerticesSize
);
unsigned
short
cb
=
FormatUtils
::
BytesToUInt16
(
pVertices
,
4
,
pVerticesSize
);
unsigned
short
cbElement
=
cb
;
if
(
cb
==
0xfff0
)
cbElement
=
4
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
POINT
point
;
if
(
0xfff0
==
cb
)
if
(
cbElement
==
4
)
{
cb
=
4
;
point
.
x
=
FormatUtils
::
BytesToInt16
(
pVertices
+
6
,
(
i
*
cb
),
pVerticesSize
);
point
.
y
=
FormatUtils
::
BytesToInt16
(
pVertices
+
6
,
(
i
*
cb
)
+
(
cb
/
2
),
pVerticesSize
);
point
.
x
=
FormatUtils
::
BytesToInt16
(
pVertices
+
offset
,
(
i
*
cbElement
),
pVerticesSize
-
offset
);
point
.
y
=
FormatUtils
::
BytesToInt16
(
pVertices
+
offset
,
(
i
*
cbElement
)
+
(
cbElement
/
2
),
pVerticesSize
-
offset
);
}
else
{
point
.
x
=
FormatUtils
::
BytesToInt32
(
pVertices
+
6
,
(
i
*
cb
),
pVerticesSize
);
point
.
y
=
FormatUtils
::
BytesToInt32
(
pVertices
+
6
,
(
i
*
cb
)
+
(
cb
/
2
),
pVerticesSize
);
point
.
x
=
FormatUtils
::
BytesToInt32
(
pVertices
+
offset
,
(
i
*
cbElement
),
pVerticesSize
-
offset
);
point
.
y
=
FormatUtils
::
BytesToInt32
(
pVertices
+
offset
,
(
i
*
cbElement
)
+
(
cbElement
/
2
),
pVerticesSize
-
offset
);
}
LONG
lMinF
=
(
LONG
)
0x80000000
;
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
View file @
d70f36e3
...
...
@@ -288,6 +288,7 @@ namespace DocFileFormat
int
ndyTextBottom
=
-
1
;
bool
bHavePath
=
false
;
int
nShapePath
=
-
1
;
int
nAdjValues
=
0
;
int
nLTxID
=
-
1
;
...
...
@@ -361,6 +362,7 @@ namespace DocFileFormat
case
shapePath
:
{
bHavePath
=
true
;
nShapePath
=
iter
->
op
;
}
break
;
case
pVertices
:
{
...
...
@@ -1653,7 +1655,7 @@ namespace DocFileFormat
}
if
(
!
bRelV
&&
m_pSpa
)
{
appendStyleProperty
(
oStyle
,
L"mso-position-vertical-relative"
,
mapVerticalPositionRelative
(
m_pSpa
->
b
x
));
appendStyleProperty
(
oStyle
,
L"mso-position-vertical-relative"
,
mapVerticalPositionRelative
(
m_pSpa
->
b
y
));
}
if
(
!
m_isInlineShape
&&
!
bZIndex
)
{
...
...
ASCOfficeDocFile/DocFormatTest/DocFormatTest.cpp
View file @
d70f36e3
...
...
@@ -29,19 +29,16 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
// DocFormatTest.cpp : Defines the entry point for the console application.
//
#include "../DocFormatLib/DocFormatLib.h"
#include "../../OfficeUtils/src/ASCOfficeCriticalSection.h"
#include <iostream>
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../
../DesktopEditor/common/Directory
.h"
#include "../
DocFormatLib/DocFormatLib
.h"
#include <string>
#include <windows.h>
#include <tchar.h>
#pragma comment(lib,"Shell32.lib")
#pragma comment(lib,"Advapi32.lib")
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
...
...
@@ -49,36 +46,34 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
int
_tmain
(
int
argc
,
_TCHAR
*
argv
[]
)
HRESULT
convert_single
(
std
::
wstring
srcFileName
)
{
if
(
argc
<
2
)
return
1
;
HRESULT
hr
=
S_OK
;
std
::
wstring
sSrcDoc
=
argv
[
1
];
std
::
wstring
sDstDocx
;
std
::
wstring
outputDir
=
NSDirectory
::
GetFolderPath
(
sSrcDoc
);
std
::
wstring
outputDir
=
NSDirectory
::
GetFolderPath
(
srcFileName
);
std
::
wstring
dstTempPath
=
NSDirectory
::
CreateDirectoryWithUniqueName
(
outputDir
);
std
::
wstring
dstPath
;
COfficeDocFile
docFile
;
docFile
.
m_sTempFolder
=
outputDir
;
bool
bMacros
=
true
;
HRESULT
hRes
=
docFile
.
LoadFromFile
(
s
SrcDoc
,
dstTempPath
,
L"password"
,
bMacros
,
NULL
);
HRESULT
hRes
=
docFile
.
LoadFromFile
(
s
rcFileName
,
dstTempPath
,
L"password"
,
bMacros
,
NULL
);
if
(
bMacros
)
{
sDstDocx
=
sSrcDoc
+
L"-my.docm"
;
dstPath
=
srcFileName
+
L"-my.docm"
;
}
else
{
sDstDocx
=
sSrcDoc
+
L"-my.docx"
;
dstPath
=
srcFileName
+
L"-my.docx"
;
}
if
(
hRes
==
S_OK
)
{
COfficeUtils
oCOfficeUtils
(
NULL
);
hRes
=
oCOfficeUtils
.
CompressFileOrDirectory
(
dstTempPath
.
c_str
(),
sDstDocx
,
-
1
);
hRes
=
oCOfficeUtils
.
CompressFileOrDirectory
(
dstTempPath
.
c_str
(),
dstPath
,
-
1
);
}
NSDirectory
::
DeleteDirectory
(
dstTempPath
);
...
...
@@ -86,3 +81,33 @@ int _tmain(int argc, _TCHAR* argv[])
return
hRes
;
}
HRESULT
convert_directory
(
std
::
wstring
pathName
)
{
HRESULT
hr
=
S_OK
;
std
::
vector
<
std
::
wstring
>
arFiles
=
NSDirectory
::
GetFiles
(
pathName
,
false
);
for
(
size_t
i
=
0
;
i
<
arFiles
.
size
();
i
++
)
{
convert_single
(
arFiles
[
i
]);
}
return
S_OK
;
}
int
_tmain
(
int
argc
,
_TCHAR
*
argv
[])
{
if
(
argc
<
2
)
return
1
;
HRESULT
hr
=
-
1
;
if
(
NSFile
::
CFileBinary
::
Exists
(
argv
[
1
]))
{
hr
=
convert_single
(
argv
[
1
]);
}
else
if
(
NSDirectory
::
Exists
(
argv
[
1
]))
{
hr
=
convert_directory
(
argv
[
1
]);
}
return
hr
;
}
\ No newline at end of file
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