Compare commits

..

11 Commits

Author SHA1 Message Date
635265eaa2 Feature/pre5.3.1 (#146)
* Fix bug with fonts installed not for all users

* Fix compilation error with gcc >=5

* Fix  build for xp
2019-05-29 15:29:19 +03:00
7636ff79cc v5.3.0 2019-05-27 17:05:18 +03:00
ed1019a004 Not writing transparency group in pdfa mode 2019-05-20 17:09:22 +03:00
35c4d70cf5 Fix bug 41615 2019-05-20 11:57:52 +03:00
0b987aeed2 Add variable for xp support 2019-05-17 15:00:16 +03:00
aefb229343 [x2t] Fix typo (Core props) 2019-05-16 18:25:10 +03:00
eb9d69d1ec Fix svg bug 2019-05-15 19:28:02 +03:00
9670d021c2 x2t - fix bug #41503 2019-05-14 19:22:20 +03:00
79f18355fe x2t - fix bug #41515 2019-05-13 15:27:03 +03:00
f86055c713 Epub images bug (xml files) 2019-05-08 12:51:29 +03:00
564b7f9c29 v5.2.8 2019-02-05 16:23:16 +03:00
15 changed files with 256 additions and 108 deletions

View File

@ -1818,7 +1818,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
std::wstring strCoord1 = oNodeShape.GetAttributeOrValue(L"from");
std::wstring strCoord2 = oNodeShape.GetAttributeOrValue(L"to");
if (strCoord1 != L"" && strCoord2 != L"")
if (!strCoord1.empty() && !strCoord2.empty())
{
std::vector<std::wstring> oArray1;
boost::algorithm::split(oArray1, strCoord1, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
@ -1905,7 +1905,7 @@ void CDrawingConverter::doc_LoadShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::C
int nOffsetX = _POINTS[0] - _x;
int nOffsetY = _POINTS[1] - _y;
strStyleAdvenced = L";margin-left:" + std::to_wstring(_x) + L";margin-top:" + std::to_wstring(_y)
strStyleAdvenced += L";margin-left:" + std::to_wstring(_x) + L";margin-top:" + std::to_wstring(_y)
+ L";width:" + std::to_wstring(_r - _x) + L";height:" + std::to_wstring(_b - _y) + L";polyline_correct:true;";
double dKoefX = 21600.0 / (std::max)((_r - _x), 1);
@ -3302,6 +3302,7 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
std::map<std::wstring, std::wstring>::iterator pFind;
bool bIsInline = false;
bool bIsMargin = false;
if (oProps.IsTop == true)
{
@ -3312,12 +3313,19 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
{
bIsInline = true;
}
if (((oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"margin-left")) &&
(oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"margin-top")))
||
((oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"left")) &&
(oCssStyles.m_mapSettings.end() != oCssStyles.m_mapSettings.find(L"top"))))
{
bIsMargin = true;
}
pFind = oCssStyles.m_mapSettings.find(L"mso-position-horizontal-relative");
if (oCssStyles.m_mapSettings.end() != pFind && (pFind->second == L"text" || pFind->second == L"char"))
if (oCssStyles.m_mapSettings.end() != pFind && ((pFind->second == L"text" && !bIsMargin) || pFind->second == L"char"))
{
pFind = oCssStyles.m_mapSettings.find(L"mso-position-vertical-relative");
if (oCssStyles.m_mapSettings.end() != pFind && (pFind->second == L"text" || pFind->second == L"line"))
if (oCssStyles.m_mapSettings.end() != pFind && ((pFind->second == L"text" && !bIsMargin) || pFind->second == L"line"))
{
bIsInline = true;
}
@ -3355,7 +3363,13 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (oCssStyles.m_mapSettings.end() != pFind)
{
left = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
std::vector<std::wstring> oArray1;
boost::algorithm::split(oArray1, pFind->second, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
for (size_t i = 0; i < oArray1.size(); i++)
{
left += (LONG)(dKoefSize * parserPoint.FromString(oArray1[i]) + 0.5);
}
}
pFind = oCssStyles.m_mapSettings.find(L"margin-top");
@ -3365,7 +3379,12 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
if (oCssStyles.m_mapSettings.end() != pFind)
{
top = (LONG)(dKoefSize * parserPoint.FromString(pFind->second) + 0.5);
std::vector<std::wstring> oArray1;
boost::algorithm::split(oArray1, pFind->second, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
for (size_t i = 0; i < oArray1.size(); i++)
{
top += (LONG)(dKoefSize * parserPoint.FromString(oArray1[i]) + 0.5);
}
}
}

View File

@ -79,7 +79,7 @@ namespace PPTX
XmlMacroReadNodeValueBase(oNode, _T("cp:revision"), revision);
XmlMacroReadNodeValueBase(oNode, _T("dc:subject"), subject);
XmlMacroReadNodeValueBase(oNode, _T("dc:title"), title);
XmlMacroReadNodeValueBase(oNode, _T("cp:version"), title);
XmlMacroReadNodeValueBase(oNode, _T("cp:version"), version);
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{
@ -217,7 +217,7 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->WriteNodeValue2(_T("dc:title"), title);
pWriter->WriteNodeValue2(_T("dc:subject"), title);
pWriter->WriteNodeValue2(_T("dc:subject"), subject);
pWriter->WriteNodeValue2(_T("dc:creator"), creator);
pWriter->WriteNodeValue2(_T("cp:keywords"), keywords);
pWriter->WriteNodeValue2(_T("dc:description"), description);
@ -242,9 +242,9 @@ namespace PPTX
pWriter->WriteStringXML(*modified);
pWriter->WriteNodeEnd(_T("dcterms:modified"));
}
pWriter->WriteNodeValue2(_T("cp:category"), revision);
pWriter->WriteNodeValue2(_T("cp:contentStatus"), revision);
pWriter->WriteNodeValue2(_T("cp:version"), revision);
pWriter->WriteNodeValue2(_T("cp:category"), category);
pWriter->WriteNodeValue2(_T("cp:contentStatus"), contentStatus);
pWriter->WriteNodeValue2(_T("cp:version"), version);
pWriter->EndNode(_T("cp:coreProperties"));
}

View File

@ -1,18 +1,9 @@
@echo off
SET SCRIPTPATH=%~dp0
CD /D %~dp0
SET PLATFORM=win_32
if defined ProgramFiles(x86) (
SET PLATFORM=win_64
)
if defined TARGET (
SET PLATFORM=%TARGET%
)
mkdir "%SCRIPTPATH%%PLATFORM%"
cd "%SCRIPTPATH%%PLATFORM%"
Powershell.exe -executionpolicy remotesigned -file %SCRIPTPATH%download.ps1 http://d2ettrnqo7v976.cloudfront.net/cef/3163/%PLATFORM%/cef_binary.7z cef_binary.7z cef_binary
setlocal
SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe"
SET UNSIP_PROGRAMM2="%ProgramFiles(x86)%\7-Zip\7z.exe"
@ -20,11 +11,48 @@ if exist %UNSIP_PROGRAMM2% (
SET UNSIP_PROGRAMM=%UNSIP_PROGRAMM2%
)
if exist "cef_binary" (
echo "cef_binary.7z already extracted"
) else (
call %UNSIP_PROGRAMM% x "cef_binary.7z"
mkdir build
xcopy /Y /S cef_binary\Release\* build\
xcopy /Y /S cef_binary\Resources\* build\
if defined BUILD_PLATFORM (
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
SET "BUILD_PLATFORMS=win_64 win_32 winxp_64 winxp_32"
GOTO :found
)
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:all=%" (
SET "BUILD_PLATFORMS=win_64 win_32"
GOTO :found
)
)
SET "BUILD_PLATFORMS=win_32"
if defined ProgramFiles(x86) (
SET "BUILD_PLATFORMS=win_64"
GOTO :found
)
if defined TARGET (
SET "BUILD_PLATFORMS=%TARGET%"
GOTO :found
)
echo "error"
GOTO :end
:found
for %%a in (%BUILD_PLATFORMS%) do (
echo "platform: %%a"
mkdir "%SCRIPTPATH%%%a"
cd "%SCRIPTPATH%%%a"
Powershell.exe -executionpolicy remotesigned -file %SCRIPTPATH%download.ps1 http://d2ettrnqo7v976.cloudfront.net/cef/3163/%%a/cef_binary.7z cef_binary.7z cef_binary
if exist "cef_binary" (
echo "cef_binary.7z already extracted"
) else (
call %UNSIP_PROGRAMM% x "cef_binary.7z"
mkdir build
xcopy /Y /S cef_binary\Release\* build\
xcopy /Y /S cef_binary\Resources\* build\
)
)
:end
endlocal
@echo on

View File

@ -1,64 +1,80 @@
@echo off
SET SCRIPTPATH=%~dp0
CD /D %~dp0
setlocal
SET ICU_MAJOR_VER=58
SET ICU_MINOR_VER=2
SET build_platform=win_32
if defined ProgramFiles(x86) (
SET build_platform=win_64
)
if defined TARGET (
SET build_platform=%TARGET%
)
if "%build_platform%" == "win_32" (
SET MACHINE=x86
)
if "%build_platform%" == "win_64" (
SET MACHINE=x64
)
if not exist "%build_platform%" (
md "%build_platform%"
)
if not exist "%build_platform%\build" (
md "%build_platform%\build"
)
cd "%SCRIPTPATH%%build_platform%"
if exist "%SCRIPTPATH%%build_platform%\icu\" (
echo "icu already exported"
) else (
svn export http://source.icu-project.org/repos/icu/tags/release-%ICU_MAJOR_VER%-%ICU_MINOR_VER%/icu4c ./icu
)
SET VC=%ProgramFiles%\Microsoft Visual Studio 14.0\VC
SET VC64=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC
if exist %VC64% (
SET VC=%VC64%
)
call "%VC%\vcvarsall.bat" %MACHINE%
if "%build_platform%" == "win_64" (
MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="X64"
) else (
MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="Win32"
SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe"
SET UNSIP_PROGRAMM2="%ProgramFiles(x86)%\7-Zip\7z.exe"
if exist %UNSIP_PROGRAMM2% (
SET UNSIP_PROGRAMM=%UNSIP_PROGRAMM2%
)
if "%build_platform%" == "win_64" (
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\bin64\icudt%ICU_MAJOR_VER%.dll" "%SCRIPTPATH%%build_platform%\build\"
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\bin64\icuuc%ICU_MAJOR_VER%.dll" "%SCRIPTPATH%%build_platform%\build\"
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\lib64\icudt.lib" "%SCRIPTPATH%%build_platform%\build\"
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\lib64\icuuc.lib" "%SCRIPTPATH%%build_platform%\build\"
) else (
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\bin\icudt%ICU_MAJOR_VER%.dll" "%SCRIPTPATH%%build_platform%\build\"
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\bin\icuuc%ICU_MAJOR_VER%.dll" "%SCRIPTPATH%%build_platform%\build\"
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\lib\icudt.lib" "%SCRIPTPATH%%build_platform%\build\"
XCOPY /Y "%SCRIPTPATH%%build_platform%\icu\lib\icuuc.lib" "%SCRIPTPATH%%build_platform%\build\"
if defined BUILD_PLATFORM (
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:all=%" (
SET "BUILD_PLATFORMS=win_64 win_32"
GOTO :found
)
)
SET "BUILD_PLATFORMS=win_32"
if defined ProgramFiles(x86) (
SET "BUILD_PLATFORMS=win_64"
GOTO :found
)
if defined TARGET (
SET "BUILD_PLATFORMS=%TARGET%"
GOTO :found
)
echo "error"
GOTO :end
:found
for %%a in (%BUILD_PLATFORMS%) do (
cd "%SCRIPTPATH%"
if not exist "%%a" (
md "%%a"
)
if not exist "%%a\build" (
md "%%a\build"
)
cd "%SCRIPTPATH%%%a"
if exist "icu" (
echo "icu already exported"
) else (
svn export http://source.icu-project.org/repos/icu/tags/release-%ICU_MAJOR_VER%-%ICU_MINOR_VER%/icu4c ./icu
)
if "%%a" == "win_64" (
call "%VC%\vcvarsall.bat" x64
MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="X64"
XCOPY /Y "icu\bin64\icudt%ICU_MAJOR_VER%.dll" "build\"
XCOPY /Y "icu\bin64\icuuc%ICU_MAJOR_VER%.dll" "build\"
XCOPY /Y "icu\lib64\icudt.lib" "build\"
XCOPY /Y "icu\lib64\icuuc.lib" "build\"
) else (
call "%VC%\vcvarsall.bat" x86
MSBuild.exe icu\source\allinone\allinone.sln /p:Configuration=Release /p:PlatformToolset=v140 /p:Platform="Win32"
XCOPY /Y "icu\bin\icudt%ICU_MAJOR_VER%.dll" "build\"
XCOPY /Y "icu\bin\icuuc%ICU_MAJOR_VER%.dll" "build\"
XCOPY /Y "icu\lib\icudt.lib" "build\"
XCOPY /Y "icu\lib\icuuc.lib" "build\"
)
)
cd "%SCRIPTPATH%"
:end
endlocal
@echo on

View File

@ -20,4 +20,8 @@ call ninja -C out.gn/win_32/release
call gn gen out.gn/win_32/debug --args="is_debug=true target_cpu=\"x86\" v8_target_cpu=\"x86\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
call ninja -C out.gn/win_32/debug
rem v8_use_snapshot=true v8_use_external_startup_data=true
rem v8_use_snapshot=true v8_use_external_startup_data=true
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
call %~dp0v8_xp\build.bat
cd %~dp0
)

