mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-14 11:56:01 +08:00
Compare commits
4 Commits
develop
...
feature/hw
| Author | SHA1 | Date | |
|---|---|---|---|
| ebed729f13 | |||
| 7146c08ef4 | |||
| 5ae071fa19 | |||
| f75cc7fe0f |
@ -6,13 +6,12 @@ import os
|
||||
if not base.is_dir("glm"):
|
||||
base.cmd("git", ["clone", "https://github.com/g-truc/glm.git"])
|
||||
base.cmd_in_dir("glm", "git", ["checkout", "33b4a621a697a305bc3a7610d290677b96beb181", "--quiet"])
|
||||
base.replaceInFile("./glm/glm/detail/func_common.inl", "vec<L, T, Q> v;", "vec<L, T, Q> v{};")
|
||||
|
||||
if not base.is_dir("mdds"):
|
||||
base.cmd("git", ["clone", "https://github.com/kohei-us/mdds.git"])
|
||||
base.cmd_in_dir("mdds", "git", ["checkout", "0783158939c6ce4b0b1b89e345ab983ccb0f0ad0"], "--quiet")
|
||||
|
||||
fix_cpp_version = "#if __cplusplus < 201703L\n"
|
||||
fix_cpp_version = "#if __cplusplus < 201402L\n"
|
||||
fix_cpp_version += "#ifndef _MSC_VER\n"
|
||||
fix_cpp_version += "namespace std {\n"
|
||||
fix_cpp_version += " template<bool __v>\n"
|
||||
|
||||
4
Common/3dParty/v8_89/.gitignore
vendored
4
Common/3dParty/v8_89/.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
.cipd
|
||||
.gclient*
|
||||
.gcs*
|
||||
.gclient
|
||||
.gclient_entries
|
||||
v8
|
||||
depot_tools
|
||||
v8.data
|
||||
|
||||
@ -967,12 +967,7 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring &_fileName)
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
|
||||
else if (0 == sExt.compare(L".md"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MD;
|
||||
else if (0 == sExt.compare(L".tsv"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_TSV;
|
||||
else if (0 == sExt.compare(L".scsv"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_SCSV;
|
||||
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".tsv") || 0 == sExt.compare(L".dsv") || 0 == sExt.compare(L".cssv")
|
||||
|| 0 == sExt.compare(L".xls") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xlsb"))
|
||||
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".tsv") || 0 == sExt.compare(L".xls") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xlsb"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
|
||||
else if (0 == sExt.compare(L".html") || 0 == sExt.compare(L".htm"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;
|
||||
@ -1804,10 +1799,6 @@ std::wstring COfficeFileFormatChecker::GetExtensionByType(int type)
|
||||
return L".ods";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV:
|
||||
return L".csv";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_TSV:
|
||||
return L".tsv";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_SCSV:
|
||||
return L".scsv";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT:
|
||||
return L".fods";
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS:
|
||||
@ -1997,11 +1988,7 @@ int COfficeFileFormatChecker::GetFormatByExtension(const std::wstring &sExt)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB;
|
||||
if (L".xls" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS;
|
||||
if (L".tsv" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_TSV;
|
||||
if (L".scsv" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_SCSV;
|
||||
if (L".csv" == ext || L".dsv" == ext)
|
||||
if (L".csv" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
|
||||
if (L".fods" == ext)
|
||||
return AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT;
|
||||
|
||||
@ -87,14 +87,13 @@
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0005
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0006
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0007
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSB AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0008
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS_FLAT AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0009
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x000a
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_FLAT AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x000b
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX_PACKAGE AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x000c
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_NUMBERS AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x000d
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_TSV AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0014
|
||||
#define AVS_OFFICESTUDIO_FILE_SPREADSHEET_SCSV AVS_OFFICESTUDIO_FILE_SPREADSHEET + 0x0024
|
||||
|
||||
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM 0x0200
|
||||
#define AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF AVS_OFFICESTUDIO_FILE_CROSSPLATFORM + 0x0001
|
||||
|
||||
200
Common/base.pri
200
Common/base.pri
@ -118,13 +118,13 @@ win32:contains(QMAKE_TARGET.arch, arm64): {
|
||||
}
|
||||
|
||||
linux-clang-libc++ {
|
||||
CONFIG += core_linux
|
||||
CONFIG += core_linux
|
||||
CONFIG += core_linux_64
|
||||
CONFIG += core_linux_clang
|
||||
message("linux-64-clang-libc++")
|
||||
}
|
||||
linux-clang-libc++-32 {
|
||||
CONFIG += core_linux
|
||||
CONFIG += core_linux
|
||||
CONFIG += core_linux_32
|
||||
CONFIG += core_linux_clang
|
||||
message("linux-32-clang-libc++")
|
||||
@ -180,9 +180,9 @@ mac {
|
||||
!core_ios {
|
||||
CONFIG += core_mac
|
||||
CONFIG += core_mac_64
|
||||
}
|
||||
|
||||
DEFINES += _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
|
||||
DEFINES += _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
|
||||
}
|
||||
}
|
||||
|
||||
# DEFINES
|
||||
@ -199,58 +199,32 @@ core_win_64 {
|
||||
DEFINES += WIN64 _WIN64
|
||||
}
|
||||
|
||||
defineTest(startsWith) {
|
||||
tmp = $$2
|
||||
tmp ~= s,^$$re_escape($$1),,
|
||||
!equals(tmp, $$2): return(true)
|
||||
return(false)
|
||||
}
|
||||
|
||||
core_linux {
|
||||
DEFINES += LINUX _LINUX
|
||||
|
||||
QMAKE_CUSTOM_SYSROOT = $$(QMAKE_CUSTOM_SYSROOT)
|
||||
!isEmpty(QMAKE_CUSTOM_SYSROOT) {
|
||||
CONFIG += core_linix_use_sysroot
|
||||
message("using custom sysroot $$QMAKE_CUSTOM_SYSROOT")
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$(QMAKE_CUSTOM_SYSROOT)/usr/bin/
|
||||
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$(QMAKE_CUSTOM_SYSROOT_BIN)
|
||||
isEmpty(QMAKE_CUSTOM_SYSROOT_BIN) {
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$QMAKE_CUSTOM_SYSROOT/usr/bin
|
||||
core_linux_64 {
|
||||
!linux_arm64 { # x86_64
|
||||
QMAKE_CUSTOM_SYSROOT_LIB = $$(QMAKE_CUSTOM_SYSROOT)/usr/lib/x86_64-linux-gnu
|
||||
!isEmpty(QMAKE_CUSTOM_SYSROOT) {
|
||||
message("using custom sysroot $$QMAKE_CUSTOM_SYSROOT")
|
||||
QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "gcc")
|
||||
QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
|
||||
QMAKE_CFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT
|
||||
QMAKE_CXXFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT -std=gnu++1y
|
||||
QMAKE_LFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT
|
||||
}
|
||||
}
|
||||
QMAKE_CUSTOM_SYSROOT_BIN = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , /)
|
||||
|
||||
startsWith($$QMAKE_CUSTOM_SYSROOT, $$QMAKE_CUSTOM_SYSROOT_BIN) {
|
||||
message("Using compilers from same sysroot")
|
||||
QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "gcc")
|
||||
QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++")
|
||||
QMAKE_AR = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "ar") cqs
|
||||
QMAKE_RANLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "ranlib")
|
||||
QMAKE_STRIP = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "strip")
|
||||
} else {
|
||||
message("Using cross-compilers from host sysroot")
|
||||
QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-gcc")
|
||||
QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-g++")
|
||||
QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-g++")
|
||||
QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-g++")
|
||||
QMAKE_AR = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-ar") cqs
|
||||
QMAKE_RANLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-ranlib")
|
||||
QMAKE_STRIP = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-strip")
|
||||
QMAKE_OBJCOPY = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "aarch64-linux-gnu-objcopy")
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS += --sysroot=$$QMAKE_CUSTOM_SYSROOT
|
||||
QMAKE_CXXFLAGS += --sysroot=$$QMAKE_CUSTOM_SYSROOT -std=gnu++1y
|
||||
|
||||
QMAKE_LFLAGS += --sysroot=$$QMAKE_CUSTOM_SYSROOT
|
||||
QMAKE_INCDIR += $$QMAKE_CUSTOM_SYSROOT/usr/include
|
||||
}
|
||||
}
|
||||
|
||||
gcc {
|
||||
COMPILER_VERSION = $$system($$QMAKE_CXX " -dumpversion")
|
||||
COMPILER_VERSION = $$system($$QMAKE_CXX " -dumpversion")
|
||||
COMPILER_MAJOR_VERSION_ARRAY = $$split(COMPILER_VERSION, ".")
|
||||
COMPILER_MAJOR_VERSION = $$member(COMPILER_MAJOR_VERSION_ARRAY, 0)
|
||||
lessThan(COMPILER_MAJOR_VERSION, 5): CONFIG += build_gcc_less_5
|
||||
@ -280,11 +254,6 @@ core_mac {
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12
|
||||
!apple_silicon:QMAKE_APPLE_DEVICE_ARCHS = x86_64
|
||||
}
|
||||
|
||||
!core_debug {
|
||||
equals(TEMPLATE, app):QMAKE_POST_LINK += strip $(TARGET)
|
||||
# TODO: plugin!
|
||||
}
|
||||
}
|
||||
|
||||
core_linux_clang {
|
||||
@ -343,10 +312,6 @@ core_linux {
|
||||
core_linux {
|
||||
equals(TEMPLATE, app):CONFIG += core_static_link_libstd
|
||||
plugin:CONFIG += core_static_link_libstd
|
||||
|
||||
|
||||
equals(TEMPLATE, app):QMAKE_LFLAGS_RELEASE += -Wl,-s
|
||||
plugin:QMAKE_LFLAGS_RELEASE += -Wl,-s
|
||||
}
|
||||
|
||||
core_win_32 {
|
||||
@ -356,7 +321,7 @@ core_win_64 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = win_64
|
||||
}
|
||||
core_win_arm64 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = win_arm64
|
||||
CORE_BUILDS_PLATFORM_PREFIX = win_arm64
|
||||
}
|
||||
core_linux_32 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = linux_32
|
||||
@ -378,6 +343,27 @@ core_linux_arm {
|
||||
linux_arm64 {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = linux_arm64
|
||||
DEFINES += _ARM_ALIGN_
|
||||
|
||||
ARM64_TOOLCHAIN_BIN = $$(ARM64_TOOLCHAIN_BIN)
|
||||
ARM64_TOOLCHAIN_BIN_PREFIX = $$(ARM64_TOOLCHAIN_BIN_PREFIX)
|
||||
|
||||
!isEmpty(ARM64_TOOLCHAIN_BIN){
|
||||
!isEmpty(ARM64_TOOLCHAIN_BIN_PREFIX){
|
||||
ARM64_TOOLCHAIN_BIN_FULL = $$ARM64_TOOLCHAIN_BIN/$$ARM64_TOOLCHAIN_BIN_PREFIX
|
||||
message("using arm64 toolchain $$ARM64_TOOLCHAIN_BIN")
|
||||
|
||||
QMAKE_CC = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "gcc")
|
||||
QMAKE_CXX = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++")
|
||||
QMAKE_LINK = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++")
|
||||
QMAKE_LINK_SHLIB = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++")
|
||||
|
||||
QMAKE_AR = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "ar cqs")
|
||||
QMAKE_OBJCOPY = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "objcopy")
|
||||
QMAKE_NM = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "nm -P")
|
||||
QMAKE_STRIP = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "strip")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
core_ios {
|
||||
CORE_BUILDS_PLATFORM_PREFIX = ios
|
||||
@ -704,105 +690,3 @@ ADD_INC_PATH = $$(ADDITIONAL_INCLUDE_PATH)
|
||||
!disable_precompiled_header {
|
||||
CONFIG += precompile_header
|
||||
}
|
||||
|
||||
SWIFT_SOURCES=
|
||||
defineTest(UseSwift) {
|
||||
isEmpty(SWIFT_SOURCES): return(false)
|
||||
# work only on ios and mac
|
||||
!core_ios:!core_mac {
|
||||
return(false)
|
||||
}
|
||||
|
||||
# path to the bridging header that exposes Objective-C code to Swift
|
||||
BRIDGING_HEADER = $$1
|
||||
# sdk and toolchain (set from environment variables)
|
||||
SDK_PATH = $$(SDK_PATH)
|
||||
XCODE_TOOLCHAIN_PATH = $$(XCODE_TOOLCHAIN_PATH)
|
||||
|
||||
IOS_TARGET_PLATFORM = apple-ios11.0
|
||||
SWIFT_GEN_HEADERS_PATH = $$PWD_ROOT_DIR/core_build/$$CORE_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX
|
||||
ARCHS = arm64
|
||||
# simulator
|
||||
xcframework_platform_ios_simulator {
|
||||
IOS_TARGET_PLATFORM = $${IOS_TARGET_PLATFORM}-simulator
|
||||
SWIFT_GEN_HEADERS_PATH = $$SWIFT_GEN_HEADERS_PATH/simulator
|
||||
ARCHS += x86_64
|
||||
}
|
||||
|
||||
# add swift compiler for each architecture
|
||||
SWIFT_COMPILERS_OUT =
|
||||
for(ARCH, ARCHS) {
|
||||
COMPILER_NAME = swift_compiler_$${ARCH}
|
||||
COMPILER_OUTPUT = $$SWIFT_GEN_HEADERS_PATH/swift_module_$${ARCH}.o
|
||||
SWIFT_COMPILERS_OUT += $$COMPILER_OUTPUT
|
||||
|
||||
$${COMPILER_NAME}.name = SwiftCompiler_$${ARCH}
|
||||
$${COMPILER_NAME}.input = SWIFT_SOURCES
|
||||
$${COMPILER_NAME}.output = $$COMPILER_OUTPUT
|
||||
SWIFT_CMD = swiftc -c $$SWIFT_SOURCES \
|
||||
-module-name SwiftModule \
|
||||
-whole-module-optimization \
|
||||
-emit-objc-header \
|
||||
-emit-objc-header-path $$SWIFT_GEN_HEADERS_PATH/SwiftModule-Swift.h \
|
||||
-emit-object \
|
||||
-sdk $$SDK_PATH \
|
||||
-target $${ARCH}-$${IOS_TARGET_PLATFORM} \
|
||||
-o $$COMPILER_OUTPUT \
|
||||
-framework UIKit
|
||||
|
||||
!isEmpty(BRIDGING_HEADER) {
|
||||
SWIFT_CMD += -import-objc-header $$BRIDGING_HEADER
|
||||
}
|
||||
|
||||
$${COMPILER_NAME}.commands = $$SWIFT_CMD
|
||||
$${COMPILER_NAME}.CONFIG = combine target_predeps no_link
|
||||
|
||||
export($${COMPILER_NAME}.name)
|
||||
export($${COMPILER_NAME}.input)
|
||||
export($${COMPILER_NAME}.output)
|
||||
export($${COMPILER_NAME}.commands)
|
||||
export($${COMPILER_NAME}.CONFIG)
|
||||
QMAKE_EXTRA_COMPILERS += $${COMPILER_NAME}
|
||||
}
|
||||
|
||||
# add lipo tool execution to form universal binary
|
||||
LIPO_OUT = $$SWIFT_GEN_HEADERS_PATH/swift_module.o
|
||||
lipo_tool.name = LipoTool
|
||||
# as input for lipo_tool we set SWIFT_SOURCES (not SWIFT_COMPILERS_OUT as it won't be executed otherwise!)
|
||||
lipo_tool.input = SWIFT_SOURCES
|
||||
# compiled swift sources go into depends
|
||||
lipo_tool.depends = $$SWIFT_COMPILERS_OUT
|
||||
lipo_tool.output = $$LIPO_OUT
|
||||
lipo_tool.commands = lipo -create $$SWIFT_COMPILERS_OUT -output $$LIPO_OUT
|
||||
lipo_tool.CONFIG = combine target_predeps no_link
|
||||
lipo_tool.variable_out = OBJECTS
|
||||
|
||||
export(lipo_tool.name)
|
||||
export(lipo_tool.input)
|
||||
export(lipo_tool.depends)
|
||||
export(lipo_tool.output)
|
||||
export(lipo_tool.commands)
|
||||
export(lipo_tool.CONFIG)
|
||||
export(lipo_tool.variable_out)
|
||||
QMAKE_EXTRA_COMPILERS += lipo_tool
|
||||
|
||||
export(QMAKE_EXTRA_COMPILERS)
|
||||
|
||||
INCLUDEPATH += $$SWIFT_GEN_HEADERS_PATH
|
||||
export(INCLUDEPATH)
|
||||
|
||||
# link with libs from toolchain
|
||||
SWIFT_LIB_PATH = $$XCODE_TOOLCHAIN_PATH/usr/lib/swift/iphoneos
|
||||
xcframework_platform_ios_simulator {
|
||||
SWIFT_LIB_PATH = $$XCODE_TOOLCHAIN_PATH/usr/lib/swift/iphonesimulator
|
||||
}
|
||||
LIBS += -L$$SWIFT_LIB_PATH
|
||||
LIBS += -lswiftCore -lswiftFoundation -lswiftObjectiveC
|
||||
|
||||
export(LIBS)
|
||||
|
||||
OTHER_FILES += $$SWIFT_SOURCES
|
||||
export(OTHER_FILES)
|
||||
return(true)
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ def _loadLibrary(path):
|
||||
library_name = 'libdocbuilder.c.dylib'
|
||||
# if there is no dylib file, get library from framework
|
||||
if not os.path.exists(path + '/' + library_name):
|
||||
path = path + '/docbuilder.c.framework/Versions/A'
|
||||
path = path + '/docbuilder.c.framework'
|
||||
library_name = 'docbuilder.c'
|
||||
|
||||
_lib = ctypes.CDLL(path + '/' + library_name)
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
bool OpenFile(const std::wstring& sFile, const wchar_t* sPassword)
|
||||
bool OpenFile(const std::wstring& sFile, const std::wstring& sPassword)
|
||||
{
|
||||
CloseFile();
|
||||
|
||||
@ -171,7 +171,7 @@ public:
|
||||
|
||||
return m_pFile ? true : false;
|
||||
}
|
||||
bool OpenFile(BYTE* data, LONG size, const wchar_t* sPassword)
|
||||
bool OpenFile(BYTE* data, LONG size, const std::wstring& sPassword)
|
||||
{
|
||||
CloseFile();
|
||||
|
||||
@ -245,7 +245,7 @@ public:
|
||||
|
||||
return 0;
|
||||
}
|
||||
bool CheckOwnerPassword(const wchar_t* sPassword)
|
||||
bool CheckOwnerPassword(const std::wstring& sPassword)
|
||||
{
|
||||
if (m_nType == 0)
|
||||
return ((CPdfFile*)m_pFile)->CheckOwnerPassword(sPassword);
|
||||
@ -454,20 +454,6 @@ public:
|
||||
if (m_nType == 0)
|
||||
((CPdfFile*)m_pFile)->SetCMapMemory(data, size);
|
||||
}
|
||||
void SetScanPageFonts(int nPageIndex)
|
||||
{
|
||||
if (NULL == m_pImageStorage)
|
||||
m_pImageStorage = NSDocxRenderer::CreateWasmImageStorage();
|
||||
|
||||
CDocxRenderer oRenderer(m_pApplicationFonts);
|
||||
oRenderer.SetExternalImageStorage(m_pImageStorage);
|
||||
oRenderer.SetTextAssociationType(NSDocxRenderer::TextAssociationType::tatParagraphToShape);
|
||||
|
||||
oRenderer.ScanPageBin(m_pFile, nPageIndex);
|
||||
|
||||
if (m_nType == 0)
|
||||
((CPdfFile*)m_pFile)->SetPageFonts(nPageIndex);
|
||||
}
|
||||
BYTE* ScanPage(int nPageIndex, int mode)
|
||||
{
|
||||
if (NULL == m_pImageStorage)
|
||||
|
||||
@ -26,8 +26,7 @@ CDrawingFileEmbed::~CDrawingFileEmbed()
|
||||
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::OpenFile(JSSmart<CJSValue> sFile, JSSmart<CJSValue> sPassword)
|
||||
{
|
||||
std::wstring wsPassword = sPassword->isString() ? sPassword->toStringW() : L"";
|
||||
bool bResult = m_pFile->OpenFile(sFile->toStringW(), sPassword->isString() ? wsPassword.c_str() : NULL);
|
||||
bool bResult = m_pFile->OpenFile(sFile->toStringW(), sPassword->isString() ? sPassword->toStringW() : L"");
|
||||
return CJSContext::createBool(bResult);
|
||||
}
|
||||
JSSmart<CJSValue> CDrawingFileEmbed::CloseFile()
|
||||
|
||||
@ -461,8 +461,6 @@ namespace NSJSBase
|
||||
v8::SnapshotCreator snapshotCreator;
|
||||
v8::Isolate* isolate = snapshotCreator.GetIsolate();
|
||||
{
|
||||
CV8TryCatch try_catch(isolate);
|
||||
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
// Create a new context
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate);
|
||||
@ -474,12 +472,11 @@ namespace NSJSBase
|
||||
global->Set(context, v8::String::NewFromUtf8Literal(isolate, "self"), global).Check();
|
||||
global->Set(context, v8::String::NewFromUtf8Literal(isolate, "native"), v8::Undefined(isolate)).Check();
|
||||
|
||||
// Compile
|
||||
// Compile and run
|
||||
v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, script.c_str()).ToLocalChecked();
|
||||
v8::Local<v8::Script> script = v8::Script::Compile(context, source).ToLocalChecked();
|
||||
// Run
|
||||
script->Run(context).IsEmpty();
|
||||
|
||||
script->Run(context).IsEmpty();
|
||||
snapshotCreator.SetDefaultContext(context);
|
||||
}
|
||||
v8::StartupData data = snapshotCreator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
|
||||
|
||||
@ -62,13 +62,7 @@ v8::Local<v8::String> CreateV8String(v8::Isolate* i, const std::string& str);
|
||||
#include <android/log.h>
|
||||
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, "js", __VA_ARGS__)
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "js", __VA_ARGS__)
|
||||
#ifdef _DEBUG
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "js", __VA_ARGS__)
|
||||
#else
|
||||
// should be disabled for release builds
|
||||
#define LOGD(...)
|
||||
#endif // _DEBUG
|
||||
#endif // ANDROID_LOGS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -805,9 +799,6 @@ namespace NSJSBase
|
||||
CV8TryCatch() : CJSTryCatch(), try_catch(V8IsolateOneArg)
|
||||
{
|
||||
}
|
||||
CV8TryCatch(v8::Isolate* isolate) : CJSTryCatch(), try_catch(isolate)
|
||||
{
|
||||
}
|
||||
virtual ~CV8TryCatch()
|
||||
{
|
||||
}
|
||||
|
||||
@ -419,7 +419,6 @@ namespace Aggplus
|
||||
m_bReleaseImage = FALSE;
|
||||
Alpha = 255;
|
||||
m_bUseBounds = false;
|
||||
m_bIsScale = false;
|
||||
}
|
||||
|
||||
CBrushTexture::CBrushTexture(const std::wstring& strName, WrapMode wrapMode) : CBrush(BrushTypeTextureFill), m_wrapMode(wrapMode)
|
||||
@ -428,7 +427,6 @@ namespace Aggplus
|
||||
m_bReleaseImage = TRUE;
|
||||
Alpha = 255;
|
||||
m_bUseBounds = false;
|
||||
m_bIsScale = false;
|
||||
}
|
||||
|
||||
CBrushTexture::CBrushTexture(CImage *pImage, WrapMode wrapMode) : CBrush(BrushTypeTextureFill), m_wrapMode(wrapMode)
|
||||
@ -437,7 +435,6 @@ namespace Aggplus
|
||||
m_bReleaseImage = FALSE;
|
||||
Alpha = 255;
|
||||
m_bUseBounds = false;
|
||||
m_bIsScale = false;
|
||||
}
|
||||
|
||||
CBrushTexture::~CBrushTexture()
|
||||
|
||||
@ -205,10 +205,6 @@ public:
|
||||
bool m_bUseBounds;
|
||||
CDoubleRect m_oBounds;
|
||||
|
||||
bool m_bIsScale;
|
||||
double m_dScaleX;
|
||||
double m_dScaleY;
|
||||
|
||||
BYTE Alpha;
|
||||
};
|
||||
}
|
||||
|
||||
@ -847,8 +847,6 @@ namespace Aggplus
|
||||
double dScaleY = m_dDpiY / m_dDpiTile;
|
||||
|
||||
brushMatrix.Scale(dScaleX, dScaleY, Aggplus::MatrixOrderAppend);
|
||||
if (ptxBrush->m_bIsScale)
|
||||
brushMatrix.Scale(ptxBrush->m_dScaleX, ptxBrush->m_dScaleY, Aggplus::MatrixOrderAppend);
|
||||
}
|
||||
|
||||
brushMatrix.Translate(x, y, Aggplus::MatrixOrderAppend);
|
||||
|
||||
@ -886,12 +886,12 @@ namespace Aggplus
|
||||
if (isCurve)
|
||||
{
|
||||
std::vector<PointD> points = GetPoints(idx, 4);
|
||||
area = 3.0 * ((points[3].Y - points[0].Y) * (points[1].X + points[2].X)
|
||||
area = 3.0 * (points[3].Y - points[0].Y) * (points[1].X + points[2].X)
|
||||
- (points[3].X - points[0].X) * (points[1].Y + points[2].Y)
|
||||
+ points[1].Y * (points[0].X - points[2].X)
|
||||
- points[1].X * (points[0].Y - points[2].Y)
|
||||
+ points[3].Y * (points[2].X + points[0].X / 3.0)
|
||||
- points[3].X * (points[2].Y + points[0].Y / 3.0)) / 20.0;
|
||||
- points[3].X * (points[2].Y + points[0].Y / 3.0) / 20.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1007,18 +1007,16 @@ namespace Aggplus
|
||||
bool CGraphicsPath::operator==(const CGraphicsPath& other) noexcept
|
||||
{
|
||||
unsigned pointsCount = GetPointCount(),
|
||||
otherPointsCount = other.GetPointCount();
|
||||
otherPointsCount = other.GetPointCount();
|
||||
|
||||
if (pointsCount != otherPointsCount)
|
||||
return false;
|
||||
|
||||
std::vector<PointD> points = GetPoints(0, pointsCount),
|
||||
otherPoints = other.GetPoints(0, otherPointsCount);
|
||||
|
||||
bool reverse = IsClockwise() ^ other.IsClockwise();
|
||||
otherPoints = other.GetPoints(0, otherPointsCount);
|
||||
|
||||
for (unsigned i = 0; i < pointsCount; i++)
|
||||
if (!points[i].Equals(otherPoints[reverse ? pointsCount - i - 1 : i]))
|
||||
if (!points[i].Equals(otherPoints[i]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -1551,31 +1549,3 @@ namespace Aggplus
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT IRenderer::AddPath(const Aggplus::CGraphicsPath& path)
|
||||
{
|
||||
if (path.GetPointCount() == 0)
|
||||
return S_FALSE;
|
||||
|
||||
size_t length = path.GetPointCount() + path.GetCloseCount();
|
||||
std::vector<Aggplus::PointD> points = path.GetPoints(0, length);
|
||||
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
if (path.IsCurvePoint(i))
|
||||
{
|
||||
PathCommandCurveTo(points[i].X, points[i].Y,
|
||||
points[i + 1].X, points[i + 1].Y,
|
||||
points[i + 2].X, points[i + 2].Y);
|
||||
i += 2;
|
||||
}
|
||||
else if (path.IsMovePoint(i))
|
||||
PathCommandMoveTo(points[i].X, points[i].Y);
|
||||
else if (path.IsLinePoint(i))
|
||||
PathCommandLineTo(points[i].X, points[i].Y);
|
||||
else
|
||||
PathCommandClose();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -613,32 +613,6 @@ HRESULT CGraphicsRenderer::put_BrushTransform(const Aggplus::CMatrix& oMatrix)
|
||||
m_oBrush.Transform = oMatrix;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CGraphicsRenderer::get_BrushOffset(double& offsetX, double& offsetY) const
|
||||
{
|
||||
offsetX = m_oBrush.OffsetX;
|
||||
offsetY = m_oBrush.OffsetY;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CGraphicsRenderer::put_BrushOffset(const double& offsetX, const double& offsetY)
|
||||
{
|
||||
m_oBrush.OffsetX = offsetX;
|
||||
m_oBrush.OffsetY = offsetY;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CGraphicsRenderer::get_BrushScale(bool& isScale, double& scaleX, double& scaleY) const
|
||||
{
|
||||
isScale = m_oBrush.IsScale;
|
||||
scaleX = m_oBrush.ScaleX;
|
||||
scaleY = m_oBrush.ScaleY;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CGraphicsRenderer::put_BrushScale(bool isScale, const double& scaleX, const double& scaleY)
|
||||
{
|
||||
m_oBrush.IsScale = isScale;
|
||||
m_oBrush.ScaleX = scaleX;
|
||||
m_oBrush.ScaleY = scaleY;
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CGraphicsRenderer::BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height)
|
||||
{
|
||||
m_oBrush.Rectable = val;
|
||||
@ -972,17 +946,10 @@ HRESULT CGraphicsRenderer::DrawPath(const LONG& nType)
|
||||
switch (m_oBrush.TextureMode)
|
||||
{
|
||||
case c_BrushTextureModeTile:
|
||||
case c_BrushTextureModeTileCenter:
|
||||
oMode = Aggplus::WrapModeTile;
|
||||
break;
|
||||
case c_BrushTextureModeTileFlipX:
|
||||
oMode = Aggplus::WrapModeTileFlipX;
|
||||
break;
|
||||
case c_BrushTextureModeTileFlipY:
|
||||
oMode = Aggplus::WrapModeTileFlipY;
|
||||
break;
|
||||
case c_BrushTextureModeTileFlipXY:
|
||||
oMode = Aggplus::WrapModeTileFlipXY;
|
||||
case c_BrushTextureModeTileCenter:
|
||||
oMode = Aggplus::WrapModeTile;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1056,18 +1023,11 @@ HRESULT CGraphicsRenderer::DrawPath(const LONG& nType)
|
||||
if (m_oBrush.Rectable == 1)
|
||||
{
|
||||
pTextureBrush->m_bUseBounds = true;
|
||||
pTextureBrush->m_oBounds.left = m_oBrush.Rect.X + m_oBrush.OffsetX;
|
||||
pTextureBrush->m_oBounds.top = m_oBrush.Rect.Y + m_oBrush.OffsetY;
|
||||
pTextureBrush->m_oBounds.left = m_oBrush.Rect.X;
|
||||
pTextureBrush->m_oBounds.top = m_oBrush.Rect.Y;
|
||||
pTextureBrush->m_oBounds.right = pTextureBrush->m_oBounds.left + m_oBrush.Rect.Width;
|
||||
pTextureBrush->m_oBounds.bottom = pTextureBrush->m_oBounds.top + m_oBrush.Rect.Height;
|
||||
}
|
||||
|
||||
if (m_oBrush.IsScale == 1)
|
||||
{
|
||||
pTextureBrush->m_bIsScale = true;
|
||||
pTextureBrush->m_dScaleX = m_oBrush.ScaleX;
|
||||
pTextureBrush->m_dScaleY = m_oBrush.ScaleY;
|
||||
}
|
||||
}
|
||||
|
||||
pBrush = pTextureBrush;
|
||||
|
||||
@ -189,10 +189,6 @@ public:
|
||||
virtual HRESULT put_BrushLinearAngle(const double& dAngle);
|
||||
virtual HRESULT get_BrushTransform(Aggplus::CMatrix& oMatrix);
|
||||
virtual HRESULT put_BrushTransform(const Aggplus::CMatrix& oMatrix);
|
||||
virtual HRESULT get_BrushOffset(double& offsetX, double& offsetY) const;
|
||||
virtual HRESULT put_BrushOffset(const double& offsetX, const double& offsetY);
|
||||
virtual HRESULT get_BrushScale(bool& isScale, double& scaleX, double& scaleY) const;
|
||||
virtual HRESULT put_BrushScale(bool isScale, const double& scaleX, const double& scaleY);
|
||||
virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height);
|
||||
virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height);
|
||||
virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount);
|
||||
|
||||
@ -169,10 +169,7 @@ public:
|
||||
AdvancedCommandType GetCommandType() { return m_nCommandType; }
|
||||
};
|
||||
|
||||
namespace Aggplus {
|
||||
class CImage;
|
||||
class CGraphicsPath;
|
||||
}
|
||||
namespace Aggplus { class CImage; }
|
||||
|
||||
// IRenderer
|
||||
class IRenderer : public IGrObject
|
||||
@ -244,32 +241,6 @@ public:
|
||||
virtual HRESULT put_BrushTransform(const Aggplus::CMatrix& oMatrix) = 0;
|
||||
virtual HRESULT get_BrushLinearAngle(double* dAngle) = 0;
|
||||
virtual HRESULT put_BrushLinearAngle(const double& dAngle) = 0;
|
||||
virtual HRESULT get_BrushOffset(double& offsetX, double& offsetY) const
|
||||
{
|
||||
UNUSED_VARIABLE(offsetX);
|
||||
UNUSED_VARIABLE(offsetY);
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT put_BrushOffset(const double& offsetX, const double& offsetY)
|
||||
{
|
||||
UNUSED_VARIABLE(offsetX);
|
||||
UNUSED_VARIABLE(offsetY);
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT get_BrushScale(bool& isScale, double& scaleX, double& scaleY) const
|
||||
{
|
||||
UNUSED_VARIABLE(isScale);
|
||||
UNUSED_VARIABLE(scaleX);
|
||||
UNUSED_VARIABLE(scaleY);
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT put_BrushScale(bool isScale, const double& scaleX, const double& scaleY)
|
||||
{
|
||||
UNUSED_VARIABLE(isScale);
|
||||
UNUSED_VARIABLE(scaleX);
|
||||
UNUSED_VARIABLE(scaleY);
|
||||
return S_OK;
|
||||
}
|
||||
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;
|
||||
|
||||
@ -329,8 +300,6 @@ public:
|
||||
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;
|
||||
|
||||
HRESULT AddPath(const Aggplus::CGraphicsPath& path);
|
||||
|
||||
//-------- Функции для вывода изображений ---------------------------------------------------
|
||||
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;
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "../fontengine/FontManager.h"
|
||||
#include "../raster/BgraFrame.h"
|
||||
#include "../common/StringExt.h"
|
||||
#include "GraphicsPath.h"
|
||||
|
||||
// этот класс нужно переписать. должно работать как и в js
|
||||
// а не просто на каждом символе переключаться, если нужно
|
||||
@ -352,13 +351,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
bool bIsPathOpened = false;
|
||||
bool bIsEnableBrushRect = false;
|
||||
|
||||
double old_t1, old_t2, old_t3, old_t4, old_t5, old_t6;
|
||||
|
||||
CBufferReader oReader(pBuffer, lBufferLen);
|
||||
Aggplus::CGraphicsPath path;
|
||||
Aggplus::CMatrix transMatrRot;
|
||||
Aggplus::RectF_T<double> clipRect;
|
||||
bool isResetRot = false;
|
||||
while (oReader.Check())
|
||||
{
|
||||
eCommand = (CommandType)(oReader.ReadByte());
|
||||
@ -389,8 +382,6 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
pRenderer->EndCommand(c_nPathType);
|
||||
}
|
||||
bIsPathOpened = false;
|
||||
@ -480,16 +471,6 @@ namespace NSOnlineOfficeBinToPdf
|
||||
double m2 = oReader.ReadDouble();
|
||||
double m3 = oReader.ReadDouble();
|
||||
double m4 = oReader.ReadDouble();
|
||||
|
||||
long type;
|
||||
pRenderer->get_BrushTextureMode(&type);
|
||||
if (type != c_BrushTextureModeStretch)
|
||||
{
|
||||
m1 = 0.0;
|
||||
m2 = 0.0;
|
||||
}
|
||||
|
||||
clipRect = Aggplus::RectF_T<double>(m1, m2, m3, m4);
|
||||
pRenderer->BrushRect(bIsEnableBrushRect ? 1 : 0, m1, m2, m3, m4);
|
||||
break;
|
||||
}
|
||||
@ -609,16 +590,6 @@ namespace NSOnlineOfficeBinToPdf
|
||||
pRenderer->put_BrushTextureAlpha(lAlpha);
|
||||
break;
|
||||
}
|
||||
case ctBrushResetRotation:
|
||||
{
|
||||
pRenderer->GetTransform(&old_t1, &old_t2, &old_t3, &old_t4, &old_t5, &old_t6);
|
||||
|
||||
Aggplus::CMatrix mtr(old_t1, old_t2, old_t3, old_t4, old_t5, old_t6);
|
||||
double rot = mtr.rotation();
|
||||
transMatrRot.Rotate(agg::rad2deg(rot));
|
||||
isResetRot = true;
|
||||
break;
|
||||
}
|
||||
case ctSetTransform:
|
||||
{
|
||||
double m1 = oReader.ReadDouble();
|
||||
@ -635,15 +606,11 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
pRenderer->EndCommand(c_nPathType);
|
||||
}
|
||||
|
||||
pRenderer->BeginCommand(c_nPathType);
|
||||
pRenderer->PathCommandStart();
|
||||
path.Reset();
|
||||
path.StartFigure();
|
||||
|
||||
bIsPathOpened = true;
|
||||
break;
|
||||
@ -652,14 +619,14 @@ namespace NSOnlineOfficeBinToPdf
|
||||
{
|
||||
double m1 = oReader.ReadDouble();
|
||||
double m2 = oReader.ReadDouble();
|
||||
path.MoveTo(m1, m2);
|
||||
pRenderer->PathCommandMoveTo(m1, m2);
|
||||
break;
|
||||
}
|
||||
case ctPathCommandLineTo:
|
||||
{
|
||||
double m1 = oReader.ReadDouble();
|
||||
double m2 = oReader.ReadDouble();
|
||||
path.LineTo(m1, m2);
|
||||
pRenderer->PathCommandLineTo(m1, m2);
|
||||
break;
|
||||
}
|
||||
case ctPathCommandCurveTo:
|
||||
@ -670,12 +637,12 @@ namespace NSOnlineOfficeBinToPdf
|
||||
double m4 = oReader.ReadDouble();
|
||||
double m5 = oReader.ReadDouble();
|
||||
double m6 = oReader.ReadDouble();
|
||||
path.CurveTo(m1, m2, m3, m4, m5, m6);
|
||||
pRenderer->PathCommandCurveTo(m1, m2, m3, m4, m5, m6);
|
||||
break;
|
||||
}
|
||||
case ctPathCommandClose:
|
||||
{
|
||||
path.CloseFigure();
|
||||
pRenderer->PathCommandClose();
|
||||
break;
|
||||
}
|
||||
case ctPathCommandEnd:
|
||||
@ -683,108 +650,14 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
pRenderer->EndCommand(c_nPathType);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ctPathCommandOffset:
|
||||
{
|
||||
double m1 = oReader.ReadDouble();
|
||||
double m2 = oReader.ReadDouble();
|
||||
|
||||
pRenderer->put_BrushOffset(m1, m2);
|
||||
break;
|
||||
}
|
||||
case ctPathCommandScale:
|
||||
{
|
||||
double m1 = oReader.ReadDouble();
|
||||
double m2 = oReader.ReadDouble();
|
||||
|
||||
pRenderer->put_BrushScale(true, m1, m2);
|
||||
break;
|
||||
}
|
||||
case ctDrawPath:
|
||||
{
|
||||
long fill = oReader.ReadInt();
|
||||
long type;
|
||||
pRenderer->get_BrushType(&type);
|
||||
|
||||
if (fill != c_nStroke && type == c_BrushTypeTexture)
|
||||
{
|
||||
Aggplus::CGraphicsPath clipPath;
|
||||
Aggplus::CGraphicsPath drawPath(path);
|
||||
|
||||
if (isResetRot)
|
||||
{
|
||||
pRenderer->get_BrushTextureMode(&type);
|
||||
bool isStretch = type == c_BrushTextureModeStretch;
|
||||
|
||||
double left, top, width, height;
|
||||
drawPath.GetBounds(left, top, width, height);
|
||||
|
||||
double rot = transMatrRot.rotation();
|
||||
double cX = left + width / 2.0;
|
||||
double cY = top + height / 2.0;
|
||||
|
||||
bool isZeroPt = clipRect.X < 0.1 && clipRect.X > -0.1 && clipRect.Y < 0.1 && clipRect.Y > -0.1;
|
||||
bool isZeroRot = rot < 1e-6 && rot > -1e-6;
|
||||
|
||||
transMatrRot.Reset();
|
||||
transMatrRot.RotateAt(agg::rad2deg(rot), cX, cY, Aggplus::MatrixOrderAppend);
|
||||
|
||||
double offX = old_t5 - transMatrRot.tx();
|
||||
double offY = old_t6 - transMatrRot.ty();
|
||||
|
||||
drawPath.Transform(&transMatrRot);
|
||||
pRenderer->SetTransform(1.0, 0.0, 0.0, 1.0, offX, offY);
|
||||
|
||||
if (isZeroPt && !isZeroRot && isStretch)
|
||||
drawPath.GetBounds(left, top, width, height);
|
||||
else
|
||||
{
|
||||
Aggplus::CGraphicsPath tmpPath;
|
||||
tmpPath.AddRectangle(left, top, width, height);
|
||||
tmpPath.Transform(&transMatrRot);
|
||||
tmpPath.GetBounds(left, top, width, height);
|
||||
}
|
||||
|
||||
if (isZeroPt || !isStretch)
|
||||
clipRect = Aggplus::RectF_T<double>(left, top, width, height);
|
||||
|
||||
if (isStretch)
|
||||
{
|
||||
if (!isZeroPt)
|
||||
clipRect.Offset(-offX, -offY);
|
||||
pRenderer->BrushRect(true, clipRect.X, clipRect.Y, clipRect.Width, clipRect.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
double tileOffX, tileOffY;
|
||||
pRenderer->get_BrushOffset(tileOffX, tileOffY);
|
||||
pRenderer->put_BrushOffset(tileOffX - offX, tileOffY - offY);
|
||||
}
|
||||
}
|
||||
|
||||
clipPath.AddRectangle(clipRect.X, clipRect.Y, clipRect.Width, clipRect.Height);
|
||||
path = Aggplus::CalcBooleanOperation(drawPath, clipPath, Aggplus::Intersection);
|
||||
clipRect = Aggplus::RectF_T<double>();
|
||||
}
|
||||
|
||||
pRenderer->AddPath(path);
|
||||
pRenderer->DrawPath(fill);
|
||||
|
||||
if (isResetRot)
|
||||
{
|
||||
pRenderer->SetTransform(old_t1, old_t2, old_t3, old_t4, old_t5, old_t6);
|
||||
transMatrRot.Reset();
|
||||
isResetRot = false;
|
||||
}
|
||||
|
||||
pRenderer->put_BrushScale(false, 1.0, 1.0);
|
||||
pRenderer->put_BrushOffset(0.0, 0.0);
|
||||
pRenderer->DrawPath(oReader.ReadInt());
|
||||
break;
|
||||
}
|
||||
case ctDrawImageFromFile:
|
||||
@ -861,8 +734,6 @@ namespace NSOnlineOfficeBinToPdf
|
||||
if (bIsPathOpened)
|
||||
{
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
pRenderer->EndCommand(4);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
@ -876,13 +747,8 @@ namespace NSOnlineOfficeBinToPdf
|
||||
pRenderer->EndCommand(4);
|
||||
bIsPathOpened = false;
|
||||
}
|
||||
int nCommand = oReader.ReadInt();
|
||||
if (path.GetPointCount() && nCommand == c_nClipType)
|
||||
pRenderer->AddPath(path);
|
||||
pRenderer->EndCommand((DWORD)nCommand);
|
||||
pRenderer->EndCommand((DWORD)(oReader.ReadInt()));
|
||||
pRenderer->PathCommandEnd();
|
||||
if (path.GetPointCount())
|
||||
path.Reset();
|
||||
break;
|
||||
}
|
||||
case ctGradientFill:
|
||||
@ -1266,10 +1132,6 @@ namespace NSOnlineOfficeBinToPdf
|
||||
oReader.Skip(1);
|
||||
break;
|
||||
}
|
||||
case ctBrushResetRotation:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ctSetTransform:
|
||||
{
|
||||
oReader.SkipInt(6);
|
||||
@ -1302,16 +1164,6 @@ namespace NSOnlineOfficeBinToPdf
|
||||
{
|
||||
break;
|
||||
}
|
||||
case ctPathCommandOffset:
|
||||
{
|
||||
oReader.SkipInt(2);
|
||||
break;
|
||||
}
|
||||
case ctPathCommandScale:
|
||||
{
|
||||
oReader.SkipInt(2);
|
||||
break;
|
||||
}
|
||||
case ctDrawPath:
|
||||
{
|
||||
oReader.SkipInt();
|
||||
|
||||
@ -108,7 +108,6 @@ namespace NSOnlineOfficeBinToPdf
|
||||
ctBrushRectableEnabled = 30,
|
||||
ctBrushGradient = 31,
|
||||
ctBrushTexturePath = 32,
|
||||
ctBrushResetRotation = 33,
|
||||
|
||||
// font
|
||||
ctFontXML = 40,
|
||||
@ -154,8 +153,6 @@ namespace NSOnlineOfficeBinToPdf
|
||||
ctPathCommandGetCurrentPoint = 101,
|
||||
ctPathCommandText = 102,
|
||||
ctPathCommandTextEx = 103,
|
||||
ctPathCommandOffset = 104,
|
||||
ctPathCommandScale = 105,
|
||||
|
||||
// image
|
||||
ctDrawImage = 110,
|
||||
|
||||
@ -214,18 +214,6 @@ public:
|
||||
|
||||
inline bool IsPositive() { return Width > 0 && Height > 0; }
|
||||
|
||||
RectF_T& operator=(const RectF_T& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
|
||||
X = other.X;
|
||||
Y = other.Y;
|
||||
Width = other.Width;
|
||||
Height = other.Height;
|
||||
|
||||
return *this;
|
||||
};
|
||||
public:
|
||||
T X, Y, Width, Height;
|
||||
};
|
||||
|
||||
@ -51,7 +51,6 @@
|
||||
"_DestroyTextInfo",
|
||||
"_IsNeedCMap",
|
||||
"_SetCMapData",
|
||||
"_SetScanPageFonts",
|
||||
"_ScanPage",
|
||||
"_SplitPages",
|
||||
"_MergePages",
|
||||
@ -197,7 +196,7 @@
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/SrcReader/",
|
||||
"files": ["Adaptors.cpp", "GfxClip.cpp", "RendererOutputDev.cpp", "JPXStream2.cpp", "PdfAnnot.cpp", "PdfFont.cpp"]
|
||||
"files": ["Adaptors.cpp", "GfxClip.cpp", "RendererOutputDev.cpp", "JPXStream2.cpp", "PdfAnnot.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/SrcWriter/",
|
||||
|
||||
@ -639,7 +639,6 @@ SOURCES += \
|
||||
$$PDF_ROOT_DIR/SrcReader/Adaptors.cpp \
|
||||
$$PDF_ROOT_DIR/SrcReader/GfxClip.cpp \
|
||||
$$PDF_ROOT_DIR/SrcReader/PdfAnnot.cpp \
|
||||
$$PDF_ROOT_DIR/SrcReader/PdfFont.cpp \
|
||||
$$PDF_ROOT_DIR/Resources/BaseFonts.cpp \
|
||||
$$PDF_ROOT_DIR/Resources/CMapMemory/cmap_memory.cpp
|
||||
|
||||
@ -665,7 +664,6 @@ HEADERS +=\
|
||||
$$PDF_ROOT_DIR/SrcReader/MemoryUtils.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/GfxClip.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/FontsWasm.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/PdfFont.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/PdfAnnot.h
|
||||
|
||||
DEFINES += CRYPTOPP_DISABLE_ASM
|
||||
|
||||
@ -1047,15 +1047,11 @@ function readAnnotType(reader, rec, readDoubleFunc, readDouble2Func, readStringF
|
||||
if (flags & (1 << 0))
|
||||
{
|
||||
rec["A"] = {};
|
||||
if (isRead)
|
||||
readStringFunc.call(reader);
|
||||
readAction(reader, rec["A"], readDoubleFunc, readStringFunc);
|
||||
}
|
||||
if (flags & (1 << 1))
|
||||
{
|
||||
rec["PA"] = {};
|
||||
if (isRead)
|
||||
readStringFunc.call(reader);
|
||||
readAction(reader, rec["PA"], readDoubleFunc, readStringFunc);
|
||||
}
|
||||
// Selection mode - H
|
||||
@ -1706,11 +1702,6 @@ CFile.prototype["readAnnotationsInfoFromBinary"] = function(AnnotInfo)
|
||||
};
|
||||
|
||||
// SCAN PAGES
|
||||
CFile.prototype["scanPageFonts"] = function(page)
|
||||
{
|
||||
this._setScanPageFonts(page);
|
||||
};
|
||||
|
||||
CFile.prototype["scanPage"] = function(page, mode)
|
||||
{
|
||||
let ptr = this._scanPage(page, mode);
|
||||
|
||||
@ -252,11 +252,6 @@ CFile.prototype._getInteractiveFormsAP = function(width, height, backgroundColor
|
||||
};
|
||||
|
||||
// SCAN PAGES
|
||||
CFile.prototype._setScanPageFonts = function(page)
|
||||
{
|
||||
g_native_drawing_file["SetScanPageFonts"](page);
|
||||
};
|
||||
|
||||
CFile.prototype._scanPage = function(page, mode)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["ScanPage"](page, (mode === undefined) ? 0 : mode);
|
||||
|
||||
@ -106,7 +106,7 @@ CFile.prototype._openFile = function(buffer, password)
|
||||
}
|
||||
|
||||
let passwordPtr = 0;
|
||||
if (password !== undefined)
|
||||
if (password)
|
||||
{
|
||||
let passwordBuf = password.toUtf8();
|
||||
passwordPtr = Module["_malloc"](passwordBuf.length);
|
||||
@ -227,7 +227,7 @@ CFile.prototype._UndoRedact = function()
|
||||
CFile.prototype._CheckOwnerPassword = function(password)
|
||||
{
|
||||
let passwordPtr = 0;
|
||||
if (password !== undefined)
|
||||
if (password)
|
||||
{
|
||||
let passwordBuf = password.toUtf8();
|
||||
passwordPtr = Module["_malloc"](passwordBuf.length);
|
||||
@ -388,11 +388,6 @@ CFile.prototype._getInteractiveFormsAP = function(width, height, backgroundColor
|
||||
};
|
||||
|
||||
// SCAN PAGES
|
||||
CFile.prototype._setScanPageFonts = function(page)
|
||||
{
|
||||
Module["_SetScanPageFonts"](this.nativeFile, page);
|
||||
};
|
||||
|
||||
CFile.prototype._scanPage = function(page, mode)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_ScanPage"](this.nativeFile, page, (mode === undefined) ? 0 : mode);
|
||||
|
||||
@ -80,7 +80,7 @@ WASM_EXPORT CDrawingFile* Open(BYTE* data, LONG size, const char* password)
|
||||
std::wstring sPassword = L"";
|
||||
if (NULL != password)
|
||||
sPassword = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)password, strlen(password));
|
||||
pFile->OpenFile(data, size, password ? sPassword.c_str() : NULL);
|
||||
pFile->OpenFile(data, size, sPassword);
|
||||
return pFile;
|
||||
}
|
||||
WASM_EXPORT int GetType(CDrawingFile* pFile)
|
||||
@ -166,10 +166,6 @@ WASM_EXPORT void SetCMapData(CDrawingFile* pFile, BYTE* data, int size)
|
||||
{
|
||||
pFile->SetCMapData(data, size);
|
||||
}
|
||||
WASM_EXPORT void SetScanPageFonts(CDrawingFile* pFile, int nPageIndex)
|
||||
{
|
||||
return pFile->SetScanPageFonts(nPageIndex);
|
||||
}
|
||||
WASM_EXPORT BYTE* ScanPage(CDrawingFile* pFile, int nPageIndex, int mode)
|
||||
{
|
||||
return pFile->ScanPage(nPageIndex, mode);
|
||||
@ -204,7 +200,7 @@ WASM_EXPORT int CheckOwnerPassword(CDrawingFile* pFile, const char* password)
|
||||
std::wstring sPassword = L"";
|
||||
if (NULL != password)
|
||||
sPassword = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)password, strlen(password));
|
||||
return pFile->CheckOwnerPassword(password ? sPassword.c_str() : NULL) ? 1 : 0;
|
||||
return pFile->CheckOwnerPassword(sPassword) ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT int CheckPerm(CDrawingFile* pFile, int nPermFlag)
|
||||
{
|
||||
|
||||
@ -971,7 +971,7 @@ void ReadInteractiveFormsFonts(CDrawingFile* pGrFile, int nType)
|
||||
int nFontLength = READ_INT(pFont + i2);
|
||||
i2 += 4;
|
||||
|
||||
std::cout << std::endl << "GIDtoUnicode" << std::endl;
|
||||
std::cout << std::endl << "CIDtoUnicode" << std::endl;
|
||||
|
||||
for (int j = 0; j < nFontLength; ++j)
|
||||
{
|
||||
@ -979,7 +979,7 @@ void ReadInteractiveFormsFonts(CDrawingFile* pGrFile, int nType)
|
||||
i2 += 4;
|
||||
unsigned int unicode = READ_INT(pFont + i2);
|
||||
i2 += 4;
|
||||
std::cout << "gid\t" << code << "\tunicode\t" << unicode << std::endl;
|
||||
std::cout << "cid\t" << code << "\tunicode\t" << unicode << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
@ -1072,7 +1072,7 @@ int main(int argc, char* argv[])
|
||||
if (!NSFile::CFileBinary::ReadAllBytes(sFilePath, &pFileData, nFileDataLen))
|
||||
return 1;
|
||||
|
||||
CDrawingFile* pGrFile = Open(pFileData, (LONG)nFileDataLen, NULL);
|
||||
CDrawingFile* pGrFile = Open(pFileData, (LONG)nFileDataLen, "");
|
||||
int nError = GetErrorCode(pGrFile);
|
||||
|
||||
if (nError != 0)
|
||||
@ -1080,7 +1080,7 @@ int main(int argc, char* argv[])
|
||||
Close(pGrFile);
|
||||
if (nError == 4)
|
||||
{
|
||||
std::string sPassword = "";
|
||||
std::string sPassword = "123456";
|
||||
pGrFile = Open(pFileData, nFileDataLen, sPassword.c_str());
|
||||
}
|
||||
else
|
||||
@ -1100,7 +1100,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
if (true && GetFromBase64(NSFile::GetProcessDirectory() + L"/split.txt", &pBuffer, &nBufferLen))
|
||||
{
|
||||
std::vector<int> arrPages = { 0 };
|
||||
std::vector<int> arrPages = { 2 };
|
||||
BYTE* pSplitPages = SplitPages(pGrFile, arrPages.data(), arrPages.size(), pBuffer, nBufferLen);
|
||||
int nLength = READ_INT(pSplitPages);
|
||||
|
||||
@ -1175,7 +1175,7 @@ int main(int argc, char* argv[])
|
||||
// OWNER PASSWORD
|
||||
if (false)
|
||||
{
|
||||
std::string sPassword = "";
|
||||
std::string sPassword = "gfhjkmgfhjkm";
|
||||
std::cout << "CheckPerm 4 Edit " << CheckPerm(pGrFile, 4) << std::endl;
|
||||
std::cout << "CheckPerm 4 Print " << CheckPerm(pGrFile, 3) << std::endl;
|
||||
|
||||
@ -1184,17 +1184,17 @@ int main(int argc, char* argv[])
|
||||
std::cout << "CheckPerm 4 Print " << CheckPerm(pGrFile, 3) << std::endl;
|
||||
}
|
||||
|
||||
BYTE* pColor = new BYTE[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
// REDACT
|
||||
if (false)
|
||||
{
|
||||
BYTE* pColor = new BYTE[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int pRect[8] = { 307499, 217499, 307499, 1124999, 1799999, 1124999, 1799999, 217499 };
|
||||
if (!RedactPage(pGrFile, nTestPage, pRect, 1, pColor, 12))
|
||||
std::cout << "Redact false" << std::endl;
|
||||
}
|
||||
|
||||
// RASTER
|
||||
if (false)
|
||||
if (true)
|
||||
{
|
||||
int i = nTestPage;
|
||||
//for (int i = 0; i < nPagesCount; ++i)
|
||||
@ -1364,7 +1364,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// INTERACTIVE FORMS
|
||||
if (false)
|
||||
if (true)
|
||||
{
|
||||
ReadInteractiveFormsFonts(pGrFile, 1);
|
||||
ReadInteractiveFormsFonts(pGrFile, 2);
|
||||
@ -1483,7 +1483,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// ANNOTS
|
||||
if (false)
|
||||
if (true)
|
||||
{
|
||||
BYTE* pAnnots = GetAnnotationsInfo(pGrFile, -1);
|
||||
nLength = READ_INT(pAnnots);
|
||||
@ -2251,10 +2251,12 @@ int main(int argc, char* argv[])
|
||||
free(pAnnotAP);
|
||||
}
|
||||
|
||||
// SCAN PAGE Fonts
|
||||
if (true)
|
||||
// SCAN PAGE
|
||||
if (false)
|
||||
{
|
||||
SetScanPageFonts(pGrFile, nTestPage);
|
||||
BYTE* pScan = ScanPage(pGrFile, nTestPage, 2);
|
||||
if (pScan)
|
||||
free(pScan);
|
||||
|
||||
ReadInteractiveFormsFonts(pGrFile, 1);
|
||||
ReadInteractiveFormsFonts(pGrFile, 2);
|
||||
|
||||
@ -63,9 +63,9 @@ public:
|
||||
|
||||
// Open
|
||||
virtual bool LoadFromFile(const std::wstring& file, const std::wstring& options = L"",
|
||||
const wchar_t* owner_password = NULL, const wchar_t* user_password = NULL) = 0;
|
||||
const std::wstring& owner_password = L"", const std::wstring& user_password = L"") = 0;
|
||||
virtual bool LoadFromMemory(unsigned char* data, unsigned long length, const std::wstring& options = L"",
|
||||
const wchar_t* owner_password = NULL, const wchar_t* user_password = NULL) = 0;
|
||||
const std::wstring& owner_password = L"", const std::wstring& user_password = L"") = 0;
|
||||
|
||||
// Close
|
||||
virtual void Close() = 0;
|
||||
|
||||
@ -113,10 +113,7 @@ const long c_BrushTypeTensorCurveGradient = 6007;
|
||||
|
||||
const long c_BrushTextureModeStretch = 0;
|
||||
const long c_BrushTextureModeTile = 1;
|
||||
const long c_BrushTextureModeTileFlipX = 2;
|
||||
const long c_BrushTextureModeTileFlipY = 3;
|
||||
const long c_BrushTextureModeTileFlipXY = 4;
|
||||
const long c_BrushTextureModeTileCenter = 5;
|
||||
const long c_BrushTextureModeTileCenter = 2;
|
||||
// --------------------------------------------------------------
|
||||
|
||||
namespace Aggplus { class CImage; }
|
||||
@ -287,13 +284,6 @@ namespace NSStructures
|
||||
Aggplus::RectF Rect;
|
||||
Aggplus::CDoubleRect Bounds;
|
||||
|
||||
int IsScale;
|
||||
double ScaleX;
|
||||
double ScaleY;
|
||||
|
||||
double OffsetX;
|
||||
double OffsetY;
|
||||
|
||||
double LinearAngle;
|
||||
std::vector<TSubColor> m_arrSubColors;
|
||||
NSStructures::GradientInfo m_oGradientInfo;
|
||||
@ -425,13 +415,6 @@ namespace NSStructures
|
||||
Rect.Width = 0.0F;
|
||||
Rect.Height = 0.0F;
|
||||
|
||||
IsScale = FALSE;
|
||||
ScaleX = 1.0;
|
||||
ScaleY = 1.0;
|
||||
|
||||
OffsetX = 0.0;
|
||||
OffsetY = 0.0;
|
||||
|
||||
Bounds.left = 0;
|
||||
Bounds.top = 0;
|
||||
Bounds.right = 0;
|
||||
@ -471,10 +454,6 @@ namespace NSStructures
|
||||
Rect = other.Rect;
|
||||
Bounds = other.Bounds;
|
||||
|
||||
IsScale = other.IsScale;
|
||||
ScaleX = other.ScaleX;
|
||||
ScaleY = other.ScaleY;
|
||||
|
||||
LinearAngle = other.LinearAngle;
|
||||
m_arrSubColors = other.m_arrSubColors;
|
||||
m_oGradientInfo = other.m_oGradientInfo;
|
||||
|
||||
@ -358,7 +358,7 @@ namespace SVG
|
||||
|
||||
bool CRenderedObject::ApplyStroke(IRenderer *pRenderer, const TStroke *pStroke, bool bUseDefault, const CRenderedObject* pContextObject) const
|
||||
{
|
||||
if (NULL == pRenderer || NULL == pStroke || pStroke->m_oColor.None() || (!bUseDefault && ((pStroke->m_oWidth.Empty() || pStroke->m_oWidth.Zero()) && pStroke->m_oColor.Empty())))
|
||||
if (NULL == pRenderer || NULL == pStroke || NSCSS::NSProperties::EColorType::ColorNone == pStroke->m_oColor.GetType() || (!bUseDefault && ((pStroke->m_oWidth.Empty() || pStroke->m_oWidth.Zero()) && pStroke->m_oColor.Empty())))
|
||||
{
|
||||
pRenderer->put_PenSize(0);
|
||||
return false;
|
||||
@ -401,7 +401,7 @@ namespace SVG
|
||||
|
||||
bool CRenderedObject::ApplyFill(IRenderer *pRenderer, const NSCSS::NSProperties::CColor *pFill, const CSvgFile *pFile, bool bUseDefault, const CRenderedObject* pContextObject) const
|
||||
{
|
||||
if (NULL == pRenderer || NULL == pFill || pFill->None() || (!bUseDefault && pFill->Empty()))
|
||||
if (NULL == pRenderer || NULL == pFill || NSCSS::NSProperties::EColorType::ColorNone == pFill->GetType() || (!bUseDefault && pFill->Empty()))
|
||||
{
|
||||
pRenderer->put_BrushType(c_BrushTypeNoFill);
|
||||
return false;
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@ -605,12 +604,6 @@ public:
|
||||
evp = EVP_sha512();
|
||||
else if (m_alg == OOXML_HASH_ALG_ECDSA_384)
|
||||
evp = EVP_sha384();
|
||||
else if (m_alg == OOXML_HASH_ALG_SHA256)
|
||||
evp = EVP_sha256();
|
||||
else if (m_alg == OOXML_HASH_ALG_SHA384)
|
||||
evp = EVP_sha384();
|
||||
else if (m_alg == OOXML_HASH_ALG_SHA512)
|
||||
evp = EVP_sha512();
|
||||
|
||||
if (!PKCS7_sign_add_signer(pkcs7, m_cert, m_key, evp, 0))
|
||||
{
|
||||
|
||||
@ -42,7 +42,7 @@ CDjVuFile::~CDjVuFile()
|
||||
delete m_pImplementation;
|
||||
}
|
||||
bool CDjVuFile::LoadFromFile(const std::wstring& file, const std::wstring& options,
|
||||
const wchar_t* owner_password, const wchar_t* user_password)
|
||||
const std::wstring& owner_password, const std::wstring& user_password)
|
||||
{
|
||||
if (m_pImplementation)
|
||||
return m_pImplementation->LoadFromFile(file, options);
|
||||
@ -50,7 +50,7 @@ bool CDjVuFile::LoadFromFile(const std::wstring& file, const std::wstring& optio
|
||||
return false;
|
||||
}
|
||||
bool CDjVuFile::LoadFromMemory(BYTE* data, DWORD length, const std::wstring& options,
|
||||
const wchar_t* owner_password, const wchar_t* user_password)
|
||||
const std::wstring& owner_password, const std::wstring& user_password)
|
||||
{
|
||||
if (m_pImplementation)
|
||||
return m_pImplementation->LoadFromMemory(data, length, options);
|
||||
|
||||
@ -55,9 +55,9 @@ public:
|
||||
virtual ~CDjVuFile();
|
||||
|
||||
virtual bool LoadFromFile(const std::wstring& file, const std::wstring& options = L"",
|
||||
const wchar_t* owner_password = NULL, const wchar_t* user_password = NULL);
|
||||
const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
|
||||
virtual bool LoadFromMemory(BYTE* data, DWORD length, const std::wstring& options = L"",
|
||||
const wchar_t* owner_password = NULL, const wchar_t* user_password = NULL);
|
||||
const std::wstring& owner_password = L"", const std::wstring& user_password = L"");
|
||||
|
||||
virtual void Close();
|
||||
virtual NSFonts::IApplicationFonts* GetFonts();
|
||||
|
||||
@ -92,7 +92,6 @@ int CDocxRenderer::Convert(IOfficeDrawingFile* pFile, const std::wstring& sDst,
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bUseDefaultFont = false;
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bWriteStyleRaw = false;
|
||||
m_pInternal->m_bIsSupportShapeCommands = false;
|
||||
m_pInternal->m_oDocument.m_bIsRecord = true;
|
||||
|
||||
if (bIsOutCompress)
|
||||
m_pInternal->m_oDocument.m_strTempDirectory = NSDirectory::CreateDirectoryWithUniqueName(m_pInternal->m_sTempDirectory);
|
||||
@ -131,7 +130,6 @@ std::vector<std::wstring> CDocxRenderer::ScanPage(IOfficeDrawingFile* pFile, siz
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bUseDefaultFont = true;
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bWriteStyleRaw = true;
|
||||
m_pInternal->m_bIsSupportShapeCommands = false;
|
||||
m_pInternal->m_oDocument.m_bIsRecord = false;
|
||||
|
||||
DrawPage(pFile, nPage);
|
||||
|
||||
@ -148,7 +146,6 @@ std::vector<std::wstring> CDocxRenderer::ScanPagePptx(IOfficeDrawingFile* pFile,
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bWriteStyleRaw = true;
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bCollectMetaInfo = true;
|
||||
m_pInternal->m_bIsSupportShapeCommands = true;
|
||||
m_pInternal->m_oDocument.m_bIsRecord = false;
|
||||
|
||||
m_pInternal->m_eShapeSerializeType = ShapeSerializeType::sstXml;
|
||||
DrawPage(pFile, nPage);
|
||||
@ -165,10 +162,7 @@ NSWasm::CData CDocxRenderer::ScanPageBin(IOfficeDrawingFile* pFile, size_t nPage
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bUseDefaultFont = true;
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bWriteStyleRaw = true;
|
||||
m_pInternal->m_oDocument.m_oCurrentPage.m_bCollectMetaInfo = true;
|
||||
m_pInternal->m_oDocument.m_bIsRecord = false;
|
||||
m_pInternal->m_bIsSupportShapeCommands = true;
|
||||
m_pInternal->m_oDocument.m_oFontStyleManager.Clear();
|
||||
m_pInternal->m_oDocument.m_oFontSelector.ClearCache();
|
||||
|
||||
DrawPage(pFile, nPage);
|
||||
|
||||
|
||||
@ -572,11 +572,8 @@ namespace NSDocxRenderer
|
||||
m_oPageBuilder.ClearNoAttack();
|
||||
|
||||
m_oCurrentPage.Analyze();
|
||||
if (m_bIsRecord)
|
||||
{
|
||||
m_oCurrentPage.Record(m_oPageBuilder, m_lPageNum >= m_lNumberPages - 1);
|
||||
m_arXmlString.push_back(NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(m_oPageBuilder.GetBuffer(), (LONG)m_oPageBuilder.GetCurSize()));
|
||||
}
|
||||
m_oCurrentPage.Record(m_oPageBuilder, m_lPageNum >= m_lNumberPages - 1);
|
||||
m_arXmlString.push_back(NSFile::CUtf8Converter::GetUtf8StringFromUnicode2(m_oPageBuilder.GetBuffer(), (LONG)m_oPageBuilder.GetCurSize()));
|
||||
|
||||
if (m_oPageBuilder.GetCurSize() > 100000000/*100Mb*/)
|
||||
m_oPageBuilder.Clear();
|
||||
|
||||
@ -40,7 +40,6 @@ namespace NSDocxRenderer
|
||||
LONG m_lNumberPages{0};
|
||||
|
||||
bool m_bIsDisablePageCommand {false}; // disable commands inside draw function
|
||||
bool m_bIsRecord {true};
|
||||
|
||||
NSStringUtils::CStringBuilder m_oPageBuilder;
|
||||
std::list<std::string> m_arXmlString;
|
||||
|
||||
@ -70,8 +70,6 @@ namespace NSDocxRenderer
|
||||
m_oContBuilder.Clear();
|
||||
m_arCompleteObjectsXml.clear();
|
||||
m_arLuminosityShapes.clear();
|
||||
|
||||
m_bFontSubstitution = false;
|
||||
}
|
||||
|
||||
CPage::~CPage()
|
||||
@ -195,17 +193,14 @@ namespace NSDocxRenderer
|
||||
|
||||
if (!m_arShapes.empty())
|
||||
{
|
||||
auto& last_shape = m_arShapes.back();
|
||||
if (last_shape->IsEqual(top, bot, left, right) && rotation == last_shape->m_dRotation && lType != m_lLastType && m_lLastType != 0)
|
||||
auto& last_shape = m_arShapes.back();
|
||||
if (last_shape->IsEqual(top, bot, left, right) && rotation == last_shape->m_dRotation)
|
||||
{
|
||||
set_fill_mode(last_shape);
|
||||
// Reset stroke/fill logic
|
||||
m_lLastType = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_lLastType = lType;
|
||||
auto shape = std::make_shared<CShape>();
|
||||
shape->m_oPen.Size *= transform_det;
|
||||
set_fill_mode(shape);
|
||||
@ -332,15 +327,13 @@ namespace NSDocxRenderer
|
||||
m_oManagers.pFontManager->SetStringGid(0);
|
||||
m_oManagers.pFontManager->MeasureStringGids(pUnicodes, nCount, dTextX, dTextY, _x, _y, _w, _h, CFontManager::mtPosition);
|
||||
}
|
||||
_h = m_oManagers.pFontManager->GetFontHeight();
|
||||
double baseline = dTextY + fBaseLineOffset;
|
||||
|
||||
_h = m_oManagers.pFontManager->GetFontHeight();
|
||||
|
||||
double baseline = dTextY + fBaseLineOffset;
|
||||
double top = baseline - _h;
|
||||
double left = dTextX;
|
||||
double right = dTextR;
|
||||
|
||||
if (left == right) // XPS
|
||||
right = left + _w;
|
||||
double right = left + _w;
|
||||
|
||||
// use forced fold option
|
||||
const auto& oParams = m_oManagers.pFontManager->GetFontSelectParams();
|
||||
@ -648,8 +641,20 @@ namespace NSDocxRenderer
|
||||
{
|
||||
for (auto& line : m_arTextLines)
|
||||
for (auto& cont : line->m_arConts)
|
||||
if (cont && !m_bUseDefaultFont)
|
||||
cont->CalcSelected();
|
||||
{
|
||||
if (cont && cont->m_oSelectedSizes.dHeight == 0.0 && cont->m_oSelectedSizes.dWidth == 0.0)
|
||||
{
|
||||
if (m_bUseDefaultFont)
|
||||
{
|
||||
cont->m_oSelectedSizes.dHeight = cont->m_dHeight;
|
||||
cont->m_oSelectedSizes.dWidth = cont->m_dWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
cont->CalcSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPage::AnalyzeShapes()
|
||||
@ -762,19 +767,6 @@ namespace NSDocxRenderer
|
||||
if (line && line->m_arConts.empty())
|
||||
line = nullptr;
|
||||
|
||||
for (auto& line : m_arTextLines)
|
||||
if (line)
|
||||
{
|
||||
bool is_remove = true;
|
||||
for(auto& cont : line->m_arConts)
|
||||
if (cont && !cont->IsOnlySpaces())
|
||||
is_remove = false;
|
||||
|
||||
if (is_remove)
|
||||
line = nullptr;
|
||||
}
|
||||
|
||||
|
||||
auto right = MoveNullptr(m_arTextLines.begin(), m_arTextLines.end());
|
||||
m_arTextLines.erase(right, m_arTextLines.end());
|
||||
|
||||
@ -843,8 +835,7 @@ namespace NSDocxRenderer
|
||||
// шейпы из буквиц
|
||||
for (auto&& drop_cap : drop_caps)
|
||||
{
|
||||
if (!m_bUseDefaultFont)
|
||||
drop_cap->CalcSelected();
|
||||
drop_cap->CalcSelected();
|
||||
|
||||
auto line = std::make_shared<CTextLine>();
|
||||
line->AddCont(drop_cap);
|
||||
@ -1360,21 +1351,6 @@ namespace NSDocxRenderer
|
||||
|
||||
return IsHorizontalLineTrough(dummy_cont);
|
||||
}
|
||||
bool CPage::IsTextLineBetween(text_line_ptr_t pFirst, text_line_ptr_t pSecond) const noexcept
|
||||
{
|
||||
double left = std::min(pFirst->m_dLeft, pSecond->m_dLeft);
|
||||
double right = std::max(pFirst->m_dRight, pSecond->m_dRight);
|
||||
double top = std::min(pFirst->m_dBotWithMaxDescent, pSecond->m_dBotWithMaxDescent);
|
||||
double bot = std::max(pFirst->m_dTopWithMaxAscent, pSecond->m_dTopWithMaxAscent);
|
||||
|
||||
auto dummy_cont = std::make_shared<CContText>();
|
||||
dummy_cont->m_dLeft = left - c_dGRAPHICS_ERROR_MM;
|
||||
dummy_cont->m_dRight = right + c_dGRAPHICS_ERROR_MM;
|
||||
dummy_cont->m_dTop = top - c_dGRAPHICS_ERROR_MM;
|
||||
dummy_cont->m_dBot = bot + c_dGRAPHICS_ERROR_MM;
|
||||
|
||||
return IsTextLineTrough(dummy_cont);
|
||||
}
|
||||
|
||||
bool CPage::IsVerticalLineTrough(base_item_ptr_t pFirst) const noexcept
|
||||
{
|
||||
@ -1383,9 +1359,7 @@ namespace NSDocxRenderer
|
||||
const auto center = pFirst->m_dTop + height / 2;
|
||||
|
||||
for (const auto& line : ver_lines)
|
||||
if (line.pos - pFirst->m_dLeft > c_dGRAPHICS_ERROR_IN_LINES_MM &&
|
||||
pFirst->m_dRight - line.pos > c_dGRAPHICS_ERROR_IN_LINES_MM &&
|
||||
line.min <= center && line.max >= center)
|
||||
if (line.pos > pFirst->m_dLeft && line.pos < pFirst->m_dRight && line.min <= center && line.max >= center)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -1402,20 +1376,6 @@ namespace NSDocxRenderer
|
||||
|
||||
return false;
|
||||
}
|
||||
bool CPage::IsTextLineTrough(base_item_ptr_t pFirst) const noexcept
|
||||
{
|
||||
const auto width = pFirst->m_dRight - pFirst->m_dLeft;
|
||||
const auto center = pFirst->m_dLeft + width / 2;
|
||||
|
||||
for (const auto& text_line : m_arShapes)
|
||||
if (text_line && text_line->m_eType == CShape::eShapeType::stTextBox && text_line->m_dBot > pFirst->m_dTop &&
|
||||
text_line->m_dBot < pFirst->m_dBot &&
|
||||
text_line->m_dLeft <= center &&
|
||||
text_line->m_dRight >= center)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CPage::SplitLines()
|
||||
{
|
||||
@ -1485,7 +1445,7 @@ namespace NSDocxRenderer
|
||||
|
||||
for (const auto& line : m_arTextLines)
|
||||
{
|
||||
if (fabs(line->m_dBot - curr_bot) < 4 * c_dTHE_SAME_STRING_Y_PRECISION_MM)
|
||||
if (fabs(line->m_dBotWithMaxDescent - curr_bot) < 4 * c_dTHE_SAME_STRING_Y_PRECISION_MM)
|
||||
{
|
||||
bot_aligned_text_lines.back().push_back(line);
|
||||
}
|
||||
@ -1493,7 +1453,7 @@ namespace NSDocxRenderer
|
||||
{
|
||||
bot_aligned_text_lines.push_back({});
|
||||
bot_aligned_text_lines.back().push_back(line);
|
||||
curr_bot = line->m_dBot;
|
||||
curr_bot = line->m_dBotWithMaxDescent;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1611,12 +1571,10 @@ namespace NSDocxRenderer
|
||||
curr_line->CalcFirstWordWidth();
|
||||
|
||||
for (auto& cont : prev_line->m_arConts)
|
||||
if (!m_bUseDefaultFont)
|
||||
cont->CalcSelected();
|
||||
cont->CalcSelected();
|
||||
|
||||
for (auto& cont : curr_line->m_arConts)
|
||||
if (!m_bUseDefaultFont)
|
||||
cont->CalcSelected();
|
||||
cont->CalcSelected();
|
||||
|
||||
m_arShapes.push_back(CreateSingleLineShape(prev_line));
|
||||
m_arShapes.push_back(CreateSingleLineShape(curr_line));
|
||||
@ -1648,9 +1606,9 @@ namespace NSDocxRenderer
|
||||
// lamda to setup and add paragpraph
|
||||
auto add_paragraph = [this, &max_right, &min_left, &ar_paragraphs] (paragraph_ptr_t& paragraph) {
|
||||
|
||||
std::shared_ptr<CTextLine>& firstLine = paragraph->m_arTextLines.front();
|
||||
paragraph->m_dBot = paragraph->m_arTextLines.back()->m_dBotWithMaxDescent;
|
||||
paragraph->m_dTop = firstLine->m_dTopWithMaxAscent;
|
||||
double additional_bottom = paragraph->m_arTextLines.front()->m_dTopWithMaxAscent - paragraph->m_arTextLines.front()->m_dTop;
|
||||
paragraph->m_dBot = paragraph->m_arTextLines.back()->m_dBot + additional_bottom;
|
||||
paragraph->m_dTop = paragraph->m_arTextLines.front()->m_dTopWithMaxAscent;
|
||||
paragraph->m_dRight = max_right;
|
||||
paragraph->m_dLeft = min_left;
|
||||
|
||||
@ -1667,23 +1625,6 @@ namespace NSDocxRenderer
|
||||
|
||||
paragraph->MergeLines();
|
||||
|
||||
// Correct first line position
|
||||
double firstLine_height = firstLine->m_dBotWithMaxDescent - firstLine->m_dTopWithMaxAscent;
|
||||
if (paragraph->m_dLineHeight > firstLine_height)
|
||||
{
|
||||
double offset = paragraph->m_dLineHeight - firstLine_height;
|
||||
paragraph->m_dTop -= offset;
|
||||
paragraph->m_dBot -= offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
double ascent = firstLine->m_dBot - firstLine->m_dTopWithMaxAscent;
|
||||
double newAscent = ascent * paragraph->m_dLineHeight / firstLine_height;
|
||||
double offset = ascent - newAscent;
|
||||
paragraph->m_dTop += offset;
|
||||
paragraph->m_dBot += offset;
|
||||
}
|
||||
|
||||
// setting TextAlignmentType
|
||||
if (paragraph->m_arTextLines.size() > 1)
|
||||
{
|
||||
@ -1981,8 +1922,6 @@ namespace NSDocxRenderer
|
||||
{
|
||||
if (IsHorizontalLineBetween(text_lines[index], text_lines[index + 1]))
|
||||
ar_delims[index] = true;
|
||||
if (IsTextLineBetween(text_lines[index], text_lines[index + 1]))
|
||||
ar_delims[index] = true;
|
||||
}
|
||||
|
||||
// на основе ar_delims разбиваем на параграфы
|
||||
@ -2616,9 +2555,9 @@ namespace NSDocxRenderer
|
||||
pParagraph->m_arTextLines.push_back(pLine);
|
||||
pParagraph->m_dLeft = pLine->m_dLeft;
|
||||
pParagraph->m_dTop = pLine->m_dTopWithMaxAscent;
|
||||
pParagraph->m_dBot = pLine->m_dBotWithMaxDescent;
|
||||
pParagraph->m_dBot = pLine->m_dBot + (pLine->m_dTopWithMaxAscent - pLine->m_dTop);
|
||||
pParagraph->m_dWidth = pLine->m_dWidth;
|
||||
pParagraph->m_dHeight = pLine->m_dBotWithMaxDescent - pLine->m_dTopWithMaxAscent;
|
||||
pParagraph->m_dHeight = pLine->m_dHeight;
|
||||
pParagraph->m_dRight = pLine->m_dRight;
|
||||
pParagraph->m_dLineHeight = pParagraph->m_dHeight;
|
||||
pParagraph->m_nOrder = pLine->m_nOrder;
|
||||
@ -2635,11 +2574,11 @@ namespace NSDocxRenderer
|
||||
pShape->m_eType = CShape::eShapeType::stTextBox;
|
||||
|
||||
pShape->m_dLeft = pParagraph->m_dLeft;
|
||||
pShape->m_dRight = pParagraph->m_dRight * 1.025;
|
||||
pShape->m_dTop = pParagraph->m_dTop;
|
||||
pShape->m_dBot = pParagraph->m_dBot;
|
||||
pShape->m_dWidth = pShape->m_dRight - pShape->m_dLeft;
|
||||
pShape->m_dWidth = pParagraph->m_dWidth;
|
||||
pShape->m_dHeight = pParagraph->m_dHeight;
|
||||
pShape->m_dRight = pParagraph->m_dRight;
|
||||
pShape->m_nOrder = pParagraph->m_nOrder;
|
||||
pShape->m_bIsBehindDoc = false;
|
||||
|
||||
@ -2651,12 +2590,11 @@ namespace NSDocxRenderer
|
||||
auto pShape = std::make_shared<CShape>();
|
||||
|
||||
pShape->m_dLeft = pParagraph->m_dLeft;
|
||||
pShape->m_dRight = pParagraph->m_dRight;
|
||||
if (pParagraph->m_arTextLines.size() == 1) pShape->m_dRight *= 1.025;
|
||||
pShape->m_dTop = pParagraph->m_dTop;
|
||||
pShape->m_dRight = pParagraph->m_dRight;
|
||||
pShape->m_dBot = pParagraph->m_dBot;
|
||||
pShape->m_dHeight = pParagraph->m_dHeight;
|
||||
pShape->m_dWidth = pShape->m_dRight - pShape->m_dLeft;
|
||||
pShape->m_dWidth = pParagraph->m_dWidth;
|
||||
pShape->m_nOrder = pParagraph->m_nOrder;
|
||||
|
||||
if (pParagraph->m_bIsNeedFirstLineIndent && pParagraph->m_dFirstLine < 0)
|
||||
|
||||
@ -194,11 +194,9 @@ namespace NSDocxRenderer
|
||||
|
||||
bool IsVerticalLineBetween(text_line_ptr_t pFirst, text_line_ptr_t pSecond) const noexcept;
|
||||
bool IsHorizontalLineBetween(text_line_ptr_t pFirst, text_line_ptr_t pSecond) const noexcept;
|
||||
bool IsTextLineBetween(text_line_ptr_t pFirst, text_line_ptr_t pSecond) const noexcept;
|
||||
|
||||
bool IsVerticalLineTrough(base_item_ptr_t pFirst) const noexcept;
|
||||
bool IsHorizontalLineTrough(base_item_ptr_t pFirst) const noexcept;
|
||||
bool IsTextLineTrough(base_item_ptr_t pFirst) const noexcept;
|
||||
|
||||
void ToXml(NSStringUtils::CStringBuilder& oWriter) const noexcept;
|
||||
void WriteSectionToFile(bool bLastPage, NSStringUtils::CStringBuilder& oWriter) const noexcept;
|
||||
@ -233,8 +231,6 @@ namespace NSDocxRenderer
|
||||
std::vector<shape_ptr_t> m_arLuminosityShapes;
|
||||
std::vector<shape_ptr_t> m_arOneColorGradientShape;
|
||||
|
||||
long m_lLastType = 0;
|
||||
|
||||
size_t m_nCurrentOrder = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@ -178,10 +178,7 @@ namespace NSDocxRenderer
|
||||
}
|
||||
bool CBaseItem::IsEqual(double dTop, double dBot, double dLeft, double dRight) const noexcept
|
||||
{
|
||||
return fabs(m_dLeft - dLeft) < c_dGRAPHICS_ERROR_MM &&
|
||||
fabs(m_dTop - dTop) < c_dGRAPHICS_ERROR_MM &&
|
||||
fabs(m_dBot - dBot) < c_dGRAPHICS_ERROR_MM &&
|
||||
fabs(m_dRight - dRight) < c_dGRAPHICS_ERROR_MM;
|
||||
return m_dLeft == dLeft && m_dTop == dTop && m_dBot == dBot && m_dRight == dRight;
|
||||
}
|
||||
bool CBaseItem::operator==(const CBaseItem& other)
|
||||
{
|
||||
|
||||
@ -92,7 +92,6 @@ namespace NSDocxRenderer
|
||||
m_arOriginLefts[i] = rCont.m_arOriginLefts[i];
|
||||
|
||||
m_bFontSubstitution = rCont.m_bFontSubstitution;
|
||||
m_dSpacing = rCont.m_dSpacing;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -101,6 +100,7 @@ namespace NSDocxRenderer
|
||||
{
|
||||
if (!m_pFontStyle->wsFontName.empty() && !m_oText.empty())
|
||||
{
|
||||
// нужно перемерять...
|
||||
if (m_oSelectedFont.Path.empty())
|
||||
m_pManager->LoadFontByName(m_oSelectedFont);
|
||||
else
|
||||
@ -121,7 +121,6 @@ namespace NSDocxRenderer
|
||||
|
||||
m_oSelectedSizes.dWidth = dBoxWidth;
|
||||
m_oSelectedSizes.dHeight = dBoxHeight;
|
||||
m_dSpacing = (m_dWidth - m_oSelectedSizes.dWidth) / (m_oText.length());
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,34 +207,34 @@ namespace NSDocxRenderer
|
||||
return eVerticalCrossingType::vctCurrentInsideNext;
|
||||
|
||||
else if (this_top < other_top && this_bot > other_bot)
|
||||
return eVerticalCrossingType::vctCurrentOutsideNext;
|
||||
return eVerticalCrossingType::vctCurrentOutsideNext;
|
||||
|
||||
else if (this_top < other_top && this_bot < other_bot && this_bot > other_top &&
|
||||
this_bot - other_top > c_dOVERLAP_TEXT_LINE_ERROR_MM)
|
||||
return eVerticalCrossingType::vctCurrentAboveNext;
|
||||
else if (this_top < other_top && this_bot < other_bot &&
|
||||
(this_bot >= other_top || fabs(this_bot - other_top) < c_dTHE_SAME_STRING_Y_PRECISION_MM))
|
||||
return eVerticalCrossingType::vctCurrentAboveNext;
|
||||
|
||||
else if (this_top > other_top && this_bot > other_bot && this_top < other_bot &&
|
||||
other_bot - this_top > c_dOVERLAP_TEXT_LINE_ERROR_MM)
|
||||
return eVerticalCrossingType::vctCurrentBelowNext;
|
||||
else if (this_top > other_top && this_bot > other_bot &&
|
||||
(this_top <= other_bot || fabs(this_top - other_bot) < c_dTHE_SAME_STRING_Y_PRECISION_MM))
|
||||
return eVerticalCrossingType::vctCurrentBelowNext;
|
||||
|
||||
else if (this_top == other_top && this_bot == other_bot)
|
||||
return eVerticalCrossingType::vctDublicate;
|
||||
|
||||
else if (fabs(this_top - other_top) < c_dTHE_SAME_STRING_Y_PRECISION_MM &&
|
||||
fabs(this_bot - other_bot) < c_dTHE_SAME_STRING_Y_PRECISION_MM)
|
||||
return eVerticalCrossingType::vctTopAndBottomBordersMatch;
|
||||
return eVerticalCrossingType::vctTopAndBottomBordersMatch;
|
||||
|
||||
else if (fabs(this_top - other_top) < c_dTHE_SAME_STRING_Y_PRECISION_MM)
|
||||
return eVerticalCrossingType::vctTopBorderMatch;
|
||||
return eVerticalCrossingType::vctTopBorderMatch;
|
||||
|
||||
else if (fabs(this_bot - other_bot) < c_dTHE_SAME_STRING_Y_PRECISION_MM)
|
||||
return eVerticalCrossingType::vctBottomBorderMatch;
|
||||
return eVerticalCrossingType::vctBottomBorderMatch;
|
||||
|
||||
else if (other_top - this_bot > -c_dOVERLAP_TEXT_LINE_ERROR_MM)
|
||||
return eVerticalCrossingType::vctNoCrossingCurrentAboveNext;
|
||||
else if (this_bot < other_top)
|
||||
return eVerticalCrossingType::vctNoCrossingCurrentAboveNext;
|
||||
|
||||
else if (this_top - other_bot > -c_dOVERLAP_TEXT_LINE_ERROR_MM)
|
||||
return eVerticalCrossingType::vctNoCrossingCurrentBelowNext;
|
||||
else if (this_top > other_bot)
|
||||
return eVerticalCrossingType::vctNoCrossingCurrentBelowNext;
|
||||
|
||||
else
|
||||
return eVerticalCrossingType::vctUnknown;
|
||||
@ -259,11 +258,18 @@ namespace NSDocxRenderer
|
||||
|
||||
LONG lCalculatedSpacing = 0;
|
||||
|
||||
// mm to points * 20
|
||||
if (!m_oText.empty())
|
||||
lCalculatedSpacing = static_cast<LONG>(m_dSpacing * c_dMMToDx);
|
||||
{
|
||||
double dSpacing = (m_dWidth - m_oSelectedSizes.dWidth) / (m_oText.length());
|
||||
dSpacing *= c_dMMToDx;
|
||||
|
||||
//mm to points * 20
|
||||
lCalculatedSpacing = static_cast<LONG>(dSpacing);
|
||||
}
|
||||
|
||||
// принудительно уменьшаем spacing чтобы текстовые линии не выходили за правую границу
|
||||
lCalculatedSpacing -= 1;
|
||||
|
||||
if (lCalculatedSpacing != 0)
|
||||
{
|
||||
oWriter.WriteString(L"<w:spacing w:val=\"");
|
||||
@ -390,7 +396,14 @@ namespace NSDocxRenderer
|
||||
|
||||
LONG lCalculatedSpacing = 0;
|
||||
if (!m_oText.empty())
|
||||
lCalculatedSpacing = static_cast<LONG>(m_dSpacing * c_dMMToPt * 100);
|
||||
{
|
||||
double dSpacing = (m_dWidth - m_oSelectedSizes.dWidth) / (m_oText.length());
|
||||
dSpacing *= c_dMMToPt * 100;
|
||||
lCalculatedSpacing = static_cast<LONG>(dSpacing);
|
||||
}
|
||||
|
||||
// принудительно уменьшаем spacing чтобы текстовые линии не выходили за правую границу
|
||||
lCalculatedSpacing -= 15;
|
||||
|
||||
oWriter.WriteString(L" spc=\"");
|
||||
oWriter.AddInt(lCalculatedSpacing);
|
||||
@ -528,7 +541,12 @@ namespace NSDocxRenderer
|
||||
{
|
||||
int lCalculatedSpacing = 0;
|
||||
if (!m_oText.empty())
|
||||
lCalculatedSpacing = static_cast<LONG>(m_dSpacing * c_dMMToPt * 100);
|
||||
{
|
||||
double dSpacing = (m_dWidth - m_oSelectedSizes.dWidth) / (m_oText.length());
|
||||
dSpacing *= c_dMMToPt * 100;
|
||||
lCalculatedSpacing = static_cast<LONG>(dSpacing);
|
||||
}
|
||||
lCalculatedSpacing -= 15;
|
||||
|
||||
const BYTE kPARRUN_TYPE_RUN = 1;
|
||||
oWriter.StartRecord(kPARRUN_TYPE_RUN);
|
||||
@ -555,9 +573,6 @@ namespace NSDocxRenderer
|
||||
std::wstring origin_lefts{};
|
||||
for (auto& l : m_arOriginLefts)
|
||||
origin_lefts += std::to_wstring(static_cast<int>(l * c_dMMToEMU)) + L";";
|
||||
// add offset for last symbol
|
||||
if (!m_arSymWidths.empty())
|
||||
origin_lefts += std::to_wstring(static_cast<int>((m_arOriginLefts.back() + m_arSymWidths.back()) * c_dMMToEMU)) + L";";
|
||||
|
||||
oWriter.WriteBYTE(5); oWriter.WriteStringUtf16(origin_lefts); // Origin lefts
|
||||
oWriter.WriteBYTE(6); oWriter.WriteBool(m_bFontSubstitution); // Font Substitution (just pass from pdf)
|
||||
@ -661,7 +676,6 @@ namespace NSDocxRenderer
|
||||
|
||||
bool CContText::IsEqual(const CContText *pCont) const noexcept
|
||||
{
|
||||
bool bIf0 = IsFontsEqual(m_oSelectedFont, pCont->m_oSelectedFont);
|
||||
bool bIf1 = m_pFontStyle->wsFontStyleId == pCont->m_pFontStyle->wsFontStyleId;
|
||||
bool bIf2 = m_bIsStrikeoutPresent == pCont->m_bIsStrikeoutPresent;
|
||||
bool bIf3 = m_bIsDoubleStrikeout == pCont->m_bIsDoubleStrikeout;
|
||||
@ -678,7 +692,7 @@ namespace NSDocxRenderer
|
||||
bool bIf14 = m_eVertAlignType == eVertAlignType::vatUnknown && pCont->m_eVertAlignType == eVertAlignType::vatBase;
|
||||
bool bIf15 = m_eVertAlignType == eVertAlignType::vatBase && pCont->m_eVertAlignType == eVertAlignType::vatUnknown;
|
||||
|
||||
return (bIf0 && bIf1 && bIf2 && bIf3 && bIf4 && bIf5 && bIf6 && bIf7 &&
|
||||
return (bIf1 && bIf2 && bIf3 && bIf4 && bIf5 && bIf6 && bIf7 &&
|
||||
bIf8 && bIf9 && bIf10 && bIf11 && bIf12 && (bIf13 || bIf14 || bIf15));
|
||||
}
|
||||
|
||||
@ -740,14 +754,14 @@ namespace NSDocxRenderer
|
||||
continue;
|
||||
}
|
||||
m_arSymWidths.push_back(w);
|
||||
m_dWidth += w;
|
||||
m_oText += oText.at(i);
|
||||
m_arOriginLefts.push_back(arOriginLefts[i]);
|
||||
m_dRight = arOriginLefts[i] + w;
|
||||
|
||||
if (!arGids.empty() && m_bCollectMetaInfo)
|
||||
m_arGids.push_back(arGids[i]);
|
||||
}
|
||||
m_dWidth = m_dRight - m_dLeft;
|
||||
m_dRight = m_dLeft + m_dWidth;
|
||||
}
|
||||
void CContText::AddTextFront(const NSStringUtils::CStringUTF32& oText,
|
||||
const std::vector<double>& arSymWidths,
|
||||
@ -756,11 +770,18 @@ namespace NSDocxRenderer
|
||||
{
|
||||
m_oText = oText + m_oText;
|
||||
|
||||
double addtitional_width = 0;
|
||||
for (auto& w : arSymWidths)
|
||||
addtitional_width += w;
|
||||
|
||||
auto ar_sym_w = m_arSymWidths;
|
||||
m_arSymWidths = arSymWidths;
|
||||
for (auto& w : ar_sym_w)
|
||||
m_arSymWidths.push_back(w);
|
||||
|
||||
m_dWidth += addtitional_width;
|
||||
m_dLeft = m_dRight - m_dWidth;
|
||||
|
||||
if (!arGids.empty() && m_bCollectMetaInfo)
|
||||
{
|
||||
auto ar_gids = m_arGids;
|
||||
@ -773,9 +794,6 @@ namespace NSDocxRenderer
|
||||
m_arOriginLefts = arOriginLefts;
|
||||
for (auto& left : ar_lefts)
|
||||
m_arOriginLefts.push_back(left);
|
||||
|
||||
m_dLeft = m_arOriginLefts.back();
|
||||
m_dWidth = m_dRight - m_dLeft;
|
||||
}
|
||||
void CContText::SetText(const NSStringUtils::CStringUTF32& oText,
|
||||
const std::vector<double>& arSymWidths,
|
||||
@ -816,8 +834,8 @@ namespace NSDocxRenderer
|
||||
m_arGids.push_back(nGid);
|
||||
}
|
||||
}
|
||||
m_dRight = dLeft + dWidth;
|
||||
m_dWidth = m_dRight - m_dLeft;
|
||||
m_dWidth += dWidth;
|
||||
m_dRight = m_dLeft + m_dWidth;
|
||||
}
|
||||
void CContText::AddSymFront(uint32_t cSym, double dWidth, double dLeft, unsigned int nGid)
|
||||
{
|
||||
@ -826,7 +844,7 @@ namespace NSDocxRenderer
|
||||
text += m_oText;
|
||||
m_oText = text;
|
||||
|
||||
m_dLeft = dLeft;
|
||||
m_dLeft -= dWidth;
|
||||
m_dWidth = m_dRight - m_dLeft;
|
||||
|
||||
m_arSymWidths.insert(m_arSymWidths.begin(), dWidth);
|
||||
@ -860,16 +878,11 @@ namespace NSDocxRenderer
|
||||
void CContText::RemoveLastSym()
|
||||
{
|
||||
m_oText = m_oText.substr(0, m_oText.length() - 1);
|
||||
m_dWidth -= m_arSymWidths[m_arSymWidths.size() - 1];
|
||||
m_dRight = m_dLeft + m_dWidth;
|
||||
m_arSymWidths.resize(m_arSymWidths.size() - 1);
|
||||
m_arOriginLefts.resize(m_arOriginLefts.size() - 1);
|
||||
|
||||
if (!m_arOriginLefts.empty())
|
||||
m_dRight = m_arOriginLefts.back() + m_arSymWidths.back();
|
||||
else
|
||||
m_dRight = m_dLeft;
|
||||
|
||||
m_dWidth = m_dRight - m_dLeft;
|
||||
|
||||
if (!m_arGids.empty() && m_bCollectMetaInfo)
|
||||
m_arGids.resize(m_arGids.size() - 1);
|
||||
}
|
||||
@ -886,7 +899,7 @@ namespace NSDocxRenderer
|
||||
{
|
||||
return m_arSymWidths;
|
||||
}
|
||||
const std::vector<double>& CContText::GetSymLefts() const noexcept
|
||||
const std::vector<double> CContText::GetSymLefts() const noexcept
|
||||
{
|
||||
return m_arOriginLefts;
|
||||
}
|
||||
@ -898,12 +911,12 @@ namespace NSDocxRenderer
|
||||
eHorizontalCrossingType eHType)
|
||||
{
|
||||
//Условие пересечения по вертикали
|
||||
bool bIf1 = eVType == eVerticalCrossingType::vctCurrentAboveNext;
|
||||
bool bIf2 = eVType == eVerticalCrossingType::vctCurrentBelowNext;
|
||||
bool bIf1 = eVType == eVerticalCrossingType::vctCurrentAboveNext; //текущий cont выше
|
||||
bool bIf2 = eVType == eVerticalCrossingType::vctCurrentBelowNext; //текущий cont ниже
|
||||
|
||||
//Условие пересечения по горизонтали
|
||||
bool bIf3 = eHType == eHorizontalCrossingType::hctCurrentLeftOfNext;
|
||||
bool bIf4 = eHType == eHorizontalCrossingType::hctCurrentRightOfNext;
|
||||
bool bIf3 = eHType == eHorizontalCrossingType::hctCurrentLeftOfNext; //текущий cont левее
|
||||
bool bIf4 = eHType == eHorizontalCrossingType::hctCurrentRightOfNext; //текущий cont правее
|
||||
|
||||
//Размеры шрифта и текст должны бать одинаковыми
|
||||
bool bIf5 = pFirstCont->m_pFontStyle->dFontSize == pSecondCont->m_pFontStyle->dFontSize;
|
||||
@ -919,7 +932,9 @@ namespace NSDocxRenderer
|
||||
bool bIf11 = pFirstCont->m_pFontStyle->oBrush.Color1 == c_iGreyColor2;
|
||||
bool bIf12 = pSecondCont->m_pFontStyle->oBrush.Color1 == c_iGreyColor2;
|
||||
|
||||
// каждый символ с Emboss или Engrave разбиваются на 3 символа с разными цветами
|
||||
//note Каждый символ с Emboss или Engrave разбиваются на 3 символа с разными цветами
|
||||
//note Логика подобрана для конкретного примера - возможно нужно будет ее обобщить.
|
||||
//todo существует проблема неправильного определением FontEffects с физически пересекаемыми строчками - файл generaltest.pdf p.14
|
||||
if (bIf5 && bIf6)
|
||||
{
|
||||
if (bIf12 && pFirstCont->m_bIsEmbossPresent)
|
||||
@ -979,10 +994,8 @@ namespace NSDocxRenderer
|
||||
eHorizontalCrossingType eHType)
|
||||
{
|
||||
|
||||
double first_height = pFirstCont->m_dBotWithDescent - pFirstCont->m_dTopWithAscent;
|
||||
bool bIf1 = eVType == eVerticalCrossingType::vctCurrentAboveNext ||
|
||||
eVType == eVerticalCrossingType::vctCurrentInsideNext &&
|
||||
pSecondCont->m_dBot - pFirstCont->m_dBot > first_height * 0.2;
|
||||
eVType == eVerticalCrossingType::vctCurrentInsideNext;
|
||||
|
||||
bool bIf2 = eVType == eVerticalCrossingType::vctCurrentBelowNext;
|
||||
|
||||
@ -1094,19 +1107,6 @@ namespace NSDocxRenderer
|
||||
{
|
||||
return 0x0300 <= cSym && 0x036F >= cSym;
|
||||
}
|
||||
bool CContText::IsFontsEqual(const NSStructures::CFont& oFont1, const NSStructures::CFont& oFont2)
|
||||
{
|
||||
bool res = oFont1.Name == oFont2.Name;
|
||||
res = res && oFont1.Path == oFont2.Path;
|
||||
res = res && oFont1.FaceIndex == oFont2.FaceIndex;
|
||||
res = res && oFont1.StringGID == oFont2.StringGID;
|
||||
res = res && oFont1.Size == oFont2.Size;
|
||||
res = res && oFont1.Bold == oFont2.Bold;
|
||||
res = res && oFont1.Italic == oFont2.Italic;
|
||||
res = res && oFont1.Underline == oFont2.Underline;
|
||||
res = res && oFont1.Strikeout == oFont2.Strikeout;
|
||||
return res;
|
||||
}
|
||||
|
||||
double CContText::CalculateSpace() const noexcept
|
||||
{
|
||||
@ -1174,25 +1174,22 @@ namespace NSDocxRenderer
|
||||
oText.length() == 1 && CContText::IsUnicodeDiacriticalMark(oText.at(0))) &&
|
||||
bFontSubstitution == m_pCurrCont->m_bFontSubstitution)
|
||||
{
|
||||
|
||||
double avg_width = dWidth / oText.length();
|
||||
for (size_t i = 0; i < oText.length(); ++i)
|
||||
if (oText.at(i) == c_SPACE_SYM)
|
||||
m_pCurrCont->m_pFontStyle->UpdateAvgSpaceWidth(avg_width);
|
||||
|
||||
double avg_space_width = m_pCurrCont->m_pFontStyle->GetAvgSpaceWidth();
|
||||
double space_width =
|
||||
avg_space_width != 0.0 ?
|
||||
avg_space_width * c_dAVERAGE_SPACE_WIDTH_COEF :
|
||||
m_pCurrCont->CalculateSpace() * c_dSPACE_WIDTH_COEF;
|
||||
|
||||
double spacing = dLeft - m_dPrevRight;
|
||||
bool is_added = false;
|
||||
bool diff_spacing = false;
|
||||
|
||||
// set spacing at the second symbol
|
||||
if (m_pCurrCont->GetLength() == 1)
|
||||
m_pCurrCont->m_dSpacing = spacing;
|
||||
|
||||
if (fabs(spacing - m_pCurrCont->m_dSpacing) > c_dTHE_SAME_SPACING_ERROR)
|
||||
diff_spacing = true;
|
||||
|
||||
// some_text+more_text
|
||||
if (!diff_spacing && fabs(m_pCurrCont->m_dRight - dLeft) < space_width && dRight > m_pCurrCont->m_dRight)
|
||||
if (fabs(m_pCurrCont->m_dRight - dLeft) < space_width && dRight > m_pCurrCont->m_dRight)
|
||||
{
|
||||
double left_avg_width = (dRight - m_pCurrCont->m_dRight) / oText.length();
|
||||
std::vector<double> ar_widths;
|
||||
@ -1204,7 +1201,7 @@ namespace NSDocxRenderer
|
||||
|
||||
}
|
||||
// more_text+some_text
|
||||
else if (diff_spacing && fabs(m_pCurrCont->m_dLeft - dRight) < space_width && dLeft < m_pCurrCont->m_dLeft)
|
||||
else if (fabs(m_pCurrCont->m_dLeft - dRight) < space_width && dLeft < m_pCurrCont->m_dLeft)
|
||||
{
|
||||
double right_avg_width = (m_pCurrCont->m_dLeft - dLeft) / oText.length();
|
||||
std::vector<double> ar_widths;
|
||||
@ -1222,7 +1219,6 @@ namespace NSDocxRenderer
|
||||
m_pCurrCont->m_dHeight = m_pCurrCont->m_dBot - m_pCurrCont->m_dTop;
|
||||
m_pCurrCont->m_dWidth = m_pCurrCont->m_dRight - m_pCurrCont->m_dLeft;
|
||||
m_pCurrCont->m_nOrder = nOrder;
|
||||
m_dPrevRight = dRight;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1246,14 +1242,14 @@ namespace NSDocxRenderer
|
||||
m_pFontSelector->IsSelectedItalic(),
|
||||
m_pFontSelector->IsSelectedBold() || bForcedBold);
|
||||
|
||||
double avg_width = dWidth / oText.length();
|
||||
for (size_t i = 0; i < oText.length(); ++i)
|
||||
if (oText.at(i) == c_SPACE_SYM)
|
||||
pCont->m_pFontStyle->UpdateAvgSpaceWidth(avg_width);
|
||||
|
||||
// just in case if oText contains more than 1 symbol
|
||||
std::vector<double> ar_widths;
|
||||
double avg_width = abs(dRight - dLeft) / oText.length();
|
||||
for (size_t i = 0; i < oText.length(); ++i)
|
||||
{
|
||||
if (oText.at(i) == c_SPACE_SYM) pCont->m_pFontStyle->UpdateAvgSpaceWidth(avg_width);
|
||||
ar_widths.push_back(avg_width);
|
||||
}
|
||||
|
||||
pCont->m_bCollectMetaInfo = bCollectMetaInfo;
|
||||
pCont->SetText(oText, ar_widths, std::move(gids), std::move(origin_lefts));
|
||||
@ -1262,11 +1258,12 @@ namespace NSDocxRenderer
|
||||
pCont->m_dWidth = dWidth;
|
||||
pCont->m_dRight = dRight;
|
||||
|
||||
double ascent = pFontManager->GetFontAscent();
|
||||
double descent = pFontManager->GetFontDescent();
|
||||
double font_size = oFont.Size;
|
||||
double em_height = oMetrics.dEmHeight;
|
||||
double ratio = font_size / em_height * c_dPtToMM;
|
||||
|
||||
pCont->m_dTopWithAscent = pCont->m_dBot - ascent;
|
||||
pCont->m_dBotWithDescent = pCont->m_dBot + fabs(descent);
|
||||
pCont->m_dTopWithAscent = pCont->m_dBot - (oMetrics.dAscent * ratio);
|
||||
pCont->m_dBotWithDescent = pCont->m_dBot + (oMetrics.dDescent * ratio);
|
||||
pCont->m_dSpaceWidthMM = pFontManager->GetSpaceWidthMM();
|
||||
|
||||
pCont->m_wsOriginFontName = oFont.Name;
|
||||
@ -1302,7 +1299,6 @@ namespace NSDocxRenderer
|
||||
m_pCurrCont = pCont;
|
||||
m_oPrevFont = oFont;
|
||||
m_oPrevBrush = oBrush;
|
||||
m_dPrevRight = dRight;
|
||||
}
|
||||
|
||||
void CContTextBuilder::NullCurrCont()
|
||||
|
||||
@ -67,7 +67,6 @@ namespace NSDocxRenderer
|
||||
|
||||
// sizes
|
||||
double m_dSpaceWidthMM{0};
|
||||
double m_dSpacing{0};
|
||||
CSelectedSizes m_oSelectedSizes{};
|
||||
|
||||
double m_dTopWithAscent{0};
|
||||
@ -122,7 +121,7 @@ namespace NSDocxRenderer
|
||||
|
||||
const NSStringUtils::CStringUTF32& GetText() const noexcept;
|
||||
const std::vector<double>& GetSymWidths() const noexcept;
|
||||
const std::vector<double>& GetSymLefts() const noexcept;
|
||||
const std::vector<double> GetSymLefts() const noexcept;
|
||||
|
||||
std::shared_ptr<CContText> Split(size_t index);
|
||||
std::shared_ptr<CContText> Split(double dLeft);
|
||||
@ -159,8 +158,6 @@ namespace NSDocxRenderer
|
||||
static bool IsUnicodeSymbol(uint32_t symbol);
|
||||
static bool IsUnicodeDiacriticalMark(uint32_t symbol);
|
||||
|
||||
static bool IsFontsEqual(const NSStructures::CFont& oFont1, const NSStructures::CFont& oFont2);
|
||||
|
||||
private:
|
||||
NSStringUtils::CStringUTF32 m_oText{};
|
||||
std::vector<double> m_arSymWidths{};
|
||||
@ -201,8 +198,8 @@ namespace NSDocxRenderer
|
||||
|
||||
void NullCurrCont();
|
||||
void Clear();
|
||||
private:
|
||||
|
||||
private:
|
||||
std::vector<cont_ptr_t> m_arConts;
|
||||
std::vector<cont_ptr_t> m_arDiacs;
|
||||
|
||||
@ -213,6 +210,5 @@ namespace NSDocxRenderer
|
||||
|
||||
CFontStyleManager* m_pFontStyleManager {nullptr};
|
||||
CFontSelector* m_pFontSelector {nullptr};
|
||||
double m_dPrevRight = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@ -1343,7 +1343,7 @@ namespace NSDocxRenderer
|
||||
// WriteRecord WriteBodyPr
|
||||
oWriter.StartRecord(0);
|
||||
oWriter.WriteBYTE(kBin_g_nodeAttributeStart);
|
||||
oWriter.WriteBYTE(1); oWriter.WriteBYTE(4); // anchor
|
||||
oWriter.WriteBYTE(1); oWriter.WriteBYTE(1); // anchor
|
||||
oWriter.WriteBYTE(2); oWriter.WriteBool(false); // anchorCtr
|
||||
oWriter.WriteBYTE(3); oWriter.AddInt(0); // bIns
|
||||
oWriter.WriteBYTE(4); oWriter.WriteBool(true); // compatLnSpc
|
||||
|
||||
@ -66,8 +66,6 @@ namespace NSDocxRenderer
|
||||
std::sort(m_arConts.begin(), m_arConts.end(), [] (const cont_ptr_t& a, const cont_ptr_t& b) {
|
||||
if (!a) return false;
|
||||
if (!b) return true;
|
||||
if (fabs(a->m_dLeft - b->m_dLeft) < c_dTHE_SAME_STRING_X_PRECISION_MM)
|
||||
return a->m_dRight < b->m_dRight;
|
||||
return a->m_dLeft < b->m_dLeft;
|
||||
});
|
||||
|
||||
@ -196,20 +194,16 @@ namespace NSDocxRenderer
|
||||
continue;
|
||||
|
||||
const auto& text = cont->GetText();
|
||||
auto ar_lefts = cont->GetSymLefts();
|
||||
auto ar_width = cont->GetSymWidths();
|
||||
auto ar_widths = cont->GetSymWidths();
|
||||
for (size_t i = 0; i < text.length(); ++i)
|
||||
{
|
||||
if (text.at(i) == c_SPACE_SYM)
|
||||
{
|
||||
if (i == 0)
|
||||
m_dFirstWordWidth = cont->m_dLeft - m_dLeft;
|
||||
else
|
||||
m_dFirstWordWidth = ar_lefts[i - 1] - m_dLeft + ar_width[i - 1];
|
||||
m_dFirstWordWidth = width;
|
||||
is_done = true;
|
||||
break;
|
||||
}
|
||||
|
||||
width += ar_widths[i];
|
||||
}
|
||||
if (is_done)
|
||||
break;
|
||||
@ -245,15 +239,15 @@ namespace NSDocxRenderer
|
||||
return eVerticalCrossingType::vctCurrentInsideNext;
|
||||
|
||||
else if (this_top < other_top && this_bot > other_bot)
|
||||
return eVerticalCrossingType::vctCurrentOutsideNext;
|
||||
return eVerticalCrossingType::vctCurrentOutsideNext;
|
||||
|
||||
else if (this_top < other_top && this_bot < other_bot && this_bot > other_top &&
|
||||
this_bot - other_top > c_dOVERLAP_TEXT_LINE_ERROR_MM)
|
||||
return eVerticalCrossingType::vctCurrentAboveNext;
|
||||
else if (this_top < other_top && this_bot < other_bot &&
|
||||
(this_bot >= other_top || fabs(this_bot - other_top) < c_dTHE_SAME_STRING_Y_PRECISION_MM))
|
||||
return eVerticalCrossingType::vctCurrentAboveNext;
|
||||
|
||||
else if (this_top > other_top && this_bot > other_bot && this_top < other_bot &&
|
||||
other_bot - this_top > c_dOVERLAP_TEXT_LINE_ERROR_MM)
|
||||
return eVerticalCrossingType::vctCurrentBelowNext;
|
||||
else if (this_top > other_top && this_bot > other_bot &&
|
||||
(this_top <= other_bot || fabs(this_top - other_bot) < c_dTHE_SAME_STRING_Y_PRECISION_MM))
|
||||
return eVerticalCrossingType::vctCurrentBelowNext;
|
||||
|
||||
else if (this_top == other_top && this_bot == other_bot &&
|
||||
m_dLeft == pLine->m_dLeft && m_dRight == pLine->m_dRight)
|
||||
@ -261,33 +255,31 @@ namespace NSDocxRenderer
|
||||
|
||||
else if (fabs(this_top - other_top) < c_dTHE_SAME_STRING_Y_PRECISION_MM &&
|
||||
fabs(this_bot - other_bot) < c_dTHE_SAME_STRING_Y_PRECISION_MM)
|
||||
return eVerticalCrossingType::vctTopAndBottomBordersMatch;
|
||||
return eVerticalCrossingType::vctTopAndBottomBordersMatch;
|
||||
|
||||
else if (fabs(this_top - other_top) < c_dTHE_SAME_STRING_Y_PRECISION_MM)
|
||||
return eVerticalCrossingType::vctTopBorderMatch;
|
||||
return eVerticalCrossingType::vctTopBorderMatch;
|
||||
|
||||
else if (fabs(this_bot - other_bot) < c_dTHE_SAME_STRING_Y_PRECISION_MM)
|
||||
return eVerticalCrossingType::vctBottomBorderMatch;
|
||||
return eVerticalCrossingType::vctBottomBorderMatch;
|
||||
|
||||
else if (other_top - this_bot > -c_dOVERLAP_TEXT_LINE_ERROR_MM)
|
||||
return eVerticalCrossingType::vctNoCrossingCurrentAboveNext;
|
||||
else if (this_bot < other_top)
|
||||
return eVerticalCrossingType::vctNoCrossingCurrentAboveNext;
|
||||
|
||||
else if (this_top - other_bot > -c_dOVERLAP_TEXT_LINE_ERROR_MM)
|
||||
return eVerticalCrossingType::vctNoCrossingCurrentBelowNext;
|
||||
else if (this_top > other_bot)
|
||||
return eVerticalCrossingType::vctNoCrossingCurrentBelowNext;
|
||||
|
||||
else
|
||||
return eVerticalCrossingType::vctUnknown;
|
||||
return eVerticalCrossingType::vctUnknown;
|
||||
}
|
||||
|
||||
void CTextLine::RecalcWithNewItem(const CContText* pCont)
|
||||
{
|
||||
CBaseItem::RecalcWithNewItem(pCont);
|
||||
if (!pCont->IsOnlySpaces())
|
||||
{
|
||||
if (m_dTopWithMaxAscent == 0.0) m_dTopWithMaxAscent = pCont->m_dTopWithAscent;
|
||||
else m_dTopWithMaxAscent = std::min(m_dTopWithMaxAscent, pCont->m_dTopWithAscent);
|
||||
m_dBotWithMaxDescent = std::max(m_dBotWithMaxDescent, pCont->m_dBotWithDescent);
|
||||
}
|
||||
if (m_dTopWithMaxAscent == 0.0) m_dTopWithMaxAscent = pCont->m_dTopWithAscent;
|
||||
else m_dTopWithMaxAscent = std::min(m_dTopWithMaxAscent, pCont->m_dTopWithAscent);
|
||||
|
||||
m_dBotWithMaxDescent = std::max(m_dBotWithMaxDescent, pCont->m_dBotWithDescent);
|
||||
}
|
||||
|
||||
void CTextLine::SetVertAlignType(const eVertAlignType& oType)
|
||||
|
||||
@ -581,16 +581,6 @@ namespace NSDocxRenderer
|
||||
{
|
||||
return c_dPtToMM * (m_oFontMetrics.dLineSpacing * m_oFont.Size) / m_oFontMetrics.dEmHeight;
|
||||
}
|
||||
double CFontManager::GetFontAscent() const
|
||||
{
|
||||
//double tmp = m_oFontMetrics.dAscent;
|
||||
double tmp = m_oFontMetrics.dLineSpacing - fabs(m_oFontMetrics.dDescent);
|
||||
return c_dPtToMM * (tmp * m_oFont.Size) / m_oFontMetrics.dEmHeight;
|
||||
}
|
||||
double CFontManager::GetFontDescent() const
|
||||
{
|
||||
return c_dPtToMM * (m_oFontMetrics.dDescent * m_oFont.Size) / m_oFontMetrics.dEmHeight;
|
||||
}
|
||||
double CFontManager::GetSpaceWidthMM() const
|
||||
{
|
||||
double dSpaceWidthMM = 0.0;
|
||||
|
||||
@ -124,9 +124,6 @@ namespace NSDocxRenderer
|
||||
const CFontMetrics& GetFontMetrics() const noexcept;
|
||||
|
||||
double GetFontHeight() const;
|
||||
double GetFontAscent() const;
|
||||
double GetFontDescent() const;
|
||||
|
||||
double GetSpaceWidthMM() const;
|
||||
|
||||
void SetStringGid(const LONG& lGid);
|
||||
|
||||
@ -24,11 +24,9 @@ constexpr double c_dPtToEMU = 12700.0;
|
||||
constexpr double c_dDegreeToAngle = 60000.0;
|
||||
|
||||
const double c_dSTANDART_STRING_HEIGHT_MM = 4.2333333333333334;
|
||||
const double c_dTHE_SAME_STRING_Y_PRECISION_MM = 0.015;
|
||||
const double c_dTHE_SAME_STRING_X_PRECISION_MM = 0.03;
|
||||
const double c_dTHE_SAME_SPACING_ERROR = 0.1;
|
||||
const double c_dTHE_SAME_STRING_Y_PRECISION_MM = 0.02;
|
||||
const double c_dTHE_SAME_STRING_X_PRECISION_MM = 0.02;
|
||||
const double c_dLINE_DISTANCE_ERROR_MM = 0.3;
|
||||
const double c_dOVERLAP_TEXT_LINE_ERROR_MM = 0.5;
|
||||
const double c_dERROR_OF_PARAGRAPH_BORDERS_MM = 1.0;
|
||||
const double c_dCENTER_POSITION_ERROR_MM = 1.5;
|
||||
const double c_dTHE_STRING_X_PRECISION_MM = 0.5;
|
||||
|
||||
@ -14,7 +14,7 @@ include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lCryptoPPLib
|
||||
|
||||
ADD_DEPENDENCY(kernel, UnicodeConverter, graphics, StarMathConverter)
|
||||
ADD_DEPENDENCY(kernel, UnicodeConverter, graphics)
|
||||
|
||||
DEFINES += HWPFILE_USE_DYNAMIC_LIBRARY \
|
||||
CRYPTOPP_DISABLE_ASM
|
||||
@ -22,6 +22,58 @@ DEFINES += HWPFILE_USE_DYNAMIC_LIBRARY \
|
||||
|
||||
SOURCES += \
|
||||
HWPFile.cpp \
|
||||
HwpDoc/Chart/Attribute.cpp \
|
||||
HwpDoc/Chart/Axis.cpp \
|
||||
HwpDoc/Chart/Backdrop.cpp \
|
||||
HwpDoc/Chart/Bar.cpp \
|
||||
HwpDoc/Chart/Brush.cpp \
|
||||
HwpDoc/Chart/CategoryScale.cpp \
|
||||
HwpDoc/Chart/ChartReader.cpp \
|
||||
HwpDoc/Chart/ChartStream.cpp \
|
||||
HwpDoc/Chart/Contour.cpp \
|
||||
HwpDoc/Chart/ContourGradient.cpp \
|
||||
HwpDoc/Chart/Coor.cpp \
|
||||
HwpDoc/Chart/Coor3.cpp \
|
||||
HwpDoc/Chart/DataGrid.cpp \
|
||||
HwpDoc/Chart/DataPoint.cpp \
|
||||
HwpDoc/Chart/DateScale.cpp \
|
||||
HwpDoc/Chart/Doughnut.cpp \
|
||||
HwpDoc/Chart/Elevation.cpp \
|
||||
HwpDoc/Chart/Fill.cpp \
|
||||
HwpDoc/Chart/Footnote.cpp \
|
||||
HwpDoc/Chart/Frame.cpp \
|
||||
HwpDoc/Chart/Gradient.cpp \
|
||||
HwpDoc/Chart/HiLo.cpp \
|
||||
HwpDoc/Chart/Intersection.cpp \
|
||||
HwpDoc/Chart/LCoor.cpp \
|
||||
HwpDoc/Chart/LRect.cpp \
|
||||
HwpDoc/Chart/Label.cpp \
|
||||
HwpDoc/Chart/Legend.cpp \
|
||||
HwpDoc/Chart/Light.cpp \
|
||||
HwpDoc/Chart/Location.cpp \
|
||||
HwpDoc/Chart/Marker.cpp \
|
||||
HwpDoc/Chart/Pen.cpp \
|
||||
HwpDoc/Chart/Pie.cpp \
|
||||
HwpDoc/Chart/Plot.cpp \
|
||||
HwpDoc/Chart/Position.cpp \
|
||||
HwpDoc/Chart/PrintInformation.cpp \
|
||||
HwpDoc/Chart/Rect.cpp \
|
||||
HwpDoc/Chart/Series.cpp \
|
||||
HwpDoc/Chart/Shadow.cpp \
|
||||
HwpDoc/Chart/StatLine.cpp \
|
||||
HwpDoc/Chart/Surface.cpp \
|
||||
HwpDoc/Chart/TextLayout.cpp \
|
||||
HwpDoc/Chart/Tick.cpp \
|
||||
HwpDoc/Chart/Title.cpp \
|
||||
HwpDoc/Chart/ValueScale.cpp \
|
||||
HwpDoc/Chart/View3D.cpp \
|
||||
HwpDoc/Chart/VtChart.cpp \
|
||||
HwpDoc/Chart/VtColor.cpp \
|
||||
HwpDoc/Chart/VtFont.cpp \
|
||||
HwpDoc/Chart/VtPicture.cpp \
|
||||
HwpDoc/Chart/Wall.cpp \
|
||||
HwpDoc/Chart/Weighting.cpp \
|
||||
HwpDoc/Chart/XYZ.cpp \
|
||||
HwpDoc/Common/XMLReader.cpp \
|
||||
HwpDoc/Common/WriterContext.cpp \
|
||||
HwpDoc/Conversion/Converter2OOXML.cpp \
|
||||
@ -99,6 +151,61 @@ SOURCES += \
|
||||
|
||||
HEADERS += \
|
||||
HWPFile.h \
|
||||
HwpDoc/Chart/Attribute.h \
|
||||
HwpDoc/Chart/Axis.h \
|
||||
HwpDoc/Chart/Backdrop.h \
|
||||
HwpDoc/Chart/Bar.h \
|
||||
HwpDoc/Chart/Brush.h \
|
||||
HwpDoc/Chart/CategoryScale.h \
|
||||
HwpDoc/Chart/CharCommon.h \
|
||||
HwpDoc/Chart/ChartObject.h \
|
||||
HwpDoc/Chart/ChartReader.h \
|
||||
HwpDoc/Chart/ChartStream.h \
|
||||
HwpDoc/Chart/Contour.h \
|
||||
HwpDoc/Chart/ContourGradient.h \
|
||||
HwpDoc/Chart/Coor.h \
|
||||
HwpDoc/Chart/Coor3.h \
|
||||
HwpDoc/Chart/DataGrid.h \
|
||||
HwpDoc/Chart/DataPoint.h \
|
||||
HwpDoc/Chart/DateScale.h \
|
||||
HwpDoc/Chart/Doughnut.h \
|
||||
HwpDoc/Chart/Elevation.h \
|
||||
HwpDoc/Chart/Fill.h \
|
||||
HwpDoc/Chart/Footnote.h \
|
||||
HwpDoc/Chart/Frame.h \
|
||||
HwpDoc/Chart/Gradient.h \
|
||||
HwpDoc/Chart/HiLo.h \
|
||||
HwpDoc/Chart/Intersection.h \
|
||||
HwpDoc/Chart/LCoor.h \
|
||||
HwpDoc/Chart/LRect.h \
|
||||
HwpDoc/Chart/Label.h \
|
||||
HwpDoc/Chart/Legend.h \
|
||||
HwpDoc/Chart/Light.h \
|
||||
HwpDoc/Chart/Location.h \
|
||||
HwpDoc/Chart/Marker.h \
|
||||
HwpDoc/Chart/Pen.h \
|
||||
HwpDoc/Chart/Pie.h \
|
||||
HwpDoc/Chart/Plot.h \
|
||||
HwpDoc/Chart/Position.h \
|
||||
HwpDoc/Chart/PrintInformation.h \
|
||||
HwpDoc/Chart/Rect.h \
|
||||
HwpDoc/Chart/Series.h \
|
||||
HwpDoc/Chart/Shadow.h \
|
||||
HwpDoc/Chart/StatLine.h \
|
||||
HwpDoc/Chart/Surface.h \
|
||||
HwpDoc/Chart/TextLayout.h \
|
||||
HwpDoc/Chart/Tick.h \
|
||||
HwpDoc/Chart/Title.h \
|
||||
HwpDoc/Chart/Types.h \
|
||||
HwpDoc/Chart/ValueScale.h \
|
||||
HwpDoc/Chart/View3D.h \
|
||||
HwpDoc/Chart/VtChart.h \
|
||||
HwpDoc/Chart/VtColor.h \
|
||||
HwpDoc/Chart/VtFont.h \
|
||||
HwpDoc/Chart/VtPicture.h \
|
||||
HwpDoc/Chart/Wall.h \
|
||||
HwpDoc/Chart/Weighting.h \
|
||||
HwpDoc/Chart/XYZ.h \
|
||||
HwpDoc/Common/Common.h \
|
||||
HwpDoc/Common/NodeNames.h \
|
||||
HwpDoc/Common/WriterContext.h \
|
||||
|
||||
15
HwpFile/HwpDoc/Chart/Attribute.cpp
Normal file
15
HwpFile/HwpDoc/Chart/Attribute.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "Attribute.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CAttribute::CAttribute()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CAttribute::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oBrush.Read(oStream) && m_oPen.Read(oStream) &&
|
||||
oStream.ReadString(m_sText) && oStream.ReadDouble(m_dValue);
|
||||
}
|
||||
}}
|
||||
25
HwpFile/HwpDoc/Chart/Attribute.h
Normal file
25
HwpFile/HwpDoc/Chart/Attribute.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef ATTRIBUTE_H
|
||||
#define ATTRIBUTE_H
|
||||
|
||||
#include "Brush.h"
|
||||
#include "Pen.h"
|
||||
#include "Collection.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CAttribute : public IChartObject
|
||||
{
|
||||
CBrush m_oBrush;
|
||||
CPen m_oPen;
|
||||
CHART_STRING m_sText;
|
||||
CHART_DOUBLE m_dValue;
|
||||
public:
|
||||
CAttribute();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
|
||||
using CAttributes = CCollection<CAttribute>;
|
||||
}}
|
||||
|
||||
#endif // ATTRIBUTE_H
|
||||
51
HwpFile/HwpDoc/Chart/Axis.cpp
Normal file
51
HwpFile/HwpDoc/Chart/Axis.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include "Axis.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CAxisGrid::CAxisGrid()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CAxisGrid::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oMajorPen.Read(oStream) && m_oMinorPen.Read(oStream);
|
||||
}
|
||||
|
||||
CAxisScale::CAxisScale()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CAxisScale::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadBoolean(m_bHide) && oStream.ReadInteger(m_nLogBase) &&
|
||||
oStream.ReadString(m_sPercentBasis) && oStream.ReadInteger(m_nType);
|
||||
}
|
||||
|
||||
CAxisTitle::CAxisTitle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CAxisTitle::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oBackdrop.Read(oStream) && oStream.ReadString(m_sText) &&
|
||||
m_oTextLayout.Read(oStream) && oStream.ReadInteger(m_nTextLength) &&
|
||||
oStream.ReadBoolean(m_bVisible) && m_oVtFont.Read(oStream);
|
||||
}
|
||||
|
||||
CAxis::CAxis()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CAxis::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oAxisGrid.Read(oStream) && m_oAxisScale.Read(oStream) &&
|
||||
m_oAxisTitle.Read(oStream) && m_oCategoryScale.Read(oStream) &&
|
||||
m_oDateScale.Read(oStream) && m_oIntersection.Read(oStream) &&
|
||||
m_oLabels.Read(oStream) && oStream.ReadInteger(m_nLabelLevelCount) &&
|
||||
m_oPen.Read(oStream) && m_oTick.Read(oStream) && m_oValueScale.Read(oStream);
|
||||
}
|
||||
}}
|
||||
73
HwpFile/HwpDoc/Chart/Axis.h
Normal file
73
HwpFile/HwpDoc/Chart/Axis.h
Normal file
@ -0,0 +1,73 @@
|
||||
#ifndef AXIS_H
|
||||
#define AXIS_H
|
||||
|
||||
#include "Pen.h"
|
||||
#include "VtFont.h"
|
||||
#include "Backdrop.h"
|
||||
#include "TextLayout.h"
|
||||
#include "CategoryScale.h"
|
||||
#include "DateScale.h"
|
||||
#include "Intersection.h"
|
||||
#include "Label.h"
|
||||
#include "Tick.h"
|
||||
#include "ValueScale.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CAxisGrid : public IChartObject
|
||||
{
|
||||
CPen m_oMajorPen;
|
||||
CPen m_oMinorPen;
|
||||
public:
|
||||
CAxisGrid();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
|
||||
class CAxisScale : public IChartObject
|
||||
{
|
||||
CHART_BOOLEAN m_bHide;
|
||||
CHART_INTEGER m_nLogBase;
|
||||
CHART_STRING m_sPercentBasis;
|
||||
CHART_INTEGER m_nType;
|
||||
public:
|
||||
CAxisScale();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
|
||||
class CAxisTitle : public IChartObject
|
||||
{
|
||||
CBackdrop m_oBackdrop;
|
||||
CHART_STRING m_sText;
|
||||
CTextLayout m_oTextLayout;
|
||||
CHART_INTEGER m_nTextLength;
|
||||
CHART_BOOLEAN m_bVisible;
|
||||
CVtFont m_oVtFont;
|
||||
public:
|
||||
CAxisTitle();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
|
||||
class CAxis : public IChartObject
|
||||
{
|
||||
CAxisGrid m_oAxisGrid;
|
||||
CAxisScale m_oAxisScale;
|
||||
CAxisTitle m_oAxisTitle;
|
||||
CCategoryScale m_oCategoryScale;
|
||||
CDateScale m_oDateScale;
|
||||
CIntersection m_oIntersection;
|
||||
CLabels m_oLabels;
|
||||
CHART_INTEGER m_nLabelLevelCount;
|
||||
CPen m_oPen;
|
||||
CTick m_oTick;
|
||||
CValueScale m_oValueScale;
|
||||
public:
|
||||
CAxis();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // AXIS_H
|
||||
14
HwpFile/HwpDoc/Chart/Backdrop.cpp
Normal file
14
HwpFile/HwpDoc/Chart/Backdrop.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Backdrop.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CBackdrop::CBackdrop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CBackdrop::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oFrame.Read(oStream) && m_oFill.Read(oStream) && m_oShadow.Read(oStream);
|
||||
}
|
||||
}}
|
||||
22
HwpFile/HwpDoc/Chart/Backdrop.h
Normal file
22
HwpFile/HwpDoc/Chart/Backdrop.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef BACKDROP_H
|
||||
#define BACKDROP_H
|
||||
|
||||
#include "Frame.h"
|
||||
#include "Fill.h"
|
||||
#include "Shadow.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CBackdrop : public IChartObject
|
||||
{
|
||||
CFrame m_oFrame;
|
||||
CFill m_oFill;
|
||||
CShadow m_oShadow;
|
||||
public:
|
||||
CBackdrop();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // BACKDROP_H
|
||||
14
HwpFile/HwpDoc/Chart/Bar.cpp
Normal file
14
HwpFile/HwpDoc/Chart/Bar.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Bar.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CBar::CBar()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CBar::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadInteger(m_nSides) && oStream.ReadSingle(m_snTopRatio);
|
||||
}
|
||||
}}
|
||||
19
HwpFile/HwpDoc/Chart/Bar.h
Normal file
19
HwpFile/HwpDoc/Chart/Bar.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef BAR_H
|
||||
#define BAR_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CBar : public IChartObject
|
||||
{
|
||||
CHART_INTEGER m_nSides;
|
||||
CHART_SINGLE m_snTopRatio;
|
||||
public:
|
||||
CBar();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // BAR_H
|
||||
15
HwpFile/HwpDoc/Chart/Brush.cpp
Normal file
15
HwpFile/HwpDoc/Chart/Brush.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "Brush.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CBrush::CBrush()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CBrush::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oFillColor.Read(oStream) && oStream.ReadInteger(m_nIndex) &&
|
||||
m_oPatternColor.Read(oStream) && oStream.ReadInteger(m_nStyle);
|
||||
}
|
||||
}}
|
||||
21
HwpFile/HwpDoc/Chart/Brush.h
Normal file
21
HwpFile/HwpDoc/Chart/Brush.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef BRUSH_H
|
||||
#define BRUSH_H
|
||||
|
||||
#include "VtColor.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CBrush : public IChartObject
|
||||
{
|
||||
CVtColor m_oFillColor;
|
||||
CHART_INTEGER m_nIndex;
|
||||
CVtColor m_oPatternColor;
|
||||
CHART_INTEGER m_nStyle;
|
||||
public:
|
||||
CBrush();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // BRUSH_H
|
||||
15
HwpFile/HwpDoc/Chart/CategoryScale.cpp
Normal file
15
HwpFile/HwpDoc/Chart/CategoryScale.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "CategoryScale.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CCategoryScale::CCategoryScale()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CCategoryScale::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadBoolean(m_bAuto) && oStream.ReadInteger(m_nDivisionsPerLabel) &&
|
||||
oStream.ReadInteger(m_nDivisionsPerTick) && oStream.ReadBoolean(m_bLabelTick);
|
||||
}
|
||||
}}
|
||||
21
HwpFile/HwpDoc/Chart/CategoryScale.h
Normal file
21
HwpFile/HwpDoc/Chart/CategoryScale.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef CATEGORYSCALE_H
|
||||
#define CATEGORYSCALE_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CCategoryScale : public IChartObject
|
||||
{
|
||||
CHART_BOOLEAN m_bAuto;
|
||||
CHART_INTEGER m_nDivisionsPerLabel;
|
||||
CHART_INTEGER m_nDivisionsPerTick;
|
||||
CHART_BOOLEAN m_bLabelTick;
|
||||
public:
|
||||
CCategoryScale();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // CATEGORYSCALE_H
|
||||
17
HwpFile/HwpDoc/Chart/CharCommon.h
Normal file
17
HwpFile/HwpDoc/Chart/CharCommon.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef CHARCOMMON_H
|
||||
#define CHARCOMMON_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
typedef bool CHART_BOOLEAN;
|
||||
typedef int8_t CHART_INTEGER;
|
||||
typedef int CHART_LONG;
|
||||
typedef float CHART_SINGLE;
|
||||
typedef double CHART_DOUBLE;
|
||||
typedef std::wstring CHART_STRING;
|
||||
}}
|
||||
|
||||
#endif // CHARCOMMON_H
|
||||
21
HwpFile/HwpDoc/Chart/ChartObject.h
Normal file
21
HwpFile/HwpDoc/Chart/ChartObject.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef CHARTOBJECT_H
|
||||
#define CHARTOBJECT_H
|
||||
|
||||
#include "Types.h"
|
||||
#include "ChartStream.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class IChartObject
|
||||
{
|
||||
CHART_LONG m_lId;
|
||||
CHART_LONG m_lStoredtypeId;
|
||||
protected:
|
||||
IChartObject() = default;
|
||||
public:
|
||||
virtual bool Read(CChartStream& oStream) = 0;
|
||||
// virtual ETypes GetType() const = 0;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // CHARTOBJECT_H
|
||||
28
HwpFile/HwpDoc/Chart/ChartReader.cpp
Normal file
28
HwpFile/HwpDoc/Chart/ChartReader.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "ChartReader.h"
|
||||
|
||||
#include "VtChart.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CChartReader::CChartReader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CChartReader::ReadFromOle(CHWPStream& oOleData)
|
||||
{
|
||||
CChartStream oChartStream(&oOleData);
|
||||
|
||||
oChartStream.Skip(44); //Unknown data
|
||||
|
||||
CHART_STRING sStoredName;
|
||||
oChartStream.ReadString(sStoredName);
|
||||
|
||||
CVtChart oVtChart;
|
||||
|
||||
if (!oVtChart.Read(oChartStream))
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
}}
|
||||
17
HwpFile/HwpDoc/Chart/ChartReader.h
Normal file
17
HwpFile/HwpDoc/Chart/ChartReader.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef CHARTREADER_H
|
||||
#define CHARTREADER_H
|
||||
|
||||
#include "../HWPStream.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CChartReader
|
||||
{
|
||||
public:
|
||||
CChartReader();
|
||||
|
||||
bool ReadFromOle(CHWPStream& oOleData);
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // CHARTREADER_H
|
||||
74
HwpFile/HwpDoc/Chart/ChartStream.cpp
Normal file
74
HwpFile/HwpDoc/Chart/ChartStream.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
#include "ChartStream.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CChartStream::CChartStream()
|
||||
: m_pStream(nullptr), m_bExternStream(false)
|
||||
{}
|
||||
|
||||
CChartStream::CChartStream(CHWPStream* pStream, bool bExtern)
|
||||
: m_pStream(pStream), m_bExternStream(bExtern)
|
||||
{}
|
||||
|
||||
CChartStream::~CChartStream()
|
||||
{
|
||||
if (nullptr != m_pStream && !m_bExternStream)
|
||||
delete m_pStream;
|
||||
}
|
||||
|
||||
#define CHECK_VALID()\
|
||||
if (!Valid())\
|
||||
return false
|
||||
|
||||
bool CChartStream::ReadBoolean(CHART_BOOLEAN& bValue)
|
||||
{
|
||||
CHECK_VALID();
|
||||
return m_pStream->ReadBool(bValue);
|
||||
}
|
||||
|
||||
bool CChartStream::ReadInteger(CHART_INTEGER& nValue)
|
||||
{
|
||||
CHECK_VALID();
|
||||
return m_pStream->ReadByte((HWP_BYTE&)nValue);
|
||||
}
|
||||
|
||||
bool CChartStream::ReadLong(CHART_LONG& lValue)
|
||||
{
|
||||
CHECK_VALID();
|
||||
return m_pStream->ReadInt(lValue);
|
||||
}
|
||||
|
||||
bool CChartStream::ReadSingle(CHART_SINGLE& fValue)
|
||||
{
|
||||
CHECK_VALID();
|
||||
return m_pStream->ReadFloat(fValue);
|
||||
}
|
||||
|
||||
bool CChartStream::ReadDouble(CHART_DOUBLE& dValue)
|
||||
{
|
||||
CHECK_VALID();
|
||||
return m_pStream->ReadDouble(dValue);
|
||||
}
|
||||
|
||||
bool CChartStream::ReadString(HWP_STRING& sValue)
|
||||
{
|
||||
CHECK_VALID();
|
||||
|
||||
short shCount;
|
||||
if (!m_pStream->ReadShort(shCount))
|
||||
return false;
|
||||
|
||||
return m_pStream->ReadString(sValue, shCount, EStringCharacter::ASCII);
|
||||
}
|
||||
|
||||
void CChartStream::Skip(int nStep)
|
||||
{
|
||||
if (nullptr != m_pStream)
|
||||
m_pStream->Skip(nStep);
|
||||
}
|
||||
|
||||
bool CChartStream::Valid() const
|
||||
{
|
||||
return nullptr != m_pStream && m_pStream->IsValid();
|
||||
}
|
||||
}}
|
||||
31
HwpFile/HwpDoc/Chart/ChartStream.h
Normal file
31
HwpFile/HwpDoc/Chart/ChartStream.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef CHARTSTREAM_H
|
||||
#define CHARTSTREAM_H
|
||||
|
||||
#include "../HWPStream.h"
|
||||
#include "CharCommon.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CChartStream
|
||||
{
|
||||
CHWPStream *m_pStream;
|
||||
bool m_bExternStream;
|
||||
public:
|
||||
CChartStream();
|
||||
CChartStream(CHWPStream* pStream, bool bExtern = true);
|
||||
~CChartStream();
|
||||
|
||||
bool ReadBoolean(CHART_BOOLEAN& bValue);
|
||||
bool ReadInteger(CHART_INTEGER& nValue);
|
||||
bool ReadLong(CHART_LONG& lValue);
|
||||
bool ReadSingle(CHART_SINGLE& fValue);
|
||||
bool ReadDouble(CHART_DOUBLE& dValue);
|
||||
bool ReadString(HWP_STRING& sValue);
|
||||
|
||||
void Skip(int nStep);
|
||||
private:
|
||||
bool Valid() const;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // CHARTSTREAM_H
|
||||
7
HwpFile/HwpDoc/Chart/Collection.cpp
Normal file
7
HwpFile/HwpDoc/Chart/Collection.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "Collection.h"
|
||||
|
||||
|
||||
CCollection::CCollection()
|
||||
{
|
||||
|
||||
}
|
||||
54
HwpFile/HwpDoc/Chart/Collection.h
Normal file
54
HwpFile/HwpDoc/Chart/Collection.h
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef COLLECTION_H
|
||||
#define COLLECTION_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
template<typename T>
|
||||
class CCollection : public IChartObject
|
||||
{
|
||||
std::vector<const T*> m_arItems;
|
||||
public:
|
||||
CCollection() = default;
|
||||
~CCollection()
|
||||
{
|
||||
for (const T* pItem : m_arItems)
|
||||
delete pItem;
|
||||
}
|
||||
|
||||
bool AddItem(const T* pItem)
|
||||
{
|
||||
if(nullptr == pItem)
|
||||
return false;
|
||||
|
||||
m_arItems.push_back(pItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool Read(CChartStream& oStream) override
|
||||
{
|
||||
CHART_LONG lCount;
|
||||
|
||||
if (!oStream.ReadLong(lCount))
|
||||
return false;
|
||||
|
||||
for (long lIndex = 0; lIndex < lCount; ++lIndex)
|
||||
{
|
||||
T* pItem = new T();
|
||||
|
||||
if (nullptr == pItem)
|
||||
continue;
|
||||
|
||||
if (!pItem->Read(oStream) || !AddItem(pItem))
|
||||
{
|
||||
delete pItem;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}}
|
||||
#endif // COLLECTION_H
|
||||
14
HwpFile/HwpDoc/Chart/Contour.cpp
Normal file
14
HwpFile/HwpDoc/Chart/Contour.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Contour.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CContour::CContour()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CContour::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadInteger(m_nDisplayType);
|
||||
}
|
||||
}}
|
||||
18
HwpFile/HwpDoc/Chart/Contour.h
Normal file
18
HwpFile/HwpDoc/Chart/Contour.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef CONTOUR_H
|
||||
#define CONTOUR_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CContour : public IChartObject
|
||||
{
|
||||
CHART_INTEGER m_nDisplayType;
|
||||
public:
|
||||
CContour();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // CONTOUR_H
|
||||
15
HwpFile/HwpDoc/Chart/ContourGradient.cpp
Normal file
15
HwpFile/HwpDoc/Chart/ContourGradient.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "ContourGradient.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CContourGradient::CContourGradient()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CContourGradient::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oFromBrushColor.Read(oStream) && m_oToBrushColor.Read(oStream) &&
|
||||
m_oFromPenColor.Read(oStream) && m_oToPenColor.Read(oStream);
|
||||
}
|
||||
}}
|
||||
21
HwpFile/HwpDoc/Chart/ContourGradient.h
Normal file
21
HwpFile/HwpDoc/Chart/ContourGradient.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef CONTOURGRADIENT_H
|
||||
#define CONTOURGRADIENT_H
|
||||
|
||||
#include "VtColor.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CContourGradient : public IChartObject
|
||||
{
|
||||
CVtColor m_oFromBrushColor;
|
||||
CVtColor m_oToBrushColor;
|
||||
CVtColor m_oFromPenColor;
|
||||
CVtColor m_oToPenColor;
|
||||
public:
|
||||
CContourGradient();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // CONTOURGRADIENT_H
|
||||
14
HwpFile/HwpDoc/Chart/Coor.cpp
Normal file
14
HwpFile/HwpDoc/Chart/Coor.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Coor.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CCoor::CCoor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CCoor::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadSingle(m_snX) && oStream.ReadSingle(m_snY);
|
||||
}
|
||||
}}
|
||||
19
HwpFile/HwpDoc/Chart/Coor.h
Normal file
19
HwpFile/HwpDoc/Chart/Coor.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef COOR_H
|
||||
#define COOR_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CCoor : public IChartObject
|
||||
{
|
||||
CHART_SINGLE m_snX;
|
||||
CHART_SINGLE m_snY;
|
||||
public:
|
||||
CCoor();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // COOR_H
|
||||
14
HwpFile/HwpDoc/Chart/Coor3.cpp
Normal file
14
HwpFile/HwpDoc/Chart/Coor3.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Coor3.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CCoor3::CCoor3()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CCoor3::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadSingle(m_snX) && oStream.ReadSingle(m_snY) && oStream.ReadSingle(m_snZ);
|
||||
}
|
||||
}}
|
||||
20
HwpFile/HwpDoc/Chart/Coor3.h
Normal file
20
HwpFile/HwpDoc/Chart/Coor3.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef COOR3_H
|
||||
#define COOR3_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CCoor3 : public IChartObject
|
||||
{
|
||||
CHART_SINGLE m_snX;
|
||||
CHART_SINGLE m_snY;
|
||||
CHART_SINGLE m_snZ;
|
||||
public:
|
||||
CCoor3();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // COOR3_H
|
||||
17
HwpFile/HwpDoc/Chart/DataGrid.cpp
Normal file
17
HwpFile/HwpDoc/Chart/DataGrid.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "DataGrid.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CDataGrid::CDataGrid()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CDataGrid::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadInteger(m_nColumnCount) && oStream.ReadString(m_sColumnLabel) &&
|
||||
oStream.ReadInteger(m_nColumnLabelCount) && oStream.ReadInteger(m_nCompositeColumnLabel) &&
|
||||
oStream.ReadString(m_sCompositeRowLabel) && oStream.ReadInteger(m_nRowCount) &&
|
||||
oStream.ReadString(m_sRowLabel) && oStream.ReadInteger(m_nRowLabelCount);
|
||||
}
|
||||
}}
|
||||
25
HwpFile/HwpDoc/Chart/DataGrid.h
Normal file
25
HwpFile/HwpDoc/Chart/DataGrid.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef DATAGRID_H
|
||||
#define DATAGRID_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CDataGrid : public IChartObject
|
||||
{
|
||||
CHART_INTEGER m_nColumnCount;
|
||||
CHART_STRING m_sColumnLabel;
|
||||
CHART_INTEGER m_nColumnLabelCount;
|
||||
CHART_INTEGER m_nCompositeColumnLabel;
|
||||
CHART_STRING m_sCompositeRowLabel;
|
||||
CHART_INTEGER m_nRowCount;
|
||||
CHART_STRING m_sRowLabel;
|
||||
CHART_INTEGER m_nRowLabelCount;
|
||||
public:
|
||||
CDataGrid();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // DATAGRID_H
|
||||
31
HwpFile/HwpDoc/Chart/DataPoint.cpp
Normal file
31
HwpFile/HwpDoc/Chart/DataPoint.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include "DataPoint.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CDataPointLabel::CDataPointLabel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CDataPointLabel::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oBackdrop.Read(oStream) && oStream.ReadInteger(m_nComponent) &&
|
||||
oStream.ReadBoolean(m_bCustom) && oStream.ReadInteger(m_nLineStyle) &&
|
||||
oStream.ReadInteger(m_nLocationType) && m_oOffset.Read(oStream) &&
|
||||
oStream.ReadString(m_sPercentFormat) && oStream.ReadString(m_sText) &&
|
||||
m_oTextLayout.Read(oStream) && oStream.ReadInteger(m_nTextLength) &&
|
||||
oStream.ReadString(m_sValueFormat) && m_oVtFont.Read(oStream);
|
||||
}
|
||||
|
||||
CDataPoint::CDataPoint()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CDataPoint::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oBrush.Read(oStream) && m_oDataPointLabel.Read(oStream) &&
|
||||
m_oEdgePen.Read(oStream) && oStream.ReadSingle(m_snOffset) &&
|
||||
m_oMarker.Read(oStream) && m_oVtPicture.Read(oStream);
|
||||
}
|
||||
}}
|
||||
53
HwpFile/HwpDoc/Chart/DataPoint.h
Normal file
53
HwpFile/HwpDoc/Chart/DataPoint.h
Normal file
@ -0,0 +1,53 @@
|
||||
#ifndef DATAPOINT_H
|
||||
#define DATAPOINT_H
|
||||
|
||||
#include "Backdrop.h"
|
||||
#include "Coor.h"
|
||||
#include "TextLayout.h"
|
||||
#include "VtFont.h"
|
||||
#include "Pen.h"
|
||||
#include "Marker.h"
|
||||
#include "Brush.h"
|
||||
#include "VtPicture.h"
|
||||
#include "Collection.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CDataPointLabel : public IChartObject
|
||||
{
|
||||
CBackdrop m_oBackdrop;
|
||||
CHART_INTEGER m_nComponent;
|
||||
CHART_BOOLEAN m_bCustom;
|
||||
CHART_INTEGER m_nLineStyle;
|
||||
CHART_INTEGER m_nLocationType;
|
||||
CCoor m_oOffset;
|
||||
CHART_STRING m_sPercentFormat;
|
||||
CHART_STRING m_sText;
|
||||
CTextLayout m_oTextLayout;
|
||||
CHART_INTEGER m_nTextLength;
|
||||
CHART_STRING m_sValueFormat;
|
||||
CVtFont m_oVtFont;
|
||||
public:
|
||||
CDataPointLabel();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
|
||||
class CDataPoint : public IChartObject
|
||||
{
|
||||
CBrush m_oBrush;
|
||||
CDataPointLabel m_oDataPointLabel;
|
||||
CPen m_oEdgePen;
|
||||
CHART_SINGLE m_snOffset;
|
||||
CMarker m_oMarker;
|
||||
CVtPicture m_oVtPicture;
|
||||
public:
|
||||
CDataPoint();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
|
||||
using CDataPoints = CCollection<CDataPoint>;
|
||||
}}
|
||||
|
||||
#endif // DATAPOINT_H
|
||||
17
HwpFile/HwpDoc/Chart/DateScale.cpp
Normal file
17
HwpFile/HwpDoc/Chart/DateScale.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "DateScale.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CDateScale::CDateScale()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CDateScale::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadBoolean(m_bAuto) && oStream.ReadInteger(m_nMajFreq) &&
|
||||
oStream.ReadInteger(m_nMajInt) && oStream.ReadDouble(m_dMaximum) &&
|
||||
oStream.ReadDouble(m_dMinimum) && oStream.ReadInteger(m_nMinFreq) &&
|
||||
oStream.ReadInteger(m_nMinInt) && oStream.ReadBoolean(m_bSkipWeekend);
|
||||
}
|
||||
}}
|
||||
25
HwpFile/HwpDoc/Chart/DateScale.h
Normal file
25
HwpFile/HwpDoc/Chart/DateScale.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef DATESCALE_H
|
||||
#define DATESCALE_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CDateScale : public IChartObject
|
||||
{
|
||||
CHART_BOOLEAN m_bAuto;
|
||||
CHART_INTEGER m_nMajFreq;
|
||||
CHART_INTEGER m_nMajInt;
|
||||
CHART_DOUBLE m_dMaximum;
|
||||
CHART_DOUBLE m_dMinimum;
|
||||
CHART_INTEGER m_nMinFreq;
|
||||
CHART_INTEGER m_nMinInt;
|
||||
CHART_BOOLEAN m_bSkipWeekend;
|
||||
public:
|
||||
CDateScale();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // DATESCALE_H
|
||||
14
HwpFile/HwpDoc/Chart/Doughnut.cpp
Normal file
14
HwpFile/HwpDoc/Chart/Doughnut.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "Doughnut.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CDoughnut::CDoughnut()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CDoughnut::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadInteger(m_nSides) && oStream.ReadSingle(m_snInteriorRatio);
|
||||
}
|
||||
}}
|
||||
19
HwpFile/HwpDoc/Chart/Doughnut.h
Normal file
19
HwpFile/HwpDoc/Chart/Doughnut.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef DOUGHNUT_H
|
||||
#define DOUGHNUT_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CDoughnut : public IChartObject
|
||||
{
|
||||
CHART_INTEGER m_nSides;
|
||||
CHART_SINGLE m_snInteriorRatio;
|
||||
public:
|
||||
CDoughnut();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // DOUGHNUT_H
|
||||
18
HwpFile/HwpDoc/Chart/Elevation.cpp
Normal file
18
HwpFile/HwpDoc/Chart/Elevation.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "Elevation.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CElevation::CElevation()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CElevation::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oAttributes.Read(oStream) && oStream.ReadBoolean(m_bAutoValues) &&
|
||||
oStream.ReadInteger(m_nColorType) && oStream.ReadInteger(m_nColSmoothing) &&
|
||||
m_oContour.Read(oStream) && m_oContourGradient.Read(oStream) &&
|
||||
oStream.ReadInteger(m_nRowSmoothing) && oStream.ReadBoolean(m_bSeparateContourData) &&
|
||||
m_oSurface.Read(oStream);
|
||||
}
|
||||
}}
|
||||
29
HwpFile/HwpDoc/Chart/Elevation.h
Normal file
29
HwpFile/HwpDoc/Chart/Elevation.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef ELEVATION_H
|
||||
#define ELEVATION_H
|
||||
|
||||
#include "Attribute.h"
|
||||
#include "Contour.h"
|
||||
#include "ContourGradient.h"
|
||||
#include "Surface.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CElevation : public IChartObject
|
||||
{
|
||||
CAttributes m_oAttributes;
|
||||
CHART_BOOLEAN m_bAutoValues;
|
||||
CHART_INTEGER m_nColorType;
|
||||
CHART_INTEGER m_nColSmoothing;
|
||||
CContour m_oContour;
|
||||
CContourGradient m_oContourGradient;
|
||||
CHART_INTEGER m_nRowSmoothing;
|
||||
CHART_BOOLEAN m_bSeparateContourData;
|
||||
CSurface m_oSurface;
|
||||
public:
|
||||
CElevation();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // ELEVATION_H
|
||||
15
HwpFile/HwpDoc/Chart/Fill.cpp
Normal file
15
HwpFile/HwpDoc/Chart/Fill.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "Fill.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CFill::CFill()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CFill::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oBrush.Read(oStream) && /*&&*/
|
||||
oStream.ReadInteger(m_nStyle) && m_oVtPicture.Read(oStream);
|
||||
}
|
||||
}}
|
||||
27
HwpFile/HwpDoc/Chart/Fill.h
Normal file
27
HwpFile/HwpDoc/Chart/Fill.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef FILL_H
|
||||
#define FILL_H
|
||||
|
||||
#include "Brush.h"
|
||||
#include "Gradient.h"
|
||||
#include "VtPicture.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CFill : public IChartObject
|
||||
{
|
||||
CBrush m_oBrush;
|
||||
// union
|
||||
// {
|
||||
// CGradient m_oGradient;
|
||||
// CVtPicture m_oPicture;
|
||||
// } m_oGradient;
|
||||
CHART_INTEGER m_nStyle;
|
||||
CVtPicture m_oVtPicture;
|
||||
public:
|
||||
CFill();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // FILL_H
|
||||
16
HwpFile/HwpDoc/Chart/Footnote.cpp
Normal file
16
HwpFile/HwpDoc/Chart/Footnote.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "Footnote.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CFootnote::CFootnote()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CFootnote::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oBackdrop.Read(oStream) && m_oLocation.Read(oStream) &&
|
||||
oStream.ReadString(m_sText) && m_oTextLayout.Read(oStream) &&
|
||||
oStream.ReadInteger(m_nTextLength) && m_oVtFont.Read(oStream);
|
||||
}
|
||||
}}
|
||||
26
HwpFile/HwpDoc/Chart/Footnote.h
Normal file
26
HwpFile/HwpDoc/Chart/Footnote.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef FOOTNOTE_H
|
||||
#define FOOTNOTE_H
|
||||
|
||||
#include "Backdrop.h"
|
||||
#include "Location.h"
|
||||
#include "TextLayout.h"
|
||||
#include "VtFont.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CFootnote : public IChartObject
|
||||
{
|
||||
CBackdrop m_oBackdrop;
|
||||
CLocation m_oLocation;
|
||||
CHART_STRING m_sText;
|
||||
CTextLayout m_oTextLayout;
|
||||
CHART_INTEGER m_nTextLength;
|
||||
CVtFont m_oVtFont;
|
||||
public:
|
||||
CFootnote();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // FOOTNOTE_H
|
||||
15
HwpFile/HwpDoc/Chart/Frame.cpp
Normal file
15
HwpFile/HwpDoc/Chart/Frame.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "Frame.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CFrame::CFrame()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CFrame::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadInteger(m_nStyle) && oStream.ReadSingle(m_snWidth) &&
|
||||
m_oFrameColor.Read(oStream) && m_oSpaceColor.Read(oStream);
|
||||
}
|
||||
}}
|
||||
21
HwpFile/HwpDoc/Chart/Frame.h
Normal file
21
HwpFile/HwpDoc/Chart/Frame.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef FRAME_H
|
||||
#define FRAME_H
|
||||
|
||||
#include "VtColor.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CFrame : public IChartObject
|
||||
{
|
||||
CHART_INTEGER m_nStyle;
|
||||
CHART_SINGLE m_snWidth;
|
||||
CVtColor m_oFrameColor;
|
||||
CVtColor m_oSpaceColor;
|
||||
public:
|
||||
CFrame();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // FRAME_H
|
||||
15
HwpFile/HwpDoc/Chart/Gradient.cpp
Normal file
15
HwpFile/HwpDoc/Chart/Gradient.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "Gradient.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CGradient::CGradient()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CGradient::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oFromColor.Read(oStream) && oStream.ReadInteger(m_nStyle) &&
|
||||
m_oToColor.Read(oStream);
|
||||
}
|
||||
}}
|
||||
20
HwpFile/HwpDoc/Chart/Gradient.h
Normal file
20
HwpFile/HwpDoc/Chart/Gradient.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef GRADIENT_H
|
||||
#define GRADIENT_H
|
||||
|
||||
#include "VtColor.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CGradient : public IChartObject
|
||||
{
|
||||
CVtColor m_oFromColor;
|
||||
CHART_INTEGER m_nStyle;
|
||||
CVtColor m_oToColor;
|
||||
public:
|
||||
CGradient();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // GRADIENT_H
|
||||
14
HwpFile/HwpDoc/Chart/HiLo.cpp
Normal file
14
HwpFile/HwpDoc/Chart/HiLo.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "HiLo.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CHiLo::CHiLo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CHiLo::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oGainColor.Read(oStream) && m_oLossColor.Read(oStream);
|
||||
}
|
||||
}}
|
||||
19
HwpFile/HwpDoc/Chart/HiLo.h
Normal file
19
HwpFile/HwpDoc/Chart/HiLo.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef HILO_H
|
||||
#define HILO_H
|
||||
|
||||
#include "VtColor.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CHiLo : public IChartObject
|
||||
{
|
||||
CVtColor m_oGainColor;
|
||||
CVtColor m_oLossColor;
|
||||
public:
|
||||
CHiLo();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // HILO_H
|
||||
16
HwpFile/HwpDoc/Chart/Intersection.cpp
Normal file
16
HwpFile/HwpDoc/Chart/Intersection.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "Intersection.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CIntersection::CIntersection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CIntersection::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadBoolean(m_bAuto) && oStream.ReadInteger(m_nAxisId) &&
|
||||
oStream.ReadInteger(m_nIndex) && oStream.ReadBoolean(m_bLabelsInsidePlot) &&
|
||||
oStream.ReadDouble(m_dPoint);
|
||||
}
|
||||
}}
|
||||
22
HwpFile/HwpDoc/Chart/Intersection.h
Normal file
22
HwpFile/HwpDoc/Chart/Intersection.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef INTERSECTION_H
|
||||
#define INTERSECTION_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CIntersection : public IChartObject
|
||||
{
|
||||
CHART_BOOLEAN m_bAuto;
|
||||
CHART_INTEGER m_nAxisId;
|
||||
CHART_INTEGER m_nIndex;
|
||||
CHART_BOOLEAN m_bLabelsInsidePlot;
|
||||
CHART_DOUBLE m_dPoint;
|
||||
public:
|
||||
CIntersection();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // INTERSECTION_H
|
||||
14
HwpFile/HwpDoc/Chart/LCoor.cpp
Normal file
14
HwpFile/HwpDoc/Chart/LCoor.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "LCoor.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CLCoor::CLCoor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CLCoor::Read(CChartStream& oStream)
|
||||
{
|
||||
return oStream.ReadLong(m_lX) && oStream.ReadLong(m_lY);
|
||||
}
|
||||
}}
|
||||
19
HwpFile/HwpDoc/Chart/LCoor.h
Normal file
19
HwpFile/HwpDoc/Chart/LCoor.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef LCOOR_H
|
||||
#define LCOOR_H
|
||||
|
||||
#include "ChartObject.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
class CLCoor : public IChartObject
|
||||
{
|
||||
CHART_LONG m_lX;
|
||||
CHART_LONG m_lY;
|
||||
public:
|
||||
CLCoor();
|
||||
|
||||
bool Read(CChartStream& oStream) override;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif // LCOOR_H
|
||||
14
HwpFile/HwpDoc/Chart/LRect.cpp
Normal file
14
HwpFile/HwpDoc/Chart/LRect.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "LRect.h"
|
||||
|
||||
namespace HWP { namespace CHART
|
||||
{
|
||||
CLRect::CLRect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CLRect::Read(CChartStream& oStream)
|
||||
{
|
||||
return m_oMax.Read(oStream) && m_oMin.Read(oStream);
|
||||
}
|
||||
}}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user