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
a9509852
Commit
a9509852
authored
Oct 07, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b649255f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
611 additions
and
4 deletions
+611
-4
Common/base.pri
Common/base.pri
+1
-2
DesktopEditor/doctrenderer/doctrenderer.cpp
DesktopEditor/doctrenderer/doctrenderer.cpp
+10
-1
DesktopEditor/graphics/MetafileToGraphicsRenderer.h
DesktopEditor/graphics/MetafileToGraphicsRenderer.h
+263
-0
DesktopEditor/graphics/MetafileToRenderer.h
DesktopEditor/graphics/MetafileToRenderer.h
+337
-1
No files found.
Common/base.pri
View file @
a9509852
...
@@ -17,8 +17,7 @@ win32:!contains(QMAKE_TARGET.arch, x86_64): {
...
@@ -17,8 +17,7 @@ win32:!contains(QMAKE_TARGET.arch, x86_64): {
CONFIG += core_win_32
CONFIG += core_win_32
}
}
linux-g++
linux-g++ {
{
CONFIG += core_linux
CONFIG += core_linux
linux-g++:contains(QMAKE_HOST.arch, x86_64): {
linux-g++:contains(QMAKE_HOST.arch, x86_64): {
message("linux-64")
message("linux-64")
...
...
DesktopEditor/doctrenderer/doctrenderer.cpp
View file @
a9509852
...
@@ -68,6 +68,8 @@ namespace NSDoctRenderer
...
@@ -68,6 +68,8 @@ namespace NSDoctRenderer
bool
m_bIsRetina
;
bool
m_bIsRetina
;
int
m_nSaveToPDFParams
;
int
m_nSaveToPDFParams
;
bool
m_bIsOnlyOnePage
;
public:
public:
CExecuteParams
()
:
m_arChanges
()
CExecuteParams
()
:
m_arChanges
()
{
{
...
@@ -90,6 +92,8 @@ namespace NSDoctRenderer
...
@@ -90,6 +92,8 @@ namespace NSDoctRenderer
m_bIsRetina
=
false
;
m_bIsRetina
=
false
;
m_nSaveToPDFParams
=
0
;
m_nSaveToPDFParams
=
0
;
m_bIsOnlyOnePage
=
false
;
}
}
~
CExecuteParams
()
~
CExecuteParams
()
{
{
...
@@ -147,6 +151,8 @@ namespace NSDoctRenderer
...
@@ -147,6 +151,8 @@ namespace NSDoctRenderer
if
(
nParams
&
0x02
)
if
(
nParams
&
0x02
)
m_nSaveToPDFParams
=
1
;
m_nSaveToPDFParams
=
1
;
m_bIsOnlyOnePage
=
(
oNode
.
ReadValueInt
(
"OnlyOnePage"
,
0
)
==
1
)
?
true
:
false
;
return
true
;
return
true
;
}
}
};
};
...
@@ -523,7 +529,10 @@ namespace NSDoctRenderer
...
@@ -523,7 +529,10 @@ namespace NSDoctRenderer
if
(
js_func_get_file_s
->
IsFunction
())
if
(
js_func_get_file_s
->
IsFunction
())
{
{
v8
::
Handle
<
v8
::
Function
>
func_get_file_s
=
v8
::
Handle
<
v8
::
Function
>::
Cast
(
js_func_get_file_s
);
v8
::
Handle
<
v8
::
Function
>
func_get_file_s
=
v8
::
Handle
<
v8
::
Function
>::
Cast
(
js_func_get_file_s
);
args
[
0
]
=
v8
::
Int32
::
New
(
isolate
,
pParams
->
m_nSaveToPDFParams
);
if
(
pParams
->
m_bIsOnlyOnePage
)
args
[
0
]
=
v8
::
Int32
::
New
(
isolate
,
pParams
->
m_nSaveToPDFParams
);
else
args
[
0
]
=
v8
::
Int32
::
New
(
isolate
,
0x0100
);
v8
::
Local
<
v8
::
Value
>
js_result2
=
func_get_file_s
->
Call
(
global_js
,
1
,
args
);
v8
::
Local
<
v8
::
Value
>
js_result2
=
func_get_file_s
->
Call
(
global_js
,
1
,
args
);
if
(
try_catch
.
HasCaught
())
if
(
try_catch
.
HasCaught
())
...
...
DesktopEditor/graphics/MetafileToGraphicsRenderer.h
0 → 100644
View file @
a9509852
This diff is collapsed.
Click to expand it.
DesktopEditor/graphics/MetafileToRenderer.h
View file @
a9509852
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include "./IRenderer.h"
#include "./IRenderer.h"
#include "../common/String.h"
#include "../common/String.h"
#include <math.h>
#include <math.h>
#include "../common/Array.h"
#ifndef INT32
#ifndef INT32
typedef
int
INT32
;
typedef
int
INT32
;
...
@@ -202,6 +203,12 @@ namespace NSOnlineOfficeBinToPdf
...
@@ -202,6 +203,12 @@ namespace NSOnlineOfficeBinToPdf
return
ret
;
return
ret
;
#endif
#endif
}
}
static
inline
void
SkipInt
(
BYTE
*&
pData
,
int
&
nOffset
,
int
nCount
=
1
)
{
pData
+=
(
nCount
<<
2
);
nOffset
+=
(
nCount
<<
2
);
}
static
inline
USHORT
ReadUSHORT
(
BYTE
*&
pData
,
int
&
nOffset
)
static
inline
USHORT
ReadUSHORT
(
BYTE
*&
pData
,
int
&
nOffset
)
{
{
#ifdef _ARM_ALIGN_
#ifdef _ARM_ALIGN_
...
@@ -217,6 +224,11 @@ namespace NSOnlineOfficeBinToPdf
...
@@ -217,6 +224,11 @@ namespace NSOnlineOfficeBinToPdf
return
ret
;
return
ret
;
#endif
#endif
}
}
static
inline
void
SkipUSHORT
(
BYTE
*&
pData
,
int
&
nOffset
)
{
pData
+=
2
;
nOffset
+=
2
;
}
static
inline
std
::
wstring
ReadString16
(
BYTE
*&
pData
,
int
&
nOffset
,
int
nLen
)
static
inline
std
::
wstring
ReadString16
(
BYTE
*&
pData
,
int
&
nOffset
,
int
nLen
)
{
{
...
@@ -260,6 +272,11 @@ namespace NSOnlineOfficeBinToPdf
...
@@ -260,6 +272,11 @@ namespace NSOnlineOfficeBinToPdf
nOffset
+=
nLen
;
nOffset
+=
nLen
;
return
wsTempString
;
return
wsTempString
;
}
}
static
inline
void
SkipString16
(
BYTE
*&
pData
,
int
&
nOffset
,
int
nLen
)
{
pData
+=
nLen
;
nOffset
+=
nLen
;
}
static
bool
ConvertBufferToRenderer
(
BYTE
*
pBuffer
,
LONG
lBufferLen
,
IMetafileToRenderter
*
pCorrector
)
static
bool
ConvertBufferToRenderer
(
BYTE
*
pBuffer
,
LONG
lBufferLen
,
IMetafileToRenderter
*
pCorrector
)
{
{
...
@@ -312,6 +329,9 @@ namespace NSOnlineOfficeBinToPdf
...
@@ -312,6 +329,9 @@ namespace NSOnlineOfficeBinToPdf
pRenderer
->
EndCommand
(
c_nPageType
);
pRenderer
->
EndCommand
(
c_nPageType
);
if
(
lRendererType
==
c_nGrRenderer
)
return
true
;
break
;
break
;
}
}
case
ctPenColor
:
case
ctPenColor
:
...
@@ -477,7 +497,7 @@ namespace NSOnlineOfficeBinToPdf
...
@@ -477,7 +497,7 @@ namespace NSOnlineOfficeBinToPdf
case
2
:
case
2
:
{
{
LONG
lColorsCount
=
(
LONG
)
ReadInt
(
current
,
curindex
);
LONG
lColorsCount
=
(
LONG
)
ReadInt
(
current
,
curindex
);
if
(
0
<
=
lColorsCount
)
if
(
0
>
=
lColorsCount
)
{
{
pRenderer
->
put_BrushGradientColors
(
NULL
,
NULL
,
0
);
pRenderer
->
put_BrushGradientColors
(
NULL
,
NULL
,
0
);
}
}
...
@@ -806,6 +826,322 @@ namespace NSOnlineOfficeBinToPdf
...
@@ -806,6 +826,322 @@ namespace NSOnlineOfficeBinToPdf
return
true
;
return
true
;
}
}
class
CMetafilePageInfo
{
public:
double
width
;
double
height
;
BYTE
*
data
;
public:
CMetafilePageInfo
()
{
width
=
0
;
height
=
0
;
data
=
NULL
;
}
};
class
CMetafilePagesInfo
{
public:
int
PagesCount
;
CArray
<
CMetafilePageInfo
>
arSizes
;
public:
CMetafilePagesInfo
()
{
PagesCount
=
0
;
}
public:
inline
void
AddPage
()
{
++
PagesCount
;
arSizes
.
Add
();
}
void
CheckBuffer
(
BYTE
*
pBuffer
,
LONG
lBufferLen
)
{
CommandType
eCommand
=
ctError
;
bool
bIsPathOpened
=
false
;
int
curindex
=
0
;
BYTE
*
current
=
pBuffer
;
while
(
curindex
<
lBufferLen
)
{
eCommand
=
(
CommandType
)(
*
current
);
current
++
;
curindex
++
;
switch
(
eCommand
)
{
case
ctPageWidth
:
{
arSizes
[
PagesCount
].
width
=
(
ReadInt
(
current
,
curindex
)
/
100000.0
);
break
;
}
case
ctPageHeight
:
{
arSizes
[
PagesCount
].
height
=
(
ReadInt
(
current
,
curindex
)
/
100000.0
);
break
;
}
case
ctPageStart
:
{
AddPage
();
arSizes
[
PagesCount
].
data
=
current
;
break
;
}
case
ctPageEnd
:
{
break
;
}
case
ctPenColor
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctPenAlpha
:
{
current
++
;
curindex
++
;
break
;
}
case
ctPenSize
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctPenDashStyle
:
{
BYTE
nDashType
=
*
current
++
;
curindex
++
;
switch
(
nDashType
)
{
case
Aggplus
:
:
DashStyleCustom
:
{
int
nCountDash
=
ReadInt
(
current
,
curindex
);
if
(
0
<
nCountDash
)
{
SkipInt
(
current
,
curindex
,
nCountDash
);
}
}
defaut:
break
;
}
break
;
}
case
ctPenLineJoin
:
{
current
++
;
curindex
++
;
break
;
}
case
ctBrushType
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctBrushColor1
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctBrushAlpha1
:
{
current
++
;
curindex
++
;
break
;
}
case
ctBrushColor2
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctBrushAlpha2
:
{
current
++
;
curindex
++
;
break
;
}
case
ctBrushRectable
:
{
SkipInt
(
current
,
curindex
,
4
);
break
;
}
case
ctBrushRectableEnabled
:
{
current
+=
1
;
curindex
+=
1
;
break
;
}
case
ctBrushTexturePath
:
{
int
nLen
=
2
*
ReadUSHORT
(
current
,
curindex
);
SkipString16
(
current
,
curindex
,
nLen
);
break
;
}
case
ctBrushGradient
:
{
current
++
;
curindex
++
;
while
(
true
)
{
BYTE
_command
=
*
current
;
current
++
;
curindex
++
;
if
(
251
==
_command
)
break
;
switch
(
_command
)
{
case
0
:
{
current
+=
5
;
curindex
+=
5
;
SkipInt
(
current
,
curindex
,
4
);
break
;
}
case
1
:
{
current
++
;
curindex
++
;
SkipInt
(
current
,
curindex
,
6
);
break
;
}
case
2
:
{
LONG
lColorsCount
=
(
LONG
)
ReadInt
(
current
,
curindex
);
if
(
0
<=
lColorsCount
)
{
SkipInt
(
current
,
curindex
,
8
*
lColorsCount
);
}
break
;
}
default:
{
break
;
}
};
}
break
;
}
case
ctBrushTextureMode
:
{
current
+=
1
;
curindex
+=
1
;
break
;
}
case
ctBrushTextureAlpha
:
{
current
+=
1
;
curindex
+=
1
;
break
;
}
case
ctSetTransform
:
{
SkipInt
(
current
,
curindex
,
6
);
break
;
}
case
ctPathCommandStart
:
{
break
;
}
case
ctPathCommandMoveTo
:
{
SkipInt
(
current
,
curindex
,
2
);
break
;
}
case
ctPathCommandLineTo
:
{
SkipInt
(
current
,
curindex
,
2
);
break
;
}
case
ctPathCommandCurveTo
:
{
SkipInt
(
current
,
curindex
,
6
);
break
;
}
case
ctPathCommandClose
:
{
break
;
}
case
ctPathCommandEnd
:
{
break
;
}
case
ctDrawPath
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctDrawImageFromFile
:
{
int
nLen
=
ReadInt
(
current
,
curindex
);
SkipString16
(
current
,
curindex
,
nLen
);
SkipInt
(
current
,
curindex
,
4
);
break
;
}
case
ctFontName
:
{
int
nLen
=
2
*
(
int
)
ReadUSHORT
(
current
,
curindex
);
SkipString16
(
current
,
curindex
,
nLen
);
break
;
}
case
ctFontSize
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctFontStyle
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctDrawText
:
{
int
nLen
=
2
*
(
int
)
ReadUSHORT
(
current
,
curindex
);
SkipString16
(
current
,
curindex
,
nLen
);
SkipInt
(
current
,
curindex
,
2
);
break
;
}
case
ctBeginCommand
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctEndCommand
:
{
SkipInt
(
current
,
curindex
);
break
;
}
case
ctGradientFill
:
case
ctGradientFillXML
:
case
ctGradientStroke
:
case
ctGradientStrokeXML
:
{
// TODO: Эта команда не должна приходить
return
;
}
default:
{
break
;
}
};
// switch (eCommand)
}
// while (curindex < len)
}
};
}
}
#endif // _BUILD_METAFILE_TO_IRENDERER_H_
#endif // _BUILD_METAFILE_TO_IRENDERER_H_
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