View File

@ -24,3 +24,8 @@ call git checkout -b 6.0 -t branch-heads/6.0
cd ../
call gclient sync --no-history
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
call v8_xp\fetch.bat
cd %~dp0
)

View File

@ -1,7 +1,7 @@
SET SCRIPTPATH=%~dp0
CD /D %~dp0
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\win_tools-2_7_6_bin\python\bin;%PATH%
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\win_tools-2_7_13_chromium7_bin\python\bin;%PATH%
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
SET GYP_MSVS_VERSION=2015

View File

@ -8,7 +8,7 @@ if exist "depot_tools" (
call powershell -File .\fix-depot_tools.ps1
)
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\python276_bin;%PATH%
SET PATH=%SCRIPTPATH%depot_tools;%SCRIPTPATH%depot_tools\win_tools-2_7_13_chromium7_bin\python\bin;%PATH%
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
SET GYP_MSVS_VERSION=2015

View File

@ -37,6 +37,12 @@ CONFIG(debug, debug|release) {
#PLATFORM
win32 {
CONFIG += core_windows
WINDOWS_VERSION_XP = $$(WINDOWS_VERSION_XP)
!isEmpty(WINDOWS_VERSION_XP) {
CONFIG += build_xp
message(xp using)
}
}
DST_ARCH=$$QMAKE_TARGET.arch

View File

@ -25,6 +25,10 @@ LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lUnicodeConverter -lkernel -lgraphics
} else {
DEFINES += V8_OS_XP
DESTDIR=$$DESTDIR/xp
OBJECTS_DIR = $$OBJECTS_DIR/xp
MOC_DIR = $$MOC_DIR/xp
RCC_DIR = $$RCC_DIR/xp
UI_DIR = $$UI_DIR/xp
include(../../Common/3dParty/v8/v8_xp/v8.pri)
}

