mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
245 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d1f53d952 | |||
| 5e5fb5ea6d | |||
| ec72a22aab | |||
| 6f0539df86 | |||
| 36109d2ba8 | |||
| a283d0c4ad | |||
| d690281b8d | |||
| e74b75a087 | |||
| a8978265ea | |||
| f1b4b2ac29 | |||
| d11b0c814e | |||
| 0d9d8fad80 | |||
| 092df2d20e | |||
| 96208a1c54 | |||
| d47bd4a0ae | |||
| b626b23794 | |||
| 841ff873a7 | |||
| 9614b81aa4 | |||
| 42bbf6a487 | |||
| 4973b92435 | |||
| e99eb7cc81 | |||
| 4beedf8e03 | |||
| 6ace3e2e80 | |||
| 1baf789bb5 | |||
| c239040756 | |||
| b89d16691a | |||
| 9788d38a69 | |||
| bf6d4b00e3 | |||
| 4a452ee47f | |||
| 3a46d8a909 | |||
| 8539dc168b | |||
| d651d5166b | |||
| 699acd0516 | |||
| 5e9e15be57 | |||
| 2eec32df98 | |||
| 77ea7fd3df | |||
| cb40323b31 | |||
| 85817c68c1 | |||
| 7a822494aa | |||
| 284d2730e2 | |||
| 7a36d76298 | |||
| c3b7447c04 | |||
| e0cc9c0409 | |||
| 075d6c849b | |||
| a0ff455786 | |||
| c4f475167d | |||
| d72d03d449 | |||
| 322c7af962 | |||
| 879ce1a66d | |||
| a01b535609 | |||
| 25a909d7a7 | |||
| 2c081fedc9 | |||
| 9fc7aa5bca | |||
| 35e10ff9cd | |||
| bce86077af | |||
| ed46c8521d | |||
| 7d18fa5753 | |||
| bdddc1ac67 | |||
| a02bd8f383 | |||
| 07e8cda08d | |||
| 53e8fa7731 | |||
| cc4056a18b | |||
| 63b425763e | |||
| bf859f9763 | |||
| 650c993fa0 | |||
| abba98d9d3 | |||
| e85923d94e | |||
| 6d548d27bc | |||
| 29167e6267 | |||
| 80e2c75a54 | |||
| 9c67404b69 | |||
| c82b5c9994 | |||
| e6205fcff9 | |||
| 1ec0142c25 | |||
| f65463c96f | |||
| 133ad365f4 | |||
| 4c077a28b8 | |||
| 1bd7c77ead | |||
| 26e5245cf6 | |||
| 672b9fd118 | |||
| c96b59cbbf | |||
| 81ec34b6f9 | |||
| f29d83a80b | |||
| b5c44805fb | |||
| 01bfa49aba | |||
| 7c0bef3c04 | |||
| 7aeaec211a | |||
| a3de9703bf | |||
| af743b7e25 | |||
| d4b6a05717 | |||
| de51600d34 | |||
| c64379636e | |||
| d2f9c59b5f | |||
| 30675ab8b9 | |||
| fbadc56797 | |||
| a568aa02c4 | |||
| 099d49b3a7 | |||
| 55a200e71d | |||
| c6586a9a17 | |||
| fbcf56be9e | |||
| 83fdc52baf | |||
| 966eac2367 | |||
| 32c185c089 | |||
| cb66e15faf | |||
| f6a102353d | |||
| 2247d47e4b | |||
| cb77b0989c | |||
| 5832049ebc | |||
| 43bc3c92b3 | |||
| 50007b47ee | |||
| b98c51b020 | |||
| 0c5e670ad1 | |||
| e41b892b58 | |||
| 527af6f669 | |||
| 5e6f84ec74 | |||
| 3c7d05a33e | |||
| c2d48fdd32 | |||
| ebf6e9e995 | |||
| f87f2a47d5 | |||
| 5728bcda76 | |||
| ceadb68bc6 | |||
| 3aa94ae6ae | |||
| b8095b3f82 | |||
| 7448a331e9 | |||
| 940bb840be | |||
| 967b0aec72 | |||
| 852989d0c9 | |||
| c733399b88 | |||
| 8c92a944ad | |||
| 0456f9b362 | |||
| 4ec7942649 | |||
| 13410416a5 | |||
| b4d00a7a47 | |||
| 9d497e48c9 | |||
| 759a159005 | |||
| 92e6fa06b5 | |||
| 7b93de3e8a | |||
| ca3e65468b | |||
| 5d378ddb41 | |||
| ba05993073 | |||
| 6438c1cd4b | |||
| 07ad714d3a | |||
| 1c87c34db9 | |||
| 8f4956102a | |||
| 0d8fcd1bef | |||
| 4db5c55544 | |||
| 709ac0b868 | |||
| dd73d3347f | |||
| e98f981a46 | |||
| d6b7aefe51 | |||
| f612ca64e0 | |||
| e3a582ee67 | |||
| fa68ba2f0d | |||
| 3387f67f7e | |||
| 383e9bc971 | |||
| c67aea9543 | |||
| 0e64e3467b | |||
| cc2027edab | |||
| da3739942f | |||
| 80d5783b3b | |||
| dbd5aeadd2 | |||
| d57b69731b | |||
| 248f9a5362 | |||
| 204ef06b1a | |||
| f9171cb342 | |||
| 6d80b8537f | |||
| c5a09b75d6 | |||
| 1c8687e07f | |||
| 28745ae49f | |||
| d6b5523406 | |||
| fc1d61799b | |||
| 358903d331 | |||
| 46e8d03eeb | |||
| 554ad261cf | |||
| 78c662ea55 | |||
| 98a02441de | |||
| efb3075e0e | |||
| da703d88ca | |||
| dc73c8b2b6 | |||
| 1404829b68 | |||
| be9f8ba8e6 | |||
| f858b76fd4 | |||
| 3914b9a9d5 | |||
| e19d1c6735 | |||
| 041d8a3dc4 | |||
| 31ee203b92 | |||
| 3d7eefcd3d | |||
| 82db1cd0d1 | |||
| 14ea99e880 | |||
| 7363c995dd | |||
| 66a2edf5d2 | |||
| 36e5cada88 | |||
| 01e9bb8cef | |||
| 9887883626 | |||
| 3d828f9683 | |||
| 2d890247ab | |||
| 5acc2513c8 | |||
| d3dc902f23 | |||
| 11ae76f9f0 | |||
| 7340469a8c | |||
| 92e03fd7b6 | |||
| 7a12a4d43e | |||
| c59f679043 | |||
| 3cb1503632 | |||
| b2b0c74cd4 | |||
| a1376d647f | |||
| dc17f5fe2e | |||
| 6d45b90ac0 | |||
| 7130c2d1bb | |||
| e19db2847f | |||
| 2e8bb7177c | |||
| c8ca57ea40 | |||
| e7931e73d1 | |||
| b096ce8098 | |||
| ffc3149d4b | |||
| f4cc9ec38a | |||
| 5c3760a907 | |||
| 6320c543c0 | |||
| 324dd2de49 | |||
| e07fd5ed24 | |||
| 19295c1037 | |||
| 7ad0e7e9fe | |||
| ce9ede6820 | |||
| 379f474739 | |||
| a2662a6f2b | |||
| c52893306d | |||
| 3a9a2b5ee7 | |||
| 8df04c48ad | |||
| f7b0565233 | |||
| ef7fb15efe | |||
| e32b53d662 | |||
| 0b683226e9 | |||
| 73924f3ae0 | |||
| e8ecef51dd | |||
| 5bf730e1d6 | |||
| 091f3a3a8e | |||
| ffa8467c9e | |||
| 398c69c01e | |||
| a48ed74102 | |||
| 45628154d9 | |||
| 2921e476c3 | |||
| e97fd44489 | |||
| 44016b4ccc | |||
| 01f01ec85f | |||
| fa85b389f2 |
@ -83,19 +83,19 @@ function configure_make() {
|
||||
|
||||
if [[ "${ARCH}" == "x86_64" ]]; then
|
||||
|
||||
./Configure android-x86_64 --prefix="${PREFIX_DIR}" enable-ssl3 enable-ssl3-method enable-md2
|
||||
./Configure android-x86_64 --prefix="${PREFIX_DIR}" no-shared no-tests enable-ssl3 enable-ssl3-method enable-md2 no-asm
|
||||
|
||||
elif [[ "${ARCH}" == "x86" ]]; then
|
||||
|
||||
./Configure android-x86 --prefix="${PREFIX_DIR}" enable-ssl3 enable-ssl3-method enable-md2
|
||||
./Configure android-x86 --prefix="${PREFIX_DIR}" no-shared no-tests enable-ssl3 enable-ssl3-method enable-md2 no-asm
|
||||
|
||||
elif [[ "${ARCH}" == "arm" ]]; then
|
||||
|
||||
./Configure android-arm --prefix="${PREFIX_DIR}" enable-ssl3 enable-ssl3-method enable-md2
|
||||
./Configure android-arm --prefix="${PREFIX_DIR}" no-shared no-tests enable-ssl3 enable-ssl3-method enable-md2 no-asm
|
||||
|
||||
elif [[ "${ARCH}" == "arm64" ]]; then
|
||||
|
||||
./Configure android-arm64 --prefix="${PREFIX_DIR}" enable-ssl3 enable-ssl3-method enable-md2
|
||||
./Configure android-arm64 --prefix="${PREFIX_DIR}" no-shared no-tests enable-ssl3 enable-ssl3-method enable-md2 no-asm
|
||||
|
||||
else
|
||||
log_error "not support" && exit 1
|
||||
@ -103,6 +103,9 @@ function configure_make() {
|
||||
|
||||
log_info "make $ABI start..."
|
||||
|
||||
sed -ie 's/LIB_CFLAGS=/LIB_CFLAGS=-fvisibility=hidden /g' ./Makefile
|
||||
sed -ie 's/LIB_CXXFLAGS=/LIB_CXXFLAGS=-fvisibility=hidden /g' ./Makefile
|
||||
|
||||
make clean >"${OUTPUT_ROOT}/log/${ABI}.log"
|
||||
if make -j$(get_cpu_count) >>"${OUTPUT_ROOT}/log/${ABI}.log" 2>&1; then
|
||||
make install_sw >>"${OUTPUT_ROOT}/log/${ABI}.log" 2>&1
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# Based on Ubuntu
|
||||
############################################################
|
||||
# Set the base image to Ubuntu
|
||||
FROM ubuntu:14.04
|
||||
FROM ubuntu:18.04
|
||||
# File Author / Maintainer
|
||||
MAINTAINER onlyoffice.com
|
||||
################## BEGIN INSTALLATION ######################
|
||||
@ -23,12 +23,25 @@ RUN sudo apt-get install -y \
|
||||
curl \
|
||||
wget \
|
||||
xz-utils \
|
||||
zip
|
||||
zip \
|
||||
python2.7 \
|
||||
python3 \
|
||||
autoconf \
|
||||
build-essential \
|
||||
cmake \
|
||||
pkg-config \
|
||||
libc6-i386 \
|
||||
gcc-multilib \
|
||||
software-properties-common
|
||||
WORKDIR /home/docker
|
||||
RUN mkdir v8
|
||||
WORKDIR /home/docker/v8
|
||||
COPY ./build.sh ./build.sh
|
||||
RUN ./build.sh
|
||||
COPY ./build.py ./build.py
|
||||
RUN sudo add-apt-repository -y ppa:deadsnakes/ppa
|
||||
RUN sudo apt install -y python3.8
|
||||
RUN sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1000
|
||||
RUN sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1000
|
||||
RUN python ./build.py
|
||||
RUN zip -r ./build.zip ./build/*
|
||||
RUN ls -al /home/docker/v8/build.zip
|
||||
#End of docker Command
|
||||
199
Common/3dParty/v8/android/build.py
Normal file
199
Common/3dParty/v8/android/build.py
Normal file
@ -0,0 +1,199 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import platform
|
||||
import os
|
||||
import subprocess
|
||||
import glob
|
||||
import shutil
|
||||
import codecs
|
||||
|
||||
# BASE --------------------------------------------
|
||||
def host_platform():
|
||||
ret = platform.system().lower()
|
||||
if (ret == "darwin"):
|
||||
return "mac"
|
||||
return ret
|
||||
|
||||
def get_path(path):
|
||||
if "windows" == host_platform():
|
||||
return path.replace("/", "\\")
|
||||
return path
|
||||
|
||||
def is_file(path):
|
||||
return os.path.isfile(get_path(path))
|
||||
|
||||
def is_dir(path):
|
||||
return os.path.isdir(get_path(path))
|
||||
|
||||
def copy_file(src, dst):
|
||||
if is_file(dst):
|
||||
delete_file(dst)
|
||||
if not is_file(src):
|
||||
print("copy warning [file not exist]: " + src)
|
||||
return
|
||||
return shutil.copy2(get_path(src), get_path(dst))
|
||||
|
||||
def delete_file(path):
|
||||
if not is_file(path):
|
||||
print("delete warning [file not exist]: " + path)
|
||||
return
|
||||
return os.remove(get_path(path))
|
||||
|
||||
def create_dir(path):
|
||||
path2 = get_path(path)
|
||||
if not os.path.exists(path2):
|
||||
os.makedirs(path2)
|
||||
return
|
||||
|
||||
def copy_dir(src, dst):
|
||||
if is_dir(dst):
|
||||
delete_dir(dst)
|
||||
try:
|
||||
shutil.copytree(get_path(src), get_path(dst))
|
||||
except OSError as e:
|
||||
print('Directory not copied. Error: %s' % e)
|
||||
return
|
||||
|
||||
def delete_dir(path):
|
||||
if not is_dir(path):
|
||||
print("delete warning [folder not exist]: " + path)
|
||||
return
|
||||
shutil.rmtree(get_path(path), ignore_errors=True)
|
||||
return
|
||||
|
||||
def cmd(prog, args=[], is_no_errors=False):
|
||||
ret = 0
|
||||
command = prog
|
||||
for arg in args:
|
||||
command += (" \"" + arg + "\"")
|
||||
ret = subprocess.call(command, stderr=subprocess.STDOUT, shell=True)
|
||||
if ret != 0 and True != is_no_errors:
|
||||
sys.exit("Error (" + prog + "): " + str(ret))
|
||||
return ret
|
||||
|
||||
def cmd2(prog, args=[], is_no_errors=False):
|
||||
ret = 0
|
||||
command = get_path(prog)
|
||||
for arg in args:
|
||||
command += (" " + arg)
|
||||
print(command)
|
||||
ret = subprocess.call(command, stderr=subprocess.STDOUT, shell=True)
|
||||
if ret != 0 and True != is_no_errors:
|
||||
sys.exit("Error (" + prog + "): " + str(ret))
|
||||
return ret
|
||||
|
||||
def get_script_dir():
|
||||
test_file = __file__
|
||||
scriptPath = os.path.realpath(test_file)
|
||||
scriptDir = os.path.dirname(scriptPath)
|
||||
return scriptDir
|
||||
|
||||
def get_env(name):
|
||||
return os.getenv(name, "")
|
||||
|
||||
def set_env(name, value):
|
||||
os.environ[name] = value
|
||||
return
|
||||
|
||||
def replaceInFile(path, text, textReplace):
|
||||
if not is_file(path):
|
||||
print("[replaceInFile] file not exist: " + path)
|
||||
return
|
||||
filedata = ""
|
||||
with open(get_path(path), "r") as file:
|
||||
filedata = file.read()
|
||||
filedata = filedata.replace(text, textReplace)
|
||||
delete_file(path)
|
||||
with open(get_path(path), "w") as file:
|
||||
file.write(filedata)
|
||||
return
|
||||
|
||||
# -------------------------------------------------
|
||||
|
||||
def get_android_args(platform, sdk_ver=21):
|
||||
gn_args = ["is_component_build=false",
|
||||
"is_clang=true",
|
||||
"is_debug=false",
|
||||
"use_sysroot=true",
|
||||
"target_os=\\\"android\\\"",
|
||||
"target_cpu=\\\"" + platform + "\\\"",
|
||||
"v8_target_cpu=\\\"" + platform + "\\\"",
|
||||
"v8_enable_i18n_support=true",
|
||||
"v8_static_library=true",
|
||||
"v8_monolithic=true",
|
||||
"use_custom_libcxx=false",
|
||||
"android_ndk_version=\\\"21.1.6352462\\\"",
|
||||
"android_sdk_version=\\\"" + str(sdk_ver) + "\\\"",
|
||||
"clang_use_chrome_plugins=false",
|
||||
"v8_use_external_startup_data=false",
|
||||
"treat_warnings_as_errors=false"]
|
||||
return gn_args
|
||||
|
||||
def deploy_libs():
|
||||
if is_dir("../build"):
|
||||
delete_dir("../build")
|
||||
create_dir("../build")
|
||||
|
||||
platforms = ["arm64", "arm", "x86_64", "x86"]
|
||||
dirs = ["arm64-v8a", "armeabi-v7a", "x86_64", "x86"]
|
||||
|
||||
for index, item in enumerate(platforms):
|
||||
input_dir = "./out.gn/android/" + platforms[index]
|
||||
output_dir = "../build/" + dirs[index]
|
||||
create_dir(output_dir)
|
||||
copy_file(input_dir + "/icudtl.dat", output_dir + "/icudtl.dat")
|
||||
copy_file(input_dir + "/icudtl_extra.dat", output_dir + "/icudtl_extra.dat")
|
||||
copy_file(input_dir + "/obj/libv8_monolith.a", output_dir + "/libv8_monolith.a")
|
||||
|
||||
create_dir("../build/v8")
|
||||
copy_dir("./include", "../build/v8/include")
|
||||
copy_dir("./src", "../build/v8/src")
|
||||
return
|
||||
|
||||
def make():
|
||||
old_env = dict(os.environ)
|
||||
old_cur = os.getcwd()
|
||||
|
||||
base_dir = get_script_dir()
|
||||
|
||||
os.chdir(base_dir)
|
||||
if not is_dir("depot_tools"):
|
||||
cmd("git", ["clone", "https://chromium.googlesource.com/chromium/tools/depot_tools.git"])
|
||||
|
||||
os.environ["PATH"] = base_dir + "/depot_tools" + os.pathsep + os.environ["PATH"]
|
||||
|
||||
if not is_dir("v8"):
|
||||
cmd("./depot_tools/fetch", ["v8"], True)
|
||||
copy_dir("./v8/third_party", "./v8/third_party_new")
|
||||
v8_branch_version = "remotes/branch-heads/8.9"
|
||||
cmd("./depot_tools/gclient", ["sync", "-r", v8_branch_version], True)
|
||||
replaceInFile("./.gclient", "]", "];target_os=['android'];")
|
||||
cmd("gclient", ["sync", "--force"], True)
|
||||
copy_dir("./v8/third_party_new/ninja", "./v8/third_party/ninja")
|
||||
|
||||
if not is_file("v8/third_party/jinja2/tests.py.bak"):
|
||||
copy_file("v8/third_party/jinja2/tests.py", "v8/third_party/jinja2/tests.py.bak")
|
||||
replaceInFile("v8/third_party/jinja2/tests.py", "from collections import Mapping", "try:\n from collections.abc import Mapping\nexcept ImportError:\n from collections import Mapping")
|
||||
|
||||
os.chdir("v8")
|
||||
|
||||
cmd2("gn", ["gen", "out.gn/android/arm64", "--args=\"" + " ".join(get_android_args("arm64")) + "\""])
|
||||
cmd("ninja", ["-C", "out.gn/android/arm64"])
|
||||
|
||||
cmd2("gn", ["gen", "out.gn/android/arm", "--args=\"" + " ".join(get_android_args("arm")) + "\""])
|
||||
cmd("ninja", ["-C", "out.gn/android/arm"])
|
||||
|
||||
cmd2("gn", ["gen", "out.gn/android/x86_64", "--args=\"" + " ".join(get_android_args("x64", 16)) + "\""])
|
||||
cmd("ninja", ["-C", "out.gn/android/x86_64"])
|
||||
|
||||
cmd2("gn", ["gen", "out.gn/android/x86", "--args=\"" + " ".join(get_android_args("x86", 16)) + "\""])
|
||||
cmd("ninja", ["-C", "out.gn/android/x86"])
|
||||
|
||||
deploy_libs()
|
||||
|
||||
os.chdir(old_cur)
|
||||
os.environ.clear()
|
||||
os.environ.update(old_env)
|
||||
|
||||
make()
|
||||
@ -48,7 +48,7 @@ restore_build_gn()
|
||||
|
||||
if [ ! -d "v8" ]
|
||||
then
|
||||
fetch v8
|
||||
./depot_tools/fetch v8
|
||||
cd v8
|
||||
git checkout -b 6.0 branch-heads/6.0
|
||||
|
||||
|
||||
@ -3,23 +3,34 @@ sys.path.append('./../../../../../build_tools/scripts')
|
||||
import base
|
||||
import os
|
||||
|
||||
if ("linux" == base.host_platform()):
|
||||
if not base.is_dir("./build"):
|
||||
base.bash("./build")
|
||||
def build_func():
|
||||
if ("linux" == base.host_platform()):
|
||||
if not base.is_dir("./build"):
|
||||
base.cmd("python", ["./build.py"])
|
||||
|
||||
if ("mac" == base.host_platform()):
|
||||
if not base.is_file("./build.zip"):
|
||||
base.bash("./run_docker")
|
||||
if not base.is_dir("./build"):
|
||||
base.configure_common_apps("./../../../../../build_tools/scripts/base.py")
|
||||
base.extract("./build.zip", "./")
|
||||
if not base.is_dir("v8"):
|
||||
if not base.is_dir("depot_tools"):
|
||||
base.cmd("git", ["clone", "https://chromium.googlesource.com/chromium/tools/depot_tools.git"])
|
||||
old_cur = os.getcwd()
|
||||
os.environ["PATH"] = old_cur + "/depot_tools" + os.pathsep + os.environ["PATH"]
|
||||
base.cmd("./depot_tools/fetch", ["v8"], True)
|
||||
os.chdir(old_cur + "/v8")
|
||||
base.cmd("git", ["checkout", "-b", "6.0", "branch-heads/6.0"], True)
|
||||
os.chdir(old_cur)
|
||||
base.cmd("gclient", ["sync"])
|
||||
if ("mac" == base.host_platform()):
|
||||
if not base.is_file("./build.zip"):
|
||||
base.bash("./run_docker")
|
||||
if not base.is_dir("./build"):
|
||||
base.configure_common_apps("./../../../../../build_tools/scripts/base.py")
|
||||
base.extract("./build.zip", "./")
|
||||
if not base.is_dir("v8"):
|
||||
if not base.is_dir("depot_tools"):
|
||||
base.cmd("git", ["clone", "https://chromium.googlesource.com/chromium/tools/depot_tools.git"])
|
||||
old_cur = os.getcwd()
|
||||
os.environ["PATH"] = old_cur + "/depot_tools" + os.pathsep + os.environ["PATH"]
|
||||
base.cmd("./depot_tools/fetch", ["v8"], True)
|
||||
base.cmd("./depot_tools/gclient", ["sync", "-r", "remotes/branch-heads/8.9"], True)
|
||||
base.cmd("gclient", ["sync", "--force"], True)
|
||||
return
|
||||
|
||||
# build function. for speed we just download the build archive
|
||||
# archive built with this func
|
||||
if False:
|
||||
build_func()
|
||||
else:
|
||||
if not base.is_file("./build.7z"):
|
||||
base.download("http://d2ettrnqo7v976.cloudfront.net/v8/android/build.7z", "./build.7z")
|
||||
base.extract("./build.7z", "./")
|
||||
base.copy_dir("./build/v8", "./v8")
|
||||
base.delete_dir("./build/v8")
|
||||
|
||||
@ -10,6 +10,7 @@ for image in $(docker images --format "{{.ID}}"); do
|
||||
done
|
||||
|
||||
docker rm v8docker
|
||||
docker build . -t v8_docker --build-arg CACHEBUST=0 --no-cache=true
|
||||
#add --progress=plain for full logs from build.sh
|
||||
docker build . -t v8_docker --build-arg CACHEBUST=0 --no-cache=true --platform linux/amd64
|
||||
docker run -d --name v8docker v8_docker:latest
|
||||
docker cp v8docker:/home/docker/v8/build.zip .
|
||||
@ -8,6 +8,12 @@ v8_version_89 {
|
||||
|
||||
core_win_32:CONFIG += build_platform_32
|
||||
core_linux_32:CONFIG += build_platform_32
|
||||
|
||||
core_android {
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_armv7):CONFIG += build_platform_32
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_x86):CONFIG += build_platform_32
|
||||
}
|
||||
|
||||
!build_platform_32:DEFINES += V8_COMPRESS_POINTERS
|
||||
|
||||
CORE_V8_PATH_OVERRIDE = $$PWD/../v8_89
|
||||
@ -17,12 +23,13 @@ CORE_V8_PATH_INCLUDE = $$CORE_V8_PATH_OVERRIDE/v8
|
||||
CORE_V8_PATH_LIBS = $$CORE_V8_PATH_INCLUDE/out.gn/$$CORE_BUILDS_PLATFORM_PREFIX/obj
|
||||
|
||||
core_android {
|
||||
CORE_V8_PATH_INCLUDE = $$CORE_V8_PATH_OVERRIDE/android/v8
|
||||
CORE_V8_PATH_INCLUDE = $$PWD/android/v8
|
||||
CORE_V8_PATH_LIBS = $$PWD/android/build
|
||||
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_arm64_v8a):CORE_V8_PATH_LIBS=$$CORE_V8_PATH_OVERRIDE/android/build/arm64-v8a
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_armv7): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_OVERRIDE/android/build/armeabi-v7a
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_x86): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_OVERRIDE/android/build/x86
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_x86_64): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_OVERRIDE/android/build/x86_64
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_arm64_v8a):CORE_V8_PATH_LIBS=$$CORE_V8_PATH_LIBS/arm64-v8a
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_armv7): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_LIBS/armeabi-v7a
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_x86): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_LIBS/x86
|
||||
isEqual(CORE_BUILDS_PLATFORM_PREFIX, android_x86_64): CORE_V8_PATH_LIBS=$$CORE_V8_PATH_LIBS/x86_64
|
||||
}
|
||||
|
||||
INCLUDEPATH += \
|
||||
@ -76,6 +83,5 @@ core_mac {
|
||||
}
|
||||
|
||||
core_android {
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_nosnapshot -lv8_libsampler
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -licui18n -licuuc
|
||||
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_monolith
|
||||
}
|
||||
|
||||
@ -524,6 +524,7 @@ public:
|
||||
m_mapLCID2DefCodePage.insert(std::make_pair(0x40E, 1250));
|
||||
m_mapLCID2DefCodePage.insert(std::make_pair(0x40F, 1252));
|
||||
m_mapLCID2DefCodePage.insert(std::make_pair(0x410, 1252));
|
||||
m_mapLCID2DefCodePage.insert(std::make_pair(0x412, 949));
|
||||
m_mapLCID2DefCodePage.insert(std::make_pair(0x413, 1252));
|
||||
m_mapLCID2DefCodePage.insert(std::make_pair(0x414, 1252));
|
||||
m_mapLCID2DefCodePage.insert(std::make_pair(0x415, 1250));
|
||||
|
||||
@ -24,6 +24,8 @@ core_linux {
|
||||
SOURCES += $$PWD/src/FileTransporter_curl.cpp
|
||||
}
|
||||
core_mac {
|
||||
use_v8:DEFINES += OLD_MACOS_SYSTEM
|
||||
|
||||
OBJECTIVE_SOURCES += $$PWD/src/FileTransporter_mac.mm
|
||||
LIBS += -framework AppKit
|
||||
}
|
||||
|
||||
@ -49,323 +49,350 @@
|
||||
|
||||
namespace NSNetwork
|
||||
{
|
||||
namespace NSFileTransport
|
||||
{
|
||||
std::string wget_url_validate(const std::string& url)
|
||||
{
|
||||
std::string::size_type pos = 0;
|
||||
const char* url_ptr = url.c_str();
|
||||
while ('-' == *url_ptr++) // '\0' => break
|
||||
++pos;
|
||||
if (*url_ptr == '\0')
|
||||
return "";
|
||||
namespace NSFileTransport
|
||||
{
|
||||
std::string wget_url_validate(const std::string& url)
|
||||
{
|
||||
std::string::size_type pos = 0;
|
||||
const char* url_ptr = url.c_str();
|
||||
while ('-' == *url_ptr++) // '\0' => break
|
||||
++pos;
|
||||
if (*url_ptr == '\0')
|
||||
return "";
|
||||
|
||||
return url.substr(pos);
|
||||
}
|
||||
return url.substr(pos);
|
||||
}
|
||||
|
||||
int download_external(const std::wstring& sUrl, const std::wstring& sOutput, std::function<void(int)> func_onProgress = nullptr, std::function<bool(void)> func_checkAborted = nullptr)
|
||||
{
|
||||
pid_t pid;
|
||||
int nReturnCode = -1;
|
||||
std::string sUrlA = U_TO_UTF8(sUrl);
|
||||
//sUrlA =("\"" + sUrlA + "\"");
|
||||
std::string sOutputA = U_TO_UTF8(sOutput);
|
||||
//sOutputA =("\"" + sOutputA + "\"");
|
||||
int download_external(const std::wstring& sUrl, const std::wstring& sOutput, std::function<void(int)> func_onProgress = nullptr, std::function<bool(void)> func_checkAborted = nullptr)
|
||||
{
|
||||
pid_t pid;
|
||||
int nReturnCode = -1;
|
||||
std::string sUrlA = U_TO_UTF8(sUrl);
|
||||
//sUrlA =("\"" + sUrlA + "\"");
|
||||
std::string sOutputA = U_TO_UTF8(sOutput);
|
||||
//sOutputA =("\"" + sOutputA + "\"");
|
||||
|
||||
if (0 != nReturnCode && NSFile::CFileBinary::Exists(L"/usr/bin/curl"))
|
||||
{
|
||||
int pipefd[2];
|
||||
if(func_onProgress)
|
||||
pipe(pipefd);
|
||||
std::wstring sCurlBin = L"";
|
||||
if (NSFile::CFileBinary::Exists(L"/usr/bin/curl"))
|
||||
sCurlBin = L"/usr/bin/curl";
|
||||
if (NSFile::CFileBinary::Exists(L"/usr/local/bin/curl"))
|
||||
sCurlBin = L"/usr/local/bin/curl";
|
||||
|
||||
pid = fork(); // create child process
|
||||
int status;
|
||||
if (0 != nReturnCode && !sCurlBin.empty())
|
||||
{
|
||||
int pipefd[2];
|
||||
if(func_onProgress)
|
||||
pipe(pipefd);
|
||||
|
||||
switch (pid)
|
||||
{
|
||||
case -1: // error
|
||||
break;
|
||||
pid = fork(); // create child process
|
||||
int status;
|
||||
|
||||
case 0: // child process
|
||||
{
|
||||
const char* nargs[10];
|
||||
nargs[0] = "/usr/bin/curl";
|
||||
nargs[1] = "--url";
|
||||
nargs[2] = sUrlA.c_str();
|
||||
nargs[3] = "--output";
|
||||
nargs[4] = sOutputA.c_str();
|
||||
func_onProgress == NULL ? nargs[5] = "--silent" : nargs[5] = "--progress-bar";
|
||||
nargs[6] = "-L";
|
||||
nargs[7] = "--connect-timeout";
|
||||
nargs[8] = "10";
|
||||
nargs[9] = NULL;
|
||||
switch (pid)
|
||||
{
|
||||
case -1: // error
|
||||
break;
|
||||
|
||||
const char* nenv[3];
|
||||
nenv[0] = "LD_PRELOAD=";
|
||||
nenv[1] = "LD_LIBRARY_PATH=";
|
||||
nenv[2] = NULL;
|
||||
case 0: // child process
|
||||
{
|
||||
std::string sProgramBinA = U_TO_UTF8(sCurlBin);
|
||||
|
||||
if(func_onProgress)
|
||||
{
|
||||
close(pipefd[0]); // close reading end in the child
|
||||
const char* nargs[10];
|
||||
nargs[0] = sProgramBinA.c_str();
|
||||
nargs[1] = "--url";
|
||||
nargs[2] = sUrlA.c_str();
|
||||
nargs[3] = "--output";
|
||||
nargs[4] = sOutputA.c_str();
|
||||
func_onProgress == NULL ? nargs[5] = "--silent" : nargs[5] = "--progress-bar";
|
||||
nargs[6] = "-L";
|
||||
nargs[7] = "--connect-timeout";
|
||||
nargs[8] = "10";
|
||||
nargs[9] = NULL;
|
||||
|
||||
dup2(pipefd[1], 1); // send stdout to the pipe
|
||||
dup2(pipefd[1], 2); // send stderr to the pipe
|
||||
const char* nenv[3];
|
||||
nenv[0] = "LD_PRELOAD=";
|
||||
nenv[1] = "LD_LIBRARY_PATH=";
|
||||
nenv[2] = NULL;
|
||||
|
||||
close(pipefd[1]); // this descriptor is no longer needed
|
||||
}
|
||||
if(func_onProgress)
|
||||
{
|
||||
close(pipefd[0]); // close reading end in the child
|
||||
|
||||
execve("/usr/bin/curl", (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default: // parent process, pid now contains the child pid
|
||||
if(func_onProgress)
|
||||
{
|
||||
close(pipefd[1]);
|
||||
// close the write end of the pipe in the parent
|
||||
size_t size = 81;
|
||||
char buffer[size];
|
||||
std::string str;
|
||||
ssize_t res = 1;
|
||||
std::regex r(R"(\d+(?:\.\d+)?%)");
|
||||
std::smatch sm;
|
||||
std::string percentFull;
|
||||
std::string percent;
|
||||
int percentInt;
|
||||
dup2(pipefd[1], 1); // send stdout to the pipe
|
||||
dup2(pipefd[1], 2); // send stderr to the pipe
|
||||
|
||||
while (1)
|
||||
{
|
||||
if(func_checkAborted && func_checkAborted())
|
||||
{
|
||||
kill(pid, SIGTERM);
|
||||
//while (-1 == waitpid(pid, &status, 0)); // wait for child to complete
|
||||
return nReturnCode;
|
||||
}
|
||||
close(pipefd[1]); // this descriptor is no longer needed
|
||||
}
|
||||
|
||||
str.clear();
|
||||
res = read(pipefd[0], buffer, sizeof(buffer));
|
||||
execve(sProgramBinA.c_str(), (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default: // parent process, pid now contains the child pid
|
||||
if(func_onProgress)
|
||||
{
|
||||
close(pipefd[1]);
|
||||
// close the write end of the pipe in the parent
|
||||
size_t size = 81;
|
||||
char buffer[size];
|
||||
std::string str;
|
||||
ssize_t res = 1;
|
||||
std::regex r(R"(\d+(?:\.\d+)?%)");
|
||||
std::smatch sm;
|
||||
std::string percentFull;
|
||||
std::string percent;
|
||||
int percentInt;
|
||||
|
||||
if(res == 0)
|
||||
break;
|
||||
while (1)
|
||||
{
|
||||
if(func_checkAborted && func_checkAborted())
|
||||
{
|
||||
kill(pid, SIGTERM);
|
||||
//while (-1 == waitpid(pid, &status, 0)); // wait for child to complete
|
||||
return nReturnCode;
|
||||
}
|
||||
|
||||
str.append(buffer);
|
||||
str.clear();
|
||||
res = read(pipefd[0], buffer, sizeof(buffer));
|
||||
|
||||
if(regex_search(str, sm, r))
|
||||
{
|
||||
percentFull = sm.str();
|
||||
percent = percentFull.substr(0, percentFull.find("."));
|
||||
percentInt = std::stoi(percent);
|
||||
if(res == 0)
|
||||
break;
|
||||
|
||||
if(percentInt >= 0 && percentInt <= 100)
|
||||
func_onProgress(percentInt);
|
||||
}
|
||||
str.append(buffer);
|
||||
|
||||
if(str.find("100.0%") != std::string::npos)
|
||||
break;
|
||||
if(regex_search(str, sm, r))
|
||||
{
|
||||
percentFull = sm.str();
|
||||
percent = percentFull.substr(0, percentFull.find("."));
|
||||
percentInt = std::stoi(percent);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
int waitres;
|
||||
while (1) // wait for child to complete
|
||||
{
|
||||
if(func_checkAborted && func_checkAborted())
|
||||
{
|
||||
kill(pid, SIGTERM);
|
||||
return nReturnCode;
|
||||
}
|
||||
else if((waitres = waitpid(pid, &status, WNOHANG)) > 0)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
nReturnCode = WEXITSTATUS(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(percentInt >= 0 && percentInt <= 100)
|
||||
func_onProgress(percentInt);
|
||||
}
|
||||
|
||||
if (0 != nReturnCode && NSFile::CFileBinary::Exists(L"/usr/bin/wget"))
|
||||
{
|
||||
std::string sUrlValidateA = wget_url_validate(sUrlA);
|
||||
if(str.find("100.0%") != std::string::npos)
|
||||
break;
|
||||
|
||||
pid = fork(); // create child process
|
||||
int status;
|
||||
}
|
||||
}
|
||||
else {
|
||||
int waitres;
|
||||
while (1) // wait for child to complete
|
||||
{
|
||||
if(func_checkAborted && func_checkAborted())
|
||||
{
|
||||
kill(pid, SIGTERM);
|
||||
return nReturnCode;
|
||||
}
|
||||
else if((waitres = waitpid(pid, &status, WNOHANG)) > 0)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
nReturnCode = WEXITSTATUS(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (pid)
|
||||
{
|
||||
case -1: // error
|
||||
break;
|
||||
std::wstring sWgetBin = L"";
|
||||
if (NSFile::CFileBinary::Exists(L"/usr/bin/wget"))
|
||||
sWgetBin = L"/usr/bin/wget";
|
||||
if (NSFile::CFileBinary::Exists(L"/usr/local/bin/wget"))
|
||||
sWgetBin = L"/usr/local/bin/wget";
|
||||
|
||||
case 0: // child process
|
||||
{
|
||||
const char* nargs[8];
|
||||
nargs[0] = "/usr/bin/wget";
|
||||
nargs[1] = sUrlValidateA.c_str();
|
||||
nargs[2] = "-O";
|
||||
nargs[3] = sOutputA.c_str();
|
||||
nargs[4] = "-q";
|
||||
nargs[5] = "--connect-timeout=10";
|
||||
nargs[6] = "--tries=2";
|
||||
nargs[7] = NULL;
|
||||
if (0 != nReturnCode && !sWgetBin.empty())
|
||||
{
|
||||
std::string sUrlValidateA = wget_url_validate(sUrlA);
|
||||
|
||||
const char* nenv[2];
|
||||
nenv[0] = "LD_PRELOAD=";
|
||||
nenv[1] = NULL;
|
||||
pid = fork(); // create child process
|
||||
int status;
|
||||
|
||||
execve("/usr/bin/wget", (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default: // parent process, pid now contains the child pid
|
||||
int waitres;
|
||||
while (1) // wait for child to complete
|
||||
{
|
||||
if(func_checkAborted && func_checkAborted())
|
||||
{
|
||||
kill(pid, SIGTERM);
|
||||
return nReturnCode;
|
||||
}
|
||||
else if((waitres = waitpid(pid, &status, WNOHANG)) > 0)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
nReturnCode = WEXITSTATUS(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (pid)
|
||||
{
|
||||
case -1: // error
|
||||
break;
|
||||
|
||||
if (0 == nReturnCode)
|
||||
{
|
||||
if (!NSFile::CFileBinary::Exists(sOutput))
|
||||
nReturnCode = -1;
|
||||
}
|
||||
case 0: // child process
|
||||
{
|
||||
std::string sProgramBinA = U_TO_UTF8(sWgetBin);
|
||||
|
||||
return nReturnCode;
|
||||
}
|
||||
#ifndef OLD_MACOS_SYSTEM
|
||||
const char* nargs[8];
|
||||
#else
|
||||
const char* nargs[9];
|
||||
#endif
|
||||
|
||||
int uploaddata_external(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize)
|
||||
{
|
||||
int nReturnCode = -1;
|
||||
NSFile::CFileBinary oFileData;
|
||||
std::wstring tempFileName = NSFile::CFileBinary::GetTempPath() + L"/tmpFileForUpload";
|
||||
oFileData.CreateFileW(tempFileName);
|
||||
oFileData.WriteFile(cData, nSize);
|
||||
oFileData.CloseFile();
|
||||
nargs[0] = sProgramBinA.c_str();
|
||||
nargs[1] = sUrlValidateA.c_str();
|
||||
nargs[2] = "-O";
|
||||
nargs[3] = sOutputA.c_str();
|
||||
nargs[4] = "-q";
|
||||
nargs[5] = "--connect-timeout=10";
|
||||
nargs[6] = "--tries=2";
|
||||
|
||||
std::string sUploadUrlA = U_TO_UTF8(sUploadUrl);
|
||||
#ifndef OLD_MACOS_SYSTEM
|
||||
nargs[7] = NULL;
|
||||
#else
|
||||
nargs[7] = "--no-check-certificate";
|
||||
nargs[8] = NULL;
|
||||
#endif
|
||||
|
||||
const char* nenv[2];
|
||||
nenv[0] = "LD_PRELOAD=";
|
||||
nenv[1] = NULL;
|
||||
|
||||
execve(sProgramBinA.c_str(), (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default: // parent process, pid now contains the child pid
|
||||
int waitres;
|
||||
while (1) // wait for child to complete
|
||||
{
|
||||
if(func_checkAborted && func_checkAborted())
|
||||
{
|
||||
kill(pid, SIGTERM);
|
||||
return nReturnCode;
|
||||
}
|
||||
else if((waitres = waitpid(pid, &status, WNOHANG)) > 0)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
nReturnCode = WEXITSTATUS(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == nReturnCode)
|
||||
{
|
||||
if (!NSFile::CFileBinary::Exists(sOutput))
|
||||
nReturnCode = -1;
|
||||
}
|
||||
|
||||
return nReturnCode;
|
||||
}
|
||||
|
||||
int uploaddata_external(const std::wstring &sUploadUrl, const unsigned char* cData, const int nSize)
|
||||
{
|
||||
int nReturnCode = -1;
|
||||
NSFile::CFileBinary oFileData;
|
||||
std::wstring tempFileName = NSFile::CFileBinary::GetTempPath() + L"/tmpFileForUpload";
|
||||
oFileData.CreateFileW(tempFileName);
|
||||
oFileData.WriteFile(cData, nSize);
|
||||
oFileData.CloseFile();
|
||||
|
||||
std::string sUploadUrlA = U_TO_UTF8(sUploadUrl);
|
||||
|
||||
|
||||
if (0 != nReturnCode && NSFile::CFileBinary::Exists(L"/usr/bin/curl"))
|
||||
{
|
||||
pid_t pid = fork(); // create child process
|
||||
int status;
|
||||
if (0 != nReturnCode && NSFile::CFileBinary::Exists(L"/usr/bin/curl"))
|
||||
{
|
||||
pid_t pid = fork(); // create child process
|
||||
int status;
|
||||
|
||||
switch (pid)
|
||||
{
|
||||
case -1: // error
|
||||
break;
|
||||
switch (pid)
|
||||
{
|
||||
case -1: // error
|
||||
break;
|
||||
|
||||
case 0: // child process
|
||||
{
|
||||
//curl --request POST --data-binary "@template_entry.xml" $URL
|
||||
auto pathTofile(std::string("@") + std::string(tempFileName.begin(), tempFileName.end()));
|
||||
const char* nargs[9];
|
||||
nargs[0] = "/usr/bin/curl";
|
||||
nargs[1] = "--request";
|
||||
nargs[2] = "POST";
|
||||
nargs[3] = "--data-binary";
|
||||
nargs[4] = pathTofile.c_str();
|
||||
nargs[5] = sUploadUrlA.c_str();
|
||||
nargs[6] = "--connect-timeout";
|
||||
nargs[7] = "10";
|
||||
nargs[8] = NULL;
|
||||
case 0: // child process
|
||||
{
|
||||
//curl --request POST --data-binary "@template_entry.xml" $URL
|
||||
auto pathTofile(std::string("@") + std::string(tempFileName.begin(), tempFileName.end()));
|
||||
const char* nargs[9];
|
||||
nargs[0] = "/usr/bin/curl";
|
||||
nargs[1] = "--request";
|
||||
nargs[2] = "POST";
|
||||
nargs[3] = "--data-binary";
|
||||
nargs[4] = pathTofile.c_str();
|
||||
nargs[5] = sUploadUrlA.c_str();
|
||||
nargs[6] = "--connect-timeout";
|
||||
nargs[7] = "10";
|
||||
nargs[8] = NULL;
|
||||
|
||||
const char* nenv[3];
|
||||
nenv[0] = "LD_PRELOAD=";
|
||||
nenv[1] = "LD_LIBRARY_PATH=";
|
||||
nenv[2] = NULL;
|
||||
const char* nenv[3];
|
||||
nenv[0] = "LD_PRELOAD=";
|
||||
nenv[1] = "LD_LIBRARY_PATH=";
|
||||
nenv[2] = NULL;
|
||||
|
||||
execve("/usr/bin/curl", (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default: // parent process, pid now contains the child pid
|
||||
while (-1 == waitpid(pid, &status, 0)); // wait for child to complete
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
nReturnCode = WEXITSTATUS(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
NSFile::CFileBinary::Remove(tempFileName);
|
||||
execve("/usr/bin/curl", (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default: // parent process, pid now contains the child pid
|
||||
while (-1 == waitpid(pid, &status, 0)); // wait for child to complete
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
nReturnCode = WEXITSTATUS(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
NSFile::CFileBinary::Remove(tempFileName);
|
||||
|
||||
return nReturnCode;
|
||||
}
|
||||
return nReturnCode;
|
||||
}
|
||||
|
||||
int uploadfile_external(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath)
|
||||
{
|
||||
int nReturnCode = -1;
|
||||
int uploadfile_external(const std::wstring &sUploadUrl, const std::wstring &sUploadFilePath)
|
||||
{
|
||||
int nReturnCode = -1;
|
||||
|
||||
std::string sUploadUrlA = U_TO_UTF8(sUploadUrl);
|
||||
std::string sUploadFilePathA = U_TO_UTF8(sUploadFilePath);
|
||||
std::string sUploadFileNameA = U_TO_UTF8(NSFile::GetFileName(sUploadFilePath));
|
||||
std::string sUploadUrlA = U_TO_UTF8(sUploadUrl);
|
||||
std::string sUploadFilePathA = U_TO_UTF8(sUploadFilePath);
|
||||
std::string sUploadFileNameA = U_TO_UTF8(NSFile::GetFileName(sUploadFilePath));
|
||||
|
||||
if (0 != nReturnCode && NSFile::CFileBinary::Exists(L"/usr/bin/curl"))
|
||||
{
|
||||
pid_t pid = fork(); // create child process
|
||||
int status;
|
||||
if (0 != nReturnCode && NSFile::CFileBinary::Exists(L"/usr/bin/curl"))
|
||||
{
|
||||
pid_t pid = fork(); // create child process
|
||||
int status;
|
||||
|
||||
switch (pid)
|
||||
{
|
||||
case -1: // error
|
||||
break;
|
||||
switch (pid)
|
||||
{
|
||||
case -1: // error
|
||||
break;
|
||||
|
||||
case 0: // child process
|
||||
{
|
||||
//curl -v -F filename=image.jpg -F upload=@/home/vladimir/Pictures/Test.png $URL
|
||||
auto filename(std::string("filename=") + sUploadFileNameA);
|
||||
auto upload(std::string("upload=@") + sUploadFilePathA);
|
||||
const char* nargs[10];
|
||||
nargs[0] = "/usr/bin/curl";
|
||||
nargs[1] = "-v";
|
||||
nargs[2] = "-F";
|
||||
nargs[3] = filename.c_str();
|
||||
nargs[4] = "-F";
|
||||
nargs[5] = upload.c_str();
|
||||
nargs[6] = sUploadUrlA.c_str();
|
||||
nargs[7] = "--connect-timeout";
|
||||
nargs[8] = "10";
|
||||
nargs[9] = NULL;
|
||||
case 0: // child process
|
||||
{
|
||||
//curl -v -F filename=image.jpg -F upload=@/home/vladimir/Pictures/Test.png $URL
|
||||
auto filename(std::string("filename=") + sUploadFileNameA);
|
||||
auto upload(std::string("upload=@") + sUploadFilePathA);
|
||||
const char* nargs[10];
|
||||
nargs[0] = "/usr/bin/curl";
|
||||
nargs[1] = "-v";
|
||||
nargs[2] = "-F";
|
||||
nargs[3] = filename.c_str();
|
||||
nargs[4] = "-F";
|
||||
nargs[5] = upload.c_str();
|
||||
nargs[6] = sUploadUrlA.c_str();
|
||||
nargs[7] = "--connect-timeout";
|
||||
nargs[8] = "10";
|
||||
nargs[9] = NULL;
|
||||
|
||||
const char* nenv[3];
|
||||
nenv[0] = "LD_PRELOAD=";
|
||||
nenv[1] = "LD_LIBRARY_PATH=";
|
||||
nenv[2] = NULL;
|
||||
const char* nenv[3];
|
||||
nenv[0] = "LD_PRELOAD=";
|
||||
nenv[1] = "LD_LIBRARY_PATH=";
|
||||
nenv[2] = NULL;
|
||||
|
||||
execve("/usr/bin/curl", (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default: // parent process, pid now contains the child pid
|
||||
while (-1 == waitpid(pid, &status, 0)); // wait for child to complete
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
nReturnCode = WEXITSTATUS(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
execve("/usr/bin/curl", (char * const *)nargs, (char * const *)nenv);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default: // parent process, pid now contains the child pid
|
||||
while (-1 == waitpid(pid, &status, 0)); // wait for child to complete
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
nReturnCode = WEXITSTATUS(status);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nReturnCode;
|
||||
}
|
||||
}
|
||||
return nReturnCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -59,8 +59,9 @@ libsocketio {
|
||||
_WEBSOCKETPP_CPP11_CHRONO_ \
|
||||
\
|
||||
"SIO_TLS=1" \
|
||||
"SIO_TLS_NO=0" \
|
||||
"PING_TIMEOUT_INTERVAL=20000"
|
||||
"SIO_TLS_NO=0"
|
||||
|
||||
#DEFINES += "PING_TIMEOUT_INTERVAL=20000"
|
||||
|
||||
include($$PWD/../../3dParty/boost/boost.pri)
|
||||
|
||||
|
||||
@ -11,11 +11,19 @@ BUILD_NUMBER = $$(BUILD_NUMBER)
|
||||
|
||||
DEFINES += INTVER=$$VERSION
|
||||
|
||||
WIN_VERSION = $$replace(VERSION, \., ",")
|
||||
DEFINES += WIN_INTVER=$$WIN_VERSION
|
||||
|
||||
PUBLISHER_NAME = $$(PUBLISHER_NAME)
|
||||
isEmpty(PUBLISHER_NAME){
|
||||
PUBLISHER_NAME = $$cat(copyright.txt)
|
||||
}
|
||||
|
||||
APPLICATION_NAME_DEFAULT = $$(APPLICATION_NAME_DEFAULT)
|
||||
!isEmpty(APPLICATION_NAME_DEFAULT){
|
||||
DEFINES += "APPLICATION_NAME_DEFAULT=$${APPLICATION_NAME_DEFAULT}"
|
||||
}
|
||||
|
||||
OO_BUILD_BRANDING = $$(OO_BRANDING)
|
||||
OO_DESTDIR_BUILD_OVERRIDE = $$(DESTDIR_BUILD_OVERRIDE)
|
||||
|
||||
@ -31,6 +39,8 @@ win32 {
|
||||
CURRENT_YEAR = $$system(date +%Y)
|
||||
}
|
||||
|
||||
DEFINES += COPYRIGHT_YEAR=$${CURRENT_YEAR}
|
||||
|
||||
QMAKE_TARGET_COMPANY = $$PUBLISHER_NAME
|
||||
QMAKE_TARGET_COPYRIGHT = Copyright (C) $${PUBLISHER_NAME} $${CURRENT_YEAR}. All rights reserved
|
||||
|
||||
@ -388,26 +398,36 @@ core_static_link_libstd {
|
||||
message(core_static_link_libstd)
|
||||
}
|
||||
plugin {
|
||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||
QMAKE_CFLAGS += -fvisibility=hidden
|
||||
|
||||
TARGET_EXT = .so
|
||||
}
|
||||
}
|
||||
|
||||
core_mac {
|
||||
plugin {
|
||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||
QMAKE_CFLAGS += -fvisibility=hidden
|
||||
}
|
||||
}
|
||||
|
||||
core_windows {
|
||||
plugin {
|
||||
TARGET_EXT = .dll
|
||||
}
|
||||
}
|
||||
|
||||
!core_windows {
|
||||
plugin:CONFIG += config_hidden_symbols
|
||||
staticlib:CONFIG += config_hidden_symbols
|
||||
}
|
||||
|
||||
config_hidden_symbols {
|
||||
QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
QMAKE_CFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
|
||||
core_mac:CONFIG += clang_no_exclude_libs
|
||||
core_ios:CONFIG += clang_no_exclude_libs
|
||||
|
||||
!clang_no_exclude_libs {
|
||||
plugin:QMAKE_LFLAGS += -Wl,--exclude-libs,ALL
|
||||
equals(TEMPLATE, app) {
|
||||
QMAKE_LFLAGS += -Wl,--exclude-libs,ALL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# BUILD_PATHS
|
||||
# MUST BE DEFINED CORE_ROOT_DIR
|
||||
!core_no_dst {
|
||||
|
||||
@ -68,6 +68,9 @@ public:
|
||||
inline void close() override {
|
||||
std::fstream::close();
|
||||
}
|
||||
inline bool isError() override {
|
||||
return (std::fstream::bad() || std::fstream::fail());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ namespace CFCPP
|
||||
virtual void write (const char* buffer, _INT64 len) = 0;
|
||||
virtual void flush() = 0;
|
||||
virtual void close() = 0;
|
||||
virtual bool isError() = 0;
|
||||
};
|
||||
|
||||
using Stream = std::shared_ptr<IStream>;
|
||||
|
||||
@ -67,9 +67,9 @@ std::shared_ptr<CFStorage> CompoundFile::RootStorage()
|
||||
{
|
||||
return _impl->RootStorage();
|
||||
}
|
||||
void CompoundFile::Save(std::wstring wFileName)
|
||||
bool CompoundFile::Save(std::wstring wFileName)
|
||||
{
|
||||
_impl->Save(wFileName);
|
||||
return _impl->Save(wFileName);
|
||||
}
|
||||
void CompoundFile::Save(Stream stream)
|
||||
{
|
||||
@ -316,15 +316,23 @@ void CompoundFile_impl::Load(Stream stream)
|
||||
}
|
||||
}
|
||||
|
||||
void CompoundFile_impl::Save(std::wstring wFileName)
|
||||
{
|
||||
if (isDisposed)
|
||||
throw CFException("Compound File closed: cannot save data");
|
||||
bool CompoundFile_impl::Save(std::wstring wFileName)
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
//throw CFException("Compound File closed: cannot save data");
|
||||
return false;
|
||||
}
|
||||
|
||||
Stream file = OpenFileStream(wFileName, true, true);
|
||||
file->seek(0, std::ios::beg);
|
||||
|
||||
try
|
||||
if (!file) return false;
|
||||
if (file->isError()) return false;
|
||||
|
||||
file->seek(0, std::ios::beg);
|
||||
|
||||
bool result = true;
|
||||
try
|
||||
{
|
||||
Save(file);
|
||||
|
||||
@ -343,7 +351,9 @@ void CompoundFile_impl::Save(std::wstring wFileName)
|
||||
file->close();
|
||||
|
||||
throw CFException("Error saving file [" + fileName + "]", ex);
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ public:
|
||||
|
||||
std::shared_ptr<CFStorage> RootStorage();
|
||||
|
||||
void Save(std::wstring wFileName);
|
||||
bool Save(std::wstring wFileName);
|
||||
void Save(Stream stream);
|
||||
|
||||
void Commit(bool releaseMemory = false);
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
// Main methods
|
||||
std::shared_ptr<CFStorage> RootStorage();
|
||||
|
||||
void Save(std::wstring wFileName);
|
||||
bool Save(std::wstring wFileName);
|
||||
void Save(Stream stream);
|
||||
|
||||
void Commit(bool releaseMemory = false);
|
||||
|
||||
@ -123,6 +123,14 @@ void StreamView::close()
|
||||
if (std::dynamic_pointer_cast<std::iostream>(stream) != nullptr)
|
||||
stream->close();
|
||||
}
|
||||
bool StreamView::isError()
|
||||
{
|
||||
if (std::dynamic_pointer_cast<std::iostream>(stream) == nullptr) return true;
|
||||
if ((std::dynamic_pointer_cast<std::iostream>(stream))->bad()) return true;
|
||||
if ((std::dynamic_pointer_cast<std::iostream>(stream))->fail()) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_INT64 StreamView::read(char *buffer, _INT64 len)
|
||||
{
|
||||
|
||||
@ -46,14 +46,13 @@ public:
|
||||
StreamView(const SVector<Sector> §orChain, _INT32 sectorSize, _INT64 length,
|
||||
SList<Sector> &availableSectors, Stream stream, bool isFatStream = false);
|
||||
|
||||
|
||||
_INT64 tell() override;
|
||||
_INT64 seek(_INT64 offset, std::ios_base::seekdir mode = std::ios::beg) override;
|
||||
_INT64 read(char *buffer, _INT64 count) override;
|
||||
void write(const char *buffer, _INT64 count) override;
|
||||
void flush() override {}
|
||||
void close() override;
|
||||
|
||||
bool isError() override;
|
||||
|
||||
_INT64 getPosition() const;
|
||||
void SetLength(_INT64 value);
|
||||
|
||||
@ -18,14 +18,7 @@ DEFINES += GRAPHICS_USE_DYNAMIC_LIBRARY
|
||||
ADD_DEPENDENCY(graphics, kernel, UnicodeConverter)
|
||||
|
||||
core_windows {
|
||||
DEFINES += \
|
||||
JAS_WIN_MSVC_BUILD \
|
||||
WIN32
|
||||
|
||||
DEFINES -= UNICODE
|
||||
DEFINES -= _DEBUG
|
||||
|
||||
message(windows)
|
||||
|
||||
LIBS += -lAdvapi32
|
||||
LIBS += -lShell32
|
||||
|
||||
@ -1070,6 +1070,8 @@ namespace NSEditorApi
|
||||
js_wrapper<int> m_nInsertPageNum;
|
||||
|
||||
js_wrapper<CAscShadow> m_oShadow;
|
||||
|
||||
js_wrapper<int> m_nVerticalTextAlign;
|
||||
|
||||
public:
|
||||
CAscShapeProp()
|
||||
@ -1094,6 +1096,8 @@ namespace NSEditorApi
|
||||
LINK_PROPERTY_INT_JS(InsertPageNum)
|
||||
|
||||
LINK_PROPERTY_OBJECT_JS(CAscShadow, Shadow)
|
||||
|
||||
LINK_PROPERTY_INT_JS(VerticalTextAlign)
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -414,8 +414,8 @@ int main(int argc, char** argv)
|
||||
NSStringUtils::CStringBuilder oBuilderJS;
|
||||
oBuilderJS.WriteString(L"[");
|
||||
|
||||
#define COUNT_FONTS_SCALE 5
|
||||
double support_scales[COUNT_FONTS_SCALE] = { 1, 1.25, 1.5, 1.75, 2 };
|
||||
#define COUNT_FONTS_SCALE 11
|
||||
double support_scales[COUNT_FONTS_SCALE] = { 1, 1.25, 1.5, 1.75, 2, 2.5, 3, 3.5, 4, 4.5, 5 };
|
||||
|
||||
int nThemeIndex = 0;
|
||||
for (std::vector<std::wstring>::iterator iter = arThemes.begin(); iter != arThemes.end(); iter++)
|
||||
|
||||
@ -1414,6 +1414,12 @@ namespace NSFile
|
||||
close(dst);
|
||||
return (-1 != read_size_marker) ? true : false;
|
||||
#else
|
||||
|
||||
#ifdef _WIN32
|
||||
if (0 != ::CopyFileW(strSrc.c_str(), strDst.c_str(), 1))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
std::ifstream src;
|
||||
std::ofstream dst;
|
||||
|
||||
|
||||
@ -33,9 +33,9 @@
|
||||
#include "File.h"
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <tchar.h>
|
||||
#include <tchar.h>
|
||||
#elif __linux__ || MAC
|
||||
#include <libgen.h>
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
namespace NSSystemPath
|
||||
@ -61,7 +61,7 @@ namespace NSSystemPath
|
||||
sRes = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)pDirName, strlen(pDirName));
|
||||
delete [] pUtf8;
|
||||
#endif
|
||||
return sRes;
|
||||
return sRes;
|
||||
}
|
||||
std::wstring GetFileName(const std::wstring& strFileName)
|
||||
{
|
||||
@ -103,17 +103,19 @@ namespace NSSystemPath
|
||||
sRes = strLeft + strRight.substr(1);
|
||||
}
|
||||
else if(!bLeftSlash && !bRightSlash)
|
||||
sRes = strLeft + L"/" + strRight;
|
||||
sRes = strLeft + L"/" + strRight;
|
||||
else
|
||||
sRes = strLeft + strRight;
|
||||
return sRes;
|
||||
}
|
||||
std::string NormalizePath(const std::string& strFileName)
|
||||
{
|
||||
const char* pData = strFileName.c_str();
|
||||
int nLen = (int) strFileName.length();
|
||||
|
||||
char* pDataNorm = new char[nLen + 1];
|
||||
template<class CHAR, class STRING = std::basic_string<CHAR, std::char_traits<CHAR>, std::allocator<CHAR>>>
|
||||
STRING NormalizePathTemplate(const STRING& strFileName)
|
||||
{
|
||||
const CHAR* pData = strFileName.c_str();
|
||||
int nLen = (int) strFileName.length();
|
||||
|
||||
CHAR* pDataNorm = new CHAR[nLen + 1];
|
||||
int* pSlashPoints = new int[nLen + 1];
|
||||
|
||||
int nStart = 0;
|
||||
@ -122,10 +124,15 @@ namespace NSSystemPath
|
||||
int nCurrentW = 0;
|
||||
bool bIsUp = false;
|
||||
|
||||
#if !defined(_WIN32) && !defined (_WIN64)
|
||||
if (pData[nCurrent] == '/' || pData[nCurrent] == '\\')
|
||||
{
|
||||
#if !defined(_WIN32) && !defined (_WIN64)
|
||||
pDataNorm[nCurrentW++] = pData[nCurrent];
|
||||
#endif
|
||||
#endif
|
||||
++nCurrentSlash;
|
||||
pSlashPoints[nCurrentSlash] = nCurrentW;
|
||||
}
|
||||
|
||||
while (nCurrent < nLen)
|
||||
{
|
||||
if (pData[nCurrent] == '/' || pData[nCurrent] == '\\')
|
||||
@ -135,7 +142,7 @@ namespace NSSystemPath
|
||||
bIsUp = false;
|
||||
if ((nCurrent - nStart) == 2)
|
||||
{
|
||||
if (pData[nStart] == (char)'.' && pData[nStart + 1] == (char)'.')
|
||||
if (pData[nStart] == (CHAR)'.' && pData[nStart + 1] == (CHAR)'.')
|
||||
{
|
||||
if (nCurrentSlash > 0)
|
||||
{
|
||||
@ -147,7 +154,7 @@ namespace NSSystemPath
|
||||
}
|
||||
if (!bIsUp)
|
||||
{
|
||||
pDataNorm[nCurrentW++] = (char)'/';
|
||||
pDataNorm[nCurrentW++] = (CHAR)'/';
|
||||
++nCurrentSlash;
|
||||
pSlashPoints[nCurrentSlash] = nCurrentW;
|
||||
}
|
||||
@ -160,13 +167,22 @@ namespace NSSystemPath
|
||||
++nCurrent;
|
||||
}
|
||||
|
||||
pDataNorm[nCurrentW] = (char)'\0';
|
||||
pDataNorm[nCurrentW] = (CHAR)'\0';
|
||||
|
||||
std::string result = std::string(pDataNorm, nCurrentW);
|
||||
STRING result = STRING(pDataNorm, nCurrentW);
|
||||
|
||||
delete[] pDataNorm;
|
||||
delete[] pSlashPoints;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string NormalizePath(const std::string& strFileName)
|
||||
{
|
||||
return NormalizePathTemplate<char>(strFileName);
|
||||
}
|
||||
std::wstring NormalizePath(const std::wstring& strFileName)
|
||||
{
|
||||
return NormalizePathTemplate<wchar_t>(strFileName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,10 +38,11 @@
|
||||
|
||||
namespace NSSystemPath
|
||||
{
|
||||
KERNEL_DECL std::wstring GetDirectoryName(const std::wstring& strFileName);
|
||||
KERNEL_DECL std::wstring GetFileName(const std::wstring& strFileName);
|
||||
KERNEL_DECL std::wstring Combine(const std::wstring& strLeft, const std::wstring& strRight);
|
||||
KERNEL_DECL std::string NormalizePath(const std::string& strFileName);
|
||||
KERNEL_DECL std::wstring GetDirectoryName(const std::wstring& strFileName);
|
||||
KERNEL_DECL std::wstring GetFileName(const std::wstring& strFileName);
|
||||
KERNEL_DECL std::wstring Combine(const std::wstring& strLeft, const std::wstring& strRight);
|
||||
KERNEL_DECL std::string NormalizePath(const std::string& strFileName);
|
||||
KERNEL_DECL std::wstring NormalizePath(const std::wstring& strFileName);
|
||||
}
|
||||
|
||||
#endif //_BUILD_PATH_CROSSPLATFORM_H_
|
||||
|
||||
@ -35,12 +35,23 @@
|
||||
#include <string>
|
||||
#include "../../Common/kernel_config.h"
|
||||
|
||||
#define VALUE_STRINGIFY(d) L##d
|
||||
#define VALUE_TO_STR(v) VALUE_STRINGIFY(v)
|
||||
|
||||
namespace NSSystemUtils
|
||||
{
|
||||
static const wchar_t* gc_EnvApplicationName = L"APPLICATION_NAME";
|
||||
#ifndef APPLICATION_NAME_DEFAULT
|
||||
static const wchar_t* gc_EnvApplicationNameDefault = L"ONLYOFFICE";
|
||||
#else
|
||||
static const wchar_t* gc_EnvApplicationNameDefault = VALUE_TO_STR(APPLICATION_NAME_DEFAULT);
|
||||
#endif
|
||||
static const wchar_t* gc_EnvCompanyName = L"COMPANY_NAME";
|
||||
#ifndef COMPANY_NAME_DEFAULT
|
||||
static const wchar_t* gc_EnvCompanyNameDefault = L"Ascensio System SIA Copyright (c) 2022";
|
||||
#else
|
||||
static const wchar_t* gc_EnvCompanyNameDefault = VALUE_TO_STR(COMPANY_NAME_DEFAULT);
|
||||
#endif
|
||||
static const wchar_t* gc_EnvMethodEncrypt = L"METHOD_CRYPT";
|
||||
static const wchar_t* gc_EnvMethodEncryptDefault = L"Strong";
|
||||
static const wchar_t* gc_EnvCreator = L"CREATOR";
|
||||
|
||||
@ -155,7 +155,7 @@ _TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c)
|
||||
return (memcmp(p1, p2, (size_t) c));
|
||||
}
|
||||
|
||||
#ifndef _IOS
|
||||
#if !defined(_IOS) && !defined(DISABLE_IMAGE_EXCEPTIONS)
|
||||
static void
|
||||
Win32WarningHandler(const char* module, const char* fmt, va_list ap)
|
||||
{
|
||||
|
||||
@ -5,18 +5,6 @@ TARGET = docbuilder
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
PRODUCT_VERSION=$$(PRODUCT_VERSION)
|
||||
BUILD_NUMBER=$$(BUILD_NUMBER)
|
||||
|
||||
isEmpty(PRODUCT_VERSION) {
|
||||
BINARYVERSION = 0.0.0.0
|
||||
}
|
||||
else {
|
||||
BINARYVERSION = $$(PRODUCT_VERSION).$$(BUILD_NUMBER)
|
||||
}
|
||||
|
||||
DEFINES += INTVER=$$BINARYVERSION
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../../core
|
||||
|
||||
@ -50,32 +50,32 @@ void parse_args(NSDoctRenderer::CDocBuilder* builder, int argc, wchar_t *argv[])
|
||||
void parse_args(NSDoctRenderer::CDocBuilder* builder, int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
#ifdef WIN32
|
||||
std::wstring sW(argv[i]);
|
||||
std::string sParam = U_TO_UTF8(sW);
|
||||
std::wstring sW(argv[i]);
|
||||
std::string sParam = U_TO_UTF8(sW);
|
||||
#else
|
||||
std::string sParam(argv[i]);
|
||||
std::string sParam(argv[i]);
|
||||
#endif
|
||||
|
||||
if (sParam.find("--") == 0)
|
||||
{
|
||||
std::string::size_type _pos = sParam.find('=');
|
||||
if (std::string::npos == _pos)
|
||||
builder->SetProperty(sParam.c_str(), L"");
|
||||
else
|
||||
{
|
||||
std::string sName = sParam.substr(0, _pos);
|
||||
std::string sValue = sParam.substr(_pos + 1);
|
||||
if (sParam.find("--") == 0)
|
||||
{
|
||||
std::string::size_type _pos = sParam.find('=');
|
||||
if (std::string::npos == _pos)
|
||||
builder->SetProperty(sParam.c_str(), L"");
|
||||
else
|
||||
{
|
||||
std::string sName = sParam.substr(0, _pos);
|
||||
std::string sValue = sParam.substr(_pos + 1);
|
||||
|
||||
std::wstring sValueW = UTF8_TO_U(sValue);
|
||||
builder->SetProperty(sName.c_str(), sValueW.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
std::wstring sValueW = UTF8_TO_U(sValue);
|
||||
builder->SetProperty(sName.c_str(), sValueW.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
@ -84,102 +84,84 @@ int wmain(int argc, wchar_t *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
if (argc <= 0)
|
||||
return 0;
|
||||
if (argc <= 0)
|
||||
return 0;
|
||||
|
||||
bool bIsHelp = false;
|
||||
bool bIsFonts = false;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
bool bIsHelp = false;
|
||||
bool bIsFonts = false;
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
#ifdef WIN32
|
||||
std::wstring sW(argv[i]);
|
||||
std::string sParam(sW.begin(), sW.end());
|
||||
std::wstring sW(argv[i]);
|
||||
std::string sParam(sW.begin(), sW.end());
|
||||
#else
|
||||
std::string sParam(argv[i]);
|
||||
std::string sParam(argv[i]);
|
||||
#endif
|
||||
if (sParam == "-v" || sParam == "-version")
|
||||
{
|
||||
std::cout << "v" VALUE(INTVER) << std::endl;
|
||||
NSDoctRenderer::CDocBuilder oBuilder;
|
||||
oBuilder.ExecuteCommand(L"checkL");
|
||||
if (sParam == "-v" || sParam == "-version")
|
||||
{
|
||||
std::cout << "v" VALUE(INTVER) << std::endl;
|
||||
NSDoctRenderer::CDocBuilder oBuilder;
|
||||
oBuilder.ExecuteCommand(L"checkL");
|
||||
|
||||
char* sSdkVer = oBuilder.GetVersion();
|
||||
if (NULL != sSdkVer)
|
||||
{
|
||||
std::string sSdkVerStd(sSdkVer);
|
||||
std::cout << "sdk version: " << sSdkVerStd << std::endl;
|
||||
delete [] sSdkVer;
|
||||
}
|
||||
char* sSdkVer = oBuilder.GetVersion();
|
||||
if (NULL != sSdkVer)
|
||||
{
|
||||
std::string sSdkVerStd(sSdkVer);
|
||||
std::cout << "sdk version: " << sSdkVerStd << std::endl;
|
||||
delete [] sSdkVer;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (sParam == "-h" || sParam == "-help")
|
||||
{
|
||||
bIsHelp = true;
|
||||
}
|
||||
else if (sParam == "-f" || sParam == "-fonts")
|
||||
{
|
||||
bIsFonts = true;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (sParam == "-h" || sParam == "-help")
|
||||
{
|
||||
bIsHelp = true;
|
||||
}
|
||||
else if (sParam == "-f" || sParam == "-fonts")
|
||||
{
|
||||
bIsFonts = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsFonts)
|
||||
{
|
||||
NSDoctRenderer::CDocBuilder oBuilder;
|
||||
parse_args(&oBuilder, argc, argv);
|
||||
if (bIsFonts)
|
||||
{
|
||||
NSDoctRenderer::CDocBuilder oBuilder;
|
||||
parse_args(&oBuilder, argc, argv);
|
||||
|
||||
oBuilder.ExecuteCommand(L"checkL");
|
||||
return 0;
|
||||
}
|
||||
oBuilder.ExecuteCommand(L"checkL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc < 2 || bIsHelp)
|
||||
{
|
||||
std::cout << "USAGE: documentbuilder \"path_to_script_file\"" << std::endl;
|
||||
NSDoctRenderer::CDocBuilder oBuilder;
|
||||
oBuilder.ExecuteCommand(L"checkL");
|
||||
return 0;
|
||||
}
|
||||
if (argc < 2 || bIsHelp)
|
||||
{
|
||||
std::cout << "USAGE: documentbuilder \"path_to_script_file\"" << std::endl;
|
||||
NSDoctRenderer::CDocBuilder oBuilder;
|
||||
oBuilder.ExecuteCommand(L"checkL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
std::wstring sBuildFile(argv[argc - 1]);
|
||||
std::wstring sBuildFile(argv[argc - 1]);
|
||||
#else
|
||||
std::string sBuildFileA(argv[argc - 1]);
|
||||
std::wstring sBuildFile = UTF8_TO_U(sBuildFileA);
|
||||
std::string sBuildFileA(argv[argc - 1]);
|
||||
std::wstring sBuildFile = UTF8_TO_U(sBuildFileA);
|
||||
#endif
|
||||
|
||||
if (true)
|
||||
{
|
||||
NSDoctRenderer::CDocBuilder::Initialize(L"/home/mihail/main/build_tools/out/linux_64/onlyoffice/documentbuilder");
|
||||
NSDoctRenderer::CDocBuilder oBuilder;
|
||||
if (true)
|
||||
{
|
||||
NSDoctRenderer::CDocBuilder oBuilder;
|
||||
|
||||
// если отключена эта опция - то она отключится на parse_args
|
||||
// если отключена эта опция - то она отключится на parse_args
|
||||
oBuilder.SetProperty("--check-fonts", L"");
|
||||
oBuilder.SetProperty("--cache-scripts", L"false");
|
||||
oBuilder.SetTmpFolder(L"tmp");
|
||||
|
||||
//oBuilder.SetProperty("--use-doctrenderer-scheme", L"");
|
||||
//oBuilder.SetProperty("--work-directory", L"builder");
|
||||
|
||||
parse_args(&oBuilder, argc - 1, argv);
|
||||
parse_args(&oBuilder, argc - 1, argv);
|
||||
|
||||
// oBuilder.WriteData(L"result.log", L"Alert!", false);
|
||||
|
||||
// формируем документ SampleTetxt2.docx - с одним вырезанным из SampleDocument.docx абзаца
|
||||
oBuilder.Run(sBuildFile.c_str());
|
||||
// включаем вторую схему сохранения
|
||||
oBuilder.SetProperty("--use-doctrenderer-scheme", L"");
|
||||
// перекрашиваем абзац в красный цвет
|
||||
oBuilder.Run(L"/home/mihail/script2.docbuilder");
|
||||
// oBuilder.OpenFile(L"SampleText2.docx", L"");
|
||||
// oBuilder.ExecuteCommand(L"var oParagraph = Api.GetDocument().GetElement(1);\n"
|
||||
// L"oParagraph.SetColor(255, 0, 0);\n"
|
||||
// L"\n");
|
||||
// // сохраняем
|
||||
// oBuilder.SaveFile(OFFICESTUDIO_FILE_DOCUMENT_DOCX, L"SampleText2.docx");
|
||||
// oBuilder.CloseFile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NSDoctRenderer::CDocBuilder::Dispose();
|
||||
return 0;
|
||||
NSDoctRenderer::CDocBuilder::Dispose();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
#ifndef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#define VER_FILEVERSION 1,0,0,2
|
||||
#define VER_FILEVERSION_STR "1.0.0.2\0"
|
||||
#define VER_STRINGIFY(d) #d
|
||||
#define TO_STR(v) VER_STRINGIFY(v)
|
||||
|
||||
#define VER_FILEVERSION WIN_INTVER
|
||||
#define VER_FILEVERSION_STR TO_STR(WIN_INTVER)"\0"
|
||||
|
||||
#define VER_PRODUCTVERSION VER_FILEVERSION
|
||||
#define VER_PRODUCTVERSION_STR "1.0\0"
|
||||
|
||||
#define VER_COMPANYNAME_STR "Ascensio System SIA\0"
|
||||
#define VER_LEGALCOPYRIGHT_STR "Ascensio System SIA 2016\0"
|
||||
#define VER_LEGALCOPYRIGHT_STR "Ascensio System SIA " TO_STR(COPYRIGHT_YEAR) "\0"
|
||||
#define VER_COMPANYDOMAIN_STR "www.onlyoffice.com\0"
|
||||
#define ABOUT_COPYRIGHT_STR VER_LEGALCOPYRIGHT_STR
|
||||
|
||||
|
||||
@ -60,11 +60,11 @@ BEGIN
|
||||
BEGIN
|
||||
BLOCK "040904e4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Ascensio System SIA 2022"
|
||||
VALUE "CompanyName", "Ascensio System SIA 2023"
|
||||
VALUE "FileDescription", "ONLYOFFICE docbuilder ActiveX DLL"
|
||||
VALUE "FileVersion", "1.0.0.1"
|
||||
VALUE "InternalName", "docbuilder.com.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) Ascensio System SIA 2022. All rights reserved."
|
||||
VALUE "LegalCopyright", "Copyright (C) Ascensio System SIA 2023. All rights reserved."
|
||||
VALUE "OriginalFilename", "docbuilder.com.dll"
|
||||
VALUE "ProductName", "docbuilder.com"
|
||||
VALUE "ProductVersion", "1.0.0.1"
|
||||
|
||||
@ -71,7 +71,7 @@ BEGIN
|
||||
VALUE "FileDescription", "Document Builder .NET"
|
||||
VALUE "FileVersion", "1.0.0.1"
|
||||
VALUE "InternalName", "docbuilder.net"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2023"
|
||||
VALUE "LegalCopyright", "Copyright (C) Ascensio System SIA 2023. All rights reserved."
|
||||
VALUE "OriginalFilename", "docbuilder.net"
|
||||
VALUE "ProductName", "docbuilder.net"
|
||||
VALUE "ProductVersion", "1.0.0.1"
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{10124551-28B8-4CA0-8FBA-420CF9602CF3}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>doctrendererwrapper</RootNamespace>
|
||||
<ProjectName>docbuilder.net</ProjectName>
|
||||
|
||||
@ -128,6 +128,69 @@ std::wstring CV8RealTimeWorker::GetJSVariable(std::wstring sParam)
|
||||
return L"jsValue(" + sParam + L")";
|
||||
}
|
||||
|
||||
std::string GetCorrectArgument(const std::string& sInput)
|
||||
{
|
||||
if (sInput.empty())
|
||||
return "{}";
|
||||
|
||||
const char* input = sInput.c_str();
|
||||
std::string::size_type len = sInput.length();
|
||||
|
||||
std::string sResult;
|
||||
sResult.reserve(len);
|
||||
|
||||
bool bIsInsideString = false;
|
||||
int nQouteMarkCounter = 0;
|
||||
for (std::string::size_type pos = 0; pos < len; ++pos)
|
||||
{
|
||||
char cur = input[pos];
|
||||
if (bIsInsideString)
|
||||
{
|
||||
if ('\\' == cur)
|
||||
++nQouteMarkCounter;
|
||||
else if ('\"' == cur)
|
||||
{
|
||||
if (nQouteMarkCounter & 1)
|
||||
{
|
||||
// внутренняя кавычка - ничего не делаем
|
||||
}
|
||||
else
|
||||
{
|
||||
bIsInsideString = false;
|
||||
nQouteMarkCounter = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nQouteMarkCounter = 0;
|
||||
}
|
||||
sResult += cur;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (cur)
|
||||
{
|
||||
case '\\':
|
||||
{
|
||||
while (pos < (len - 1) && isalpha(input[pos + 1]))
|
||||
++pos;
|
||||
break;
|
||||
}
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
break;
|
||||
case '\"':
|
||||
bIsInsideString = true;
|
||||
default:
|
||||
sResult += cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sResult;
|
||||
}
|
||||
|
||||
bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstring& path, const std::string& sString, const std::wstring& sCachePath, CV8Params* pParams)
|
||||
{
|
||||
LOGGER_SPEED_START();
|
||||
@ -145,9 +208,8 @@ bool CV8RealTimeWorker::OpenFile(const std::wstring& sBasePath, const std::wstri
|
||||
|
||||
if (true)
|
||||
{
|
||||
std::string sArg = m_sUtf8ArgumentJSON;
|
||||
if (sArg.empty())
|
||||
sArg = "{}";
|
||||
std::string sArg = GetCorrectArgument(m_sUtf8ArgumentJSON);
|
||||
|
||||
NSStringUtils::string_replaceA(sArg, "\\", "\\\\");
|
||||
NSStringUtils::string_replaceA(sArg, "\"", "\\\"");
|
||||
std::string sArgument = "var Argument = JSON.parse(\"" + sArg + "\");";
|
||||
@ -254,8 +316,21 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
|
||||
_formatDst = NSDoctRenderer::DoctRendererFormat::PPTT;
|
||||
else if (type & AVS_OFFICESTUDIO_FILE_SPREADSHEET)
|
||||
_formatDst = NSDoctRenderer::DoctRendererFormat::XLST;
|
||||
else if ((type & AVS_OFFICESTUDIO_FILE_CROSSPLATFORM) || (type & AVS_OFFICESTUDIO_FILE_IMAGE))
|
||||
else if (type & AVS_OFFICESTUDIO_FILE_CROSSPLATFORM)
|
||||
_formatDst = NSDoctRenderer::DoctRendererFormat::PDF;
|
||||
else if (type & AVS_OFFICESTUDIO_FILE_IMAGE)
|
||||
{
|
||||
_formatDst = NSDoctRenderer::DoctRendererFormat::IMAGE;
|
||||
// не поддерживает x2т прямую конвертацию. делаем ***T format
|
||||
switch (m_nFileType)
|
||||
{
|
||||
case 0: { _formatDst = NSDoctRenderer::DoctRendererFormat::DOCT; break; }
|
||||
case 1: { _formatDst = NSDoctRenderer::DoctRendererFormat::PPTT; break; }
|
||||
case 2: { _formatDst = NSDoctRenderer::DoctRendererFormat::XLST; break; }
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CJSContextScope scope(m_context);
|
||||
JSSmart<CJSTryCatch> try_catch = m_context->GetExceptions();
|
||||
@ -280,7 +355,12 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
|
||||
if (pNative == NULL)
|
||||
return false;
|
||||
|
||||
if (_formatDst == NSDoctRenderer::DoctRendererFormat::PDF)
|
||||
bool bIsSilentMode = false;
|
||||
if (_formatDst == NSDoctRenderer::DoctRendererFormat::PDF ||
|
||||
_formatDst == NSDoctRenderer::DoctRendererFormat::IMAGE)
|
||||
bIsSilentMode = true;
|
||||
|
||||
if (bIsSilentMode)
|
||||
this->ExecuteCommand(L"Api.asc_SetSilentMode(false);");
|
||||
|
||||
std::wstring strError;
|
||||
@ -292,7 +372,7 @@ bool CV8RealTimeWorker::SaveFileWithChanges(int type, const std::wstring& _path,
|
||||
strError,
|
||||
sJsonParams);
|
||||
|
||||
if (_formatDst == NSDoctRenderer::DoctRendererFormat::PDF)
|
||||
if (bIsSilentMode)
|
||||
this->ExecuteCommand(L"Api.asc_SetSilentMode(true);");
|
||||
|
||||
return bIsError;
|
||||
@ -1243,6 +1323,15 @@ namespace NSDoctRenderer
|
||||
size_t _len = command.length();
|
||||
|
||||
bool bIsBuilder = false;
|
||||
bool bIsBuilderJSCloseFile = false;
|
||||
while (_len > 0)
|
||||
{
|
||||
if (' ' != *_data && '\t' != *_data)
|
||||
break;
|
||||
++_data;
|
||||
--_len;
|
||||
}
|
||||
|
||||
if (_len > 8)
|
||||
{
|
||||
if (_data[0] == 'b' &&
|
||||
@ -1251,9 +1340,32 @@ namespace NSDoctRenderer
|
||||
_data[3] == 'l' &&
|
||||
_data[4] == 'd' &&
|
||||
_data[5] == 'e' &&
|
||||
_data[6] == 'r' &&
|
||||
_data[7] == '.')
|
||||
bIsBuilder = true;
|
||||
_data[6] == 'r')
|
||||
{
|
||||
if (_data[7] == '.')
|
||||
bIsBuilder = true;
|
||||
else if (_len > 20)
|
||||
{
|
||||
if (_data[7] == 'J' &&
|
||||
_data[8] == 'S' &&
|
||||
_data[9] == '.' &&
|
||||
_data[10] == 'C' &&
|
||||
_data[11] == 'l' &&
|
||||
_data[12] == 'o' &&
|
||||
_data[13] == 's' &&
|
||||
_data[14] == 'e' &&
|
||||
_data[15] == 'F' &&
|
||||
_data[16] == 'i' &&
|
||||
_data[17] == 'l' &&
|
||||
_data[18] == 'e' &&
|
||||
_data[19] == '(' &&
|
||||
_data[20] == ')')
|
||||
{
|
||||
bIsBuilder = true;
|
||||
bIsBuilderJSCloseFile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool bIsNoError = true;
|
||||
@ -1273,6 +1385,9 @@ namespace NSDoctRenderer
|
||||
++_pos;
|
||||
|
||||
std::string sFuncNum(_data + 8, _pos - 8);
|
||||
if (bIsBuilderJSCloseFile)
|
||||
sFuncNum = "CloseFile";
|
||||
|
||||
int nCountParameters = 0;
|
||||
ParceParameters(command, _builder_params, nCountParameters);
|
||||
|
||||
|
||||
@ -94,11 +94,11 @@ namespace NSDoctRenderer
|
||||
else if (L"pdf" == sExt)
|
||||
nFormat = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
|
||||
else if (L"image" == sExt)
|
||||
nFormat = AVS_OFFICESTUDIO_FILE_IMAGE;
|
||||
nFormat = AVS_OFFICESTUDIO_FILE_IMAGE_PNG;
|
||||
else if (L"jpg" == sExt)
|
||||
nFormat = AVS_OFFICESTUDIO_FILE_IMAGE;
|
||||
nFormat = AVS_OFFICESTUDIO_FILE_IMAGE_JPG;
|
||||
else if (L"png" == sExt)
|
||||
nFormat = AVS_OFFICESTUDIO_FILE_IMAGE;
|
||||
nFormat = AVS_OFFICESTUDIO_FILE_IMAGE_PNG;
|
||||
return nFormat;
|
||||
}
|
||||
}
|
||||
@ -452,6 +452,7 @@ namespace NSDoctRenderer
|
||||
std::wstring m_sTmpFolder;
|
||||
std::wstring m_sFileDir;
|
||||
int m_nFileType;
|
||||
bool m_bJavascriptBeforeEditor;
|
||||
|
||||
std::wstring m_sX2tPath;
|
||||
|
||||
@ -476,7 +477,7 @@ namespace NSDoctRenderer
|
||||
public:
|
||||
CDocBuilder_Private() : CDoctRendererConfig(), m_sTmpFolder(NSFile::CFileBinary::GetTempPath()), m_nFileType(-1),
|
||||
m_pWorker(NULL), m_pAdditionalData(NULL), m_bIsInit(false), m_bIsCacheScript(true), m_bIsServerSafeVersion(false),
|
||||
m_sGlobalVariable(""), m_bIsGlobalVariableUse(false), m_pParent(NULL)
|
||||
m_sGlobalVariable(""), m_bIsGlobalVariableUse(false), m_pParent(NULL), m_bJavascriptBeforeEditor(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -624,6 +625,9 @@ namespace NSDoctRenderer
|
||||
NSDirectory::CreateDirectory(m_sFileDir + L"/changes");
|
||||
}
|
||||
|
||||
if (m_bJavascriptBeforeEditor)
|
||||
CheckWorkerAfterOpen();
|
||||
|
||||
return bRet;
|
||||
#else
|
||||
std::wstring sPath = m_sX2tPath + L"/empty/new.";
|
||||
@ -912,7 +916,11 @@ namespace NSDoctRenderer
|
||||
LOGGER_SPEED_LAP("open_convert");
|
||||
|
||||
if (0 == nReturnCode)
|
||||
{
|
||||
if (m_bJavascriptBeforeEditor)
|
||||
CheckWorkerAfterOpen();
|
||||
return 0;
|
||||
}
|
||||
|
||||
NSDirectory::DeleteDirectory(m_sFileDir);
|
||||
m_sFileDir = L"";
|
||||
@ -923,7 +931,7 @@ namespace NSDoctRenderer
|
||||
return nReturnCode;
|
||||
}
|
||||
|
||||
void CloseFile()
|
||||
void CloseFile(bool bIsDestroyJS = true)
|
||||
{
|
||||
Init();
|
||||
|
||||
@ -935,7 +943,9 @@ namespace NSDoctRenderer
|
||||
|
||||
if (m_pWorker)
|
||||
m_sGlobalVariable = m_pWorker->GetGlobalVariable();
|
||||
RELEASEOBJECT(m_pWorker);
|
||||
|
||||
if (bIsDestroyJS)
|
||||
RELEASEOBJECT(m_pWorker);
|
||||
}
|
||||
|
||||
std::wstring GetSaveFilePath(const std::wstring& path)
|
||||
@ -989,6 +999,9 @@ namespace NSDoctRenderer
|
||||
{
|
||||
sJsonParams = sJsonParams.substr(pos1 + 1, pos2 - pos1 - 1);
|
||||
NSStringUtils::string_replace(sJsonParams, L""", L"\"");
|
||||
|
||||
if (0 != sJsonParams.find(L"{"))
|
||||
sJsonParams = L"";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1196,34 +1209,41 @@ namespace NSDoctRenderer
|
||||
|
||||
bool CheckWorker()
|
||||
{
|
||||
if (-1 == m_nFileType)
|
||||
{
|
||||
CV8RealTimeWorker::_LOGGING_ERROR_(L"error (command)", L"file not opened!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NULL == m_pWorker)
|
||||
{
|
||||
m_pWorker = new CV8RealTimeWorker(m_pParent);
|
||||
m_pWorker->m_nFileType = m_nFileType;
|
||||
m_pWorker->m_sUtf8ArgumentJSON = m_oParams.m_sArgumentJSON;
|
||||
m_pWorker->m_sGlobalVariable = m_sGlobalVariable;
|
||||
|
||||
std::wstring sCachePath = L"";
|
||||
if (m_bIsCacheScript)
|
||||
sCachePath = GetScriptCache();
|
||||
|
||||
CV8Params oParams;
|
||||
oParams.IsServerSaveVersion = m_bIsServerSafeVersion;
|
||||
oParams.DocumentDirectory = m_sFileDir;
|
||||
|
||||
bool bOpen = m_pWorker->OpenFile(m_sX2tPath, m_sFileDir, GetScript(), sCachePath, &oParams);
|
||||
if (!bOpen)
|
||||
return false;
|
||||
return CheckWorkerAfterOpen();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckWorkerAfterOpen()
|
||||
{
|
||||
if (!m_pWorker)
|
||||
return false;
|
||||
|
||||
m_pWorker->m_nFileType = m_nFileType;
|
||||
if (-1 == m_nFileType)
|
||||
{
|
||||
m_bJavascriptBeforeEditor = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_bJavascriptBeforeEditor = false;
|
||||
std::wstring sCachePath = L"";
|
||||
if (m_bIsCacheScript)
|
||||
sCachePath = GetScriptCache();
|
||||
|
||||
CV8Params oParams;
|
||||
oParams.IsServerSaveVersion = m_bIsServerSafeVersion;
|
||||
oParams.DocumentDirectory = m_sFileDir;
|
||||
|
||||
return m_pWorker->OpenFile(m_sX2tPath, m_sFileDir, GetScript(), sCachePath, &oParams);
|
||||
}
|
||||
|
||||
int SaveFile(const std::wstring& ext, const std::wstring& path, const wchar_t* params = NULL)
|
||||
{
|
||||
int nType = -1;
|
||||
@ -1270,9 +1290,7 @@ namespace NSDoctRenderer
|
||||
|
||||
Init();
|
||||
|
||||
if (!CheckWorker())
|
||||
return false;
|
||||
|
||||
CheckWorker();
|
||||
return m_pWorker->ExecuteCommand(command, retValue);
|
||||
}
|
||||
|
||||
@ -1280,8 +1298,7 @@ namespace NSDoctRenderer
|
||||
{
|
||||
CDocBuilderContext ctx;
|
||||
|
||||
if (!CheckWorker())
|
||||
return ctx;
|
||||
CheckWorker();
|
||||
|
||||
ctx.m_internal->m_context = m_pWorker->m_context;
|
||||
ctx.m_internal->m_context_data = &m_pWorker->m_oContextData;
|
||||
|
||||
@ -391,6 +391,7 @@ namespace NSDoctRenderer
|
||||
}
|
||||
case DoctRendererFormat::PDF:
|
||||
case DoctRendererFormat::PPTX_THEME_THUMBNAIL:
|
||||
case DoctRendererFormat::IMAGE:
|
||||
{
|
||||
// CALCULATE
|
||||
if (pParams->m_sJsonParams.empty())
|
||||
@ -423,14 +424,28 @@ namespace NSDoctRenderer
|
||||
}
|
||||
|
||||
// RENDER
|
||||
if (!bIsBreak && DoctRendererFormat::PDF == pParams->m_eDstFormat)
|
||||
if (!bIsBreak &&
|
||||
(DoctRendererFormat::PDF == pParams->m_eDstFormat || DoctRendererFormat::IMAGE == pParams->m_eDstFormat))
|
||||
{
|
||||
if (pParams->m_sJsonParams.empty())
|
||||
args[0] = CJSContext::createNull();
|
||||
{
|
||||
if (DoctRendererFormat::IMAGE == pParams->m_eDstFormat)
|
||||
{
|
||||
args[0] = context->JSON_Parse("{ \"saveFormat\" : \"image\" }");
|
||||
}
|
||||
else
|
||||
args[0] = CJSContext::createNull();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string sTmp = U_TO_UTF8((pParams->m_sJsonParams));
|
||||
args[0] = context->JSON_Parse(sTmp.c_str());
|
||||
|
||||
if (DoctRendererFormat::IMAGE == pParams->m_eDstFormat)
|
||||
{
|
||||
JSSmart<CJSObject> argObj = args[0]->toObject();
|
||||
argObj->set("saveFormat", CJSContext::createString("image"));
|
||||
}
|
||||
}
|
||||
|
||||
JSSmart<CJSValue> js_result2 = js_objectApi->call_func("asc_nativeGetPDF", 1, args);
|
||||
@ -886,6 +901,7 @@ namespace NSDoctRenderer
|
||||
{
|
||||
case DoctRendererFormat::DOCT:
|
||||
case DoctRendererFormat::PDF:
|
||||
case DoctRendererFormat::IMAGE:
|
||||
case DoctRendererFormat::HTML:
|
||||
{
|
||||
arSdkFiles = &m_pInternal->m_arDoctSDK;
|
||||
@ -903,6 +919,7 @@ namespace NSDoctRenderer
|
||||
{
|
||||
case DoctRendererFormat::PPTT:
|
||||
case DoctRendererFormat::PDF:
|
||||
case DoctRendererFormat::IMAGE:
|
||||
case DoctRendererFormat::PPTX_THEME_THUMBNAIL:
|
||||
{
|
||||
arSdkFiles = &m_pInternal->m_arPpttSDK;
|
||||
@ -920,6 +937,7 @@ namespace NSDoctRenderer
|
||||
{
|
||||
case DoctRendererFormat::XLST:
|
||||
case DoctRendererFormat::PDF:
|
||||
case DoctRendererFormat::IMAGE:
|
||||
{
|
||||
arSdkFiles = &m_pInternal->m_arXlstSDK;
|
||||
m_pInternal->m_strEditorType = L"spreadsheet";
|
||||
|
||||
@ -48,6 +48,7 @@ namespace NSDoctRenderer
|
||||
PDF = 3,
|
||||
HTML = 4,
|
||||
PPTX_THEME_THUMBNAIL = 5,
|
||||
IMAGE = 6,
|
||||
|
||||
INVALID = 255
|
||||
};
|
||||
|
||||
@ -42,7 +42,8 @@ JSSmart<CJSValue> CBuilderEmbed::builder_SaveFile(JSSmart<CJSValue> type, JSSmar
|
||||
}
|
||||
JSSmart<CJSValue> CBuilderEmbed::builder_CloseFile()
|
||||
{
|
||||
m_pBuilder->CloseFile();
|
||||
std::cout << "Warning: use builderJS.CloseFile(); separately!";
|
||||
m_pBuilder->GetPrivate()->CloseFile(false);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <stdlib.h>
|
||||
|
||||
int CHash::getDigestLength(HashAlgs alg)
|
||||
{
|
||||
|
||||
@ -23,8 +23,6 @@ SOURCES += $$PWD/js_logger.cpp
|
||||
linux_arm64:CONFIG += disable_v8_use_inspector
|
||||
build_xp::CONFIG += disable_v8_use_inspector
|
||||
|
||||
core_android:CONFIG += v8_version_60
|
||||
|
||||
!disable_v8_use_inspector:CONFIG += v8_use_inspector
|
||||
|
||||
!build_xp {
|
||||
|
||||
@ -642,6 +642,17 @@ namespace NSJSBase
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef V8_VERSION_89_PLUS
|
||||
#define V8_ARRAY_BUFFER_USE_BACKING_STORE
|
||||
#endif
|
||||
|
||||
#ifdef V8_ARRAY_BUFFER_USE_BACKING_STORE
|
||||
static void V8AllocatorDeleter(void* data, size_t length, void*)
|
||||
{
|
||||
NSAllocator::Free((unsigned char*)data, length);
|
||||
}
|
||||
#endif
|
||||
|
||||
class CJSTypedArrayV8 : public CJSValueV8Template<v8::Uint8Array, CJSTypedArray>
|
||||
{
|
||||
public:
|
||||
@ -649,9 +660,18 @@ namespace NSJSBase
|
||||
{
|
||||
if (0 < count)
|
||||
{
|
||||
#ifdef V8_ARRAY_BUFFER_USE_BACKING_STORE
|
||||
std::shared_ptr<v8::BackingStore> backing_store =
|
||||
v8::ArrayBuffer::NewBackingStore((void*)data, (size_t)count,
|
||||
isExternalize ? v8::BackingStore::EmptyDeleter : V8AllocatorDeleter,
|
||||
nullptr);
|
||||
v8::Local<v8::ArrayBuffer> oArrayBuffer = v8::ArrayBuffer::New(CV8Worker::GetCurrent(), backing_store);
|
||||
value = v8::Uint8Array::New(oArrayBuffer, 0, (size_t)count);
|
||||
#else
|
||||
v8::Local<v8::ArrayBuffer> _buffer = v8::ArrayBuffer::New(CV8Worker::GetCurrent(), (void*)data, (size_t)count,
|
||||
isExternalize ? v8::ArrayBufferCreationMode::kExternalized : v8::ArrayBufferCreationMode::kInternalized);
|
||||
value = v8::Uint8Array::New(_buffer, 0, (size_t)count);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
virtual ~CJSTypedArrayV8()
|
||||
@ -666,10 +686,16 @@ namespace NSJSBase
|
||||
|
||||
virtual CJSDataBuffer getData()
|
||||
{
|
||||
v8::ArrayBuffer::Contents contents = value->Buffer()->GetContents();
|
||||
CJSDataBuffer buffer;
|
||||
#ifdef V8_ARRAY_BUFFER_USE_BACKING_STORE
|
||||
std::shared_ptr<v8::BackingStore> contents = value->Buffer()->GetBackingStore();
|
||||
buffer.Data = (BYTE*)contents->Data();
|
||||
buffer.Len = contents->ByteLength();
|
||||
#else
|
||||
v8::ArrayBuffer::Contents contents = value->Buffer()->GetContents();
|
||||
buffer.Data = (BYTE*)contents.Data();
|
||||
buffer.Len = contents.ByteLength();
|
||||
#endif
|
||||
buffer.IsExternalize = false;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@ -1649,7 +1649,7 @@ static long GetNextNameValue(HKEY key, const std::wstring& sSubkey, std::wstring
|
||||
if (hkey)
|
||||
RegCloseKey(hkey);
|
||||
hkey = NULL;
|
||||
return ERROR_SUCCESS;
|
||||
return ERROR_SUCCESS + 1;
|
||||
}
|
||||
|
||||
// if subkey is specified then open key (first time)
|
||||
@ -1749,6 +1749,10 @@ std::vector<std::wstring> CApplicationFonts::GetSetupFontFiles()
|
||||
}
|
||||
}
|
||||
|
||||
sName = L"";
|
||||
sData = L"";
|
||||
GetNextNameValue(0, L"", sName, sData);
|
||||
|
||||
if (true)
|
||||
{
|
||||
std::vector<std::wstring> oArray2 = NSDirectory::GetFiles(L"C:\\Windows\\Fonts", true);
|
||||
|
||||
@ -37,6 +37,8 @@ var AscFonts = window['AscFonts'];
|
||||
if (window["NATIVE_EDITOR_ENJINE"])
|
||||
window.setImmediate = function(fn) { fn(); };
|
||||
|
||||
var setImmediate = window.setImmediate;
|
||||
|
||||
//desktop_fetch
|
||||
|
||||
//polyfill
|
||||
|
||||
@ -125,222 +125,227 @@ const long c_nHtmlRendrerer3 = 0x0011;
|
||||
const long c_nHtmlRendrererText = 0x0012;
|
||||
const long c_nQRenderer = 0x0013;
|
||||
|
||||
const int c_nAdditionalParamBreak = 0x00;
|
||||
|
||||
// типы команд
|
||||
const long c_nCommandLongTypeOnlyText = 0x1000;
|
||||
|
||||
class IFormField
|
||||
{
|
||||
public:
|
||||
IFormField() {}
|
||||
virtual ~IFormField() {}
|
||||
IFormField() {}
|
||||
virtual ~IFormField() {}
|
||||
};
|
||||
|
||||
// IRenderer
|
||||
class IRenderer : public IGrObject
|
||||
{
|
||||
public:
|
||||
bool m_bUseTransformCoordsToIdentity;
|
||||
bool m_bUseTransformCoordsToIdentity;
|
||||
|
||||
public:
|
||||
IRenderer()
|
||||
{
|
||||
m_bUseTransformCoordsToIdentity = false;
|
||||
}
|
||||
IRenderer()
|
||||
{
|
||||
m_bUseTransformCoordsToIdentity = false;
|
||||
}
|
||||
|
||||
public:
|
||||
// тип рендерера-----------------------------------------------------------------------------
|
||||
virtual HRESULT get_Type(LONG* lType) = 0;
|
||||
//-------- Функции для работы со страницей --------------------------------------------------
|
||||
virtual HRESULT NewPage() = 0;
|
||||
virtual HRESULT get_Height(double* dHeight) = 0;
|
||||
virtual HRESULT put_Height(const double& dHeight) = 0;
|
||||
virtual HRESULT get_Width(double* dWidth) = 0;
|
||||
virtual HRESULT put_Width(const double& dWidth) = 0;
|
||||
virtual HRESULT get_DpiX(double* dDpiX) = 0;
|
||||
virtual HRESULT get_DpiY(double* dDpiY) = 0;
|
||||
// тип рендерера-----------------------------------------------------------------------------
|
||||
virtual HRESULT get_Type(LONG* lType) = 0;
|
||||
//-------- Функции для работы со страницей --------------------------------------------------
|
||||
virtual HRESULT NewPage() = 0;
|
||||
virtual HRESULT get_Height(double* dHeight) = 0;
|
||||
virtual HRESULT put_Height(const double& dHeight) = 0;
|
||||
virtual HRESULT get_Width(double* dWidth) = 0;
|
||||
virtual HRESULT put_Width(const double& dWidth) = 0;
|
||||
virtual HRESULT get_DpiX(double* dDpiX) = 0;
|
||||
virtual HRESULT get_DpiY(double* dDpiY) = 0;
|
||||
|
||||
// pen --------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_PenColor(LONG* lColor) = 0;
|
||||
virtual HRESULT put_PenColor(const LONG& lColor) = 0;
|
||||
virtual HRESULT get_PenAlpha(LONG* lAlpha) = 0;
|
||||
virtual HRESULT put_PenAlpha(const LONG& lAlpha) = 0;
|
||||
virtual HRESULT get_PenSize(double* dSize) = 0;
|
||||
virtual HRESULT put_PenSize(const double& dSize) = 0;
|
||||
virtual HRESULT get_PenDashStyle(BYTE* val) = 0;
|
||||
virtual HRESULT put_PenDashStyle(const BYTE& val) = 0;
|
||||
virtual HRESULT get_PenLineStartCap(BYTE* val) = 0;
|
||||
virtual HRESULT put_PenLineStartCap(const BYTE& val) = 0;
|
||||
virtual HRESULT get_PenLineEndCap(BYTE* val) = 0;
|
||||
virtual HRESULT put_PenLineEndCap(const BYTE& val) = 0;
|
||||
virtual HRESULT get_PenLineJoin(BYTE* val) = 0;
|
||||
virtual HRESULT put_PenLineJoin(const BYTE& val) = 0;
|
||||
virtual HRESULT get_PenDashOffset(double* dOffset) = 0;
|
||||
virtual HRESULT put_PenDashOffset(const double& dOffset) = 0;
|
||||
virtual HRESULT get_PenAlign(LONG* lAlign) = 0;
|
||||
virtual HRESULT put_PenAlign(const LONG& lAlign) = 0;
|
||||
virtual HRESULT get_PenMiterLimit(double* dOffset) = 0;
|
||||
virtual HRESULT put_PenMiterLimit(const double& dOffset) = 0;
|
||||
virtual HRESULT PenDashPattern(double* pPattern, LONG lCount)= 0;
|
||||
// pen --------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_PenColor(LONG* lColor) = 0;
|
||||
virtual HRESULT put_PenColor(const LONG& lColor) = 0;
|
||||
virtual HRESULT get_PenAlpha(LONG* lAlpha) = 0;
|
||||
virtual HRESULT put_PenAlpha(const LONG& lAlpha) = 0;
|
||||
virtual HRESULT get_PenSize(double* dSize) = 0;
|
||||
virtual HRESULT put_PenSize(const double& dSize) = 0;
|
||||
virtual HRESULT get_PenDashStyle(BYTE* val) = 0;
|
||||
virtual HRESULT put_PenDashStyle(const BYTE& val) = 0;
|
||||
virtual HRESULT get_PenLineStartCap(BYTE* val) = 0;
|
||||
virtual HRESULT put_PenLineStartCap(const BYTE& val) = 0;
|
||||
virtual HRESULT get_PenLineEndCap(BYTE* val) = 0;
|
||||
virtual HRESULT put_PenLineEndCap(const BYTE& val) = 0;
|
||||
virtual HRESULT get_PenLineJoin(BYTE* val) = 0;
|
||||
virtual HRESULT put_PenLineJoin(const BYTE& val) = 0;
|
||||
virtual HRESULT get_PenDashOffset(double* dOffset) = 0;
|
||||
virtual HRESULT put_PenDashOffset(const double& dOffset) = 0;
|
||||
virtual HRESULT get_PenAlign(LONG* lAlign) = 0;
|
||||
virtual HRESULT put_PenAlign(const LONG& lAlign) = 0;
|
||||
virtual HRESULT get_PenMiterLimit(double* dOffset) = 0;
|
||||
virtual HRESULT put_PenMiterLimit(const double& dOffset) = 0;
|
||||
virtual HRESULT PenDashPattern(double* pPattern, LONG lCount) = 0;
|
||||
|
||||
// brush ------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_BrushType(LONG* lType) = 0;
|
||||
virtual HRESULT put_BrushType(const LONG& lType) = 0;
|
||||
virtual HRESULT get_BrushColor1(LONG* lColor) = 0;
|
||||
virtual HRESULT put_BrushColor1(const LONG& lColor) = 0;
|
||||
virtual HRESULT get_BrushAlpha1(LONG* lAlpha) = 0;
|
||||
virtual HRESULT put_BrushAlpha1(const LONG& lAlpha) = 0;
|
||||
virtual HRESULT get_BrushColor2(LONG* lColor) = 0;
|
||||
virtual HRESULT put_BrushColor2(const LONG& lColor) = 0;
|
||||
virtual HRESULT get_BrushAlpha2(LONG* lAlpha) = 0;
|
||||
virtual HRESULT put_BrushAlpha2(const LONG& lAlpha) = 0;
|
||||
virtual HRESULT get_BrushTexturePath(std::wstring* bsPath) = 0;
|
||||
virtual HRESULT put_BrushTexturePath(const std::wstring& bsPath) = 0;
|
||||
virtual HRESULT get_BrushTextureMode(LONG* lMode) = 0;
|
||||
virtual HRESULT put_BrushTextureMode(const LONG& lMode) = 0;
|
||||
virtual HRESULT get_BrushTextureAlpha(LONG* lTxAlpha) = 0;
|
||||
virtual HRESULT put_BrushTextureAlpha(const LONG& lTxAlpha) = 0;
|
||||
virtual HRESULT get_BrushLinearAngle(double* dAngle) = 0;
|
||||
virtual HRESULT put_BrushLinearAngle(const double& dAngle) = 0;
|
||||
virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height) = 0;
|
||||
virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height) = 0;
|
||||
// brush ------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_BrushType(LONG* lType) = 0;
|
||||
virtual HRESULT put_BrushType(const LONG& lType) = 0;
|
||||
virtual HRESULT get_BrushColor1(LONG* lColor) = 0;
|
||||
virtual HRESULT put_BrushColor1(const LONG& lColor) = 0;
|
||||
virtual HRESULT get_BrushAlpha1(LONG* lAlpha) = 0;
|
||||
virtual HRESULT put_BrushAlpha1(const LONG& lAlpha) = 0;
|
||||
virtual HRESULT get_BrushColor2(LONG* lColor) = 0;
|
||||
virtual HRESULT put_BrushColor2(const LONG& lColor) = 0;
|
||||
virtual HRESULT get_BrushAlpha2(LONG* lAlpha) = 0;
|
||||
virtual HRESULT put_BrushAlpha2(const LONG& lAlpha) = 0;
|
||||
virtual HRESULT get_BrushTexturePath(std::wstring* bsPath) = 0;
|
||||
virtual HRESULT put_BrushTexturePath(const std::wstring& bsPath) = 0;
|
||||
virtual HRESULT get_BrushTextureMode(LONG* lMode) = 0;
|
||||
virtual HRESULT put_BrushTextureMode(const LONG& lMode) = 0;
|
||||
virtual HRESULT get_BrushTextureAlpha(LONG* lTxAlpha) = 0;
|
||||
virtual HRESULT put_BrushTextureAlpha(const LONG& lTxAlpha) = 0;
|
||||
virtual HRESULT get_BrushLinearAngle(double* dAngle) = 0;
|
||||
virtual HRESULT put_BrushLinearAngle(const double& dAngle) = 0;
|
||||
virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height) = 0;
|
||||
virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height) = 0;
|
||||
|
||||
virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount) = 0;
|
||||
//virtual void put_BrushGradInfo(const NSStructures::GradientInfo &_ginfo) {};
|
||||
virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount) = 0;
|
||||
//virtual void put_BrushGradInfo(const NSStructures::GradientInfo &_ginfo) {};
|
||||
|
||||
// font -------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_FontName(std::wstring* bsName) = 0;
|
||||
virtual HRESULT put_FontName(const std::wstring& bsName) = 0;
|
||||
virtual HRESULT get_FontPath(std::wstring* bsName) = 0;
|
||||
virtual HRESULT put_FontPath(const std::wstring& bsName) = 0;
|
||||
virtual HRESULT get_FontSize(double* dSize) = 0;
|
||||
virtual HRESULT put_FontSize(const double& dSize) = 0;
|
||||
virtual HRESULT get_FontStyle(LONG* lStyle) = 0;
|
||||
virtual HRESULT put_FontStyle(const LONG& lStyle) = 0;
|
||||
virtual HRESULT get_FontStringGID(INT* bGID) = 0;
|
||||
virtual HRESULT put_FontStringGID(const INT& bGID) = 0;
|
||||
virtual HRESULT get_FontCharSpace(double* dSpace) = 0;
|
||||
virtual HRESULT put_FontCharSpace(const double& dSpace) = 0;
|
||||
virtual HRESULT get_FontFaceIndex(int* lFaceIndex) = 0;
|
||||
virtual HRESULT put_FontFaceIndex(const int& lFaceIndex) = 0;
|
||||
// font -------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_FontName(std::wstring* bsName) = 0;
|
||||
virtual HRESULT put_FontName(const std::wstring& bsName) = 0;
|
||||
virtual HRESULT get_FontPath(std::wstring* bsName) = 0;
|
||||
virtual HRESULT put_FontPath(const std::wstring& bsName) = 0;
|
||||
virtual HRESULT get_FontSize(double* dSize) = 0;
|
||||
virtual HRESULT put_FontSize(const double& dSize) = 0;
|
||||
virtual HRESULT get_FontStyle(LONG* lStyle) = 0;
|
||||
virtual HRESULT put_FontStyle(const LONG& lStyle) = 0;
|
||||
virtual HRESULT get_FontStringGID(INT* bGID) = 0;
|
||||
virtual HRESULT put_FontStringGID(const INT& bGID) = 0;
|
||||
virtual HRESULT get_FontCharSpace(double* dSpace) = 0;
|
||||
virtual HRESULT put_FontCharSpace(const double& dSpace) = 0;
|
||||
virtual HRESULT get_FontFaceIndex(int* lFaceIndex) = 0;
|
||||
virtual HRESULT put_FontFaceIndex(const int& lFaceIndex) = 0;
|
||||
|
||||
//-------- Функции для вывода текста --------------------------------------------------------
|
||||
virtual HRESULT CommandDrawTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT CommandDrawText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
//-------- Функции для вывода текста --------------------------------------------------------
|
||||
virtual HRESULT CommandDrawTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT CommandDrawText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
|
||||
virtual HRESULT CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
|
||||
virtual HRESULT CommandDrawTextCHAR2(unsigned int* codepoints, const unsigned int& codepointscount, const unsigned int& gid, const double& x, const double& y, const double& w, const double& h)
|
||||
{
|
||||
LONG c = (NULL == codepoints) ? 32 : codepoints[0];
|
||||
return CommandDrawTextExCHAR(c, (LONG)gid, x, y, w, h);
|
||||
}
|
||||
virtual HRESULT CommandDrawTextCHAR2(unsigned int* codepoints, const unsigned int& codepointscount, const unsigned int& gid, const double& x, const double& y, const double& w, const double& h)
|
||||
{
|
||||
LONG c = (NULL == codepoints) ? 32 : codepoints[0];
|
||||
return CommandDrawTextExCHAR(c, (LONG)gid, x, y, w, h);
|
||||
}
|
||||
|
||||
//-------- Маркеры для команд ---------------------------------------------------------------
|
||||
virtual HRESULT BeginCommand(const DWORD& lType) = 0;
|
||||
virtual HRESULT EndCommand(const DWORD& lType) = 0;
|
||||
//-------- Маркеры для команд ---------------------------------------------------------------
|
||||
virtual HRESULT BeginCommand(const DWORD& lType) = 0;
|
||||
virtual HRESULT EndCommand(const DWORD& lType) = 0;
|
||||
|
||||
//-------- Функции для работы с Graphics Path -----------------------------------------------
|
||||
virtual HRESULT PathCommandMoveTo(const double& x, const double& y) = 0;
|
||||
virtual HRESULT PathCommandLineTo(const double& x, const double& y) = 0;
|
||||
virtual HRESULT PathCommandLinesTo(double* points, const int& count) = 0;
|
||||
virtual HRESULT PathCommandCurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3) = 0;
|
||||
virtual HRESULT PathCommandCurvesTo(double* points, const int& count) = 0;
|
||||
virtual HRESULT PathCommandArcTo(const double& x, const double& y, const double& w, const double& h, const double& startAngle, const double& sweepAngle) = 0;
|
||||
virtual HRESULT PathCommandClose() = 0;
|
||||
virtual HRESULT PathCommandEnd() = 0;
|
||||
virtual HRESULT DrawPath(const LONG& nType) = 0;
|
||||
virtual HRESULT PathCommandStart() = 0;
|
||||
virtual HRESULT PathCommandGetCurrentPoint(double* x, double* y) = 0;
|
||||
//-------- Функции для работы с Graphics Path -----------------------------------------------
|
||||
virtual HRESULT PathCommandMoveTo(const double& x, const double& y) = 0;
|
||||
virtual HRESULT PathCommandLineTo(const double& x, const double& y) = 0;
|
||||
virtual HRESULT PathCommandLinesTo(double* points, const int& count) = 0;
|
||||
virtual HRESULT PathCommandCurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3) = 0;
|
||||
virtual HRESULT PathCommandCurvesTo(double* points, const int& count) = 0;
|
||||
virtual HRESULT PathCommandArcTo(const double& x, const double& y, const double& w, const double& h, const double& startAngle, const double& sweepAngle) = 0;
|
||||
virtual HRESULT PathCommandClose() = 0;
|
||||
virtual HRESULT PathCommandEnd() = 0;
|
||||
virtual HRESULT DrawPath(const LONG& nType) = 0;
|
||||
virtual HRESULT PathCommandStart() = 0;
|
||||
virtual HRESULT PathCommandGetCurrentPoint(double* x, double* y) = 0;
|
||||
|
||||
virtual HRESULT PathCommandTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT PathCommandText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT PathCommandTextCHAR(const LONG& c, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT PathCommandText(const std::wstring& bsText, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
|
||||
virtual HRESULT PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT PathCommandTextEx(const std::wstring& sText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT PathCommandTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT PathCommandTextEx(const std::wstring& sText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
|
||||
//-------- Функции для вывода изображений ---------------------------------------------------
|
||||
virtual HRESULT DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT DrawImageFromFile(const std::wstring&, const double& x, const double& y, const double& w, const double& h, const BYTE& lAlpha = 255) = 0;
|
||||
//-------- Функции для вывода изображений ---------------------------------------------------
|
||||
virtual HRESULT DrawImage(IGrObject* pImage, const double& x, const double& y, const double& w, const double& h) = 0;
|
||||
virtual HRESULT DrawImageFromFile(const std::wstring&, const double& x, const double& y, const double& w, const double& h, const BYTE& lAlpha = 255) = 0;
|
||||
|
||||
// transform --------------------------------------------------------------------------------
|
||||
virtual HRESULT GetCommandParams(double* dAngle, double* dLeft, double* dTop, double* dWidth, double* dHeight, DWORD* lFlags)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT SetCommandParams(double dAngle, double dLeft, double dTop, double dWidth, double dHeight, DWORD lFlags)
|
||||
{
|
||||
if ((dWidth <= 1) || (dHeight <= 1))
|
||||
lFlags = 0;
|
||||
// transform --------------------------------------------------------------------------------
|
||||
virtual HRESULT GetCommandParams(double* dAngle, double* dLeft, double* dTop, double* dWidth, double* dHeight, DWORD* lFlags)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT SetCommandParams(double dAngle, double dLeft, double dTop, double dWidth, double dHeight, DWORD lFlags)
|
||||
{
|
||||
if ((dWidth <= 1) || (dHeight <= 1))
|
||||
lFlags = 0;
|
||||
|
||||
INT bFlipX = (0 != (c_nParamFlipX & lFlags));
|
||||
INT bFlipY = (0 != (c_nParamFlipY & lFlags));
|
||||
INT bFlipX = (0 != (c_nParamFlipX & lFlags));
|
||||
INT bFlipY = (0 != (c_nParamFlipY & lFlags));
|
||||
|
||||
float m11 = bFlipX ? -1.0f : 1.0f;
|
||||
float m22 = bFlipY ? -1.0f : 1.0f;
|
||||
float m11 = bFlipX ? -1.0f : 1.0f;
|
||||
float m22 = bFlipY ? -1.0f : 1.0f;
|
||||
|
||||
Aggplus::CMatrix oMatrix(1, 0, 0, 1, 0, 0);
|
||||
Aggplus::CMatrix oMatrix(1, 0, 0, 1, 0, 0);
|
||||
|
||||
if ((0 != dAngle) || (0 != lFlags))
|
||||
{
|
||||
double dCentreX = (double)(dLeft + dWidth / 2.0);
|
||||
double dCentreY = (double)(dTop + dHeight / 2.0);
|
||||
if ((0 != dAngle) || (0 != lFlags))
|
||||
{
|
||||
double dCentreX = (double)(dLeft + dWidth / 2.0);
|
||||
double dCentreY = (double)(dTop + dHeight / 2.0);
|
||||
|
||||
oMatrix.Translate(-dCentreX, -dCentreY , Aggplus::MatrixOrderAppend);
|
||||
oMatrix.Translate(-dCentreX, -dCentreY , Aggplus::MatrixOrderAppend);
|
||||
|
||||
oMatrix.Rotate(dAngle , Aggplus::MatrixOrderAppend);
|
||||
oMatrix.Scale(m11, m22 , Aggplus::MatrixOrderAppend);
|
||||
oMatrix.Rotate(dAngle , Aggplus::MatrixOrderAppend);
|
||||
oMatrix.Scale(m11, m22 , Aggplus::MatrixOrderAppend);
|
||||
|
||||
oMatrix.Translate(dCentreX, dCentreY , Aggplus::MatrixOrderAppend);
|
||||
}
|
||||
double mass[6];
|
||||
oMatrix.GetElements(mass);
|
||||
SetTransform(mass[0], mass[1], mass[2], mass[3], mass[4], mass[5]);
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT SetBaseTransform(const double& m1, const double& m2, const double& m3, const double& m4, const double& m5, const double& m6) { return S_OK; }
|
||||
virtual HRESULT SetTransform(const double& m1, const double& m2, const double& m3, const double& m4, const double& m5, const double& m6) = 0;
|
||||
virtual HRESULT GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF) = 0;
|
||||
virtual HRESULT ResetTransform() = 0;
|
||||
oMatrix.Translate(dCentreX, dCentreY , Aggplus::MatrixOrderAppend);
|
||||
}
|
||||
double mass[6];
|
||||
oMatrix.GetElements(mass);
|
||||
SetTransform(mass[0], mass[1], mass[2], mass[3], mass[4], mass[5]);
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT SetBaseTransform(const double& m1, const double& m2, const double& m3, const double& m4, const double& m5, const double& m6) { return S_OK; }
|
||||
virtual HRESULT SetTransform(const double& m1, const double& m2, const double& m3, const double& m4, const double& m5, const double& m6) = 0;
|
||||
virtual HRESULT GetTransform(double *pdA, double *pdB, double *pdC, double *pdD, double *pdE, double *pdF) = 0;
|
||||
virtual HRESULT ResetTransform() = 0;
|
||||
|
||||
// -----------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_ClipMode(LONG* plMode) = 0;
|
||||
virtual HRESULT put_ClipMode(const LONG& lMode) = 0;
|
||||
// -----------------------------------------------------------------------------------------
|
||||
virtual HRESULT get_ClipMode(LONG* plMode) = 0;
|
||||
virtual HRESULT put_ClipMode(const LONG& lMode) = 0;
|
||||
|
||||
// additiaonal params ----------------------------------------------------------------------
|
||||
virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand) = 0;
|
||||
virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand) = 0;
|
||||
virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand) = 0;
|
||||
// additiaonal params ----------------------------------------------------------------------
|
||||
virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand) = 0;
|
||||
virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand) = 0;
|
||||
virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand) = 0;
|
||||
|
||||
virtual HRESULT StartConvertCoordsToIdentity()
|
||||
{
|
||||
m_bUseTransformCoordsToIdentity = true;
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT EndConvertCoordsToIdentity()
|
||||
{
|
||||
m_bUseTransformCoordsToIdentity = false;
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip) {return S_OK;}
|
||||
virtual HRESULT AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage) {return S_OK;}
|
||||
virtual HRESULT AddFormField(IFormField* pField) {return S_OK;}
|
||||
virtual HRESULT DocInfo(const std::wstring& wsTitle, const std::wstring& wsCreator, const std::wstring& wsSubject, const std::wstring& wsKeywords) {return S_OK;}
|
||||
virtual HRESULT StartConvertCoordsToIdentity()
|
||||
{
|
||||
m_bUseTransformCoordsToIdentity = true;
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT EndConvertCoordsToIdentity()
|
||||
{
|
||||
m_bUseTransformCoordsToIdentity = false;
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip) {return S_OK;}
|
||||
virtual HRESULT AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage) {return S_OK;}
|
||||
virtual HRESULT AddFormField(IFormField* pField) {return S_OK;}
|
||||
virtual HRESULT DocInfo(const std::wstring& wsTitle, const std::wstring& wsCreator, const std::wstring& wsSubject, const std::wstring& wsKeywords) {return S_OK;}
|
||||
|
||||
virtual HRESULT IsExistAdditionalParam(const int& type) {return S_FALSE;}
|
||||
virtual HRESULT GetAdditionalParam(const int& type, std::string& result) {return S_FALSE;}
|
||||
};
|
||||
|
||||
#define PROPERTY_RENDERER(NameBase, Name, Type) \
|
||||
STDMETHOD(get_##NameBase##Name)(Type* pVal) \
|
||||
{ \
|
||||
if (NULL == pVal) \
|
||||
return S_FALSE; \
|
||||
*pVal = m_o##NameBase.##Name; \
|
||||
return S_OK; \
|
||||
} \
|
||||
STDMETHOD(put_##NameBase##Name)(Type Val) \
|
||||
{ \
|
||||
m_o##NameBase.##Name = Val; \
|
||||
return S_OK; \
|
||||
}
|
||||
#define PROPERTY_RENDERER(NameBase, Name, Type) \
|
||||
STDMETHOD(get_##NameBase##Name)(Type* pVal) \
|
||||
{ \
|
||||
if (NULL == pVal) \
|
||||
return S_FALSE; \
|
||||
*pVal = m_o##NameBase.##Name; \
|
||||
return S_OK; \
|
||||
} \
|
||||
STDMETHOD(put_##NameBase##Name)(Type Val) \
|
||||
{ \
|
||||
m_o##NameBase.##Name = Val; \
|
||||
return S_OK; \
|
||||
}
|
||||
|
||||
// exapmle:
|
||||
// PROPERTY_RENDERER(Pen, Color, LONG)
|
||||
|
||||
@ -36,257 +36,289 @@
|
||||
|
||||
namespace NSOnlineOfficeBinToPdf
|
||||
{
|
||||
class CMetafileToRenderterRaster_private
|
||||
{
|
||||
public:
|
||||
class CMetafileToRenderterRaster_private
|
||||
{
|
||||
public:
|
||||
NSFonts::IApplicationFonts* appFonts;
|
||||
|
||||
int m_nRasterFormat;
|
||||
int m_nSaveType; // 0 = stretch, 1 = aspect (width == maxsize)
|
||||
bool m_bIsOnlyFirst;
|
||||
std::wstring m_sFileName;
|
||||
int m_nRasterW;
|
||||
int m_nRasterH;
|
||||
int m_nRasterFormat;
|
||||
|
||||
double m_dDpiX;
|
||||
double m_dDpiY;
|
||||
// save_type - combined integer
|
||||
// saveType = save_type & 0x0F
|
||||
// saveFlags = (save_type & 0xF0) >> 1
|
||||
// saveType:
|
||||
// 0 - stretch
|
||||
// 1 - делаем максимально большую картинку с аспектом как у страницы и вписанную в [m_nRasterW x m_nRasterH]
|
||||
// 2 - nRasterW = (int)((pageW * m_internal->m_dDpiX / 25.4) + 0.5);
|
||||
// nRasterH = (int)((pageH * m_internal->m_dDpiY / 25.4) + 0.5);
|
||||
// 3 - special mode for clouds (see code)
|
||||
//
|
||||
// saveFlags & 1: change w/h by orientation
|
||||
int m_nSaveType;
|
||||
bool m_bIsOnlyFirst;
|
||||
std::wstring m_sFileName;
|
||||
int m_nRasterW;
|
||||
int m_nRasterH;
|
||||
|
||||
public:
|
||||
CMetafileToRenderterRaster_private()
|
||||
{
|
||||
appFonts = NULL;
|
||||
double m_dDpiX;
|
||||
double m_dDpiY;
|
||||
|
||||
m_nRasterFormat = 4;
|
||||
m_nSaveType = 2;
|
||||
m_bIsOnlyFirst = true;
|
||||
m_sFileName = L"";
|
||||
public:
|
||||
CMetafileToRenderterRaster_private()
|
||||
{
|
||||
appFonts = NULL;
|
||||
|
||||
m_nRasterW = 100;
|
||||
m_nRasterH = 100;
|
||||
m_nRasterFormat = 4;
|
||||
m_nSaveType = 2;
|
||||
m_bIsOnlyFirst = true;
|
||||
m_sFileName = L"";
|
||||
|
||||
m_dDpiX = 96.0;
|
||||
m_dDpiY = 96.0;
|
||||
}
|
||||
m_nRasterW = 100;
|
||||
m_nRasterH = 100;
|
||||
|
||||
m_dDpiX = 96.0;
|
||||
m_dDpiY = 96.0;
|
||||
}
|
||||
|
||||
~CMetafileToRenderterRaster_private()
|
||||
{
|
||||
}
|
||||
};
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
CMetafileToRenderterRaster::CMetafileToRenderterRaster(IRenderer* pRenderer) : IMetafileToRenderter(pRenderer)
|
||||
{
|
||||
m_internal = new CMetafileToRenderterRaster_private();
|
||||
}
|
||||
CMetafileToRenderterRaster::~CMetafileToRenderterRaster()
|
||||
{
|
||||
RELEASEOBJECT(m_internal);
|
||||
}
|
||||
CMetafileToRenderterRaster::CMetafileToRenderterRaster(IRenderer* pRenderer) : IMetafileToRenderter(pRenderer)
|
||||
{
|
||||
m_internal = new CMetafileToRenderterRaster_private();
|
||||
}
|
||||
CMetafileToRenderterRaster::~CMetafileToRenderterRaster()
|
||||
{
|
||||
RELEASEOBJECT(m_internal);
|
||||
}
|
||||
|
||||
bool CMetafileToRenderterRaster::ConvertBuffer(BYTE* pBuffer, LONG lBufferLen)
|
||||
{
|
||||
std::wstring sMain = m_internal->m_sFileName;
|
||||
std::wstring sExt = L"";
|
||||
if (!m_internal->m_bIsOnlyFirst)
|
||||
{
|
||||
std::wstring::size_type pos = m_internal->m_sFileName.find_last_of('.');
|
||||
if (std::wstring::npos == pos)
|
||||
return false;
|
||||
bool CMetafileToRenderterRaster::ConvertBuffer(BYTE* pBuffer, LONG lBufferLen)
|
||||
{
|
||||
std::wstring sMain = m_internal->m_sFileName;
|
||||
std::wstring sExt = L"";
|
||||
if (!m_internal->m_bIsOnlyFirst)
|
||||
{
|
||||
std::wstring::size_type pos = m_internal->m_sFileName.find_last_of('.');
|
||||
if (std::wstring::npos == pos)
|
||||
return false;
|
||||
|
||||
sMain = m_internal->m_sFileName.substr(0, pos);
|
||||
sExt = m_internal->m_sFileName.substr(pos);
|
||||
}
|
||||
sMain = m_internal->m_sFileName.substr(0, pos);
|
||||
sExt = m_internal->m_sFileName.substr(pos);
|
||||
}
|
||||
|
||||
CMetafilePagesInfo oInfo;
|
||||
oInfo.CheckBuffer(pBuffer, lBufferLen);
|
||||
CMetafilePagesInfo oInfo;
|
||||
oInfo.CheckBuffer(pBuffer, lBufferLen);
|
||||
|
||||
int nPagesCount = oInfo.PagesCount;
|
||||
if (0 == nPagesCount)
|
||||
return false;
|
||||
int nPagesCount = oInfo.PagesCount;
|
||||
if (0 == nPagesCount)
|
||||
return false;
|
||||
|
||||
if (m_internal->m_bIsOnlyFirst)
|
||||
nPagesCount = 1;
|
||||
if (m_internal->m_bIsOnlyFirst)
|
||||
nPagesCount = 1;
|
||||
|
||||
NSFonts::IFontManager* pFontManager = m_internal->appFonts->GenerateFontManager();
|
||||
NSFonts::IFontsCache* pFontsCache = NSFonts::NSFontCache::Create();
|
||||
pFontsCache->SetStreams(m_internal->appFonts->GetStreams());
|
||||
pFontManager->SetOwnerCache(pFontsCache);
|
||||
pFontsCache->SetStreams(m_internal->appFonts->GetStreams());
|
||||
pFontManager->SetOwnerCache(pFontsCache);
|
||||
|
||||
CImageFilesCache* pImagesCache = new CImageFilesCache(m_internal->appFonts);
|
||||
CImageFilesCache* pImagesCache = new CImageFilesCache(m_internal->appFonts);
|
||||
|
||||
for (int nPageIndex = 0; nPageIndex < nPagesCount; ++nPageIndex)
|
||||
{
|
||||
CBgraFrame oFrame;
|
||||
int nRasterW = m_internal->m_nRasterW;
|
||||
int nRasterH = m_internal->m_nRasterH;
|
||||
for (int nPageIndex = 0; nPageIndex < nPagesCount; ++nPageIndex)
|
||||
{
|
||||
CBgraFrame oFrame;
|
||||
int nRasterW = m_internal->m_nRasterW;
|
||||
int nRasterH = m_internal->m_nRasterH;
|
||||
|
||||
int nOffsetX = 0;
|
||||
int nResultW = nRasterW;
|
||||
int nResultH = nRasterH;
|
||||
int nOffsetX = 0;
|
||||
int nResultW = nRasterW;
|
||||
int nResultH = nRasterH;
|
||||
|
||||
if (1 == m_internal->m_nSaveType)
|
||||
{
|
||||
double w = oInfo.arSizes[nPageIndex].width;
|
||||
double h = oInfo.arSizes[nPageIndex].height;
|
||||
int nSaveType = m_internal->m_nSaveType & 0x0F;
|
||||
int nSaveFlags = (m_internal->m_nSaveType & 0xF0) >> 4;
|
||||
|
||||
double dKoef1 = nRasterW / w;
|
||||
double dKoef2 = nRasterH / h;
|
||||
if (dKoef1 > dKoef2)
|
||||
dKoef1 = dKoef2;
|
||||
if (nSaveFlags & 0x01)
|
||||
{
|
||||
// change w/h if needed
|
||||
double w = oInfo.arSizes[nPageIndex].width;
|
||||
double h = oInfo.arSizes[nPageIndex].height;
|
||||
if ((w > h && nResultH > nResultW) || (w < h && nResultW > nResultH))
|
||||
{
|
||||
int nTmp = nResultW;
|
||||
nResultW = nResultH;
|
||||
nResultH = nTmp;
|
||||
|
||||
nRasterW = (int)(w * dKoef1 + 0.5);
|
||||
nRasterH = (int)(h * dKoef1 + 0.5);
|
||||
}
|
||||
else if (2 == m_internal->m_nSaveType)
|
||||
{
|
||||
double w = oInfo.arSizes[nPageIndex].width;
|
||||
double h = oInfo.arSizes[nPageIndex].height;
|
||||
nTmp = nRasterW;
|
||||
nRasterW = nRasterH;
|
||||
nRasterH = nTmp;
|
||||
}
|
||||
}
|
||||
|
||||
nRasterW = (int)((w * m_internal->m_dDpiX / 25.4) + 0.5);
|
||||
nRasterH = (int)((h * m_internal->m_dDpiY / 25.4) + 0.5);
|
||||
}
|
||||
else if (3 == m_internal->m_nSaveType)
|
||||
{
|
||||
double w = oInfo.arSizes[nPageIndex].width;
|
||||
double h = oInfo.arSizes[nPageIndex].height;
|
||||
if (1 == nSaveType)
|
||||
{
|
||||
double w = oInfo.arSizes[nPageIndex].width;
|
||||
double h = oInfo.arSizes[nPageIndex].height;
|
||||
|
||||
double dKoef1 = nRasterW / w;
|
||||
double dKoef2 = nRasterH / h;
|
||||
double dKoef1 = nRasterW / w;
|
||||
double dKoef2 = nRasterH / h;
|
||||
if (dKoef1 > dKoef2)
|
||||
dKoef1 = dKoef2;
|
||||
|
||||
if (dKoef1 > dKoef2)
|
||||
{
|
||||
nRasterH = (int)(dKoef1 * h) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRasterW = (int)(dKoef2 * w) + 1;
|
||||
nOffsetX = (nRasterW - nResultW) >> 1;
|
||||
}
|
||||
}
|
||||
nRasterW = (int)(w * dKoef1 + 0.5);
|
||||
nRasterH = (int)(h * dKoef1 + 0.5);
|
||||
}
|
||||
else if (2 == nSaveType)
|
||||
{
|
||||
double w = oInfo.arSizes[nPageIndex].width;
|
||||
double h = oInfo.arSizes[nPageIndex].height;
|
||||
|
||||
oFrame.put_Width(nRasterW);
|
||||
oFrame.put_Height(nRasterH);
|
||||
oFrame.put_Stride(4 * nRasterW);
|
||||
nRasterW = (int)((w * m_internal->m_dDpiX / 25.4) + 0.5);
|
||||
nRasterH = (int)((h * m_internal->m_dDpiY / 25.4) + 0.5);
|
||||
}
|
||||
else if (3 == nSaveType)
|
||||
{
|
||||
double w = oInfo.arSizes[nPageIndex].width;
|
||||
double h = oInfo.arSizes[nPageIndex].height;
|
||||
|
||||
BYTE* pDataRaster = new BYTE[4 * nRasterW * nRasterH];
|
||||
memset(pDataRaster, 0xFF, 4 * nRasterW * nRasterH);
|
||||
oFrame.put_Data(pDataRaster);
|
||||
double dKoef1 = nRasterW / w;
|
||||
double dKoef2 = nRasterH / h;
|
||||
|
||||
CGraphicsRenderer oRenderer;
|
||||
oRenderer.SetFontManager(pFontManager);
|
||||
oRenderer.SetImageCache(pImagesCache);
|
||||
if (dKoef1 > dKoef2)
|
||||
{
|
||||
nRasterH = (int)(dKoef1 * h) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRasterW = (int)(dKoef2 * w) + 1;
|
||||
nOffsetX = (nRasterW - nResultW) >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
oRenderer.CreateFromBgraFrame(&oFrame);
|
||||
oRenderer.SetTileImageDpi(96.0);
|
||||
oRenderer.SetSwapRGB(false);
|
||||
oFrame.put_Width(nRasterW);
|
||||
oFrame.put_Height(nRasterH);
|
||||
oFrame.put_Stride(4 * nRasterW);
|
||||
|
||||
this->m_pRenderer = &oRenderer;
|
||||
BYTE* pBufferPage = oInfo.arSizes[nPageIndex].data;
|
||||
LONG nLen = lBufferLen - ((LONG)(pBufferPage - pBuffer));
|
||||
NSOnlineOfficeBinToPdf::ConvertBufferToRenderer(pBufferPage, nLen, this);
|
||||
BYTE* pDataRaster = new BYTE[4 * nRasterW * nRasterH];
|
||||
memset(pDataRaster, 0xFF, 4 * nRasterW * nRasterH);
|
||||
oFrame.put_Data(pDataRaster);
|
||||
|
||||
if (3 == m_internal->m_nSaveType)
|
||||
{
|
||||
int nStride = 4 * nResultW;
|
||||
BYTE* pDataResult = new BYTE[nStride * nResultH];
|
||||
CGraphicsRenderer oRenderer;
|
||||
oRenderer.SetFontManager(pFontManager);
|
||||
oRenderer.SetImageCache(pImagesCache);
|
||||
|
||||
if (0 == nOffsetX)
|
||||
{
|
||||
memcpy(pDataResult, pDataRaster, nStride * nResultH);
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE* pDataCopy = pDataRaster + 4 * nOffsetX;
|
||||
BYTE* pDataDst = pDataResult;
|
||||
int nStrideSrc = 4 * nRasterW;
|
||||
for (int i = 0; i < nResultH; ++i)
|
||||
{
|
||||
memcpy(pDataDst, pDataCopy, nStride);
|
||||
pDataCopy += nStrideSrc;
|
||||
pDataDst += nStride;
|
||||
}
|
||||
}
|
||||
oRenderer.CreateFromBgraFrame(&oFrame);
|
||||
oRenderer.SetTileImageDpi(96.0);
|
||||
oRenderer.SetSwapRGB(false);
|
||||
|
||||
oFrame.put_Data(pDataResult);
|
||||
oFrame.put_Width(nResultW);
|
||||
oFrame.put_Height(nResultH);
|
||||
oFrame.put_Stride(nStride);
|
||||
this->m_pRenderer = &oRenderer;
|
||||
BYTE* pBufferPage = oInfo.arSizes[nPageIndex].data;
|
||||
LONG nLen = lBufferLen - ((LONG)(pBufferPage - pBuffer));
|
||||
NSOnlineOfficeBinToPdf::ConvertBufferToRenderer(pBufferPage, nLen, this);
|
||||
|
||||
RELEASEARRAYOBJECTS(pDataRaster);
|
||||
}
|
||||
if (3 == nSaveType)
|
||||
{
|
||||
int nStride = 4 * nResultW;
|
||||
BYTE* pDataResult = new BYTE[nStride * nResultH];
|
||||
|
||||
if (m_internal->m_bIsOnlyFirst)
|
||||
oFrame.SaveFile(sMain + sExt, m_internal->m_nRasterFormat);
|
||||
else
|
||||
oFrame.SaveFile(sMain + std::to_wstring(nPageIndex + 1) + sExt, m_internal->m_nRasterFormat);
|
||||
}
|
||||
if (0 == nOffsetX)
|
||||
{
|
||||
memcpy(pDataResult, pDataRaster, nStride * nResultH);
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE* pDataCopy = pDataRaster + 4 * nOffsetX;
|
||||
BYTE* pDataDst = pDataResult;
|
||||
int nStrideSrc = 4 * nRasterW;
|
||||
for (int i = 0; i < nResultH; ++i)
|
||||
{
|
||||
memcpy(pDataDst, pDataCopy, nStride);
|
||||
pDataCopy += nStrideSrc;
|
||||
pDataDst += nStride;
|
||||
}
|
||||
}
|
||||
|
||||
RELEASEINTERFACE(pFontManager);
|
||||
RELEASEINTERFACE(pImagesCache);
|
||||
oFrame.put_Data(pDataResult);
|
||||
oFrame.put_Width(nResultW);
|
||||
oFrame.put_Height(nResultH);
|
||||
oFrame.put_Stride(nStride);
|
||||
|
||||
return true;
|
||||
}
|
||||
RELEASEARRAYOBJECTS(pDataRaster);
|
||||
}
|
||||
|
||||
std::wstring CMetafileToRenderterRaster::GetFileName()
|
||||
{
|
||||
return m_internal->m_sFileName;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetFileName(const std::wstring& value)
|
||||
{
|
||||
m_internal->m_sFileName = value;
|
||||
}
|
||||
if (m_internal->m_bIsOnlyFirst)
|
||||
oFrame.SaveFile(sMain + sExt, m_internal->m_nRasterFormat);
|
||||
else
|
||||
oFrame.SaveFile(sMain + std::to_wstring(nPageIndex + 1) + sExt, m_internal->m_nRasterFormat);
|
||||
}
|
||||
|
||||
void CMetafileToRenderterRaster::SetApplication(NSFonts::IApplicationFonts* pFonts)
|
||||
{
|
||||
RELEASEINTERFACE(pFontManager);
|
||||
RELEASEINTERFACE(pImagesCache);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::wstring CMetafileToRenderterRaster::GetFileName()
|
||||
{
|
||||
return m_internal->m_sFileName;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetFileName(const std::wstring& value)
|
||||
{
|
||||
m_internal->m_sFileName = value;
|
||||
}
|
||||
|
||||
void CMetafileToRenderterRaster::SetApplication(NSFonts::IApplicationFonts* pFonts)
|
||||
{
|
||||
m_internal->appFonts = pFonts;
|
||||
}
|
||||
}
|
||||
|
||||
int CMetafileToRenderterRaster::GetRasterFormat()
|
||||
{
|
||||
return m_internal->m_nRasterFormat;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetRasterFormat(const int& value)
|
||||
{
|
||||
m_internal->m_nRasterFormat = value;
|
||||
}
|
||||
int CMetafileToRenderterRaster::GetRasterFormat()
|
||||
{
|
||||
return m_internal->m_nRasterFormat;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetRasterFormat(const int& value)
|
||||
{
|
||||
m_internal->m_nRasterFormat = value;
|
||||
}
|
||||
|
||||
int CMetafileToRenderterRaster::GetSaveType()
|
||||
{
|
||||
return m_internal->m_nSaveType;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetSaveType(const int& value)
|
||||
{
|
||||
m_internal->m_nSaveType = value;
|
||||
}
|
||||
int CMetafileToRenderterRaster::GetSaveType()
|
||||
{
|
||||
return m_internal->m_nSaveType;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetSaveType(const int& value)
|
||||
{
|
||||
m_internal->m_nSaveType = value;
|
||||
}
|
||||
|
||||
int CMetafileToRenderterRaster::GetRasterW()
|
||||
{
|
||||
return m_internal->m_nRasterW;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetRasterW(const int& value)
|
||||
{
|
||||
m_internal->m_nRasterW = value;
|
||||
}
|
||||
int CMetafileToRenderterRaster::GetRasterW()
|
||||
{
|
||||
return m_internal->m_nRasterW;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetRasterW(const int& value)
|
||||
{
|
||||
m_internal->m_nRasterW = value;
|
||||
}
|
||||
|
||||
int CMetafileToRenderterRaster::GetRasterH()
|
||||
{
|
||||
return m_internal->m_nRasterH;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetRasterH(const int& value)
|
||||
{
|
||||
m_internal->m_nRasterH = value;
|
||||
}
|
||||
int CMetafileToRenderterRaster::GetRasterH()
|
||||
{
|
||||
return m_internal->m_nRasterH;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetRasterH(const int& value)
|
||||
{
|
||||
m_internal->m_nRasterH = value;
|
||||
}
|
||||
|
||||
bool CMetafileToRenderterRaster::GetIsOnlyFirst()
|
||||
{
|
||||
return m_internal->m_bIsOnlyFirst;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetIsOnlyFirst(const bool& value)
|
||||
{
|
||||
m_internal->m_bIsOnlyFirst = value;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetOutputDpi(const double& dDpiX, const double& dDpiY)
|
||||
{
|
||||
m_internal->m_dDpiX = dDpiX;
|
||||
m_internal->m_dDpiY = dDpiY;
|
||||
}
|
||||
bool CMetafileToRenderterRaster::GetIsOnlyFirst()
|
||||
{
|
||||
return m_internal->m_bIsOnlyFirst;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetIsOnlyFirst(const bool& value)
|
||||
{
|
||||
m_internal->m_bIsOnlyFirst = value;
|
||||
}
|
||||
void CMetafileToRenderterRaster::SetOutputDpi(const double& dDpiX, const double& dDpiY)
|
||||
{
|
||||
m_internal->m_dDpiX = dDpiX;
|
||||
m_internal->m_dDpiY = dDpiY;
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
namespace NSOnlineOfficeBinToPdf
|
||||
{
|
||||
class CMetafilePageInfo
|
||||
class CMetafilePageInfo
|
||||
{
|
||||
public:
|
||||
double width;
|
||||
@ -57,11 +57,11 @@ namespace NSOnlineOfficeBinToPdf
|
||||
}
|
||||
};
|
||||
|
||||
class CMetafilePagesInfo
|
||||
class GRAPHICS_DECL CMetafilePagesInfo
|
||||
{
|
||||
public:
|
||||
int PagesCount;
|
||||
std::vector<CMetafilePageInfo> arSizes;
|
||||
std::vector<CMetafilePageInfo> arSizes;
|
||||
|
||||
public:
|
||||
CMetafilePagesInfo()
|
||||
@ -73,11 +73,11 @@ namespace NSOnlineOfficeBinToPdf
|
||||
inline void AddPage()
|
||||
{
|
||||
++PagesCount;
|
||||
arSizes.push_back(CMetafilePageInfo());
|
||||
arSizes.push_back(CMetafilePageInfo());
|
||||
}
|
||||
|
||||
void CheckBuffer(BYTE* pBuffer, LONG lBufferLen);
|
||||
};
|
||||
void CheckBuffer(BYTE* pBuffer, LONG lBufferLen);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _BUILD_METAFILE_TO_IRENDERER_H_
|
||||
|
||||
@ -2,6 +2,7 @@ LIB_GRAPHICS_PRI_PATH=$$PWD/../..
|
||||
|
||||
DEFINES -= UNICODE
|
||||
DEFINES -= _UNICODE
|
||||
DEFINES += DISABLE_IMAGE_EXCEPTIONS
|
||||
|
||||
DEFINES += \
|
||||
_QT \
|
||||
|
||||
143
DesktopEditor/pluginsmanager/help.h
Normal file
143
DesktopEditor/pluginsmanager/help.h
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
// Commands
|
||||
std::wstring sCmdHelp = L"--h";
|
||||
std::wstring sCmdHelpFull = L"--help";
|
||||
|
||||
std::wstring sCmdPluginsDir = L"--directory";
|
||||
std::wstring sCmdMarketplaceUrl = L"--marketplace";
|
||||
|
||||
std::wstring sCmdPrintInstalled = L"--print-installed";
|
||||
std::wstring sCmdPrintRemoved = L"--print-removed";
|
||||
std::wstring sCmdPrintMarketplace = L"--print-marketplace";
|
||||
std::wstring sCmdPrintBackup = L"--print-backup";
|
||||
|
||||
std::wstring sCmdReset = L"--reset";
|
||||
std::wstring sCmdInstall = L"--install";
|
||||
std::wstring sCmdRestore = L"--restore";
|
||||
std::wstring sCmdUpdate = L"--update";
|
||||
std::wstring sCmdUpdateAll = L"--update-all";
|
||||
std::wstring sCmdAutorename = L"--autorename";
|
||||
std::wstring sCmdRemove = L"--remove";
|
||||
std::wstring sCmdRemoveAll = L"--remove-all";
|
||||
std::wstring sCmdIgnore = L"--ignore";
|
||||
|
||||
// Settings
|
||||
std::wstring sSetRemoved = L"--removed=";
|
||||
|
||||
std::vector<std::wstring> arrCommands {sCmdHelp, sCmdHelpFull, sCmdPluginsDir, sCmdMarketplaceUrl,
|
||||
sCmdPrintInstalled, sCmdPrintRemoved, sCmdPrintMarketplace, sCmdPrintBackup,
|
||||
sCmdReset, sCmdInstall, sCmdRestore, sCmdUpdate, sCmdUpdateAll, sCmdAutorename,
|
||||
sCmdRemove, sCmdRemoveAll, sCmdIgnore};
|
||||
|
||||
bool IsCommandExists(std::wstring sCommand)
|
||||
{
|
||||
return std::find(arrCommands.begin(), arrCommands.end(), sCommand) != arrCommands.end();
|
||||
}
|
||||
|
||||
bool IsNeedSetValue(std::wstring sParam)
|
||||
{
|
||||
return sParam == sCmdPluginsDir ||
|
||||
sParam == sCmdInstall ||
|
||||
sParam == sCmdRestore ||
|
||||
sParam == sCmdUpdate ||
|
||||
sParam == sCmdRemove ||
|
||||
sParam == sCmdIgnore;
|
||||
}
|
||||
|
||||
std::wstring sHelpText =
|
||||
L"\nPlugins Manager Options\n\n" \
|
||||
|
||||
L" --h \n" \
|
||||
L" --help = Print usage information.\n\n" \
|
||||
|
||||
L" --directory = Required parameter. Set plugins folder in quotes.\n" \
|
||||
L" For example, --directory=\"/home/mark/plugins\"\n" \
|
||||
L" The symbol = can be skipped for all parameters.\n" \
|
||||
L" Must be first on the command line.\n\n" \
|
||||
|
||||
L" --marketplace = Optional parameter. Set plugins marketplace URL in quotes.\n" \
|
||||
L" Default is https://onlyoffice.github.io\n\n" \
|
||||
|
||||
L" --print-installed = Optional parameter without value. Print installed plugins.\n\n" \
|
||||
|
||||
L" --print-removed = Optional parameter without value. Print removed plugins.\n\n" \
|
||||
|
||||
L" --print-marketplace = Optional parameter without value. Print available plugins from the marketplace.\n\n" \
|
||||
|
||||
L" --print-backup = Optional parameter without value. Print backup plugins.\n" \
|
||||
L" Backup plugins can be restored using --restore option\n\n" \
|
||||
|
||||
L" --reset = Optional parameter without value. Reset user setting.\n\n" \
|
||||
|
||||
L" --install = Optional parameter. Set comma-separated quoted list of plugins to install.\n" \
|
||||
L" Installing by plugin name, for example, --install=\"photo editor\"\n" \
|
||||
L" GUID, for example, --install=\"{7327FC95-16DA-41D9-9AF2-0E7F449F6800}\"\n" \
|
||||
L" URL, for example, --install=\"https://anysite.com/deploy/chess.plugin\"\n" \
|
||||
L" file path, for example, --install=\"/home/mark/work/speech.plugin\"\n" \
|
||||
L" config path, for example, --install=\"/home/mark/work/plugins.json\"\n" \
|
||||
L" is supported.\n" \
|
||||
L" Combined installation is supported, for example, --install=\"photo editor, {7327FC95-16DA-41D9-9AF2-0E7F449F6800}, etc\".\n" \
|
||||
L" File paths without quotes, plugin extensions: .zip, .plugin.\n\n" \
|
||||
|
||||
L" --restore = Optional parameter. Set comma-separated quoted list of plugins to restore.\n" \
|
||||
L" Print backup plugins using --print-backup option.\n" \
|
||||
L" Restoring by plugin name or GUID is supported.\n" \
|
||||
L" For example, --restore=\"Youtube, {7327FC95-16DA-41D9-9AF2-0E7F449F6800}\"\n\n" \
|
||||
|
||||
L" --update = Optional parameter. Set comma-separated quoted list of plugins to update.\n" \
|
||||
L" Updating by plugin name, GUID, config path is supported.\n" \
|
||||
L" For example, --update=\"Youtube, PhotoEditor, {7327FC95-16DA-41D9-9AF2-0E7F449F6800}\"\n\n" \
|
||||
|
||||
L" --update-all = Optional parameter without value. Update all installed plugins from marketplace.\n\n" \
|
||||
|
||||
L" --autorename = Optional parameter without value.\n" \
|
||||
L" Rename installed plugins folders from name to GUID.\n" \
|
||||
L" For example, youtube -> {38E022EA-AD92-45FC-B22B-49DF39746DB4}\n\n" \
|
||||
|
||||
L" --remove = Optional parameter. Set comma-separated quoted list of plugins to remove.\n" \
|
||||
L" Removing by plugin name, GUID, config path is supported.\n" \
|
||||
L" For example, --remove=\"Youtube, PhotoEditor, {7327FC95-16DA-41D9-9AF2-0E7F449F6800}\"\n\n" \
|
||||
|
||||
L" --remove-all = Optional parameter without value. Remove all installed plugins.\n\n" \
|
||||
|
||||
L" --ignore = Optional parameter. Set comma-separated quoted list of plugins to ignore actions,\n" \
|
||||
L" such as update, remove, rename or restore.\n" \
|
||||
L" For example, --ignore=\"youtube, {7327FC95-16DA-41D9-9AF2-0E7F449F6800}\"\n" \
|
||||
;
|
||||
1559
DesktopEditor/pluginsmanager/main.cpp
Normal file
1559
DesktopEditor/pluginsmanager/main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
36
DesktopEditor/pluginsmanager/pluginsmanager.pro
Normal file
36
DesktopEditor/pluginsmanager/pluginsmanager.pro
Normal file
@ -0,0 +1,36 @@
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
CONFIG -= qt
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
|
||||
|
||||
DESTDIR = $$CORE_BUILDS_BINARY_PATH
|
||||
|
||||
TARGET = pluginsmanager
|
||||
|
||||
DEFINES += KERNEL_USE_DYNAMIC_LIBRARY
|
||||
|
||||
ADD_DEPENDENCY(kernel, kernel_network, UnicodeConverter)
|
||||
|
||||
core_windows {
|
||||
DEFINES += \
|
||||
WIN32
|
||||
|
||||
DEFINES -= UNICODE
|
||||
DEFINES -= _DEBUG
|
||||
|
||||
message(windows)
|
||||
|
||||
LIBS += -lAdvapi32
|
||||
LIBS += -lShell32
|
||||
LIBS += -lGdi32
|
||||
LIBS += -lUser32
|
||||
}
|
||||
|
||||
SOURCES += main.cpp
|
||||
HEADERS += help.h
|
||||
@ -278,17 +278,21 @@ namespace MetaFile
|
||||
double dLogicalFontHeight = std::fabs(pFont->GetHeight());
|
||||
|
||||
double dM11, dM12, dM21, dM22, dRx, dRy;
|
||||
m_pRenderer->GetTransform(&dM11, &dM12, &dM21, &dM22, &dRx, &dRy);
|
||||
|
||||
if (dLogicalFontHeight < M_MINFONTSIZE)
|
||||
{
|
||||
m_pRenderer->GetTransform(&dM11, &dM12, &dM21, &dM22, &dRx, &dRy);
|
||||
dFontScale = dM22;
|
||||
dLogicalFontHeight *= dFontScale;
|
||||
m_pRenderer->SetTransform(dM11 / std::fabs(dM11), dM12, dM21, dM22 / std::fabs(dM22), dRx, dRy);
|
||||
|
||||
dM11 /= std::fabs(dM11);
|
||||
dM22 /= std::fabs(dM22);
|
||||
|
||||
m_pRenderer->SetTransform(dM11, dM12, dM21, dM22, dRx, dRy);
|
||||
}
|
||||
|
||||
m_pRenderer->put_FontName(pFont->GetFaceName());
|
||||
m_pRenderer->put_FontSize(fabs(dLogicalFontHeight * m_dScaleX / 25.4 * 72.));
|
||||
m_pRenderer->put_FontSize(fabs(dLogicalFontHeight * m_dScaleX / 25.4 * 72.) * dM22);
|
||||
|
||||
int lStyle = 0;
|
||||
if (pFont->GetWeight() > 550)
|
||||
@ -1209,12 +1213,8 @@ namespace MetaFile
|
||||
std::vector<double> arDashes(unSizeDash);
|
||||
|
||||
for (unsigned int unIndex = 0; unIndex < unSizeDash; ++unIndex)
|
||||
{
|
||||
if (PS_STARTCAP_ROUND == ulPenStartCap)
|
||||
arDashes[unIndex] = pDataDash[unIndex] * ((0 == unIndex % 2) ? (dWidth / 4) : (1.5 * dWidth));
|
||||
else
|
||||
arDashes[unIndex] = pDataDash[unIndex] * dWidth;
|
||||
}
|
||||
|
||||
m_pRenderer->PenDashPattern(arDashes.data(), unSizeDash);
|
||||
|
||||
nDashStyle = Aggplus::DashStyleCustom;
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
#include <math.h>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#ifndef DIB_RGB_COLORS
|
||||
#define DIB_RGB_COLORS 0x00
|
||||
@ -1015,10 +1016,10 @@ namespace MetaFile
|
||||
return sTmpFile;
|
||||
}
|
||||
|
||||
std::wstring StringNormalization(std::wstring wsString)
|
||||
std::wstring StringNormalization(const std::wstring& wsString)
|
||||
{
|
||||
std::wstring wsText;
|
||||
for (wchar_t wChar : wsString)
|
||||
for (const wchar_t& wChar : wsString)
|
||||
if (wChar == L'<')
|
||||
wsText += L"<";
|
||||
else if (wChar == L'>')
|
||||
@ -1036,6 +1037,30 @@ namespace MetaFile
|
||||
return wsText;
|
||||
}
|
||||
|
||||
bool StringEquals(const std::wstring& wsFirst, const std::wstring& wsSecond)
|
||||
{
|
||||
#if 0
|
||||
// since c++14!
|
||||
return std::equal(wsFirst.begin(), wsFirst.end(),
|
||||
wsSecond.begin(), wsSecond.end(),
|
||||
[](wchar_t wchFirst, wchar_t wchSecond) {
|
||||
return tolower(wchFirst) == tolower(wchSecond);
|
||||
});
|
||||
#else
|
||||
size_t sizeFirst = wsFirst.length();
|
||||
size_t sizeSecond = wsSecond.length();
|
||||
if (sizeFirst != sizeSecond)
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < sizeFirst; ++i)
|
||||
{
|
||||
if (tolower(wsFirst[i]) != tolower(wsSecond[i]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int GetMinAccuracy(double dValue)
|
||||
{
|
||||
if (dValue == (int)dValue)
|
||||
|
||||
@ -1229,7 +1229,8 @@ namespace MetaFile
|
||||
void ProcessRasterOperation(unsigned int unRasterOperation, BYTE** ppBgra, unsigned int unWidth, unsigned int unHeight);
|
||||
std::wstring GetTempFilename(const std::wstring& sFolder = L"");
|
||||
|
||||
std::wstring StringNormalization(std::wstring wsString);
|
||||
std::wstring StringNormalization(const std::wstring& wsString);
|
||||
bool StringEquals(const std::wstring& wsFirstString, const std::wstring& wsSecondString);
|
||||
|
||||
std::wstring ConvertToWString(double dValue, int nAccuracy = -1);
|
||||
std::wstring ConvertToWString(const std::vector<double>& arValues, int nAccuracy = -1);
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
#include "CEmfInterpretatorSvg.h"
|
||||
|
||||
#include "../../Common/MetaFileUtils.h"
|
||||
|
||||
#include "../../../../graphics/Image.h"
|
||||
|
||||
#include "../../../BgraFrame.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -1152,10 +1149,21 @@ namespace MetaFile
|
||||
|
||||
arNodeAttributes.push_back({L"font-size", ConvertToWString(dFontHeight)});
|
||||
|
||||
std::wstring wsFaceName = pFont->GetFaceName();
|
||||
std::wstring wsFontName = pFont->GetFaceName();
|
||||
|
||||
if (!wsFaceName.empty())
|
||||
arNodeAttributes.push_back({L"font-family", wsFaceName});
|
||||
if (!wsFontName.empty())
|
||||
{
|
||||
NSFonts::CFontSelectFormat oFormat;
|
||||
oFormat.wsName = new std::wstring(pFont->GetFaceName());
|
||||
|
||||
NSFonts::CFontInfo *pFontInfo = m_pParser->GetFontManager()->GetFontInfoByParams(oFormat);
|
||||
|
||||
if (NULL != pFontInfo && !StringEquals(wsFontName, pFontInfo->m_wsFontName))
|
||||
wsFontName = L"'" + wsFontName + L"', '" + pFontInfo->m_wsFontName + L"'";
|
||||
}
|
||||
|
||||
if (!wsFontName.empty())
|
||||
arNodeAttributes.push_back({L"font-family", wsFontName});
|
||||
|
||||
if (pFont->GetWeight() > 550)
|
||||
arNodeAttributes.push_back({L"font-weight", L"bold"});
|
||||
|
||||
@ -253,6 +253,9 @@ namespace MetaFile
|
||||
|
||||
IFont *pFont = m_pParser->GetFont();
|
||||
|
||||
if (NULL == pFont)
|
||||
return;
|
||||
|
||||
double dFontHeight = std::fabs(pFont->GetHeight());
|
||||
|
||||
if (dFontHeight < 0.01)
|
||||
@ -260,12 +263,21 @@ namespace MetaFile
|
||||
|
||||
arNodeAttributes.push_back({L"font-size", ConvertToWString(dFontHeight)});
|
||||
|
||||
std::wstring wsFaceName = pFont->GetFaceName();
|
||||
std::transform(wsFaceName.begin(), wsFaceName.end(), wsFaceName.begin(), towlower);
|
||||
EraseWords(wsFaceName, {L" bold", L" italic"});
|
||||
std::wstring wsFontName = pFont->GetFaceName();
|
||||
|
||||
if (!wsFaceName.empty())
|
||||
arNodeAttributes.push_back({L"font-family", wsFaceName});
|
||||
if (!wsFontName.empty())
|
||||
{
|
||||
NSFonts::CFontSelectFormat oFormat;
|
||||
oFormat.wsName = new std::wstring(pFont->GetFaceName());
|
||||
|
||||
NSFonts::CFontInfo *pFontInfo = m_pParser->GetFontManager()->GetFontInfoByParams(oFormat);
|
||||
|
||||
if (NULL != pFontInfo && !StringEquals(wsFontName, pFontInfo->m_wsFontName))
|
||||
wsFontName = L"'" + wsFontName + L"', '" + pFontInfo->m_wsFontName + L"'";
|
||||
}
|
||||
|
||||
if (!wsFontName.empty())
|
||||
arNodeAttributes.push_back({L"font-family", wsFontName});
|
||||
|
||||
if (pFont->GetWeight() > 550)
|
||||
arNodeAttributes.push_back({L"font-weight", L"bold"});
|
||||
@ -351,10 +363,15 @@ namespace MetaFile
|
||||
|
||||
double dSin = std::sin(dEscapement * M_PI / 180.);
|
||||
|
||||
dXCoord -= dFontHeight * dSin;
|
||||
dYCoord -= dFontHeight * dSin;
|
||||
|
||||
if (oScale.y < -0.00001)
|
||||
dXCoord -= dFontHeight * dSin;
|
||||
|
||||
arNodeAttributes.push_back({L"transform", L"rotate(" + ConvertToWString(dEscapement) + L' ' + ConvertToWString(dXCoord) + L' ' + ConvertToWString(dYCoord) + L')'});
|
||||
|
||||
if (oScale.y > 0.00001)
|
||||
dXCoord -= dFontHeight * dSin;
|
||||
}
|
||||
|
||||
AddTransform(arNodeAttributes, &oTransform);
|
||||
@ -487,15 +504,27 @@ namespace MetaFile
|
||||
unsigned int unMetaPenStyle = pPen->GetStyle();
|
||||
unsigned int ulPenStyle = unMetaPenStyle & PS_STYLE_MASK;
|
||||
unsigned int ulPenStartCap = unMetaPenStyle & PS_STARTCAP_MASK;
|
||||
unsigned int ulPenEndCap = unMetaPenStyle & PS_ENDCAP_MASK;
|
||||
unsigned int ulPenJoin = unMetaPenStyle & PS_JOIN_MASK;
|
||||
|
||||
// svg не поддерживает разные стили для разных сторон линии
|
||||
std::wstring wsLineCap;
|
||||
|
||||
if (PS_ENDCAP_ROUND == ulPenEndCap)
|
||||
wsLineCap = L"round";
|
||||
else if (PS_ENDCAP_SQUARE == ulPenEndCap)
|
||||
wsLineCap = L"square";
|
||||
else if (PS_ENDCAP_FLAT == ulPenEndCap)
|
||||
wsLineCap = L"butt";
|
||||
|
||||
if (PS_STARTCAP_FLAT == ulPenStartCap)
|
||||
arAttributes.push_back({L"stroke-linecap", L"butt"});
|
||||
wsLineCap = L"butt";
|
||||
else if (PS_STARTCAP_SQUARE == ulPenStartCap)
|
||||
arAttributes.push_back({L"stroke-linecap", L"square"});
|
||||
wsLineCap = L"square";
|
||||
else if (PS_STARTCAP_ROUND == ulPenStartCap)
|
||||
arAttributes.push_back({L"stroke-linecap", L"round"});
|
||||
wsLineCap = L"round";
|
||||
|
||||
arAttributes.push_back({L"stroke-linecap", wsLineCap});
|
||||
|
||||
if (PS_JOIN_MITER == ulPenJoin)
|
||||
arAttributes.push_back({L"stroke-linejoin", L"miter"});
|
||||
|
||||
@ -208,7 +208,7 @@ namespace SVG
|
||||
|
||||
const wchar_t* buf = Rgb.c_str();
|
||||
size_t len = Rgb.length();
|
||||
for ( size_t i = 0; i < len; ++i )
|
||||
for ( size_t i = 0; i < len && IndCol < 4; ++i )
|
||||
{
|
||||
if ( isdigit ( buf [ i ] ) )
|
||||
{
|
||||
@ -247,7 +247,7 @@ namespace SVG
|
||||
if (0 == Color[3])
|
||||
return -2;
|
||||
|
||||
return ( ( (int) (Color [ 2 ]) << 16 ) | ( (int) (Color [ 1 ]) << 8 ) | (int) (Color [ 1 ]) );
|
||||
return ( ( (int) (Color [ 2 ]) << 16 ) | ( (int) (Color [ 1 ]) << 8 ) | (int) (Color [ 0 ]) );
|
||||
}
|
||||
long ColorParser::ColorFromHexString(const std::wstring& Hex)
|
||||
{
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
SET SCRIPTPATH=%~dp0
|
||||
CD /D %~dp0
|
||||
|
||||
call hg clone https://hg.mozilla.org/projects/nspr
|
||||
call hg clone https://hg.mozilla.org/projects/nss
|
||||
|
||||
cd nss
|
||||
export USE_64=1
|
||||
make nss_build_all
|
||||
|
||||
git clone https://github.com/openssl/openssl.git openssl
|
||||
cd openssl
|
||||
perl ./Configure linux-64
|
||||
./config
|
||||
make
|
||||
|
||||
#call git clone -b master https://github.com/lsh123/xmlsec.git
|
||||
#download from http://www.aleksey.com/xmlsec/download/xmlsec1-1.2.23.tar.gz
|
||||
# get from our git repository
|
||||
@ -1,312 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2014-10-10T14:24:04
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT -= core gui
|
||||
|
||||
TARGET = libxmlsec
|
||||
TEMPLATE = lib
|
||||
QMAKE_CXXFLAGS += -Wall -g
|
||||
|
||||
#CONFIG += shared
|
||||
#CONFIG += plugin
|
||||
CONFIG += staticlib
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD_ROOT_DIR/xmlsec/include \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/xml/build/qt
|
||||
|
||||
DEFINES += \
|
||||
LIBXML_READER_ENABLED \
|
||||
LIBXML_PUSH_ENABLED \
|
||||
LIBXML_HTML_ENABLED \
|
||||
LIBXML_XPATH_ENABLED \
|
||||
LIBXML_OUTPUT_ENABLED \
|
||||
LIBXML_C14N_ENABLED \
|
||||
LIBXML_SAX1_ENABLED \
|
||||
LIBXML_TREE_ENABLED \
|
||||
LIBXML_XPTR_ENABLED \
|
||||
IN_LIBXML \
|
||||
LIBXML_STATIC
|
||||
|
||||
include($$CORE_ROOT_DIR/DesktopEditor/xml/build/qt/libxml2_src.pri)
|
||||
|
||||
DEFINES += PACKAGE=\\\"xmlsec1\\\"
|
||||
DEFINES += VERSION=\\\"1.2.23\\\"
|
||||
DEFINES += XMLSEC_DEFAULT_CRYPTO=\\\"openssl\\\"
|
||||
|
||||
DEFINES += \
|
||||
IN_XMLSEC \
|
||||
XMLSEC_STATIC
|
||||
|
||||
core_linux {
|
||||
#CONFIG += use_gcrypt
|
||||
#CONFIG += use_gnutls
|
||||
#CONFIG += use_mscrypto
|
||||
#CONFIG += use_nss
|
||||
CONFIG += use_openssl
|
||||
#CONFIG += use_skeleton
|
||||
#CONFIG += use_xslt
|
||||
}
|
||||
|
||||
core_windows {
|
||||
CONFIG += use_mscrypto
|
||||
}
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/app.h \
|
||||
xmlsec/include/xmlsec/base64.h \
|
||||
xmlsec/include/xmlsec/bn.h \
|
||||
xmlsec/include/xmlsec/buffer.h \
|
||||
xmlsec/include/xmlsec/crypto.h \
|
||||
xmlsec/include/xmlsec/dl.h \
|
||||
xmlsec/include/xmlsec/errors.h \
|
||||
xmlsec/include/xmlsec/exports.h \
|
||||
xmlsec/include/xmlsec/io.h \
|
||||
xmlsec/include/xmlsec/keyinfo.h \
|
||||
xmlsec/include/xmlsec/keys.h \
|
||||
xmlsec/include/xmlsec/keysdata.h \
|
||||
xmlsec/include/xmlsec/keysmngr.h \
|
||||
xmlsec/include/xmlsec/list.h \
|
||||
xmlsec/include/xmlsec/membuf.h \
|
||||
xmlsec/include/xmlsec/nodeset.h \
|
||||
xmlsec/include/xmlsec/parser.h \
|
||||
xmlsec/include/xmlsec/private.h \
|
||||
xmlsec/include/xmlsec/soap.h \
|
||||
xmlsec/include/xmlsec/strings.h \
|
||||
xmlsec/include/xmlsec/templates.h \
|
||||
xmlsec/include/xmlsec/transforms.h \
|
||||
xmlsec/include/xmlsec/version.h \
|
||||
xmlsec/include/xmlsec/version.h.in \
|
||||
xmlsec/include/xmlsec/x509.h \
|
||||
xmlsec/include/xmlsec/xmldsig.h \
|
||||
xmlsec/include/xmlsec/xmlenc.h \
|
||||
xmlsec/include/xmlsec/xmlsec.h \
|
||||
xmlsec/include/xmlsec/xmltree.h \
|
||||
xmlsec/src/globals.h \
|
||||
xmlsec/src/kw_aes_des.h
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/app.c \
|
||||
xmlsec/src/base64.c \
|
||||
xmlsec/src/bn.c \
|
||||
xmlsec/src/buffer.c \
|
||||
xmlsec/src/c14n.c \
|
||||
xmlsec/src/dl.c \
|
||||
xmlsec/src/enveloped.c \
|
||||
xmlsec/src/errors.c \
|
||||
xmlsec/src/io.c \
|
||||
xmlsec/src/keyinfo.c \
|
||||
xmlsec/src/keys.c \
|
||||
xmlsec/src/keysdata.c \
|
||||
xmlsec/src/keysmngr.c \
|
||||
xmlsec/src/kw_aes_des.c \
|
||||
xmlsec/src/list.c \
|
||||
xmlsec/src/membuf.c \
|
||||
xmlsec/src/nodeset.c \
|
||||
xmlsec/src/parser.c \
|
||||
xmlsec/src/relationship.c \
|
||||
xmlsec/src/soap.c \
|
||||
xmlsec/src/strings.c \
|
||||
xmlsec/src/templates.c \
|
||||
xmlsec/src/transforms.c \
|
||||
xmlsec/src/x509.c \
|
||||
xmlsec/src/xmldsig.c \
|
||||
xmlsec/src/xmlenc.c \
|
||||
xmlsec/src/xmlsec.c \
|
||||
xmlsec/src/xmltree.c \
|
||||
xmlsec/src/xpath.c
|
||||
|
||||
use_gcrypt {
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/gcrypt/app.h \
|
||||
xmlsec/include/xmlsec/gcrypt/crypto.h \
|
||||
xmlsec/include/xmlsec/gcrypt/symbols.h \
|
||||
\
|
||||
xmlsec/src/gcrypt/asn1.h \
|
||||
xmlsec/src/gcrypt/globals.h
|
||||
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/gcrypt/app.c \
|
||||
xmlsec/src/gcrypt/asn1.c \
|
||||
xmlsec/src/gcrypt/asymkeys.c \
|
||||
xmlsec/src/gcrypt/ciphers.c \
|
||||
xmlsec/src/gcrypt/crypto.c \
|
||||
xmlsec/src/gcrypt/digests.c \
|
||||
xmlsec/src/gcrypt/hmac.c \
|
||||
xmlsec/src/gcrypt/kw_aes.c \
|
||||
xmlsec/src/gcrypt/kw_des.c \
|
||||
xmlsec/src/gcrypt/signatures.c \
|
||||
xmlsec/src/gcrypt/symkeys.c
|
||||
|
||||
}
|
||||
|
||||
use_gnutls {
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/gnutls/app.h \
|
||||
xmlsec/include/xmlsec/gnutls/crypto.h \
|
||||
xmlsec/include/xmlsec/gnutls/symbols.h \
|
||||
xmlsec/include/xmlsec/gnutls/x509.h \
|
||||
\
|
||||
xmlsec/src/gnutls/globals.h \
|
||||
xmlsec/src/gnutls/x509utils.h
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/gnutls/app.c \
|
||||
xmlsec/src/gnutls/asymkeys.c \
|
||||
xmlsec/src/gnutls/ciphers.c \
|
||||
xmlsec/src/gnutls/crypto.c \
|
||||
xmlsec/src/gnutls/digests.c \
|
||||
xmlsec/src/gnutls/hmac.c \
|
||||
xmlsec/src/gnutls/kw_aes.c \
|
||||
xmlsec/src/gnutls/kw_des.c \
|
||||
xmlsec/src/gnutls/signatures.c \
|
||||
xmlsec/src/gnutls/symkeys.c \
|
||||
xmlsec/src/gnutls/x509.c \
|
||||
xmlsec/src/gnutls/x509utils.c \
|
||||
xmlsec/src/gnutls/x509vfy.c
|
||||
|
||||
}
|
||||
|
||||
use_mscrypto {
|
||||
|
||||
DEFINES += XMLSEC_CRYPTO_MSCRYPTO
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/mscrypto/app.h \
|
||||
xmlsec/include/xmlsec/mscrypto/certkeys.h \
|
||||
xmlsec/include/xmlsec/mscrypto/crypto.h \
|
||||
xmlsec/include/xmlsec/mscrypto/keysstore.h \
|
||||
xmlsec/include/xmlsec/mscrypto/symbols.h \
|
||||
xmlsec/include/xmlsec/mscrypto/x509.h \
|
||||
\
|
||||
xmlsec/src/mscrypto/csp_calg.h \
|
||||
xmlsec/src/mscrypto/csp_oid.h \
|
||||
xmlsec/src/mscrypto/globals.h \
|
||||
xmlsec/src/mscrypto/private.h \
|
||||
xmlsec/src/mscrypto/xmlsec-mingw.h
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/mscrypto/app.c \
|
||||
xmlsec/src/mscrypto/certkeys.c \
|
||||
xmlsec/src/mscrypto/ciphers.c \
|
||||
xmlsec/src/mscrypto/crypto.c \
|
||||
xmlsec/src/mscrypto/digests.c \
|
||||
xmlsec/src/mscrypto/hmac.c \
|
||||
xmlsec/src/mscrypto/keysstore.c \
|
||||
xmlsec/src/mscrypto/kt_rsa.c \
|
||||
xmlsec/src/mscrypto/kw_aes.c \
|
||||
xmlsec/src/mscrypto/kw_des.c \
|
||||
xmlsec/src/mscrypto/signatures.c \
|
||||
xmlsec/src/mscrypto/symkeys.c \
|
||||
xmlsec/src/mscrypto/x509.c \
|
||||
xmlsec/src/mscrypto/x509vfy.c
|
||||
|
||||
}
|
||||
|
||||
use_nss {
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/nss/app.h \
|
||||
xmlsec/include/xmlsec/nss/bignum.h \
|
||||
xmlsec/include/xmlsec/nss/crypto.h \
|
||||
xmlsec/include/xmlsec/nss/keysstore.h \
|
||||
xmlsec/include/xmlsec/nss/pkikeys.h \
|
||||
xmlsec/include/xmlsec/nss/symbols.h \
|
||||
xmlsec/include/xmlsec/nss/x509.h \
|
||||
\
|
||||
xmlsec/src/nss/globals.h
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/nss/app.c \
|
||||
xmlsec/src/nss/bignum.c \
|
||||
xmlsec/src/nss/ciphers.c \
|
||||
xmlsec/src/nss/crypto.c \
|
||||
xmlsec/src/nss/digests.c \
|
||||
xmlsec/src/nss/hmac.c \
|
||||
xmlsec/src/nss/keysstore.c \
|
||||
xmlsec/src/nss/keytrans.c \
|
||||
xmlsec/src/nss/kw_aes.c \
|
||||
xmlsec/src/nss/kw_des.c \
|
||||
xmlsec/src/nss/pkikeys.c \
|
||||
xmlsec/src/nss/signatures.c \
|
||||
xmlsec/src/nss/symkeys.c \
|
||||
xmlsec/src/nss/x509.c \
|
||||
xmlsec/src/nss/x509vfy.c
|
||||
|
||||
}
|
||||
|
||||
use_openssl {
|
||||
|
||||
DEFINES += XMLSEC_OPENSSL_110
|
||||
|
||||
INCLUDEPATH += $$PWD/openssl/include
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/openssl/app.h \
|
||||
xmlsec/include/xmlsec/openssl/bn.h \
|
||||
xmlsec/include/xmlsec/openssl/crypto.h \
|
||||
xmlsec/include/xmlsec/openssl/evp.h \
|
||||
xmlsec/include/xmlsec/openssl/symbols.h \
|
||||
xmlsec/include/xmlsec/openssl/x509.h \
|
||||
\
|
||||
xmlsec/src/openssl/globals.h \
|
||||
xmlsec/src/openssl/openssl11_wrapper.h
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/openssl/_app.c \
|
||||
xmlsec/src/openssl/_bn.c \
|
||||
xmlsec/src/openssl/_ciphers.c \
|
||||
xmlsec/src/openssl/_crypto.c \
|
||||
xmlsec/src/openssl/_digests.c \
|
||||
xmlsec/src/openssl/_evp.c \
|
||||
xmlsec/src/openssl/_evp_signatures.c \
|
||||
xmlsec/src/openssl/_hmac.c \
|
||||
xmlsec/src/openssl/_kt_rsa.c \
|
||||
xmlsec/src/openssl/_kw_aes.c \
|
||||
xmlsec/src/openssl/_kw_des.c \
|
||||
xmlsec/src/openssl/_signatures.c \
|
||||
xmlsec/src/openssl/_symkeys.c \
|
||||
xmlsec/src/openssl/_x509.c \
|
||||
xmlsec/src/openssl/_x509vfy.c
|
||||
|
||||
}
|
||||
|
||||
use_skeleton {
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/skeleton/app.h \
|
||||
xmlsec/include/xmlsec/skeleton/crypto.h \
|
||||
xmlsec/include/xmlsec/skeleton/symbols.h \
|
||||
\
|
||||
xmlsec/src/skeleton/globals.h
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/skeleton/app.c \
|
||||
xmlsec/src/skeleton/crypto.c
|
||||
|
||||
}
|
||||
|
||||
use_xslt {
|
||||
|
||||
HEADERS += \
|
||||
xmlsec/include/xmlsec/private/xslt.h
|
||||
|
||||
SOURCES += \
|
||||
xmlsec/src/xslt.c
|
||||
|
||||
} else {
|
||||
|
||||
DEFINES += \
|
||||
XMLSEC_NO_XSLT
|
||||
|
||||
}
|
||||
@ -7,23 +7,23 @@ class COOXMLSigner_private;
|
||||
class OPENSSL_DECL COOXMLSigner
|
||||
{
|
||||
public:
|
||||
COOXMLSigner(const std::wstring& sFolder, ICertificate* pContext);
|
||||
COOXMLSigner(unsigned char* data, unsigned long length, ICertificate* pContext);
|
||||
~COOXMLSigner();
|
||||
COOXMLSigner(const std::wstring& sFolder, ICertificate* pContext);
|
||||
COOXMLSigner(unsigned char* data, unsigned long length, ICertificate* pContext);
|
||||
~COOXMLSigner();
|
||||
|
||||
void SetGuid (const std::wstring& guid);
|
||||
void SetImageValid (const std::wstring& file);
|
||||
void SetImageInvalid(const std::wstring& file);
|
||||
void SetImageValid (unsigned char* data, unsigned long length);
|
||||
void SetImageInvalid(unsigned char* data, unsigned long length);
|
||||
void SetGuid (const std::wstring& guid);
|
||||
void SetImageValid (const std::wstring& file);
|
||||
void SetImageInvalid(const std::wstring& file);
|
||||
void SetImageValid (unsigned char* data, unsigned long length);
|
||||
void SetImageInvalid(unsigned char* data, unsigned long length);
|
||||
|
||||
int Sign(unsigned char*& pFiletoWrite, unsigned long& dwLenFiletoWrite);
|
||||
int Sign(unsigned char*& pFiletoWrite, unsigned long& dwLenFiletoWrite);
|
||||
|
||||
// Simle alias to Sign(data, len) for folder realization
|
||||
int Sign();
|
||||
// Simle alias to Sign(data, len) for folder realization
|
||||
int Sign();
|
||||
|
||||
private:
|
||||
COOXMLSigner_private* m_internal;
|
||||
COOXMLSigner_private* m_internal;
|
||||
};
|
||||
|
||||
#endif //_XML_OOXMLSIGNER_H_
|
||||
|
||||
@ -7,48 +7,49 @@
|
||||
#define OOXML_SIGNATURE_INVALID 1
|
||||
#define OOXML_SIGNATURE_NOTSUPPORTED 2
|
||||
#define OOXML_SIGNATURE_BAD 3
|
||||
#define OOXML_SIGNATURE_PARTIALLY 4
|
||||
|
||||
class COOXMLSignature_private;
|
||||
class OPENSSL_DECL COOXMLSignature
|
||||
{
|
||||
public:
|
||||
COOXMLSignature();
|
||||
~COOXMLSignature();
|
||||
COOXMLSignature();
|
||||
~COOXMLSignature();
|
||||
|
||||
public:
|
||||
int GetValid();
|
||||
std::string GetGuid();
|
||||
std::string GetDate();
|
||||
ICertificate* GetCertificate();
|
||||
std::string GetImageValidBase64();
|
||||
std::string GetImageInvalidBase64();
|
||||
int GetValid();
|
||||
std::string GetGuid();
|
||||
std::string GetDate();
|
||||
ICertificate* GetCertificate();
|
||||
std::string GetImageValidBase64();
|
||||
std::string GetImageInvalidBase64();
|
||||
|
||||
std::wstring GetFile();
|
||||
std::wstring GetFile();
|
||||
|
||||
public:
|
||||
void Check();
|
||||
void Check();
|
||||
|
||||
friend class COOXMLVerifier_private;
|
||||
friend class COOXMLVerifier;
|
||||
friend class COOXMLVerifier_private;
|
||||
friend class COOXMLVerifier;
|
||||
private:
|
||||
COOXMLSignature_private* m_internal;
|
||||
COOXMLSignature_private* m_internal;
|
||||
};
|
||||
|
||||
class COOXMLVerifier_private;
|
||||
class Q_DECL_EXPORT COOXMLVerifier
|
||||
{
|
||||
public:
|
||||
COOXMLVerifier(const std::wstring& sFolder);
|
||||
COOXMLVerifier(unsigned char* data, unsigned long length);
|
||||
~COOXMLVerifier();
|
||||
COOXMLVerifier(const std::wstring& sFolder);
|
||||
COOXMLVerifier(unsigned char* data, unsigned long length);
|
||||
~COOXMLVerifier();
|
||||
|
||||
int GetSignatureCount();
|
||||
COOXMLSignature* GetSignature(const int& index);
|
||||
int GetSignatureCount();
|
||||
COOXMLSignature* GetSignature(const int& index);
|
||||
|
||||
void RemoveSignature(const std::string& sGuid);
|
||||
void RemoveSignature(const std::string& sGuid);
|
||||
|
||||
private:
|
||||
COOXMLVerifier_private* m_internal;
|
||||
COOXMLVerifier_private* m_internal;
|
||||
};
|
||||
|
||||
#endif //_XML_OOXMLVERIFIER_H_
|
||||
|
||||
@ -27,6 +27,7 @@ HEADERS += \
|
||||
src/XmlTransform.h
|
||||
|
||||
SOURCES += \
|
||||
src/common.h \
|
||||
src/XmlTransform.cpp \
|
||||
src/CertificateCommon.cpp \
|
||||
src/OOXMLSigner.cpp \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -5,214 +5,252 @@
|
||||
#include "../../../common/File.h"
|
||||
#include "../../../common/Directory.h"
|
||||
#include "../../../../OfficeUtils/src/ZipFolder.h"
|
||||
#include <set>
|
||||
|
||||
class CManifestFileInfo
|
||||
{
|
||||
public:
|
||||
IFolder* m_pFolder;
|
||||
|
||||
protected:
|
||||
std::wstring m_sFile;
|
||||
std::wstring m_sAliasDirectory;
|
||||
int m_nCountUnexistedFile;
|
||||
|
||||
public:
|
||||
CManifestFileInfo()
|
||||
{
|
||||
m_pFolder = NULL;
|
||||
m_sFile = L"";
|
||||
m_nCountUnexistedFile = 0;
|
||||
}
|
||||
|
||||
std::wstring& GetFilePath()
|
||||
{
|
||||
return m_sFile;
|
||||
}
|
||||
|
||||
void SetFilePath(const std::wstring& sFilePath)
|
||||
{
|
||||
m_sFile = sFilePath;
|
||||
m_sAliasDirectory = NSFile::GetDirectoryName(sFilePath);
|
||||
m_sAliasDirectory = NSFile::GetDirectoryName(m_sAliasDirectory); // ../ from _rels/
|
||||
}
|
||||
|
||||
std::wstring GetHeadPath(const std::wstring& sFile)
|
||||
{
|
||||
std::wstring sFullPath = m_sAliasDirectory + L"/" + sFile;
|
||||
sFullPath = NSSystemPath::NormalizePath(sFullPath);
|
||||
|
||||
if (!sFullPath.empty() && '/' != sFullPath[0])
|
||||
sFullPath = L"/" + sFullPath;
|
||||
|
||||
return sFullPath;
|
||||
}
|
||||
};
|
||||
|
||||
class COOXMLRelationship
|
||||
{
|
||||
public:
|
||||
std::wstring rid;
|
||||
std::wstring type;
|
||||
std::wstring target;
|
||||
std::wstring target_mode;
|
||||
std::wstring rid;
|
||||
std::wstring type;
|
||||
std::wstring target;
|
||||
std::wstring target_mode;
|
||||
|
||||
public:
|
||||
|
||||
COOXMLRelationship()
|
||||
{
|
||||
}
|
||||
COOXMLRelationship()
|
||||
{
|
||||
}
|
||||
|
||||
COOXMLRelationship(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
rid = node.GetAttribute("Id");
|
||||
type = node.GetAttribute("Type");
|
||||
target = node.GetAttribute("Target");
|
||||
target_mode = node.GetAttribute("TargetMode");
|
||||
COOXMLRelationship(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
rid = node.GetAttribute("Id");
|
||||
type = node.GetAttribute("Type");
|
||||
target = node.GetAttribute("Target");
|
||||
target_mode = node.GetAttribute("TargetMode");
|
||||
|
||||
CheckTargetMode();
|
||||
}
|
||||
CheckTargetMode();
|
||||
}
|
||||
|
||||
std::wstring GetXml()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
builder.WriteString(L"<Relationship Id=\"");
|
||||
builder.WriteEncodeXmlString(rid);
|
||||
builder.WriteString(L"\" Type=\"");
|
||||
builder.WriteEncodeXmlString(type);
|
||||
builder.WriteString(L"\" Target=\"");
|
||||
builder.WriteEncodeXmlString(target);
|
||||
builder.WriteString(L"\" TargetMode=\"");
|
||||
builder.WriteEncodeXmlString(target_mode);
|
||||
builder.WriteString(L"\" />");
|
||||
return builder.GetData();
|
||||
}
|
||||
std::wstring GetXml()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
builder.WriteString(L"<Relationship Id=\"");
|
||||
builder.WriteEncodeXmlString(rid);
|
||||
builder.WriteString(L"\" Type=\"");
|
||||
builder.WriteEncodeXmlString(type);
|
||||
builder.WriteString(L"\" Target=\"");
|
||||
builder.WriteEncodeXmlString(target);
|
||||
builder.WriteString(L"\" TargetMode=\"");
|
||||
builder.WriteEncodeXmlString(target_mode);
|
||||
builder.WriteString(L"\" />");
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
static bool Compare(const COOXMLRelationship& i, const COOXMLRelationship& j)
|
||||
{
|
||||
return i.rid < j.rid;
|
||||
}
|
||||
static bool Compare(const COOXMLRelationship& i, const COOXMLRelationship& j)
|
||||
{
|
||||
return i.rid < j.rid;
|
||||
}
|
||||
|
||||
protected:
|
||||
void CheckTargetMode()
|
||||
{
|
||||
if (!target_mode.empty())
|
||||
return;
|
||||
void CheckTargetMode()
|
||||
{
|
||||
if (!target_mode.empty())
|
||||
return;
|
||||
|
||||
if (0 == target.find(L"http") || 0 == target.find(L"www") || 0 == target.find(L"ftp"))
|
||||
target_mode = L"External";
|
||||
else
|
||||
target_mode = L"Internal";
|
||||
}
|
||||
if (0 == target.find(L"http") || 0 == target.find(L"www") || 0 == target.find(L"ftp"))
|
||||
target_mode = L"External";
|
||||
else
|
||||
target_mode = L"Internal";
|
||||
}
|
||||
};
|
||||
|
||||
class COOXMLRelationships
|
||||
{
|
||||
public:
|
||||
std::vector<COOXMLRelationship> rels;
|
||||
IFolder* m_pFolder;
|
||||
std::vector<COOXMLRelationship> rels;
|
||||
CManifestFileInfo* m_pFileInfo;
|
||||
|
||||
public:
|
||||
|
||||
COOXMLRelationships()
|
||||
{
|
||||
m_pFolder = NULL;
|
||||
}
|
||||
COOXMLRelationships()
|
||||
{
|
||||
}
|
||||
|
||||
COOXMLRelationships(const std::string& xml, std::map<std::wstring, bool>* check_need = NULL)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
if (!oNode.FromXmlStringA(xml))
|
||||
return;
|
||||
COOXMLRelationships(const std::string& xml, CManifestFileInfo* pFileInfo, std::set<std::wstring>* check_need = NULL)
|
||||
{
|
||||
m_pFileInfo = pFileInfo;
|
||||
XmlUtils::CXmlNode oNode;
|
||||
if (!oNode.FromXmlStringA(xml))
|
||||
return;
|
||||
|
||||
FromXmlNode(oNode, check_need);
|
||||
}
|
||||
FromXmlNode(oNode, check_need);
|
||||
}
|
||||
|
||||
COOXMLRelationships(const std::wstring& xml, IFolder* pFolder, std::map<std::wstring, bool>* check_need = NULL)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
COOXMLRelationships(CManifestFileInfo* pFileInfo, std::set<std::wstring>* check_need = NULL)
|
||||
{
|
||||
m_pFileInfo = pFileInfo;
|
||||
|
||||
if (NULL == pFolder)
|
||||
{
|
||||
if (!oNode.FromXmlString(xml))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pFolder = pFolder;
|
||||
oNode = pFolder->getNodeFromFile(xml);
|
||||
if (!oNode.IsValid())
|
||||
return;
|
||||
}
|
||||
if (!m_pFileInfo || NULL == m_pFileInfo->m_pFolder)
|
||||
return;
|
||||
|
||||
FromXmlNode(oNode, check_need);
|
||||
}
|
||||
XmlUtils::CXmlNode oNode = m_pFileInfo->m_pFolder->getNodeFromFile(m_pFileInfo->GetFilePath());
|
||||
if (!oNode.IsValid())
|
||||
return;
|
||||
|
||||
void FromXmlNode(XmlUtils::CXmlNode& oNode, std::map<std::wstring, bool>* check_need = NULL)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (!oNode.GetNodes(L"Relationship", oNodes))
|
||||
return;
|
||||
FromXmlNode(oNode, check_need);
|
||||
}
|
||||
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oRel;
|
||||
oNodes.GetAt(i, oRel);
|
||||
void FromXmlNode(XmlUtils::CXmlNode& oNode, std::set<std::wstring>* check_need = NULL)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (!oNode.GetNodes(L"Relationship", oNodes))
|
||||
return;
|
||||
|
||||
if (NULL == check_need)
|
||||
{
|
||||
rels.push_back(COOXMLRelationship(oRel));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sRid = oRel.GetAttribute("Id");
|
||||
if (check_need->find(sRid) != check_need->end())
|
||||
rels.push_back(COOXMLRelationship(oRel));
|
||||
}
|
||||
}
|
||||
}
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oRel;
|
||||
oNodes.GetAt(i, oRel);
|
||||
|
||||
std::wstring GetXml()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
COOXMLRelationship oCurrentRel(oRel);
|
||||
if (NULL == check_need)
|
||||
{
|
||||
rels.push_back(oCurrentRel);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sRid = oRel.GetAttribute("Id");
|
||||
if (check_need->find(sRid) != check_need->end())
|
||||
rels.push_back(oCurrentRel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
builder.WriteString(L"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
|
||||
std::wstring GetXml()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
|
||||
// sort by rId
|
||||
std::sort(rels.begin(), rels.end(), COOXMLRelationship::Compare);
|
||||
builder.WriteString(L"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
|
||||
|
||||
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
|
||||
builder.WriteString(i->GetXml());
|
||||
// sort by rId
|
||||
std::sort(rels.begin(), rels.end(), COOXMLRelationship::Compare);
|
||||
|
||||
builder.WriteString(L"</Relationships>");
|
||||
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
|
||||
builder.WriteString(i->GetXml());
|
||||
|
||||
return builder.GetData();
|
||||
}
|
||||
builder.WriteString(L"</Relationships>");
|
||||
|
||||
std::wstring GetTransforms()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
builder.WriteString(L"<Transforms><Transform Algorithm=\"http://schemas.openxmlformats.org/package/2006/RelationshipTransform\">");
|
||||
std::wstring GetTransforms()
|
||||
{
|
||||
NSStringUtils::CStringBuilder builder;
|
||||
|
||||
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
|
||||
{
|
||||
builder.WriteString(L"<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"");
|
||||
builder.WriteEncodeXmlString(i->rid);
|
||||
builder.WriteString(L"\" />");
|
||||
}
|
||||
builder.WriteString(L"<Transforms><Transform Algorithm=\"http://schemas.openxmlformats.org/package/2006/RelationshipTransform\">");
|
||||
|
||||
builder.WriteString(L"</Transform><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>");
|
||||
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
|
||||
{
|
||||
builder.WriteString(L"<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"");
|
||||
builder.WriteEncodeXmlString(i->rid);
|
||||
builder.WriteString(L"\" />");
|
||||
}
|
||||
|
||||
return builder.GetData();
|
||||
}
|
||||
builder.WriteString(L"</Transform><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>");
|
||||
|
||||
void CheckOriginSigs(const std::wstring& file)
|
||||
{
|
||||
int rId = 0;
|
||||
std::string sReplace = "";
|
||||
std::vector<COOXMLRelationship>::iterator i = rels.begin();
|
||||
while (i != rels.end())
|
||||
{
|
||||
if (0 == i->target.find(L"_xmlsignatures/"))
|
||||
{
|
||||
sReplace = U_TO_UTF8(i->target);
|
||||
break;
|
||||
}
|
||||
return builder.GetData();
|
||||
}
|
||||
|
||||
std::wstring rid = i->rid;
|
||||
rid = rid.substr(3);
|
||||
void CheckOriginSigs(const std::wstring& file)
|
||||
{
|
||||
int rId = 0;
|
||||
std::string sReplace = "";
|
||||
std::vector<COOXMLRelationship>::iterator i = rels.begin();
|
||||
while (i != rels.end())
|
||||
{
|
||||
if (0 == i->target.find(L"_xmlsignatures/"))
|
||||
{
|
||||
sReplace = U_TO_UTF8(i->target);
|
||||
break;
|
||||
}
|
||||
|
||||
int nTemp = std::stoi(rid);
|
||||
std::wstring rid = i->rid;
|
||||
rid = rid.substr(3);
|
||||
|
||||
if (nTemp > rId)
|
||||
rId = nTemp;
|
||||
int nTemp = std::stoi(rid);
|
||||
|
||||
i++;
|
||||
}
|
||||
if (nTemp > rId)
|
||||
rId = nTemp;
|
||||
|
||||
if (!sReplace.empty())
|
||||
{
|
||||
if (sReplace == "_xmlsignatures/origin.sigs")
|
||||
return;
|
||||
i++;
|
||||
}
|
||||
|
||||
std::string sXmlA = m_pFolder->readXml(file);
|
||||
NSStringUtils::string_replaceA(sXmlA, sReplace, "_xmlsignatures/origin.sigs");
|
||||
m_pFolder->writeXmlA(file, sXmlA);
|
||||
return;
|
||||
}
|
||||
if (!sReplace.empty())
|
||||
{
|
||||
if (sReplace == "_xmlsignatures/origin.sigs")
|
||||
return;
|
||||
|
||||
std::string sXmlA = m_pFolder->readXml(file);
|
||||
std::string sXmlA = m_pFileInfo->m_pFolder->readXml(file);
|
||||
NSStringUtils::string_replaceA(sXmlA, sReplace, "_xmlsignatures/origin.sigs");
|
||||
m_pFileInfo->m_pFolder->writeXmlA(file, sXmlA);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string::size_type pos = sXmlA.rfind("</Relationships>");
|
||||
if (pos == std::string::npos)
|
||||
return;
|
||||
std::string sXmlA = m_pFileInfo->m_pFolder->readXml(file);
|
||||
|
||||
rId++;
|
||||
std::string sRet = sXmlA.substr(0, pos);
|
||||
sRet += ("<Relationship Id=\"rId" + std::to_string(rId) + "\" \
|
||||
std::string::size_type pos = sXmlA.rfind("</Relationships>");
|
||||
if (pos == std::string::npos)
|
||||
return;
|
||||
|
||||
rId++;
|
||||
std::string sRet = sXmlA.substr(0, pos);
|
||||
sRet += ("<Relationship Id=\"rId" + std::to_string(rId) + "\" \
|
||||
Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin\" Target=\"_xmlsignatures/origin.sigs\"/>\
|
||||
</Relationships>");
|
||||
m_pFolder->writeXmlA(file, sRet);
|
||||
}
|
||||
m_pFileInfo->m_pFolder->writeXmlA(file, sRet);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_XML_RELS_H_
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
#include "./XmlTransform.h"
|
||||
|
||||
IXmlTransform* IXmlTransform::GetFromType(const std::string& alg)
|
||||
IXmlTransform* IXmlTransform::GetFromType(const std::string& alg, CManifestFileInfo* pManifestFileInfo)
|
||||
{
|
||||
if (true)
|
||||
{
|
||||
CXmlTransformRelationship* transform = new CXmlTransformRelationship();
|
||||
if (transform->m_algorithm == alg)
|
||||
return transform;
|
||||
RELEASEOBJECT(transform);
|
||||
}
|
||||
if (true)
|
||||
{
|
||||
CXmlTransformC14N* transform = new CXmlTransformC14N();
|
||||
if (transform->CheckC14NTransform(alg))
|
||||
return transform;
|
||||
RELEASEOBJECT(transform);
|
||||
}
|
||||
if (true)
|
||||
{
|
||||
CXmlTransformRelationship* transform = new CXmlTransformRelationship(pManifestFileInfo);
|
||||
if (transform->m_algorithm == alg)
|
||||
return transform;
|
||||
RELEASEOBJECT(transform);
|
||||
}
|
||||
if (true)
|
||||
{
|
||||
CXmlTransformC14N* transform = new CXmlTransformC14N();
|
||||
if (transform->CheckC14NTransform(alg))
|
||||
return transform;
|
||||
RELEASEOBJECT(transform);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -6,186 +6,188 @@
|
||||
class IXmlTransform
|
||||
{
|
||||
protected:
|
||||
std::string m_algorithm;
|
||||
std::string m_algorithm;
|
||||
|
||||
public:
|
||||
IXmlTransform()
|
||||
{
|
||||
m_algorithm = "";
|
||||
}
|
||||
virtual ~IXmlTransform()
|
||||
{
|
||||
}
|
||||
IXmlTransform()
|
||||
{
|
||||
m_algorithm = "";
|
||||
}
|
||||
virtual ~IXmlTransform()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual std::string Transform(const std::string& sXml) = 0;
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node) = 0;
|
||||
virtual std::string Transform(const std::string& sXml) = 0;
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node) = 0;
|
||||
|
||||
static IXmlTransform* GetFromType(const std::string& alg);
|
||||
static IXmlTransform* GetFromType(const std::string& alg, CManifestFileInfo* pManifestFileInfo);
|
||||
};
|
||||
|
||||
class CXmlTransformRelationship : public IXmlTransform
|
||||
{
|
||||
protected:
|
||||
std::map<std::wstring, bool> m_arIds;
|
||||
CManifestFileInfo* m_pManifestFileInfo;
|
||||
std::set<std::wstring> m_arIds;
|
||||
|
||||
public:
|
||||
CXmlTransformRelationship() : IXmlTransform()
|
||||
{
|
||||
m_algorithm = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
|
||||
}
|
||||
CXmlTransformRelationship(CManifestFileInfo* pManifestFileInfo) : IXmlTransform()
|
||||
{
|
||||
m_pManifestFileInfo = pManifestFileInfo;
|
||||
m_algorithm = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
|
||||
}
|
||||
|
||||
virtual std::string Transform(const std::string& xml)
|
||||
{
|
||||
COOXMLRelationships _rels(xml, &m_arIds);
|
||||
return U_TO_UTF8(_rels.GetXml());
|
||||
}
|
||||
virtual std::string Transform(const std::string& xml)
|
||||
{
|
||||
COOXMLRelationships _rels(xml, m_pManifestFileInfo, &m_arIds);
|
||||
return U_TO_UTF8(_rels.GetXml());
|
||||
}
|
||||
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodesIds;
|
||||
node.GetChilds(oNodesIds);
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodesIds;
|
||||
node.GetChilds(oNodesIds);
|
||||
|
||||
int nCount = oNodesIds.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode _node;
|
||||
oNodesIds.GetAt(i, _node);
|
||||
int nCount = oNodesIds.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode _node;
|
||||
oNodesIds.GetAt(i, _node);
|
||||
|
||||
std::wstring sType = _node.GetAttribute("SourceId");
|
||||
if (!sType.empty())
|
||||
m_arIds.insert(std::pair<std::wstring, bool>(sType, true));
|
||||
}
|
||||
}
|
||||
std::wstring sType = _node.GetAttribute("SourceId");
|
||||
if (!sType.empty())
|
||||
m_arIds.insert(sType);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CXmlTransformC14N : public IXmlTransform
|
||||
{
|
||||
protected:
|
||||
int m_mode;
|
||||
bool m_comments;
|
||||
int m_mode;
|
||||
bool m_comments;
|
||||
|
||||
public:
|
||||
CXmlTransformC14N() : IXmlTransform()
|
||||
{
|
||||
m_mode = -1;
|
||||
m_comments = false;
|
||||
}
|
||||
CXmlTransformC14N() : IXmlTransform()
|
||||
{
|
||||
m_mode = -1;
|
||||
m_comments = false;
|
||||
}
|
||||
|
||||
bool CheckC14NTransform(const std::string& alg)
|
||||
{
|
||||
m_mode = -1;
|
||||
if ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_1_0;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_1_0;
|
||||
m_comments = true;
|
||||
}
|
||||
else if ("http://www.w3.org/2006/12/xml-c14n11" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_1_1;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/2006/12/xml-c14n11#WithComments" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_1_1;
|
||||
m_comments = true;
|
||||
}
|
||||
else if ("http://www.w3.org/2001/10/xml-exc-c14n#" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_EXCLUSIVE_1_0;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/2001/10/xml-exc-c14n#WithComments" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_EXCLUSIVE_1_0;
|
||||
m_comments = true;
|
||||
}
|
||||
return (-1 != m_mode) ? true : false;
|
||||
}
|
||||
bool CheckC14NTransform(const std::string& alg)
|
||||
{
|
||||
m_mode = -1;
|
||||
if ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_1_0;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_1_0;
|
||||
m_comments = true;
|
||||
}
|
||||
else if ("http://www.w3.org/2006/12/xml-c14n11" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_1_1;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/2006/12/xml-c14n11#WithComments" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_1_1;
|
||||
m_comments = true;
|
||||
}
|
||||
else if ("http://www.w3.org/2001/10/xml-exc-c14n#" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_EXCLUSIVE_1_0;
|
||||
m_comments = false;
|
||||
}
|
||||
else if ("http://www.w3.org/2001/10/xml-exc-c14n#WithComments" == alg)
|
||||
{
|
||||
m_mode = XmlUtils::XML_C14N_EXCLUSIVE_1_0;
|
||||
m_comments = true;
|
||||
}
|
||||
return (-1 != m_mode) ? true : false;
|
||||
}
|
||||
|
||||
virtual std::string Transform(const std::string& xml)
|
||||
{
|
||||
if (-1 == m_mode)
|
||||
return xml;
|
||||
return XmlUtils::NSXmlCanonicalizator::Execute(xml, m_mode, m_comments);
|
||||
}
|
||||
virtual std::string Transform(const std::string& xml)
|
||||
{
|
||||
if (-1 == m_mode)
|
||||
return xml;
|
||||
return XmlUtils::NSXmlCanonicalizator::Execute(xml, m_mode, m_comments);
|
||||
}
|
||||
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
// none
|
||||
XML_UNUSED(node);
|
||||
}
|
||||
virtual void LoadFromXml(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
// none
|
||||
XML_UNUSED(node);
|
||||
}
|
||||
};
|
||||
|
||||
class CXmlTransforms
|
||||
{
|
||||
protected:
|
||||
std::vector<IXmlTransform*> m_transforms;
|
||||
bool m_valid;
|
||||
std::vector<IXmlTransform*> m_transforms;
|
||||
bool m_valid;
|
||||
|
||||
public:
|
||||
CXmlTransforms()
|
||||
{
|
||||
m_valid = true;
|
||||
}
|
||||
CXmlTransforms()
|
||||
{
|
||||
m_valid = true;
|
||||
}
|
||||
|
||||
CXmlTransforms(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_valid = true;
|
||||
CXmlTransforms(XmlUtils::CXmlNode& node, CManifestFileInfo* pManifestInfo)
|
||||
{
|
||||
m_valid = true;
|
||||
|
||||
XmlUtils::CXmlNodes oNodes = node.GetNodes(L"Transform");
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode nodeTransform;
|
||||
oNodes.GetAt(i, nodeTransform);
|
||||
XmlUtils::CXmlNodes oNodes = node.GetNodes(L"Transform");
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode nodeTransform;
|
||||
oNodes.GetAt(i, nodeTransform);
|
||||
|
||||
IXmlTransform* pTransform = IXmlTransform::GetFromType(nodeTransform.GetAttributeA("Algorithm"));
|
||||
if (NULL == pTransform)
|
||||
{
|
||||
m_valid = false;
|
||||
return;
|
||||
}
|
||||
IXmlTransform* pTransform = IXmlTransform::GetFromType(nodeTransform.GetAttributeA("Algorithm"), pManifestInfo);
|
||||
if (NULL == pTransform)
|
||||
{
|
||||
m_valid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
pTransform->LoadFromXml(nodeTransform);
|
||||
m_transforms.push_back(pTransform);
|
||||
}
|
||||
}
|
||||
pTransform->LoadFromXml(nodeTransform);
|
||||
m_transforms.push_back(pTransform);
|
||||
}
|
||||
}
|
||||
|
||||
~CXmlTransforms()
|
||||
{
|
||||
for (std::vector<IXmlTransform*>::iterator i = m_transforms.begin(); i != m_transforms.end(); i++)
|
||||
{
|
||||
IXmlTransform* t = *i;
|
||||
RELEASEOBJECT(t);
|
||||
}
|
||||
m_transforms.clear();
|
||||
}
|
||||
~CXmlTransforms()
|
||||
{
|
||||
for (std::vector<IXmlTransform*>::iterator i = m_transforms.begin(); i != m_transforms.end(); i++)
|
||||
{
|
||||
IXmlTransform* t = *i;
|
||||
RELEASEOBJECT(t);
|
||||
}
|
||||
m_transforms.clear();
|
||||
}
|
||||
|
||||
bool GetValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
bool GetValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
std::string Transform(const std::string& xml)
|
||||
{
|
||||
std::string sResult = xml;
|
||||
for (std::vector<IXmlTransform*>::iterator i = m_transforms.begin(); i != m_transforms.end(); i++)
|
||||
{
|
||||
sResult = (*i)->Transform(sResult);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
std::string Transform(const std::string& xml)
|
||||
{
|
||||
std::string sResult = xml;
|
||||
for (std::vector<IXmlTransform*>::iterator i = m_transforms.begin(); i != m_transforms.end(); i++)
|
||||
{
|
||||
sResult = (*i)->Transform(sResult);
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
|
||||
void AddTransform(IXmlTransform* transform)
|
||||
{
|
||||
m_transforms.push_back(transform);
|
||||
}
|
||||
void AddTransform(IXmlTransform* transform)
|
||||
{
|
||||
m_transforms.push_back(transform);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_XML_TRANSFORM_H_
|
||||
|
||||
99
DesktopEditor/xmlsec/src/src/common.h
Normal file
99
DesktopEditor/xmlsec/src/src/common.h
Normal file
@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
|
||||
#include "./../include/CertificateCommon.h"
|
||||
#include "../../../../OfficeUtils/src/ZipFolder.h"
|
||||
#include "./XmlTransform.h"
|
||||
#include <cstdio>
|
||||
#include <ctime>
|
||||
#include <time.h>
|
||||
|
||||
class CSignFolderFiles
|
||||
{
|
||||
public:
|
||||
std::map<std::wstring, std::wstring> m_content_types;
|
||||
std::vector<std::wstring> m_rels;
|
||||
std::vector<std::wstring> m_files;
|
||||
|
||||
public:
|
||||
CSignFolderFiles() {}
|
||||
~CSignFolderFiles() {}
|
||||
|
||||
public:
|
||||
static bool CheckNeedSign(const std::wstring& sCheckFile)
|
||||
{
|
||||
if (0 == sCheckFile.find(L"_xmlsignatures") ||
|
||||
0 == sCheckFile.find(L"docProps") ||
|
||||
0 == sCheckFile.find(L"[Content_Types].xml") ||
|
||||
0 == sCheckFile.find(L"[trash]"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Folder_Parse(IFolder* pFolder, bool bIsAddSlash = false)
|
||||
{
|
||||
// 1) Parse files in directory
|
||||
std::vector<std::wstring> files = pFolder->getFiles(L"", true);
|
||||
|
||||
// 2) Check each file
|
||||
std::wstring sFolder = L"";
|
||||
for (std::vector<std::wstring>::iterator i = files.begin(); i != files.end(); i++)
|
||||
{
|
||||
std::wstring sCheckFile = *i;
|
||||
|
||||
// make cool filename
|
||||
sCheckFile = pFolder->getLocalFilePath(sCheckFile);
|
||||
|
||||
// check needed file
|
||||
if (!CheckNeedSign(sCheckFile))
|
||||
continue;
|
||||
|
||||
// check rels and add to needed array
|
||||
std::wstring::size_type posExt = sCheckFile.rfind(L".");
|
||||
if (std::wstring::npos == posExt)
|
||||
continue;
|
||||
|
||||
std::wstring sExt = sCheckFile.substr(posExt + 1);
|
||||
|
||||
if (bIsAddSlash)
|
||||
sCheckFile = L"/" + sCheckFile;
|
||||
|
||||
if (sExt == L"rels")
|
||||
m_rels.push_back(sCheckFile);
|
||||
else
|
||||
m_files.push_back(sCheckFile);
|
||||
}
|
||||
|
||||
std::sort(m_rels.begin(), m_rels.end());
|
||||
std::sort(m_files.begin(), m_files.end());
|
||||
}
|
||||
|
||||
void Folder_ParseContentTypes(IFolder* pFolder)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode = pFolder->getNodeFromFile(L"/[Content_Types].xml");
|
||||
|
||||
XmlUtils::CXmlNodes nodesDefaults;
|
||||
oNode.GetNodes(L"Default", nodesDefaults);
|
||||
|
||||
XmlUtils::CXmlNodes nodesOverrides;
|
||||
oNode.GetNodes(L"Override", nodesOverrides);
|
||||
|
||||
int nCount = nodesDefaults.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode node;
|
||||
nodesDefaults.GetAt(i, node);
|
||||
|
||||
m_content_types.insert(std::pair<std::wstring, std::wstring>(node.GetAttribute("Extension"), node.GetAttribute("ContentType")));
|
||||
}
|
||||
|
||||
nCount = nodesOverrides.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode node;
|
||||
nodesOverrides.GetAt(i, node);
|
||||
|
||||
m_content_types.insert(std::pair<std::wstring, std::wstring>(node.GetAttribute("PartName"), node.GetAttribute("ContentType")));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -57,23 +57,23 @@ namespace NSDjvu
|
||||
{
|
||||
static GUTF8String MakeUTF8String(const std::wstring& wsText)
|
||||
{
|
||||
std::string sText = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(wsText);
|
||||
GUTF8String utf8String(sText.c_str());
|
||||
return utf8String;
|
||||
std::string sText = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(wsText);
|
||||
GUTF8String utf8String(sText.c_str());
|
||||
return utf8String;
|
||||
}
|
||||
static std::string MakeCString(GUTF8String& strText)
|
||||
static std::string MakeCString(GUTF8String& strText)
|
||||
{
|
||||
std::string sString(strText.getbuf());
|
||||
return sString;
|
||||
return sString;
|
||||
}
|
||||
static int GetInteger(const std::wstring& wsString)
|
||||
static int GetInteger(const std::wstring& wsString)
|
||||
{
|
||||
if (wsString.size() < 1)
|
||||
return 0;
|
||||
|
||||
try
|
||||
{
|
||||
return std::stoi(wsString);
|
||||
return std::stoi(wsString);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -81,7 +81,7 @@ namespace NSDjvu
|
||||
|
||||
try
|
||||
{
|
||||
return static_cast<int>(std::stol(wsString));
|
||||
return static_cast<int>(std::stol(wsString));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@ -93,9 +93,9 @@ namespace NSDjvu
|
||||
CDjVuFileImplementation::CDjVuFileImplementation(NSFonts::IApplicationFonts* pFonts)
|
||||
{
|
||||
m_pDoc = NULL;
|
||||
m_wsTempDirectory = L"";
|
||||
SetTempDirectory(L"");
|
||||
m_pApplicationFonts = pFonts;
|
||||
m_wsTempDirectory = L"";
|
||||
SetTempDirectory(L"");
|
||||
m_pApplicationFonts = pFonts;
|
||||
}
|
||||
CDjVuFileImplementation::~CDjVuFileImplementation()
|
||||
{
|
||||
@ -105,7 +105,7 @@ CDjVuFileImplementation::~CDjVuFileImplementation()
|
||||
}
|
||||
NSFonts::IApplicationFonts* CDjVuFileImplementation::GetFonts()
|
||||
{
|
||||
return m_pApplicationFonts;
|
||||
return m_pApplicationFonts;
|
||||
}
|
||||
|
||||
bool CDjVuFileImplementation::LoadFromFile(const std::wstring& wsSrcFileName, const std::wstring& wsXMLOptions)
|
||||
@ -127,19 +127,19 @@ bool CDjVuFileImplementation::LoadFromFile(const std::wstring& wsSrcFileName, co
|
||||
}
|
||||
bool CDjVuFileImplementation::LoadFromMemory(BYTE* data, DWORD length, const std::wstring& wsXmlOptions)
|
||||
{
|
||||
m_pDoc = NULL;
|
||||
try
|
||||
{
|
||||
GP<ByteStream> stream = ByteStream::create(data, (size_t)length);
|
||||
m_pDoc = DjVuDocument::create(stream);
|
||||
m_pDoc->wait_get_pages_num();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_pDoc = NULL;
|
||||
try
|
||||
{
|
||||
GP<ByteStream> stream = ByteStream::create(data, (size_t)length);
|
||||
m_pDoc = DjVuDocument::create(stream);
|
||||
m_pDoc->wait_get_pages_num();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
void CDjVuFileImplementation::Close()
|
||||
{
|
||||
@ -151,14 +151,14 @@ std::wstring CDjVuFileImplementation::GetTempDirectory() const
|
||||
void CDjVuFileImplementation::SetTempDirectory(const std::wstring& wsDirectory)
|
||||
{
|
||||
#ifndef DISABLE_TEMP_DIRECTORY
|
||||
if (!m_wsTempDirectory.empty())
|
||||
NSDirectory::DeleteDirectory(m_wsTempDirectory);
|
||||
if (!m_wsTempDirectory.empty())
|
||||
NSDirectory::DeleteDirectory(m_wsTempDirectory);
|
||||
|
||||
m_wsTempDirectory = wsDirectory;
|
||||
if (m_wsTempDirectory.empty())
|
||||
m_wsTempDirectory = NSFile::CFileBinary::GetTempPath();
|
||||
m_wsTempDirectory = wsDirectory;
|
||||
if (m_wsTempDirectory.empty())
|
||||
m_wsTempDirectory = NSFile::CFileBinary::GetTempPath();
|
||||
|
||||
m_wsTempDirectory += L"/DJVU/";
|
||||
m_wsTempDirectory += L"/DJVU/";
|
||||
NSDirectory::CreateDirectory(m_wsTempDirectory);
|
||||
#endif
|
||||
}
|
||||
@ -193,14 +193,14 @@ void CDjVuFileImplementation::GetPageInfo(int nPageIndex, double* pdWidth, doubl
|
||||
*pdDpiX = pPage->get_dpi();
|
||||
*pdDpiY = pPage->get_dpi();
|
||||
#endif
|
||||
int nW = 0;
|
||||
int nH = 0;
|
||||
int nDpi = 0;
|
||||
m_pDoc->ReadPageInfo(nPageIndex, nW, nH, nDpi);
|
||||
*pdWidth = nW;
|
||||
*pdHeight = nH;
|
||||
*pdDpiX = nDpi;
|
||||
*pdDpiY = nDpi;
|
||||
int nW = 0;
|
||||
int nH = 0;
|
||||
int nDpi = 0;
|
||||
m_pDoc->ReadPageInfo(nPageIndex, nW, nH, nDpi);
|
||||
*pdWidth = nW;
|
||||
*pdHeight = nH;
|
||||
*pdDpiX = nDpi;
|
||||
*pdDpiY = nDpi;
|
||||
}
|
||||
void CDjVuFileImplementation::DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pBreak)
|
||||
{
|
||||
@ -217,14 +217,14 @@ void CDjVuFileImplementation::DrawPageOnRenderer(IRenderer* pRenderer, int nPag
|
||||
pRenderer->get_Type(&lRendererType);
|
||||
|
||||
#ifndef BUILDING_WASM_MODULE
|
||||
if (c_nPDFWriter == lRendererType)
|
||||
if (c_nPDFWriter == lRendererType)
|
||||
{
|
||||
XmlUtils::CXmlNode oText = ParseText(pPage);
|
||||
CreatePdfFrame(pRenderer, pPage, nPageIndex, oText);
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif
|
||||
{
|
||||
{
|
||||
XmlUtils::CXmlNode oText = ParseText(pPage);
|
||||
CreateFrame(pRenderer, pPage, nPageIndex, oText);
|
||||
}
|
||||
@ -236,8 +236,8 @@ void CDjVuFileImplementation::DrawPageOnRenderer(IRenderer* pRenderer, int nPag
|
||||
}
|
||||
void CDjVuFileImplementation::ConvertToPdf(const std::wstring& wsDstPath)
|
||||
{
|
||||
CPdfFile oPdf(m_pApplicationFonts);
|
||||
oPdf.CreatePdf();
|
||||
CPdfFile oPdf(m_pApplicationFonts);
|
||||
oPdf.CreatePdf();
|
||||
|
||||
bool bBreak = false;
|
||||
for (int nPageIndex = 0, nPagesCount = GetPagesCount(); nPageIndex < nPagesCount; nPageIndex++)
|
||||
@ -262,166 +262,166 @@ void CDjVuFileImplementation::ConvertToPdf(const std::wstring& wsDstPath)
|
||||
}
|
||||
std::wstring CDjVuFileImplementation::GetInfo()
|
||||
{
|
||||
std::wstring sRes = L"{";
|
||||
std::wstring sRes = L"{";
|
||||
|
||||
double nW = 0;
|
||||
double nH = 0;
|
||||
double nDpi = 0;
|
||||
GetPageInfo(0, &nW, &nH, &nDpi, &nDpi);
|
||||
sRes += L"\"PageWidth\":";
|
||||
sRes += std::to_wstring((int)(nW * 100));
|
||||
sRes += L",\"PageHeight\":";
|
||||
sRes += std::to_wstring((int)(nH * 100));
|
||||
sRes += L",\"NumberOfPages\":";
|
||||
sRes += std::to_wstring(GetPagesCount());
|
||||
sRes += L"}";
|
||||
double nW = 0;
|
||||
double nH = 0;
|
||||
double nDpi = 0;
|
||||
GetPageInfo(0, &nW, &nH, &nDpi, &nDpi);
|
||||
sRes += L"\"PageWidth\":";
|
||||
sRes += std::to_wstring((int)(nW * 100));
|
||||
sRes += L",\"PageHeight\":";
|
||||
sRes += std::to_wstring((int)(nH * 100));
|
||||
sRes += L",\"NumberOfPages\":";
|
||||
sRes += std::to_wstring(GetPagesCount());
|
||||
sRes += L"}";
|
||||
|
||||
return sRes;
|
||||
return sRes;
|
||||
}
|
||||
|
||||
void getBookmars(const GP<DjVmNav>& nav, int& pos, int count, NSWasm::CData& out, int level)
|
||||
{
|
||||
while (count > 0 && pos < nav->getBookMarkCount())
|
||||
{
|
||||
GP<DjVmNav::DjVuBookMark> gpBookMark;
|
||||
nav->getBookMark(gpBookMark, pos++);
|
||||
while (count > 0 && pos < nav->getBookMarkCount())
|
||||
{
|
||||
GP<DjVmNav::DjVuBookMark> gpBookMark;
|
||||
nav->getBookMark(gpBookMark, pos++);
|
||||
|
||||
GUTF8String str = gpBookMark->url;
|
||||
int endpos;
|
||||
DWORD nPage = str.toULong(1, endpos) - 1;
|
||||
if (endpos == (int)str.length())
|
||||
{
|
||||
out.AddInt(nPage);
|
||||
out.AddInt(level);
|
||||
out.AddDouble(0.0);
|
||||
GUTF8String description = gpBookMark->displayname;
|
||||
out.WriteString((BYTE*)description.getbuf(), description.length());
|
||||
}
|
||||
GUTF8String str = gpBookMark->url;
|
||||
int endpos;
|
||||
DWORD nPage = str.toULong(1, endpos) - 1;
|
||||
if (endpos == (int)str.length())
|
||||
{
|
||||
out.AddInt(nPage);
|
||||
out.AddInt(level);
|
||||
out.AddDouble(0.0);
|
||||
GUTF8String description = gpBookMark->displayname;
|
||||
out.WriteString((BYTE*)description.getbuf(), description.length());
|
||||
}
|
||||
|
||||
getBookmars(nav, pos, gpBookMark->count, out, level + 1);
|
||||
count--;
|
||||
}
|
||||
getBookmars(nav, pos, gpBookMark->count, out, level + 1);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
BYTE* CDjVuFileImplementation::GetStructure()
|
||||
{
|
||||
GP<DjVmNav> nav = m_pDoc->get_djvm_nav();
|
||||
if (!nav)
|
||||
return NULL;
|
||||
GP<DjVmNav> nav = m_pDoc->get_djvm_nav();
|
||||
if (!nav)
|
||||
return NULL;
|
||||
|
||||
int pos = 0;
|
||||
int count = nav->getBookMarkCount();
|
||||
if (count <= 0)
|
||||
return NULL;
|
||||
int pos = 0;
|
||||
int count = nav->getBookMarkCount();
|
||||
if (count <= 0)
|
||||
return NULL;
|
||||
|
||||
NSWasm::CData oRes;
|
||||
oRes.SkipLen();
|
||||
getBookmars(nav, pos, count, oRes, 1);
|
||||
oRes.WriteLen();
|
||||
BYTE* bRes = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
return bRes;
|
||||
NSWasm::CData oRes;
|
||||
oRes.SkipLen();
|
||||
getBookmars(nav, pos, count, oRes, 1);
|
||||
oRes.WriteLen();
|
||||
BYTE* bRes = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
return bRes;
|
||||
}
|
||||
BYTE* CDjVuFileImplementation::GetPageGlyphs(int nPageIndex)
|
||||
{
|
||||
return NULL;
|
||||
try
|
||||
{
|
||||
GP<DjVuImage> pPage = m_pDoc->get_page(nPageIndex);
|
||||
const GP<DjVuText> text(DjVuText::create());
|
||||
const GP<ByteStream> text_str(pPage->get_text());
|
||||
if (!text_str)
|
||||
return NULL;
|
||||
text->decode(text_str);
|
||||
return NULL;
|
||||
try
|
||||
{
|
||||
GP<DjVuImage> pPage = m_pDoc->get_page(nPageIndex);
|
||||
const GP<DjVuText> text(DjVuText::create());
|
||||
const GP<ByteStream> text_str(pPage->get_text());
|
||||
if (!text_str)
|
||||
return NULL;
|
||||
text->decode(text_str);
|
||||
|
||||
GUTF8String pageText = text->get_xmlText(pPage->get_height());
|
||||
XmlUtils::CXmlNode hiddenText;
|
||||
XmlUtils::CXmlNode pageColumn;
|
||||
XmlUtils::CXmlNode region;
|
||||
hiddenText.FromXmlStringA(NSDjvu::MakeCString(pageText));
|
||||
hiddenText.GetNode(L"PAGECOLUMN", pageColumn);
|
||||
pageColumn.GetNode(L"REGION", region);
|
||||
GUTF8String pageText = text->get_xmlText(pPage->get_height());
|
||||
XmlUtils::CXmlNode hiddenText;
|
||||
XmlUtils::CXmlNode pageColumn;
|
||||
XmlUtils::CXmlNode region;
|
||||
hiddenText.FromXmlStringA(NSDjvu::MakeCString(pageText));
|
||||
hiddenText.GetNode(L"PAGECOLUMN", pageColumn);
|
||||
pageColumn.GetNode(L"REGION", region);
|
||||
|
||||
NSWasm::CData oRes;
|
||||
oRes.SkipLen();
|
||||
XmlUtils::CXmlNodes oParagraphsNodes;
|
||||
region.GetNodes(L"PARAGRAPH", oParagraphsNodes);
|
||||
for (int nParagraphIndex = 0; nParagraphIndex < oParagraphsNodes.GetCount(); nParagraphIndex++)
|
||||
{
|
||||
XmlUtils::CXmlNode oParagraphNode;
|
||||
oParagraphsNodes.GetAt(nParagraphIndex, oParagraphNode);
|
||||
XmlUtils::CXmlNodes oLinesNodes;
|
||||
oParagraphNode.GetNodes(L"LINE", oLinesNodes);
|
||||
for (int nLineIndex = 0; nLineIndex < oLinesNodes.GetCount(); nLineIndex++)
|
||||
{
|
||||
XmlUtils::CXmlNode oLineNode;
|
||||
oLinesNodes.GetAt(nLineIndex, oLineNode);
|
||||
XmlUtils::CXmlNodes oWordsNodes;
|
||||
oLineNode.GetNodes(L"WORD", oWordsNodes);
|
||||
for (int nWordIndex = 0; nWordIndex < oWordsNodes.GetCount(); nWordIndex++)
|
||||
{
|
||||
XmlUtils::CXmlNode oWordNode;
|
||||
oWordsNodes.GetAt(nWordIndex, oWordNode);
|
||||
std::wstring csWord = oWordNode.GetText();
|
||||
std::wstring csCoords = oWordNode.GetAttribute(L"coords");
|
||||
double arrCoords[4];
|
||||
ParseCoords(csCoords, arrCoords, 1);
|
||||
NSWasm::CData oRes;
|
||||
oRes.SkipLen();
|
||||
XmlUtils::CXmlNodes oParagraphsNodes;
|
||||
region.GetNodes(L"PARAGRAPH", oParagraphsNodes);
|
||||
for (int nParagraphIndex = 0; nParagraphIndex < oParagraphsNodes.GetCount(); nParagraphIndex++)
|
||||
{
|
||||
XmlUtils::CXmlNode oParagraphNode;
|
||||
oParagraphsNodes.GetAt(nParagraphIndex, oParagraphNode);
|
||||
XmlUtils::CXmlNodes oLinesNodes;
|
||||
oParagraphNode.GetNodes(L"LINE", oLinesNodes);
|
||||
for (int nLineIndex = 0; nLineIndex < oLinesNodes.GetCount(); nLineIndex++)
|
||||
{
|
||||
XmlUtils::CXmlNode oLineNode;
|
||||
oLinesNodes.GetAt(nLineIndex, oLineNode);
|
||||
XmlUtils::CXmlNodes oWordsNodes;
|
||||
oLineNode.GetNodes(L"WORD", oWordsNodes);
|
||||
for (int nWordIndex = 0; nWordIndex < oWordsNodes.GetCount(); nWordIndex++)
|
||||
{
|
||||
XmlUtils::CXmlNode oWordNode;
|
||||
oWordsNodes.GetAt(nWordIndex, oWordNode);
|
||||
std::wstring csWord = oWordNode.GetText();
|
||||
std::wstring csCoords = oWordNode.GetAttribute(L"coords");
|
||||
double arrCoords[4];
|
||||
ParseCoords(csCoords, arrCoords, 1);
|
||||
|
||||
std::string sText = U_TO_UTF8(csWord);
|
||||
oRes.WriteString((BYTE*)sText.c_str(), sText.length());
|
||||
oRes.AddDouble(arrCoords[0]);
|
||||
oRes.AddDouble(arrCoords[3]);
|
||||
oRes.AddDouble(arrCoords[2] - arrCoords[0]);
|
||||
oRes.AddDouble(arrCoords[1] - arrCoords[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
oRes.WriteLen();
|
||||
std::string sText = U_TO_UTF8(csWord);
|
||||
oRes.WriteString((BYTE*)sText.c_str(), sText.length());
|
||||
oRes.AddDouble(arrCoords[0]);
|
||||
oRes.AddDouble(arrCoords[3]);
|
||||
oRes.AddDouble(arrCoords[2] - arrCoords[0]);
|
||||
oRes.AddDouble(arrCoords[1] - arrCoords[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
oRes.WriteLen();
|
||||
|
||||
BYTE* res = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
return res;
|
||||
}
|
||||
catch (...) {}
|
||||
return NULL;
|
||||
BYTE* res = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
return res;
|
||||
}
|
||||
catch (...) {}
|
||||
return NULL;
|
||||
}
|
||||
BYTE* CDjVuFileImplementation::GetPageLinks(int nPageIndex)
|
||||
{
|
||||
double dPageDpiX, dPageDpiY;
|
||||
double dWidth, dHeight;
|
||||
GetPageInfo(nPageIndex, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY);
|
||||
double dPageDpiX, dPageDpiY;
|
||||
double dWidth, dHeight;
|
||||
GetPageInfo(nPageIndex, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY);
|
||||
|
||||
try
|
||||
{
|
||||
GP<DjVuImage> pPage = m_pDoc->get_page(nPageIndex);
|
||||
pPage->wait_for_complete_decode();
|
||||
GP<DjVuAnno> pAnno = pPage->get_decoded_anno();
|
||||
if (!pAnno)
|
||||
return NULL;
|
||||
GPList<GMapArea> map_areas = pAnno->ant->map_areas;
|
||||
try
|
||||
{
|
||||
GP<DjVuImage> pPage = m_pDoc->get_page(nPageIndex);
|
||||
pPage->wait_for_complete_decode();
|
||||
GP<DjVuAnno> pAnno = pPage->get_decoded_anno();
|
||||
if (!pAnno)
|
||||
return NULL;
|
||||
GPList<GMapArea> map_areas = pAnno->ant->map_areas;
|
||||
|
||||
NSWasm::CData oRes;
|
||||
oRes.SkipLen();
|
||||
for (GPosition pos(map_areas); pos; ++pos)
|
||||
{
|
||||
GUTF8String str = map_areas[pos]->url;
|
||||
oRes.WriteString((BYTE*)str.getbuf(), str.length());
|
||||
// Верхний левый угол
|
||||
double x = map_areas[pos]->get_xmin();
|
||||
double y = dHeight - map_areas[pos]->get_ymax();
|
||||
oRes.AddDouble(0.0);
|
||||
oRes.AddDouble(x);
|
||||
oRes.AddDouble(y);
|
||||
oRes.AddDouble(map_areas[pos]->get_xmax() - x);
|
||||
oRes.AddDouble(map_areas[pos]->get_ymax() - map_areas[pos]->get_ymin());
|
||||
}
|
||||
oRes.WriteLen();
|
||||
NSWasm::CData oRes;
|
||||
oRes.SkipLen();
|
||||
for (GPosition pos(map_areas); pos; ++pos)
|
||||
{
|
||||
GUTF8String str = map_areas[pos]->url;
|
||||
oRes.WriteString((BYTE*)str.getbuf(), str.length());
|
||||
// Верхний левый угол
|
||||
double x = map_areas[pos]->get_xmin();
|
||||
double y = dHeight - map_areas[pos]->get_ymax();
|
||||
oRes.AddDouble(0.0);
|
||||
oRes.AddDouble(x);
|
||||
oRes.AddDouble(y);
|
||||
oRes.AddDouble(map_areas[pos]->get_xmax() - x);
|
||||
oRes.AddDouble(map_areas[pos]->get_ymax() - map_areas[pos]->get_ymin());
|
||||
}
|
||||
oRes.WriteLen();
|
||||
|
||||
BYTE* res = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
return res;
|
||||
}
|
||||
catch (...) {}
|
||||
return NULL;
|
||||
BYTE* res = oRes.GetBuffer();
|
||||
oRes.ClearWithoutAttack();
|
||||
return res;
|
||||
}
|
||||
catch (...) {}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& pPage, int nPage, XmlUtils::CXmlNode& text)
|
||||
@ -467,7 +467,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& p
|
||||
}
|
||||
else if (c_nHtmlRendrerer == lRendererType)
|
||||
{
|
||||
// TODO: Нужно реализовать функцию
|
||||
// TODO: Нужно реализовать функцию
|
||||
// pRenderer->GetMaxImageSize();
|
||||
//VARIANT var;
|
||||
//renderer->GetAdditionalParam(L"MaxImageSize", &var);
|
||||
@ -492,10 +492,13 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& p
|
||||
if (!pBufferDst)
|
||||
return;
|
||||
|
||||
bool bIsInit = false;
|
||||
|
||||
Aggplus::CImage oImage;
|
||||
oImage.Create(pBufferDst, lImageWidth, lImageHeight, 4 * lImageWidth);
|
||||
if (pPage->is_legal_photo() || pPage->is_legal_compound())
|
||||
{
|
||||
bIsInit = true;
|
||||
GRect oRectAll(0, 0, lImageWidth, lImageHeight);
|
||||
GP<GPixmap> pImage = pPage->get_pixmap(oRectAll, oRectAll);
|
||||
|
||||
@ -515,11 +518,12 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& p
|
||||
}
|
||||
else if (pPage->is_legal_bilevel())
|
||||
{
|
||||
bIsInit = true;
|
||||
GRect oRectAll(0, 0, lImageWidth, lImageHeight);
|
||||
GP<GBitmap> pBitmap = pPage->get_bitmap(oRectAll, oRectAll, 4);
|
||||
int nPaletteEntries = pBitmap->get_grays();
|
||||
|
||||
unsigned int* palette = new unsigned int[nPaletteEntries];
|
||||
unsigned int* palette = new unsigned int[nPaletteEntries];
|
||||
|
||||
// Create palette for the bitmap
|
||||
int color = 0xff0000;
|
||||
@ -531,7 +535,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& p
|
||||
color -= decrement;
|
||||
}
|
||||
|
||||
unsigned int* pBuffer = (unsigned int*)pBufferDst;
|
||||
unsigned int* pBuffer = (unsigned int*)pBufferDst;
|
||||
for (int j = lImageHeight - 1; j >= 0; --j)
|
||||
{
|
||||
BYTE* pLine = pBitmap->operator [](j);
|
||||
@ -560,6 +564,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& p
|
||||
|
||||
if (NULL != pImage)
|
||||
{
|
||||
bIsInit = true;
|
||||
BYTE* pBuffer = pBufferDst;
|
||||
for (int j = lImageHeight - 1; j >= 0; --j)
|
||||
{
|
||||
@ -580,9 +585,10 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& p
|
||||
|
||||
if (NULL != pBitmap)
|
||||
{
|
||||
bIsInit = true;
|
||||
int nPaletteEntries = pBitmap->get_grays();
|
||||
|
||||
unsigned int* palette = new unsigned int[nPaletteEntries];
|
||||
unsigned int* palette = new unsigned int[nPaletteEntries];
|
||||
|
||||
// Create palette for the bitmap
|
||||
int color = 0xff0000;
|
||||
@ -594,7 +600,7 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& p
|
||||
color -= decrement;
|
||||
}
|
||||
|
||||
unsigned int* pBuffer = (unsigned int*)pBufferDst;
|
||||
unsigned int* pBuffer = (unsigned int*)pBufferDst;
|
||||
for (int j = lImageHeight - 1; j >= 0; --j)
|
||||
{
|
||||
BYTE* pLine = pBitmap->operator [](j);
|
||||
@ -624,7 +630,8 @@ void CDjVuFileImplementation::CreateFrame(IRenderer* pRenderer, GP<DjVuImage>& p
|
||||
TextToRenderer(pRenderer, text, dPixToMM / nDpi);
|
||||
}
|
||||
|
||||
pRenderer->DrawImage((IGrObject*)&oImage, 0, 0, dRendWidth, dRendHeight);
|
||||
if (bIsInit)
|
||||
pRenderer->DrawImage((IGrObject*)&oImage, 0, 0, dRendWidth, dRendHeight);
|
||||
pRenderer->EndCommand(c_nPageType);
|
||||
}
|
||||
void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer, GP<DjVuImage>& pPage, int nPageIndex, XmlUtils::CXmlNode& oText)
|
||||
@ -738,42 +745,42 @@ void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer, GP<DjVuImage>
|
||||
|
||||
GP<GBitmap> pBitmap = pPage->get_bitmap(oRectAll, oRectAll, 4);
|
||||
|
||||
NSImages::CPixJbig2 oPix;
|
||||
if (oPix.Create(lImageWidth, lImageHeight, 1))
|
||||
NSImages::CPixJbig2 oPix;
|
||||
if (oPix.Create(lImageWidth, lImageHeight, 1))
|
||||
{
|
||||
for (int nY = 0; nY < lImageHeight; nY++)
|
||||
{
|
||||
BYTE* pLine = pBitmap->operator [](nY);
|
||||
for (int nX = 0; nX < lImageWidth; nX++, pLine++)
|
||||
{
|
||||
oPix.SetPixel(nX, lImageHeight - 1 - nY, *pLine);
|
||||
oPix.SetPixel(nX, lImageHeight - 1 - nY, *pLine);
|
||||
}
|
||||
}
|
||||
|
||||
pPdf->DrawImageWith1bppMask((IGrObject*)&oImage, &oPix, lImageWidth, lImageHeight, 0, 0, dWidth, dHeight);
|
||||
oPix.Destroy();
|
||||
pPdf->DrawImageWith1bppMask((IGrObject*)&oImage, &oPix, lImageWidth, lImageHeight, 0, 0, dWidth, dHeight);
|
||||
oPix.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pPage->is_legal_bilevel())
|
||||
{
|
||||
GRect oRectAll(0, 0, lImageWidth, lImageHeight);
|
||||
GP<GBitmap> pBitmap = pPage->get_bitmap(oRectAll, oRectAll, 4);
|
||||
|
||||
NSImages::CPixJbig2 oPix;
|
||||
if (oPix.Create(lImageWidth, lImageHeight, 1))
|
||||
NSImages::CPixJbig2 oPix;
|
||||
if (oPix.Create(lImageWidth, lImageHeight, 1))
|
||||
{
|
||||
for (int nY = 0; nY < lImageHeight; nY++)
|
||||
{
|
||||
BYTE* pLine = pBitmap->operator [](nY);
|
||||
for (int nX = 0; nX < lImageWidth; nX++, pLine++)
|
||||
{
|
||||
oPix.SetPixel(nX, lImageHeight - 1 - nY, *pLine);
|
||||
oPix.SetPixel(nX, lImageHeight - 1 - nY, *pLine);
|
||||
}
|
||||
}
|
||||
|
||||
pPdf->DrawImage1bpp(&oPix, lImageWidth, lImageHeight, 0, 0, dWidth, dHeight);
|
||||
oPix.Destroy();
|
||||
pPdf->DrawImage1bpp(&oPix, lImageWidth, lImageHeight, 0, 0, dWidth, dHeight);
|
||||
oPix.Destroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -815,20 +822,20 @@ void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer, GP<DjVuImage>
|
||||
int nPaletteEntries = pBitmap->get_grays();
|
||||
if (nPaletteEntries <= 2)
|
||||
{
|
||||
NSImages::CPixJbig2 oPix;
|
||||
if (oPix.Create(lImageWidth, lImageHeight, 1))
|
||||
NSImages::CPixJbig2 oPix;
|
||||
if (oPix.Create(lImageWidth, lImageHeight, 1))
|
||||
{
|
||||
for (int nY = 0; nY < lImageHeight; nY++)
|
||||
{
|
||||
BYTE* pLine = pBitmap->operator [](nY);
|
||||
for (int nX = 0; nX < lImageWidth; nX++, pLine++)
|
||||
{
|
||||
oPix.Create(nX, lImageHeight - 1 - nY, *pLine);
|
||||
oPix.Create(nX, lImageHeight - 1 - nY, *pLine);
|
||||
}
|
||||
}
|
||||
|
||||
pPdf->DrawImage1bpp(&oPix, lImageWidth, lImageHeight, 0, 0, dWidth, dHeight);
|
||||
oPix.Destroy();
|
||||
pPdf->DrawImage1bpp(&oPix, lImageWidth, lImageHeight, 0, 0, dWidth, dHeight);
|
||||
oPix.Destroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -840,7 +847,7 @@ void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer, GP<DjVuImage>
|
||||
Aggplus::CImage oImage;
|
||||
oImage.Create(pBufferDst, lImageWidth, lImageHeight, 4 * lImageWidth);
|
||||
|
||||
unsigned int* palette = new unsigned int[nPaletteEntries];
|
||||
unsigned int* palette = new unsigned int[nPaletteEntries];
|
||||
|
||||
// Create palette for the bitmap
|
||||
int color = 0xff0000;
|
||||
@ -852,7 +859,7 @@ void CDjVuFileImplementation::CreatePdfFrame(IRenderer* pRenderer, GP<DjVuImage>
|
||||
color -= decrement;
|
||||
}
|
||||
|
||||
unsigned int* pBuffer = (unsigned int*)pBufferDst;
|
||||
unsigned int* pBuffer = (unsigned int*)pBufferDst;
|
||||
for (int j = lImageHeight - 1; j >= 0; --j)
|
||||
{
|
||||
BYTE* pLine = pBitmap->operator [](j);
|
||||
@ -892,10 +899,10 @@ XmlUtils::CXmlNode CDjVuFileImplementation::ParseText(GP<DjVuImage> pPage)
|
||||
XmlUtils::CXmlNode hiddenText;
|
||||
XmlUtils::CXmlNode pageColumn;
|
||||
XmlUtils::CXmlNode region;
|
||||
hiddenText.FromXmlStringA(NSDjvu::MakeCString(pageText));
|
||||
hiddenText.GetNode(L"PAGECOLUMN", pageColumn);
|
||||
pageColumn.GetNode(L"REGION", region);
|
||||
region.GetNode(L"PARAGRAPH", paragraph);
|
||||
hiddenText.FromXmlStringA(NSDjvu::MakeCString(pageText));
|
||||
hiddenText.GetNode(L"PAGECOLUMN", pageColumn);
|
||||
pageColumn.GetNode(L"REGION", region);
|
||||
region.GetNode(L"PARAGRAPH", paragraph);
|
||||
}
|
||||
return paragraph;
|
||||
}
|
||||
@ -903,7 +910,7 @@ void CDjVuFileImplementation::TextToRenderer(IRenderer* pRenderer, XmlUtils::CXm
|
||||
{
|
||||
// Выставим шрифт пустой (чтобы растягивать по всему ректу)
|
||||
pRenderer->put_FontName(L"DjvuEmptyFont");
|
||||
//std::wstring csText = oTextNode.GetXml();
|
||||
//std::wstring csText = oTextNode.GetXml();
|
||||
XmlUtils::CXmlNodes oLinesNodes;
|
||||
oTextNode.GetNodes(L"LINE", oLinesNodes);
|
||||
for (int nLineIndex = 0; nLineIndex < oLinesNodes.GetCount(); ++nLineIndex)
|
||||
@ -916,11 +923,11 @@ void CDjVuFileImplementation::TextToRenderer(IRenderer* pRenderer, XmlUtils::CXm
|
||||
{
|
||||
XmlUtils::CXmlNode oWordNode;
|
||||
oWordsNodes.GetAt(nWordIndex, oWordNode);
|
||||
std::wstring csWord = oWordNode.GetText();
|
||||
std::wstring csCoords = oWordNode.GetAttribute(L"coords");
|
||||
std::wstring csWord = oWordNode.GetText();
|
||||
std::wstring csCoords = oWordNode.GetAttribute(L"coords");
|
||||
double arrCoords[4];
|
||||
ParseCoords(csCoords, arrCoords, dKoef);
|
||||
DrawPageText(pRenderer, arrCoords, csWord);
|
||||
ParseCoords(csCoords, arrCoords, dKoef);
|
||||
DrawPageText(pRenderer, arrCoords, csWord);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -929,13 +936,13 @@ void CDjVuFileImplementation::DrawPageText(IRenderer* pRenderer, double* pdCoord
|
||||
pRenderer->put_FontSize(pdCoords[1] - pdCoords[3]);
|
||||
pRenderer->CommandDrawText(wsText,
|
||||
(float)(pdCoords[0]),
|
||||
(float)(pdCoords[3]),
|
||||
(float)(pdCoords[2] - pdCoords[0]),
|
||||
(float)(pdCoords[1] - pdCoords[3]));
|
||||
(float)(pdCoords[3]),
|
||||
(float)(pdCoords[2] - pdCoords[0]),
|
||||
(float)(pdCoords[1] - pdCoords[3]));
|
||||
}
|
||||
void CDjVuFileImplementation::ParseCoords(const std::wstring& wsCoordsStr, double* pdCoords, double dKoef)
|
||||
{
|
||||
std::vector<std::wstring> vCoords = NSStringExt::Split(wsCoordsStr, L',');
|
||||
std::vector<std::wstring> vCoords = NSStringExt::Split(wsCoordsStr, L',');
|
||||
if (vCoords.size() >= 4)
|
||||
{
|
||||
for (int nIndex = 0; nIndex < 4; nIndex++)
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#include "../DesktopEditor/graphics/pro/officedrawingfile.h"
|
||||
#include "../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
#include "src/logic/elements/Paragraph.h"
|
||||
#include "./convert_params.h"
|
||||
|
||||
#ifndef DOCXRENDERER_USE_DYNAMIC_LIBRARY
|
||||
#define DOCXRENDERER_DECL_EXPORT
|
||||
|
||||
44
DocxRenderer/convert_params.h
Normal file
44
DocxRenderer/convert_params.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
enum TextAssociationType
|
||||
{
|
||||
tatBlockChar = 0, // Каждый символ во фрейме
|
||||
tatBlockLine = 1, // Каждая линия - параграф во фрейме. Линии могут объединяться в рамках одного блока.
|
||||
tatPlainLine = 2, // Каждая линия - параграф обычный
|
||||
tatShapeLine = 3, // Каждая линия - параграф в шейпе. Линии могут объединяться в рамках одного блока.
|
||||
tatPlainParagraph = 4 // Линии объединяются в параграфы
|
||||
};
|
||||
}
|
||||
@ -285,6 +285,9 @@ namespace NSDocxRenderer
|
||||
pShape->GetDataFromVector(m_oVector);
|
||||
|
||||
m_arShapes.push_back(pShape);
|
||||
|
||||
double dDeterminant = sqrt(fabs(m_pTransform->Determinant()));
|
||||
pShape->m_oPen.Size *= dDeterminant;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,18 +1,10 @@
|
||||
#pragma once
|
||||
#include "BaseItem.h"
|
||||
#include "TextLine.h"
|
||||
#include "../../../convert_params.h"
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
enum TextAssociationType
|
||||
{
|
||||
tatBlockChar = 0, // Каждый символ во фрейме
|
||||
tatBlockLine = 1, // Каждая линия - параграф во фрейме. Линии могут объединяться в рамках одного блока.
|
||||
tatPlainLine = 2, // Каждая линия - параграф обычный
|
||||
tatShapeLine = 3, // Каждая линия - параграф в шейпе. Линии могут объединяться в рамках одного блока.
|
||||
tatPlainParagraph = 4 // Линии объединяются в параграфы
|
||||
};
|
||||
|
||||
class CParagraph : public CBaseItem
|
||||
{
|
||||
public:
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
#include "../../DesktopEditor/graphics/pro/Graphics.h"
|
||||
#include "../../DesktopEditor/fontengine/ApplicationFontsWorker.h"
|
||||
|
||||
#include "../../PdfReader/PdfReader.h"
|
||||
#include "../../PdfFile/PdfFile.h"
|
||||
#include "../../DjVuFile/DjVu.h"
|
||||
#include "../../XpsFile/XpsFile.h"
|
||||
#include "../DocxRenderer.h"
|
||||
@ -55,136 +55,136 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef TEST_XML_BOM
|
||||
std::wstring sFileXmlSrc = L"PATH_TO_SRC_XML";
|
||||
std::wstring sFileXmlDst = L"PATH_TO_DST_XML";
|
||||
std::wstring sFileXmlSrc = L"PATH_TO_SRC_XML";
|
||||
std::wstring sFileXmlDst = L"PATH_TO_DST_XML";
|
||||
|
||||
BYTE* pBufferXml = NULL;
|
||||
DWORD lBufferXmlLen = 0;
|
||||
NSFile::CFileBinary::ReadAllBytes(sFileXmlSrc, &pBufferXml, lBufferXmlLen);
|
||||
BYTE* pBufferXml = NULL;
|
||||
DWORD lBufferXmlLen = 0;
|
||||
NSFile::CFileBinary::ReadAllBytes(sFileXmlSrc, &pBufferXml, lBufferXmlLen);
|
||||
|
||||
std::string sUtf8 = XmlUtils::GetUtf8FromFileContent(pBufferXml, lBufferXmlLen);
|
||||
std::wstring sUnicode = UTF8_TO_U(sUtf8);
|
||||
std::string sUtf8 = XmlUtils::GetUtf8FromFileContent(pBufferXml, lBufferXmlLen);
|
||||
std::wstring sUnicode = UTF8_TO_U(sUtf8);
|
||||
|
||||
NSFile::CFileBinary::SaveToFile(sFileXmlDst, sUnicode, true);
|
||||
NSFile::CFileBinary::SaveToFile(sFileXmlDst, sUnicode, true);
|
||||
|
||||
RELEASEARRAYOBJECTS(pBufferXml);
|
||||
RELEASEARRAYOBJECTS(pBufferXml);
|
||||
#endif
|
||||
|
||||
CApplicationFontsWorker oWorker;
|
||||
oWorker.m_sDirectory = NSFile::GetProcessDirectory() + L"/fonts_cache";
|
||||
oWorker.m_bIsNeedThumbnails = false;
|
||||
CApplicationFontsWorker oWorker;
|
||||
oWorker.m_sDirectory = NSFile::GetProcessDirectory() + L"/fonts_cache";
|
||||
oWorker.m_bIsNeedThumbnails = false;
|
||||
|
||||
if (!NSDirectory::Exists(oWorker.m_sDirectory))
|
||||
NSDirectory::CreateDirectory(oWorker.m_sDirectory);
|
||||
if (!NSDirectory::Exists(oWorker.m_sDirectory))
|
||||
NSDirectory::CreateDirectory(oWorker.m_sDirectory);
|
||||
|
||||
NSFonts::IApplicationFonts* pFonts = oWorker.Check();
|
||||
NSFonts::IApplicationFonts* pFonts = oWorker.Check();
|
||||
|
||||
std::wstring sTempDir = NSFile::GetProcessDirectory() + L"/temp";
|
||||
std::wstring sTempDirOut = NSFile::GetProcessDirectory() + L"/temp/output";
|
||||
std::wstring sTempDir = NSFile::GetProcessDirectory() + L"/temp";
|
||||
std::wstring sTempDirOut = NSFile::GetProcessDirectory() + L"/temp/output";
|
||||
|
||||
if (!NSDirectory::Exists(sTempDir))
|
||||
NSDirectory::CreateDirectory(sTempDir);
|
||||
if (!NSDirectory::Exists(sTempDirOut))
|
||||
NSDirectory::CreateDirectory(sTempDirOut);
|
||||
if (!NSDirectory::Exists(sTempDir))
|
||||
NSDirectory::CreateDirectory(sTempDir);
|
||||
if (!NSDirectory::Exists(sTempDirOut))
|
||||
NSDirectory::CreateDirectory(sTempDirOut);
|
||||
|
||||
//Добавляем все файлы из определенного каталога
|
||||
//std::vector<std::wstring> sSourceFiles = NSDirectory::GetFiles(L"C:\\Folder");
|
||||
std::vector<std::wstring> sSourceFiles;
|
||||
//Или добавляем любой нужный файл
|
||||
//sSourceFiles.push_back(L"C:\\File.pdf");
|
||||
//Добавляем все файлы из определенного каталога
|
||||
//std::vector<std::wstring> sSourceFiles = NSDirectory::GetFiles(L"C:\\Folder");
|
||||
std::vector<std::wstring> sSourceFiles;
|
||||
//Или добавляем любой нужный файл
|
||||
sSourceFiles.push_back(L"");
|
||||
|
||||
std::wstring sTextDirOut = NSFile::GetProcessDirectory() + L"/text";
|
||||
if (!NSDirectory::Exists(sTextDirOut))
|
||||
NSDirectory::CreateDirectory(sTextDirOut);
|
||||
std::wstring sTextDirOut = NSFile::GetProcessDirectory() + L"/text";
|
||||
if (!NSDirectory::Exists(sTextDirOut))
|
||||
NSDirectory::CreateDirectory(sTextDirOut);
|
||||
|
||||
IOfficeDrawingFile* pReader = NULL;
|
||||
IOfficeDrawingFile* pReader = NULL;
|
||||
|
||||
COfficeFileFormatChecker oChecker;
|
||||
int nFileType = 0;
|
||||
COfficeFileFormatChecker oChecker;
|
||||
int nFileType = 0;
|
||||
|
||||
CDocxRenderer oDocxRenderer(pFonts);
|
||||
oDocxRenderer.SetTempFolder(sTempDirOut);
|
||||
CDocxRenderer oDocxRenderer(pFonts);
|
||||
oDocxRenderer.SetTempFolder(sTempDirOut);
|
||||
|
||||
for (size_t nIndex = 0; nIndex < sSourceFiles.size(); nIndex++)
|
||||
{
|
||||
if (oChecker.isOfficeFile(sSourceFiles[nIndex]))
|
||||
{
|
||||
nFileType = oChecker.nFileType;
|
||||
switch (nFileType)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF:
|
||||
pReader = new PdfReader::CPdfReader(pFonts);
|
||||
break;
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS:
|
||||
pReader = new CXpsFile(pFonts);
|
||||
break;
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU:
|
||||
pReader = new CDjVuFile(pFonts);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (size_t nIndex = 0; nIndex < sSourceFiles.size(); nIndex++)
|
||||
{
|
||||
if (oChecker.isOfficeFile(sSourceFiles[nIndex]))
|
||||
{
|
||||
nFileType = oChecker.nFileType;
|
||||
switch (nFileType)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF:
|
||||
pReader = new CPdfFile(pFonts);
|
||||
break;
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS:
|
||||
pReader = new CXpsFile(pFonts);
|
||||
break;
|
||||
case AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU:
|
||||
pReader = new CDjVuFile(pFonts);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pReader)
|
||||
{
|
||||
pFonts->Release();
|
||||
return 0;
|
||||
}
|
||||
if (!pReader)
|
||||
{
|
||||
pFonts->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
pReader->SetTempDirectory(sTempDir);
|
||||
pReader->SetTempDirectory(sTempDir);
|
||||
|
||||
#ifndef LOAD_FILE_AS_BINARY
|
||||
pReader->LoadFromFile(sSourceFiles[nIndex]);
|
||||
pReader->LoadFromFile(sSourceFiles[nIndex]);
|
||||
#else
|
||||
BYTE* pFileBinary = NULL;
|
||||
DWORD nFileBinaryLen = 0;
|
||||
NSFile::CFileBinary::ReadAllBytes(sSourceFile, &pFileBinary, nFileBinaryLen);
|
||||
BYTE* pFileBinary = NULL;
|
||||
DWORD nFileBinaryLen = 0;
|
||||
NSFile::CFileBinary::ReadAllBytes(sSourceFile, &pFileBinary, nFileBinaryLen);
|
||||
|
||||
pReader->LoadFromMemory(pFileBinary, nFileBinaryLen);
|
||||
pReader->LoadFromMemory(pFileBinary, nFileBinaryLen);
|
||||
#endif
|
||||
|
||||
#ifdef TEST_FOR_HTML_RENDERER_TEXT
|
||||
if (true)
|
||||
{
|
||||
int nPagesCount = pReader->GetPagesCount();
|
||||
if (true)
|
||||
{
|
||||
int nPagesCount = pReader->GetPagesCount();
|
||||
|
||||
NSHtmlRenderer::CHTMLRendererText oTextRenderer;
|
||||
for (int i = 0; i < nPagesCount; i++)
|
||||
{
|
||||
oTextRenderer.Init(pReader, 8);
|
||||
pReader->DrawPageOnRenderer(&oTextRenderer, i, NULL);
|
||||
}
|
||||
}
|
||||
NSHtmlRenderer::CHTMLRendererText oTextRenderer;
|
||||
for (int i = 0; i < nPagesCount; i++)
|
||||
{
|
||||
oTextRenderer.Init(pReader, 8);
|
||||
pReader->DrawPageOnRenderer(&oTextRenderer, i, NULL);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
std::wstring sExtention = NSFile::GetFileExtention(sSourceFiles[nIndex]);
|
||||
std::wstring sFileNameWithExtention = NSFile::GetFileName(sSourceFiles[nIndex]);
|
||||
std::wstring sFileName = sFileNameWithExtention.substr(0, sFileNameWithExtention.size() - 1 - sExtention.size());
|
||||
std::wstring sDocx = L"/" + sFileName + L".docx";
|
||||
std::wstring sZip = L"/" + sFileName + L".zip";
|
||||
std::wstring sExtention = NSFile::GetFileExtention(sSourceFiles[nIndex]);
|
||||
std::wstring sFileNameWithExtention = NSFile::GetFileName(sSourceFiles[nIndex]);
|
||||
std::wstring sFileName = sFileNameWithExtention.substr(0, sFileNameWithExtention.size() - 1 - sExtention.size());
|
||||
std::wstring sDocx = L"/" + sFileName + L".docx";
|
||||
std::wstring sZip = L"/" + sFileName + L".zip";
|
||||
|
||||
// проверить все режимы
|
||||
NSDocxRenderer::TextAssociationType taType;
|
||||
//taType = NSDocxRenderer::tatBlockChar;
|
||||
//taType = NSDocxRenderer::tatBlockLine;
|
||||
//taType = NSDocxRenderer::tatPlainLine;
|
||||
//taType = NSDocxRenderer::tatShapeLine;
|
||||
taType = NSDocxRenderer::tatPlainParagraph;
|
||||
// проверить все режимы
|
||||
NSDocxRenderer::TextAssociationType taType;
|
||||
//taType = NSDocxRenderer::tatBlockChar;
|
||||
//taType = NSDocxRenderer::tatBlockLine;
|
||||
//taType = NSDocxRenderer::tatPlainLine;
|
||||
//taType = NSDocxRenderer::tatShapeLine;
|
||||
taType = NSDocxRenderer::tatPlainParagraph;
|
||||
|
||||
oDocxRenderer.SetTextAssociationType(taType);
|
||||
oDocxRenderer.Convert(pReader, sTextDirOut+sDocx);
|
||||
//Если сразу нужен zip-архив
|
||||
//oDocxRenderer.Convert(pReader, sPlainParagraphDirOut+sZip);
|
||||
oDocxRenderer.SetTextAssociationType(taType);
|
||||
oDocxRenderer.Convert(pReader, sTextDirOut+sDocx);
|
||||
//Если сразу нужен zip-архив
|
||||
//oDocxRenderer.Convert(pReader, sPlainParagraphDirOut+sZip);
|
||||
#endif
|
||||
delete pReader;
|
||||
}
|
||||
delete pReader;
|
||||
}
|
||||
|
||||
pFonts->Release();
|
||||
pFonts->Release();
|
||||
|
||||
#ifdef LOAD_FILE_AS_BINARY
|
||||
RELEASEARRAYOBJECTS(pFileBinary);
|
||||
RELEASEARRAYOBJECTS(pFileBinary);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ CORE_ROOT_DIR = $$PWD/../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel, graphics, PdfReader, DjVuFile, XpsFile, PdfWriter, DocxRenderer)
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel, kernel_network, graphics, PdfFile, DjVuFile, XpsFile, DocxRenderer)
|
||||
|
||||
core_linux:include($$PWD/../../Common/3dParty/icu/icu.pri)
|
||||
core_windows:LIBS += -lgdi32 -ladvapi32 -luser32 -lshell32
|
||||
@ -22,7 +22,7 @@ SOURCES += main.cpp
|
||||
SOURCES += \
|
||||
$$CORE_ROOT_DIR/Common/OfficeFileFormatChecker2.cpp \
|
||||
$$CORE_ROOT_DIR/Common/3dParty/pole/pole.cpp \
|
||||
$$CORE_ROOT_DIR/Common/DocxFormat/Source/Base/unicode_util.cpp
|
||||
$$CORE_ROOT_DIR/OOXML/Base/unicode_util.cpp
|
||||
|
||||
DESTDIR = $$PWD_ROOT_DIR/build
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ HRESULT CEpubFile::Convert(const std::wstring& sInputFile, const std::wstring& s
|
||||
NSDirectory::CreateDirectory(sOutputDir);
|
||||
HRESULT hRes = oFile.OpenBatchHtml(arFiles, sOutputDir, &oFileParams);
|
||||
if (bIsOutCompress && S_OK == hRes)
|
||||
oOfficeUtils.CompressFileOrDirectory(sOutputDir, sOutputFile);
|
||||
hRes = oOfficeUtils.CompressFileOrDirectory(sOutputDir, sOutputFile);
|
||||
|
||||
#ifdef _DEBUG
|
||||
std::wcout << L"---" << (S_OK == hRes ? L"Successful" : L"Failed") << L" conversion of Epub to Docx---" << std::endl;
|
||||
@ -303,6 +303,14 @@ HRESULT CEpubFile::FromHtml(const std::wstring& sHtmlFile, const std::wstring& s
|
||||
NSFile::CFileBinary oContentOpf;
|
||||
bool bWasLanguage = false, bWasTitle = false;
|
||||
std::wstring sTitle = sInpTitle.empty() ? NSFile::GetFileName(sDstFile) : sInpTitle;
|
||||
replace_all(sTitle, L"&", L"&");
|
||||
replace_all(sTitle, L"<", L"<");
|
||||
replace_all(sTitle, L">", L">");
|
||||
replace_all(sTitle, L"\"", L""");
|
||||
replace_all(sTitle, L"\'", L"'");
|
||||
replace_all(sTitle, L"\n", L"
");
|
||||
replace_all(sTitle, L"\r", L"
");
|
||||
replace_all(sTitle, L"\t", L"	");
|
||||
std::wstring sUUID = GenerateUUID();
|
||||
if (oContentOpf.CreateFileW(m_sTempDir + L"/OEBPS/content.opf"))
|
||||
{
|
||||
|
||||
@ -192,6 +192,34 @@ struct SPublishInfo
|
||||
};
|
||||
*/
|
||||
|
||||
void replace_all(std::wstring& s, const std::wstring& s1, const std::wstring& s2)
|
||||
{
|
||||
size_t pos = s.find(s1);
|
||||
size_t l = s2.length();
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
if (!(s1 == L"&" && s2 == L"&" && s.length() > pos + 4 && s[pos] == L'&' && s[pos + 1] == L'a' && s[pos + 2] == L'm' && s[pos + 3] == L'p' && s[pos + 4] == L';'))
|
||||
s.replace(pos, s1.length(), s2);
|
||||
pos = s.find(s1, pos + l);
|
||||
}
|
||||
}
|
||||
|
||||
std::wstring EncodeXmlString(const std::wstring& s)
|
||||
{
|
||||
std::wstring sRes = s;
|
||||
|
||||
replace_all(sRes, L"&", L"&");
|
||||
replace_all(sRes, L"<", L"<");
|
||||
replace_all(sRes, L">", L">");
|
||||
replace_all(sRes, L"\"", L""");
|
||||
replace_all(sRes, L"\'", L"'");
|
||||
replace_all(sRes, L"\n", L"
");
|
||||
replace_all(sRes, L"\r", L"
");
|
||||
replace_all(sRes, L"\t", L"	");
|
||||
|
||||
return sRes;
|
||||
}
|
||||
|
||||
class CFb2File_Private
|
||||
{
|
||||
public:
|
||||
@ -1537,19 +1565,19 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory
|
||||
NSStringUtils::CStringBuilder oCore;
|
||||
// Заголовок
|
||||
oCore += L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><dc:title>";
|
||||
oCore.WriteEncodeXmlString(m_internal->m_oTitleInfo.m_sBookTitle);
|
||||
oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.m_sBookTitle));
|
||||
// Жанры
|
||||
oCore += L"</dc:title><dc:subject>";
|
||||
oCore.WriteEncodeXmlString(m_internal->m_oTitleInfo.getGenres());
|
||||
oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.getGenres()));
|
||||
// Авторы
|
||||
oCore += L"</dc:subject><dc:creator>";
|
||||
oCore.WriteEncodeXmlString(m_internal->m_oTitleInfo.getAuthors());
|
||||
oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.getAuthors()));
|
||||
oCore.WriteString(L"</dc:creator>");
|
||||
// Ключевые слова
|
||||
if (!m_internal->m_oTitleInfo.m_pKeywords.empty())
|
||||
{
|
||||
oCore.WriteString(L"<cp:keywords>");
|
||||
oCore.WriteEncodeXmlString(m_internal->m_oTitleInfo.m_pKeywords);
|
||||
oCore.WriteString(EncodeXmlString(m_internal->m_oTitleInfo.m_pKeywords));
|
||||
oCore.WriteString(L"</cp:keywords>");
|
||||
}
|
||||
// Конец core
|
||||
@ -1596,17 +1624,6 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void replace_all(std::wstring& s, const std::wstring& s1, const std::wstring& s2)
|
||||
{
|
||||
size_t pos = s.find(s1);
|
||||
size_t l = s2.length();
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
s.replace(pos, s1.length(), s2);
|
||||
pos = s.find(s1, pos + l);
|
||||
}
|
||||
}
|
||||
|
||||
void readLi(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuilder& oTitleInfo, XmlUtils::CXmlLiteReader& oIndexHtml, std::vector<std::wstring>& arrBinary, bool bUl, bool bWasP, bool bWasTable);
|
||||
void readStream(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuilder& oTitleInfo, XmlUtils::CXmlLiteReader& oIndexHtml, std::vector<std::wstring>& arrBinary, bool bWasP, bool bWasTable)
|
||||
{
|
||||
@ -1627,7 +1644,11 @@ void readStream(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuild
|
||||
oXml.WriteString(L"</p>");
|
||||
}
|
||||
else if (sName == L"title")
|
||||
oTitleInfo.WriteString(L"<book-title>" + oIndexHtml.GetText2() + L"</book-title>");
|
||||
{
|
||||
oTitleInfo.WriteString(L"<book-title>");
|
||||
oTitleInfo.WriteString(EncodeXmlString(oIndexHtml.GetText2()));
|
||||
oTitleInfo.WriteString(L"</book-title>");
|
||||
}
|
||||
else if (sName == L"meta")
|
||||
{
|
||||
std::wstring sAtrName, sAtrContent;
|
||||
@ -1643,20 +1664,30 @@ void readStream(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuild
|
||||
|
||||
if (!sAtrName.empty())
|
||||
{
|
||||
replace_all(sAtrContent, L"&", L"&");
|
||||
replace_all(sAtrContent, L"<", L"<");
|
||||
replace_all(sAtrContent, L">", L">");
|
||||
replace_all(sAtrContent, L"\"", L""");
|
||||
replace_all(sAtrContent, L"\'", L"'");
|
||||
|
||||
if (sAtrName == L"creator")
|
||||
oTitleInfo.WriteString(L"<author><nickname>" + sAtrContent + L"</nickname></author>");
|
||||
{
|
||||
oTitleInfo.WriteString(L"<author><nickname>");
|
||||
oTitleInfo.WriteString(EncodeXmlString(sAtrContent));
|
||||
oTitleInfo.WriteString(L"</nickname></author>");
|
||||
}
|
||||
else if (sAtrName == L"description")
|
||||
oTitleInfo.WriteString(L"<annotation><p>" + sAtrContent + L"</p></annotation>");
|
||||
{
|
||||
oTitleInfo.WriteString(L"<annotation><p>");
|
||||
oTitleInfo.WriteString(EncodeXmlString(sAtrContent));
|
||||
oTitleInfo.WriteString(L"</p></annotation>");
|
||||
}
|
||||
else if (sAtrName == L"subject")
|
||||
oTitleInfo.WriteString(L"<genre>" + sAtrContent + L"</genre>");
|
||||
{
|
||||
oTitleInfo.WriteString(L"<genre>");
|
||||
oTitleInfo.WriteString(EncodeXmlString(sAtrContent));
|
||||
oTitleInfo.WriteString(L"</genre>");
|
||||
}
|
||||
else if (sAtrName == L"keywords")
|
||||
oTitleInfo.WriteString(L"<keywords>" + sAtrContent + L"</keywords>");
|
||||
{
|
||||
oTitleInfo.WriteString(L"<keywords>");
|
||||
oTitleInfo.WriteString(EncodeXmlString(sAtrContent));
|
||||
oTitleInfo.WriteString(L"</keywords>");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sName == L"h1")
|
||||
@ -1952,6 +1983,10 @@ std::wstring GenerateUUID()
|
||||
|
||||
HRESULT CFb2File::FromHtml(const std::wstring& sHtmlFile, const std::wstring& sDst, const std::wstring& sInpTitle)
|
||||
{
|
||||
std::wstring sTitle = sInpTitle;
|
||||
if (sTitle.empty())
|
||||
sTitle = NSFile::GetFileName(sDst);
|
||||
|
||||
BYTE* pData;
|
||||
DWORD nLength;
|
||||
if (!NSFile::CFileBinary::ReadAllBytes(sHtmlFile, &pData, nLength))
|
||||
@ -1994,7 +2029,11 @@ HRESULT CFb2File::FromHtml(const std::wstring& sHtmlFile, const std::wstring& sD
|
||||
oRes.WriteString(L"<description><title-info>");
|
||||
std::wstring sTitleInfo = oTitleInfo.GetData();
|
||||
if (sTitleInfo.find(L"<book-title>") == std::wstring::npos)
|
||||
oRes.WriteString(L"<book-title>" + (sInpTitle.empty() ? NSFile::GetFileName(sDst) : sInpTitle) + L"</book-title>");
|
||||
{
|
||||
oRes.WriteString(L"<book-title>");
|
||||
oRes.WriteString(EncodeXmlString(sTitle));
|
||||
oRes.WriteString(L"</book-title>");
|
||||
}
|
||||
oRes.WriteString(sTitleInfo);
|
||||
oRes.WriteString(L"</title-info></description>");
|
||||
// body
|
||||
@ -2015,7 +2054,8 @@ HRESULT CFb2File::FromHtml(const std::wstring& sHtmlFile, const std::wstring& sD
|
||||
{
|
||||
oWriter.WriteStringUTF8(oRes.GetData());
|
||||
oWriter.CloseFile();
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
return S_FALSE;
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -62,11 +62,11 @@ namespace ODRAW
|
||||
std::vector<long> m_arAbsMaxAdjustments;
|
||||
std::vector<long> m_arAdjustments;
|
||||
std::vector<double> m_arGuides;
|
||||
LONG m_eJoin;
|
||||
long m_eJoin;
|
||||
bool m_bConcentricFill;
|
||||
bool m_bCustomShape;
|
||||
std::vector<SimpleTypes::CPoint> m_arConnectors;
|
||||
std::vector<LONG> m_arConnectorAngles;
|
||||
std::vector<long> m_arConnectorAngles;
|
||||
|
||||
std::vector<Aggplus::RECT> m_arTextRects;
|
||||
|
||||
@ -77,8 +77,8 @@ namespace ODRAW
|
||||
std::wstring m_strPath;
|
||||
std::wstring m_strRect;
|
||||
|
||||
LONG m_lLimoX;
|
||||
LONG m_lLimoY;
|
||||
int m_lLimoX;
|
||||
int m_lLimoY;
|
||||
|
||||
CPath m_oPath;
|
||||
|
||||
|
||||
@ -511,9 +511,9 @@ namespace NSCustomVML
|
||||
|
||||
(*m_pAdjustValues)[lIndex] = lValue;
|
||||
}
|
||||
void CCustomVML::SetAdjusts(std::vector<LONG>* pList)
|
||||
void CCustomVML::SetAdjusts(std::vector<long>* pValues)
|
||||
{
|
||||
m_pAdjustValues = pList;
|
||||
m_pAdjustValues = pValues;
|
||||
}
|
||||
void CCustomVML::ToCustomShape(ODRAW::CBaseShape* pShape, NSGuidesVML::CFormulasManager& oManager)
|
||||
{
|
||||
|
||||
@ -93,7 +93,7 @@ namespace NSCustomVML
|
||||
std::vector<Aggplus::POINT> m_arVertices;
|
||||
std::vector<CSegment> m_arSegments;
|
||||
std::vector<CGuide> m_arGuides;
|
||||
std::vector<LONG>* m_pAdjustValues;
|
||||
std::vector<long>* m_pAdjustValues;
|
||||
std::vector<Aggplus::POINT> m_arConnectionSites;
|
||||
std::vector<Aggplus::RECT> m_arInscribe;
|
||||
std::vector<double> m_arConnectionSitesDir;
|
||||
@ -128,7 +128,7 @@ namespace NSCustomVML
|
||||
void addGuide(CGuide & oInfo);
|
||||
void addAdjust(int lIndex, int lValue);
|
||||
|
||||
void SetAdjusts(std::vector<LONG>* pList);
|
||||
void SetAdjusts(std::vector<long>* pList);
|
||||
void ToCustomShape(ODRAW::CBaseShape* pShape, NSGuidesVML::CFormulasManager& oManager);
|
||||
};
|
||||
}
|
||||
|
||||
@ -463,7 +463,7 @@ namespace NSGuidesVML
|
||||
arAdj.push_back(0);
|
||||
}
|
||||
|
||||
LONG lVal = (LONG)(dScale * arAdj[oHandle.gdRef.y]);
|
||||
int lVal = (int)(dScale * arAdj[oHandle.gdRef.y]);
|
||||
arAdj[oHandle.gdRef.y] = lVal;
|
||||
}
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ namespace NSGuidesVML
|
||||
m_arFormulas.clear();
|
||||
m_arResults.clear();
|
||||
}
|
||||
void CFormulasManager::Clear(std::vector<LONG>* pAdjusts)
|
||||
void CFormulasManager::Clear(std::vector<long>* pAdjusts)
|
||||
{
|
||||
m_pAdjustments = pAdjusts;
|
||||
|
||||
|
||||
@ -274,8 +274,8 @@ namespace NSGuidesVML
|
||||
class CFormulasManager
|
||||
{
|
||||
public:
|
||||
std::vector<LONG>* m_pAdjustments;
|
||||
std::vector<LONG> m_arResults;
|
||||
std::vector<long>* m_pAdjustments;
|
||||
std::vector<long> m_arResults;
|
||||
|
||||
std::vector<CFormula> m_arFormulas;
|
||||
|
||||
@ -289,7 +289,7 @@ namespace NSGuidesVML
|
||||
CFormulasManager& operator =(const CFormulasManager& oSrc);
|
||||
|
||||
void Clear();
|
||||
void Clear(std::vector<LONG>* pAdjusts);
|
||||
void Clear(std::vector<long>* pAdjusts);
|
||||
|
||||
void AddFormula(std::wstring strFormula);
|
||||
void AddFormula(CFormula oFormula);
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
#include "../../../DocFile/OfficeDrawing/PresetShapeTypes.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
//#define CREATE_BY_SPT(SHAPE_TYPE, CLASS_SHAPE_NAME) \
|
||||
// case SHAPE_TYPE: { pShape = new CLASS_SHAPE_NAME(); break; } \
|
||||
@ -631,68 +630,50 @@ CPPTShape* CPPTShape::CreateByShapeType(DocFileFormat::ShapeType* pShapeType)
|
||||
}
|
||||
|
||||
// Connectors
|
||||
if (pShapeType->ConnectorLocations.length())
|
||||
if (false == pShapeType->ConnectorLocations.empty())
|
||||
{
|
||||
pShape->LoadConnectorsList(pShapeType->ConnectorLocations);
|
||||
}
|
||||
|
||||
// TextRect
|
||||
if (pShapeType->TextBoxRectangle.length())
|
||||
if (false == pShapeType->TextBoxRectangle.empty())
|
||||
{
|
||||
pShape->LoadTextRect(pShapeType->TextBoxRectangle);
|
||||
}
|
||||
|
||||
// Handles
|
||||
for (std::list<DocFileFormat::Handle>::iterator iter = pShapeType->Handles.begin(); iter != pShapeType->Handles.end(); ++iter)
|
||||
// Handles // todooo - убрать лишнее определение Handle !!!
|
||||
for (size_t i = 0; i < pShapeType->Handles.size(); ++i)
|
||||
{
|
||||
CHandle_ oHandle;
|
||||
oHandle.position = iter->position;
|
||||
oHandle.xrange = iter->xrange;
|
||||
oHandle.yrange = iter->yrange;
|
||||
oHandle.switchHandle = iter->switchHandle;
|
||||
oHandle.polar = iter->polar;
|
||||
oHandle.radiusrange = iter->radiusrange;
|
||||
oHandle.position = pShapeType->Handles[i].position;
|
||||
oHandle.xrange = pShapeType->Handles[i].xrange;
|
||||
oHandle.yrange = pShapeType->Handles[i].yrange;
|
||||
oHandle.switchHandle = pShapeType->Handles[i].switchHandle;
|
||||
oHandle.polar = pShapeType->Handles[i].polar;
|
||||
oHandle.radiusrange = pShapeType->Handles[i].radiusrange;
|
||||
|
||||
pShape->m_arHandles.push_back(oHandle);
|
||||
}
|
||||
|
||||
// Formulas / Guides
|
||||
for (std::list<std::wstring>::iterator iter = pShapeType->Formulas.begin(); iter != pShapeType->Formulas.end(); ++iter)
|
||||
for (size_t i = 0; i < pShapeType->Formulas.size(); ++i)
|
||||
{
|
||||
pShape->AddGuide(iter->c_str());
|
||||
pShape->AddGuide(pShapeType->Formulas[i]);
|
||||
}
|
||||
|
||||
// Adjustments
|
||||
if (pShapeType->AdjustmentValues.length())
|
||||
{
|
||||
std::vector<std::wstring> adjArray;
|
||||
boost::algorithm::split(adjArray, pShapeType->AdjustmentValues, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
for (size_t i = 0; i < adjArray.size(); ++i)
|
||||
{
|
||||
pShape->m_arAdjustments.push_back(boost::lexical_cast<double>(adjArray[i].c_str()));
|
||||
}
|
||||
}
|
||||
pShape->m_arAdjustments = pShapeType->Adjustments;
|
||||
|
||||
// ConnectorAngles
|
||||
if (pShapeType->ConnectorAngles.length())
|
||||
{
|
||||
std::vector<std::wstring> anglesArray;
|
||||
boost::algorithm::split(anglesArray, pShapeType->ConnectorAngles, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
for (size_t i = 0; i < anglesArray.size(); ++i)
|
||||
{
|
||||
pShape->m_arConnectorAngles.push_back(boost::lexical_cast<LONG>(anglesArray[i].c_str()));
|
||||
}
|
||||
}
|
||||
pShape->m_arConnectorAngles = pShapeType->ConnectorAngles;
|
||||
|
||||
// Limo
|
||||
if (pShapeType->Limo.length())
|
||||
if (false == pShapeType->Limo.empty())
|
||||
{
|
||||
std::vector<std::wstring> limoArray;
|
||||
boost::algorithm::split(limoArray, pShapeType->Limo, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
if (limoArray.size() == 2)
|
||||
{
|
||||
pShape->m_lLimoX = boost::lexical_cast<long>(limoArray[0].c_str());
|
||||
pShape->m_lLimoY = boost::lexical_cast<long>(limoArray[1].c_str());
|
||||
pShape->m_lLimoX = boost::lexical_cast<int>(limoArray[0].c_str());
|
||||
pShape->m_lLimoY = boost::lexical_cast<int>(limoArray[1].c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,9 +133,9 @@ namespace NSGuidesVML
|
||||
{
|
||||
LONG lVal = 0;
|
||||
|
||||
std::map<std::wstring, LONG>::iterator NumFmla = m_arMapFormula.find(strParam);
|
||||
std::map<std::wstring, LONG>::iterator NumAdj = m_arMapAdj.find(strParam);
|
||||
std::map<std::wstring, LONG>::iterator NumGuides = mapGuides.find(strParam);
|
||||
std::map<std::wstring, long>::iterator NumFmla = m_arMapFormula.find(strParam);
|
||||
std::map<std::wstring, long>::iterator NumAdj = m_arMapAdj.find(strParam);
|
||||
std::map<std::wstring, long>::iterator NumGuides = mapGuides.find(strParam);
|
||||
|
||||
if (NumAdj != m_arMapAdj.end())
|
||||
{
|
||||
|
||||
@ -41,8 +41,8 @@ namespace NSGuidesVML
|
||||
private:
|
||||
std::vector<CSlice> m_arSlices;
|
||||
CPPTShape* pPPTShape;
|
||||
std::map<std::wstring, LONG> m_arMapFormula;
|
||||
std::map<std::wstring, LONG> m_arMapAdj;
|
||||
std::map<std::wstring, long> m_arMapFormula;
|
||||
std::map<std::wstring, long> m_arMapAdj;
|
||||
std::vector<CSlicePath> m_arSlicesPath;
|
||||
LONG m_lIndexDst;
|
||||
LONG m_lIndexAdj;
|
||||
|
||||
@ -49,6 +49,15 @@ namespace DocFileFormat
|
||||
ShapeType::~ShapeType()
|
||||
{
|
||||
}
|
||||
std::wstring ShapeType::VectorToStr(std::vector<long> & arr) const
|
||||
{
|
||||
std::wstring sRes;
|
||||
for (size_t i = 0; i < arr.size(); ++i)
|
||||
{
|
||||
sRes += std::to_wstring(arr[i]) + L",";
|
||||
}
|
||||
return sRes.empty() ? L"" : sRes.substr(sRes.size() - 1);
|
||||
}
|
||||
unsigned int ShapeType::GetTypeCode() const
|
||||
{
|
||||
return TypeCode;
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "../IVisitable.h"
|
||||
#include "../../Common/Base/XmlTools.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace ODRAW
|
||||
{
|
||||
@ -280,57 +281,29 @@ namespace DocFileFormat
|
||||
class ShapeType: public IVisitable
|
||||
{
|
||||
public:
|
||||
|
||||
ShapeType (unsigned int typeCode);
|
||||
virtual ~ShapeType();
|
||||
|
||||
unsigned int GetTypeCode() const;
|
||||
|
||||
/// This string describes a sequence of commands that define the shape’s path.
|
||||
/// This string describes both the pSegmentInfo array and pVertices array in the shape’s geometry properties.
|
||||
std::wstring Path;
|
||||
/// This specifies a list of formulas whose calculated values are referenced by other properties.
|
||||
/// Each formula is listed on a separate line. Formulas are ordered, with the first formula having index 0.
|
||||
/// This section can be omitted if the shape doesn’t need any guides.
|
||||
std::list<std::wstring> Formulas;
|
||||
/// Specifies a comma-delimited list of parameters, or adjustment values,
|
||||
/// used to define values for a parameterized formula.
|
||||
/// These values represent the location of an adjust handle and may be
|
||||
/// referenced by the geometry of an adjust handle or as a parameter guide function.
|
||||
std::wstring AdjustmentValues;
|
||||
/// These values specify the location of connection points on the shape’s path.
|
||||
/// The connection points are defined by a string consisting of pairs of x and y values, delimited by commas.
|
||||
std::wstring ConnectorLocations;
|
||||
/// This section specifies the properties of each adjust handle on the shape.
|
||||
/// One adjust handle is specified per line.
|
||||
/// The properties for each handle correspond to values of the ADJH structure
|
||||
/// contained in the pAdjustHandles array in the shape’s geometry properties.
|
||||
std::list<Handle> Handles;
|
||||
/// Specifies one or more text boxes inscribed inside the shape.
|
||||
/// A textbox is defined by one or more sets of numbers specifying (in order) the left, top, right, and bottom points of the rectangle.
|
||||
/// Multiple sets are delimited by a semicolon.
|
||||
/// If omitted, the text box is the same as the geometry’s bounding box.
|
||||
std::wstring TextBoxRectangle;
|
||||
bool ShapeConcentricFill;
|
||||
/// Specifies what join style the shape has.
|
||||
/// Since there is no UI for changing the join style,
|
||||
/// all shapes of this type will always have the specified join style.
|
||||
JoinStyle Joins;
|
||||
/// Specifies the (x,y) coordinates of the limo stretch point.
|
||||
/// Some shapes that have portions that should be constrained to a fixed aspect ratio, are designed with limo-stretch to keep those portions at the fixed aspect ratio.
|
||||
std::wstring Limo;
|
||||
/// Associated with each connection site, there is a direction which specifies at what angle elbow and curved connectors should attach to it
|
||||
std::wstring ConnectorAngles;
|
||||
/// Specifies if a shape of this type is filled by default
|
||||
bool Filled;
|
||||
/// Specifies if a shape of this type is stroked by default
|
||||
bool Stroked;
|
||||
/// Speicfies the locked properties of teh shape.
|
||||
/// By default nothing is locked.
|
||||
ODRAW::OfficeArtFOPTEPtr Lock;
|
||||
|
||||
///
|
||||
std::wstring Textpath;
|
||||
std::wstring VectorToStr(std::vector<long> & arr) const;
|
||||
|
||||
std::wstring Path;
|
||||
std::vector<std::wstring> Formulas;
|
||||
std::vector<long> Adjustments;
|
||||
std::wstring ConnectorLocations;
|
||||
std::vector<Handle> Handles;
|
||||
std::wstring TextBoxRectangle;
|
||||
std::vector<long> ConnectorAngles;
|
||||
std::wstring Limo;
|
||||
std::wstring Textpath;
|
||||
|
||||
JoinStyle Joins;
|
||||
bool ShapeConcentricFill;
|
||||
bool Filled;
|
||||
bool Stroked;
|
||||
|
||||
ODRAW::OfficeArtFOPTEPtr Lock;
|
||||
|
||||
protected:
|
||||
unsigned int TypeCode;
|
||||
|
||||
@ -54,7 +54,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @1 @5 0");
|
||||
Formulas.push_back( L"sum @2 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -128,7 +129,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @32 @5 0");
|
||||
Formulas.push_back( L"sum @33 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -214,7 +216,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @39 @5 0");
|
||||
Formulas.push_back( L"sum @40 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -295,7 +298,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @36 @5 0");
|
||||
Formulas.push_back( L"sum @37 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -337,7 +341,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @11 @5 0");
|
||||
Formulas.push_back( L"sum @12 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -379,7 +384,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @11 @5 0");
|
||||
Formulas.push_back( L"sum @12 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -428,7 +434,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @16 @5 0");
|
||||
Formulas.push_back( L"sum @17 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -477,7 +484,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @16 @5 0");
|
||||
Formulas.push_back( L"sum @17 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -541,7 +549,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @25 @5 0");
|
||||
Formulas.push_back( L"sum @26 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -587,7 +596,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @14 @5 0");
|
||||
Formulas.push_back( L"sum @15 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -650,7 +660,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @25 @5 0");
|
||||
Formulas.push_back( L"sum @26 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
@ -745,7 +756,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"sum @46 @5 0");
|
||||
Formulas.push_back( L"sum @47 @5 0");
|
||||
|
||||
AdjustmentValues = L"1350";
|
||||
Adjustments.push_back(1350);
|
||||
|
||||
ConnectorLocations = L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0";
|
||||
TextBoxRectangle = L"@0,@0,@1,@2";
|
||||
|
||||
|
||||
@ -48,7 +48,12 @@ namespace DocFileFormat
|
||||
Formulas.push_back( L"val #3");
|
||||
Formulas.push_back( L"val #4");
|
||||
|
||||
AdjustmentValues = L"-5898240,,,21600,21600";
|
||||
Adjustments.push_back(-5898240);
|
||||
Adjustments.push_back(0);
|
||||
Adjustments.push_back(0);
|
||||
Adjustments.push_back(21600);
|
||||
Adjustments.push_back(21600);
|
||||
|
||||
ConnectorLocations = L"0,0;21600,21600;0,21600";
|
||||
|
||||
Handle HandleOne;
|
||||
|
||||
@ -52,9 +52,16 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod @4 @3 10800");
|
||||
Formulas.push_back(L"sum width 0 @5");
|
||||
|
||||
AdjustmentValues = L"16200,5400";
|
||||
Adjustments.push_back(16200);
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = L"@0,0;0,10800;@0,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,@1,@6,@2";
|
||||
|
||||
Handle one;
|
||||
@ -82,9 +89,16 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod @4 @3 10800");
|
||||
Formulas.push_back(L"sum width 0 @5");
|
||||
|
||||
AdjustmentValues = L"16200,5400";
|
||||
Adjustments.push_back(16200);
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = L"10800,0;0,@0;10800,21600;21600,@0";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@1,0,@2,@6";
|
||||
|
||||
Handle one;
|
||||
@ -110,9 +124,15 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod #0 #1 10800");
|
||||
Formulas.push_back(L"sum #0 0 @3");
|
||||
|
||||
AdjustmentValues = L"5400,5400";
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(5400);
|
||||
ConnectorLocations = L"10800,0;0,@0;10800,21600;21600,@0";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@1,@4,@2,21600";
|
||||
|
||||
Handle one;
|
||||
@ -138,9 +158,16 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod #0 #1 10800");
|
||||
Formulas.push_back(L"sum #0 0 @3");
|
||||
|
||||
AdjustmentValues = L"5400,5400";
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = L"@0,0;0,10800;@0,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@4,@1,21600,@2";
|
||||
|
||||
Handle one;
|
||||
@ -160,10 +187,21 @@ namespace DocFileFormat
|
||||
Joins = miter;
|
||||
Path = L"m,10800l@0,21600@0@3@2@3@2,21600,21600,10800@2,0@2@1@0@1@0,xe";
|
||||
|
||||
AdjustmentValues = L"4320,5400";
|
||||
Adjustments.push_back(4320);
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = L"@2,0;10800,@1;@0,0;0,10800;@0,21600;10800,@3;@2,21600;21600,10800";
|
||||
ConnectorAngles = L"270,270,270,180,90,90,90,0";
|
||||
TextBoxRectangle = L"@5,@1,@6,@3";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@5,@1,@6,@3";
|
||||
|
||||
Formulas.push_back(L"val #0");
|
||||
Formulas.push_back(L"val #1");
|
||||
@ -198,9 +236,20 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum #1 0 @4");
|
||||
Formulas.push_back(L"sum 21600 0 @5");
|
||||
|
||||
AdjustmentValues = L"5400,4320";
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(4320);
|
||||
|
||||
ConnectorLocations = L"10800,0;0,@0;@1,10800;0,@2;10800,21600;21600,@2;@3,10800;21600,@0";
|
||||
ConnectorAngles = L"270,180,180,180,90,0,0,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
ConnectorAngles.push_back(0);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@1,@5,@3,@6";
|
||||
|
||||
Handle one;
|
||||
@ -231,7 +280,10 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod @7 #2 @6");
|
||||
Formulas.push_back(L"sum 21600 0 @8");
|
||||
|
||||
AdjustmentValues = L"6480,8640,4320";
|
||||
Adjustments.push_back(6480);
|
||||
Adjustments.push_back(8640);
|
||||
Adjustments.push_back(4320);
|
||||
|
||||
ConnectorLocations = L"Rectangle";
|
||||
TextBoxRectangle = L"@8,@1,@9,@4;@1,@8,@4,@9";
|
||||
|
||||
@ -276,9 +328,17 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum @1 0 10800");
|
||||
Formulas.push_back(L"prod @2 @16 @15");
|
||||
|
||||
AdjustmentValues = L"6480,8640,6171";
|
||||
Adjustments.push_back(6480);
|
||||
Adjustments.push_back(8640);
|
||||
Adjustments.push_back(6171);
|
||||
|
||||
ConnectorLocations = L"10800,0;0,@8;10800,@9;21600,@8";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@13,@6,@14,@9;@1,@17,@4,@9";
|
||||
|
||||
Handle one;
|
||||
@ -304,7 +364,12 @@ namespace DocFileFormat
|
||||
Path = L"m21600,6079l15126,r,2912l12427,2912c5564,2912,,7052,,12158r,9442l6474,21600r,-9442c6474,10550,9139,9246,12427,9246r2699,l15126,12158,21600,6079xe";
|
||||
|
||||
ConnectorLocations = L"2830950,0;2830950,2722432;605830,4836695;4042610,1361216";
|
||||
ConnectorAngles = L"270,90,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"12427,2912,18227,9246";
|
||||
}
|
||||
};
|
||||
@ -319,7 +384,13 @@ namespace DocFileFormat
|
||||
Path = L"m15662,14285l21600,8310r-2970,qy9250,,,8485l,21600r6110,l6110,8310qy8907,5842l9725,5842qx12520,8310l9725,8310xe";
|
||||
|
||||
ConnectorLocations = L"9250,0;3055,21600;9725,8310;15662,14285;21600,8310";
|
||||
ConnectorAngles = L"270,90,90,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,8310,6110,21600";
|
||||
}
|
||||
};
|
||||
@ -347,10 +418,22 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum #0 0 @4");
|
||||
Formulas.push_back(L"prod @2 @10 @11");
|
||||
|
||||
AdjustmentValues = L"9257,18514,6171";
|
||||
Adjustments.push_back(9257);
|
||||
Adjustments.push_back(18514);
|
||||
Adjustments.push_back(6171);
|
||||
|
||||
ConnectorLocations = L"@4,0;@0,@2;@2,@0;0,@4;@2,21600;@7,@1;@1,@7;21600,@2";
|
||||
ConnectorAngles = L"270,180,270,180,90,90,0,0";
|
||||
TextBoxRectangle = L"@12,@5,@1,@1;@5,@12,@1,@1";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@12,@5,@1,@1;@5,@12,@1,@1";
|
||||
|
||||
Handle one;
|
||||
one.position = L"#0,topLeft";
|
||||
@ -394,9 +477,19 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum @0 0 @4");
|
||||
Formulas.push_back(L"prod @2 @15 @16");
|
||||
|
||||
AdjustmentValues = L"9257,18514,7200";
|
||||
Adjustments.push_back(9257);
|
||||
Adjustments.push_back(18514);
|
||||
Adjustments.push_back(7200);
|
||||
|
||||
ConnectorLocations = L"@4,0;@0,@2;0,@11;@14,21600;@1,@13;21600,@2";
|
||||
ConnectorAngles = L"270,180,180,90,0,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,@12,@1,21600;@5,@17,@1,21600";
|
||||
|
||||
|
||||
@ -472,9 +565,18 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod height 4390 32768");
|
||||
Formulas.push_back(L"prod height 28378 32768");
|
||||
|
||||
AdjustmentValues = L"12960,19440,14400";
|
||||
Adjustments.push_back(12960);
|
||||
Adjustments.push_back(19440);
|
||||
Adjustments.push_back(14400);
|
||||
|
||||
ConnectorLocations = L"0,@17;@2,@14;@22,@8;@2,@12;@22,@16";
|
||||
ConnectorAngles = L"180,90,0,0,0";
|
||||
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
ConnectorAngles.push_back(0);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@47,@45,@48,@46";
|
||||
|
||||
Handle one;
|
||||
@ -549,10 +651,19 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod height 4390 32768");
|
||||
Formulas.push_back(L"prod height 28378 32768");
|
||||
|
||||
AdjustmentValues = L"12960,19440,14400";
|
||||
ConnectorLocations = L"0,@17;@2,@14;@22,@8;@2,@12;@22,@16";
|
||||
ConnectorAngles = L"180,90,0,0,0";
|
||||
TextBoxRectangle = L"@47,@45,@48,@46";
|
||||
Adjustments.push_back(12960);
|
||||
Adjustments.push_back(19440);
|
||||
Adjustments.push_back(7200);
|
||||
|
||||
ConnectorLocations = L"0,@15;@2,@11;0,@8;@2,@13;@21,@16";
|
||||
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@43,@41,@44,@42";
|
||||
|
||||
Handle one;
|
||||
one.position = L"topLeft,#0";
|
||||
@ -626,9 +737,18 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod height 4390 32768");
|
||||
Formulas.push_back(L"prod height 28378 32768");
|
||||
|
||||
AdjustmentValues = L"12960,19440,7200";
|
||||
Adjustments.push_back(12960);
|
||||
Adjustments.push_back(19440);
|
||||
Adjustments.push_back(7200);
|
||||
|
||||
ConnectorLocations = L"@8,0;@11,@2;@15,0;@16,@21;@13,@2";
|
||||
ConnectorAngles = L"270,270,270,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@41,@43,@42,@44";
|
||||
|
||||
Handle one;
|
||||
@ -707,9 +827,18 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod height 4390 32768");
|
||||
Formulas.push_back(L"prod height 28378 32768");
|
||||
|
||||
AdjustmentValues = L"12960,19440,14400";
|
||||
Adjustments.push_back(12960);
|
||||
Adjustments.push_back(19440);
|
||||
Adjustments.push_back(14400);
|
||||
|
||||
ConnectorLocations = L"@17,0;@16,@22;@12,@2;@8,@22;@14,@2";
|
||||
ConnectorAngles = L"270,90,90,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@45,@47,@46,@48";
|
||||
|
||||
Handle one;
|
||||
@ -746,9 +875,16 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod @4 @3 10800");
|
||||
Formulas.push_back(L"sum width 0 @5");
|
||||
|
||||
AdjustmentValues = L"16200,5400";
|
||||
Adjustments.push_back(16200);
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = L"@0,0;0,10800;@0,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"3375,@1,@6,@2";
|
||||
|
||||
Handle one;
|
||||
@ -776,9 +912,16 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod @4 @3 10800");
|
||||
Formulas.push_back(L"sum width 0 @5");
|
||||
|
||||
AdjustmentValues = L"16200,5400";
|
||||
Adjustments.push_back(16200);
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = L"@0,0;@5,10800;@0,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@5,@1,@6,@2";
|
||||
|
||||
Handle one;
|
||||
@ -801,9 +944,15 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #0");
|
||||
Formulas.push_back(L"prod #0 1 2");
|
||||
|
||||
AdjustmentValues = L"16200";
|
||||
Adjustments.push_back(16200);
|
||||
|
||||
ConnectorLocations = L"@1,0;0,10800;@1,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,0,10800,21600;0,0,16200,21600;0,0,21600,21600";
|
||||
|
||||
Handle one;
|
||||
@ -826,9 +975,15 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 @0");
|
||||
Formulas.push_back(L"prod #0 1 2");
|
||||
|
||||
AdjustmentValues = L"16200";
|
||||
Adjustments.push_back(16200);
|
||||
|
||||
ConnectorLocations = L"@2,0;@1,10800;@2,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,0,10800,21600;0,0,16200,21600;0,0,21600,21600";
|
||||
|
||||
Handle one;
|
||||
@ -854,10 +1009,19 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 #1");
|
||||
Formulas.push_back(L"sum 21600 0 #3");
|
||||
Formulas.push_back(L"prod #0 1 2");
|
||||
|
||||
Adjustments.push_back(14400);
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(18000);
|
||||
Adjustments.push_back(8100);
|
||||
|
||||
AdjustmentValues = L"14400,5400,18000,8100";
|
||||
ConnectorLocations = L"@6,0;0,10800;@6,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,0,@0,21600";
|
||||
|
||||
Handle one;
|
||||
@ -895,9 +1059,18 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 #3");
|
||||
Formulas.push_back(L"sum #0 21600 0");
|
||||
|
||||
AdjustmentValues = L"7200,5400,3600,8100";
|
||||
Adjustments.push_back(7200);
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(3600);
|
||||
Adjustments.push_back(8100);
|
||||
|
||||
ConnectorLocations = L"@7,0;0,10800;@7,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@0,0,21600,21600";
|
||||
|
||||
Handle one;
|
||||
@ -936,9 +1109,18 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum #0 21600 0");
|
||||
Formulas.push_back(L"prod @6 1 2");
|
||||
|
||||
AdjustmentValues = L"7200,5400,3600,8100";
|
||||
Adjustments.push_back(7200);
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(3600);
|
||||
Adjustments.push_back(8100);
|
||||
|
||||
ConnectorLocations = L"10800,0;0,@7;10800,21600;21600,@7";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,@0,21600,21600";
|
||||
|
||||
Handle one;
|
||||
@ -976,9 +1158,18 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 #3");
|
||||
Formulas.push_back(L"prod #0 1 2");
|
||||
|
||||
AdjustmentValues = L"14400,5400,18000,8100";
|
||||
Adjustments.push_back(14400);
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(18000);
|
||||
Adjustments.push_back(8100);
|
||||
|
||||
ConnectorLocations = L"10800,0;0,@6;10800,21600;21600,@6";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,0,21600,@0";
|
||||
|
||||
Handle one;
|
||||
@ -1019,9 +1210,18 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 #0");
|
||||
Formulas.push_back(L"sum 21600 0 #2");
|
||||
|
||||
AdjustmentValues = L"5400,5400,2700,8100";
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(2700);
|
||||
Adjustments.push_back(8100);
|
||||
|
||||
ConnectorLocations = L"10800,0;0,10800;10800,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"@0,0,@8,21600";
|
||||
|
||||
Handle one;
|
||||
@ -1062,9 +1262,18 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 #0");
|
||||
Formulas.push_back(L"sum 21600 0 #2");
|
||||
|
||||
AdjustmentValues = L"5400,5400,2700,8100";
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(2700);
|
||||
Adjustments.push_back(8100);
|
||||
|
||||
ConnectorLocations = L"10800,0;0,10800;10800,21600;21600,10800";
|
||||
ConnectorAngles = L"270,180,90,0";
|
||||
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
TextBoxRectangle = L"0,@0,21600,@8";
|
||||
|
||||
Handle one;
|
||||
@ -1105,7 +1314,11 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 #0");
|
||||
Formulas.push_back(L"sum 21600 0 #2");
|
||||
|
||||
AdjustmentValues = L"5400,8100,2700,9450";
|
||||
Adjustments.push_back(5400);
|
||||
Adjustments.push_back(8100);
|
||||
Adjustments.push_back(2700);
|
||||
Adjustments.push_back(9450);
|
||||
|
||||
ConnectorLocations = L"Rectangle";
|
||||
TextBoxRectangle = L"@0,@0,@8,@8";
|
||||
|
||||
@ -1135,8 +1348,6 @@ namespace DocFileFormat
|
||||
ShapeConcentricFill = false;
|
||||
Joins = miter;
|
||||
|
||||
AdjustmentValues = L"-11796480,,5400";
|
||||
|
||||
Path = L"al10800,10800@8@8@4@6,10800,10800,10800,10800@9@7l@30@31@17@18@24@25@15@16@32@33xe";
|
||||
|
||||
Formulas.push_back(L"val #1");
|
||||
@ -1190,7 +1401,10 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum @35 10800 0");
|
||||
Formulas.push_back(L"sum @36 10800 0");
|
||||
|
||||
AdjustmentValues = L"-11796480,,5400";
|
||||
Adjustments.push_back(-11796480);
|
||||
Adjustments.push_back(0);
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = L"@44,@45;@48,@49;@46,@47;@17,@18;@24,@25;@15,@16";
|
||||
TextBoxRectangle = L"3163,3163,18437,18437";
|
||||
|
||||
|
||||
@ -54,7 +54,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back((L"sum @1 @5 0"));
|
||||
Formulas.push_back((L"sum @2 @5 0"));
|
||||
|
||||
AdjustmentValues = (L"2700");
|
||||
Adjustments.push_back(2700);
|
||||
|
||||
ConnectorLocations = (L"0,@4;@0,@4;@3,21600;@3,@2;21600,@4;@1,@4;@3,0;@3,@0");
|
||||
TextBoxRectangle = (L"@0,@0,@1,@2");
|
||||
|
||||
|
||||
@ -88,7 +88,9 @@ namespace DocFileFormat
|
||||
Formulas.push_back((L"if @4 @32 21600"));
|
||||
Formulas.push_back((L"if @6 @41 @33"));
|
||||
|
||||
AdjustmentValues = (L"11796480,5400");
|
||||
Adjustments.push_back(11796480);
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = (L"10800,@27;@22,@23;10800,@26;@24,@23");
|
||||
TextBoxRectangle = (L"@36,@40,@37,@42");
|
||||
|
||||
|
||||
@ -57,7 +57,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 @9");
|
||||
Formulas.push_back(L"val #1");
|
||||
|
||||
AdjustmentValues = L"1800";
|
||||
Adjustments.push_back(1800);
|
||||
|
||||
ConnectorLocations = L"0,0;21600,@11;0,21600";
|
||||
TextBoxRectangle = L"0,@4,7637,@5";
|
||||
|
||||
@ -87,7 +88,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod #0 9598 32768");
|
||||
Formulas.push_back(L"sum 21600 0 @2");
|
||||
|
||||
AdjustmentValues = L"1800";
|
||||
Adjustments.push_back(1800);
|
||||
|
||||
ConnectorLocations = L"0,0;0,21600;21600,10800";
|
||||
TextBoxRectangle = L"0,@2,15274,@3";
|
||||
|
||||
@ -120,7 +122,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 @9");
|
||||
Formulas.push_back(L"val #1");
|
||||
|
||||
AdjustmentValues = L"1800,10800";
|
||||
Adjustments.push_back(1800);
|
||||
Adjustments.push_back(10800);
|
||||
ConnectorLocations = L"21600,0;0,10800;21600,21600";
|
||||
TextBoxRectangle = L"13963,@4,21600,@5";
|
||||
|
||||
@ -157,7 +160,9 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum 21600 0 @9");
|
||||
Formulas.push_back(L"val #1");
|
||||
|
||||
AdjustmentValues = L"1800,10800";
|
||||
Adjustments.push_back(1800);
|
||||
Adjustments.push_back(10800);
|
||||
|
||||
ConnectorLocations = L"0,0;21600,@11;0,21600";
|
||||
TextBoxRectangle = L"0,@4,7637,@5";
|
||||
|
||||
@ -197,7 +202,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum @11 #0 0");
|
||||
Formulas.push_back(L"sum width 0 @13");
|
||||
|
||||
AdjustmentValues = L"1800";
|
||||
Adjustments.push_back(1800);
|
||||
|
||||
ConnectorLocations = L"@3,0;0,@4;@3,@2;@1,@4";
|
||||
TextBoxRectangle = L"@13,@11,@14,@12";
|
||||
|
||||
@ -231,7 +237,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"prod width 1 2");
|
||||
Formulas.push_back(L"prod height 1 2");
|
||||
|
||||
AdjustmentValues = L"1800";
|
||||
Adjustments.push_back(1800);
|
||||
|
||||
ConnectorLocations = L"@8,0;0,@9;@8,@7;@6,@9";
|
||||
TextBoxRectangle = L"@3,@3,@4,@5";
|
||||
|
||||
|
||||
@ -81,7 +81,9 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #0");
|
||||
Formulas.push_back(L"val #1");
|
||||
|
||||
AdjustmentValues = L"1350,25920";
|
||||
Adjustments.push_back(1350);
|
||||
Adjustments.push_back(25920);
|
||||
|
||||
ConnectorLocations = L"10800,0;0,10800;10800,21600;21600,10800;@34,@35";
|
||||
|
||||
Handle one;
|
||||
@ -136,7 +138,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #0");
|
||||
Formulas.push_back(L"val #1");
|
||||
|
||||
AdjustmentValues = L"1350,25920";
|
||||
Adjustments.push_back(1350);
|
||||
Adjustments.push_back(25920);
|
||||
ConnectorLocations = L"10800,0;0,10800;10800,21600;21600,10800;@34,@35";
|
||||
TextBoxRectangle = L"791,791,20809,20809";
|
||||
|
||||
@ -179,7 +182,9 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"if @20 #0 @13");
|
||||
Formulas.push_back(L"if @20 #1 @14");
|
||||
|
||||
AdjustmentValues = L"1350,25920";
|
||||
Adjustments.push_back(1350);
|
||||
Adjustments.push_back(25920);
|
||||
|
||||
ConnectorLocations = L"10800,0;3163,3163;0,10800;3163,18437;10800,21600;18437,18437;21600,10800;18437,3163;@21,@22";
|
||||
TextBoxRectangle = L"3163,3163,18437,18437";
|
||||
|
||||
@ -239,12 +244,14 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #0");
|
||||
Formulas.push_back(L"val #1");
|
||||
|
||||
AdjustmentValues = L"1350,25920";
|
||||
Adjustments.push_back(1350);
|
||||
Adjustments.push_back(25920);
|
||||
|
||||
ConnectorLocations = L"67,10800;10800,21577;21582,10800;10800,1235;@38,@39";
|
||||
TextBoxRectangle = L"2977,3262,17087,17337";
|
||||
|
||||
Handle one;
|
||||
one.position = L"#0,#1";
|
||||
one.position = L"#0,#1";
|
||||
Handles.push_back (one);
|
||||
}
|
||||
};
|
||||
@ -263,7 +270,11 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-1800,24300,-1800,4050";
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -283,18 +294,23 @@ namespace DocFileFormat
|
||||
{
|
||||
ShapeConcentricFill = true;
|
||||
Joins = miter;
|
||||
Path = L"m@0@1l@2@3nfem,l21600,r,21600l,21600xe";
|
||||
|
||||
Path = L"m@0@1l@2@3nfem,l21600,r,21600l,21600xe";
|
||||
|
||||
Formulas.push_back(L"val #0");
|
||||
Formulas.push_back(L"val #1");
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-8280,24300,-1800,4050";
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
Adjustments.push_back(-8280);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
one.position = L"#0,#1";
|
||||
one.position = L"#0,#1";
|
||||
Handles.push_back (one);
|
||||
|
||||
Handle two;
|
||||
@ -317,7 +333,13 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-10080,24300,-3600,4050,-1800,4050";
|
||||
Adjustments.push_back(-10080);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-3600);
|
||||
Adjustments.push_back(4050);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -346,7 +368,13 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #4");
|
||||
Formulas.push_back(L"val #5");
|
||||
|
||||
AdjustmentValues = L"-10080,24300,-3600,4050,-1800,4050";
|
||||
Adjustments.push_back(-10080);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-3600);
|
||||
Adjustments.push_back(4050);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -377,7 +405,10 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-1800,24300,-1800,4050";
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -404,7 +435,11 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-8280,24300,-1800,4050";
|
||||
Adjustments.push_back(-8280);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -433,7 +468,11 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #4");
|
||||
Formulas.push_back(L"val #5");
|
||||
|
||||
AdjustmentValues = L"-8280,24300,-1800,4050";
|
||||
Adjustments.push_back(-8280);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -468,7 +507,15 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #6");
|
||||
Formulas.push_back(L"val #7");
|
||||
|
||||
AdjustmentValues = L"23400,24400,25200,21600,25200,4050,23400,4050";
|
||||
Adjustments.push_back(23400);
|
||||
Adjustments.push_back(24400);
|
||||
Adjustments.push_back(25200);
|
||||
Adjustments.push_back(21600);
|
||||
Adjustments.push_back(25200);
|
||||
Adjustments.push_back(4050);
|
||||
Adjustments.push_back(23400);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -503,7 +550,11 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-1800,24300,-1800,4050";
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -530,7 +581,11 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-8280,24300,-1800,4050";
|
||||
Adjustments.push_back(-8280);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -559,7 +614,13 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #4");
|
||||
Formulas.push_back(L"val #5");
|
||||
|
||||
AdjustmentValues = L"-10080,24300,-3600,4050,-1800,4050";
|
||||
Adjustments.push_back(-10080);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-3600);
|
||||
Adjustments.push_back(4050);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -594,7 +655,15 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #6");
|
||||
Formulas.push_back(L"val #7");
|
||||
|
||||
AdjustmentValues = L"23400,24400,25200,21600,25200,4050,23400,4050";
|
||||
Adjustments.push_back(23400);
|
||||
Adjustments.push_back(24400);
|
||||
Adjustments.push_back(25200);
|
||||
Adjustments.push_back(21600);
|
||||
Adjustments.push_back(25200);
|
||||
Adjustments.push_back(4050);
|
||||
Adjustments.push_back(23400);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -629,7 +698,11 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-1800,24300,-1800,4050";
|
||||
Adjustments.push_back(-8280);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -656,7 +729,11 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #2");
|
||||
Formulas.push_back(L"val #3");
|
||||
|
||||
AdjustmentValues = L"-8280,24300,-1800,4050";
|
||||
Adjustments.push_back(-8280);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -685,7 +762,13 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #4");
|
||||
Formulas.push_back(L"val #5");
|
||||
|
||||
AdjustmentValues = L"-10080,24300,-3600,4050,-1800,4050";
|
||||
Adjustments.push_back(-10080);
|
||||
Adjustments.push_back(24300);
|
||||
Adjustments.push_back(-3600);
|
||||
Adjustments.push_back(4050);
|
||||
Adjustments.push_back(-1800);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
@ -720,7 +803,15 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"val #6");
|
||||
Formulas.push_back(L"val #7");
|
||||
|
||||
AdjustmentValues = L"23400,24400,25200,21600,25200,4050,23400,4050";
|
||||
Adjustments.push_back(23400);
|
||||
Adjustments.push_back(24400);
|
||||
Adjustments.push_back(25200);
|
||||
Adjustments.push_back(21600);
|
||||
Adjustments.push_back(25200);
|
||||
Adjustments.push_back(4050);
|
||||
Adjustments.push_back(23400);
|
||||
Adjustments.push_back(4050);
|
||||
|
||||
ConnectorLocations = L"@0,@1;10800,0;10800,21600;0,10800;21600,10800";
|
||||
|
||||
Handle one;
|
||||
|
||||
@ -41,28 +41,32 @@ namespace DocFileFormat
|
||||
CanType():
|
||||
ShapeType(msosptCan)
|
||||
{
|
||||
this->ShapeConcentricFill = true;
|
||||
ShapeConcentricFill = true;
|
||||
|
||||
this->Joins = round;
|
||||
Joins = round;
|
||||
|
||||
this->Path = L"m10800,qx0@1l0@2qy10800,21600,21600@2l21600@1qy10800,xem0@1qy10800@0,21600@1nfe";
|
||||
Path = L"m10800,qx0@1l0@2qy10800,21600,21600@2l21600@1qy10800,xem0@1qy10800@0,21600@1nfe";
|
||||
|
||||
this->Formulas.push_back( L"val #0" );
|
||||
this->Formulas.push_back( L"prod #0 1 2" );
|
||||
this->Formulas.push_back( L"sum height 0 @1" );
|
||||
Formulas.push_back( L"val #0" );
|
||||
Formulas.push_back( L"prod #0 1 2" );
|
||||
Formulas.push_back( L"sum height 0 @1" );
|
||||
|
||||
this->AdjustmentValues = L"5400";
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
this->ConnectorLocations = L"10800,@0;10800,0;0,10800;10800,21600;21600,10800";
|
||||
ConnectorLocations = L"10800,@0;10800,0;0,10800;10800,21600;21600,10800";
|
||||
|
||||
this->ConnectorAngles = L"270,270,180,90,0";
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
this->TextBoxRectangle = L"0,@0,21600,@2";
|
||||
TextBoxRectangle = L"0,@0,21600,@2";
|
||||
|
||||
Handle HandleOne;
|
||||
HandleOne.position = L"center,#0";
|
||||
HandleOne.yrange = L"0,10800";
|
||||
this->Handles.push_back( HandleOne );
|
||||
Handles.push_back( HandleOne );
|
||||
}
|
||||
|
||||
virtual ~CanType()
|
||||
|
||||
@ -56,7 +56,8 @@ namespace DocFileFormat
|
||||
|
||||
Formulas.push_back(L"val #0");
|
||||
|
||||
AdjustmentValues = L"10800";
|
||||
Adjustments.push_back(10800);
|
||||
|
||||
ConnectorLocations = L"0,0;21600,21600";
|
||||
}
|
||||
};
|
||||
@ -69,7 +70,6 @@ namespace DocFileFormat
|
||||
ShapeConcentricFill = true;
|
||||
Joins = miter;
|
||||
Path = L"m,l21600,r,21600e";
|
||||
//AdjustmentValues = L"10800";
|
||||
|
||||
Filled = true;
|
||||
}
|
||||
@ -82,11 +82,12 @@ namespace DocFileFormat
|
||||
{
|
||||
ShapeConcentricFill = true;
|
||||
Joins = miter;
|
||||
Path = L"m,l@0,0@0,21600,21600,21600e";
|
||||
AdjustmentValues = L"10800";
|
||||
|
||||
Filled = true;
|
||||
|
||||
Path = L"m,l@0,0@0,21600,21600,21600e";
|
||||
|
||||
Adjustments.push_back(10800);
|
||||
|
||||
Formulas.push_back(L"val #0");
|
||||
|
||||
Handle one;
|
||||
@ -102,11 +103,12 @@ namespace DocFileFormat
|
||||
{
|
||||
ShapeConcentricFill = true;
|
||||
Joins = miter;
|
||||
Path = L"m,l@0,0@0,21600,21600,21600e";
|
||||
AdjustmentValues = L"10800";
|
||||
|
||||
Filled = true;
|
||||
|
||||
|
||||
Path = L"m,l@0,0@0,21600,21600,21600e";
|
||||
|
||||
Adjustments.push_back(10800);
|
||||
|
||||
Formulas.push_back(L"val #0");
|
||||
|
||||
Handle one;
|
||||
@ -122,10 +124,11 @@ namespace DocFileFormat
|
||||
{
|
||||
ShapeConcentricFill = true;
|
||||
Joins = miter;
|
||||
Path = L"m,l@0,0@0,21600,21600,21600e";
|
||||
AdjustmentValues = L"10800";
|
||||
|
||||
Filled = true;
|
||||
|
||||
Path = L"m,l@0,0@0,21600,21600,21600e";
|
||||
|
||||
Adjustments.push_back(10800);
|
||||
|
||||
Formulas.push_back(L"val #0");
|
||||
|
||||
@ -142,13 +145,15 @@ namespace DocFileFormat
|
||||
{
|
||||
ShapeConcentricFill = true;
|
||||
Joins = round;
|
||||
|
||||
Path = L"m,c@0,0@1,5400@1,10800@1,16200@2,21600,21600,21600e";
|
||||
|
||||
Formulas.push_back(L"mid #0 0");
|
||||
Formulas.push_back(L"val #0");
|
||||
Formulas.push_back(L"mid #0 21600");
|
||||
|
||||
AdjustmentValues = L"10800";
|
||||
Adjustments.push_back(10800);
|
||||
|
||||
ConnectorLocations = L"0,0;21600,21600";
|
||||
}
|
||||
};
|
||||
|
||||
@ -41,35 +41,39 @@ namespace DocFileFormat
|
||||
CubeType():
|
||||
ShapeType(msosptCube)
|
||||
{
|
||||
this->ShapeConcentricFill = true;
|
||||
ShapeConcentricFill = true;
|
||||
Joins = miter;
|
||||
|
||||
this->Joins = miter;
|
||||
Path = L"m@0,l0@0,,21600@1,21600,21600@2,21600,xem0@0nfl@1@0,21600,em@1@0nfl@1,21600e";
|
||||
|
||||
this->Path = L"m@0,l0@0,,21600@1,21600,21600@2,21600,xem0@0nfl@1@0,21600,em@1@0nfl@1,21600e";
|
||||
Formulas.push_back( L"val #0");
|
||||
Formulas.push_back( L"sum width 0 #0");
|
||||
Formulas.push_back( L"sum height 0 #0");
|
||||
Formulas.push_back( L"mid height #0");
|
||||
Formulas.push_back( L"prod @1 1 2");
|
||||
Formulas.push_back( L"prod @2 1 2");
|
||||
Formulas.push_back( L"mid width #0");
|
||||
|
||||
this->Formulas.push_back( L"val #0");
|
||||
this->Formulas.push_back( L"sum width 0 #0");
|
||||
this->Formulas.push_back( L"sum height 0 #0");
|
||||
this->Formulas.push_back( L"mid height #0");
|
||||
this->Formulas.push_back( L"prod @1 1 2");
|
||||
this->Formulas.push_back( L"prod @2 1 2");
|
||||
this->Formulas.push_back( L"mid width #0");
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
this->AdjustmentValues = L"5400";
|
||||
ConnectorLocations = L"@6,0;@4,@0;0,@3;@4,21600;@1,@3;21600,@5";
|
||||
|
||||
this->ConnectorLocations = L"@6,0;@4,@0;0,@3;@4,21600;@1,@3;21600,@5";
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(270);
|
||||
ConnectorAngles.push_back(180);
|
||||
ConnectorAngles.push_back(90);
|
||||
ConnectorAngles.push_back(0);
|
||||
ConnectorAngles.push_back(0);
|
||||
|
||||
this->ConnectorAngles = L"270,270,180,90,0,0";
|
||||
|
||||
this->TextBoxRectangle = L"0,@0,@1,21600";
|
||||
TextBoxRectangle = L"0,@0,@1,21600";
|
||||
|
||||
Handle HandleOne;
|
||||
HandleOne.position = L"topLeft,#0";
|
||||
HandleOne.switchHandle = L"true";
|
||||
HandleOne.yrange = L"0,21600";
|
||||
this->Handles.push_back( HandleOne );
|
||||
Handles.push_back( HandleOne );
|
||||
|
||||
this->Limo = L"10800,10800";
|
||||
Limo = L"10800,10800";
|
||||
}
|
||||
|
||||
virtual ~CubeType()
|
||||
|
||||
@ -51,7 +51,8 @@ namespace DocFileFormat
|
||||
Formulas.push_back(L"sum width 0 @3" ) ;
|
||||
Formulas.push_back(L"sum height 0 @3" );
|
||||
|
||||
AdjustmentValues = L"5400";
|
||||
Adjustments.push_back(5400);
|
||||
|
||||
ConnectorLocations = L"10800,0;3163,3163;0,10800;3163,18437;10800,21600;18437,18437;21600,10800;18437,3163";
|
||||
TextBoxRectangle = L"3163,3163,18437,18437";
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user