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
1ae20da7
Commit
1ae20da7
authored
May 10, 2016
by
Oleg Korshul
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
новая схема (несколько скриптов)
parent
65d37bb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
35 deletions
+102
-35
DesktopEditor/doctrenderer/doctrenderer.cpp
DesktopEditor/doctrenderer/doctrenderer.cpp
+50
-26
HtmlFile/HtmlFile.cpp
HtmlFile/HtmlFile.cpp
+49
-6
HtmlFile/test/test.pro
HtmlFile/test/test.pro
+3
-3
No files found.
DesktopEditor/doctrenderer/doctrenderer.cpp
View file @
1ae20da7
...
...
@@ -203,9 +203,9 @@ namespace NSDoctRenderer
std
::
wstring
m_strConfigPath
;
CArray
<
std
::
wstring
>
m_arrFiles
;
std
::
wstring
m_st
rDoctSDK
;
std
::
wstring
m_st
rPpttSDK
;
std
::
wstring
m_st
rXlstSDK
;
std
::
vector
<
std
::
wstring
>
m_a
rDoctSDK
;
std
::
vector
<
std
::
wstring
>
m_a
rPpttSDK
;
std
::
vector
<
std
::
wstring
>
m_a
rXlstSDK
;
std
::
wstring
m_strEditorType
;
std
::
wstring
m_strFilePath
;
...
...
@@ -250,30 +250,17 @@ namespace NSDoctRenderer
}
}
m_strDoctSDK
=
L""
;
m_strPpttSDK
=
L""
;
m_strXlstSDK
=
L""
;
XmlUtils
::
CXmlNode
oNodeSdk
=
oNode
.
ReadNode
(
L"DoctSdk"
);
if
(
oNodeSdk
.
IsValid
())
m_strDoctSDK
=
oNodeSdk
.
GetText
(
);
LoadSDK_scripts
(
oNodeSdk
,
m_arDoctSDK
);
oNodeSdk
=
oNode
.
ReadNode
(
L"PpttSdk"
);
if
(
oNodeSdk
.
IsValid
())
m_strPpttSDK
=
oNodeSdk
.
GetText
(
);
LoadSDK_scripts
(
oNodeSdk
,
m_arPpttSDK
);
oNodeSdk
=
oNode
.
ReadNode
(
L"XlstSdk"
);
if
(
oNodeSdk
.
IsValid
())
m_strXlstSDK
=
oNodeSdk
.
GetText
();
if
(
!
NSFile
::
CFileBinary
::
Exists
(
m_strDoctSDK
))
m_strDoctSDK
=
m_strConfigDir
+
m_strDoctSDK
;
if
(
!
NSFile
::
CFileBinary
::
Exists
(
m_strPpttSDK
))
m_strPpttSDK
=
m_strConfigDir
+
m_strPpttSDK
;
if
(
!
NSFile
::
CFileBinary
::
Exists
(
m_strXlstSDK
))
m_strXlstSDK
=
m_strConfigDir
+
m_strXlstSDK
;
LoadSDK_scripts
(
oNodeSdk
,
m_arXlstSDK
);
m_sConsoleLogFile
=
L""
;
m_sErrorsLogFile
=
L""
;
...
...
@@ -299,6 +286,37 @@ namespace NSDoctRenderer
}
void
LoadSDK_scripts
(
XmlUtils
::
CXmlNode
&
oNode
,
std
::
vector
<
std
::
wstring
>&
_files
)
{
XmlUtils
::
CXmlNodes
oNodes
;
if
(
oNode
.
GetNodes
(
L"file"
,
oNodes
))
{
int
nCount
=
oNodes
.
GetCount
();
XmlUtils
::
CXmlNode
_node
;
for
(
int
i
=
0
;
i
<
nCount
;
++
i
)
{
oNodes
.
GetAt
(
i
,
_node
);
std
::
wstring
strFilePath
=
_node
.
GetText
();
if
(
NSFile
::
CFileBinary
::
Exists
(
strFilePath
)
&&
!
NSFile
::
CFileBinary
::
Exists
(
m_strConfigDir
+
strFilePath
))
_files
.
push_back
(
strFilePath
);
else
_files
.
push_back
(
m_strConfigDir
+
strFilePath
);
}
}
else
{
std
::
wstring
strFilePath
=
oNode
.
GetText
();
if
(
NSFile
::
CFileBinary
::
Exists
(
strFilePath
)
&&
!
NSFile
::
CFileBinary
::
Exists
(
m_strConfigDir
+
strFilePath
))
_files
.
push_back
(
strFilePath
);
else
_files
.
push_back
(
m_strConfigDir
+
strFilePath
);
}
}
public:
static
void
_LOGGING_ERROR_
(
const
std
::
wstring
&
strType
,
const
std
::
wstring
&
strError
)
...
...
@@ -960,7 +978,7 @@ namespace NSDoctRenderer
m_pInternal
->
m_oParams
.
FromXml
(
strXml
);
m_pInternal
->
m_arImagesInChanges
.
clear
();
std
::
wstring
sResourceFile
;
std
::
vector
<
std
::
wstring
>*
arSdkFiles
=
NULL
;
switch
(
m_pInternal
->
m_oParams
.
m_eSrcFormat
)
{
case
DoctRendererFormat
:
:
DOCT
:
...
...
@@ -971,7 +989,7 @@ namespace NSDoctRenderer
case
DoctRendererFormat
:
:
PDF
:
case
DoctRendererFormat
:
:
HTML
:
{
sResourceFile
=
m_pInternal
->
m_st
rDoctSDK
;
arSdkFiles
=
&
m_pInternal
->
m_a
rDoctSDK
;
m_pInternal
->
m_strEditorType
=
L"document"
;
break
;
}
...
...
@@ -987,7 +1005,7 @@ namespace NSDoctRenderer
case
DoctRendererFormat
:
:
PPTT
:
case
DoctRendererFormat
:
:
PDF
:
{
sResourceFile
=
m_pInternal
->
m_st
rPpttSDK
;
arSdkFiles
=
&
m_pInternal
->
m_a
rPpttSDK
;
m_pInternal
->
m_strEditorType
=
L"presentation"
;
break
;
}
...
...
@@ -1003,7 +1021,7 @@ namespace NSDoctRenderer
case
DoctRendererFormat
:
:
XLST
:
case
DoctRendererFormat
:
:
PDF
:
{
sResourceFile
=
m_pInternal
->
m_st
rXlstSDK
;
arSdkFiles
=
&
m_pInternal
->
m_a
rXlstSDK
;
m_pInternal
->
m_strEditorType
=
L"spreadsheet"
;
break
;
}
...
...
@@ -1037,9 +1055,15 @@ namespace NSDoctRenderer
strScript
+=
"
\n\n
"
;
}
// теперь оборачиваем сами
//strScript += ("(function(){" + m_pInternal->ReadScriptFile(sResourceFile) + "})();");
strScript
+=
m_pInternal
->
ReadScriptFile
(
sResourceFile
);
if
(
NULL
!=
arSdkFiles
)
{
for
(
std
::
vector
<
std
::
wstring
>::
iterator
i
=
arSdkFiles
->
begin
();
i
!=
arSdkFiles
->
end
();
i
++
)
{
strScript
+=
m_pInternal
->
ReadScriptFile
(
*
i
);
strScript
+=
"
\n\n
"
;
}
}
if
(
m_pInternal
->
m_strEditorType
==
L"spreadsheet"
)
strScript
+=
"
\n
$.ready();"
;
...
...
HtmlFile/HtmlFile.cpp
View file @
1ae20da7
...
...
@@ -117,13 +117,36 @@ static void GetScriptsPath(NSStringUtils::CStringBuilder& oBuilder)
}
}
std
::
wstring
sPath
=
oNode
.
ReadValueString
(
L"DoctSdk"
);
if
(
!
NSFile
::
CFileBinary
::
Exists
(
sPath
)
||
NSFile
::
CFileBinary
::
Exists
(
sProcess
+
sPath
))
sPath
=
sProcess
+
sPath
;
XmlUtils
::
CXmlNode
oNodeSdk
=
oNode
.
ReadNode
(
L"DoctSdk"
);
XmlUtils
::
CXmlNodes
oNodes
;
if
(
oNodeSdk
.
GetNodes
(
L"file"
,
oNodes
))
{
int
nCount
=
oNodes
.
GetCount
();
XmlUtils
::
CXmlNode
_node
;
for
(
int
i
=
0
;
i
<
nCount
;
++
i
)
{
oNodes
.
GetAt
(
i
,
_node
);
std
::
wstring
sPath
=
_node
.
GetText
();
if
(
!
NSFile
::
CFileBinary
::
Exists
(
sPath
)
||
NSFile
::
CFileBinary
::
Exists
(
sProcess
+
sPath
))
sPath
=
sProcess
+
sPath
;
oBuilder
.
WriteString
(
L"<sdk>"
);
oBuilder
.
WriteEncodeXmlString
(
CorrectHtmlPath
(
sPath
));
oBuilder
.
WriteString
(
L"</sdk>"
);
}
}
else
{
std
::
wstring
sPath
=
oNodeSdk
.
GetText
();
if
(
!
NSFile
::
CFileBinary
::
Exists
(
sPath
)
||
NSFile
::
CFileBinary
::
Exists
(
sProcess
+
sPath
))
sPath
=
sProcess
+
sPath
;
oBuilder
.
WriteString
(
L"<sdk>"
);
oBuilder
.
WriteEncodeXmlString
(
CorrectHtmlPath
(
sPath
));
oBuilder
.
WriteString
(
L"</sdk>"
);
oBuilder
.
WriteString
(
L"<sdk>"
);
oBuilder
.
WriteEncodeXmlString
(
CorrectHtmlPath
(
sPath
));
oBuilder
.
WriteString
(
L"</sdk>"
);
}
}
int
CHtmlFile
::
Convert
(
const
std
::
vector
<
std
::
wstring
>&
arFiles
,
const
std
::
wstring
&
sDstfolder
,
const
std
::
wstring
&
sPathInternal
)
...
...
@@ -214,11 +237,31 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
NULL, NULL, TRUE, CREATE_UNICODE_ENVIRONMENT, (LPVOID)pCommandLineEnv, NULL, &sturtupinfo, &processinfo);
#else
HANDLE
ghJob
=
CreateJobObject
(
NULL
,
NULL
);
if
(
ghJob
)
{
JOBOBJECT_EXTENDED_LIMIT_INFORMATION
jeli
=
{
0
};
// Configure all child processes associated with the job to terminate when the
jeli
.
BasicLimitInformation
.
LimitFlags
=
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
;
if
(
0
==
SetInformationJobObject
(
ghJob
,
JobObjectExtendedLimitInformation
,
&
jeli
,
sizeof
(
jeli
)))
{
CloseHandle
(
ghJob
);
ghJob
=
NULL
;
}
}
PROCESS_INFORMATION
processinfo
;
ZeroMemory
(
&
processinfo
,
sizeof
(
PROCESS_INFORMATION
));
BOOL
bResult
=
CreateProcessW
(
sInternal
.
c_str
(),
pCommandLine
,
NULL
,
NULL
,
TRUE
,
NULL
,
NULL
,
NULL
,
&
sturtupinfo
,
&
processinfo
);
if
(
bResult
&&
ghJob
)
{
AssignProcessToJobObject
(
ghJob
,
processinfo
.
hProcess
);
}
#endif
::
WaitForSingleObject
(
processinfo
.
hProcess
,
INFINITE
);
...
...
HtmlFile/test/test.pro
View file @
1ae20da7
...
...
@@ -24,7 +24,7 @@ CONFIG += c++11
TEMPLATE
=
app
###############
destination
path
###############
DESTINATION_SDK_PATH
=
$$
PWD
/../../
SDK
/
lib
DESTINATION_SDK_PATH
=
$$
PWD
/../../
build
/
lib
#
WINDOWS
win32
:
contains
(
QMAKE_TARGET
.
arch
,
x86_64
)
:
{
...
...
@@ -56,8 +56,8 @@ LIBS += -L$$DESTINATION_SDK_PATH -lgraphics
linux
-
g
++
|
linux
-
g
++-
64
|
linux
-
g
++-
32
{
QMAKE_LFLAGS
+=
-
Wl
,
--
rpath
=./
LIBS
+=
$$
PWD
/../../
UnicodeConverter
/
icubuilds
/
linux64
/
usr
/
local
/
lib
/
libicuuc
.
so
.
55
LIBS
+=
$$
PWD
/../../
UnicodeConverter
/
icubuilds
/
linux64
/
usr
/
local
/
lib
/
libicudata
.
so
.
55
LIBS
+=
$$
PWD
/../../
build
/
bin
/
icu
/
linux_64
/
libicuuc
.
so
.
55
LIBS
+=
$$
PWD
/../../
build
/
bin
/
icu
/
linux_64
/
libicudata
.
so
.
55
message
(
linux
)
}
...
...
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