View File

@ -1626,6 +1626,25 @@ std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles()
continue;
}
}
if (true)
{
std::vector<std::wstring> oArray2 = NSDirectory::GetFiles(L"C:/Windows/Fonts", true);
wchar_t sUserName[1000];
DWORD nUserNameLen = 1000 + 1;
GetUserNameW(sUserName, &nUserNameLen);
std::wstring strUserName(sUserName, nUserNameLen - 1);
NSDirectory::GetFiles2(L"C:\\Users\\" + strUserName + L"\\AppData\\Local\\Microsoft\\Windows\\Fonts", oArray2, true);
for (std::vector<std::wstring>::iterator i = oArray2.begin(); i != oArray2.end(); i++)
{
if (map_files.end() == map_files.find(*i))
oArray.push_back(*i);
}
}
return oArray;
#endif

View File

@ -5580,6 +5580,12 @@ namespace SVG
inline bool LoadFromFile (const std::wstring& strFile, Storage* model)
{
#if 0
std::wstring sExt = NSFile::GetFileExtention(strFile);
if (sExt != L"svg" && sExt != L"xml")
return false;
#endif
if (model)
{
m_model = model;
@ -5613,19 +5619,26 @@ namespace SVG
}
XmlUtils::CXmlNode oXml;
if (oXml.FromXmlString(sXml))
{
m_nLayerLevel = 0;
if (!oXml.FromXmlString(sXml))
return false;
if (Explore(oXml))
{
m_model->JoinXLinkReference();
m_model->JoinClipPathLinks();
m_model->JoinStyleLinks();
std::wstring sNodeName = oXml.GetName();
if (L"svg" != sNodeName &&
L"g" != sNodeName &&
L"xml" != sNodeName)
return false;
return true;
}
}
m_nLayerLevel = 0;
if (Explore(oXml))
{
m_model->JoinXLinkReference();
m_model->JoinClipPathLinks();
m_model->JoinStyleLinks();
return true;
}
}
return false;
@ -5923,7 +5936,7 @@ namespace SVG
if (!strXmlNode.empty())
{
if ('#' == strXmlNode.c_str()[0])
return false;
return NULL;
}
#ifdef _DEBUG

