mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4894639c09 | |||
| 3727c2e982 | |||
| a5122a6a47 | |||
| c9330ee0f1 | |||
| 2214362426 | |||
| bf600c6eb0 | |||
| 0db6728463 | |||
| 09c43b1179 | |||
| 390ab3bcc8 | |||
| 075f70c220 | |||
| 6abf1613ec | |||
| 0abc21d4ee | |||
| 7a7cdab770 | |||
| 7ae3c6f2ea | |||
| 35bd2803a4 | |||
| e7bf661432 |
@ -26,15 +26,15 @@ if not exist "%folder%" (
|
||||
md %folder%\shared
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
|
||||
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\static\"
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
|
||||
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\static_fpic\"
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET%
|
||||
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\shared\"
|
||||
)
|
||||
|
||||
@ -54,14 +54,20 @@ if not exist "%folder%" (
|
||||
md %folder%\shared
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
|
||||
.\bjam.exe link=static --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\static\"
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
|
||||
.\bjam.exe link=static cxxflags=-fPIC --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\static_fpic\"
|
||||
|
||||
.\b2.exe --clean
|
||||
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET%
|
||||
.\bjam.exe link=shared --with-filesystem --with-system --with-date_time --with-regex address-model=64 --toolset=%TOOLSET% || goto :error
|
||||
XCOPY /Y stage\lib\* "%folder%\shared\"
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo "Failed with error #%errorlevel%."
|
||||
exit /b %errorlevel%
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
|
||||
@ -4,7 +4,7 @@ CD /D %~dp0
|
||||
if exist "%SCRIPTPATH%boost_1_58_0.7z" (
|
||||
echo "boost already downloaded"
|
||||
) else (
|
||||
Powershell.exe Invoke-WebRequest -OutFile boost_1_58_0.7z http://freefr.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
|
||||
Powershell.exe Invoke-WebRequest -OutFile boost_1_58_0.7z https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox
|
||||
)
|
||||
|
||||
SET UNSIP_PROGRAMM="C:\Program Files\7-Zip\7z.exe"
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
BOOST_URL=https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
@ -12,21 +11,11 @@ case "$os" in
|
||||
*) exit ;;
|
||||
esac
|
||||
|
||||
if [[ "$platform" == *"mac"* ]]
|
||||
then
|
||||
if [[ -f "$SCRIPTPATH/7zX_1.7.1.dmg" ]]
|
||||
then
|
||||
echo "7z already downloaded"
|
||||
else
|
||||
wget http://static.updatestar.net/dl/7zX/7zX_1.7.1.dmg
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -f "$SCRIPTPATH/boost_1_58_0.7z" ]]
|
||||
then
|
||||
echo "boost already downloaded"
|
||||
else
|
||||
wget http://freefr.dl.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.7z
|
||||
wget $BOOST_URL || curl -O $BOOST_URL
|
||||
fi
|
||||
|
||||
if [ -d "$SCRIPTPATH/boost_1_58_0" ]; then
|
||||
@ -36,8 +25,6 @@ if [[ "$platform" == *"linux"* ]]
|
||||
then
|
||||
7z x -y "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
|
||||
else
|
||||
hdiutil mount "$SCRIPTPATH/7zX_1.7.1.dmg"
|
||||
/Volumes/7zX/7zX.app/Contents/Resources/7za x "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
|
||||
hdiutil unmount /Volumes/7zX
|
||||
7za x "$SCRIPTPATH/boost_1_58_0.7z" -o"$SCRIPTPATH/"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
@ -42,9 +40,10 @@ cef_version="3163"
|
||||
if [[ "$platform" == *"linux"* ]]
|
||||
then
|
||||
cef_version="3202"
|
||||
fi
|
||||
|
||||
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/$cef_version/$platform$arch/$cef_arch
|
||||
else
|
||||
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/$cef_version/$platform/$cef_arch
|
||||
fi
|
||||
|
||||
if [[ "$platform" == *"linux"* ]]
|
||||
then
|
||||
@ -75,3 +74,15 @@ then
|
||||
cp -r -t build/ ./$cef_binary/Release/* ./$cef_binary/Resources/*
|
||||
chmod a+xr build/locales
|
||||
fi
|
||||
|
||||
if [[ "$platform" == *"mac"* ]]
|
||||
then
|
||||
if [ -d "build/Chromium Embedded Framework.framework" ]
|
||||
then
|
||||
echo "cef_binary already extracted"
|
||||
else
|
||||
wget $cef_url || curl -O $cef_url
|
||||
7za x $cef_arch
|
||||
mv "$cef_binary" "build/Chromium Embedded Framework.framework"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
SET MACHINE=x86
|
||||
if defined ProgramFiles(x86) (
|
||||
SET MACHINE=x64
|
||||
)
|
||||
|
||||
if "%TARGET%" == "win-32" (
|
||||
SET MACHINE=x86
|
||||
)
|
||||
|
||||
if "%TARGET%" == "win-64" (
|
||||
SET MACHINE=x64
|
||||
)
|
||||
|
||||
if "%MACHINE%" == "x86" (
|
||||
SET OUTPUT=win_32
|
||||
)
|
||||
|
||||
if "%MACHINE%" == "x64" (
|
||||
SET OUTPUT=win_64
|
||||
)
|
||||
|
||||
SET VC=%ProgramFiles%\Microsoft Visual Studio 12.0\VC
|
||||
SET VC64=%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC
|
||||
if exist %VC64% (
|
||||
SET VC=%VC64%
|
||||
)
|
||||
|
||||
call "%VC%\vcvarsall.bat" %MACHINE%
|
||||
|
||||
cd curl
|
||||
call buildconf.bat
|
||||
cd winbuild
|
||||
nmake /f Makefile.vc mode=static ENABLE_WINSSL=yes MACHINE=%MACHINE% VC=12
|
||||
|
||||
if not exist "%SCRIPTPATH%%OUTPUT%" (
|
||||
md %SCRIPTPATH%%OUTPUT%\build
|
||||
xcopy /Y /S ..\builds\libcurl-vc12-%MACHINE%-release-static-ipv6-sspi-winssl\lib\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\
|
||||
move %SCRIPTPATH%%OUTPUT%\build\libcurl_a.lib %SCRIPTPATH%%OUTPUT%\build\curl.lib
|
||||
)
|
||||
|
||||
cd ..\..
|
||||
@ -1,73 +0,0 @@
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
|
||||
case "$os" in
|
||||
Linux*)
|
||||
platform="linux"
|
||||
BUILD_PLATFORM=Linux
|
||||
;;
|
||||
Darwin*)
|
||||
platform="mac"
|
||||
BUILD_PLATFORM=MacOSX
|
||||
;;
|
||||
*) exit ;;
|
||||
esac
|
||||
|
||||
|
||||
architecture=$(uname -m)
|
||||
arch=""
|
||||
|
||||
case "$architecture" in
|
||||
x86_64*) arch="_64" ;;
|
||||
*) arch="_32" ;;
|
||||
esac
|
||||
|
||||
if [[ -d "$SCRIPTPATH/$platform$arch" ]]
|
||||
then
|
||||
echo
|
||||
else
|
||||
mkdir "$SCRIPTPATH/$platform$arch"
|
||||
fi
|
||||
|
||||
CURL_FOLDER=curl
|
||||
cd ${CURL_FOLDER}
|
||||
|
||||
if [[ ! -f configure ]]
|
||||
then
|
||||
./buildconf
|
||||
fi
|
||||
|
||||
if [[ ! -f Makefile ]]
|
||||
then
|
||||
./configure \
|
||||
--disable-shared \
|
||||
--enable-static \
|
||||
--disable-ldap \
|
||||
--disable-sspi \
|
||||
--without-librtmp \
|
||||
--disable-ftp \
|
||||
--disable-file \
|
||||
--disable-dict \
|
||||
--disable-telnet \
|
||||
--disable-tftp \
|
||||
--disable-rtsp \
|
||||
--disable-pop3 \
|
||||
--disable-imap \
|
||||
--disable-smtp \
|
||||
--disable-gopher \
|
||||
--disable-smb \
|
||||
--without-libidn
|
||||
fi
|
||||
|
||||
make
|
||||
|
||||
if [ ! -d "$SCRIPTPATH/$platform$arch/build" ]
|
||||
then
|
||||
DESTDIR="$SCRIPTPATH/$platform$arch" make install
|
||||
mkdir -p "$SCRIPTPATH/$platform$arch/build"
|
||||
cp "$SCRIPTPATH/$platform$arch/usr/local/lib/libcurl.a" "$SCRIPTPATH/$platform$arch/build/"
|
||||
fi
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
core_linux {
|
||||
INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/usr/local/include
|
||||
|
||||
LIBS += -lcurl
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
CD /D %~dp0
|
||||
SET CURL_FOLDER=curl
|
||||
IF NOT EXIST %CURL_FOLDER% CALL git clone https://github.com/curl/curl.git %CURL_FOLDER%
|
||||
CD %CURL_FOLDER%
|
||||
CALL git fetch
|
||||
CALL git checkout curl-7_54_1
|
||||
CD ..
|
||||
@ -1,8 +0,0 @@
|
||||
CURL_FOLDER=curl
|
||||
if [ ! -d ${CURL_FOLDER} ]; then
|
||||
git clone https://github.com/curl/curl.git ${CURL_FOLDER}
|
||||
fi
|
||||
cd ${CURL_FOLDER}
|
||||
git fetch
|
||||
git checkout curl-7_54_1
|
||||
cd ..
|
||||
@ -25,6 +25,10 @@ if defined BUILD_PLATFORM (
|
||||
SET "BUILD_PLATFORMS=win_64 win_32"
|
||||
GOTO :found
|
||||
)
|
||||
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
|
||||
SET "BUILD_PLATFORMS=win_64 win_32"
|
||||
GOTO :found
|
||||
)
|
||||
)
|
||||
|
||||
SET "BUILD_PLATFORMS=win_32"
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
ICU_MAJOR_VER=58
|
||||
ICU_MINOR_VER=2
|
||||
@ -59,11 +57,19 @@ else
|
||||
svn export http://source.icu-project.org/repos/icu/tags/release-$ICU_MAJOR_VER-$ICU_MINOR_VER/icu4c ./icu
|
||||
fi
|
||||
|
||||
# Workaround for building icu older than 60.0
|
||||
# on systems without xlocale.h (removed from glibc since 2.26)
|
||||
# See https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
|
||||
# See https://bugs.archlinux.org/task/55246
|
||||
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
|
||||
if [[ "$platform" == *"linux"* ]]
|
||||
then
|
||||
# Workaround for building icu older than 60.0
|
||||
# on systems without xlocale.h (removed from glibc since 2.26)
|
||||
# See https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
|
||||
# See https://bugs.archlinux.org/task/55246
|
||||
sed -i 's/xlocale/locale/' ./icu/source/i18n/digitlst.cpp
|
||||
fi
|
||||
|
||||
if [[ "$platform" == *"mac"* ]]
|
||||
then
|
||||
sed -i -e 's/cmd\, \"%s %s -o %s%s %s %s%s %s %s\"\,/cmd\, \"%s %s -o %s%s %s %s %s %s %s\"\,/' ./icu/source/tools/pkgdata/pkgdata.cpp
|
||||
fi
|
||||
|
||||
cd ./icu/source/
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
ICU_MAJOR_VER=62
|
||||
ICU_MINOR_VER=1
|
||||
|
||||
@ -14,7 +14,13 @@ FOR /f "tokens=*" %%i in ('DIR /a:d /b *') DO (
|
||||
ECHO %%i
|
||||
|
||||
if exist %%i/build.bat (
|
||||
call %%i/build.bat
|
||||
call %%i/build.bat || goto :error
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo "Failed with error #%errorlevel%."
|
||||
exit /b %errorlevel%
|
||||
@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd "$SCRIPTPATH"
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd "$SCRIPTPATH"/openssl
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd "$SCRIPTPATH"
|
||||
|
||||
|
||||
@ -9,19 +9,25 @@ call powershell -File .\fix-static_crt.ps1
|
||||
cd v8
|
||||
|
||||
call gn gen out.gn/win_64/release --args="is_debug=false target_cpu=\"x64\" v8_target_cpu=\"x64\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
|
||||
call ninja -C out.gn/win_64/release
|
||||
call ninja -C out.gn/win_64/release || goto :error
|
||||
|
||||
call gn gen out.gn/win_64/debug --args="is_debug=true target_cpu=\"x64\" v8_target_cpu=\"x64\" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
|
||||
call ninja -C out.gn/win_64/debug
|
||||
call ninja -C out.gn/win_64/debug || goto :error
|
||||
|
||||
call gn gen out.gn/win_32/release --args="is_debug=false 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/release
|
||||
call ninja -C out.gn/win_32/release || goto :error
|
||||
|
||||
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
|
||||
call ninja -C out.gn/win_32/debug || goto :error
|
||||
|
||||
rem v8_use_snapshot=true v8_use_external_startup_data=true
|
||||
if not "%BUILD_PLATFORM%"=="%BUILD_PLATFORM:xp=%" (
|
||||
call %~dp0v8_xp\build.bat
|
||||
call %~dp0v8_xp\build.bat || goto :error
|
||||
cd %~dp0
|
||||
)
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo "Failed with error #%errorlevel%."
|
||||
exit /b %errorlevel%
|
||||
@ -2,8 +2,7 @@
|
||||
|
||||
export PATH=`pwd`/depot_tools:"$PATH"
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
os=$(uname -s)
|
||||
platform=""
|
||||
@ -38,6 +37,7 @@ fi
|
||||
|
||||
if [[ "$platform" == "mac" ]]
|
||||
then
|
||||
sed -i -e "s/if (mac_sdk_version != mac_sdk_min_build_override/if (false \&\& mac_sdk_version != mac_sdk_min_build_override/g" build/config/mac/mac_sdk.gni
|
||||
# for new macOS!!!
|
||||
#sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
|
||||
gn gen out.gn/mac_64 --args='is_debug=false target_cpu="x64" v8_static_library=true is_component_build=false v8_use_snapshot=false'
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0" || grealpath "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd "$SCRIPTPATH"
|
||||
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
export PATH=`pwd`/depot_tools:"$PATH"
|
||||
|
||||
|
||||
@ -27,8 +27,8 @@ if not exist "win_32" (
|
||||
|
||||
cd "%SCRIPTPATH%v8\tools\gyp"
|
||||
|
||||
call devenv v8.sln /Rebuild "Release"
|
||||
call devenv v8.sln /Rebuild "Debug"
|
||||
call devenv v8.sln /Rebuild "Release" || goto :error
|
||||
call devenv v8.sln /Rebuild "Debug" || goto :error
|
||||
|
||||
cd "%SCRIPTPATH%"
|
||||
|
||||
@ -51,8 +51,8 @@ if not exist "win_64" (
|
||||
|
||||
cd "%SCRIPTPATH%v8\tools\gyp"
|
||||
|
||||
call devenv v8.sln /Rebuild "Release"
|
||||
call devenv v8.sln /Rebuild "Debug"
|
||||
call devenv v8.sln /Rebuild "Release" || goto :error
|
||||
call devenv v8.sln /Rebuild "Debug" || goto :error
|
||||
|
||||
cd "%SCRIPTPATH%"
|
||||
|
||||
@ -62,3 +62,9 @@ if not exist "win_64" (
|
||||
XCOPY /Y "v8\build\Debug\lib\*" "win_64\debug\"
|
||||
XCOPY /Y "v8\build\Debug\icudt.dll" "win_64\debug\"
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
|
||||
:error
|
||||
echo "Failed with error #%errorlevel%."
|
||||
exit /b %errorlevel%
|
||||
@ -61,7 +61,7 @@ namespace OOX
|
||||
if(std::wstring::npos != m_sText.find(' ') || std::wstring::npos != m_sText.find('\n'))
|
||||
writer.WriteString(_T(" xml:space=\"preserve\""));
|
||||
writer.WriteString(_T(">"));
|
||||
writer.WriteEncodeXmlString(m_sText);
|
||||
writer.WriteEncodeXmlStringHHHH(m_sText);
|
||||
writer.WriteString(_T("</t>"));
|
||||
}
|
||||
virtual void toXML2(NSStringUtils::CStringBuilder& writer, const wchar_t* name) const
|
||||
@ -71,7 +71,7 @@ namespace OOX
|
||||
if(std::wstring::npos != m_sText.find(' ') || std::wstring::npos != m_sText.find('\n'))
|
||||
writer.WriteString(_T(" xml:space=\"preserve\""));
|
||||
writer.WriteString(_T(">"));
|
||||
writer.WriteEncodeXmlString(m_sText);
|
||||
writer.WriteEncodeXmlStringHHHH(m_sText);
|
||||
writer.WriteString(_T("</"));
|
||||
writer.WriteString(name);
|
||||
writer.WriteString(_T(">"));
|
||||
@ -83,7 +83,21 @@ namespace OOX
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
m_sText = oReader.GetText3();
|
||||
int nDepth = oReader.GetDepth();
|
||||
XmlUtils::XmlNodeType eNodeType = XmlUtils::XmlNodeType_EndElement;
|
||||
while (oReader.Read(eNodeType) && oReader.GetDepth() >= nDepth && XmlUtils::XmlNodeType_EndElement != eNodeType)
|
||||
{
|
||||
if (eNodeType == XmlUtils::XmlNodeType_Text || eNodeType == XmlUtils::XmlNodeType_Whitespace || eNodeType == XmlUtils::XmlNodeType_SIGNIFICANT_WHITESPACE)
|
||||
{
|
||||
std::string sTemp = oReader.GetTextA();
|
||||
wchar_t* pUnicodes = NULL;
|
||||
LONG lOutputCount = 0;
|
||||
NSFile::CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH((BYTE*)sTemp.c_str(), sTemp.length(), pUnicodes, lOutputCount);
|
||||
m_sText.append(pUnicodes);
|
||||
RELEASEARRAYOBJECTS(pUnicodes);
|
||||
}
|
||||
}
|
||||
|
||||
NSStringExt::Replace(m_sText, L"\t", L"");
|
||||
if(!(m_oSpace.IsInit() && SimpleTypes::xmlspacePreserve == m_oSpace->GetValue()))
|
||||
{
|
||||
|
||||
@ -788,4 +788,7 @@
|
||||
|
||||
#define ASC_MENU_EVENT_TYPE_ON_EDIT_TEXT 22003
|
||||
|
||||
#define ASC_EVENT_TYPE_SPELLCHECK_MESSAGE 22004
|
||||
#define ASC_EVENT_TYPE_SPELLCHECK_TURN_ON 22005
|
||||
|
||||
#endif //_BUILD_EDITOR_DEFINES_CROSSPLATFORM_H_
|
||||
|
||||
@ -121,6 +121,10 @@ namespace NSFile
|
||||
std::wstring CUtf8Converter::GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8)
|
||||
{
|
||||
return GetUnicodeFromCharPtr(sParam.c_str(), (LONG)sParam.length(), bIsUtf8);
|
||||
}
|
||||
LONG CUtf8Converter::GetUnicodeStringFromUTF8BufferSize(LONG lCount)
|
||||
{
|
||||
return lCount + 1;
|
||||
}
|
||||
std::wstring CUtf8Converter::GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount )
|
||||
{
|
||||
@ -305,6 +309,249 @@ namespace NSFile
|
||||
return GetUnicodeStringFromUTF8_4bytes(pBuffer, lCount);
|
||||
}
|
||||
|
||||
#define CHECK_HHHH(pBuffer) \
|
||||
wchar_t code = 0; \
|
||||
if('_' == pBuffer[0] && 'x' == pBuffer[1] && 0 != pBuffer[2] && 0 != pBuffer[3] && 0 != pBuffer[4] && 0 != pBuffer[5] && '_' == pBuffer[6]) \
|
||||
{ \
|
||||
int i = 2; \
|
||||
for(; i < 6; ++i) \
|
||||
{ \
|
||||
code *= 16; \
|
||||
if('0' <= pBuffer[i] && pBuffer[i] <= '9') \
|
||||
{ \
|
||||
code += pBuffer[i] - '0'; \
|
||||
} \
|
||||
else if('A' <= pBuffer[i] && pBuffer[i] <= 'F') \
|
||||
{ \
|
||||
code += pBuffer[i] - 'A' + 10; \
|
||||
} \
|
||||
else if('a' <= pBuffer[i] && pBuffer[i] <= 'f') \
|
||||
{ \
|
||||
code += pBuffer[i] - 'a' + 10; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if(i == 6) \
|
||||
{ \
|
||||
if(0x005F == code) \
|
||||
{ \
|
||||
code = '_'; \
|
||||
} \
|
||||
return code; \
|
||||
} \
|
||||
} \
|
||||
return -1;
|
||||
|
||||
long CUtf8Converter::CheckHHHHChar(const BYTE* pBuffer)
|
||||
{
|
||||
CHECK_HHHH(pBuffer);
|
||||
}
|
||||
long CUtf8Converter::CheckHHHHChar(const wchar_t* pBuffer)
|
||||
{
|
||||
CHECK_HHHH(pBuffer);
|
||||
}
|
||||
|
||||
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
|
||||
{
|
||||
if (NULL == pUnicodes)
|
||||
{
|
||||
pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)];
|
||||
}
|
||||
WCHAR* pUnicodeString = pUnicodes;
|
||||
LONG lIndexUnicode = 0;
|
||||
|
||||
LONG lIndex = 0;
|
||||
while (lIndex < lCount)
|
||||
{
|
||||
BYTE byteMain = pBuffer[lIndex];
|
||||
if (0x00 == (byteMain & 0x80))
|
||||
{
|
||||
// 1 byte
|
||||
long code = CheckHHHHChar(pBuffer + lIndex);
|
||||
if(code < 0)
|
||||
{
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)byteMain;
|
||||
++lIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)code;
|
||||
lIndex += 7;
|
||||
}
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x20))
|
||||
{
|
||||
// 2 byte
|
||||
int val = (int)(((byteMain & 0x1F) << 6) |
|
||||
(pBuffer[lIndex + 1] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 2;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x10))
|
||||
{
|
||||
// 3 byte
|
||||
int val = (int)(((byteMain & 0x0F) << 12) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 2] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 3;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x0F))
|
||||
{
|
||||
// 4 byte
|
||||
int val = (int)(((byteMain & 0x07) << 18) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 3] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 4;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x08))
|
||||
{
|
||||
// 4 byte
|
||||
int val = (int)(((byteMain & 0x07) << 18) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 3] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 4;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x04))
|
||||
{
|
||||
// 5 byte
|
||||
int val = (int)(((byteMain & 0x03) << 24) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 18) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 3] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 4] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 6 byte
|
||||
int val = (int)(((byteMain & 0x01) << 30) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 24) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 18) |
|
||||
((pBuffer[lIndex + 3] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 4] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 5] & 0x3F));
|
||||
pUnicodeString[lIndexUnicode++] = (WCHAR)(val);
|
||||
lIndex += 5;
|
||||
}
|
||||
}
|
||||
|
||||
pUnicodeString[lIndexUnicode] = 0;
|
||||
lOutputCount = lIndexUnicode;
|
||||
}
|
||||
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
|
||||
{
|
||||
if (NULL == pUnicodes)
|
||||
{
|
||||
pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)];
|
||||
}
|
||||
WCHAR* pUnicodeString = pUnicodes;
|
||||
WCHAR* pStart = pUnicodeString;
|
||||
LONG lIndex = 0;
|
||||
while (lIndex < lCount)
|
||||
{
|
||||
BYTE byteMain = pBuffer[lIndex];
|
||||
if (0x00 == (byteMain & 0x80))
|
||||
{
|
||||
// 1 byte
|
||||
long code = CheckHHHHChar(pBuffer + lIndex);
|
||||
if(code < 0)
|
||||
{
|
||||
*pUnicodeString++ = (WCHAR)byteMain;
|
||||
++lIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pUnicodeString++ = (WCHAR)code;
|
||||
lIndex += 7;
|
||||
}
|
||||
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x20))
|
||||
{
|
||||
// 2 byte
|
||||
int val = (int)(((byteMain & 0x1F) << 6) |
|
||||
(pBuffer[lIndex + 1] & 0x3F));
|
||||
*pUnicodeString++ = (WCHAR)(val);
|
||||
lIndex += 2;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x10))
|
||||
{
|
||||
// 3 byte
|
||||
int val = (int)(((byteMain & 0x0F) << 12) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 2] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 3;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x0F))
|
||||
{
|
||||
// 4 byte
|
||||
int val = (int)(((byteMain & 0x07) << 18) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 3] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 4;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x08))
|
||||
{
|
||||
// 4 byte
|
||||
int val = (int)(((byteMain & 0x07) << 18) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 3] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 4;
|
||||
}
|
||||
else if (0x00 == (byteMain & 0x04))
|
||||
{
|
||||
// 5 byte
|
||||
int val = (int)(((byteMain & 0x03) << 24) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 18) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 3] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 4] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 6 byte
|
||||
int val = (int)(((byteMain & 0x01) << 30) |
|
||||
((pBuffer[lIndex + 1] & 0x3F) << 24) |
|
||||
((pBuffer[lIndex + 2] & 0x3F) << 18) |
|
||||
((pBuffer[lIndex + 3] & 0x3F) << 12) |
|
||||
((pBuffer[lIndex + 4] & 0x3F) << 6) |
|
||||
(pBuffer[lIndex + 5] & 0x3F));
|
||||
|
||||
WriteUtf16_WCHAR(val, pUnicodeString);
|
||||
lIndex += 5;
|
||||
}
|
||||
}
|
||||
|
||||
*pUnicodeString++ = 0;
|
||||
lOutputCount = pUnicodeString - pStart;
|
||||
}
|
||||
void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount )
|
||||
{
|
||||
if (sizeof(WCHAR) == 2)
|
||||
return GetUnicodeStringFromUTF8WithHHHH_2bytes(pBuffer, lCount, pUnicodes, lOutputCount);
|
||||
return GetUnicodeStringFromUTF8WithHHHH_4bytes(pBuffer, lCount, pUnicodes, lOutputCount);
|
||||
}
|
||||
|
||||
void CUtf8Converter::GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM)
|
||||
{
|
||||
if (NULL == pData)
|
||||
|
||||
@ -100,11 +100,17 @@ namespace NSFile
|
||||
|
||||
static std::wstring GetUnicodeFromCharPtr(const char* pData, LONG lCount, INT bIsUtf8 = FALSE);
|
||||
static std::wstring GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8 = FALSE);
|
||||
|
||||
static std::wstring GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount );
|
||||
static std::wstring GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount );
|
||||
|
||||
static std::wstring GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount );
|
||||
|
||||
static void GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
|
||||
static void GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
|
||||
static void GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount );
|
||||
|
||||
static inline LONG GetUnicodeStringFromUTF8BufferSize( LONG lCount );
|
||||
|
||||
static void GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
|
||||
static void GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
|
||||
static void GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false);
|
||||
@ -118,6 +124,9 @@ namespace NSFile
|
||||
|
||||
static std::wstring GetWStringFromUTF16(const CStringUtf16& data);
|
||||
static std::wstring GetWStringFromUTF16(const unsigned short* pUtf16, LONG lCount);
|
||||
|
||||
static long CheckHHHHChar(const BYTE* pBuffer);
|
||||
static long CheckHHHHChar(const wchar_t* pBuffer);
|
||||
};
|
||||
|
||||
class KERNEL_DECL CFileBinary
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
*
|
||||
*/
|
||||
#include "StringBuilder.h"
|
||||
#include "File.h"
|
||||
|
||||
namespace NSStringUtils
|
||||
{
|
||||
@ -301,6 +302,18 @@ namespace NSStringUtils
|
||||
else
|
||||
WriteEncodeXmlString_4bytes(pString, nCount);
|
||||
}
|
||||
void CStringBuilder::WriteEncodeXmlStringHHHH(const std::wstring& sString)
|
||||
{
|
||||
WriteEncodeXmlStringHHHH(sString.c_str(), (int)sString.length());
|
||||
}
|
||||
|
||||
void CStringBuilder::WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount)
|
||||
{
|
||||
if (sizeof(wchar_t) == 2)
|
||||
WriteEncodeXmlStringHHHH_2bytes(pString, nCount);
|
||||
else
|
||||
WriteEncodeXmlStringHHHH_4bytes(pString, nCount);
|
||||
}
|
||||
inline void CStringBuilder::WriteEncodeXmlString_4bytes(const wchar_t* pString, int nCount)
|
||||
{
|
||||
const wchar_t* pData = pString;
|
||||
@ -354,6 +367,59 @@ namespace NSStringUtils
|
||||
}
|
||||
}
|
||||
}
|
||||
inline void CStringBuilder::WriteEncodeXmlStringHHHH_4bytes(const wchar_t* pString, int nCount)
|
||||
{
|
||||
const wchar_t* pData = pString;
|
||||
int nCounter = 0;
|
||||
unsigned int code;
|
||||
while (*pData != 0)
|
||||
{
|
||||
code = (unsigned int)*pData;
|
||||
WriteEncodeXmlChar(*pData, CheckXmlCodeHHHH(code, pData));
|
||||
|
||||
++pData;
|
||||
if (-1 != nCount)
|
||||
{
|
||||
++nCounter;
|
||||
if (nCounter >= nCount)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
inline void CStringBuilder::WriteEncodeXmlStringHHHH_2bytes(const wchar_t* pString, int nCount)
|
||||
{
|
||||
const wchar_t* pData = pString;
|
||||
int nCounter = 0;
|
||||
unsigned int code;
|
||||
BYTE type;
|
||||
while (*pData != 0)
|
||||
{
|
||||
code = (unsigned int)*pData;
|
||||
if (code >= 0xD800 && code <= 0xDFFF && *(pData + 1) != 0)
|
||||
{
|
||||
code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & *(pData + 1)));
|
||||
type = CheckXmlCodeHHHH(code, pData);
|
||||
if(0 != type)
|
||||
{
|
||||
WriteEncodeXmlChar(*pData, type);
|
||||
++pData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
type = CheckXmlCodeHHHH(code, pData);
|
||||
}
|
||||
WriteEncodeXmlChar(*pData, type);
|
||||
|
||||
++pData;
|
||||
if (-1 != nCount)
|
||||
{
|
||||
++nCounter;
|
||||
if (nCounter >= nCount)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
inline void CStringBuilder::WriteEncodeXmlChar(wchar_t code, BYTE type)
|
||||
{
|
||||
switch (type)
|
||||
@ -436,6 +502,27 @@ namespace NSStringUtils
|
||||
*m_pDataCur++ = (wchar_t)(';');
|
||||
m_lSizeCur += 5;
|
||||
break;
|
||||
case 10:
|
||||
AddSize(7);
|
||||
*m_pDataCur++ = (wchar_t)('_');
|
||||
*m_pDataCur++ = (wchar_t)('x');
|
||||
*m_pDataCur++ = (wchar_t)('0');
|
||||
*m_pDataCur++ = (wchar_t)('0');
|
||||
*m_pDataCur++ = (wchar_t)('5');
|
||||
*m_pDataCur++ = (wchar_t)('F');
|
||||
*m_pDataCur++ = (wchar_t)('_');
|
||||
m_lSizeCur += 7;
|
||||
break;
|
||||
case 11:
|
||||
AddSize(7);
|
||||
*m_pDataCur++ = (wchar_t)('_');
|
||||
*m_pDataCur++ = (wchar_t)('x');
|
||||
m_lSizeCur += 2;
|
||||
WriteHexByteNoSafe((code >> 8) & 0xFF);
|
||||
WriteHexByteNoSafe(code & 0xFF);
|
||||
*m_pDataCur++ = (wchar_t)('_');
|
||||
++m_lSizeCur;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -751,6 +838,35 @@ namespace NSStringUtils
|
||||
|
||||
return 0;
|
||||
}
|
||||
unsigned char CStringBuilder::CheckXmlCodeHHHH(unsigned int c, const wchar_t* pData)
|
||||
{
|
||||
if ('&' == c)
|
||||
return 2;
|
||||
if ('\'' == c)
|
||||
return 3;
|
||||
if ('<' == c)
|
||||
return 4;
|
||||
if ('>' == c)
|
||||
return 5;
|
||||
if ('\"' == c)
|
||||
return 6;
|
||||
if ('\n' == c)//when reading from the attributes is replaced by a space.
|
||||
return 7;
|
||||
if ('\r' == c)//when reading from the attributes is replaced by a space.
|
||||
return 8;
|
||||
if ('\t' == c)//when reading from the attributes is replaced by a space.
|
||||
return 9;
|
||||
if (NSFile::CUtf8Converter::CheckHHHHChar(pData) >= 0)
|
||||
return 10;
|
||||
|
||||
//xml 1.0 Character Range https://www.w3.org/TR/xml/#charsets
|
||||
if ((0x20 <= c && c <= 0xD7FF) || (0xE000 <= c && c <= 0xFFFD) || (0x10000 <= c && c <= 0x10FFFF))
|
||||
return 1;
|
||||
else if(c <= 0xFFFF)
|
||||
return 11;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo)
|
||||
{
|
||||
|
||||
@ -109,9 +109,11 @@ namespace NSStringUtils
|
||||
void AddChar2Safe(const wchar_t _c1, const wchar_t& _c2);
|
||||
|
||||
void WriteEncodeXmlString(const std::wstring& sString);
|
||||
|
||||
void WriteEncodeXmlString(const wchar_t* pString, int nCount = -1);
|
||||
|
||||
void WriteEncodeXmlStringHHHH(const std::wstring& sString);
|
||||
void WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount = -1);
|
||||
|
||||
size_t GetCurSize();
|
||||
void SetCurSize(size_t lCurSize);
|
||||
size_t GetSize();
|
||||
@ -147,8 +149,11 @@ namespace NSStringUtils
|
||||
protected:
|
||||
inline void WriteEncodeXmlString_4bytes(const wchar_t* pString, int nCount);
|
||||
inline void WriteEncodeXmlString_2bytes(const wchar_t* pString, int nCount);
|
||||
inline void WriteEncodeXmlStringHHHH_4bytes(const wchar_t* pString, int nCount);
|
||||
inline void WriteEncodeXmlStringHHHH_2bytes(const wchar_t* pString, int nCount);
|
||||
inline void WriteEncodeXmlChar(wchar_t code, unsigned char type);
|
||||
inline unsigned char CheckXmlCode(unsigned int c);
|
||||
inline unsigned char CheckXmlCodeHHHH(unsigned int c, const wchar_t* pData);
|
||||
};
|
||||
|
||||
KERNEL_DECL void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo);
|
||||
|
||||
@ -173,6 +173,8 @@
|
||||
17A7F02B1B13154500760AFB /* SvmPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17A7F0221B13154500760AFB /* SvmPlayer.cpp */; };
|
||||
17DD67B71B7E2778000F800F /* lepton_utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 17DD67B51B7E2778000F800F /* lepton_utils.cpp */; };
|
||||
697B72D41E3B78D90054C17C /* EmfFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 697B72D31E3B78D90054C17C /* EmfFile.cpp */; };
|
||||
8A2EE9BB22AFBAC200E8AB1A /* SVGTransformer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */; };
|
||||
8A2EE9BC22AFBAC200E8AB1A /* SVGFramework.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */; };
|
||||
8AC2819D2195A582006FA3D7 /* StringExt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC2819B2195A582006FA3D7 /* StringExt.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -436,6 +438,10 @@
|
||||
17A7F0231B13154500760AFB /* SvmPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SvmPlayer.h; sourceTree = "<group>"; };
|
||||
17DD67B51B7E2778000F800F /* lepton_utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lepton_utils.cpp; sourceTree = "<group>"; };
|
||||
697B72D31E3B78D90054C17C /* EmfFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmfFile.cpp; sourceTree = "<group>"; };
|
||||
8A2EE9B722AFBAC200E8AB1A /* SVGFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFramework.h; sourceTree = "<group>"; };
|
||||
8A2EE9B822AFBAC200E8AB1A /* SVGTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTransformer.h; sourceTree = "<group>"; };
|
||||
8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTransformer.cpp; sourceTree = "<group>"; };
|
||||
8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFramework.cpp; sourceTree = "<group>"; };
|
||||
8AC2819B2195A582006FA3D7 /* StringExt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringExt.cpp; path = ../../../common/StringExt.cpp; sourceTree = "<group>"; };
|
||||
8AC2819C2195A582006FA3D7 /* StringExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringExt.h; path = ../../../common/StringExt.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@ -470,6 +476,7 @@
|
||||
17A762BC1B0F35320046BC0B /* metafile */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8A2EE9B622AFBAC200E8AB1A /* svg */,
|
||||
17A7F0191B13154500760AFB /* StarView */,
|
||||
17A765081B0F3A3E0046BC0B /* Jp2 */,
|
||||
17A7631F1B0F38FE0046BC0B /* JBig2 */,
|
||||
@ -793,6 +800,18 @@
|
||||
path = ../../../raster/Metafile/StarView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8A2EE9B622AFBAC200E8AB1A /* svg */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8A2EE9B722AFBAC200E8AB1A /* SVGFramework.h */,
|
||||
8A2EE9B822AFBAC200E8AB1A /* SVGTransformer.h */,
|
||||
8A2EE9B922AFBAC200E8AB1A /* SVGTransformer.cpp */,
|
||||
8A2EE9BA22AFBAC200E8AB1A /* SVGFramework.cpp */,
|
||||
);
|
||||
name = svg;
|
||||
path = ../../../raster/Metafile/svg;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -827,6 +846,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
);
|
||||
mainGroup = 17A762B11B0F35320046BC0B;
|
||||
@ -1002,6 +1022,8 @@
|
||||
17A763EF1B0F39370046BC0B /* bardecode.cpp in Sources */,
|
||||
17A7631E1B0F389C0046BC0B /* MetaFileUtils.cpp in Sources */,
|
||||
17A763231B0F39120046BC0B /* JBig2File.cpp in Sources */,
|
||||
8A2EE9BC22AFBAC200E8AB1A /* SVGFramework.cpp in Sources */,
|
||||
8A2EE9BB22AFBAC200E8AB1A /* SVGTransformer.cpp in Sources */,
|
||||
17A765031B0F39370046BC0B /* writefile.cpp in Sources */,
|
||||
17A764B11B0F39370046BC0B /* psio2stub.cpp in Sources */,
|
||||
17A764FF1B0F39370046BC0B /* webpio.cpp in Sources */,
|
||||
|
||||
@ -107,6 +107,17 @@ namespace MetaFile
|
||||
|
||||
void Begin()
|
||||
{
|
||||
if (m_pFile)
|
||||
{
|
||||
TRect* pBounds = m_pFile->GetDCBounds();
|
||||
int nL = pBounds->nLeft;
|
||||
int nR = pBounds->nRight;
|
||||
int nT = pBounds->nTop;
|
||||
int nB = pBounds->nBottom;
|
||||
|
||||
m_dScaleX = (nR - nL <= 0) ? 1 : m_dW / (double)(nR - nL);
|
||||
m_dScaleY = (nB - nT <= 0) ? 1 : m_dH / (double)(nB - nT);
|
||||
}
|
||||
}
|
||||
void End()
|
||||
{
|
||||
|
||||
@ -144,7 +144,7 @@ namespace MetaFile
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
bool CMetaFile::DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight)
|
||||
{
|
||||
if (NULL == pRenderer)
|
||||
@ -176,7 +176,7 @@ namespace MetaFile
|
||||
}
|
||||
pRenderer->EndCommand(c_nImageType);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
void CMetaFile::Close()
|
||||
{
|
||||
m_oWmfFile.Close();
|
||||
@ -185,7 +185,7 @@ namespace MetaFile
|
||||
m_oSvgFile.Close();
|
||||
|
||||
m_lType = 0;
|
||||
};
|
||||
}
|
||||
int CMetaFile::GetType()
|
||||
{
|
||||
return m_lType;
|
||||
|
||||
@ -64,10 +64,7 @@ namespace MetaFile
|
||||
TRectD oBounds = oBoundsBox;
|
||||
if (IsPlaceable())
|
||||
{
|
||||
double dLogicalToMM = 25.4 / 72;
|
||||
if (m_oPlaceable.Inch > 0)
|
||||
dLogicalToMM /= m_oPlaceable.Inch;
|
||||
|
||||
double dLogicalToMM = (m_oPlaceable.Inch > 0 ? 25.4 / m_oPlaceable.Inch : 25.4 / 1440);
|
||||
oBounds *= dLogicalToMM;
|
||||
}
|
||||
else
|
||||
@ -111,100 +108,100 @@ namespace MetaFile
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.1 Bitmap records
|
||||
//-----------------------------------------------------------
|
||||
case META_BITBLT: Read_META_BITBLT(); break;
|
||||
case META_DIBBITBLT: Read_META_DIBBITBLT(); break;
|
||||
case META_DIBSTRETCHBLT: Read_META_DIBSTRETCHBLT(); break;
|
||||
case META_SETDIBTODEV: Read_META_SETDIBTODEV(); break;
|
||||
case META_STRETCHBLT: Read_META_STRETCHBLT(); break;
|
||||
case META_STRETCHDIB: Read_META_STRETCHDIB(); break;
|
||||
case META_BITBLT: Read_META_BITBLT(); break;
|
||||
case META_DIBBITBLT: Read_META_DIBBITBLT(); break;
|
||||
case META_DIBSTRETCHBLT: Read_META_DIBSTRETCHBLT(); break;
|
||||
case META_SETDIBTODEV: Read_META_SETDIBTODEV(); break;
|
||||
case META_STRETCHBLT: Read_META_STRETCHBLT(); break;
|
||||
case META_STRETCHDIB: Read_META_STRETCHDIB(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.2 Control records
|
||||
//-----------------------------------------------------------
|
||||
case META_EOF: bEof = true; break;
|
||||
case META_EOF: bEof = true; break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.3 Drawing records
|
||||
//-----------------------------------------------------------
|
||||
case META_ARC: Read_META_ARC(); break;
|
||||
case META_CHORD: Read_META_CHORD(); break;
|
||||
case META_ELLIPSE: Read_META_ELLIPSE(); break;
|
||||
case META_EXTFLOODFILL: Read_META_UNSUPPORTED(); break;
|
||||
case META_EXTTEXTOUT: Read_META_EXTTEXTOUT(); break;
|
||||
case META_FILLREGION: Read_META_FILLREGION(); break;
|
||||
case META_FLOODFILL: Read_META_UNSUPPORTED(); break;
|
||||
case META_FRAMEREGION: Read_META_FRAMEREGION(); break;
|
||||
case META_INVERTREGION: Read_META_INVERTREGION(); break;
|
||||
case META_LINETO: Read_META_LINETO(); break;
|
||||
case META_PAINTREGION: Read_META_PAINTREGION(); break;
|
||||
case META_PATBLT: Read_META_PATBLT(); break;
|
||||
case META_PIE: Read_META_PIE(); break;
|
||||
case META_POLYLINE: Read_META_POLYLINE(); break;
|
||||
case META_POLYGON: Read_META_POLYGON(); break;
|
||||
case META_POLYPOLYGON: Read_META_POLYPOLYGON(); break;
|
||||
case META_RECTANGLE: Read_META_RECTANGLE(); break;
|
||||
case META_ROUNDRECT: Read_META_ROUNDRECT(); break;
|
||||
case META_SETPIXEL: Read_META_SETPIXEL(); break;
|
||||
case META_TEXTOUT: Read_META_TEXTOUT(); break;
|
||||
case META_ARC: Read_META_ARC(); break;
|
||||
case META_CHORD: Read_META_CHORD(); break;
|
||||
case META_ELLIPSE: Read_META_ELLIPSE(); break;
|
||||
case META_EXTFLOODFILL: Read_META_UNSUPPORTED(); break;
|
||||
case META_EXTTEXTOUT: Read_META_EXTTEXTOUT(); break;
|
||||
case META_FILLREGION: Read_META_FILLREGION(); break;
|
||||
case META_FLOODFILL: Read_META_UNSUPPORTED(); break;
|
||||
case META_FRAMEREGION: Read_META_FRAMEREGION(); break;
|
||||
case META_INVERTREGION: Read_META_INVERTREGION(); break;
|
||||
case META_LINETO: Read_META_LINETO(); break;
|
||||
case META_PAINTREGION: Read_META_PAINTREGION(); break;
|
||||
case META_PATBLT: Read_META_PATBLT(); break;
|
||||
case META_PIE: Read_META_PIE(); break;
|
||||
case META_POLYLINE: Read_META_POLYLINE(); break;
|
||||
case META_POLYGON: Read_META_POLYGON(); break;
|
||||
case META_POLYPOLYGON: Read_META_POLYPOLYGON(); break;
|
||||
case META_RECTANGLE: Read_META_RECTANGLE(); break;
|
||||
case META_ROUNDRECT: Read_META_ROUNDRECT(); break;
|
||||
case META_SETPIXEL: Read_META_SETPIXEL(); break;
|
||||
case META_TEXTOUT: Read_META_TEXTOUT(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.4 Object records
|
||||
//-----------------------------------------------------------
|
||||
case META_CREATEBRUSHINDIRECT: Read_META_CREATEBRUSHINDIRECT(); break;
|
||||
case META_CREATEFONTINDIRECT: Read_META_CREATEFONTINDIRECT(); break;
|
||||
case META_CREATEPALETTE: Read_META_CREATEPALETTE(); break;
|
||||
case META_CREATEPATTERNBRUSH: Read_META_CREATEPATTERNBRUSH(); break;
|
||||
case META_CREATEPENINDIRECT: Read_META_CREATEPENINDIRECT(); break;
|
||||
case META_CREATEREGION: Read_META_CREATEREGION(); break;
|
||||
case META_DELETEOBJECT: Read_META_DELETEOBJECT(); break;
|
||||
case META_DIBCREATEPATTERNBRUSH: Read_META_DIBCREATEPATTERNBRUSH(); break;
|
||||
case META_SELECTCLIPREGION: Read_META_SELECTCLIPREGION(); break;
|
||||
case META_SELECTOBJECT: Read_META_SELECTOBJECT(); break;
|
||||
case META_SELECTPALETTE: Read_META_SELECTPALETTE(); break;
|
||||
case META_CREATEBRUSHINDIRECT: Read_META_CREATEBRUSHINDIRECT(); break;
|
||||
case META_CREATEFONTINDIRECT: Read_META_CREATEFONTINDIRECT(); break;
|
||||
case META_CREATEPALETTE: Read_META_CREATEPALETTE(); break;
|
||||
case META_CREATEPATTERNBRUSH: Read_META_CREATEPATTERNBRUSH(); break;
|
||||
case META_CREATEPENINDIRECT: Read_META_CREATEPENINDIRECT(); break;
|
||||
case META_CREATEREGION: Read_META_CREATEREGION(); break;
|
||||
case META_DELETEOBJECT: Read_META_DELETEOBJECT(); break;
|
||||
case META_DIBCREATEPATTERNBRUSH: Read_META_DIBCREATEPATTERNBRUSH(); break;
|
||||
case META_SELECTCLIPREGION: Read_META_SELECTCLIPREGION(); break;
|
||||
case META_SELECTOBJECT: Read_META_SELECTOBJECT(); break;
|
||||
case META_SELECTPALETTE: Read_META_SELECTPALETTE(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.5 State records
|
||||
//-----------------------------------------------------------
|
||||
case META_ANIMATEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_EXCLUDECLIPRECT: Read_META_EXCLUDECLIPRECT(); break;
|
||||
case META_INTERSECTCLIPRECT: Read_META_INTERSECTCLIPRECT(); break;
|
||||
case META_MOVETO: Read_META_MOVETO(); break;
|
||||
case META_OFFSETCLIPRGN: Read_META_OFFSETCLIPRGN(); break;
|
||||
case META_OFFSETVIEWPORTORG: Read_META_OFFSETVIEWPORTORG(); break;
|
||||
case META_OFFSETWINDOWORG: Read_META_OFFSETWINDOWORG(); break;
|
||||
case META_REALIZEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_RESIZEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_RESTOREDC: Read_META_RESTOREDC(); break;
|
||||
case META_SAVEDC: Read_META_SAVEDC(); break;
|
||||
case META_SCALEVIEWPORTEXT: Read_META_SCALEVIEWPORTEXT(); break;
|
||||
case META_SCALEWINDOWEXT: Read_META_SCALEWINDOWEXT(); break;
|
||||
case META_SETBKCOLOR: Read_META_SETBKCOLOR(); break;
|
||||
case META_SETBKMODE: Read_META_SETBKMODE(); break;
|
||||
case META_SETLAYOUT: Read_META_SETLAYOUT(); break;
|
||||
case META_SETMAPMODE: Read_META_SETMAPMODE(); break;
|
||||
case META_SETMAPPERFLAGS: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETPALENTRIES: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETPOLYFILLMODE: Read_META_SETPOLYFILLMODE(); break;
|
||||
case META_SETRELABS: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETROP2: Read_META_SETROP2(); break;
|
||||
case META_SETSTRETCHBLTMODE: Read_META_SETSTRETCHBLTMODE(); break;
|
||||
case META_SETTEXTALIGN: Read_META_SETTEXTALIGN(); break;
|
||||
case META_SETTEXTCHAREXTRA: Read_META_SETTEXTCHAREXTRA(); break;
|
||||
case META_SETTEXTCOLOR: Read_META_SETTEXTCOLOR(); break;
|
||||
case META_SETTEXTJUSTIFICATION: Read_META_SETTEXTJUSTIFICATION(); break;
|
||||
case META_SETVIEWPORTEXT: Read_META_SETVIEWPORTEXT(); break;
|
||||
case META_SETVIEWPORTORG: Read_META_SETVIEWPORTORG(); break;
|
||||
case META_SETWINDOWEXT: Read_META_SETWINDOWEXT(); break;
|
||||
case META_SETWINDOWORG: Read_META_SETWINDOWORG(); break;
|
||||
case META_ANIMATEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_EXCLUDECLIPRECT: Read_META_EXCLUDECLIPRECT(); break;
|
||||
case META_INTERSECTCLIPRECT: Read_META_INTERSECTCLIPRECT(); break;
|
||||
case META_MOVETO: Read_META_MOVETO(); break;
|
||||
case META_OFFSETCLIPRGN: Read_META_OFFSETCLIPRGN(); break;
|
||||
case META_OFFSETVIEWPORTORG: Read_META_OFFSETVIEWPORTORG(); break;
|
||||
case META_OFFSETWINDOWORG: Read_META_OFFSETWINDOWORG(); break;
|
||||
case META_REALIZEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_RESIZEPALETTE: Read_META_UNSUPPORTED(); break;
|
||||
case META_RESTOREDC: Read_META_RESTOREDC(); break;
|
||||
case META_SAVEDC: Read_META_SAVEDC(); break;
|
||||
case META_SCALEVIEWPORTEXT: Read_META_SCALEVIEWPORTEXT(); break;
|
||||
case META_SCALEWINDOWEXT: Read_META_SCALEWINDOWEXT(); break;
|
||||
case META_SETBKCOLOR: Read_META_SETBKCOLOR(); break;
|
||||
case META_SETBKMODE: Read_META_SETBKMODE(); break;
|
||||
case META_SETLAYOUT: Read_META_SETLAYOUT(); break;
|
||||
case META_SETMAPMODE: Read_META_SETMAPMODE(); break;
|
||||
case META_SETMAPPERFLAGS: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETPALENTRIES: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETPOLYFILLMODE: Read_META_SETPOLYFILLMODE(); break;
|
||||
case META_SETRELABS: Read_META_UNSUPPORTED(); break;
|
||||
case META_SETROP2: Read_META_SETROP2(); break;
|
||||
case META_SETSTRETCHBLTMODE: Read_META_SETSTRETCHBLTMODE(); break;
|
||||
case META_SETTEXTALIGN: Read_META_SETTEXTALIGN(); break;
|
||||
case META_SETTEXTCHAREXTRA: Read_META_SETTEXTCHAREXTRA(); break;
|
||||
case META_SETTEXTCOLOR: Read_META_SETTEXTCOLOR(); break;
|
||||
case META_SETTEXTJUSTIFICATION: Read_META_SETTEXTJUSTIFICATION(); break;
|
||||
case META_SETVIEWPORTEXT: Read_META_SETVIEWPORTEXT(); break;
|
||||
case META_SETVIEWPORTORG: Read_META_SETVIEWPORTORG(); break;
|
||||
case META_SETWINDOWEXT: Read_META_SETWINDOWEXT(); break;
|
||||
case META_SETWINDOWORG: Read_META_SETWINDOWORG(); break;
|
||||
//-----------------------------------------------------------
|
||||
// 2.3.6 State records
|
||||
//-----------------------------------------------------------
|
||||
case META_ESCAPE: Read_META_ESCAPE(); break;
|
||||
case META_ESCAPE: Read_META_ESCAPE(); break;
|
||||
//-----------------------------------------------------------
|
||||
// Неизвестные записи
|
||||
//-----------------------------------------------------------
|
||||
default:
|
||||
{
|
||||
//std::cout << ushType << " ";
|
||||
Read_META_UNKNOWN();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//std::cout << ushType << " ";
|
||||
Read_META_UNKNOWN();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bEof)
|
||||
@ -236,23 +233,8 @@ namespace MetaFile
|
||||
m_oDCRect.nTop = pViewport->y;
|
||||
m_oDCRect.nRight = pViewport->w + pViewport->x;
|
||||
m_oDCRect.nBottom = pViewport->h + pViewport->y;
|
||||
|
||||
return &m_oDCRect;
|
||||
|
||||
unsigned short ushMapMode = m_pDC->GetMapMode();
|
||||
if (MM_ANISOTROPIC == ushMapMode || MM_ISOTROPIC == ushMapMode)
|
||||
{
|
||||
TWmfWindow* pViewport = m_pDC->GetViewport();
|
||||
|
||||
m_oDCRect.nLeft = pViewport->x;
|
||||
m_oDCRect.nTop = pViewport->y;
|
||||
m_oDCRect.nRight = pViewport->w + pViewport->x;
|
||||
m_oDCRect.nBottom = pViewport->h + pViewport->y;
|
||||
return &m_oDCRect;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &m_oRect;
|
||||
}
|
||||
}
|
||||
double GetPixelHeight()
|
||||
{
|
||||
@ -321,7 +303,14 @@ namespace MetaFile
|
||||
}
|
||||
TXForm* GetTransform(int iGraphicsMode = GM_ADVANCED)
|
||||
{
|
||||
return m_pDC->GetTransform();
|
||||
TRect* pBounds = GetDCBounds();
|
||||
double dT = pBounds->nTop;
|
||||
double dL = pBounds->nLeft;
|
||||
|
||||
TXForm oShiftXForm(1, 0, 0, 1, -dL, -dT);
|
||||
m_oTransform.Copy(m_pDC->GetFinalTransform(iGraphicsMode));
|
||||
m_oTransform.Multiply(oShiftXForm, MWT_RIGHTMULTIPLY);
|
||||
return &m_oTransform;
|
||||
}
|
||||
unsigned int GetMiterLimit()
|
||||
{
|
||||
@ -359,24 +348,8 @@ namespace MetaFile
|
||||
|
||||
void TranslatePoint(short shX, short shY, double& dX, double &dY)
|
||||
{
|
||||
TWmfWindow* pWindow = m_pDC->GetWindow();
|
||||
TWmfWindow* pViewport = m_pDC->GetViewport();
|
||||
|
||||
dX = (double)((double)(shX - pWindow->x) * m_pDC->GetPixelWidth()) + pViewport->x;
|
||||
dY = (double)((double)(shY - pWindow->y) * m_pDC->GetPixelHeight()) + pViewport->y;
|
||||
|
||||
// Координаты приходят уже с примененной матрицей. Поэтому сначала мы умножаем на матрицу преобразования,
|
||||
// вычитаем начальные координаты и умножаем на обратную матрицу преобразования.
|
||||
TRect* pBounds = GetDCBounds();
|
||||
double dT = pBounds->nTop;
|
||||
double dL = pBounds->nLeft;
|
||||
|
||||
TEmfXForm* pInverse = GetInverseTransform();
|
||||
TEmfXForm* pTransform = GetTransform();
|
||||
pTransform->Apply(dX, dY);
|
||||
dX -= dL;
|
||||
dY -= dT;
|
||||
pInverse->Apply(dX, dY);
|
||||
dX = (double)shX;
|
||||
dY = (double)shY;
|
||||
}
|
||||
TRect GetBoundingBox()
|
||||
{
|
||||
@ -820,6 +793,9 @@ namespace MetaFile
|
||||
m_oStream >> m_oPlaceable.Inch;
|
||||
m_oStream >> m_oPlaceable.Reserved;
|
||||
m_oStream >> m_oPlaceable.Checksum;
|
||||
|
||||
m_pDC->SetViewportOrg(m_oPlaceable.BoundingBox.Left, m_oPlaceable.BoundingBox.Top);
|
||||
m_pDC->SetViewportExt(m_oPlaceable.BoundingBox.Right - m_oPlaceable.BoundingBox.Left, m_oPlaceable.BoundingBox.Bottom - m_oPlaceable.BoundingBox.Top);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -852,7 +828,7 @@ namespace MetaFile
|
||||
if (0x0100 != m_oHeader.Version && 0x0300 != m_oHeader.Version)
|
||||
return SetError();
|
||||
|
||||
// Если у нас не задан Output, значит мы считаем, что идет сканирование метафайла.
|
||||
// Если у нас не задан Output, значит мы считаем, что идет сканирование метафайла.
|
||||
// Во время сканирования мы регистрируем все точки и вычисляем BoundingBox
|
||||
if (m_pOutput)
|
||||
{
|
||||
@ -1627,6 +1603,8 @@ namespace MetaFile
|
||||
|
||||
TRect m_oBoundingBox;
|
||||
bool m_bFirstPoint;
|
||||
|
||||
TXForm m_oTransform;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -253,6 +253,8 @@ namespace MetaFile
|
||||
m_ushTextAlign = TA_TOP | TA_LEFT | TA_NOUPDATECP;
|
||||
m_ushCharSpacing = 0;
|
||||
m_oTransform.Init();
|
||||
m_oFinalTransform.Init();
|
||||
m_oFinalTransform2.Init();
|
||||
}
|
||||
CWmfDC::~CWmfDC()
|
||||
{
|
||||
@ -286,6 +288,7 @@ namespace MetaFile
|
||||
pNewDC->m_ushCharSpacing = m_ushCharSpacing;
|
||||
pNewDC->m_oTransform.Init();
|
||||
pNewDC->m_oClip = m_oClip;
|
||||
pNewDC->m_oFinalTransform.Copy(&m_oFinalTransform);
|
||||
|
||||
return pNewDC;
|
||||
}
|
||||
@ -363,53 +366,55 @@ namespace MetaFile
|
||||
|
||||
switch (m_ushMapMode)
|
||||
{
|
||||
case MM_TEXT: // 1 unit = 1pt
|
||||
{
|
||||
SetPixelWidth(1);
|
||||
SetPixelHeight(1);
|
||||
break;
|
||||
}
|
||||
case MM_LOMETRIC: // 1 unit = 0.1mm
|
||||
{
|
||||
double dPixel = 0.1 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIMETRIC: // 1 unit = 0.01mm
|
||||
{
|
||||
double dPixel = 0.01 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_LOENGLISH: // 1 unit = 0.01 inch
|
||||
{
|
||||
double dPixel = 0.01 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIENGLISH: // 1 unit = 0.001 inch
|
||||
{
|
||||
double dPixel = 0.001 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_TWIPS: // 1 unit = 1/1440 inch
|
||||
{
|
||||
SetPixelWidth(0.05);
|
||||
SetPixelHeight(0.05);
|
||||
break;
|
||||
}
|
||||
case MM_ISOTROPIC:
|
||||
case MM_ANISOTROPIC:
|
||||
{
|
||||
UpdatePixelMetrics();
|
||||
break;
|
||||
}
|
||||
case MM_TEXT: // 1 unit = 1pt
|
||||
{
|
||||
SetPixelWidth(1);
|
||||
SetPixelHeight(1);
|
||||
break;
|
||||
}
|
||||
case MM_LOMETRIC: // 1 unit = 0.1mm
|
||||
{
|
||||
double dPixel = 0.1 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIMETRIC: // 1 unit = 0.01mm
|
||||
{
|
||||
double dPixel = 0.01 * 72 / 25.4;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_LOENGLISH: // 1 unit = 0.01 inch
|
||||
{
|
||||
double dPixel = 0.01 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_HIENGLISH: // 1 unit = 0.001 inch
|
||||
{
|
||||
double dPixel = 0.001 * 72;
|
||||
SetPixelWidth(dPixel);
|
||||
SetPixelHeight(dPixel);
|
||||
break;
|
||||
}
|
||||
case MM_TWIPS: // 1 unit = 1/1440 inch
|
||||
{
|
||||
SetPixelWidth(0.05);
|
||||
SetPixelHeight(0.05);
|
||||
break;
|
||||
}
|
||||
case MM_ISOTROPIC:
|
||||
case MM_ANISOTROPIC:
|
||||
{
|
||||
UpdatePixelMetrics();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
unsigned int CWmfDC::GetMapMode()
|
||||
{
|
||||
@ -440,24 +445,28 @@ namespace MetaFile
|
||||
m_oWindow.x = shX;
|
||||
m_oWindow.y = shY;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetWindowExt(short shW, short shH)
|
||||
{
|
||||
m_oWindow.w = shW;
|
||||
m_oWindow.h = shH;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetWindowOff(short shX, short shY)
|
||||
{
|
||||
m_oWindow.x += shX;
|
||||
m_oWindow.y += shY;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetWindowScale(double dX, double dY)
|
||||
{
|
||||
m_oWindow.w = (short)(m_oWindow.w * dX);
|
||||
m_oWindow.h = (short)(m_oWindow.h * dY);
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
TWmfWindow* CWmfDC::GetViewport()
|
||||
{
|
||||
@ -468,24 +477,28 @@ namespace MetaFile
|
||||
m_oViewport.x = shX;
|
||||
m_oViewport.y = shY;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetViewportExt(short shW, short shH)
|
||||
{
|
||||
m_oViewport.w = shW;
|
||||
m_oViewport.h = shH;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetViewportOff(short shX, short shY)
|
||||
{
|
||||
m_oViewport.x += shX;
|
||||
m_oViewport.y += shY;
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
void CWmfDC::SetViewportScale(double dX, double dY)
|
||||
{
|
||||
m_oViewport.w = (short)(m_oViewport.w * dX);
|
||||
m_oViewport.h = (short)(m_oViewport.h * dY);
|
||||
UpdatePixelMetrics();
|
||||
UpdateFinalTransform();
|
||||
}
|
||||
bool CWmfDC::UpdatePixelMetrics()
|
||||
{
|
||||
@ -510,6 +523,23 @@ namespace MetaFile
|
||||
|
||||
return true;
|
||||
}
|
||||
void CWmfDC::UpdateFinalTransform()
|
||||
{
|
||||
TWmfWindow* pWindow = GetWindow();
|
||||
TWmfWindow* pViewPort = GetViewport();
|
||||
|
||||
TXForm oWindowXForm(1, 0, 0, 1, -pWindow->x, -pWindow->y);
|
||||
TXForm oViewportXForm((double)GetPixelWidth(), 0, 0, (double)GetPixelHeight(), pViewPort->x, pViewPort->y);
|
||||
|
||||
m_oFinalTransform.Init();
|
||||
m_oFinalTransform.Multiply(oWindowXForm, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform.Multiply(m_oTransform, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform.Multiply(oViewportXForm, MWT_RIGHTMULTIPLY);
|
||||
|
||||
m_oFinalTransform2.Init();
|
||||
m_oFinalTransform2.Multiply(oWindowXForm, MWT_RIGHTMULTIPLY);
|
||||
m_oFinalTransform2.Multiply(oViewportXForm, MWT_RIGHTMULTIPLY);
|
||||
}
|
||||
void CWmfDC::SetTextColor(TWmfColor& oColor)
|
||||
{
|
||||
m_oTextColor = oColor;
|
||||
@ -603,6 +633,13 @@ namespace MetaFile
|
||||
{
|
||||
return &m_oTransform;
|
||||
}
|
||||
TXForm* CWmfDC::GetFinalTransform(int iGraphicsMode)
|
||||
{
|
||||
if (GM_COMPATIBLE == iGraphicsMode)
|
||||
return &m_oFinalTransform2;
|
||||
|
||||
return &m_oFinalTransform;
|
||||
}
|
||||
unsigned int CWmfDC::GetMiterLimit()
|
||||
{
|
||||
return 0;
|
||||
@ -611,4 +648,4 @@ namespace MetaFile
|
||||
{
|
||||
return &m_oClip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,6 +129,7 @@ namespace MetaFile
|
||||
unsigned short GetCharSpacing();
|
||||
TXForm* GetTransform();
|
||||
TXForm* GetInverseTransform();
|
||||
TXForm* GetFinalTransform(int iGraphicsMode);
|
||||
unsigned int GetMiterLimit();
|
||||
CWmfClip* GetClip();
|
||||
|
||||
@ -137,6 +138,7 @@ namespace MetaFile
|
||||
void SetPixelWidth(double dW);
|
||||
void SetPixelHeight(double dH);
|
||||
bool UpdatePixelMetrics();
|
||||
void UpdateFinalTransform();
|
||||
|
||||
private:
|
||||
|
||||
@ -163,6 +165,8 @@ namespace MetaFile
|
||||
unsigned short m_ushTextAlign;
|
||||
unsigned short m_ushCharSpacing;
|
||||
TXForm m_oTransform;
|
||||
TXForm m_oFinalTransform;
|
||||
TXForm m_oFinalTransform2;
|
||||
CWmfClip m_oClip;
|
||||
};
|
||||
}
|
||||
|
||||
@ -3003,7 +3003,7 @@ namespace SVG
|
||||
|
||||
bool CreateImage (BYTE* pBuffer, unsigned long Length, int ImageEncoder = INVALID_ENCODER)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
|
||||
|
||||
@ -828,6 +828,12 @@ namespace NSHtmlRenderer
|
||||
}
|
||||
HRESULT CASCSVGWriter::GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF)
|
||||
{
|
||||
*pdA = m_pTransform->sx();
|
||||
*pdB = m_pTransform->shy();
|
||||
*pdC = m_pTransform->shx();
|
||||
*pdD = m_pTransform->sy();
|
||||
*pdE = m_pTransform->tx();
|
||||
*pdF = m_pTransform->ty();
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CASCSVGWriter::ResetTransform(void)
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
||||
Reference in New Issue
Block a user