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
16af8670
Commit
16af8670
authored
Apr 26, 2016
by
Oleg Korshul
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
сделал полностью работу с быстрым открытием в десктопе
parent
4ab14c9c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
159 additions
and
11 deletions
+159
-11
HtmlRenderer/include/HTMLRenderer3.h
HtmlRenderer/include/HTMLRenderer3.h
+7
-1
HtmlRenderer/src/HTMLRenderer3.cpp
HtmlRenderer/src/HTMLRenderer3.cpp
+109
-4
HtmlRenderer/src/Writer.h
HtmlRenderer/src/Writer.h
+42
-5
HtmlRenderer/test/test.pro
HtmlRenderer/test/test.pro
+1
-1
No files found.
HtmlRenderer/include/HTMLRenderer3.h
View file @
16af8670
...
...
@@ -2,6 +2,7 @@
#define _ASC_HTMLRENDERER3_H_
#include "../../DesktopEditor/graphics/IRenderer.h"
#include "../../DesktopEditor/common/officedrawingfile.h"
#ifndef HTMLRENDERER_USE_DYNAMIC_LIBRARY
#define HTMLRENDERER_DECL_EXPORT
...
...
@@ -145,12 +146,17 @@ namespace NSHtmlRenderer
virtual
HRESULT
get_Mode
(
LONG
*
plMode
);
virtual
HRESULT
put_Mode
(
LONG
lMode
);
virtual
HRESULT
CreateOfficeFile
(
std
::
wstring
bsFileName
);
virtual
HRESULT
CreateOfficeFile
(
std
::
wstring
bsFileName
,
const
std
::
wstring
&
fontsDir
=
L""
);
virtual
HRESULT
CloseFile
();
virtual
HRESULT
SetAdditionalParam
(
std
::
string
sParamName
,
int
nValue
);
virtual
HRESULT
SetAdditionalParam
(
std
::
string
sParamName
,
const
std
::
wstring
&
sParam
);
bool
GetOnlyTextMode
();
void
SetOnlyTextMode
(
const
bool
&
enabled
);
void
GetLastPageInfo
(
int
&
paragraphs
,
int
&
words
,
int
&
symbols
,
int
&
spaces
,
std
::
string
&
sBase64Data
);
protected:
CASCHTMLRenderer3_Private
*
m_pInternal
;
};
...
...
HtmlRenderer/src/HTMLRenderer3.cpp
View file @
16af8670
...
...
@@ -48,10 +48,14 @@ namespace NSHtmlRenderer
int
m_nTempUnicodesAlloc
;
int
m_nTempUnicodesLen
;
bool
m_bIsOnlyTextMode
;
bool
m_bDisablePageEnd
;
public:
CASCHTMLRenderer3_Private
()
{
m_oApplicationFonts
.
Initialize
();
// initialize move to CreateOfficeFile (custom directory support)
//m_oApplicationFonts.Initialize();
m_oApplicationFonts
.
GetCache
()
->
SetCacheSize
(
16
);
m_lLastSavedPage
=
0
;
...
...
@@ -79,6 +83,11 @@ namespace NSHtmlRenderer
m_nTempUnicodesAlloc
=
100
;
m_pTempUnicodes
=
new
int
[
m_nTempUnicodesAlloc
];
m_nTempUnicodesLen
=
0
;
m_bIsOnlyTextMode
=
false
;
m_bPageOpened
=
false
;
m_bDisablePageEnd
=
false
;
}
~
CASCHTMLRenderer3_Private
()
{
...
...
@@ -172,7 +181,7 @@ namespace NSHtmlRenderer
void
EndPage
()
{
m_oWriter
.
EndPage
();
m_bPageOpened
=
FALSE
;
m_bPageOpened
=
false
;
}
void
_SetFont
()
...
...
@@ -750,6 +759,12 @@ namespace NSHtmlRenderer
//-------- Маркеры для команд ---------------------------------------------------------------
HRESULT
CASCHTMLRenderer3
::
BeginCommand
(
const
DWORD
&
lType
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
{
m_pInternal
->
m_lCurrentCommandType
=
lType
;
return
S_OK
;
}
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
&&
lType
!=
c_nPDFTilingFill
)
return
m_pInternal
->
m_oDumper
.
BeginCommand
(
lType
);
...
...
@@ -780,10 +795,20 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
EndCommand
(
const
DWORD
&
lType
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
{
if
(
c_nPageType
==
lType
&&
!
m_pInternal
->
m_bDisablePageEnd
)
{
m_pInternal
->
EndPage
();
}
m_pInternal
->
m_lCurrentCommandType
=
-
1
;
return
S_OK
;
}
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
&&
lType
!=
c_nPDFTilingFill
)
return
m_pInternal
->
m_oDumper
.
EndCommand
(
lType
);
if
(
c_nPageType
==
lType
)
if
(
c_nPageType
==
lType
&&
!
m_pInternal
->
m_bDisablePageEnd
)
{
m_pInternal
->
EndPage
();
}
...
...
@@ -833,6 +858,9 @@ namespace NSHtmlRenderer
//-------- Функции для работы с Graphics Path -----------------------------------------------
HRESULT
CASCHTMLRenderer3
::
PathCommandMoveTo
(
const
double
&
x
,
const
double
&
y
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandMoveTo
(
x
,
y
);
...
...
@@ -849,6 +877,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandLineTo
(
const
double
&
x
,
const
double
&
y
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandLineTo
(
x
,
y
);
...
...
@@ -865,6 +896,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandLinesTo
(
double
*
points
,
const
int
&
count
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandLinesTo
(
points
,
count
);
...
...
@@ -873,6 +907,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandCurveTo
(
const
double
&
x1
,
const
double
&
y1
,
const
double
&
x2
,
const
double
&
y2
,
const
double
&
x3
,
const
double
&
y3
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandCurveTo
(
x1
,
y1
,
x2
,
y2
,
x3
,
y3
);
...
...
@@ -889,6 +926,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandCurvesTo
(
double
*
points
,
const
int
&
count
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandCurvesTo
(
points
,
count
);
...
...
@@ -897,6 +937,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandArcTo
(
const
double
&
x
,
const
double
&
y
,
const
double
&
w
,
const
double
&
h
,
const
double
&
startAngle
,
const
double
&
sweepAngle
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandArcTo
(
x
,
y
,
w
,
h
,
startAngle
,
sweepAngle
);
...
...
@@ -905,6 +948,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandClose
()
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandClose
();
...
...
@@ -921,6 +967,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandEnd
()
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandEnd
();
...
...
@@ -937,6 +986,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
DrawPath
(
const
LONG
&
nType
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
DrawPath
(
nType
);
...
...
@@ -945,6 +997,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandStart
()
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandStart
();
...
...
@@ -962,11 +1017,17 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandGetCurrentPoint
(
double
*
x
,
double
*
y
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
m_pInternal
->
m_oSimpleGraphicsConverter
.
PathCommandGetCurrentPoint
(
x
,
y
);
return
S_OK
;
}
HRESULT
CASCHTMLRenderer3
::
PathCommandTextCHAR
(
const
LONG
&
c
,
const
double
&
x
,
const
double
&
y
,
const
double
&
w
,
const
double
&
h
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandTextCHAR
(
c
,
x
,
y
,
w
,
h
);
...
...
@@ -978,6 +1039,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandText
(
const
std
::
wstring
&
bsText
,
const
double
&
x
,
const
double
&
y
,
const
double
&
w
,
const
double
&
h
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandText
(
bsText
,
x
,
y
,
w
,
h
);
...
...
@@ -990,6 +1054,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandTextExCHAR
(
const
LONG
&
c
,
const
LONG
&
gid
,
const
double
&
x
,
const
double
&
y
,
const
double
&
w
,
const
double
&
h
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandTextExCHAR
(
c
,
gid
,
x
,
y
,
w
,
h
);
...
...
@@ -1003,6 +1070,9 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
PathCommandTextEx
(
const
std
::
wstring
&
bsUnicodeText
,
const
unsigned
int
*
pGids
,
const
unsigned
int
nGidsCount
,
const
double
&
x
,
const
double
&
y
,
const
double
&
w
,
const
double
&
h
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
PathCommandTextEx
(
bsUnicodeText
,
pGids
,
nGidsCount
,
x
,
y
,
w
,
h
);
...
...
@@ -1015,6 +1085,9 @@ namespace NSHtmlRenderer
//-------- Функции для вывода изображений ---------------------------------------------------
HRESULT
CASCHTMLRenderer3
::
DrawImage
(
IGrObject
*
pImage
,
const
double
&
x
,
const
double
&
y
,
const
double
&
w
,
const
double
&
h
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
DrawImage
(
pImage
,
x
,
y
,
w
,
h
);
...
...
@@ -1027,6 +1100,9 @@ namespace NSHtmlRenderer
HRESULT
CASCHTMLRenderer3
::
DrawImageFromFile
(
const
std
::
wstring
&
sPath
,
const
double
&
x
,
const
double
&
y
,
const
double
&
w
,
const
double
&
h
,
const
BYTE
&
lAlpha
)
{
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
m_pInternal
->
m_bIsGraphicsDumperMode
)
return
m_pInternal
->
m_oDumper
.
DrawImageFromFile
(
sPath
,
x
,
y
,
w
,
h
,
lAlpha
);
...
...
@@ -1109,8 +1185,13 @@ namespace NSHtmlRenderer
return
S_OK
;
}
HRESULT
CASCHTMLRenderer3
::
CreateOfficeFile
(
std
::
wstring
bsFileName
)
HRESULT
CASCHTMLRenderer3
::
CreateOfficeFile
(
std
::
wstring
bsFileName
,
const
std
::
wstring
&
fontsDir
)
{
if
(
fontsDir
.
empty
())
m_pInternal
->
m_oApplicationFonts
.
Initialize
();
else
m_pInternal
->
m_oApplicationFonts
.
InitializeFromFolder
(
fontsDir
);
m_pInternal
->
m_strDstFile
=
bsFileName
;
size_t
pos1
=
m_pInternal
->
m_strDstFile
.
find_last_of
(
wchar_t
(
'/'
));
...
...
@@ -1178,6 +1259,14 @@ namespace NSHtmlRenderer
}
HRESULT
CASCHTMLRenderer3
::
SetAdditionalParam
(
std
::
string
sParamName
,
const
std
::
wstring
&
sParam
)
{
if
(
"DisablePageEnd"
==
sParamName
)
{
m_pInternal
->
m_bDisablePageEnd
=
L"yes"
==
sParam
;
}
if
(
m_pInternal
->
m_bIsOnlyTextMode
)
return
S_OK
;
if
(
"TilingHtmlPattern"
==
sParamName
)
{
if
(
1
==
m_pInternal
->
m_oWriter
.
m_lTilingCounter
)
...
...
@@ -1200,4 +1289,20 @@ namespace NSHtmlRenderer
}
return
S_OK
;
}
bool
CASCHTMLRenderer3
::
GetOnlyTextMode
()
{
return
m_pInternal
->
m_bIsOnlyTextMode
;
}
void
CASCHTMLRenderer3
::
SetOnlyTextMode
(
const
bool
&
enabled
)
{
m_pInternal
->
m_oWriter
.
m_bIsOnlyTextMode
=
enabled
;
m_pInternal
->
m_bIsOnlyTextMode
=
enabled
;
}
void
CASCHTMLRenderer3
::
GetLastPageInfo
(
int
&
paragraphs
,
int
&
words
,
int
&
symbols
,
int
&
spaces
,
std
::
string
&
sBase64Data
)
{
m_pInternal
->
m_oWriter
.
GetLastPageInfo
(
paragraphs
,
words
,
symbols
,
spaces
,
sBase64Data
);
}
}
HtmlRenderer/src/Writer.h
View file @
16af8670
...
...
@@ -9,6 +9,8 @@
#include "Document.h"
#include "../../DesktopEditor/fontengine/FontConverter.h"
#include "../../DesktopEditor/ChromiumBasedEditors2/lib/src/Logger.h"
namespace
NSHtmlRenderer
{
static
double
__g_matrix_eps
=
0.0001
;
...
...
@@ -1239,6 +1241,8 @@ namespace NSHtmlRenderer
bool
m_bIsClipping
;
bool
m_bIsSimpleGraphics
;
bool
m_bIsOnlyTextMode
;
public:
CWriter
()
{
...
...
@@ -1272,6 +1276,8 @@ namespace NSHtmlRenderer
m_bIsClipping
=
false
;
m_bIsSimpleGraphics
=
false
;
m_lTilingCounter
=
0
;
m_bIsOnlyTextMode
=
false
;
}
void
SetApplicationFonts
(
CApplicationFonts
*
pFonts
)
...
...
@@ -1514,10 +1520,37 @@ namespace NSHtmlRenderer
m_arrPages
[
m_arrPages
.
size
()
-
1
].
m_lEnd
=
m_lCurrentDumpSize
+
m_oPage
.
GetPosition
();
m_lCurrentDumpSize
+=
m_oPage
.
GetPosition
();
m_oFileWriter
.
WriteFile
(
m_oPage
.
GetData
(),
m_oPage
.
GetPosition
());
if
(
!
m_bIsOnlyTextMode
)
m_oFileWriter
.
WriteFile
(
m_oPage
.
GetData
(),
m_oPage
.
GetPosition
());
m_oPage
.
Clear
();
}
void
GetLastPageInfo
(
int
&
paragraphs
,
int
&
words
,
int
&
symbols
,
int
&
spaces
,
std
::
string
&
sBase64Data
)
{
m_oSmartText
.
ClosePage
();
paragraphs
=
(
int
)
m_oSmartText
.
m_lCountParagraphs
;
words
=
(
int
)
m_oSmartText
.
m_lCountWords
;
spaces
=
(
int
)
m_oSmartText
.
m_lCountSpaces
;
symbols
=
(
int
)
m_oSmartText
.
m_lCountSymbols
;
sBase64Data
=
""
;
if
(
m_lPagesCount
>
0
)
{
char
*
pDst
=
NULL
;
int
nDst
=
0
;
NSFile
::
CBase64Converter
::
Encode
(
m_oPage
.
GetData
(),
(
int
)
m_oPage
.
GetPosition
(),
pDst
,
nDst
,
NSBase64
::
B64_BASE64_FLAG_NOCRLF
);
if
(
0
<
nDst
)
sBase64Data
=
std
::
string
(
pDst
);
sBase64Data
=
std
::
to_string
((
int
)
m_oPage
.
GetPosition
())
+
";"
+
sBase64Data
;
RELEASEARRAYOBJECTS
(
pDst
);
}
}
inline
void
CheckVectorGraphics
()
{
/*
...
...
@@ -2070,15 +2103,19 @@ namespace NSHtmlRenderer
m_strDstDirectoryFiles
=
m_strDstDirectory
+
L"/"
+
strFileName
;
// + _T("_files");
m_strFileName
=
strFileName
;
NSDirectory
::
CreateDirectory
(
m_strDstDirectoryFiles
);
if
(
!
m_bIsOnlyTextMode
)
NSDirectory
::
CreateDirectory
(
m_strDstDirectoryFiles
);
m_strDstMedia
=
m_strDstDirectoryFiles
+
L"/media"
;
NSDirectory
::
CreateDirectory
(
m_strDstMedia
);
if
(
!
m_bIsOnlyTextMode
)
NSDirectory
::
CreateDirectory
(
m_strDstMedia
);
std
::
wstring
strFileFonts
=
m_strDstDirectoryFiles
+
L"/fonts"
;
NSDirectory
::
CreateDirectory
(
strFileFonts
);
if
(
!
m_bIsOnlyTextMode
)
NSDirectory
::
CreateDirectory
(
strFileFonts
);
std
::
wstring
strDocRendererS
=
m_strDstDirectoryFiles
+
L"/document_temp.bin"
;
m_oFileWriter
.
CreateFileW
(
strDocRendererS
);
if
(
!
m_bIsOnlyTextMode
)
m_oFileWriter
.
CreateFileW
(
strDocRendererS
);
m_oPage
.
Clear
();
m_arrPages
.
clear
();
...
...
HtmlRenderer/test/test.pro
View file @
16af8670
...
...
@@ -26,7 +26,7 @@ INCLUDEPATH += \
TEMPLATE
=
app
###############
destination
path
###############
DESTINATION_SDK_PATH
=
$$
PWD
/../../
SDK
/
lib
DESTINATION_SDK_PATH
=
$$
PWD
/../../
build
/
lib
#
WINDOWS
win32
:
contains
(
QMAKE_TARGET
.
arch
,
x86_64
)
:
{
...
...
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