View File

@ -51,14 +51,26 @@
#include <stdio.h>
#endif
class CHtmlFile_Private
{
public:
bool m_bIsEpub;
public:
CHtmlFile_Private()
{
m_bIsEpub = false;
}
};
CHtmlFile::CHtmlFile()
{
m_internal = new CHtmlFile_Private();
}
CHtmlFile::~CHtmlFile()
{
RELEASEOBJECT(m_internal);
}
static std::wstring GetSdkPath()
@ -261,7 +273,20 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
oBuilder.WriteEncodeXmlString(CorrectHtmlPath(sFilePath));
else
{
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"HTM");
std::wstring sTmpDir = L"";
if (m_internal->m_bIsEpub)
{
// чтобы ссылки на картинки остались
sTmpDir = NSFile::GetDirectoryName(sFilePath);
if (!NSDirectory::Exists(sTmpDir))
sTmpDir = NSDirectory::GetTempPath();
}
else
{
sTmpDir = NSDirectory::GetTempPath();
}
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"HTM");
if (NSFile::CFileBinary::Exists(sTmpFile))
NSFile::CFileBinary::Remove(sTmpFile);
@ -665,7 +690,10 @@ int CHtmlFile::ConvertEpub(const std::wstring& sFolder, std::wstring& sMetaInfo,
if (arHtmls.size() == 0)
return 1;
return this->Convert(arHtmls, sDstfolder, sPathInternal);
m_internal->m_bIsEpub = true;
int nErr = this->Convert(arHtmls, sDstfolder, sPathInternal);
m_internal->m_bIsEpub = false;
return nErr;
}
/////////////////////////////////////////////////////////////////

