From ca3ac2df80ff313459cece515efa180e3502b91e Mon Sep 17 00:00:00 2001 From: "Oleg.Korshul" Date: Mon, 19 Jan 2015 14:28:48 +0000 Subject: [PATCH] doctrenderer work under windows git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@60556 954022d7-b5bf-4e40-9824-e11837661b57 --- .gitattributes | 1 + DesktopEditor/doctrenderer/doctrenderer.cpp | 24 ++- .../doctrenderer/test/doctrenderer_test.pro | 141 ++++++++++++++++++ DesktopEditor/doctrenderer/test/main.cpp | 28 ++++ 4 files changed, 188 insertions(+), 6 deletions(-) create mode 100644 DesktopEditor/doctrenderer/test/doctrenderer_test.pro create mode 100644 DesktopEditor/doctrenderer/test/main.cpp diff --git a/.gitattributes b/.gitattributes index 75ad8013f0..bc70fe473e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1400,6 +1400,7 @@ DesktopEditor/cximage/png/pngnow.png svn_mime_002dtype=application%2Foctet-strea DesktopEditor/cximage/png/pngtest.png svn_mime_002dtype=application%2Foctet-stream DesktopEditor/cximage/zlib/zlib.3.pdf svn_mime_002dtype=application%2Foctet-stream DesktopEditor/doctrenderer svnc_tsvn_003alogminsize=5 +DesktopEditor/doctrenderer/test svnc_tsvn_003alogminsize=5 DesktopEditor/editor/GLplatform svnc_tsvn_003alogminsize=5 DesktopEditor/editor/build/windows/Test/break_one.bmp svn_mime_002dtype=application%2Foctet-stream DesktopEditor/editor/build/windows/Test/break_two.bmp svn_mime_002dtype=application%2Foctet-stream diff --git a/DesktopEditor/doctrenderer/doctrenderer.cpp b/DesktopEditor/doctrenderer/doctrenderer.cpp index b1be431ad5..2c5db0a635 100644 --- a/DesktopEditor/doctrenderer/doctrenderer.cpp +++ b/DesktopEditor/doctrenderer/doctrenderer.cpp @@ -136,8 +136,8 @@ namespace NSDoctRenderer { m_bIsInitTypedArrays = false; - m_strConfigPath = NSFile::GetProcessDirectory(); - m_strConfigDir = m_strConfigDir + L"DoctRenderer.config"; + m_strConfigDir = NSFile::GetProcessDirectory() + L"/"; + m_strConfigPath = m_strConfigDir + L"DoctRenderer.config"; XmlUtils::CXmlNode oNode; if (oNode.FromXmlFile(m_strConfigPath)) @@ -280,13 +280,25 @@ namespace NSDoctRenderer std::wstring strFileName = m_oParams.m_strSrcFilePath; strFileName += L"/Editor.bin"; - string_replaceAll(strFileName, L"\\\\", L"\\"); - string_replaceAll(strFileName, L"//", L"/"); - string_replaceAll(strFileName, L"\\", L"/"); + strFileName = string_replaceAll(strFileName, L"\\\\", L"\\"); + strFileName = string_replaceAll(strFileName, L"//", L"/"); + strFileName = string_replaceAll(strFileName, L"\\", L"/"); m_strFilePath = strFileName; - std::string strScript = this->ReadScriptFile(sResourceFile); + std::string strScript = ""; + for (size_t i = 0; i < m_arrFiles.GetCount(); ++i) + { +#if 0 + if (m_arrFiles[i].find(L"AllFonts.js") != std::wstring::npos) + continue; +#endif + + strScript += this->ReadScriptFile(m_arrFiles[i]); + strScript += "\n\n"; + } + + strScript += this->ReadScriptFile(sResourceFile); if (m_strEditorType == L"spreadsheet") strScript += "\n$.ready();"; diff --git a/DesktopEditor/doctrenderer/test/doctrenderer_test.pro b/DesktopEditor/doctrenderer/test/doctrenderer_test.pro new file mode 100644 index 0000000000..12c31fc009 --- /dev/null +++ b/DesktopEditor/doctrenderer/test/doctrenderer_test.pro @@ -0,0 +1,141 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2015-01-19T14:14:33 +# +#------------------------------------------------- + +QT += core + +QT -= gui + +TARGET = doctrenderer_test +CONFIG += console +CONFIG -= app_bundle + +DEFINES += _UNICODE +DEFINES += _USE_LIBXML2_READER_ +DEFINES += LIBXML_READER_ENABLED + +TEMPLATE = app + +CONFIG(debug, debug|release) { + LIBS += -L../../Debug/debug -ldoctrenderer + message(debug) +} else { + LIBS += -L../../Release/release -ldoctrenderer + message(release) +} + +linux-g++ | linux-g++-64 | linux-g++-32 { + DEFINES += \ + LINUX \ + _LINUX \ + _LINUX_QT +} + +linux-g++:contains(QMAKE_HOST.arch, x86_64):{ + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/tools/gyp -lv8_base.x64 + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/tools/gyp -lv8_snapshot + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/tools/gyp -lv8_nosnapshot.x64 + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/third_party/icu -licui18n + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/third_party/icu -licuuc + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/third_party/icu -licudata + + message(linux64) +} +linux-g++:!contains(QMAKE_HOST.arch, x86_64):{ + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/tools/gyp -lv8_base.ia32 + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/tools/gyp -lv8_snapshot + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/tools/gyp -lv8_nosnapshot.ia32 + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/third_party/icu -licui18n + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/third_party/icu -licuuc + #LIBS += -L../../../../../../../../../v8/out/native/obj.target/third_party/icu -licudata + + message(linux32) +} + +mac { + DEFINES += \ + LINUX \ + _LINUX \ + _LINUX_QT \ + _MAC \ + QT_MAC + + LIBS += -L../../../../../../../../../v8/out/native -lv8_base.x64 + LIBS += -L../../../../../../../../../v8/out/native -lv8_snapshot + LIBS += -L../../../../../../../../../v8/out/native -lv8_nosnapshot.x64 + LIBS += -L../../../../../../../../../v8/out/native -licui18n + LIBS += -L../../../../../../../../../v8/out/native -licuuc + LIBS += -L../../../../../../../../../v8/out/native -licudata + + message(mac) +} + +win32 { + DEFINES += \ + WIN32 + + DEFINES -= UNICODE + + LIBS += -lwinmm + LIBS += -ladvapi32 +} + +win32:contains(QMAKE_TARGET.arch, x86_64):{ + +CONFIG(debug, debug|release) { + LIBS += -L../../../../SDK/lib/win_64/DEBUG -lgraphics + + LIBS += -L../../../../SDK/lib/win_64/DEBUG -llibxml2 + + LIBS += -L../../../../SDK/lib/win_64/DEBUG -lv8_libbase + LIBS += -L../../../../SDK/lib/win_64/DEBUG -lv8_base + LIBS += -L../../../../SDK/lib/win_64/DEBUG -lv8_nosnapshot + LIBS += -L../../../../SDK/lib/win_64/DEBUG -lv8_snapshot + LIBS += -L../../../../SDK/lib/win_64/DEBUG -lv8_libplatform + LIBS += -L../../../../SDK/lib/win_64/DEBUG -licui18n + LIBS += -L../../../../SDK/lib/win_64/DEBUG -licuuc +} else { + LIBS += -L../../../../SDK/lib/win_64 -lgraphics + + LIBS += -L../../../../SDK/lib/win_64 -llibxml2 + + LIBS += -L../../../../SDK/lib/win_64 -lv8_libbase + LIBS += -L../../../../SDK/lib/win_64 -lv8_base + LIBS += -L../../../../SDK/lib/win_64 -lv8_nosnapshot + LIBS += -L../../../../SDK/lib/win_64 -lv8_snapshot + LIBS += -L../../../../SDK/lib/win_64 -lv8_libplatform + LIBS += -L../../../../SDK/lib/win_64 -licui18n + LIBS += -L../../../../SDK/lib/win_64 -licuuc +} + + message(windows64) +} +win32:!contains(QMAKE_TARGET.arch, x86_64):{ + LIBS += -L../../../../SDK/lib/win_32 -lgraphics + + LIBS += -L../../../../SDK/lib/win_32 -llibxml2 + + LIBS += -L../../../../SDK/lib/win_32 -lv8_libbase + LIBS += -L../../../../SDK/lib/win_32 -lv8_base + LIBS += -L../../../../SDK/lib/win_32 -lv8_nosnapshot + LIBS += -L../../../../SDK/lib/win_32 -lv8_snapshot + LIBS += -L../../../../SDK/lib/win_32 -lv8_libplatform + LIBS += -L../../../../SDK/lib/win_32 -licui18n + LIBS += -L../../../../SDK/lib/win_32 -licuuc + + message(windows32) +} + +INCLUDEPATH += \ + ../../../agg-2.4/include \ + ../../../freetype-2.5.2/include \ + ../../../../../../../v8_trunk \ + ../../../../../../../v8_trunk/include \ + ../../../Common/DocxFormat/Source/XML/libxml2/XML/include \ + + +SOURCES += main.cpp \ + ../../../Common/DocxFormat/Source/XML/libxml2/libxml2.cpp \ + ../../../Common/DocxFormat/Source/XML/stringcommon.cpp diff --git a/DesktopEditor/doctrenderer/test/main.cpp b/DesktopEditor/doctrenderer/test/main.cpp new file mode 100644 index 0000000000..7a320a5104 --- /dev/null +++ b/DesktopEditor/doctrenderer/test/main.cpp @@ -0,0 +1,28 @@ +#include + +#include "../doctrenderer.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + std::wstring strXml = L"\ +0\ +0\ +D:\\build_doc\ +D:\\build_doc\\EditorWithChanges.bin\ +D:\\activex\\AVS\\Sources\\TeamlabOffice\\trunk\\OfficeWeb\\Fonts\\native\ +D:\\build_doc\\media\ +D:\\activex\\AVS\\Sources\\TeamlabOffice\\trunk\\ServerComponents\\Test\\Applications\\TestAVSOfficeDocxFile2\\TestAVSOfficeDocxFile2\\bin\\x86\\presentationthemes\ +\ +D:\\build_doc\\changes\\changes0.json\ +\ +"; + + NSDoctRenderer::CDoctrenderer oRenderer; + + std::wstring sError; + oRenderer.Execute(strXml, sError); + + return a.exec(); +}