View File

@ -42,9 +42,11 @@
#define HTMLFILE_DECL_EXPORT Q_DECL_EXPORT
#endif
class CHtmlFile_Private;
class HTMLFILE_DECL_EXPORT CHtmlFile
{
private:
CHtmlFile_Private* m_internal;
public:

View File

@ -645,15 +645,18 @@ namespace PdfWriter
}
delete[] pA;
if (!m_pTransparencyGroup)
{
m_pTransparencyGroup = new CDictObject();
m_pTransparencyGroup->Add("Type", "Group");
m_pTransparencyGroup->Add("S", "Transparency");
m_pTransparencyGroup->Add("CS", "DeviceRGB");
}
if (!IsPDFA())
{
if (!m_pTransparencyGroup)
{
m_pTransparencyGroup = new CDictObject();
m_pTransparencyGroup->Add("Type", "Group");
m_pTransparencyGroup->Add("S", "Transparency");
m_pTransparencyGroup->Add("CS", "DeviceRGB");
}
pPage->Add("Group", m_pTransparencyGroup);
pPage->Add("Group", m_pTransparencyGroup);
}
double dWidth = pPage->GetWidth();
double dHeight = pPage->GetHeight();
@ -662,7 +665,8 @@ namespace PdfWriter
pXObject->Add("Type", "XObject");
pXObject->Add("Subtype", "Form");
pXObject->Add("BBox", CArrayObject::CreateBox(0, 0, dWidth, dHeight));
pXObject->Add("Group", m_pTransparencyGroup);
if (m_pTransparencyGroup)
pXObject->Add("Group", m_pTransparencyGroup);
CDictObject* pResources = new CDictObject();
pXObject->Add("Resources", pResources);
CDictObject* pResShadings = new CDictObject();