mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-06-26 10:36:26 +08:00
Compare commits
276 Commits
v9.4.0.120
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| acdc1e3962 | |||
| 156b912945 | |||
| 38d3a703a2 | |||
| 24bc36e66d | |||
| 049af6d91b | |||
| 47ccef0855 | |||
| c45aa7a68d | |||
| 6b04a4ebd1 | |||
| 721431c676 | |||
| 83088fcef2 | |||
| 2de90e32c3 | |||
| cb3daf1b6a | |||
| 29bb590151 | |||
| 7fe4efbb54 | |||
| f7e17d0080 | |||
| ea7f362d99 | |||
| de49ae5f32 | |||
| b607249544 | |||
| bd62388d81 | |||
| c0cad5429e | |||
| e353ff1b96 | |||
| 5f6075ca33 | |||
| 40bd21caac | |||
| f1ab3e4bf7 | |||
| 55e5f973b0 | |||
| 78ed5b3d74 | |||
| ba0e0f7449 | |||
| ba992cc401 | |||
| fba14fcf7b | |||
| aa43506bf9 | |||
| 544b0c54bc | |||
| a2c24b8dc0 | |||
| 073f100fe0 | |||
| e30a6acc87 | |||
| a016fc2868 | |||
| b77b3dc7e2 | |||
| c0a9c1a1dc | |||
| 4a15aaab0d | |||
| a982ff0ce2 | |||
| 30f21fc3c7 | |||
| b2c2a0ec6c | |||
| 77ef943473 | |||
| 5d862891ca | |||
| be921d6be7 | |||
| 6a7aedaeb2 | |||
| 67733c1733 | |||
| 812c59beaa | |||
| 97900e0c6e | |||
| ac06652662 | |||
| c5b798b8a9 | |||
| 175028396e | |||
| 35ba9d7445 | |||
| 67d31207e5 | |||
| 75e095abb9 | |||
| 6a6c85b6bd | |||
| d8133b7cb2 | |||
| 0e40482b9f | |||
| 742dfb54b8 | |||
| 52b21fbaed | |||
| aef42511ad | |||
| 692eb8c878 | |||
| 11c9900a5e | |||
| 7f16ac66f0 | |||
| a94d46ee06 | |||
| 2dd929dc95 | |||
| 1cfce0fe84 | |||
| 1fc363c189 | |||
| 3a0c438b9c | |||
| a5f4e04550 | |||
| e0141264a7 | |||
| f2bf914e72 | |||
| 62a25fa847 | |||
| bc9e8637ef | |||
| 7ac9645010 | |||
| 4250382f87 | |||
| 4eca22efde | |||
| f531e480ff | |||
| 9db2d2f328 | |||
| a868451b5d | |||
| cb217be2a2 | |||
| 6ccf19e036 | |||
| 2582927c72 | |||
| 3fe3382c1e | |||
| b139dec538 | |||
| 0b12c5b521 | |||
| 4c0c47a3cf | |||
| 234f867837 | |||
| 6366306f9c | |||
| 75f97349ca | |||
| 9ef4de7010 | |||
| 5bf72dcfb6 | |||
| f6decd4754 | |||
| f4a0f3f01a | |||
| 50816132e9 | |||
| 8e596451a9 | |||
| 8364bc02a6 | |||
| 815b6623a3 | |||
| 051f1d2c94 | |||
| c2000257aa | |||
| c5b2f3d1f2 | |||
| 72f7aaa6c2 | |||
| 13b19cc13f | |||
| 9720bd18a4 | |||
| a46e0d0a67 | |||
| 9ddd969b01 | |||
| 828eee5ed5 | |||
| a95d8712d3 | |||
| 3f76fca0f7 | |||
| 1c9ce65ba9 | |||
| 09b1d56a9a | |||
| bc59e34153 | |||
| 9679c6e7f8 | |||
| 2ffc0a7844 | |||
| c7e7fd4aa1 | |||
| 1846056b74 | |||
| 378841d655 | |||
| facd131d7b | |||
| f39716a5da | |||
| d1fada2542 | |||
| 16929b3a54 | |||
| a2f52951b2 | |||
| f3d34b1363 | |||
| 07e563afe8 | |||
| 75b3665ad5 | |||
| bdbad87830 | |||
| 290e4a0884 | |||
| 0242c5885b | |||
| 1c13c80197 | |||
| ddd991601c | |||
| 8d2331b097 | |||
| 57c26eb998 | |||
| 2c35b5f422 | |||
| 61fca43920 | |||
| 2cceef7386 | |||
| ab76f46fd4 | |||
| 2dd2f3bcc6 | |||
| 5f005b4501 | |||
| 0830ed031e | |||
| e63d62bb04 | |||
| 90029fb2f3 | |||
| 37f8c52e43 | |||
| d4e1b31e10 | |||
| 1580494bdb | |||
| f4fc487ce3 | |||
| a5bfa94770 | |||
| 85a615cc9a | |||
| 91701ed58d | |||
| 279349323f | |||
| 1dae175272 | |||
| 7c6f9f2ad6 | |||
| efc9bab6ed | |||
| 73b32984e2 | |||
| f269db67bb | |||
| 685b2bb9e0 | |||
| 55fe2e968f | |||
| d90c3aa3ac | |||
| e3e247e835 | |||
| 87c3f9beff | |||
| 9b196ada1f | |||
| cd58508d0f | |||
| d41aef7ec6 | |||
| bdc22190bd | |||
| 9989510d60 | |||
| 2f1a76fba6 | |||
| 0693bdc115 | |||
| ffb528636f | |||
| abc4619924 | |||
| fe36b3e1e6 | |||
| e72a4f8e8c | |||
| 0b2babbefc | |||
| 32da1a4901 | |||
| 15f423dbb9 | |||
| b5c29e49e2 | |||
| 9a4f929510 | |||
| 206ee9c976 | |||
| 7a8669d7f8 | |||
| ea28ff69a9 | |||
| 88626378a7 | |||
| 261cf72685 | |||
| 219bf06855 | |||
| 23e736051f | |||
| 8870516a8a | |||
| dbe56878b1 | |||
| 1f9ee8628e | |||
| 84aa409b1e | |||
| 6df60b9b4e | |||
| 52096d1b0b | |||
| 8fa5f8944e | |||
| 27dc6403d7 | |||
| ecaef0fbed | |||
| 2addc5a3d8 | |||
| 4e1afe5c55 | |||
| 9ae5855ed0 | |||
| 8d4e216852 | |||
| 866bf08da3 | |||
| 9e1bb2cd22 | |||
| bb97d00ae7 | |||
| 66eaed4f18 | |||
| 4739b9f9dd | |||
| e8f1691348 | |||
| 0b42267c43 | |||
| 6f1bfc3064 | |||
| f57f573ac4 | |||
| 0579b93796 | |||
| 2074785963 | |||
| ed697edba2 | |||
| 686c72a1c8 | |||
| 41124d3301 | |||
| 95d6c6c927 | |||
| 9ae76b07a1 | |||
| 0d7e535114 | |||
| e0af1357e5 | |||
| d4f80ea036 | |||
| 8e90fbac69 | |||
| 322fda0e07 | |||
| b0d70ff38a | |||
| 2a409336a3 | |||
| 4cdc416e0b | |||
| 7046f1d465 | |||
| 61f25af847 | |||
| 9304d10674 | |||
| 278dffc7c7 | |||
| bd7aa2df96 | |||
| 3d4dc3116e | |||
| f2fdcf4efd | |||
| ae7dbf291f | |||
| e83dbf57af | |||
| 3aa729d65b | |||
| 3bb03cb735 | |||
| cb0176ecca | |||
| b75afead99 | |||
| 290a134cdb | |||
| 6d9a2e0d09 | |||
| 32c4964cca | |||
| c2dd7b5108 | |||
| c057c8eb24 | |||
| 11000aa465 | |||
| 6630a882ed | |||
| e20143fa2e | |||
| e40603df61 | |||
| 6d0db29975 | |||
| a43af51577 | |||
| cf0f2be204 | |||
| 44e3e77631 | |||
| e4df8df318 | |||
| eca98f612c | |||
| e429ff685f | |||
| 03334267c9 | |||
| 417c3a55ec | |||
| 90eb06ac20 | |||
| 031c1c91e6 | |||
| 8a8e17562b | |||
| 9f36c04d33 | |||
| 7dffc8245a | |||
| 869774bcc1 | |||
| 27103958fe | |||
| 95c9c95a2e | |||
| 1753007900 | |||
| f43230dcaf | |||
| bb7d2ce8ee | |||
| ed8a47cbb7 | |||
| 3b2721e2da | |||
| 19c66750a8 | |||
| 4b61f6e62a | |||
| 72b57be353 | |||
| ef295fc115 | |||
| a62528e90e | |||
| 644ec4e651 | |||
| 6ca34d9c69 | |||
| 473f6aef1e | |||
| 85027065e6 | |||
| f66c646c2c | |||
| a40e246d7d | |||
| 66d36b64b0 | |||
| 954f3c91bb | |||
| 18d36179bd |
@ -525,6 +525,7 @@ namespace NSCSS
|
||||
m_mDefaultStyleData[L"ul"] = new CElement(L"ul", {{L"margin-top", L"100tw"},
|
||||
{L"margin-bottom", L"100tw"}});
|
||||
m_mDefaultStyleData[L"textarea"] = new CElement(L"textarea", {{L"border", L"1px solid black"}});
|
||||
m_mDefaultStyleData[L"th"] = new CElement(L"b", {{L"font-weight", L"bold"}});
|
||||
}
|
||||
|
||||
CCssCalculator_Private::CCssCalculator_Private()
|
||||
|
||||
@ -118,6 +118,11 @@ namespace NSCSS
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool LessSignificantThen(const CValueBase& oValue) const
|
||||
{
|
||||
return oValue.m_unLevel >= m_unLevel && (!m_bImportant || oValue.m_bImportant) && !oValue.Empty();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
#include "CDocumentStyle.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_set>
|
||||
#include <wchar.h>
|
||||
#include <math.h>
|
||||
|
||||
@ -109,7 +109,7 @@ namespace NSNetwork
|
||||
{
|
||||
CURL *curl;
|
||||
int fp;
|
||||
CURLcode res;
|
||||
CURLcode res = CURLE_FAILED_INIT;
|
||||
std::string sUrl = U_TO_UTF8(m_sDownloadFileUrl);
|
||||
std::string sOut;
|
||||
const char *url = sUrl.c_str();
|
||||
|
||||
@ -178,6 +178,33 @@ namespace NSNetwork
|
||||
NSString* stringURL = StringWToNSString(m_sDownloadFileUrl);
|
||||
NSURL* url = SafeURLFromString(stringURL);
|
||||
|
||||
// NSURLSession does not support file:// URLs reliably on macOS/iOS
|
||||
// NSFileManager to copy the file directly instead.
|
||||
if (url && [[url scheme] isEqualToString:@"file"])
|
||||
{
|
||||
NSString* dstPath = StringWToNSString(m_sDownloadFilePath);
|
||||
NSFileManager* fm = [NSFileManager defaultManager];
|
||||
// copyItemAtURL:toURL: fails if destination exists — remove it first
|
||||
// to match the overwrite semantics of writeToFile:atomically:YES
|
||||
[fm removeItemAtPath:dstPath error:nil];
|
||||
NSError* err = nil;
|
||||
BOOL ok = [fm copyItemAtURL:url
|
||||
toURL:[NSURL fileURLWithPath:dstPath]
|
||||
error:&err];
|
||||
if (!ok)
|
||||
NSLog(@"[DownloadFile] file:// copy failed: %@", err);
|
||||
#if !defined(_IOS)
|
||||
#ifndef _ASC_USE_ARC_
|
||||
if (!GetARCEnabled())
|
||||
{
|
||||
[dstPath release];
|
||||
[stringURL release];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
|
||||
if (!url)
|
||||
{
|
||||
NSLog(@"[DownloadFile] Invalid URL: %@", stringURL);
|
||||
|
||||
2
Common/js/.gitignore
vendored
2
Common/js/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
emsdk
|
||||
__pycache__
|
||||
@ -1,19 +0,0 @@
|
||||
### JSON file structure for wasm/asm module
|
||||
- `name` — name with which the module will be built
|
||||
- `res_folder` — path, relative to the .json file, to the folder where the module will be built
|
||||
- `wasm` — whether to build wasm module (*.js and *.wasm)
|
||||
- `asm` — whether to build asm module (*_ie.js and *.js.mem)
|
||||
- `run_before` — path, relative to the .json file, to .py file that needs to be executed before building the module. Or python in-line code.
|
||||
- `run_after` — path, relative to the .json file, to .py file that needs to be executed after building the module. Or python in-line code.
|
||||
- `base_js_content` — path, relative to the .json file, to .js file containing //module which will be replaced with the built module
|
||||
- `compiler_flags` — array of compilation flags and options
|
||||
- `exported_functions` — array of function names that will be called from the module
|
||||
- `include_path` — array of paths, relative to the .json file, for include directories
|
||||
- `define` — array of defines
|
||||
- `compile_files_array` — array of objects containing:
|
||||
- `name` — unique name, relative to other names in compile_files_array array
|
||||
- `folder` — path, relative to the .json file, to folder with included files
|
||||
- `files` — array of included file names, located in folder (hierarchy ../ and ./*/ allowed)
|
||||
- `include_path` — optional array of paths, relative to the .json file, for include directories
|
||||
- `define` — optional array of defines
|
||||
- `sources` — optional array of paths, relative to the .json file, to files that don't require precompilation. For example, .a or .o files.
|
||||
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
sys.path.append("./../../../build_tools/scripts")
|
||||
import base
|
||||
import os
|
||||
|
||||
def apply_patch(file, patch):
|
||||
patch_content = base.readFile(patch)
|
||||
index1 = patch_content.find("<<<<<<<")
|
||||
index2 = patch_content.find("=======")
|
||||
index3 = patch_content.find(">>>>>>>")
|
||||
file_content_old = patch_content[index1 + 7:index2].strip()
|
||||
file_content_new = patch_content[index2 + 7:index3].strip()
|
||||
#file_content_new = "\n#if 0" + file_content_old + "#else" + file_content_new + "#endif\n"
|
||||
base.replaceInFile(file, file_content_old, file_content_new)
|
||||
return
|
||||
|
||||
def clear_dir(dir):
|
||||
if base.is_dir(dir):
|
||||
base.delete_dir(dir)
|
||||
base.create_dir(dir)
|
||||
return
|
||||
@ -1,49 +0,0 @@
|
||||
// correct fetch for desktop application
|
||||
|
||||
var printErr = undefined;
|
||||
var print = undefined;
|
||||
|
||||
var fetch = ("undefined" !== typeof window) ? window.fetch : (("undefined" !== typeof self) ? self.fetch : null);
|
||||
var getBinaryPromise = null;
|
||||
|
||||
function internal_isLocal()
|
||||
{
|
||||
if (window.navigator && window.navigator.userAgent.toLowerCase().indexOf("ascdesktopeditor") < 0)
|
||||
return false;
|
||||
if (window.location && window.location.protocol == "file:")
|
||||
return true;
|
||||
if (window.document && window.document.currentScript && 0 == window.document.currentScript.src.indexOf("file:///"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (internal_isLocal())
|
||||
{
|
||||
fetch = undefined; // fetch not support file:/// scheme
|
||||
getBinaryPromise = function()
|
||||
{
|
||||
var wasmPath = "ascdesktop://fonts/" + wasmBinaryFile.substr(8);
|
||||
return new Promise(function (resolve, reject)
|
||||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', wasmPath, true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
|
||||
if (xhr.overrideMimeType)
|
||||
xhr.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
else
|
||||
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
|
||||
|
||||
xhr.onload = function ()
|
||||
{
|
||||
if (this.status == 200)
|
||||
resolve(new Uint8Array(this.response));
|
||||
};
|
||||
xhr.send(null);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getBinaryPromise = function() { return getBinaryPromise2.apply(undefined, arguments); }
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
#ifndef _LOG_FILE_H
|
||||
#define _LOG_FILE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#define LOG_BUFFER_SIZE 1000
|
||||
|
||||
// not intended for use in production. only for testing/debugging purposes
|
||||
namespace Logging
|
||||
{
|
||||
void logBytes(char* name, unsigned char* str, int len)
|
||||
{
|
||||
char buffer[LOG_BUFFER_SIZE];
|
||||
char* name_cur = name;
|
||||
char* buf_cur = buffer;
|
||||
|
||||
while (*name_cur != 0)
|
||||
{
|
||||
*buf_cur++ = *name_cur++;
|
||||
}
|
||||
|
||||
*buf_cur++ = ':';
|
||||
*buf_cur++ = ' ';
|
||||
*buf_cur++ = '[';
|
||||
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
unsigned char c = str[i];
|
||||
|
||||
unsigned char n1 = (unsigned char)(c / 100);
|
||||
c -= (n1 * 100);
|
||||
|
||||
unsigned char n2 = (unsigned char)(c / 10);
|
||||
c -= (n2 * 10);
|
||||
|
||||
if (buf_cur - buffer + 4 >= LOG_BUFFER_SIZE)
|
||||
{
|
||||
*buf_cur++ = '\0';
|
||||
printf("%s\n", buffer);
|
||||
|
||||
buf_cur = buffer;
|
||||
}
|
||||
|
||||
*buf_cur++ = (char)('0' + n1);
|
||||
*buf_cur++ = (char)('0' + n2);
|
||||
*buf_cur++ = (char)('0' + c);
|
||||
*buf_cur++ = ',';
|
||||
}
|
||||
|
||||
buf_cur--;
|
||||
*buf_cur++ = ']';
|
||||
*buf_cur++ = '\0';
|
||||
|
||||
printf("%s\n", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LOG_FILE_H
|
||||
@ -1,174 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
sys.path.append("./../../../build_tools/scripts")
|
||||
import base
|
||||
import os
|
||||
import json
|
||||
import common
|
||||
|
||||
base.configure_common_apps()
|
||||
|
||||
# fetch emsdk
|
||||
command_prefix = "" if ("windows" == base.host_platform()) else "./"
|
||||
if not base.is_dir("emsdk"):
|
||||
base.cmd("git", ["clone", "https://github.com/emscripten-core/emsdk.git"])
|
||||
os.chdir("emsdk")
|
||||
base.cmd("git", ["checkout", "f677ef915645c09794f0ae88f21d3cba2886459f"])
|
||||
base.cmd(command_prefix + "emsdk", ["install", "latest"])
|
||||
base.cmd(command_prefix + "emsdk", ["activate", "latest"])
|
||||
os.chdir("../")
|
||||
|
||||
def exec_wasm(data, work, compiler_flags, wasm):
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir(work)
|
||||
|
||||
for include in data["include_path"]:
|
||||
compiler_flags.append("-I" + include)
|
||||
for define in data["define"]:
|
||||
compiler_flags.append("-D" + define)
|
||||
|
||||
if not wasm:
|
||||
compiler_flags.append("-DBUILDING_ASMJS_MODULE")
|
||||
compiler_flags.append("-D_ARM_ALIGN_")
|
||||
|
||||
compiler_flags.append("-Wno-deprecated-non-prototype")
|
||||
compiler_flags.append("-Wno-deprecated-register")
|
||||
compiler_flags.append("-Wno-register")
|
||||
|
||||
compiler_flags.append("-fvisibility=hidden")
|
||||
#compiler_flags.append("-Wl,--no-entry")
|
||||
#compiler_flags.append("-Wl,--strip-all")
|
||||
|
||||
# arguments
|
||||
arguments = ""
|
||||
for item in compiler_flags:
|
||||
arguments += (item + " ")
|
||||
|
||||
# command
|
||||
run_file = []
|
||||
prefix_call = ""
|
||||
if base.host_platform() == "windows":
|
||||
prefix_call = "call "
|
||||
run_file.append("call " + cur_dir + "/emsdk/emsdk_env.bat")
|
||||
else:
|
||||
run_file.append("#!/bin/bash")
|
||||
run_file.append("source " + cur_dir + "/emsdk/emsdk_env.sh")
|
||||
|
||||
libs = ""
|
||||
cur_folder_index = 0
|
||||
for compile_files in data["compile_files_array"]:
|
||||
compile_files_name_folder = str(cur_folder_index)
|
||||
cur_folder_index += 1
|
||||
compile_files_name_folder_all = "all_" + compile_files_name_folder + ".o"
|
||||
base.create_dir("./o/" + compile_files_name_folder)
|
||||
|
||||
temp_arguments = ""
|
||||
if "include_path" in compile_files and compile_files["include_path"]:
|
||||
for include in compile_files["include_path"]:
|
||||
temp_arguments += ("-I" + include + " ")
|
||||
if "define" in compile_files and compile_files["define"]:
|
||||
for define in compile_files["define"]:
|
||||
temp_arguments += ("-D" + define + " ")
|
||||
|
||||
temp_libs = ""
|
||||
for item in compile_files["files"]:
|
||||
file_name = os.path.splitext(os.path.basename(item))[0]
|
||||
if not base.is_file("./o/" + compile_files_name_folder + "/" + file_name + ".o"):
|
||||
run_file.append(prefix_call + "emcc -o o/" + compile_files_name_folder + "/" + file_name + ".o -c " + arguments + temp_arguments + os.path.join(compile_files["folder"], item))
|
||||
temp_libs += ("o/" + compile_files_name_folder + "/" + file_name + ".o ")
|
||||
|
||||
if len(compile_files["files"]) > 10:
|
||||
if not base.is_file("./o/" + compile_files_name_folder + "/" + compile_files_name_folder_all):
|
||||
run_file.append(prefix_call + "emcc -o o/" + compile_files_name_folder + "/" + compile_files_name_folder_all + " -r " + arguments + temp_arguments + temp_libs)
|
||||
libs += ("o/" + compile_files_name_folder + "/" + compile_files_name_folder_all + " ")
|
||||
else:
|
||||
libs += temp_libs
|
||||
|
||||
arguments += "-s EXPORTED_FUNCTIONS=\"["
|
||||
for item in data["exported_functions"]:
|
||||
arguments += ("'" + item + "',")
|
||||
arguments = arguments[:-1]
|
||||
arguments += "]\" "
|
||||
|
||||
if "sources" in data and data["sources"]:
|
||||
for item in data["sources"]:
|
||||
arguments += (item + " ")
|
||||
|
||||
run_file.append(prefix_call + "emcc -o " + data["name"] + ".js " + arguments + libs)
|
||||
base.print_info("run " + ("wasm " if wasm else "asm ") + data["name"])
|
||||
base.run_as_bat(run_file)
|
||||
|
||||
# finalize
|
||||
base.print_info("end " + ("wasm " if wasm else "asm ") + data["name"])
|
||||
module_js_content = base.readFile("./" + data["name"] + ".js")
|
||||
engine_base_js_content = base.readFile(data["base_js_content"])
|
||||
string_utf8_content = base.readFile(cur_dir + "/string_utf8.js")
|
||||
desktop_fetch_content = base.readFile(cur_dir + "/desktop_fetch.js")
|
||||
polyfill_js_content = base.readFile(cur_dir + "/polyfill.js")
|
||||
engine_js_content = engine_base_js_content.replace("//module", module_js_content)
|
||||
engine_js_content = engine_js_content.replace("//string_utf8", string_utf8_content)
|
||||
engine_js_content = engine_js_content.replace("//desktop_fetch", desktop_fetch_content)
|
||||
if not wasm:
|
||||
engine_js_content = engine_js_content.replace("//polyfill", polyfill_js_content)
|
||||
|
||||
if "replaces" in data:
|
||||
for item in data["replaces"]:
|
||||
replace_file_content = base.readFile(data["replaces"][item])
|
||||
engine_js_content = engine_js_content.replace("//" + item, replace_file_content)
|
||||
|
||||
# write new version
|
||||
base.writeFile(data["res_folder"] + "/" + data["name"] + ("" if wasm else "_ie") + ".js", engine_js_content)
|
||||
base.copy_file("./" + data["name"] + (".wasm" if wasm else ".js.mem"), data["res_folder"] + "/" + data["name"] + (".wasm" if wasm else ".js.mem"))
|
||||
|
||||
# clear
|
||||
base.delete_file("./" + data["name"] + ".js")
|
||||
base.delete_file("./" + data["name"] + (".wasm" if wasm else ".js.mem"))
|
||||
|
||||
os.chdir(cur_dir)
|
||||
return
|
||||
|
||||
argv = sys.argv
|
||||
argv.pop(0)
|
||||
for param in argv:
|
||||
base.print_info(param)
|
||||
if not base.is_file(param):
|
||||
continue
|
||||
work_dir = os.path.dirname(param) + "/"
|
||||
json_data = json.loads(base.readFile(param))
|
||||
|
||||
if json_data["run_before"]:
|
||||
base.print_info("before")
|
||||
if base.is_file(work_dir + json_data["run_before"]):
|
||||
base.cmd_in_dir(work_dir, "python", [json_data["run_before"]])
|
||||
else:
|
||||
base.cmd_in_dir(work_dir, "python", ["-c", json_data["run_before"]])
|
||||
|
||||
# remove previous version
|
||||
common.clear_dir(work_dir + "/o")
|
||||
base.create_dir(work_dir + json_data["res_folder"])
|
||||
|
||||
# wasm or asm
|
||||
if json_data["wasm"]:
|
||||
flags = json_data["compiler_flags"][:]
|
||||
flags.append("-s WASM=1")
|
||||
exec_wasm(json_data, work_dir, flags, True)
|
||||
base.delete_dir(work_dir + "/o")
|
||||
if json_data["asm"]:
|
||||
flags = json_data["compiler_flags"][:]
|
||||
flags.append("-s WASM=0")
|
||||
flags.append("--closure 0")
|
||||
flags.append("-s MIN_IE_VERSION=11")
|
||||
# do it in min.py
|
||||
#flags.append("--closure-args=--language_out=ECMASCRIPT5_STRICT")
|
||||
if "embed_mem_file" in json_data and (json_data["embed_mem_file"]):
|
||||
flags.append("--memory-init-file 0")
|
||||
exec_wasm(json_data, work_dir, flags, False)
|
||||
base.delete_dir(work_dir + "/o")
|
||||
if json_data["run_after"]:
|
||||
base.print_info("after")
|
||||
if base.is_file(work_dir + json_data["run_after"]):
|
||||
base.cmd_in_dir(work_dir, "python", [json_data["run_after"]])
|
||||
else:
|
||||
base.cmd_in_dir(work_dir, "python", ["-c", json_data["run_after"]])
|
||||
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append('../../../build_tools/scripts')
|
||||
import base
|
||||
import os
|
||||
|
||||
params = sys.argv[1:]
|
||||
|
||||
file_path = params[0]
|
||||
file_path_min = file_path + ".min.js"
|
||||
|
||||
compilation_level = "WHITESPACE_ONLY"
|
||||
#compilation_level = "SIMPLE_OPTIMIZATIONS"
|
||||
if (len(params) > 1):
|
||||
compilation_level = params[1]
|
||||
|
||||
base.cmd("java", ["-jar", "../../../sdkjs/build/node_modules/google-closure-compiler-java/compiler.jar",
|
||||
"--compilation_level", compilation_level,
|
||||
"--language_out", "ECMASCRIPT5_STRICT",
|
||||
"--js_output_file", file_path_min,
|
||||
"--js", file_path])
|
||||
|
||||
min_content = base.readFile("../license/header.license") + base.readFile(file_path_min)
|
||||
|
||||
base.delete_file(file_path_min)
|
||||
base.delete_file(file_path)
|
||||
|
||||
base.writeFile(file_path, min_content)
|
||||
@ -1,51 +0,0 @@
|
||||
var ob;function pb(h){var f=0;return function(){return f<h.length?{done:!1,value:h[f++]}:{done:!0}}}function qb(h){var f="undefined"!=typeof Symbol&&Symbol.iterator&&h[Symbol.iterator];return f?f.call(h):{next:pb(h)}}var dd="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,Fd="function"==typeof Object.defineProperties?Object.defineProperty:function(h,f,Ka){h!=Array.prototype&&h!=Object.prototype&&(h[f]=Ka.value)};if(!dd)dd=self;
|
||||
function Gd(h,f){if(f){var Ka=dd;h=h.split(".");for(var Za=0;Za<h.length-1;Za++){var bb=h[Za];bb in Ka||(Ka[bb]={});Ka=Ka[bb]}h=h[h.length-1];Za=Ka[h];f=f(Za);f!=Za&&null!=f&&Fd(Ka,h,{configurable:!0,writable:!0,value:f})}}
|
||||
Gd("Promise",function(h){function f(f){this.MQf=0;this.Cug=void 0;this.Qie=[];var h=this.slg();try{f(h.resolve,h.reject)}catch(Tb){h.reject(Tb)}}function Ka(){this.FAd=null}function Za(h){return h instanceof f?h:new f(function(f){f(h)})}if(h)return h;Ka.prototype.nJg=function(f){if(null==this.FAd){this.FAd=[];var h=this;this.oJg(function(){h.Ihh()})}this.FAd.push(f)};var bb=dd.setTimeout;Ka.prototype.oJg=function(f){bb(f,0)};Ka.prototype.Ihh=function(){for(;this.FAd&&this.FAd.length;){var f=this.FAd;
|
||||
this.FAd=[];for(var h=0;h<f.length;++h){var Ka=f[h];f[h]=null;try{Ka()}catch(jb){this.Heh(jb)}}}this.FAd=null};Ka.prototype.Heh=function(f){this.oJg(function(){throw f;})};f.prototype.slg=function(){function f(f){return function(z){Ka||(Ka=!0,f.call(h,z))}}var h=this,Ka=!1;return{resolve:f(this.Cph),reject:f(this.oug)}};f.prototype.Cph=function(h){if(h===this)this.oug(new TypeError("A Promise cannot resolve to itself"));else if(h instanceof f)this.Aqh(h);else{a:switch(typeof h){case "object":var z=
|
||||
null!=h;break a;case "function":z=!0;break a;default:z=!1}z?this.Bph(h):this.dNg(h)}};f.prototype.Bph=function(f){var h=void 0;try{h=f.then}catch(Tb){this.oug(Tb);return}"function"==typeof h?this.Bqh(h,f):this.dNg(f)};f.prototype.oug=function(f){this.vWg(2,f)};f.prototype.dNg=function(f){this.vWg(1,f)};f.prototype.vWg=function(f,h){if(0!=this.MQf)throw Error("Cannot settle("+f+", "+h+"): Promise already settled in state"+this.MQf);this.MQf=f;this.Cug=h;this.Jhh()};f.prototype.Jhh=function(){if(null!=
|
||||
this.Qie){for(var f=0;f<this.Qie.length;++f)gb.nJg(this.Qie[f]);this.Qie=null}};var gb=new Ka;f.prototype.Aqh=function(f){var h=this.slg();f.cZf(h.resolve,h.reject)};f.prototype.Bqh=function(f,h){var z=this.slg();try{f.call(h,z.resolve,z.reject)}catch(jb){z.reject(jb)}};f.prototype.then=function(h,Ka){function z(f,h){return"function"==typeof f?function(h){try{gb(f(h))}catch(hc){Ma(hc)}}:h}var gb,Ma,bb=new f(function(f,h){gb=f;Ma=h});this.cZf(z(h,gb),z(Ka,Ma));return bb};f.prototype.catch=function(f){return this.then(void 0,
|
||||
f)};f.prototype.cZf=function(f,h){function z(){switch(Ka.MQf){case 1:f(Ka.Cug);break;case 2:h(Ka.Cug);break;default:throw Error("Unexpected state: "+Ka.MQf);}}var Ka=this;null==this.Qie?gb.nJg(z):this.Qie.push(z)};f.resolve=Za;f.reject=function(h){return new f(function(f,z){z(h)})};f.race=function(h){return new f(function(f,z){for(var Ka=qb(h),Ma=Ka.next();!Ma.done;Ma=Ka.next())Za(Ma.value).cZf(f,z)})};f.all=function(h){var z=qb(h),Ka=z.next();return Ka.done?Za([]):new f(function(f,h){function Ma(h){return function(z){Ta[h]=
|
||||
z;gb--;0==gb&&f(Ta)}}var Ta=[],gb=0;do Ta.push(void 0),gb++,Za(Ka.value).cZf(Ma(Ta.length-1),h),Ka=z.next();while(!Ka.done)})};return f});Gd("Array.prototype.fill",function(h){return h?h:function(f,h,Za){var Ka=this.length||0;0>h&&(h=Math.max(0,Ka+h));if(null==Za||Za>Ka)Za=Ka;Za=Number(Za);0>Za&&(Za=Math.max(0,Ka+Za));for(h=Number(h||0);h<Za;h++)this[h]=f;return this}});
|
||||
function Hd(h,f,Ka){if(null==h)throw new TypeError("The 'this' value for String.prototype."+Ka+" must not be null or undefined");if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+Ka+" must not be a regular expression");return h+""}Gd("String.prototype.repeat",function(h){return h?h:function(f){var h=Hd(this,null,"repeat");if(0>f||1342177279<f)throw new RangeError("Invalid count value");f|=0;for(var Za="";f;)if(f&1&&(Za+=h),f>>>=1)h+=h;return Za}});
|
||||
Gd("Number.isFinite",function(h){return h?h:function(f){return"number"!==typeof f?!1:!isNaN(f)&&Infinity!==f&&-Infinity!==f}});Gd("Number.isInteger",function(h){return h?h:function(f){return Number.isFinite(f)?f===Math.floor(f):!1}});Gd("String.prototype.endsWith",function(h){return h?h:function(f,h){var Ka=Hd(this,f,"endsWith");f+="";void 0===h&&(h=Ka.length);h=Math.max(0,Math.min(h|0,Ka.length));for(var bb=f.length;0<bb&&0<h;)if(Ka[--h]!=f[--bb])return!1;return 0>=bb}});
|
||||
Gd("String.prototype.padStart",function(h){return h?h:function(f,h){var Ka=Hd(this,null,"padStart");f-=Ka.length;h=void 0!==h?String(h):" ";return(0<f&&h?h.repeat(Math.ceil(f/h.length)).substring(0,f):"")+Ka}});function Be(){Be=function(){};dd.Symbol||(dd.Symbol=De)}function Ee(h,f){this.kYg=h;Fd(this,"description",{configurable:!0,writable:!0,value:f})}Ee.prototype.toString=function(){return this.kYg};
|
||||
var De=function(){function h(Ka){if(this instanceof h)throw new TypeError("Symbol is not a constructor");return new Ee("jscomp_symbol_"+(Ka||"")+"_"+f++,Ka)}var f=0;return h}();function Ng(){Be();var h=dd.Symbol.iterator;h||(h=dd.Symbol.iterator=dd.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[h]&&Fd(Array.prototype,h,{configurable:!0,writable:!0,value:function(){return Kh(pb(this))}});Ng=function(){}}
|
||||
function Kh(h){Ng();h={next:h};h[dd.Symbol.iterator]=function(){return this};return h}function qm(h,f){Ng();h instanceof String&&(h+="");var Ka=0,Za={next:function(){if(Ka<h.length){var bb=Ka++;return{value:f(bb,h[bb]),done:!1}}Za.next=function(){return{done:!0,value:void 0}};return Za.next()}};Za[Symbol.iterator]=function(){return Za};return Za}Gd("Array.prototype.values",function(h){return h?h:function(){return qm(this,function(f,h){return h})}});
|
||||
Gd("Math.sign",function(h){return h?h:function(f){f=Number(f);return 0===f||isNaN(f)?f:0<f?1:-1}});Gd("Array.prototype.keys",function(h){return h?h:function(){return qm(this,function(f){return f})}});function Sm(h,f){return Object.prototype.hasOwnProperty.call(h,f)}
|
||||
Gd("WeakMap",function(h){function f(f){this.aCf=(z+=Math.random()+1).toString();if(f){f=qb(f);for(var h;!(h=f.next()).done;)h=h.value,this.set(h[0],h[1])}}function Ka(){}function Za(f){Sm(f,gb)||Fd(f,gb,{value:new Ka})}function bb(f){var h=Object[f];h&&(Object[f]=function(f){if(f instanceof Ka)return f;Za(f);return h(f)})}if(function(){if(!h||!Object.seal)return!1;try{var f=Object.seal({}),z=Object.seal({}),Ka=new h([[f,2],[z,3]]);if(2!=Ka.get(f)||3!=Ka.get(z))return!1;Ka.delete(f);Ka.set(z,4);return!Ka.has(f)&&
|
||||
4==Ka.get(z)}catch(Ma){return!1}}())return h;var gb="$jscomp_hidden_"+Math.random();bb("freeze");bb("preventExtensions");bb("seal");var z=0;f.prototype.set=function(f,h){Za(f);if(!Sm(f,gb))throw Error("WeakMap key fail: "+f);f[gb][this.aCf]=h;return this};f.prototype.get=function(f){return Sm(f,gb)?f[gb][this.aCf]:void 0};f.prototype.has=function(f){return Sm(f,gb)&&Sm(f[gb],this.aCf)};f.prototype.delete=function(f){return Sm(f,gb)&&Sm(f[gb],this.aCf)?delete f[gb][this.aCf]:!1};return f});
|
||||
Gd("Map",function(h){function f(){var f={};return f.previous=f.next=f.head=f}function Ka(f,h){var z=f.b4c;return Kh(function(){if(z){for(;z.head!=f.b4c;)z=z.previous;for(;z.next!=z.head;)return z=z.next,{done:!1,value:h(z)};z=null}return{done:!0,value:void 0}})}function Za(f,h){var Ka=h&&typeof h;"object"==Ka||"function"==Ka?gb.has(h)?Ka=gb.get(h):(Ka=""+ ++z,gb.set(h,Ka)):Ka="p_"+h;var Ma=f.rsf[Ka];if(Ma&&Sm(f.rsf,Ka))for(f=0;f<Ma.length;f++){var bb=Ma[f];if(h!==h&&bb.key!==bb.key||h===bb.key)return{id:Ka,
|
||||
list:Ma,index:f,SNb:bb}}return{id:Ka,list:Ma,index:-1,SNb:void 0}}function bb(h){this.rsf={};this.b4c=f();this.size=0;if(h){h=qb(h);for(var z;!(z=h.next()).done;)z=z.value,this.set(z[0],z[1])}}if(function(){if(!h||"function"!=typeof h||!h.prototype.entries||"function"!=typeof Object.seal)return!1;try{var f=Object.seal({x:4}),z=new h(qb([[f,"s"]]));if("s"!=z.get(f)||1!=z.size||z.get({x:4})||z.set({x:4},"t")!=z||2!=z.size)return!1;var Ka=z.entries(),Ma=Ka.next();if(Ma.done||Ma.value[0]!=f||"s"!=Ma.value[1])return!1;
|
||||
Ma=Ka.next();return Ma.done||4!=Ma.value[0].x||"t"!=Ma.value[1]||!Ka.next().done?!1:!0}catch(Kb){return!1}}())return h;Ng();var gb=new WeakMap;bb.prototype.set=function(f,h){f=0===f?0:f;var z=Za(this,f);z.list||(z.list=this.rsf[z.id]=[]);z.SNb?z.SNb.value=h:(z.SNb={next:this.b4c,previous:this.b4c.previous,head:this.b4c,key:f,value:h},z.list.push(z.SNb),this.b4c.previous.next=z.SNb,this.b4c.previous=z.SNb,this.size++);return this};bb.prototype.delete=function(f){f=Za(this,f);return f.SNb&&f.list?(f.list.splice(f.index,
|
||||
1),f.list.length||delete this.rsf[f.id],f.SNb.previous.next=f.SNb.next,f.SNb.next.previous=f.SNb.previous,f.SNb.head=null,this.size--,!0):!1};bb.prototype.clear=function(){this.rsf={};this.b4c=this.b4c.previous=f();this.size=0};bb.prototype.has=function(f){return!!Za(this,f).SNb};bb.prototype.get=function(f){return(f=Za(this,f).SNb)&&f.value};bb.prototype.entries=function(){return Ka(this,function(f){return[f.key,f.value]})};bb.prototype.keys=function(){return Ka(this,function(f){return f.key})};
|
||||
bb.prototype.values=function(){return Ka(this,function(f){return f.value})};bb.prototype.forEach=function(f,h){for(var z=this.entries(),Ma;!(Ma=z.next()).done;)Ma=Ma.value,f.call(h,Ma[1],Ma[0],this)};bb.prototype[Symbol.iterator]=bb.prototype.entries;var z=0;return bb});function Fw(h,f,Ka){h instanceof String&&(h=String(h));for(var Za=h.length,bb=0;bb<Za;bb++){var gb=h[bb];if(f.call(Ka,gb,bb,h))return{dn:bb,Ju:gb}}return{dn:-1,Ju:void 0}}
|
||||
Gd("Array.prototype.find",function(h){return h?h:function(f,h){return Fw(this,f,h).Ju}});Gd("String.prototype.startsWith",function(h){return h?h:function(f,h){var Ka=Hd(this,f,"startsWith");f+="";var bb=Ka.length,gb=f.length;h=Math.max(0,Math.min(h|0,Ka.length));for(var z=0;z<gb&&h<bb;)if(Ka[h++]!=f[z++])return!1;return z>=gb}});Gd("Object.is",function(h){return h?h:function(f,h){return f===h?0!==f||1/f===1/h:f!==f&&h!==h}});
|
||||
Gd("Array.prototype.includes",function(h){return h?h:function(f,h){var Ka=this;Ka instanceof String&&(Ka=String(Ka));var bb=Ka.length;h=h||0;for(0>h&&(h=Math.max(h+bb,0));h<bb;h++){var gb=Ka[h];if(gb===f||Object.is(gb,f))return!0}return!1}});Gd("String.prototype.includes",function(h){return h?h:function(f,h){return-1!==Hd(this,f,"includes").indexOf(f,h||0)}});
|
||||
Gd("Math.tanh",function(h){return h?h:function(f){f=Number(f);if(0===f)return f;var h=Math.exp(-2*Math.abs(f));h=(1-h)/(1+h);return 0>f?-h:h}});Gd("Math.log1p",function(h){return h?h:function(f){f=Number(f);if(.25>f&&-.25<f){for(var h=f,Za=1,bb=f,gb=0,z=1;gb!=bb;)h*=f,z*=-1,bb=(gb=bb)+z*h/++Za;return bb}return Math.log(1+f)}});Gd("Math.expm1",function(h){return h?h:function(f){f=Number(f);if(.25>f&&-.25<f){for(var h=f,Za=1,bb=f,gb=0;gb!=bb;)h*=f/++Za,bb=(gb=bb)+h;return bb}return Math.exp(f)-1}});
|
||||
Gd("Math.trunc",function(h){return h?h:function(f){f=Number(f);if(isNaN(f)||Infinity===f||-Infinity===f||0===f)return f;var h=Math.floor(Math.abs(f));return 0>f?-h:h}});Gd("Math.log10",function(h){return h?h:function(f){return Math.log(f)/Math.LN10}});Gd("Math.cosh",function(h){if(h)return h;var f=Math.exp;return function(h){h=Number(h);return(f(h)+f(-h))/2}});Gd("Math.sinh",function(h){if(h)return h;var f=Math.exp;return function(h){h=Number(h);return 0===h?h:(f(h)-f(-h))/2}});
|
||||
Gd("Math.acosh",function(h){return h?h:function(f){f=Number(f);return Math.log(f+Math.sqrt(f*f-1))}});Gd("Math.atanh",function(h){if(h)return h;var f=Math.log1p;return function(h){h=Number(h);return(f(h)-f(-h))/2}});Gd("Math.asinh",function(h){return h?h:function(f){f=Number(f);if(0===f)return f;var h=Math.log(Math.abs(f)+Math.sqrt(f*f+1));return 0>f?-h:h}});Gd("Array.prototype.findIndex",function(h){return h?h:function(f,h){return Fw(this,f,h).dn}});
|
||||
|
||||
Math.imul = Math.imul || function(a, b) {
|
||||
var ah = (a >>> 16) & 0xffff;
|
||||
var al = a & 0xffff;
|
||||
var bh = (b >>> 16) & 0xffff;
|
||||
var bl = b & 0xffff;
|
||||
// shift by 0 bits fixes the sign in the high part of the number
|
||||
// final |0 converts the unsigned value back to a signed value
|
||||
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
|
||||
};
|
||||
|
||||
Math.fround = Math.fround || function(x) {
|
||||
return new Float32Array([x])[0];
|
||||
};
|
||||
|
||||
Math.clz32 = Math.clz32 || function(value) {
|
||||
value = Number(value) >>> 0;
|
||||
return value !== 0 ? 31 - Math.floor(Math.log(value + 0.5) / Math.log(2)) : 32;
|
||||
};
|
||||
|
||||
Uint8Array.prototype.copyWithin = Uint8Array.prototype.copyWithin || function(target, start, end) {
|
||||
var tmpArray = this.subarray(start, end);
|
||||
this.set(tmpArray, target);
|
||||
return this;
|
||||
};
|
||||
@ -1,144 +0,0 @@
|
||||
(function(){
|
||||
|
||||
if (undefined !== String.prototype.fromUtf8 &&
|
||||
undefined !== String.prototype.toUtf8)
|
||||
return;
|
||||
|
||||
var STRING_UTF8_BUFFER_LENGTH = 1024;
|
||||
var STRING_UTF8_BUFFER = new ArrayBuffer(STRING_UTF8_BUFFER_LENGTH);
|
||||
|
||||
/**
|
||||
* Read string from utf8
|
||||
* @param {Uint8Array} buffer
|
||||
* @param {number} [start=0]
|
||||
* @param {number} [len]
|
||||
* @returns {string}
|
||||
*/
|
||||
String.prototype.fromUtf8 = function(buffer, start, len) {
|
||||
if (undefined === start)
|
||||
start = 0;
|
||||
if (undefined === len)
|
||||
len = buffer.length - start;
|
||||
|
||||
var result = "";
|
||||
var index = start;
|
||||
var end = start + len;
|
||||
while (index < end)
|
||||
{
|
||||
var u0 = buffer[index++];
|
||||
if (!(u0 & 128))
|
||||
{
|
||||
result += String.fromCharCode(u0);
|
||||
continue;
|
||||
}
|
||||
var u1 = buffer[index++] & 63;
|
||||
if ((u0 & 224) == 192)
|
||||
{
|
||||
result += String.fromCharCode((u0 & 31) << 6 | u1);
|
||||
continue;
|
||||
}
|
||||
var u2 = buffer[index++] & 63;
|
||||
if ((u0 & 240) == 224)
|
||||
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
||||
else
|
||||
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | buffer[index++] & 63;
|
||||
if (u0 < 65536)
|
||||
result += String.fromCharCode(u0);
|
||||
else
|
||||
{
|
||||
var ch = u0 - 65536;
|
||||
result += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert string to utf8 array
|
||||
* @returns {Uint8Array}
|
||||
*/
|
||||
String.prototype.toUtf8 = function(isNoEndNull, isUseBuffer) {
|
||||
var inputLen = this.length;
|
||||
var testLen = 6 * inputLen + 1;
|
||||
var tmpStrings = (isUseBuffer && testLen < STRING_UTF8_BUFFER_LENGTH) ? STRING_UTF8_BUFFER : new ArrayBuffer(testLen);
|
||||
|
||||
var code = 0;
|
||||
var index = 0;
|
||||
|
||||
var outputIndex = 0;
|
||||
var outputDataTmp = new Uint8Array(tmpStrings);
|
||||
var outputData = outputDataTmp;
|
||||
|
||||
while (index < inputLen)
|
||||
{
|
||||
code = this.charCodeAt(index++);
|
||||
if (code >= 0xD800 && code <= 0xDFFF && index < inputLen)
|
||||
code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & this.charCodeAt(index++)));
|
||||
|
||||
if (code < 0x80)
|
||||
outputData[outputIndex++] = code;
|
||||
else if (code < 0x0800)
|
||||
{
|
||||
outputData[outputIndex++] = 0xC0 | (code >> 6);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
else if (code < 0x10000)
|
||||
{
|
||||
outputData[outputIndex++] = 0xE0 | (code >> 12);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 6) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
else if (code < 0x1FFFFF)
|
||||
{
|
||||
outputData[outputIndex++] = 0xF0 | (code >> 18);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 12) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 6) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
else if (code < 0x3FFFFFF)
|
||||
{
|
||||
outputData[outputIndex++] = 0xF8 | (code >> 24);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 18) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 12) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 6) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
else if (code < 0x7FFFFFFF)
|
||||
{
|
||||
outputData[outputIndex++] = 0xFC | (code >> 30);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 24) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 18) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 12) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | ((code >> 6) & 0x3F);
|
||||
outputData[outputIndex++] = 0x80 | (code & 0x3F);
|
||||
}
|
||||
}
|
||||
|
||||
if (isNoEndNull !== true)
|
||||
outputData[outputIndex++] = 0;
|
||||
|
||||
return new Uint8Array(tmpStrings, 0, outputIndex);
|
||||
};
|
||||
|
||||
function StringPointer(pointer, len)
|
||||
{
|
||||
this.ptr = pointer;
|
||||
this.length = len;
|
||||
}
|
||||
StringPointer.prototype.free = function()
|
||||
{
|
||||
if (0 !== this.ptr)
|
||||
Module["_free"](this.ptr);
|
||||
};
|
||||
|
||||
String.prototype.toUtf8Pointer = function(isNoEndNull) {
|
||||
var tmp = this.toUtf8(isNoEndNull, true);
|
||||
var pointer = Module["_malloc"](tmp.length);
|
||||
if (0 == pointer)
|
||||
return null;
|
||||
|
||||
Module["HEAP8"].set(tmp, pointer);
|
||||
return new StringPointer(pointer, tmp.length);
|
||||
};
|
||||
|
||||
})();
|
||||
@ -1,32 +1,35 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
@ -48,7 +48,7 @@ TARGET = allthemesgen
|
||||
|
||||
DEFINES += KERNEL_USE_DYNAMIC_LIBRARY
|
||||
DEFINES += GRAPHICS_USE_DYNAMIC_LIBRARY
|
||||
ADD_DEPENDENCY(graphics, kernel, kernel_network, UnicodeConverter, doctrenderer, PdfFile, XpsFile, DjVuFile, DocxRenderer)
|
||||
ADD_DEPENDENCY(graphics, kernel, kernel_network, UnicodeConverter, doctrenderer, PdfFile, XpsFile, DjVuFile, OFDFile, DocxRenderer)
|
||||
|
||||
core_windows {
|
||||
DEFINES -= UNICODE
|
||||
|
||||
@ -415,6 +415,34 @@ bool CxImageBMP::DibReadBitmapInfo(CxFile* fh, BITMAPINFOHEADER *pdib)
|
||||
|
||||
bihtoh(pdib);
|
||||
|
||||
if (pdib->biSize < sizeof(BITMAPCOREHEADER))
|
||||
return false;
|
||||
|
||||
if (pdib->biBitCount != 0 && pdib->biBitCount != 1 &&
|
||||
pdib->biBitCount != 4 && pdib->biBitCount != 8 &&
|
||||
pdib->biBitCount != 16 && pdib->biBitCount != 24 &&
|
||||
pdib->biBitCount != 32)
|
||||
return false;
|
||||
|
||||
unsigned long long stride = ((unsigned long long)pdib->biWidth * pdib->biBitCount + 31) / 32 * 4;
|
||||
unsigned long long height = std::llabs((long long)pdib->biHeight);
|
||||
unsigned long long expected = stride * height;
|
||||
|
||||
unsigned long long num_colors = 0;
|
||||
if (pdib->biBitCount > 0 && pdib->biBitCount <= 8) {
|
||||
num_colors = (pdib->biClrUsed != 0)
|
||||
? pdib->biClrUsed
|
||||
: (1ULL << pdib->biBitCount);
|
||||
} else if (pdib->biClrUsed > 0) {
|
||||
num_colors = pdib->biClrUsed;
|
||||
}
|
||||
unsigned long long palette_size = num_colors * 4;
|
||||
|
||||
unsigned long long masks_size = (pdib->biCompression == BI_BITFIELDS) ? 12ULL : 0ULL;
|
||||
unsigned long long fileSize = fh->Size();
|
||||
if ((unsigned long long)pdib->biSize + palette_size + masks_size + expected > fileSize)
|
||||
return false;
|
||||
|
||||
switch (pdib->biSize) // what type of bitmap info is this?
|
||||
{
|
||||
case sizeof(BITMAPINFOHEADER):
|
||||
|
||||
@ -58,7 +58,7 @@ core_windows {
|
||||
DESTDIR = $$CORE_BUILDS_BINARY_PATH
|
||||
################################################
|
||||
|
||||
ADD_DEPENDENCY(graphics, kernel, kernel_network, UnicodeConverter, doctrenderer, PdfFile, XpsFile, DjVuFile, DocxRenderer)
|
||||
ADD_DEPENDENCY(graphics, kernel, kernel_network, UnicodeConverter, doctrenderer, PdfFile, XpsFile, DjVuFile, OFDFile, DocxRenderer)
|
||||
|
||||
core_linux {
|
||||
LIBS += -ldl
|
||||
|
||||
@ -149,7 +149,7 @@ DEFINES += BUIDLER_OPEN_BASE64_ENABLED
|
||||
CONFIG += drawingfile_support
|
||||
drawingfile_support {
|
||||
DEFINES += WASM_SERIALIZER_USE_ALLOCATOR
|
||||
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, DocxRenderer)
|
||||
ADD_DEPENDENCY(PdfFile, XpsFile, DjVuFile, OFDFile, DocxRenderer)
|
||||
|
||||
HEADERS += \
|
||||
$$PWD_CUR/drawingfile.h \
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
#include "../graphics/pro/js/wasm/src/serialize.h"
|
||||
#include "../graphics/pro/js/wasm/src/HTMLRendererText.h"
|
||||
#include "../../DocxRenderer/DocxRenderer.h"
|
||||
#include "../../OFDFile/OFDFile.h"
|
||||
#include "../../OfficeUtils/src/OfficeUtils.h"
|
||||
|
||||
#define CHECKER_FILE_BUFFER_LEN 4096
|
||||
|
||||
@ -106,6 +108,9 @@ public:
|
||||
case odftXPS:
|
||||
m_nType = 2;
|
||||
break;
|
||||
case odftOFD:
|
||||
m_nType = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -168,6 +173,16 @@ public:
|
||||
else
|
||||
m_nType = 2;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_pFile = new COFDFile(m_pApplicationFonts);
|
||||
if (!m_pFile->LoadFromFile(sFile, L"", sPassword, sPassword))
|
||||
{
|
||||
RELEASEOBJECT(m_pFile);
|
||||
}
|
||||
else
|
||||
m_nType = 3;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -218,6 +233,16 @@ public:
|
||||
else
|
||||
m_nType = 2;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_pFile = new COFDFile(m_pApplicationFonts);
|
||||
if (!m_pFile->LoadFromMemory(data, size, L"", sPassword, sPassword))
|
||||
{
|
||||
RELEASEOBJECT(m_pFile);
|
||||
}
|
||||
else
|
||||
m_nType = 3;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -291,6 +316,11 @@ public:
|
||||
return bRes;
|
||||
}
|
||||
|
||||
void SetPainter(IOfficeDrawingFilePainter* pPainter)
|
||||
{
|
||||
if (m_pFile)
|
||||
m_pFile->SetPainter(pPainter);
|
||||
}
|
||||
BYTE* GetPixmap(int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor)
|
||||
{
|
||||
if (!m_pFile)
|
||||
@ -637,7 +667,7 @@ private:
|
||||
double dPageDpiX, dPageDpiY;
|
||||
double dWidth, dHeight;
|
||||
m_pFile->GetPageInfo(nPageIndex, &dWidth, &dHeight, &dPageDpiX, &dPageDpiY);
|
||||
if (m_nType == 2)
|
||||
if (m_nType == 2 || m_nType == 3)
|
||||
{
|
||||
dWidth = dWidth / 25.4 * 96.0;
|
||||
dHeight = dHeight / 25.4 * 96.0;
|
||||
@ -675,6 +705,7 @@ private:
|
||||
// 0 - PDF
|
||||
// 1 - DJVU
|
||||
// 2 - XPS
|
||||
// 3 - OFD
|
||||
LONG nSize = size < CHECKER_FILE_BUFFER_LEN ? size : CHECKER_FILE_BUFFER_LEN;
|
||||
char* pData = (char*)data;
|
||||
for (int i = 0; i < nSize - 5; ++i)
|
||||
@ -686,6 +717,25 @@ private:
|
||||
if ( (8 <= size) && (0x41 == data[0] && 0x54 == data[1] && 0x26 == data[2] && 0x54 == data[3] &&
|
||||
0x46 == data[4] && 0x4f == data[5] && 0x52 == data[6] && 0x4d == data[7]))
|
||||
return 1;
|
||||
COfficeUtils OfficeUtils(NULL);
|
||||
if (OfficeUtils.IsArchive(data, size) == S_FALSE)
|
||||
return -1;
|
||||
|
||||
ULONG nBufferSize = 0;
|
||||
BYTE *pBuffer = NULL;
|
||||
|
||||
int nFileType = -1;
|
||||
HRESULT hresult = OfficeUtils.LoadFileFromArchive(data, size, L"OFD.xml", &pBuffer, nBufferSize);
|
||||
if (hresult == S_OK && pBuffer != NULL)
|
||||
{
|
||||
if (19 <= nBufferSize && NULL != strstr((char *)pBuffer, "ofd:OFD"))
|
||||
nFileType = 3;
|
||||
|
||||
delete[] pBuffer;
|
||||
pBuffer = NULL;
|
||||
|
||||
return nFileType;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
@ -189,6 +189,7 @@ namespace Aggplus
|
||||
{
|
||||
m_bIsClip = false;
|
||||
m_bIsClip2 = false;
|
||||
m_bIsEmpty = false;
|
||||
}
|
||||
CClipMulti::~CClipMulti()
|
||||
{
|
||||
@ -211,6 +212,7 @@ namespace Aggplus
|
||||
m_rasterizer.clip_box(0, 0, width, height);
|
||||
m_bIsClip = false;
|
||||
m_bIsClip2 = false;
|
||||
m_bIsEmpty = false;
|
||||
}
|
||||
|
||||
void CClipMulti::GenerateClip(CGraphicsPath* pPath, CMatrix* pMatrix)
|
||||
@ -247,15 +249,21 @@ namespace Aggplus
|
||||
if (!m_bIsClip)
|
||||
return GenerateClip2(bEvenOdd);
|
||||
|
||||
pRasterizer->filling_rule(bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
scanline_type sl1;
|
||||
scanline_type sl2;
|
||||
scanline_type sl;
|
||||
|
||||
if (!pRasterizer->rewind_scanlines())
|
||||
{
|
||||
if (op == agg::sbool_and)
|
||||
SetEmpty();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_bIsClip2)
|
||||
{
|
||||
// need to blend with rasterizer
|
||||
pRasterizer->filling_rule(bEvenOdd ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
scanline_type sl1;
|
||||
scanline_type sl2;
|
||||
scanline_type sl;
|
||||
|
||||
agg::sbool_combine_shapes_aa(op, m_rasterizer, *pRasterizer, sl1, sl2, sl, m_storage1);
|
||||
|
||||
m_lCurStorage = 1;
|
||||
@ -263,15 +271,8 @@ namespace Aggplus
|
||||
else
|
||||
{
|
||||
// need to blend with storage
|
||||
|
||||
pRasterizer->filling_rule(op ? agg::fill_even_odd : agg::fill_non_zero);
|
||||
|
||||
scanline_type sl1;
|
||||
scanline_type sl2;
|
||||
scanline_type sl;
|
||||
|
||||
agg::sbool_combine_shapes_aa(op, *pRasterizer, (m_lCurStorage == 1) ? m_storage1 : m_storage2, sl1, sl2, sl,
|
||||
(m_lCurStorage == 1) ? m_storage2 : m_storage1);
|
||||
agg::sbool_combine_shapes_aa(op, (m_lCurStorage == 1) ? m_storage1 : m_storage2, *pRasterizer, sl1, sl2, sl,
|
||||
(m_lCurStorage == 1) ? m_storage2 : m_storage1);
|
||||
|
||||
if (1 == m_lCurStorage)
|
||||
{
|
||||
@ -295,6 +296,10 @@ namespace Aggplus
|
||||
{
|
||||
return m_bIsClip2;
|
||||
}
|
||||
bool CClipMulti::IsEmpty()
|
||||
{
|
||||
return m_bIsEmpty;
|
||||
}
|
||||
|
||||
void CClipMulti::Reset()
|
||||
{
|
||||
@ -305,5 +310,13 @@ namespace Aggplus
|
||||
|
||||
m_bIsClip = false;
|
||||
m_bIsClip2 = false;
|
||||
m_bIsEmpty = false;
|
||||
}
|
||||
void CClipMulti::SetEmpty()
|
||||
{
|
||||
m_bIsEmpty = true;
|
||||
m_bIsClip2 = true;
|
||||
m_lCurStorage = 1;
|
||||
//m_storage1.prepare();
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,6 +154,7 @@ public:
|
||||
|
||||
bool m_bIsClip;
|
||||
bool m_bIsClip2;
|
||||
bool m_bIsEmpty;
|
||||
|
||||
LONG m_lWidth;
|
||||
LONG m_lHeight;
|
||||
@ -172,8 +173,10 @@ public:
|
||||
|
||||
bool IsClip();
|
||||
bool IsClip2();
|
||||
bool IsEmpty();
|
||||
|
||||
void Reset();
|
||||
void SetEmpty();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -1353,7 +1353,7 @@ namespace Aggplus
|
||||
{
|
||||
agg::render_scanlines(ras, sl, ren);
|
||||
}
|
||||
else
|
||||
else if (!m_oClip.IsEmpty())
|
||||
{
|
||||
if (!m_oClip.IsClip2())
|
||||
{
|
||||
@ -2191,14 +2191,11 @@ namespace Aggplus
|
||||
|
||||
for (LONG i = 0; i < lCount2; ++i)
|
||||
{
|
||||
if (0 == i)
|
||||
{
|
||||
poly2_dash.add_dash((params[i * 2]) * dKoef, params[i * 2 + 1] * dKoef);
|
||||
}
|
||||
else
|
||||
{
|
||||
poly2_dash.add_dash(params[i * 2] * dKoef, params[i * 2 + 1] * dKoef);
|
||||
}
|
||||
double dashLen = params[i * 2] * dKoef;
|
||||
double gapLen = params[i * 2 + 1] * dKoef;
|
||||
if (m_bIs0PenWidthAs1px && fabs(dashLen) < 0.0001 && LineCap == agg::round_cap)
|
||||
dashLen = 0.0001;
|
||||
poly2_dash.add_dash(dashLen, gapLen);
|
||||
}
|
||||
if (1 == (lCount % 2))
|
||||
{
|
||||
|
||||
@ -152,7 +152,7 @@ public:
|
||||
Link = 1,
|
||||
DocInfo = 2,
|
||||
FormField = 3, // Backward compatibility for docxf
|
||||
Annotaion = 4,
|
||||
Annotation = 4,
|
||||
DeleteAnnot = 5,
|
||||
WidgetsInfo = 6,
|
||||
ShapeStart = 7,
|
||||
@ -161,6 +161,7 @@ public:
|
||||
PageRotate = 10,
|
||||
Headings = 11,
|
||||
Redact = 12,
|
||||
RedactAnnot = 13,
|
||||
|
||||
Undefined = 255
|
||||
};
|
||||
@ -308,6 +309,10 @@ public:
|
||||
LONG c = (NULL == codepoints) ? 32 : codepoints[0];
|
||||
return CommandDrawTextExCHAR(c, (LONG)gid, x, y, w, h);
|
||||
}
|
||||
virtual HRESULT CommandDrawType3CHAR(const std::wstring& wsUnicodeText, const double& x, const double& y, const double& w, const double& h, const double& ascent, const double& descent, const double& unitsPerEm)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-------- Command markers ---------------------------------------------------------------
|
||||
virtual HRESULT BeginCommand(const DWORD& lType) = 0;
|
||||
|
||||
@ -1067,7 +1067,7 @@ namespace NSOnlineOfficeBinToPdf
|
||||
switch (eCommand)
|
||||
{
|
||||
case ctFormField: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::FormField; break;
|
||||
case ctAnnotField: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::Annotaion; break;
|
||||
case ctAnnotField: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::Annotation; break;
|
||||
case ctAnnotFieldDelete: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::DeleteAnnot; break;
|
||||
case ctWidgetsInfo: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::WidgetsInfo; break;
|
||||
case ctShapeStart: eAdvancedCommandType = IAdvancedCommand::AdvancedCommandType::ShapeStart; break;
|
||||
|
||||
@ -135,7 +135,7 @@ CAnnotFieldInfo::CActionFieldPr* ReadAction(NSOnlineOfficeBinToPdf::CBufferReade
|
||||
return pRes;
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annotaion)
|
||||
CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annotation)
|
||||
{
|
||||
m_nType = EAnnotType::Unknown;
|
||||
|
||||
@ -154,20 +154,22 @@ CAnnotFieldInfo::CAnnotFieldInfo() : IAdvancedCommand(AdvancedCommandType::Annot
|
||||
m_oBorder.nType = 0;
|
||||
m_oBorder.dWidth = 0.0;
|
||||
|
||||
m_pMarkupPr = NULL;
|
||||
m_pTextPr = NULL;
|
||||
m_pInkPr = NULL;
|
||||
m_pLinePr = NULL;
|
||||
m_pTextMarkupPr = NULL;
|
||||
m_pSquareCirclePr = NULL;
|
||||
m_pPolygonLinePr = NULL;
|
||||
m_pPopupPr = NULL;
|
||||
m_pFreeTextPr = NULL;
|
||||
m_pCaretPr = NULL;
|
||||
m_pStampPr = NULL;
|
||||
m_pRedactPr = NULL;
|
||||
m_pLinkPr = NULL;
|
||||
m_pWidgetPr = NULL;
|
||||
m_pMarkupPr = NULL;
|
||||
m_pTextPr = NULL;
|
||||
m_pInkPr = NULL;
|
||||
m_pLinePr = NULL;
|
||||
m_pTextMarkupPr = NULL;
|
||||
m_pSquareCirclePr = NULL;
|
||||
m_pPolygonLinePr = NULL;
|
||||
m_pPopupPr = NULL;
|
||||
m_pFreeTextPr = NULL;
|
||||
m_pCaretPr = NULL;
|
||||
m_pStampPr = NULL;
|
||||
m_pRedactPr = NULL;
|
||||
m_pLinkPr = NULL;
|
||||
m_pFileAttachmentPr = NULL;
|
||||
m_pScreenPr = NULL;
|
||||
m_pWidgetPr = NULL;
|
||||
}
|
||||
CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
{
|
||||
@ -184,6 +186,8 @@ CAnnotFieldInfo::~CAnnotFieldInfo()
|
||||
RELEASEOBJECT(m_pStampPr);
|
||||
RELEASEOBJECT(m_pRedactPr);
|
||||
RELEASEOBJECT(m_pLinkPr);
|
||||
RELEASEOBJECT(m_pFileAttachmentPr);
|
||||
RELEASEOBJECT(m_pScreenPr);
|
||||
RELEASEOBJECT(m_pWidgetPr);
|
||||
}
|
||||
|
||||
@ -277,6 +281,18 @@ void CAnnotFieldInfo::SetType(int nType)
|
||||
m_pPopupPr = new CAnnotFieldInfo::CPopupAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::FileAttachment:
|
||||
{
|
||||
RELEASEOBJECT(m_pFileAttachmentPr);
|
||||
m_pFileAttachmentPr = new CAnnotFieldInfo::CFileAttachmentAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::Screen:
|
||||
{
|
||||
RELEASEOBJECT(m_pScreenPr);
|
||||
m_pScreenPr = new CAnnotFieldInfo::CScreenAnnotPr();
|
||||
break;
|
||||
}
|
||||
case EAnnotType::Redact:
|
||||
{
|
||||
CreateMarkup();
|
||||
@ -406,21 +422,31 @@ bool CAnnotFieldInfo::IsLink() const
|
||||
{
|
||||
return (m_nType == 1);
|
||||
}
|
||||
bool CAnnotFieldInfo::IsFileAttachment() const
|
||||
{
|
||||
return (m_nType == 16);
|
||||
}
|
||||
bool CAnnotFieldInfo::IsScreen() const
|
||||
{
|
||||
return (m_nType == 20);
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CMarkupAnnotPr* CAnnotFieldInfo::GetMarkupAnnotPr() { return m_pMarkupPr; }
|
||||
CAnnotFieldInfo::CTextAnnotPr* CAnnotFieldInfo::GetTextAnnotPr() { return m_pTextPr; }
|
||||
CAnnotFieldInfo::CInkAnnotPr* CAnnotFieldInfo::GetInkAnnotPr() { return m_pInkPr; }
|
||||
CAnnotFieldInfo::CLineAnnotPr* CAnnotFieldInfo::GetLineAnnotPr() { return m_pLinePr; }
|
||||
CAnnotFieldInfo::CTextMarkupAnnotPr* CAnnotFieldInfo::GetTextMarkupAnnotPr() { return m_pTextMarkupPr; }
|
||||
CAnnotFieldInfo::CSquareCircleAnnotPr* CAnnotFieldInfo::GetSquareCircleAnnotPr() { return m_pSquareCirclePr; }
|
||||
CAnnotFieldInfo::CPolygonLineAnnotPr* CAnnotFieldInfo::GetPolygonLineAnnotPr() { return m_pPolygonLinePr; }
|
||||
CAnnotFieldInfo::CPopupAnnotPr* CAnnotFieldInfo::GetPopupAnnotPr() { return m_pPopupPr; }
|
||||
CAnnotFieldInfo::CFreeTextAnnotPr* CAnnotFieldInfo::GetFreeTextAnnotPr() { return m_pFreeTextPr; }
|
||||
CAnnotFieldInfo::CCaretAnnotPr* CAnnotFieldInfo::GetCaretAnnotPr() { return m_pCaretPr; }
|
||||
CAnnotFieldInfo::CStampAnnotPr* CAnnotFieldInfo::GetStampAnnotPr() { return m_pStampPr; }
|
||||
CAnnotFieldInfo::CRedactAnnotPr* CAnnotFieldInfo::GetRedactAnnotPr() { return m_pRedactPr; }
|
||||
CAnnotFieldInfo::CLinkAnnotPr* CAnnotFieldInfo::GetLinkAnnotPr() { return m_pLinkPr; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr* CAnnotFieldInfo::GetWidgetAnnotPr() { return m_pWidgetPr; }
|
||||
CAnnotFieldInfo::CMarkupAnnotPr* CAnnotFieldInfo::GetMarkupAnnotPr() { return m_pMarkupPr; }
|
||||
CAnnotFieldInfo::CTextAnnotPr* CAnnotFieldInfo::GetTextAnnotPr() { return m_pTextPr; }
|
||||
CAnnotFieldInfo::CInkAnnotPr* CAnnotFieldInfo::GetInkAnnotPr() { return m_pInkPr; }
|
||||
CAnnotFieldInfo::CLineAnnotPr* CAnnotFieldInfo::GetLineAnnotPr() { return m_pLinePr; }
|
||||
CAnnotFieldInfo::CTextMarkupAnnotPr* CAnnotFieldInfo::GetTextMarkupAnnotPr() { return m_pTextMarkupPr; }
|
||||
CAnnotFieldInfo::CSquareCircleAnnotPr* CAnnotFieldInfo::GetSquareCircleAnnotPr() { return m_pSquareCirclePr; }
|
||||
CAnnotFieldInfo::CPolygonLineAnnotPr* CAnnotFieldInfo::GetPolygonLineAnnotPr() { return m_pPolygonLinePr; }
|
||||
CAnnotFieldInfo::CPopupAnnotPr* CAnnotFieldInfo::GetPopupAnnotPr() { return m_pPopupPr; }
|
||||
CAnnotFieldInfo::CFreeTextAnnotPr* CAnnotFieldInfo::GetFreeTextAnnotPr() { return m_pFreeTextPr; }
|
||||
CAnnotFieldInfo::CCaretAnnotPr* CAnnotFieldInfo::GetCaretAnnotPr() { return m_pCaretPr; }
|
||||
CAnnotFieldInfo::CStampAnnotPr* CAnnotFieldInfo::GetStampAnnotPr() { return m_pStampPr; }
|
||||
CAnnotFieldInfo::CRedactAnnotPr* CAnnotFieldInfo::GetRedactAnnotPr() { return m_pRedactPr; }
|
||||
CAnnotFieldInfo::CLinkAnnotPr* CAnnotFieldInfo::GetLinkAnnotPr() { return m_pLinkPr; }
|
||||
CAnnotFieldInfo::CFileAttachmentAnnotPr* CAnnotFieldInfo::GetFileAttachmentAnnotPr() { return m_pFileAttachmentPr; }
|
||||
CAnnotFieldInfo::CScreenAnnotPr* CAnnotFieldInfo::GetScreenAnnotPr() { return m_pScreenPr; }
|
||||
CAnnotFieldInfo::CWidgetAnnotPr* CAnnotFieldInfo::GetWidgetAnnotPr() { return m_pWidgetPr; }
|
||||
|
||||
bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
{
|
||||
@ -509,6 +535,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
m_pStampPr->Read(pReader, nFlags);
|
||||
else if (IsRedact())
|
||||
m_pRedactPr->Read(pReader, nFlags);
|
||||
else if (IsFileAttachment())
|
||||
m_pFileAttachmentPr->Read(pReader, nFlags);
|
||||
}
|
||||
else if (IsPopup())
|
||||
m_pPopupPr->Read(pReader);
|
||||
@ -516,6 +544,8 @@ bool CAnnotFieldInfo::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMeta
|
||||
m_pWidgetPr->Read(pReader, nType);
|
||||
else if (IsLink())
|
||||
m_pLinkPr->Read(pReader);
|
||||
else if (IsScreen())
|
||||
m_pScreenPr->Read(pReader);
|
||||
|
||||
return m_nType != -1;
|
||||
}
|
||||
@ -837,6 +867,7 @@ CAnnotFieldInfo::CLinkAnnotPr::~CLinkAnnotPr()
|
||||
}
|
||||
BYTE CAnnotFieldInfo::CLinkAnnotPr::GetH() const { return m_nH; }
|
||||
int CAnnotFieldInfo::CLinkAnnotPr::GetFlags() const { return m_nFlags; }
|
||||
void CAnnotFieldInfo::CLinkAnnotPr::GetRD(double& dRD1, double& dRD2, double& dRD3, double& dRD4) { dRD1 = m_dRD[0]; dRD2 = m_dRD[1]; dRD3 = m_dRD[2]; dRD4 = m_dRD[3]; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CLinkAnnotPr::GetQuadPoints() { return m_arrQuadPoints; }
|
||||
CAnnotFieldInfo::CActionFieldPr* CAnnotFieldInfo::CLinkAnnotPr::GetA() { return m_pAction; }
|
||||
CAnnotFieldInfo::CActionFieldPr* CAnnotFieldInfo::CLinkAnnotPr::GetPA() { return m_pPA; }
|
||||
@ -862,6 +893,126 @@ void CAnnotFieldInfo::CLinkAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader*
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrQuadPoints.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (m_nFlags & (1 << 4))
|
||||
{
|
||||
m_dRD[0] = pReader->ReadDouble();
|
||||
m_dRD[1] = pReader->ReadDouble();
|
||||
m_dRD[2] = pReader->ReadDouble();
|
||||
m_dRD[3] = pReader->ReadDouble();
|
||||
}
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CFileAttachmentAnnotPr::CFileAttachmentAnnotPr()
|
||||
{
|
||||
|
||||
}
|
||||
CAnnotFieldInfo::CFileAttachmentAnnotPr::~CFileAttachmentAnnotPr()
|
||||
{
|
||||
|
||||
}
|
||||
int CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileFlag() const { return m_nFileFlag; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetName() { return m_wsName; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFS() { return m_wsFS; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetF() { return m_wsF; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetUF() { return m_wsUF; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetDOS() { return m_wsDOS; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetMac() { return m_wsMac; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetUnix() { return m_wsUnix; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetDesc() { return m_wsDesc; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileF() { return m_wsFileF; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileUF() { return m_wsFileUF; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileDOS() { return m_wsFileDOS; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileMac() { return m_wsFileMac; }
|
||||
const std::wstring& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetFileUnix() { return m_wsFileUnix; }
|
||||
const std::pair<std::wstring, std::wstring>& CAnnotFieldInfo::CFileAttachmentAnnotPr::GetID() { return m_wsID; }
|
||||
void CAnnotFieldInfo::CFileAttachmentAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, int nFlags)
|
||||
{
|
||||
if (nFlags & (1 << 15))
|
||||
m_wsName = pReader->ReadString();
|
||||
if (nFlags & (1 << 16))
|
||||
m_wsFS = pReader->ReadString();
|
||||
if (nFlags & (1 << 17))
|
||||
m_wsF = pReader->ReadString();
|
||||
if (nFlags & (1 << 18))
|
||||
m_wsUF = pReader->ReadString();
|
||||
if (nFlags & (1 << 19))
|
||||
m_wsDOS = pReader->ReadString();
|
||||
if (nFlags & (1 << 20))
|
||||
m_wsMac = pReader->ReadString();
|
||||
if (nFlags & (1 << 21))
|
||||
m_wsUnix = pReader->ReadString();
|
||||
if (nFlags & (1 << 22))
|
||||
{
|
||||
m_wsID.first = pReader->ReadString();
|
||||
m_wsID.second = pReader->ReadString();
|
||||
}
|
||||
if (nFlags & (1 << 24))
|
||||
{
|
||||
m_nFileFlag = pReader->ReadInt();
|
||||
if (m_nFileFlag & (1 << 0))
|
||||
m_wsFileF = pReader->ReadString();
|
||||
if (m_nFileFlag & (1 << 1))
|
||||
m_wsFileUF = pReader->ReadString();
|
||||
if (m_nFileFlag & (1 << 2))
|
||||
m_wsFileDOS = pReader->ReadString();
|
||||
if (m_nFileFlag & (1 << 3))
|
||||
m_wsFileMac = pReader->ReadString();
|
||||
if (m_nFileFlag & (1 << 4))
|
||||
m_wsFileUnix = pReader->ReadString();
|
||||
}
|
||||
if (nFlags & (1 << 26))
|
||||
m_wsDesc = pReader->ReadString();
|
||||
}
|
||||
|
||||
CAnnotFieldInfo::CScreenAnnotPr::CScreenAnnotPr()
|
||||
{
|
||||
|
||||
}
|
||||
CAnnotFieldInfo::CScreenAnnotPr::~CScreenAnnotPr()
|
||||
{
|
||||
|
||||
}
|
||||
int CAnnotFieldInfo::CScreenAnnotPr::GetR() const { return m_nR; }
|
||||
int CAnnotFieldInfo::CScreenAnnotPr::GetFlags() const { return m_nFlags; }
|
||||
const std::wstring& CAnnotFieldInfo::CScreenAnnotPr::GetT() { return m_wsT; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CScreenAnnotPr::GetBC() { return m_arrBC; }
|
||||
const std::vector<double>& CAnnotFieldInfo::CScreenAnnotPr::GetBG() { return m_arrBG; }
|
||||
const std::vector<CAnnotFieldInfo::CActionFieldPr*>& CAnnotFieldInfo::CScreenAnnotPr::GetActions() { return m_arrAction; }
|
||||
void CAnnotFieldInfo::CScreenAnnotPr::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader)
|
||||
{
|
||||
m_nFlags = pReader->ReadInt();
|
||||
if (m_nFlags & (1 << 0))
|
||||
m_wsT = pReader->ReadString();
|
||||
if (m_nFlags & (1 << 1))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrBC.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrBC.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (m_nFlags & (1 << 2))
|
||||
m_nR = pReader->ReadInt();
|
||||
if (m_nFlags & (1 << 3))
|
||||
{
|
||||
int n = pReader->ReadInt();
|
||||
m_arrBG.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
m_arrBG.push_back(pReader->ReadDouble());
|
||||
}
|
||||
if (m_nFlags & (1 << 4))
|
||||
{
|
||||
int nAction = pReader->ReadInt();
|
||||
for (int i = 0; i < nAction; ++i)
|
||||
{
|
||||
std::wstring wsType = pReader->ReadString();
|
||||
CAnnotFieldInfo::CActionFieldPr* pA = ReadAction(pReader);
|
||||
if (pA)
|
||||
{
|
||||
pA->wsType = wsType;
|
||||
m_arrAction.push_back(pA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CAnnotFieldInfo::CPopupAnnotPr::IsOpen() const { return m_bOpen; }
|
||||
@ -1336,3 +1487,11 @@ bool CRedact::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRe
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CRedactAnnot::CRedactAnnot() : IAdvancedCommand(AdvancedCommandType::RedactAnnot) {}
|
||||
int CRedactAnnot::GetID() { return m_nID; }
|
||||
bool CRedactAnnot::Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector)
|
||||
{
|
||||
m_nID = pReader->ReadInt();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -62,6 +62,7 @@ public:
|
||||
Ink = 14,
|
||||
Popup = 15,
|
||||
FileAttachment = 16,
|
||||
Screen = 20,
|
||||
Redact = 25,
|
||||
Widget = 26,
|
||||
WidgetPushButton = 27,
|
||||
@ -493,6 +494,7 @@ public:
|
||||
|
||||
BYTE GetH() const;
|
||||
int GetFlags() const;
|
||||
void GetRD(double& dRD1, double& dRD2, double& dRD3, double& dRD4);
|
||||
const std::vector<double>& GetQuadPoints();
|
||||
CActionFieldPr* GetA();
|
||||
CActionFieldPr* GetPA();
|
||||
@ -502,11 +504,78 @@ public:
|
||||
private:
|
||||
BYTE m_nH;
|
||||
int m_nFlags;
|
||||
double m_dRD[4]{};
|
||||
std::vector<double> m_arrQuadPoints;
|
||||
CActionFieldPr* m_pAction;
|
||||
CActionFieldPr* m_pPA;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CFileAttachmentAnnotPr
|
||||
{
|
||||
public:
|
||||
CFileAttachmentAnnotPr();
|
||||
~CFileAttachmentAnnotPr();
|
||||
|
||||
int GetFileFlag() const;
|
||||
const std::wstring& GetName();
|
||||
const std::wstring& GetFS();
|
||||
const std::wstring& GetF();
|
||||
const std::wstring& GetUF();
|
||||
const std::wstring& GetDOS();
|
||||
const std::wstring& GetMac();
|
||||
const std::wstring& GetUnix();
|
||||
const std::wstring& GetDesc();
|
||||
const std::wstring& GetFileF();
|
||||
const std::wstring& GetFileUF();
|
||||
const std::wstring& GetFileDOS();
|
||||
const std::wstring& GetFileMac();
|
||||
const std::wstring& GetFileUnix();
|
||||
const std::pair<std::wstring, std::wstring>& GetID();
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, int nFlags);
|
||||
|
||||
private:
|
||||
int m_nFileFlag;
|
||||
std::wstring m_wsName;
|
||||
std::wstring m_wsFS;
|
||||
std::wstring m_wsF;
|
||||
std::wstring m_wsUF;
|
||||
std::wstring m_wsDOS;
|
||||
std::wstring m_wsMac;
|
||||
std::wstring m_wsUnix;
|
||||
std::wstring m_wsDesc;
|
||||
std::wstring m_wsFileF;
|
||||
std::wstring m_wsFileUF;
|
||||
std::wstring m_wsFileDOS;
|
||||
std::wstring m_wsFileMac;
|
||||
std::wstring m_wsFileUnix;
|
||||
std::pair<std::wstring, std::wstring> m_wsID;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CScreenAnnotPr
|
||||
{
|
||||
public:
|
||||
CScreenAnnotPr();
|
||||
~CScreenAnnotPr();
|
||||
|
||||
int GetR() const;
|
||||
int GetFlags() const;
|
||||
const std::wstring& GetT();
|
||||
const std::vector<double>& GetBC();
|
||||
const std::vector<double>& GetBG();
|
||||
const std::vector<CActionFieldPr*>& GetActions();
|
||||
|
||||
void Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader);
|
||||
|
||||
private:
|
||||
int m_nR;
|
||||
int m_nFlags;
|
||||
std::wstring m_wsT;
|
||||
std::vector<double> m_arrBC;
|
||||
std::vector<double> m_arrBG;
|
||||
std::vector<CActionFieldPr*> m_arrAction;
|
||||
};
|
||||
|
||||
CAnnotFieldInfo();
|
||||
virtual ~CAnnotFieldInfo();
|
||||
|
||||
@ -548,21 +617,25 @@ public:
|
||||
bool IsStamp() const;
|
||||
bool IsRedact() const;
|
||||
bool IsLink() const;
|
||||
bool IsFileAttachment() const;
|
||||
bool IsScreen() const;
|
||||
|
||||
CMarkupAnnotPr* GetMarkupAnnotPr();
|
||||
CTextAnnotPr* GetTextAnnotPr();
|
||||
CInkAnnotPr* GetInkAnnotPr();
|
||||
CLineAnnotPr* GetLineAnnotPr();
|
||||
CTextMarkupAnnotPr* GetTextMarkupAnnotPr();
|
||||
CSquareCircleAnnotPr* GetSquareCircleAnnotPr();
|
||||
CPolygonLineAnnotPr* GetPolygonLineAnnotPr();
|
||||
CPopupAnnotPr* GetPopupAnnotPr();
|
||||
CFreeTextAnnotPr* GetFreeTextAnnotPr();
|
||||
CCaretAnnotPr* GetCaretAnnotPr();
|
||||
CStampAnnotPr* GetStampAnnotPr();
|
||||
CRedactAnnotPr* GetRedactAnnotPr();
|
||||
CLinkAnnotPr* GetLinkAnnotPr();
|
||||
CWidgetAnnotPr* GetWidgetAnnotPr();
|
||||
CMarkupAnnotPr* GetMarkupAnnotPr();
|
||||
CTextAnnotPr* GetTextAnnotPr();
|
||||
CInkAnnotPr* GetInkAnnotPr();
|
||||
CLineAnnotPr* GetLineAnnotPr();
|
||||
CTextMarkupAnnotPr* GetTextMarkupAnnotPr();
|
||||
CSquareCircleAnnotPr* GetSquareCircleAnnotPr();
|
||||
CPolygonLineAnnotPr* GetPolygonLineAnnotPr();
|
||||
CPopupAnnotPr* GetPopupAnnotPr();
|
||||
CFreeTextAnnotPr* GetFreeTextAnnotPr();
|
||||
CCaretAnnotPr* GetCaretAnnotPr();
|
||||
CStampAnnotPr* GetStampAnnotPr();
|
||||
CRedactAnnotPr* GetRedactAnnotPr();
|
||||
CLinkAnnotPr* GetLinkAnnotPr();
|
||||
CFileAttachmentAnnotPr* GetFileAttachmentAnnotPr();
|
||||
CScreenAnnotPr* GetScreenAnnotPr();
|
||||
CWidgetAnnotPr* GetWidgetAnnotPr();
|
||||
|
||||
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector);
|
||||
|
||||
@ -595,20 +668,22 @@ private:
|
||||
LONG m_nRenderLen;
|
||||
BYTE* m_pRender;
|
||||
|
||||
CMarkupAnnotPr* m_pMarkupPr;
|
||||
CTextAnnotPr* m_pTextPr;
|
||||
CInkAnnotPr* m_pInkPr;
|
||||
CLineAnnotPr* m_pLinePr;
|
||||
CTextMarkupAnnotPr* m_pTextMarkupPr;
|
||||
CSquareCircleAnnotPr* m_pSquareCirclePr;
|
||||
CPolygonLineAnnotPr* m_pPolygonLinePr;
|
||||
CPopupAnnotPr* m_pPopupPr;
|
||||
CFreeTextAnnotPr* m_pFreeTextPr;
|
||||
CCaretAnnotPr* m_pCaretPr;
|
||||
CStampAnnotPr* m_pStampPr;
|
||||
CRedactAnnotPr* m_pRedactPr;
|
||||
CLinkAnnotPr* m_pLinkPr;
|
||||
CWidgetAnnotPr* m_pWidgetPr;
|
||||
CMarkupAnnotPr* m_pMarkupPr;
|
||||
CTextAnnotPr* m_pTextPr;
|
||||
CInkAnnotPr* m_pInkPr;
|
||||
CLineAnnotPr* m_pLinePr;
|
||||
CTextMarkupAnnotPr* m_pTextMarkupPr;
|
||||
CSquareCircleAnnotPr* m_pSquareCirclePr;
|
||||
CPolygonLineAnnotPr* m_pPolygonLinePr;
|
||||
CPopupAnnotPr* m_pPopupPr;
|
||||
CFreeTextAnnotPr* m_pFreeTextPr;
|
||||
CCaretAnnotPr* m_pCaretPr;
|
||||
CStampAnnotPr* m_pStampPr;
|
||||
CRedactAnnotPr* m_pRedactPr;
|
||||
CLinkAnnotPr* m_pLinkPr;
|
||||
CFileAttachmentAnnotPr* m_pFileAttachmentPr;
|
||||
CScreenAnnotPr* m_pScreenPr;
|
||||
CWidgetAnnotPr* m_pWidgetPr;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CAnnotFieldDelete : public IAdvancedCommand
|
||||
@ -686,4 +761,17 @@ private:
|
||||
std::vector<SRedact*> m_arrRedact;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CRedactAnnot : public IAdvancedCommand
|
||||
{
|
||||
public:
|
||||
CRedactAnnot();
|
||||
|
||||
int GetID();
|
||||
|
||||
bool Read(NSOnlineOfficeBinToPdf::CBufferReader* pReader, IMetafileToRenderter* pCorrector);
|
||||
|
||||
private:
|
||||
int m_nID;
|
||||
};
|
||||
|
||||
#endif // _BUILD_ANNOTFIELD_H_
|
||||
|
||||
@ -201,5 +201,4 @@ private:
|
||||
std::vector<CHeading*> m_arrHeading;
|
||||
};
|
||||
|
||||
|
||||
#endif // _BUILD_DOCINFO_H_
|
||||
|
||||
@ -49,10 +49,10 @@
|
||||
|
||||
struct TBBox
|
||||
{
|
||||
float fMinX;
|
||||
float fMaxX;
|
||||
float fMinY;
|
||||
float fMaxY;
|
||||
float fMinX = 0;
|
||||
float fMaxX = 0;
|
||||
float fMinY = 0;
|
||||
float fMaxY = 0;
|
||||
};
|
||||
|
||||
struct TBBoxAdvance
|
||||
|
||||
5
DesktopEditor/graphics/pro/js/.gitignore
vendored
5
DesktopEditor/graphics/pro/js/.gitignore
vendored
@ -1,5 +0,0 @@
|
||||
deploy
|
||||
emsdk
|
||||
freetype-2.10.4
|
||||
o
|
||||
xml
|
||||
@ -1,41 +0,0 @@
|
||||
import sys
|
||||
sys.path.append("../../../../../build_tools/scripts")
|
||||
import base
|
||||
|
||||
base.configure_common_apps()
|
||||
|
||||
base.replaceInFile("../../../../Common/3dParty/icu/icu/source/common/udata.cpp", "\n{\n#ifdef BUILDING_WASM_MODULE\nreturn NULL;\n#endif\n UDataMemory tData;", "\n{\n UDataMemory tData;")
|
||||
base.replaceInFile("../../../../DesktopEditor/cximage/png/pnglibconf.h", "//#define PNG_CONSOLE_IO_SUPPORTED", "#define PNG_CONSOLE_IO_SUPPORTED")
|
||||
|
||||
base.replaceInFile("../../../../Common/3dParty/openssl/openssl/crypto/sha/sha512.c", "const SHA_LONG64 *W = (const SHA_LONG64*)in;", "const SHA_LONG64 *W = in;")
|
||||
|
||||
# finalize
|
||||
base.replaceInFile("./deploy/drawingfile.js", "function getBinaryPromise(", "function getBinaryPromise2(")
|
||||
base.replaceInFile("./deploy/drawingfile.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){window[\"AscViewer\"] && window[\"AscViewer\"][\"onLoadModule\"] && window[\"AscViewer\"][\"onLoadModule\"]();}];")
|
||||
base.replaceInFile("./deploy/drawingfile.js", "__ATPOSTRUN__ = [];", "__ATPOSTRUN__=[function(){window[\"AscViewer\"] && window[\"AscViewer\"][\"onLoadModule\"] && window[\"AscViewer\"][\"onLoadModule\"]();}];")
|
||||
base.replaceInFile("./deploy/drawingfile.js", "\"drawingfile.js.mem\"", "getMemoryPathIE(\"drawingfile.js.mem\")")
|
||||
|
||||
base.replaceInFile("./deploy/drawingfile_ie.js", "function getBinaryPromise(", "function getBinaryPromise2(")
|
||||
base.replaceInFile("./deploy/drawingfile_ie.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){window[\"AscViewer\"] && window[\"AscViewer\"][\"onLoadModule\"] && window[\"AscViewer\"][\"onLoadModule\"]();}];")
|
||||
base.replaceInFile("./deploy/drawingfile_ie.js", "__ATPOSTRUN__ = [];", "__ATPOSTRUN__=[function(){window[\"AscViewer\"] && window[\"AscViewer\"][\"onLoadModule\"] && window[\"AscViewer\"][\"onLoadModule\"]();}];")
|
||||
base.replaceInFile("./deploy/drawingfile_ie.js", "\"drawingfile.js.mem\"", "getMemoryPathIE(\"drawingfile.js.mem\")")
|
||||
|
||||
base.cmd_in_dir("../../../../Common/js", "python", ["./min.py", "./../../DesktopEditor/graphics/pro/js/deploy/drawingfile.js", "WHITESPACE_ONLY"])
|
||||
base.cmd_in_dir("../../../../Common/js", "python", ["./min.py", "./../../DesktopEditor/graphics/pro/js/deploy/drawingfile_ie.js", "WHITESPACE_ONLY"])
|
||||
|
||||
content_native_files = [
|
||||
"./wasm/js/stream.js",
|
||||
"./wasm/js/drawingfile.js"
|
||||
]
|
||||
|
||||
content_native = "(function(window, undefined) {\n"
|
||||
for item in content_native_files:
|
||||
content_native += base.readFile(item)
|
||||
content_native += "\n})(window, undefined);"
|
||||
content_native = content_native.replace("//file_internal", base.readFile("./wasm/js/drawingfile_native.js"))
|
||||
content_native = content_native.replace("//string_utf8", base.readFile("./../../../../Common/js/string_utf8.js"))
|
||||
base.writeFile("./deploy/drawingfile_native.js", content_native)
|
||||
base.cmd_in_dir("../../../../Common/js", "python", ["./min.py", "./../../DesktopEditor/graphics/pro/js/deploy/drawingfile_native.js", "WHITESPACE_ONLY"])
|
||||
|
||||
# base.delete_dir("./xml")
|
||||
# base.delete_dir("./freetype-2.10.4")
|
||||
@ -1,41 +0,0 @@
|
||||
import sys
|
||||
sys.path.append("../../../../../build_tools/scripts")
|
||||
sys.path.append("../../../../Common/js")
|
||||
import base
|
||||
import common
|
||||
|
||||
base.configure_common_apps()
|
||||
|
||||
if not base.is_dir("xml"):
|
||||
base.copy_dir("../../../xml", "./xml")
|
||||
base.replaceInFile("./xml/libxml2/libxml.h", "xmlNop(void)", "xmlNop(void* context, char* buffer, int len)")
|
||||
base.replaceInFile("./xml/libxml2/xmlIO.c", "xmlNop(void)", "xmlNop(void* context, char* buffer, int len)")
|
||||
base.replaceInFile("./xml/src/xmllight_private.h", "#include \"../../common/", "#include \"../../../../../common/")
|
||||
base.replaceInFile("./xml/src/xmllight_private.h", "#include \"../../../UnicodeConverter/", "#include \"../../../../../../UnicodeConverter/")
|
||||
base.replaceInFile("./xml/include/xmlutils.h", "#include \"../../common/", "#include \"../../../../../common/")
|
||||
base.replaceInFile("./xml/libxml2/globals.c", "int xmlGetWarningsDefaultValue = 1;", "int xmlGetWarningsDefaultValue = 0;")
|
||||
base.replaceInFile("./xml/libxml2/globals.c", "static int xmlGetWarningsDefaultValueThrDef = 1;", "static int xmlGetWarningsDefaultValueThrDef = 0;")
|
||||
|
||||
if not base.is_dir("freetype-2.10.4"):
|
||||
base.copy_dir("../../../freetype-2.10.4", "./freetype-2.10.4")
|
||||
# smooth
|
||||
base.copy_file("./freetype-2.10.4/src/smooth/ftgrays.c", "./freetype-2.10.4/src/smooth/ftgrays.cpp")
|
||||
common.apply_patch("./freetype-2.10.4/src/smooth/ftgrays.cpp", "./wasm/patches/ftgrays1.patch")
|
||||
common.apply_patch("./freetype-2.10.4/src/smooth/ftgrays.cpp", "./wasm/patches/ftgrays2.patch")
|
||||
common.apply_patch("./freetype-2.10.4/src/smooth/ftgrays.cpp", "./wasm/patches/ftgrays3.patch")
|
||||
base.copy_file("./freetype-2.10.4/src/smooth/smooth.c", "./freetype-2.10.4/src/smooth/smooth.cpp")
|
||||
common.apply_patch("./freetype-2.10.4/src/smooth/smooth.cpp", "./wasm/patches/smooth.patch")
|
||||
# ftobjs
|
||||
common.apply_patch("./freetype-2.10.4/src/base/ftobjs.c", "./wasm/patches/ftobjs1.patch")
|
||||
common.apply_patch("./freetype-2.10.4/src/base/ftobjs.c", "./wasm/patches/ftobjs2.patch")
|
||||
# ttcmap
|
||||
base.copy_file("./freetype-2.10.4/src/sfnt/ttcmap.c", "./freetype-2.10.4/src/sfnt/ttcmap.cpp")
|
||||
common.apply_patch("./freetype-2.10.4/src/sfnt/ttcmap.cpp", "./wasm/patches/ttcmap.patch")
|
||||
base.copy_file("./freetype-2.10.4/src/sfnt/sfnt.c", "./freetype-2.10.4/src/sfnt/sfnt.cpp")
|
||||
common.apply_patch("./freetype-2.10.4/src/sfnt/sfnt.cpp", "./wasm/patches/sfnt.patch")
|
||||
common.apply_patch("./freetype-2.10.4/builds/unix/ftsystem.c", "./wasm/patches/ftsystem.patch")
|
||||
|
||||
base.replaceInFile("../../../../Common/3dParty/icu/icu/source/common/udata.cpp", "\n{\n UDataMemory tData;", "\n{\n#ifdef BUILDING_WASM_MODULE\nreturn NULL;\n#endif\n UDataMemory tData;")
|
||||
base.replaceInFile("../../../../DesktopEditor/cximage/png/pnglibconf.h", "#define PNG_CONSOLE_IO_SUPPORTED", "//#define PNG_CONSOLE_IO_SUPPORTED")
|
||||
|
||||
base.replaceInFile("../../../../Common/3dParty/openssl/openssl/crypto/sha/sha512.c", "const SHA_LONG64 *W = in;", "const SHA_LONG64 *W = (const SHA_LONG64*)in;")
|
||||
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
sys.path.append("../../../../../build_tools/scripts")
|
||||
import base
|
||||
import os
|
||||
|
||||
base.configure_common_apps()
|
||||
|
||||
base.cmd_in_dir("./../../../../../core/Common/js", sys.executable, ["make.py", "./../../DesktopEditor/graphics/pro/js/drawingfile.json"])
|
||||
|
||||
src_dir = "./deploy/"
|
||||
dst_dir = "./../../../../../sdkjs/pdf/src/engine/"
|
||||
|
||||
base.delete_file(dst_dir + "drawingfile.js")
|
||||
base.delete_file(dst_dir + "drawingfile.wasm")
|
||||
base.delete_file(dst_dir + "drawingfile_ie.js")
|
||||
|
||||
base.copy_file(src_dir + "drawingfile.js", dst_dir + "drawingfile.js")
|
||||
base.copy_file(src_dir + "drawingfile.wasm", dst_dir + "drawingfile.wasm")
|
||||
base.copy_file(src_dir + "drawingfile_ie.js", dst_dir + "drawingfile_ie.js")
|
||||
base.copy_file(src_dir + "drawingfile_native.js", dst_dir + "drawingfile_native.js")
|
||||
@ -1,263 +0,0 @@
|
||||
{
|
||||
"name": "drawingfile",
|
||||
"res_folder": "./deploy",
|
||||
"wasm": true,
|
||||
"asm": true,
|
||||
"embed_mem_file": true,
|
||||
"run_before": "before.py",
|
||||
"run_after": "after.py",
|
||||
"base_js_content": "./wasm/js/drawingfile_base.js",
|
||||
"replaces" : {
|
||||
"stream" : "./wasm/js/stream.js",
|
||||
"file" : "./wasm/js/drawingfile.js",
|
||||
"file_internal" : "./wasm/js/drawingfile_wasm.js"
|
||||
},
|
||||
|
||||
"compiler_flags": [
|
||||
"-O3",
|
||||
"-fexceptions",
|
||||
"-Wno-unused-command-line-argument",
|
||||
"-Wno-register",
|
||||
"-s ALLOW_MEMORY_GROWTH=1",
|
||||
"-s FILESYSTEM=0",
|
||||
"-s ENVIRONMENT='web'",
|
||||
"-s LLD_REPORT_UNDEFINED"
|
||||
],
|
||||
"exported_functions": [
|
||||
"_malloc",
|
||||
"_free",
|
||||
"_GetType",
|
||||
"_Open",
|
||||
"_Close",
|
||||
"_GetErrorCode",
|
||||
"_GetInfo",
|
||||
"_GetPixmap",
|
||||
"_GetGlyphs",
|
||||
"_GetLinks",
|
||||
"_GetStructure",
|
||||
"_GetInteractiveFormsInfo",
|
||||
"_GetInteractiveFormsFonts",
|
||||
"_GetInteractiveFormsAP",
|
||||
"_GetButtonIcons",
|
||||
"_GetAnnotationsInfo",
|
||||
"_GetAnnotationsAP",
|
||||
"_InitializeFontsBin",
|
||||
"_InitializeFontsBase64",
|
||||
"_InitializeFontsRanges",
|
||||
"_SetFontBinary",
|
||||
"_GetFontBinary",
|
||||
"_GetGIDByUnicode",
|
||||
"_IsFontBinaryExist",
|
||||
"_DestroyTextInfo",
|
||||
"_IsNeedCMap",
|
||||
"_SetCMapData",
|
||||
"_SetScanPageFonts",
|
||||
"_ScanPage",
|
||||
"_SplitPages",
|
||||
"_MergePages",
|
||||
"_UnmergePages",
|
||||
"_RedactPage",
|
||||
"_UndoRedact",
|
||||
"_CheckOwnerPassword",
|
||||
"_CheckPerm",
|
||||
"_GetImageBase64",
|
||||
"_GetImageBase64Len",
|
||||
"_GetImageBase64Ptr",
|
||||
"_GetImageBase64Free"
|
||||
],
|
||||
"include_path": [
|
||||
"wasm/src/lib",
|
||||
"../../../agg-2.4/include",
|
||||
"../../../cximage/jasper/include", "../../../cximage/jpeg", "../../../cximage/png",
|
||||
"freetype-2.10.4/include", "freetype-2.10.4/include/freetype",
|
||||
"../../../../OfficeUtils/src/zlib-1.2.11", "../../../../OfficeUtils/src/zlib-1.2.11/contrib/minizip", "../../../../OfficeUtils/src",
|
||||
"../../../../Common/3dParty/icu/icu/source/common",
|
||||
"../../../xml/libxml2/include", "../../../xml/build/qt",
|
||||
"../../../../PdfFile/lib/goo", "../../../../PdfFile/lib/fofi", "../../../../PdfFile/lib/splash", "../../../../PdfFile/lib",
|
||||
"../../../raster/Jp2/openjpeg", "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2",
|
||||
"../../../../Common/3dParty/openssl/openssl/include",
|
||||
"../../../../Common/3dParty/openssl/build/linux_64/include",
|
||||
"../../../../DocxRenderer"
|
||||
],
|
||||
"define": [
|
||||
"__linux__", "_LINUX", "UNIX",
|
||||
"FT2_BUILD_LIBRARY", "HAVE_FCNTL_H",
|
||||
"FT_CONFIG_OPTION_SYSTEM_ZLIB",
|
||||
"BUILDING_WASM_MODULE",
|
||||
"U_COMMON_IMPLEMENTATION",
|
||||
"errno=0", "THREADMODEL=0", "DEBUGLVL=0",
|
||||
"HAVE_MBSTATE_T", "HAVE_STDINCLUDES", "HAS_WCHAR", "HAVE_VA_COPY",
|
||||
"LIBXML_READER_ENABLED", "LIBXML_PUSH_ENABLED", "LIBXML_HTML_ENABLED",
|
||||
"LIBXML_XPATH_ENABLED", "LIBXML_OUTPUT_ENABLED", "LIBXML_C14N_ENABLED",
|
||||
"LIBXML_SAX1_ENABLED", "LIBXML_TREE_ENABLED", "LIBXML_XPTR_ENABLED",
|
||||
"XML_ERROR_DISABLE_MODE", "IN_LIBXML", "LIBXML_STATIC", "BUILD_ZLIB_AS_SOURCES",
|
||||
"_ARM_ALIGN_",
|
||||
"_tcsnicmp=strncmp", "_lseek=lseek", "_getcwd=getcwd",
|
||||
"NO_CONSOLE_IO", "USE_EXTERNAL_JPEG2000", "USE_JPIP", "OPJ_STATIC", "FONT_ENGINE_DISABLE_FILESYSTEM",
|
||||
"IMAGE_CHECKER_DISABLE_XML",
|
||||
"USE_OPENSSL_HASH",
|
||||
"DISABLE_FULL_DOCUMENT_CREATION", "DISABLE_FILESYSTEM", "CRYPTOPP_DISABLE_ASM", "DISABLE_TYPE_MISMATCH"
|
||||
],
|
||||
"compile_files_array": [
|
||||
{
|
||||
"folder": "../../../raster/",
|
||||
"files": ["BgraFrame.cpp", "ImageFileFormatChecker.cpp", "PICT/PICFile.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/CxImage/",
|
||||
"files": ["ximaenc.cpp", "ximaexif.cpp", "ximage.cpp", "ximainfo.cpp", "ximajpg.cpp", "ximalpha.cpp", "ximapal.cpp", "ximasel.cpp", "xmemfile.cpp", "ximapng.cpp", "ximabmp.cpp", "ximatran.cpp", "ximatif.cpp", "tif_xfile.cpp", "ximajas.cpp", "ximagif.cpp", "ximaico.cpp", "ximatga.cpp", "ximapcx.cpp", "ximawbmp.cpp", "ximamng.cpp", "ximapsd.cpp", "ximaska.cpp", "ximaraw.cpp", "ximaint.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/jpeg/",
|
||||
"files": ["jerror.c", "jdmarker.c", "jdapimin.c", "jdmaster.c", "jdapistd.c", "jcomapi.c", "jutils.c", "jdinput.c", "jdmainct.c", "jmemmgr.c", "jquant1.c", "jquant2.c", "jdmerge.c", "jdcolor.c", "jdsample.c", "jdpostct.c", "jddctmgr.c", "jdarith.c", "jdhuff.c", "jdcoefct.c", "jmemnobs.c", "jidctint.c", "jidctfst.c", "jidctflt.c", "jaricom.c", "jcapimin.c", "jcparam.c", "jcapistd.c", "jcinit.c", "jcmaster.c", "jccolor.c", "jcmarker.c", "jcsample.c", "jcprepct.c", "jcdctmgr.c", "jcarith.c", "jchuff.c", "jccoefct.c", "jcmainct.c", "jfdctint.c", "jfdctfst.c", "jfdctflt.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/png/",
|
||||
"files": ["pngread.c", "pngmem.c", "pngerror.c", "png.c", "pngrio.c", "pngtrans.c", "pngget.c", "pngrutil.c", "pngrtran.c", "pngset.c", "pngwrite.c", "pngwio.c", "pngwutil.c", "pngwtran.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/tiff/",
|
||||
"files": ["tif_close.c", "tif_dir.c", "tif_aux.c", "tif_getimage.c", "tif_strip.c", "tif_open.c", "tif_tile.c", "tif_error.c", "tif_read.c", "tif_flush.c", "tif_dirinfo.c", "tif_compress.c", "tif_warning.c", "tif_swab.c", "tif_color.c", "tif_dirread.c", "tif_write.c", "tif_codec.c", "tif_luv.c", "tif_dirwrite.c", "tif_dumpmode.c", "tif_fax3.c", "tif_ojpeg.c", "tif_jpeg.c", "tif_next.c", "tif_thunder.c", "tif_packbits.c", "tif_lzw.c", "tif_zip.c", "tif_fax3sm.c", "tif_predict.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/jasper/",
|
||||
"files": ["base/jas_init.c", "base/jas_stream.c", "base/jas_malloc.c", "base/jas_image.c", "base/jas_cm.c", "base/jas_seq.c", "base/jas_string.c", "base/jas_icc.c", "base/jas_debug.c", "base/jas_iccdata.c", "base/jas_tvp.c", "base/jas_version.c", "mif/mif_cod.c", "pnm/pnm_dec.c", "pnm/pnm_enc.c", "pnm/pnm_cod.c", "bmp/bmp_dec.c", "bmp/bmp_enc.c", "bmp/bmp_cod.c", "ras/ras_dec.c", "ras/ras_enc.c", "jp2/jp2_dec.c", "jp2/jp2_enc.c", "jp2/jp2_cod.c", "jpc/jpc_cs.c", "jpc/jpc_enc.c", "jpc/jpc_dec.c", "jpc/jpc_t1cod.c", "jpc/jpc_math.c", "jpc/jpc_util.c", "jpc/jpc_tsfb.c", "jpc/jpc_mct.c", "jpc/jpc_t1enc.c", "jpc/jpc_t1dec.c", "jpc/jpc_bs.c", "jpc/jpc_t2cod.c", "jpc/jpc_t2enc.c", "jpc/jpc_t2dec.c", "jpc/jpc_tagtree.c", "jpc/jpc_mqenc.c", "jpc/jpc_mqdec.c", "jpc/jpc_mqcod.c", "jpc/jpc_qmfb.c", "jpg/jpg_val.c", "jpg/jpg_dummy.c", "pgx/pgx_dec.c", "pgx/pgx_enc.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../raster/Jp2/",
|
||||
"files": ["J2kFile.cpp", "Reader.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/mng/",
|
||||
"files": ["libmng_hlapi.c", "libmng_callback_xs.c", "libmng_prop_xs.c", "libmng_object_prc.c", "libmng_zlib.c", "libmng_jpeg.c", "libmng_pixels.c", "libmng_read.c", "libmng_error.c", "libmng_display.c", "libmng_write.c", "libmng_chunk_io.c", "libmng_cms.c", "libmng_filter.c", "libmng_chunk_prc.c", "libmng_chunk_xs.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/libpsd/",
|
||||
"files": ["psd.c", "file_header.c", "color_mode.c", "image_resource.c", "blend.c", "layer_mask.c", "image_data.c", "stream.c", "psd_system.c", "color.c", "pattern_fill.c", "color_balance.c", "channel_image.c", "gradient_fill.c", "invert.c", "posterize.c", "brightness_contrast.c", "solid_color.c", "threshold.c", "effects.c", "selective_color.c", "channel_mixer.c", "photo_filter.c", "type_tool.c", "gradient_map.c", "hue_saturation.c", "levels.c", "curves.c", "pattern.c", "psd_zip.c", "descriptor.c", "drop_shadow.c", "inner_shadow.c", "color_overlay.c", "outer_glow.c", "inner_glow.c", "bevel_emboss.c", "satin.c", "gradient_overlay.c", "stroke.c", "pattern_overlay.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../cximage/raw/",
|
||||
"files": ["libdcr.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../raster/JBig2/source/",
|
||||
"files": ["JBig2File.cpp", "Encoder/jbig2enc.cpp", "Encoder/jbig2arith.cpp", "Encoder/jbig2sym.cpp", "LeptonLib/pixconv.cpp", "LeptonLib/writefile.cpp", "LeptonLib/scale.cpp", "LeptonLib/pix1.cpp", "LeptonLib/pix2.cpp", "LeptonLib/pix3.cpp", "LeptonLib/pix4.cpp", "LeptonLib/pix5.cpp", "LeptonLib/grayquant.cpp", "LeptonLib/grayquantlow.cpp", "LeptonLib/seedfill.cpp", "LeptonLib/jbclass.cpp", "LeptonLib/pixabasic.cpp", "LeptonLib/numabasic.cpp", "LeptonLib/morphseq.cpp", "LeptonLib/binexpandlow.cpp", "LeptonLib/ptabasic.cpp", "LeptonLib/rop.cpp", "LeptonLib/colormap.cpp", "LeptonLib/pngiostub.cpp", "LeptonLib/lepton_utils.cpp", "LeptonLib/scalelow.cpp", "LeptonLib/enhance.cpp", "LeptonLib/jpegio.cpp", "LeptonLib/jpegiostub.cpp", "LeptonLib/spixio.cpp", "LeptonLib/webpio.cpp", "LeptonLib/webpiostub.cpp", "LeptonLib/psio2.cpp", "LeptonLib/gifio.cpp", "LeptonLib/gifiostub.cpp", "LeptonLib/pnmio.cpp", "LeptonLib/tiffio.cpp", "LeptonLib/tiffiostub.cpp", "LeptonLib/bmpio.cpp", "LeptonLib/binexpand.cpp", "LeptonLib/compare.cpp", "LeptonLib/boxbasic.cpp", "LeptonLib/conncomp.cpp", "LeptonLib/pixafunc1.cpp", "LeptonLib/boxfunc1.cpp", "LeptonLib/ptafunc1.cpp", "LeptonLib/binreduce.cpp", "LeptonLib/seedfilllow.cpp", "LeptonLib/sel1.cpp", "LeptonLib/morphapp.cpp", "LeptonLib/correlscore.cpp", "LeptonLib/sarray.cpp", "LeptonLib/morph.cpp", "LeptonLib/roplow.cpp", "LeptonLib/fpix1.cpp", "LeptonLib/stack.cpp", "LeptonLib/pixacc.cpp", "LeptonLib/pixarith.cpp", "LeptonLib/convolve.cpp", "LeptonLib/binreducelow.cpp", "LeptonLib/convolvelow.cpp", "LeptonLib/arithlow.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "./wasm/src/",
|
||||
"files": ["lib/wasm_jmp.cpp", "drawingfile.cpp", "metafile.cpp", "HTMLRendererText.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "freetype-2.10.4/src/",
|
||||
"files": ["base/ftdebug.c","autofit/autofit.c","bdf/bdf.c","cff/cff.c","base/ftbase.c","base/ftbitmap.c","base/ftfstype.c","base/ftgasp.c","cache/ftcache.c","base/ftglyph.c","gzip/ftgzip.c","base/ftinit.c","lzw/ftlzw.c","base/ftstroke.c","base/ftsystem.c","smooth/smooth.cpp","base/ftbbox.c","base/ftbdf.c","base/ftcid.c","base/ftmm.c","base/ftpfr.c","base/ftsynth.c","base/fttype1.c","base/ftwinfnt.c","base/ftgxval.c","base/ftotval.c","base/ftpatent.c","pcf/pcf.c","pfr/pfr.c","psaux/psaux.c","pshinter/pshinter.c","psnames/psmodule.c","raster/raster.c","sfnt/sfnt.cpp","truetype/truetype.c","type1/type1.c","cid/type1cid.c","type42/type42.c","winfonts/winfnt.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../",
|
||||
"files": ["GraphicsRenderer.cpp", "pro/pro_Graphics.cpp", "pro/pro_Fonts.cpp", "pro/pro_Image.cpp", "Graphics.cpp", "Brush.cpp", "BaseThread.cpp", "GraphicsPath.cpp", "BooleanOperations.cpp", "Image.cpp", "Matrix.cpp", "Clip.cpp", "TemporaryCS.cpp", "AlphaMask.cpp", "GraphicsLayer.cpp", "commands/DocInfo.cpp", "commands/AnnotField.cpp", "commands/FormField.cpp", "MetafileToRenderer.cpp", "MetafileToRendererReader.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../fontengine/",
|
||||
"files": ["GlyphString.cpp", "FontManager.cpp", "FontFile.cpp", "FontPath.cpp", "ApplicationFonts.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../agg-2.4/src/",
|
||||
"files": ["agg_arc.cpp", "agg_vcgen_stroke.cpp", "agg_vcgen_dash.cpp", "agg_trans_affine.cpp", "agg_curves.cpp", "agg_image_filters.cpp", "agg_bezier_arc.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../common/",
|
||||
"files": ["File.cpp", "Directory.cpp", "ByteBuilder.cpp", "Base64.cpp", "StringExt.cpp", "Path.cpp", "SystemUtils.cpp", "StringUTF32.cpp", "StringBuilder.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../Common/3dParty/icu/icu/source/common/",
|
||||
"files": ["ustr_wcs.cpp", "ustrtrns.cpp", "udata.cpp", "ucnv_io.cpp", "ustring.cpp", "umutex.cpp", "putil.cpp", "ustr_cnv.cpp", "ucnvmbcs.cpp", "ucln_cmn.cpp", "ucnv2022.cpp", "ucnvbocu.cpp", "stringpiece.cpp", "charstr.cpp", "ucnv_ext.cpp", "uobject.cpp", "usprep.cpp", "unistr.cpp", "uniset_props.cpp", "loadednormalizer2impl.cpp", "filterednormalizer2.cpp", "utrie2.cpp", "normalizer2.cpp", "normalizer2impl.cpp", "utrie.cpp", "ucase.cpp", "uniset.cpp", "ruleiter.cpp", "parsepos.cpp", "util.cpp", "uprops.cpp", "uvector.cpp", "unames.cpp", "propname.cpp", "utrie2_builder.cpp", "unifunct.cpp", "bmpset.cpp", "unisetspan.cpp", "unifilt.cpp", "patternprops.cpp", "ustrcase.cpp", "bytestrie.cpp", "utf_impl.cpp", "cmemory.cpp", "uhash.cpp", "udatamem.cpp", "umapfile.cpp", "uinvchar.cpp", "uchar.cpp", "ubidi_props.cpp", "characterproperties.cpp", "ucptrie.cpp", "edits.cpp", "umutablecptrie.cpp", "bytesinkutil.cpp", "emojiprops.cpp", "cstring.cpp", "ucmndata.cpp", "ucnv.cpp", "ucnv_u7.cpp", "ucnv_u8.cpp", "ucnv_u16.cpp", "ucnv_u32.cpp", "ucnv_err.cpp", "ucnv_cnv.cpp", "ucnv_lmb.cpp", "ucnv_cb.cpp", "ucnv_ct.cpp", "ucharstrieiterator.cpp", "ucnvlat1.cpp", "uvectr32.cpp", "ucnvhz.cpp", "ucnvscsu.cpp", "ucnv_bld.cpp", "ucnvisci.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../Common/3dParty/cryptopp/",
|
||||
"files": ["cryptlib.cpp", "cpu.cpp", "integer.cpp", "3way.cpp", "adler32.cpp", "algebra.cpp", "algparam.cpp", "allocate.cpp", "arc4.cpp", "aria.cpp", "aria_simd.cpp", "ariatab.cpp", "asn.cpp", "authenc.cpp", "base32.cpp", "base64.cpp", "basecode.cpp", "bfinit.cpp", "blake2.cpp", "blake2s_simd.cpp", "blake2b_simd.cpp", "blowfish.cpp", "blumshub.cpp", "camellia.cpp", "cast.cpp", "casts.cpp", "cbcmac.cpp", "ccm.cpp", "chacha.cpp", "chacha_simd.cpp", "chacha_avx.cpp", "chachapoly.cpp", "cham.cpp", "cham_simd.cpp", "channels.cpp", "cmac.cpp", "crc.cpp", "crc_simd.cpp", "darn.cpp", "default.cpp", "des.cpp", "dessp.cpp", "dh.cpp", "dh2.cpp", "dll.cpp", "donna_32.cpp", "donna_64.cpp", "donna_sse.cpp", "dsa.cpp", "eax.cpp", "ec2n.cpp", "ecp.cpp", "eccrypto.cpp", "eprecomp.cpp", "elgamal.cpp", "emsa2.cpp", "eprecomp.cpp", "esign.cpp", "files.cpp", "filters.cpp", "fips140.cpp", "gcm.cpp", "gcm_simd.cpp", "gf256.cpp", "gf2_32.cpp", "gf2n.cpp", "gf2n_simd.cpp", "gfpcrypt.cpp", "gost.cpp", "gzip.cpp", "hc128.cpp", "hc256.cpp", "hex.cpp", "hight.cpp", "hmac.cpp", "hrtimer.cpp", "ida.cpp", "idea.cpp", "iterhash.cpp", "kalyna.cpp", "md5.cpp", "randpool.cpp", "osrng.cpp", "rijndael.cpp", "modes.cpp", "misc.cpp", "rdtables.cpp", "sha.cpp", "mqueue.cpp", "queue.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../OfficeUtils/src/",
|
||||
"files": ["OfficeUtils.cpp", "ZipBuffer.cpp", "ZipUtilsCP.cpp", "zlib_addon.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../OfficeUtils/src/zlib-1.2.11/contrib/minizip/",
|
||||
"files": ["ioapi.c", "miniunz.c", "minizip.c", "mztools.c", "unzip.c", "zip.c", "ioapibuf.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../OfficeUtils/src/zlib-1.2.11/",
|
||||
"files": ["adler32.c", "crc32.c", "deflate.c", "infback.c", "inffast.c", "inflate.c", "inftrees.c", "trees.c", "zutil.c", "compress.c"]
|
||||
},
|
||||
{
|
||||
"folder": "./",
|
||||
"files": ["xml/src/xmllight.cpp", "xml/src/xmldom.cpp", "xml/build/qt/libxml2_all.c", "xml/build/qt/libxml2_all2.c"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/",
|
||||
"files": ["PdfFile.cpp", "PdfReader.cpp", "PdfWriter.cpp", "PdfEditor.cpp", "OnlineOfficeBinToPdf.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/SrcReader/",
|
||||
"files": ["Adaptors.cpp", "GfxClip.cpp", "RendererOutputDev.cpp", "JPXStream2.cpp", "PdfAnnot.cpp", "PdfFont.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/SrcWriter/",
|
||||
"files": ["AcroForm.cpp", "Annotation.cpp", "Catalog.cpp", "Destination.cpp", "Document.cpp", "Encrypt.cpp", "EncryptDictionary.cpp", "Field.cpp", "Font.cpp", "Font14.cpp", "FontCidTT.cpp", "FontOTWriter.cpp", "FontTT.cpp", "FontTTWriter.cpp", "GState.cpp", "Image.cpp", "Info.cpp", "Metadata.cpp", "Objects.cpp", "Outline.cpp", "Pages.cpp", "Pattern.cpp", "ResourcesDictionary.cpp", "Shading.cpp", "States.cpp", "Streams.cpp", "Utils.cpp", "RedactOutputDev.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/Resources/",
|
||||
"files": ["BaseFonts.cpp", "CMapMemory/cmap_memory.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../PdfFile/lib/",
|
||||
"files": ["fofi/FoFiBase.cc", "fofi/FoFiEncodings.cc", "fofi/FoFiIdentifier.cc", "fofi/FoFiTrueType.cc", "fofi/FoFiType1.cc", "fofi/FoFiType1C.cc", "goo/FixedPoint.cc", "goo/gfile.cc", "goo/GHash.cc", "goo/GList.cc", "goo/gmem.cc", "goo/gmempp.cc", "goo/GString.cc", "goo/parseargs.c", "goo/Trace.cc", "splash/Splash.cc", "splash/SplashBitmap.cc", "splash/SplashClip.cc", "splash/SplashFont.cc", "splash/SplashFontEngine.cc", "splash/SplashFontFile.cc", "splash/SplashFontFileID.cc", "splash/SplashFTFont.cc", "splash/SplashFTFontEngine.cc", "splash/SplashFTFontFile.cc", "splash/SplashPath.cc", "splash/SplashPattern.cc", "splash/SplashScreen.cc", "splash/SplashState.cc", "splash/SplashXPath.cc", "splash/SplashXPathScanner.cc", "xpdf/AcroForm.cc", "xpdf/Annot.cc", "xpdf/Array.cc", "xpdf/BuiltinFont.cc", "xpdf/BuiltinFontTables.cc", "xpdf/Catalog.cc", "xpdf/CharCodeToUnicode.cc", "xpdf/CMap.cc", "xpdf/Decrypt.cc", "xpdf/Dict.cc", "xpdf/DisplayState.cc", "xpdf/Error.cc", "xpdf/FontEncodingTables.cc", "xpdf/Function.cc", "xpdf/Gfx.cc", "xpdf/GfxFont.cc", "xpdf/GfxState.cc", "xpdf/GlobalParams.cc", "xpdf/ImageOutputDev.cc", "xpdf/JArithmeticDecoder.cc", "xpdf/JBIG2Stream.cc", "xpdf/JPXStream.cc", "xpdf/Lexer.cc", "xpdf/Link.cc", "xpdf/NameToCharCode.cc", "xpdf/Object.cc", "xpdf/OptionalContent.cc", "xpdf/Outline.cc", "xpdf/OutputDev.cc", "xpdf/Page.cc", "xpdf/Parser.cc", "xpdf/PDF417Barcode.cc", "xpdf/PDFCore.cc", "xpdf/PDFDoc.cc", "xpdf/PDFDocEncoding.cc", "xpdf/PreScanOutputDev.cc", "xpdf/PSOutputDev.cc", "xpdf/PSTokenizer.cc", "xpdf/SecurityHandler.cc", "xpdf/ShadingImage.cc", "xpdf/SplashOutputDev.cc", "xpdf/Stream.cc", "xpdf/TextOutputDev.cc", "xpdf/TextString.cc", "xpdf/TileCache.cc", "xpdf/TileCompositor.cc", "xpdf/TileMap.cc", "xpdf/UnicodeMap.cc", "xpdf/UnicodeRemapping.cc", "xpdf/UnicodeTypeTable.cc", "xpdf/UTF8.cc", "xpdf/WebFont.cc", "xpdf/XFAScanner.cc", "xpdf/XRef.cc", "xpdf/Zoox.cc"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2/",
|
||||
"files": ["bio.c", "cidx_manager.c", "cio.c", "dwt.c", "event.c", "function_list.c", "image.c", "invert.c", "j2k.c", "jp2.c", "mct.c", "mqc.c", "openjpeg.c", "opj_clock.c", "opj_malloc.c", "phix_manager.c", "pi.c", "ppix_manager.c", "sparse_array.c", "t1.c", "t2.c", "tcd.c", "tgt.c", "thix_manager.c", "thread.c", "tpix_manager.c", "../../../../opj_bgraframe.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../XpsFile/",
|
||||
"files": ["XpsFile.cpp", "XpsLib/Document.cpp", "XpsLib/XpsPage.cpp", "XpsLib/StaticResources.cpp", "XpsLib/Utils.cpp", "XpsLib/WString.cpp", "XpsLib/ContextState.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../DjVuFile/libdjvu/",
|
||||
"files": ["../DjVu.cpp", "../DjVuFileImplementation.cpp", "Arrays.cpp", "BSByteStream.cpp", "BSEncodeByteStream.cpp", "ByteStream.cpp", "DataPool.cpp", "debug.cpp", "DjVmDir.cpp", "DjVmDir0.cpp", "DjVmDoc.cpp", "DjVmNav.cpp", "DjVuAnno.cpp", "DjVuDocEditor.cpp", "DjVuDocument.cpp", "DjVuDumpHelper.cpp", "DjVuErrorList.cpp", "DjVuFile.cpp", "DjVuFileCache.cpp", "DjVuGlobal.cpp", "DjVuGlobalMemory.cpp", "DjVuImage.cpp", "DjVuInfo.cpp", "DjVuMessageLite.cpp", "DjVuNavDir.cpp", "DjVuPalette.cpp", "DjVuPort.cpp", "DjVuText.cpp", "DjVuToPS.cpp", "GBitmap.cpp", "GContainer.cpp", "GException.cpp", "GIFFManager.cpp", "GMapAreas.cpp", "GPixmap.cpp", "GRect.cpp", "GScaler.cpp", "GSmartPointer.cpp", "GString.cpp", "GThreads.cpp", "GUnicode.cpp", "IFFByteStream.cpp", "IW44EncodeCodec.cpp", "IW44Image.cpp", "JB2EncodeCodec.cpp", "JB2Image.cpp", "JPEGDecoder.cpp", "MMRDecoder.cpp", "MMX.cpp", "UnicodeByteStream.cpp", "XMLParser.cpp", "XMLTags.cpp", "ZPCodec.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../DjVuFile/wasm/libdjvu/",
|
||||
"files": ["atomic.cpp", "DjVuMessage.cpp", "GOS.cpp", "GURL.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../",
|
||||
"files": ["officedrawingfile.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../UnicodeConverter/",
|
||||
"files": ["UnicodeConverter.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../DocxRenderer/",
|
||||
"files": ["DocxRenderer.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../DocxRenderer/src/resources",
|
||||
"files": ["VectorGraphics.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../DocxRenderer/src/logic",
|
||||
"files": ["styles/FontStyle.cpp", "styles/ParagraphStyle.cpp", "Page.cpp", "Document.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../DocxRenderer/src/logic/managers",
|
||||
"files": ["FontManager.cpp", "FontStyleManager.cpp", "ImageManager.cpp", "ParagraphStyleManager.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../DocxRenderer/src/logic/elements",
|
||||
"files": ["BaseItem.cpp", "ContText.cpp", "Paragraph.cpp", "Shape.cpp", "TextLine.cpp", "Table.cpp"]
|
||||
},
|
||||
{
|
||||
"folder": "../../../../OdfFile/Common",
|
||||
"files": ["logging.cpp"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,276 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
sys.path.append("../../../../../build_tools/scripts")
|
||||
import base
|
||||
import os
|
||||
import json
|
||||
|
||||
def apply_patch(file, patch):
|
||||
file_content = base.readFile(file)
|
||||
patch_content = base.readFile(patch)
|
||||
index1 = patch_content.find("<<<<<<<")
|
||||
index2 = patch_content.find("=======")
|
||||
index3 = patch_content.find(">>>>>>>")
|
||||
file_content_old = patch_content[index1 + 7:index2]
|
||||
file_content_new = "\n#if 0" + file_content_old + "#else" + patch_content[index2 + 7:index3] + "#endif\n"
|
||||
base.replaceInFile(file, file_content_old, file_content_new)
|
||||
return
|
||||
|
||||
if not base.is_file("./raster.o"):
|
||||
base.cmd("python", ["raster_make.py"])
|
||||
if not base.is_file("./raster.o"):
|
||||
print("raster_make.py error")
|
||||
exit(0)
|
||||
|
||||
base.configure_common_apps()
|
||||
|
||||
# remove previous version
|
||||
if base.is_dir("./deploy"):
|
||||
base.delete_dir("./deploy")
|
||||
base.create_dir("./deploy")
|
||||
if base.is_dir("./o"):
|
||||
base.delete_dir("./o")
|
||||
base.create_dir("./o")
|
||||
|
||||
# fetch emsdk
|
||||
command_prefix = "" if ("windows" == base.host_platform()) else "./"
|
||||
if not base.is_dir("emsdk"):
|
||||
base.cmd("git", ["clone", "https://github.com/emscripten-core/emsdk.git"])
|
||||
os.chdir("emsdk")
|
||||
base.cmd(command_prefix + "emsdk", ["install", "latest"])
|
||||
base.cmd(command_prefix + "emsdk", ["activate", "latest"])
|
||||
os.chdir("../")
|
||||
|
||||
if not base.is_dir("xml"):
|
||||
base.copy_dir("../../../xml", "./xml")
|
||||
base.replaceInFile("./xml/libxml2/libxml.h", "xmlNop(void)", "xmlNop(void* context, char* buffer, int len)")
|
||||
base.replaceInFile("./xml/libxml2/xmlIO.c", "xmlNop(void)", "xmlNop(void* context, char* buffer, int len)")
|
||||
base.replaceInFile("./xml/src/xmllight_private.h", "#include \"../../common/", "#include \"../../../../../common/")
|
||||
base.replaceInFile("./xml/include/xmlutils.h", "#include \"../../common/", "#include \"../../../../../common/")
|
||||
|
||||
if not base.is_dir("freetype-2.10.4"):
|
||||
base.copy_dir("../../../freetype-2.10.4", "./freetype-2.10.4")
|
||||
# smooth
|
||||
base.copy_file("./freetype-2.10.4/src/smooth/ftgrays.c", "./freetype-2.10.4/src/smooth/ftgrays.cpp");
|
||||
apply_patch("./freetype-2.10.4/src/smooth/ftgrays.cpp", "./wasm/patches/ftgrays1.patch")
|
||||
apply_patch("./freetype-2.10.4/src/smooth/ftgrays.cpp", "./wasm/patches/ftgrays2.patch")
|
||||
apply_patch("./freetype-2.10.4/src/smooth/ftgrays.cpp", "./wasm/patches/ftgrays3.patch")
|
||||
base.copy_file("./freetype-2.10.4/src/smooth/smooth.c", "./freetype-2.10.4/src/smooth/smooth.cpp");
|
||||
apply_patch("./freetype-2.10.4/src/smooth/smooth.cpp", "./wasm/patches/smooth.patch")
|
||||
# ftobjs
|
||||
apply_patch("./freetype-2.10.4/src/base/ftobjs.c", "./wasm/patches/ftobjs1.patch")
|
||||
apply_patch("./freetype-2.10.4/src/base/ftobjs.c", "./wasm/patches/ftobjs2.patch")
|
||||
# ttcmap
|
||||
base.copy_file("./freetype-2.10.4/src/sfnt/ttcmap.c", "./freetype-2.10.4/src/sfnt/ttcmap.cpp");
|
||||
apply_patch("./freetype-2.10.4/src/sfnt/ttcmap.cpp", "./wasm/patches/ttcmap.patch")
|
||||
base.copy_file("./freetype-2.10.4/src/sfnt/sfnt.c", "./freetype-2.10.4/src/sfnt/sfnt.cpp");
|
||||
apply_patch("./freetype-2.10.4/src/sfnt/sfnt.cpp", "./wasm/patches/sfnt.patch")
|
||||
|
||||
# compile
|
||||
compiler_flags = ["-O3",
|
||||
# "-fno-rtti", cryptopp uses typeid
|
||||
"-fexceptions",
|
||||
"-Wno-unused-command-line-argument",
|
||||
"-s WASM=1",
|
||||
"-s ALLOW_MEMORY_GROWTH=1",
|
||||
"-s FILESYSTEM=0",
|
||||
"-s ENVIRONMENT='web'",
|
||||
"-s LLD_REPORT_UNDEFINED"]
|
||||
|
||||
exported_functions = ["_malloc",
|
||||
"_free",
|
||||
"_GetType",
|
||||
"_Open",
|
||||
"_Close",
|
||||
"_GetErrorCode",
|
||||
"_GetInfo",
|
||||
"_GetPixmap",
|
||||
"_GetGlyphs",
|
||||
"_GetLinks",
|
||||
"_GetStructure",
|
||||
"_InitializeFontsBin",
|
||||
"_InitializeFontsBase64",
|
||||
"_SetFontBinary",
|
||||
"_IsFontBinaryExist"]
|
||||
|
||||
compile_files_array = []
|
||||
|
||||
compile_files_array.append("lib")
|
||||
compile_files_array.append("./")
|
||||
compile_files_array.append(["wasm/src/lib/wasm_jmp.cpp"])
|
||||
|
||||
compile_files_array.append("f")
|
||||
compile_files_array.append("freetype-2.10.4/src/")
|
||||
compile_files_array.append(["base/ftdebug.c","autofit/autofit.c","bdf/bdf.c","cff/cff.c","base/ftbase.c","base/ftbitmap.c","base/ftfstype.c","base/ftgasp.c","cache/ftcache.c","base/ftglyph.c","gzip/ftgzip.c","base/ftinit.c","lzw/ftlzw.c","base/ftstroke.c","base/ftsystem.c","smooth/smooth.cpp","base/ftbbox.c","base/ftbdf.c","base/ftcid.c","base/ftmm.c","base/ftpfr.c","base/ftsynth.c","base/fttype1.c","base/ftwinfnt.c","base/ftgxval.c","base/ftotval.c","base/ftpatent.c","pcf/pcf.c","pfr/pfr.c","psaux/psaux.c","pshinter/pshinter.c","psnames/psmodule.c","raster/raster.c","sfnt/sfnt.cpp","truetype/truetype.c","type1/type1.c","cid/type1cid.c","type42/type42.c","winfonts/winfnt.c"])
|
||||
|
||||
compile_files_array.append("g")
|
||||
compile_files_array.append("../../")
|
||||
compile_files_array.append(["GraphicsRenderer.cpp", "pro/pro_Graphics.cpp", "pro/pro_Fonts.cpp", "pro/pro_Image.cpp", "Graphics.cpp", "Brush.cpp", "BaseThread.cpp", "GraphicsPath.cpp", "Image.cpp", "Matrix.cpp", "Clip.cpp", "TemporaryCS.cpp"])
|
||||
|
||||
compile_files_array.append("fe")
|
||||
compile_files_array.append("../../../fontengine/")
|
||||
compile_files_array.append(["GlyphString.cpp", "FontManager.cpp", "FontFile.cpp", "FontPath.cpp", "ApplicationFonts.cpp"])
|
||||
|
||||
compile_files_array.append("a")
|
||||
compile_files_array.append("../../../agg-2.4/src/")
|
||||
compile_files_array.append(["agg_arc.cpp", "agg_vcgen_stroke.cpp", "agg_vcgen_dash.cpp", "agg_trans_affine.cpp", "agg_curves.cpp"])
|
||||
|
||||
compile_files_array.append("c")
|
||||
compile_files_array.append("../../../common/")
|
||||
compile_files_array.append(["File.cpp", "Directory.cpp", "ByteBuilder.cpp", "Base64.cpp", "StringExt.cpp"])
|
||||
|
||||
compile_files_array.append("i")
|
||||
compile_files_array.append("../../../../Common/3dParty/icu/icu/source/common/")
|
||||
compile_files_array.append(["ucnv.c", "ustr_wcs.cpp", "ucnv_err.c", "ucnv_bld.cpp", "ustrtrns.cpp", "ucnv_cb.c", "udata.cpp", "ucnv_io.cpp", "uhash.c", "udatamem.c", "cmemory.c", "ustring.cpp", "umutex.cpp", "putil.cpp", "ustr_cnv.cpp", "ucnvmbcs.cpp", "ucnvlat1.c", "ucnv_u16.c", "ucnv_u8.c", "ucnv_u32.c", "ucnv_u7.c", "ucln_cmn.cpp", "ucnv2022.cpp", "ucnv_lmb.c", "ucnvhz.c", "ucnvscsu.c", "ucnvisci.c", "ucnvbocu.cpp", "ucnv_ct.c", "ucnv_cnv.c", "stringpiece.cpp", "charstr.cpp", "umapfile.c", "ucmndata.c", "ucnv_ext.cpp", "uobject.cpp", "umath.c", "ubidi_props.c", "uchar.c", "uinvchar.c", "usprep.cpp", "unistr.cpp", "uniset_props.cpp", "loadednormalizer2impl.cpp", "filterednormalizer2.cpp", "utrie2.cpp", "normalizer2.cpp", "normalizer2impl.cpp", "utrie.cpp", "ucase.cpp", "uniset.cpp", "ruleiter.cpp", "parsepos.cpp", "util.cpp", "uprops.cpp", "uvector.cpp", "unames.cpp", "propname.cpp", "utrie2_builder.cpp", "unifunct.cpp", "bmpset.cpp", "unisetspan.cpp", "unifilt.cpp", "patternprops.cpp", "utf_impl.c", "ustrcase.cpp", "cstring.c", "bytestrie.cpp"])
|
||||
|
||||
compile_files_array.append("o")
|
||||
compile_files_array.append("../../../../OfficeUtils/src/")
|
||||
compile_files_array.append(["OfficeUtils.cpp", "ZipBuffer.cpp", "ZipUtilsCP.cpp"])
|
||||
|
||||
compile_files_array.append("m")
|
||||
compile_files_array.append("../../../../OfficeUtils/src/zlib-1.2.11/contrib/minizip/")
|
||||
compile_files_array.append(["ioapi.c", "miniunz.c", "minizip.c", "mztools.c", "unzip.c", "zip.c", "ioapibuf.c"])
|
||||
|
||||
compile_files_array.append("z")
|
||||
compile_files_array.append("../../../../OfficeUtils/src/zlib-1.2.11/")
|
||||
compile_files_array.append(["adler32.c", "crc32.c", "deflate.c", "infback.c", "inffast.c", "inflate.c", "inftrees.c", "trees.c", "zutil.c", "compress.c"])
|
||||
|
||||
compile_files_array.append("x")
|
||||
compile_files_array.append("./")
|
||||
compile_files_array.append(["xml/src/xmllight.cpp", "xml/src/xmldom.cpp", "xml/build/qt/libxml2_all.c", "xml/build/qt/libxml2_all2.c"])
|
||||
|
||||
compile_files_array.append("p")
|
||||
compile_files_array.append("../../../../PdfReader/")
|
||||
compile_files_array.append(["PdfReader.cpp", "Src/Adaptors.cpp", "Src/GfxClip.cpp", "Src/RendererOutputDev.cpp", "lib/fofi/FofiBase.cc", "lib/fofi/FofiEncodings.cc", "lib/fofi/FofiIdentifier.cc", "lib/fofi/FofiTrueType.cc", "lib/fofi/FofiType1.cc", "lib/fofi/FofiType1C.cc", "lib/goo/FixedPoint.cc", "lib/goo/gfile.cc", "lib/goo/GHash.cc", "lib/goo/GList.cc", "lib/goo/gmem.cc", "lib/goo/gmempp.cc", "lib/goo/GString.cc", "lib/goo/parseargs.c", "lib/goo/Trace.cc", "lib/splash/Splash.cc", "lib/splash/SplashBitmap.cc", "lib/splash/SplashClip.cc", "lib/splash/SplashFont.cc", "lib/splash/SplashFontEngine.cc", "lib/splash/SplashFontFile.cc", "lib/splash/SplashFontFileID.cc", "lib/splash/SplashFTFont.cc", "lib/splash/SplashFTFontEngine.cc", "lib/splash/SplashFTFontFile.cc", "lib/splash/SplashPath.cc", "lib/splash/SplashPattern.cc", "lib/splash/SplashScreen.cc", "lib/splash/SplashState.cc", "lib/splash/SplashXPath.cc", "lib/splash/SplashXPathScanner.cc", "lib/xpdf/AcroForm.cc", "lib/xpdf/Annot.cc", "lib/xpdf/Array.cc", "lib/xpdf/BuiltinFont.cc", "lib/xpdf/BuiltinFontTables.cc", "lib/xpdf/Catalog.cc", "lib/xpdf/CharCodeToUnicode.cc", "lib/xpdf/CMap.cc", "lib/xpdf/Decrypt.cc", "lib/xpdf/Dict.cc", "lib/xpdf/DisplayState.cc", "lib/xpdf/Error.cc", "lib/xpdf/FontEncodingTables.cc", "lib/xpdf/Function.cc", "lib/xpdf/Gfx.cc", "lib/xpdf/GfxFont.cc", "lib/xpdf/GfxState.cc", "lib/xpdf/GlobalParams.cc", "lib/xpdf/ImageOutputDev.cc", "lib/xpdf/JArithmeticDecoder.cc", "lib/xpdf/JBIG2Stream.cc", "lib/xpdf/JPXStream.cc", "lib/xpdf/Lexer.cc", "lib/xpdf/Link.cc", "lib/xpdf/NameToCharCode.cc", "lib/xpdf/Object.cc", "lib/xpdf/OptionalContent.cc", "lib/xpdf/Outline.cc", "lib/xpdf/OutputDev.cc", "lib/xpdf/Page.cc", "lib/xpdf/Parser.cc", "lib/xpdf/PDF417Barcode.cc", "lib/xpdf/PDFCore.cc", "lib/xpdf/PDFDoc.cc", "lib/xpdf/PDFDocEncoding.cc", "lib/xpdf/PreScanOutputDev.cc", "lib/xpdf/PSOutputDev.cc", "lib/xpdf/PSTokenizer.cc", "lib/xpdf/SecurityHandler.cc", "lib/xpdf/ShadingImage.cc", "lib/xpdf/SplashOutputDev.cc", "lib/xpdf/Stream.cc", "lib/xpdf/TextOutputDev.cc", "lib/xpdf/TextString.cc", "lib/xpdf/TileCache.cc", "lib/xpdf/TileCompositor.cc", "lib/xpdf/TileMap.cc", "lib/xpdf/UnicodeMap.cc", "lib/xpdf/UnicodeRemapping.cc", "lib/xpdf/UnicodeTypeTable.cc", "lib/xpdf/UTF8.cc", "lib/xpdf/WebFont.cc", "lib/xpdf/XFAScanner.cc", "lib/xpdf/XRef.cc", "lib/xpdf/Zoox.cc"])
|
||||
|
||||
compile_files_array.append("x")
|
||||
compile_files_array.append("../../../../XpsFile/")
|
||||
compile_files_array.append(["XpsFile.cpp", "XpsLib/Document.cpp", "XpsLib/XpsPage.cpp", "XpsLib/StaticResources.cpp", "XpsLib/Utils.cpp", "XpsLib/WString.cpp", "XpsLib/ContextState.cpp"])
|
||||
|
||||
compile_files_array.append("d")
|
||||
compile_files_array.append("../../../../DjVuFile/libdjvu/")
|
||||
compile_files_array.append(["../DjVu.cpp", "../DjVuFileImplementation.cpp", "Arrays.cpp", "BSByteStream.cpp", "BSEncodeByteStream.cpp", "ByteStream.cpp", "DataPool.cpp", "debug.cpp", "DjVmDir.cpp", "DjVmDir0.cpp", "DjVmDoc.cpp", "DjVmNav.cpp", "DjVuAnno.cpp", "DjVuDocEditor.cpp", "DjVuDocument.cpp", "DjVuDumpHelper.cpp", "DjVuErrorList.cpp", "DjVuFile.cpp", "DjVuFileCache.cpp", "DjVuGlobal.cpp", "DjVuGlobalMemory.cpp", "DjVuImage.cpp", "DjVuInfo.cpp", "DjVuMessageLite.cpp", "DjVuNavDir.cpp", "DjVuPalette.cpp", "DjVuPort.cpp", "DjVuText.cpp", "DjVuToPS.cpp", "GBitmap.cpp", "GContainer.cpp", "GException.cpp", "GIFFManager.cpp", "GMapAreas.cpp", "GPixmap.cpp", "GRect.cpp", "GScaler.cpp", "GSmartPointer.cpp", "DjVuGString.cpp", "GThreads.cpp", "GUnicode.cpp", "IFFByteStream.cpp", "IW44EncodeCodec.cpp", "IW44Image.cpp", "JB2EncodeCodec.cpp", "JB2Image.cpp", "JPEGDecoder.cpp", "MMRDecoder.cpp", "MMX.cpp", "UnicodeByteStream.cpp", "XMLParser.cpp", "XMLTags.cpp", "ZPCodec.cpp"])
|
||||
|
||||
compile_files_array.append("d")
|
||||
compile_files_array.append("../../../../DjVuFile/wasm/libdjvu/")
|
||||
compile_files_array.append(["atomic.cpp", "DjVuMessage.cpp", "GOS.cpp", "GURL.cpp"])
|
||||
|
||||
compile_files_array.append("u")
|
||||
compile_files_array.append("../../../../UnicodeConverter/")
|
||||
compile_files_array.append(["UnicodeConverter.cpp"])
|
||||
|
||||
compiler_flags.append("-Iwasm/src/lib -I../../../agg-2.4/include -I../../../cximage/jasper/include -I../../../cximage/jpeg -I../../../cximage/png -Ifreetype-2.10.4/include -Ifreetype-2.10.4/include/freetype -I../../../../OfficeUtils/src/zlib-1.2.11 -I../../../../Common/3dParty/icu/icu/source/common -I../../../xml/libxml2/include -I../../../xml/build/qt -I../../../../OfficeUtils/src/zlib-1.2.11/contrib/minizip -I../../../../PdfReader/lib/goo -I../../../../PdfReader/lib/fofi -I../../../../PdfReader/lib/splash -I../../../../PdfReader/lib")
|
||||
compiler_flags.append("-D__linux__ -D_LINUX -DUNIX -DFT2_BUILD_LIBRARY -DHAVE_FCNTL_H -DFT_CONFIG_OPTION_SYSTEM_ZLIB -DBUILDING_WASM_MODULE -DU_COMMON_IMPLEMENTATION")
|
||||
compiler_flags.append("-Derrno=0 -DTHREADMODEL=0 -DDEBUGLVL=0 -DHAVE_MBSTATE_T -DHAVE_STDINCLUDES -DHAS_WCHAR")
|
||||
compiler_flags.append("-DHAVE_VA_COPY -DLIBXML_READER_ENABLED -DLIBXML_PUSH_ENABLED -DLIBXML_HTML_ENABLED -DLIBXML_XPATH_ENABLED -DLIBXML_OUTPUT_ENABLED -DLIBXML_C14N_ENABLED -DLIBXML_SAX1_ENABLED -DLIBXML_TREE_ENABLED -DLIBXML_XPTR_ENABLED -DIN_LIBXML -DLIBXML_STATIC -DBUILD_ZLIB_AS_SOURCES -DDISABLE_PDF_CONVERTATION -D_ARM_ALIGN_")
|
||||
|
||||
# arguments
|
||||
arguments = ""
|
||||
for item in compiler_flags:
|
||||
arguments += (item + " ")
|
||||
|
||||
# sources
|
||||
sources = ["raster.o", "wasm/src/drawingfile.cpp", "wasm/src/metafile.cpp"]
|
||||
|
||||
# command
|
||||
compile_files_array_len = len(compile_files_array)
|
||||
external_file = []
|
||||
|
||||
prefix_call = ""
|
||||
if base.host_platform() == "windows":
|
||||
prefix_call = "call "
|
||||
external_file.append("call emsdk/emsdk_env.bat")
|
||||
else:
|
||||
external_file.append("#!/bin/bash")
|
||||
external_file.append("source ./emsdk/emsdk_env.sh")
|
||||
|
||||
file_index = 0
|
||||
libs = ""
|
||||
while file_index < compile_files_array_len:
|
||||
objects_dir = compile_files_array[file_index]
|
||||
base_dir = compile_files_array[file_index + 1]
|
||||
files = compile_files_array[file_index + 2]
|
||||
file_index += 3
|
||||
base.create_dir("./o/" + objects_dir)
|
||||
for item in files:
|
||||
file_name = os.path.splitext(os.path.basename(item))[0]
|
||||
external_file.append(prefix_call + "emcc -o o/" + objects_dir + "/" + file_name + ".o -c " + arguments + base_dir + item)
|
||||
libs += ("o/" + objects_dir + "/" + file_name + ".o ")
|
||||
|
||||
arguments += "-s EXPORTED_FUNCTIONS=\"["
|
||||
for item in exported_functions:
|
||||
arguments += ("'" + item + "',")
|
||||
arguments = arguments[:-1]
|
||||
arguments += "]\" "
|
||||
|
||||
for item in sources:
|
||||
arguments += (item + " ")
|
||||
|
||||
external_file.append(prefix_call + "emcc -o drawingfile.js " + arguments + libs)
|
||||
|
||||
base.replaceInFile("../../../../Common/3dParty/icu/icu/source/common/udata.cpp", "\n{\n UDataMemory tData;", "\n{\n#ifdef BUILDING_WASM_MODULE\nreturn NULL;\n#endif\n UDataMemory tData;")
|
||||
base.run_as_bat(external_file)
|
||||
base.replaceInFile("../../../../Common/3dParty/icu/icu/source/common/udata.cpp", "\n{\n#ifdef BUILDING_WASM_MODULE\nreturn NULL;\n#endif\n UDataMemory tData;", "\n{\n UDataMemory tData;")
|
||||
|
||||
# finalize
|
||||
base.replaceInFile("./drawingfile.js", "function getBinaryPromise()", "function getBinaryPromise2()")
|
||||
base.replaceInFile("./drawingfile.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){window[\"AscViewer\"] && window[\"AscViewer\"][\"onLoadModule\"] && window[\"AscViewer\"][\"onLoadModule\"]();}];")
|
||||
base.replaceInFile("./drawingfile.js", "__ATPOSTRUN__ = [];", "__ATPOSTRUN__=[function(){window[\"AscViewer\"] && window[\"AscViewer\"][\"onLoadModule\"] && window[\"AscViewer\"][\"onLoadModule\"]();}];")
|
||||
base.replaceInFile("./drawingfile.js", "\"drawingfile.js.mem\"", "getMemoryPathIE(\"drawingfile.js.mem\")")
|
||||
|
||||
module_js_content = base.readFile("./drawingfile.js")
|
||||
engine_base_js_content = base.readFile("./wasm/js/drawingfile_base.js")
|
||||
string_utf8_content = base.readFile("./../../../../Common/js/string_utf8.js")
|
||||
engine_js_content = engine_base_js_content.replace("//module", module_js_content)
|
||||
engine_js_content = engine_js_content.replace("//string_utf8", string_utf8_content)
|
||||
|
||||
# write new version
|
||||
base.writeFile("./deploy/drawingfile.js", engine_js_content)
|
||||
base.copy_file("./drawingfile.wasm", "./deploy/drawingfile.wasm")
|
||||
|
||||
# clear
|
||||
base.delete_file("drawingfile.js")
|
||||
base.delete_file("drawingfile.wasm")
|
||||
|
||||
# ie asm version
|
||||
arguments = arguments.replace("WASM=1", "WASM=0")
|
||||
|
||||
# command
|
||||
external_file = []
|
||||
|
||||
if base.host_platform() == "windows":
|
||||
external_file.append("call emsdk/emsdk_env.bat")
|
||||
else:
|
||||
external_file.append("#!/bin/bash")
|
||||
external_file.append("source ./emsdk/emsdk_env.sh")
|
||||
|
||||
external_file.append(prefix_call + "emcc -o drawingfile.js " + arguments + libs)
|
||||
base.run_as_bat(external_file)
|
||||
|
||||
# finalize
|
||||
base.replaceInFile("./drawingfile.js", "function getBinaryPromise()", "function getBinaryPromise2()")
|
||||
base.replaceInFile("./drawingfile.js", "__ATPOSTRUN__=[];", "__ATPOSTRUN__=[function(){window[\"AscViewer\"] && window[\"AscViewer\"][\"onLoadModule\"] && window[\"AscViewer\"][\"onLoadModule\"]();}];")
|
||||
base.replaceInFile("./drawingfile.js", "__ATPOSTRUN__ = [];", "__ATPOSTRUN__=[function(){window[\"AscViewer\"] && window[\"AscViewer\"][\"onLoadModule\"] && window[\"AscViewer\"][\"onLoadModule\"]();}];")
|
||||
base.replaceInFile("./drawingfile.js", "\"drawingfile.js.mem\"", "getMemoryPathIE(\"drawingfile.js.mem\")")
|
||||
|
||||
module_js_content = base.readFile("./drawingfile.js")
|
||||
engine_base_js_content = base.readFile("./wasm/js/drawingfile_base.js")
|
||||
string_utf8_content = base.readFile("./../../../../Common/js/string_utf8.js")
|
||||
polyfill_js_content = base.readFile("./../../../../Common/js/polyfill.js")
|
||||
engine_js_content = engine_base_js_content.replace("//module", module_js_content)
|
||||
engine_js_content = engine_js_content.replace("//string_utf8", string_utf8_content)
|
||||
engine_js_content = engine_js_content.replace("//polyfill", polyfill_js_content)
|
||||
|
||||
# write new version
|
||||
base.writeFile("./deploy/drawingfile_ie.js", engine_js_content)
|
||||
base.copy_file("./drawingfile.js.mem", "./deploy/drawingfile.js.mem")
|
||||
|
||||
# clear
|
||||
base.delete_file("drawingfile.js")
|
||||
base.delete_file("drawingfile.js.mem")
|
||||
# base.delete_dir("./o")
|
||||
# base.delete_dir("./xml")
|
||||
# base.delete_dir("./freetype-2.10.4")
|
||||
# base.delete_file("./raster.o")
|
||||
@ -1,844 +0,0 @@
|
||||
# Copyright (C) Ascensio System SIA, 2009-2026
|
||||
#
|
||||
# This program is a free software product. You can redistribute it and/or
|
||||
# modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
# version 3 as published by the Free Software Foundation, together with the
|
||||
# additional terms provided in the LICENSE file.
|
||||
#
|
||||
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
# details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
#
|
||||
# You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
# or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
# LV-1050, Latvia, European Union.
|
||||
#
|
||||
# The interactive user interfaces in modified versions of the Program
|
||||
# are required to display Appropriate Legal Notices in accordance with
|
||||
# Section 5 of the GNU AGPL version 3.
|
||||
#
|
||||
# No trademark rights are granted under this License.
|
||||
#
|
||||
# All non-code elements of the Product, including illustrations,
|
||||
# icon sets, and technical writing content, are licensed under the
|
||||
# Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
# https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
#
|
||||
# This license applies only to such non-code elements and does not
|
||||
# modify or replace the licensing terms applicable to the Program's
|
||||
# source code, which remains licensed under the GNU Affero General
|
||||
# Public License v3.
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
TARGET = wasmgraphics
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG += console
|
||||
CONFIG += object_parallel_to_source
|
||||
CONFIG -= app_bundle
|
||||
|
||||
DEFINES += TEST_CPP_BINARY \
|
||||
GRAPHICS_NO_USE_DYNAMIC_LIBRARY \
|
||||
BUILDING_WASM_MODULE \
|
||||
_QT
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
|
||||
include(../../freetype.pri)
|
||||
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel)
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/agg-2.4/include \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/cximage/jasper/include \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/cximage/jpeg \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/cximage/png \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/freetype-2.10.4/include \
|
||||
$$CORE_ROOT_DIR/DesktopEditor/freetype-2.10.4/include/freetype \
|
||||
$$CORE_ROOT_DIR/Common/3dParty/openssl/openssl/include
|
||||
|
||||
win32 {
|
||||
DEFINES += \
|
||||
JAS_WIN_MSVC_BUILD \
|
||||
NOMINMAX
|
||||
|
||||
DEFINES -= UNICODE
|
||||
DEFINES -= _UNICODE
|
||||
|
||||
LIBS += -lgdi32 \
|
||||
-ladvapi32 \
|
||||
-luser32 \
|
||||
-lshell32 \
|
||||
-lOle32
|
||||
}
|
||||
|
||||
# graphics
|
||||
|
||||
HEADERS += \
|
||||
../../../config.h \
|
||||
\
|
||||
../../../Matrix.h \
|
||||
../../../Matrix_private.h \
|
||||
../../../GraphicsPath.h \
|
||||
../../../BooleanOperations.h \
|
||||
../../../boolean_operations_math.h \
|
||||
../../../GraphicsPath_private.h \
|
||||
../../../AlphaMask.h \
|
||||
\
|
||||
../../../../raster/BgraFrame.h \
|
||||
../../../../raster/ImageFileFormatChecker.h \
|
||||
../../../../raster/Metafile/Metafile.h \
|
||||
../../../../raster/Metafile/Common/MetaFile.h \
|
||||
../../../../raster/Metafile/Common/IOutputDevice.h \
|
||||
../../../../raster/Metafile/Common/MetaFileTypes.h \
|
||||
../../../../raster/Metafile/Common/MetaFileClip.h \
|
||||
../../../../raster/Metafile/Common/MetaFileObjects.h \
|
||||
../../../../raster/Metafile/Common/MetaFileRenderer.h \
|
||||
../../../../raster/Metafile/Common/MetaFileUtils.h \
|
||||
../../../../raster/PICT/PICTFile.h \
|
||||
\
|
||||
../../../ArrowHead.h \
|
||||
../../../Brush.h \
|
||||
../../../Clip.h \
|
||||
../../../Color.h \
|
||||
../../../Defines.h \
|
||||
../../../Graphics.h \
|
||||
../../../Image.h \
|
||||
../../../ImageFilesCache.h \
|
||||
../../../structures.h \
|
||||
../../../shading_info.h \
|
||||
../../../GraphicsRenderer.h \
|
||||
../../../GraphicsLayer.h \
|
||||
\
|
||||
../../../../fontengine/ApplicationFonts.h \
|
||||
../../../../fontengine/FontFile.h \
|
||||
../../../../fontengine/FontPath.h \
|
||||
../../../../fontengine/GlyphString.h \
|
||||
../../../../fontengine/FontManager.h \
|
||||
../../../../fontengine/FontConverter.h \
|
||||
\
|
||||
../../Fonts.h \
|
||||
../../Graphics.h \
|
||||
../../Image.h \
|
||||
../../../../raster/Metafile/svg/SVGFramework.h \
|
||||
../../../../raster/Metafile/svg/SVGTransformer.h \
|
||||
\
|
||||
../../../MetafileToRenderer.h \
|
||||
../../../MetafileToRendererCheck.h \
|
||||
../../../MetafileToRendererReader.h \
|
||||
../../../MetafileToGraphicsRenderer.h \
|
||||
../../../commands/FormField.h \
|
||||
../../../commands/AnnotField.h \
|
||||
../../../commands/DocInfo.h
|
||||
|
||||
SOURCES += \
|
||||
../../../Matrix.cpp \
|
||||
../../../GraphicsPath.cpp \
|
||||
../../../BooleanOperations.cpp \
|
||||
../../../AlphaMask.cpp \
|
||||
../../../../raster/BgraFrame.cpp \
|
||||
../../../../raster/ImageFileFormatChecker.cpp \
|
||||
../../../../raster/Metafile/MetaFile.cpp \
|
||||
../../../../raster/PICT/PICFile.cpp \
|
||||
\
|
||||
../../../ArrowHead.cpp \
|
||||
../../../Brush.cpp \
|
||||
../../../Clip.cpp \
|
||||
../../../Graphics.cpp \
|
||||
../../../GraphicsRenderer.cpp \
|
||||
../../../Image.cpp \
|
||||
../../../GraphicsLayer.cpp \
|
||||
\
|
||||
../../../../fontengine/ApplicationFonts.cpp \
|
||||
../../../../fontengine/FontFile.cpp \
|
||||
../../../../fontengine/FontManager.cpp \
|
||||
../../../../fontengine/FontPath.cpp \
|
||||
../../../../fontengine/GlyphString.cpp \
|
||||
\
|
||||
../../pro_Fonts.cpp \
|
||||
../../pro_Image.cpp \
|
||||
../../pro_Graphics.cpp \
|
||||
../../../../raster/Metafile/svg/SVGFramework.cpp \
|
||||
../../../../raster/Metafile/svg/SVGTransformer.cpp \
|
||||
\
|
||||
../../../MetafileToRenderer.cpp \
|
||||
../../../MetafileToRendererReader.cpp \
|
||||
../../../MetafileToGraphicsRenderer.cpp \
|
||||
../../../commands/FormField.cpp \
|
||||
../../../commands/AnnotField.cpp \
|
||||
../../../commands/DocInfo.cpp
|
||||
|
||||
SOURCES += \
|
||||
../../../../agg-2.4/src/agg_arc.cpp \
|
||||
../../../../agg-2.4/src/agg_bezier_arc.cpp \
|
||||
../../../../agg-2.4/src/agg_arrowhead.cpp \
|
||||
../../../../agg-2.4/src/ctrl/agg_cbox_ctrl.cpp \
|
||||
../../../../agg-2.4/src/agg_curves.cpp \
|
||||
../../../../agg-2.4/src/agg_gsv_text.cpp \
|
||||
../../../../agg-2.4/src/agg_image_filters.cpp \
|
||||
../../../../agg-2.4/src/agg_line_aa_basics.cpp \
|
||||
../../../../agg-2.4/src/agg_line_profile_aa.cpp \
|
||||
../../../../agg-2.4/src/agg_rounded_rect.cpp \
|
||||
../../../../agg-2.4/src/agg_sqrt_tables.cpp \
|
||||
../../../../agg-2.4/src/agg_trans_affine.cpp \
|
||||
../../../../agg-2.4/src/agg_bspline.cpp \
|
||||
../../../../agg-2.4/src/agg_vcgen_bspline.cpp \
|
||||
../../../../agg-2.4/src/agg_vcgen_contour.cpp \
|
||||
../../../../agg-2.4/src/agg_vcgen_dash.cpp \
|
||||
../../../../agg-2.4/src/agg_vcgen_markers_term.cpp \
|
||||
../../../../agg-2.4/src/agg_vcgen_smooth_poly1.cpp \
|
||||
../../../../agg-2.4/src/agg_vcgen_stroke.cpp \
|
||||
\
|
||||
../../../../raster/Jp2/J2kFile.cpp \
|
||||
../../../../raster/Jp2/Reader.cpp \
|
||||
\
|
||||
../../../../raster/Metafile/Common/MetaFileTypes.cpp \
|
||||
../../../../raster/Metafile/Common/MetaFileUtils.cpp \
|
||||
\
|
||||
../../../../raster/JBig2/source/JBig2File.cpp \
|
||||
\
|
||||
../../../../raster/Metafile/StarView/SvmFile.cpp \
|
||||
../../../../raster/Metafile/StarView/SvmObjects.cpp \
|
||||
../../../../raster/Metafile/StarView/SvmPlayer.cpp
|
||||
|
||||
LIB_GRAPHICS_PRI_PATH = $$PWD/../../../..
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_cm.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_debug.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_getopt.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_icc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_iccdata.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_image.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_init.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_malloc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_stream.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_seq.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_string.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_tvp.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_version.c \
|
||||
\
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/bmp/bmp_cod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/bmp/bmp_dec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/bmp/bmp_enc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jp2/jp2_cod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jp2/jp2_dec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jp2/jp2_enc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_bs.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_cs.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_dec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_enc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_math.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_mct.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_mqcod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_mqdec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_mqenc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_qmfb.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t1cod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t1dec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t1enc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t2cod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t2dec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_t2enc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_tagtree.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_tsfb.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpc/jpc_util.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpg/jpg_dummy.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/jpg/jpg_val.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/mif/mif_cod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pgx/pgx_cod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pgx/pgx_dec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pgx/pgx_enc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pnm/pnm_cod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pnm/pnm_dec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/pnm/pnm_enc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/ras/ras_cod.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/ras/ras_dec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/ras/ras_enc.c \
|
||||
\
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jbig/jbig.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jbig/jbig_tab.c \
|
||||
\
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrtarga.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrrle.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrppm.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrjpgcom.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrgif.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrbmp.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/transupp.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdtarga.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdswitch.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdrle.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdppm.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdjpgcom.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdgif.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdcolmap.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/rdbmp.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jutils.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jpegtran.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jquant1.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jquant2.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdpostct.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdsample.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdtrans.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jerror.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jfdctflt.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jfdctfst.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jfdctint.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jidctflt.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jidctfst.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jidctint.c \
|
||||
#$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jmemansi.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jmemmgr.c \
|
||||
#$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jmemname.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jmemnobs.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jaricom.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcapimin.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcapistd.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcarith.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jccoefct.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jccolor.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcdctmgr.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jchuff.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcinit.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcmainct.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcmarker.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcmaster.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcomapi.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcparam.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcprepct.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jcsample.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jctrans.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdapimin.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdapistd.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdarith.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdatadst.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdatasrc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdcoefct.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdcolor.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jddctmgr.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdhuff.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdinput.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdmainct.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdmarker.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdmaster.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/jdmerge.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/cdjpeg.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/cjpeg.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/ckconfig.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/djpeg.c
|
||||
|
||||
SOURCES += ../../libpsd_pri.c
|
||||
SOURCES += ../../libpsd_pri2.c
|
||||
SOURCES += ../../libpsd_pri3.c
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_callback_xs.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_chunk_descr.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_chunk_io.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_chunk_prc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_chunk_xs.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_cms.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_display.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_dither.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_error.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_filter.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_hlapi.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_jpeg.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_object_prc.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_pixels.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_prop_xs.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_read.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_trace.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_write.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/mng/libmng_zlib.c \
|
||||
\
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/png.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngerror.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngget.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngmem.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngpread.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngread.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngrio.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngrtran.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngrutil.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngset.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngtrans.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngwio.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngwrite.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngwtran.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/png/pngwutil.c \
|
||||
\
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/raw/libdcr.c \
|
||||
\
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_stream.cxx \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_aux.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_close.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_codec.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_color.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_compress.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dir.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dirinfo.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dirread.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dirwrite.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_dumpmode.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_error.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_extension.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_fax3.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_fax3sm.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_flush.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_getimage.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_jbig.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_jpeg.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_luv.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_lzw.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_next.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_ojpeg.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_open.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_packbits.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_pixarlog.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_predict.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_print.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_read.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_strip.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_swab.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_thunder.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_tile.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_unix.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_version.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_warning.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_write.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/tiff/tif_zip.c \
|
||||
\
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/tif_xfile.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximabmp.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximadsp.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaenc.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaexif.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximage.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximagif.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximahist.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaico.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximainfo.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaint.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximajas.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximajbg.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximajpg.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximalpha.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximalyr.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximamng.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximapal.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximapcx.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximapng.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximapsd.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaraw.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximasel.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximaska.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximatga.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximath.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximatif.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximatran.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximawbmp.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximawmf.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/ximawnd.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/CxImage/xmemfile.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/Encoder/jbig2arith.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/Encoder/jbig2enc.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/Encoder/jbig2sym.cpp
|
||||
|
||||
SOURCES += ../../lepton_lib_all.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/boxbasic.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/ccbord.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/dwacomb.2.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/dwacomblow.2.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/fhmtgen.1.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/fliphmtgen.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/fmorphauto.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/fmorphgen.1.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/numabasic.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/pix5.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/pixabasic.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/pixafunc1.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/pixcomp.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/ptabasic.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/ptra.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/ropiplow.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/roplow.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/rotateam.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/rotateshear.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/sarray.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/sel1.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/sel2.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/LeptonLib/skew.cpp
|
||||
|
||||
HEADERS += \
|
||||
../../../../fontengine/ApplicationFontsWorker.h \
|
||||
../../../../fontengine/FontsAssistant.h \
|
||||
../../officedrawingfile.h
|
||||
|
||||
|
||||
SOURCES += \
|
||||
../../../../fontengine/ApplicationFontsWorker.cpp \
|
||||
../../../../fontengine/FontsAssistant.cpp \
|
||||
../../officedrawingfile.cpp
|
||||
|
||||
# XpsFile
|
||||
|
||||
XPS_ROOT_DIR = $$CORE_ROOT_DIR/XpsFile
|
||||
|
||||
HEADERS += \
|
||||
$$XPS_ROOT_DIR/XpsFile.h \
|
||||
$$XPS_ROOT_DIR/XpsLib/ContextState.h \
|
||||
$$XPS_ROOT_DIR/XpsLib/Document.h \
|
||||
$$XPS_ROOT_DIR/XpsLib/FontList.h \
|
||||
$$XPS_ROOT_DIR/XpsLib/XpsPage.h \
|
||||
$$XPS_ROOT_DIR/XpsLib/StaticResources.h \
|
||||
$$XPS_ROOT_DIR/XpsLib/Utils.h \
|
||||
$$XPS_ROOT_DIR/XpsLib/WString.h
|
||||
|
||||
SOURCES += \
|
||||
$$XPS_ROOT_DIR/XpsFile.cpp \
|
||||
$$XPS_ROOT_DIR/XpsLib/ContextState.cpp \
|
||||
$$XPS_ROOT_DIR/XpsLib/Document.cpp \
|
||||
$$XPS_ROOT_DIR/XpsLib/XpsPage.cpp \
|
||||
$$XPS_ROOT_DIR/XpsLib/StaticResources.cpp \
|
||||
$$XPS_ROOT_DIR/XpsLib/Utils.cpp \
|
||||
$$XPS_ROOT_DIR/XpsLib/WString.cpp
|
||||
|
||||
# DjVuFile
|
||||
|
||||
DEFINES += \
|
||||
THREADMODEL=0 \
|
||||
DEBUGLVL=0
|
||||
|
||||
DJVU_ROOT_DIR = $$CORE_ROOT_DIR/DjVuFile
|
||||
DJVU_WRAPPER = $$CORE_ROOT_DIR/DjVuFile/wasm/libdjvu
|
||||
|
||||
HEADERS += \
|
||||
$$DJVU_ROOT_DIR/DjVu.h \
|
||||
$$DJVU_ROOT_DIR/DjVuFileImplementation.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/Arrays.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/atomic.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/BSByteStream.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/ByteStream.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DataPool.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/debug.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVmDir.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVmDir0.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVmDoc.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVmNav.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuAnno.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuDocEditor.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuDocument.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuDumpHelper.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuErrorList.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuFile.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuFileCache.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuGlobal.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuImage.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuInfo.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuMessage.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuMessageLite.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuNavDir.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuPalette.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuPort.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuText.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuToPS.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GBitmap.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GContainer.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GException.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GIFFManager.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GMapAreas.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GOS.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GPixmap.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GRect.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GScaler.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GSmartPointer.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GString.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GThreads.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GURL.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/IFFByteStream.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/IW44Image.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/JB2Image.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/JPEGDecoder.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/MMRDecoder.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/MMX.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/UnicodeByteStream.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/XMLParser.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/XMLTags.h \
|
||||
$$DJVU_ROOT_DIR/libdjvu/ZPCodec.h
|
||||
|
||||
SOURCES += \
|
||||
$$DJVU_ROOT_DIR/DjVu.cpp \
|
||||
$$DJVU_ROOT_DIR/DjVuFileImplementation.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/Arrays.cpp \
|
||||
#$$DJVU_ROOT_DIR/libdjvu/atomic.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/BSByteStream.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/BSEncodeByteStream.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/ByteStream.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DataPool.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/debug.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVmDir.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVmDir0.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVmDoc.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVmNav.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuAnno.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuDocEditor.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuDocument.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuDumpHelper.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuErrorList.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuFile.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuFileCache.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuGlobal.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuGlobalMemory.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuImage.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuInfo.cpp \
|
||||
#$$DJVU_ROOT_DIR/libdjvu/DjVuMessage.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuMessageLite.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuNavDir.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuPalette.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuPort.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuText.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/DjVuToPS.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GBitmap.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GContainer.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GException.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GIFFManager.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GMapAreas.cpp \
|
||||
#$$DJVU_ROOT_DIR/libdjvu/GOS.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GPixmap.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GRect.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GScaler.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GSmartPointer.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GString.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GThreads.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/GUnicode.cpp \
|
||||
#$$DJVU_ROOT_DIR/libdjvu/GURL.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/IFFByteStream.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/IW44EncodeCodec.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/IW44Image.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/JB2EncodeCodec.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/JB2Image.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/JPEGDecoder.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/MMRDecoder.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/MMX.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/UnicodeByteStream.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/XMLParser.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/XMLTags.cpp \
|
||||
$$DJVU_ROOT_DIR/libdjvu/ZPCodec.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$DJVU_WRAPPER/atomic.cpp \
|
||||
$$DJVU_WRAPPER/DjVuMessage.cpp \
|
||||
$$DJVU_WRAPPER/GOS.cpp \
|
||||
$$DJVU_WRAPPER/GURL.cpp
|
||||
|
||||
# PdfReader
|
||||
PDF_ROOT_DIR = $$CORE_ROOT_DIR/PdfFile
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PDF_ROOT_DIR/lib/goo \
|
||||
$$PDF_ROOT_DIR/lib/fofi \
|
||||
$$PDF_ROOT_DIR/lib/splash \
|
||||
$$PDF_ROOT_DIR/lib
|
||||
|
||||
HEADERS += $$files($$PDF_ROOT_DIR/lib/*.h, true)
|
||||
SOURCES += $$files($$PDF_ROOT_DIR/lib/*.c, true)
|
||||
SOURCES += $$files($$PDF_ROOT_DIR/lib/*.cc, true)
|
||||
|
||||
SOURCES -= \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/HTMLGen.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdftohtml.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdftopng.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdftoppm.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdftops.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdftotext.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdfdetach.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdffonts.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdfimages.cc \
|
||||
$$PDF_ROOT_DIR/lib/xpdf/pdfinfo.cc
|
||||
|
||||
SOURCES += \
|
||||
$$PDF_ROOT_DIR/SrcReader/RendererOutputDev.cpp \
|
||||
$$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
|
||||
|
||||
HEADERS +=\
|
||||
$$PDF_ROOT_DIR/Resources/Fontd050000l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn019003l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn019004l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn019023l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn019024l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn021003l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn021004l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn021023l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn021024l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn022003l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn022004l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn022023l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fontn022024l.h \
|
||||
$$PDF_ROOT_DIR/Resources/Fonts050000l.h \
|
||||
$$PDF_ROOT_DIR/Resources/BaseFonts.h \
|
||||
$$PDF_ROOT_DIR/Resources/CMapMemory/cmap_memory.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/RendererOutputDev.h \
|
||||
$$PDF_ROOT_DIR/SrcReader/Adaptors.h \
|
||||
$$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
|
||||
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lCryptoPPLib
|
||||
|
||||
# PdfWriter
|
||||
HEADERS += \
|
||||
$$PDF_ROOT_DIR/SrcWriter/AcroForm.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Annotation.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Catalog.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Consts.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Destination.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Document.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Encodings.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Encrypt.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/EncryptDictionary.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Field.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Font.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Font14.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontCidTT.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontTT.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontTTWriter.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/GState.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Image.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Info.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Objects.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Outline.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Pages.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Pattern.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/ResourcesDictionary.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Shading.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Streams.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Types.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Utils.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Metadata.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/ICCProfile.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/States.h \
|
||||
$$PDF_ROOT_DIR/SrcWriter/RedactOutputDev.h
|
||||
|
||||
SOURCES += \
|
||||
$$PDF_ROOT_DIR/SrcWriter/AcroForm.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Annotation.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Catalog.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Destination.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Document.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Encrypt.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/EncryptDictionary.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Field.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Font.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Font14.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontCidTT.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontTT.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontTTWriter.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/FontOTWriter.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/GState.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Image.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Info.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Objects.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Outline.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Pages.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Pattern.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/ResourcesDictionary.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Shading.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Streams.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Utils.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/Metadata.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/States.cpp \
|
||||
$$PDF_ROOT_DIR/SrcWriter/RedactOutputDev.cpp
|
||||
|
||||
# PdfFile
|
||||
|
||||
HEADERS += \
|
||||
$$PDF_ROOT_DIR/PdfFile.h \
|
||||
$$PDF_ROOT_DIR/PdfWriter.h \
|
||||
$$PDF_ROOT_DIR/PdfReader.h \
|
||||
$$PDF_ROOT_DIR/PdfEditor.h \
|
||||
$$PDF_ROOT_DIR/OnlineOfficeBinToPdf.h
|
||||
|
||||
SOURCES += \
|
||||
$$PDF_ROOT_DIR/PdfFile.cpp \
|
||||
$$PDF_ROOT_DIR/PdfWriter.cpp \
|
||||
$$PDF_ROOT_DIR/PdfReader.cpp \
|
||||
$$PDF_ROOT_DIR/PdfEditor.cpp \
|
||||
$$PDF_ROOT_DIR/OnlineOfficeBinToPdf.cpp
|
||||
|
||||
# DocxRenderer
|
||||
DOCX_RENDERER_ROOT_DIR = $$CORE_ROOT_DIR/DocxRenderer
|
||||
HEADERS += \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/BaseItem.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/ContText.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/DropCap.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Paragraph.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Shape.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Table.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/TextLine.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/ExternalImageStorage.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontStyleManager.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/ImageManager.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontManager.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/ParagraphStyleManager.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/styles/FontStyle.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/styles/ParagraphStyle.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/ColorTable.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/Constants.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/ImageInfo.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/LinesTable.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/VectorGraphics.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/resources.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/utils.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/Page.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/Document.h \
|
||||
$$DOCX_RENDERER_ROOT_DIR/DocxRenderer.h
|
||||
|
||||
SOURCES += \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/BaseItem.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/ContText.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Paragraph.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Shape.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/Table.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/elements/TextLine.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontManager.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/FontStyleManager.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/ImageManager.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/managers/ParagraphStyleManager.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/styles/FontStyle.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/Page.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/Document.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/logic/styles/ParagraphStyle.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/VectorGraphics.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/DocxRenderer.cpp \
|
||||
$$DOCX_RENDERER_ROOT_DIR/src/resources/resources.cpp
|
||||
|
||||
HEADERS += $$CORE_ROOT_DIR/DesktopEditor/doctrenderer/drawingfile.h
|
||||
|
||||
HEADERS += \
|
||||
../wasm/src/serialize.h \
|
||||
../wasm/src/HTMLRendererText.h \
|
||||
../wasm/src/Text.h
|
||||
|
||||
SOURCES += \
|
||||
../wasm/src/HTMLRendererText.cpp \
|
||||
../wasm/src/drawingfile.cpp \
|
||||
../wasm/src/drawingfile_test.cpp
|
||||
@ -1,53 +0,0 @@
|
||||
#include "raster.h"
|
||||
#include "../../../../../raster/BgraFrame.h"
|
||||
#include "../../../../../raster/ImageFileFormatChecker.h"
|
||||
#include "../../../../../raster/Metafile/MetaFile.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
if (false)
|
||||
{
|
||||
std::wstring sFilePath = L"D:/1.jpg";
|
||||
CBgraFrame oFrame;
|
||||
if (oFrame.OpenFile(sFilePath))
|
||||
{
|
||||
oFrame.SaveFile(L"D:/1.png", 4);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (false)
|
||||
{
|
||||
std::wstring sFilePath = L"D:/1.emf";
|
||||
MetaFile::CMetaFile oFrame(NULL);
|
||||
if (oFrame.LoadFromFile(sFilePath.c_str()))
|
||||
{
|
||||
std::wstring sContentSvg = oFrame.ConvertToSvg();
|
||||
NSFile::CFileBinary::SaveToFile(L"D:/1.svg", sContentSvg, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (true)
|
||||
{
|
||||
BYTE* pFileBuffer = NULL;
|
||||
DWORD nFileSize = 0;
|
||||
NSFile::CFileBinary::ReadAllBytes(L"D:/image1.wmf", &pFileBuffer, nFileSize);
|
||||
|
||||
void* pEncodedData = Raster_Encode(pFileBuffer, (int)nFileSize, 24);
|
||||
int nEncodedSize = Raster_GetEncodedSize(pEncodedData);
|
||||
BYTE* pEncodedBuffer = (BYTE*)Raster_GetEncodedBuffer(pEncodedData);
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(L"D:/123.svg");
|
||||
oFile.WriteFile(pEncodedBuffer, nEncodedSize);
|
||||
oFile.CloseFile();
|
||||
|
||||
Raster_DestroyEncodedData(pEncodedData);
|
||||
|
||||
RELEASEARRAYOBJECTS(pFileBuffer);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#include "../../../Fonts.h"
|
||||
#include "../../../pro_base.cpp"
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
namespace NSFontPath
|
||||
{
|
||||
IFontPath* Create() { return NULL; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
namespace NSStream
|
||||
{
|
||||
IFontStream* Create() { return NULL; }
|
||||
}
|
||||
|
||||
namespace NSApplicationFontStream
|
||||
{
|
||||
IApplicationFontStreams* Create() { return NULL; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
namespace NSFontFile
|
||||
{
|
||||
IFontFile* Create() { return NULL; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
namespace NSFontCache
|
||||
{
|
||||
IFontsCache* Create() { return NULL; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
namespace NSFontManager
|
||||
{
|
||||
IFontManager* Create() { return NULL; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace NSFonts
|
||||
{
|
||||
namespace NSApplication
|
||||
{
|
||||
IApplicationFonts* Create() { return NULL; }
|
||||
}
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#include "../../../Graphics.h"
|
||||
|
||||
namespace NSGraphics
|
||||
{
|
||||
IGraphicsRenderer* Create() { return NULL; }
|
||||
}
|
||||
@ -1,144 +0,0 @@
|
||||
#include "raster.h"
|
||||
#include "../../../../../raster/BgraFrame.h"
|
||||
#include "../../../../../raster/ImageFileFormatChecker.h"
|
||||
#include "../../../../../raster/Metafile/MetaFile.h"
|
||||
|
||||
void* Raster_DecodeFile(unsigned char* buffer, int size, bool isRgba)
|
||||
{
|
||||
CBgraFrame* pFrame = new CBgraFrame();
|
||||
pFrame->put_IsRGBA(isRgba);
|
||||
pFrame->Decode(buffer, size);
|
||||
return pFrame;
|
||||
}
|
||||
void* Raster_GetDecodedBuffer(void* frame)
|
||||
{
|
||||
return ((CBgraFrame*)frame)->get_Data();
|
||||
}
|
||||
int Raster_GetWidth (void* frame)
|
||||
{
|
||||
return ((CBgraFrame*)frame)->get_Width();
|
||||
}
|
||||
int Raster_GetHeight(void* frame)
|
||||
{
|
||||
return ((CBgraFrame*)frame)->get_Height();
|
||||
}
|
||||
int Raster_GetStride(void* frame)
|
||||
{
|
||||
return ((CBgraFrame*)frame)->get_Stride();
|
||||
}
|
||||
void Raster_Destroy(void* frame)
|
||||
{
|
||||
delete ((CBgraFrame*)frame);
|
||||
}
|
||||
|
||||
class CEncodedData
|
||||
{
|
||||
public:
|
||||
BYTE* Data;
|
||||
int Size;
|
||||
|
||||
bool IsDeleteDeleter;
|
||||
|
||||
public:
|
||||
CEncodedData()
|
||||
{
|
||||
Data = 0;
|
||||
Size = 0;
|
||||
IsDeleteDeleter = false;
|
||||
}
|
||||
~CEncodedData()
|
||||
{
|
||||
if (Data)
|
||||
{
|
||||
if (!IsDeleteDeleter)
|
||||
CBgraFrame::FreeEncodedMemory(Data);
|
||||
else
|
||||
delete [] Data;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void* Raster_EncodeImageData(unsigned char* buffer, int w, int h, int stride, int format, bool isRgba)
|
||||
{
|
||||
CBgraFrame oFrame;
|
||||
oFrame.put_Data(buffer);
|
||||
oFrame.put_Width(w);
|
||||
oFrame.put_Height(h);
|
||||
oFrame.put_Stride(stride);
|
||||
oFrame.put_IsRGBA(isRgba);
|
||||
CEncodedData* pEncodedData = new CEncodedData();
|
||||
oFrame.Encode(pEncodedData->Data, pEncodedData->Size, format);
|
||||
oFrame.put_Data(NULL);
|
||||
return pEncodedData;
|
||||
}
|
||||
void* Raster_Encode(unsigned char* buffer, int size, int format)
|
||||
{
|
||||
CImageFileFormatChecker oChecker;
|
||||
bool bIsImageFile = oChecker.isImageFile(buffer, (DWORD)size);
|
||||
|
||||
if (bIsImageFile)
|
||||
{
|
||||
switch (oChecker.eFileType)
|
||||
{
|
||||
case _CXIMAGE_FORMAT_WMF:
|
||||
case _CXIMAGE_FORMAT_EMF:
|
||||
{
|
||||
if (_CXIMAGE_FORMAT_SVG == format)
|
||||
{
|
||||
#ifndef GRAPHICS_DISABLE_METAFILE
|
||||
MetaFile::IMetaFile* pMetaFile = MetaFile::Create(NULL);
|
||||
pMetaFile->LoadFromBuffer(buffer, (DWORD)size);
|
||||
std::wstring wsSvg = pMetaFile->ConvertToSvg();
|
||||
std::string sSvg = U_TO_UTF8(wsSvg);
|
||||
pMetaFile->Release();
|
||||
|
||||
CEncodedData* pEncodedData = new CEncodedData();
|
||||
pEncodedData->IsDeleteDeleter = true;
|
||||
pEncodedData->Data = new BYTE[sSvg.length()];
|
||||
pEncodedData->Size = (int)sSvg.length();
|
||||
|
||||
memcpy(pEncodedData->Data, sSvg.c_str(), sSvg.length());
|
||||
return pEncodedData;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
CBgraFrame oFrame;
|
||||
oFrame.Decode(buffer, size, format);
|
||||
|
||||
BYTE* pBuffer = NULL;
|
||||
int nEncodedSize = 0;
|
||||
|
||||
if (oFrame.Encode(pBuffer, nEncodedSize, format))
|
||||
{
|
||||
CEncodedData* pEncodedData = new CEncodedData();
|
||||
pEncodedData->Data = pBuffer;
|
||||
pEncodedData->Size = nEncodedSize;
|
||||
return pEncodedData;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
int Raster_GetEncodedSize(void* encodedData)
|
||||
{
|
||||
return ((CEncodedData*)encodedData)->Size;
|
||||
}
|
||||
void* Raster_GetEncodedBuffer(void* encodedData)
|
||||
{
|
||||
return ((CEncodedData*)encodedData)->Data;
|
||||
}
|
||||
void Raster_DestroyEncodedData(void* encodedData)
|
||||
{
|
||||
delete ((CEncodedData*)encodedData);
|
||||
}
|
||||
|
||||
int Image_GetFormat(unsigned char* buffer, int size)
|
||||
{
|
||||
CImageFileFormatChecker oChecker;
|
||||
if (oChecker.isImageFile(buffer, (DWORD)size))
|
||||
return oChecker.eFileType;
|
||||
return 0;
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
#ifndef _RASTER_H
|
||||
#define _RASTER_H
|
||||
|
||||
#ifndef RASTER_USE_DYNAMIC_LIBRARY
|
||||
#define RASTER_DECL_EXPORT
|
||||
#else
|
||||
#include "../../../../../common/base_export.h"
|
||||
#define RASTER_DECL_EXPORT Q_DECL_EXPORT
|
||||
#endif
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
RASTER_DECL_EXPORT void* Raster_DecodeFile(unsigned char* buffer, int size, bool isRgba = false);
|
||||
RASTER_DECL_EXPORT void* Raster_GetDecodedBuffer(void* frame);
|
||||
RASTER_DECL_EXPORT int Raster_GetHeight(void* frame);
|
||||
RASTER_DECL_EXPORT int Raster_GetWidth(void* frame);
|
||||
RASTER_DECL_EXPORT int Raster_GetStride(void* frame);
|
||||
RASTER_DECL_EXPORT void Raster_Destroy(void* frame);
|
||||
|
||||
RASTER_DECL_EXPORT void* Raster_EncodeImageData(unsigned char* buffer, int w, int h, int stride, int format, bool isRgba = false);
|
||||
RASTER_DECL_EXPORT void* Raster_Encode(unsigned char* buffer, int size, int format);
|
||||
RASTER_DECL_EXPORT void* Raster_GetEncodedBuffer(void* encodedData);
|
||||
RASTER_DECL_EXPORT int Raster_GetEncodedSize(void* encodedData);
|
||||
RASTER_DECL_EXPORT void Raster_DestroyEncodedData(void* encodedData);
|
||||
|
||||
RASTER_DECL_EXPORT int Image_GetFormat(unsigned char* buffer, int size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _RASTER_H
|
||||
@ -1,136 +0,0 @@
|
||||
# Copyright (C) Ascensio System SIA, 2009-2026
|
||||
#
|
||||
# This program is a free software product. You can redistribute it and/or
|
||||
# modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
# version 3 as published by the Free Software Foundation, together with the
|
||||
# additional terms provided in the LICENSE file.
|
||||
#
|
||||
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
# details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
#
|
||||
# You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
# or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
# LV-1050, Latvia, European Union.
|
||||
#
|
||||
# The interactive user interfaces in modified versions of the Program
|
||||
# are required to display Appropriate Legal Notices in accordance with
|
||||
# Section 5 of the GNU AGPL version 3.
|
||||
#
|
||||
# No trademark rights are granted under this License.
|
||||
#
|
||||
# All non-code elements of the Product, including illustrations,
|
||||
# icon sets, and technical writing content, are licensed under the
|
||||
# Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
# https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
#
|
||||
# This license applies only to such non-code elements and does not
|
||||
# modify or replace the licensing terms applicable to the Program's
|
||||
# source code, which remains licensed under the GNU Affero General
|
||||
# Public License v3.
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 0.0.0.1
|
||||
TARGET = test
|
||||
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../../../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
|
||||
DEFINES += GRAPHICS_NO_USE_DYNAMIC_LIBRARY
|
||||
DEFINES += KERNEL_NO_USE_DYNAMIC_LIBRARY
|
||||
DEFINES -= UNICODE _UNICODE
|
||||
|
||||
#DEFINES += BUILDING_WASM_MODULE
|
||||
|
||||
CONFIG += disable_cximage_mng
|
||||
CONFIG += disable_cximage_all
|
||||
include(../../../raster.pri)
|
||||
|
||||
#CONFIG += graphics_disable_metafile
|
||||
graphics_disable_metafile {
|
||||
DEFINES += GRAPHICS_DISABLE_METAFILE
|
||||
} else {
|
||||
CONFIG += metafile_disable_svg
|
||||
CONFIG += metafile_disable_svm
|
||||
CONFIG += metafile_disable_wmf_emf_xml
|
||||
include(../../../metafile.pri)
|
||||
|
||||
!metafile_disable_svg {
|
||||
CONFIG += enable_libxml
|
||||
}
|
||||
!metafile_disable_svm {
|
||||
CONFIG += enable_libxml
|
||||
SOURCES += $$CORE_ROOT_DIR/UnicodeConverter/UnicodeConverter_internal_empty.cpp
|
||||
}
|
||||
|
||||
enable_libxml:include($$CORE_ROOT_DIR/DesktopEditor/xml/build/qt/libxml2.pri)
|
||||
|
||||
!metafile_disable_wmf_emf {
|
||||
SOURCES += $$CORE_ROOT_DIR/DesktopEditor/xml/src/xmlwriter.cpp
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG += graphics_disable_fonts
|
||||
graphics_disable_fonts {
|
||||
SOURCES += $$PWD/pro_Fonts_empty.cpp
|
||||
} else {
|
||||
include(../../../fontengine.pri)
|
||||
}
|
||||
|
||||
GRAPHICS_PATH = $$CORE_ROOT_DIR/DesktopEditor/graphics
|
||||
GRAPHICS_AGG_PATH = $$CORE_ROOT_DIR/DesktopEditor/agg-2.4
|
||||
GRAPHICS_COMMON = $$CORE_ROOT_DIR/DesktopEditor/common
|
||||
# matrix
|
||||
HEADERS += \
|
||||
$$GRAPHICS_PATH/Matrix_private.h \
|
||||
$$GRAPHICS_PATH/Matrix.h
|
||||
|
||||
SOURCES += \
|
||||
$$GRAPHICS_PATH/Matrix.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$GRAPHICS_AGG_PATH/src/agg_trans_affine.cpp
|
||||
|
||||
graphics_enable_path {
|
||||
# paths
|
||||
HEADERS += \
|
||||
$$GRAPHICS_PATH/GraphicsPath_private.h \
|
||||
$$GRAPHICS_PATH/GraphicsPath.h
|
||||
|
||||
SOURCES += \
|
||||
$$GRAPHICS_PATH/GraphicsPath.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$GRAPHICS_AGG_PATH/src/agg_arc.cpp \
|
||||
$$GRAPHICS_AGG_PATH/src/agg_bezier_arc.cpp \
|
||||
$$GRAPHICS_AGG_PATH/src/agg_curves.cpp \
|
||||
$$GRAPHICS_AGG_PATH/src/agg_bspline.cpp \
|
||||
$$GRAPHICS_AGG_PATH/src/agg_vcgen_bspline.cpp \
|
||||
$$GRAPHICS_AGG_PATH/src/agg_vcgen_stroke.cpp \
|
||||
$$GRAPHICS_AGG_PATH/src/agg_vcgen_contour.cpp
|
||||
}
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$GRAPHICS_AGG_PATH/include
|
||||
|
||||
SOURCES += \
|
||||
$$GRAPHICS_COMMON/File.cpp \
|
||||
$$GRAPHICS_COMMON/Base64.cpp \
|
||||
$$GRAPHICS_COMMON/StringBuilder.cpp \
|
||||
$$GRAPHICS_COMMON/StringExt.cpp
|
||||
|
||||
SOURCES += $$PWD/pro_Graphics_empty.cpp
|
||||
|
||||
SOURCES += ./raster.cpp
|
||||
HEADERS += ./raster.h
|
||||
|
||||
SOURCES += ./main.cpp
|
||||
@ -1,116 +0,0 @@
|
||||
import sys
|
||||
sys.path.append("../../../../../build_tools/scripts")
|
||||
import base
|
||||
import os
|
||||
import json
|
||||
|
||||
base.configure_common_apps()
|
||||
|
||||
# remove previous version
|
||||
if base.is_dir("./o"):
|
||||
base.delete_dir("./o")
|
||||
base.create_dir("./o")
|
||||
|
||||
# fetch emsdk
|
||||
command_prefix = "" if ("windows" == base.host_platform()) else "./"
|
||||
if not base.is_dir("emsdk"):
|
||||
base.cmd("git", ["clone", "https://github.com/emscripten-core/emsdk.git"])
|
||||
os.chdir("emsdk")
|
||||
base.cmd(command_prefix + "emsdk", ["install", "latest"])
|
||||
base.cmd(command_prefix + "emsdk", ["activate", "latest"])
|
||||
os.chdir("../")
|
||||
|
||||
# compile
|
||||
compiler_flags = ["-O3",
|
||||
# "-fno-rtti",
|
||||
"-Wno-unused-command-line-argument",
|
||||
"-s WASM=1",
|
||||
"-s ALLOW_MEMORY_GROWTH=1",
|
||||
"-s FILESYSTEM=0",
|
||||
"-s ENVIRONMENT='web'",
|
||||
"-s LLD_REPORT_UNDEFINED"]
|
||||
|
||||
compile_files_array = []
|
||||
|
||||
compile_files_array.append("r")
|
||||
compile_files_array.append("../../../raster/")
|
||||
compile_files_array.append(["BgraFrame.cpp", "ImageFileFormatChecker.cpp"])
|
||||
|
||||
compile_files_array.append("ci")
|
||||
compile_files_array.append("../../../cximage/CxImage/")
|
||||
compile_files_array.append(["ximaenc.cpp", "ximaexif.cpp", "ximage.cpp", "ximainfo.cpp", "ximajpg.cpp", "ximalpha.cpp", "ximapal.cpp", "ximasel.cpp", "xmemfile.cpp", "ximapng.cpp", "ximabmp.cpp", "ximatran.cpp", "ximatif.cpp", "tif_xfile.cpp", "ximajas.cpp", "ximagif.cpp", "ximaico.cpp", "ximatga.cpp", "ximapcx.cpp", "ximawbmp.cpp", "ximamng.cpp", "ximapsd.cpp", "ximaska.cpp", "ximaraw.cpp"])
|
||||
|
||||
compile_files_array.append("j")
|
||||
compile_files_array.append("../../../cximage/jpeg/")
|
||||
compile_files_array.append(["jerror.c", "jdmarker.c", "jdapimin.c", "jdmaster.c", "jdapistd.c", "jcomapi.c", "jutils.c", "jdinput.c", "jdmainct.c", "jmemmgr.c", "jquant1.c", "jquant2.c", "jdmerge.c", "jdcolor.c", "jdsample.c", "jdpostct.c", "jddctmgr.c", "jdarith.c", "jdhuff.c", "jdcoefct.c", "jmemnobs.c", "jidctint.c", "jidctfst.c", "jidctflt.c", "jaricom.c", "jcapimin.c", "jcparam.c", "jcapistd.c", "jcinit.c", "jcmaster.c", "jccolor.c", "jcmarker.c", "jcsample.c", "jcprepct.c", "jcdctmgr.c", "jcarith.c", "jchuff.c", "jccoefct.c", "jcmainct.c", "jfdctint.c", "jfdctfst.c", "jfdctflt.c"])
|
||||
|
||||
compile_files_array.append("p")
|
||||
compile_files_array.append("../../../cximage/png/")
|
||||
compile_files_array.append(["pngread.c", "pngmem.c", "pngerror.c", "png.c", "pngrio.c", "pngtrans.c", "pngget.c", "pngrutil.c", "pngrtran.c", "pngset.c", "pngwrite.c", "pngwio.c", "pngwutil.c", "pngwtran.c"])
|
||||
|
||||
compile_files_array.append("t")
|
||||
compile_files_array.append("../../../cximage/tiff/")
|
||||
compile_files_array.append(["tif_close.c", "tif_dir.c", "tif_aux.c", "tif_getimage.c", "tif_strip.c", "tif_open.c", "tif_tile.c", "tif_error.c", "tif_read.c", "tif_flush.c", "tif_dirinfo.c", "tif_compress.c", "tif_warning.c", "tif_swab.c", "tif_color.c", "tif_dirread.c", "tif_write.c", "tif_codec.c", "tif_luv.c", "tif_dirwrite.c", "tif_dumpmode.c", "tif_fax3.c", "tif_ojpeg.c", "tif_jpeg.c", "tif_next.c", "tif_thunder.c", "tif_packbits.c", "tif_lzw.c", "tif_zip.c", "tif_fax3sm.c", "tif_predict.c"])
|
||||
|
||||
compile_files_array.append("ja")
|
||||
compile_files_array.append("../../../cximage/jasper/")
|
||||
compile_files_array.append(["base/jas_init.c", "base/jas_stream.c", "base/jas_malloc.c", "base/jas_image.c", "base/jas_cm.c", "base/jas_seq.c", "base/jas_string.c", "base/jas_icc.c", "base/jas_debug.c", "base/jas_iccdata.c", "base/jas_tvp.c", "base/jas_version.c", "mif/mif_cod.c", "pnm/pnm_dec.c", "pnm/pnm_enc.c", "pnm/pnm_cod.c", "bmp/bmp_dec.c", "bmp/bmp_enc.c", "bmp/bmp_cod.c", "ras/ras_dec.c", "ras/ras_enc.c", "jp2/jp2_dec.c", "jp2/jp2_enc.c", "jp2/jp2_cod.c", "jpc/jpc_cs.c", "jpc/jpc_enc.c", "jpc/jpc_dec.c", "jpc/jpc_t1cod.c", "jpc/jpc_math.c", "jpc/jpc_util.c", "jpc/jpc_tsfb.c", "jpc/jpc_mct.c", "jpc/jpc_t1enc.c", "jpc/jpc_t1dec.c", "jpc/jpc_bs.c", "jpc/jpc_t2cod.c", "jpc/jpc_t2enc.c", "jpc/jpc_t2dec.c", "jpc/jpc_tagtree.c", "jpc/jpc_mqenc.c", "jpc/jpc_mqdec.c", "jpc/jpc_mqcod.c", "jpc/jpc_qmfb.c", "jpg/jpg_val.c", "jpg/jpg_dummy.c", "pgx/pgx_dec.c", "pgx/pgx_enc.c"])
|
||||
|
||||
compile_files_array.append("jp")
|
||||
compile_files_array.append("../../../raster/Jp2/")
|
||||
compile_files_array.append(["J2kFile.cpp", "Reader.cpp"])
|
||||
|
||||
compile_files_array.append("m")
|
||||
compile_files_array.append("../../../cximage/mng/")
|
||||
compile_files_array.append(["libmng_hlapi.c", "libmng_callback_xs.c", "libmng_prop_xs.c", "libmng_object_prc.c", "libmng_zlib.c", "libmng_jpeg.c", "libmng_pixels.c", "libmng_read.c", "libmng_error.c", "libmng_display.c", "libmng_write.c", "libmng_chunk_io.c", "libmng_cms.c", "libmng_filter.c", "libmng_chunk_prc.c", "libmng_chunk_xs.c"])
|
||||
|
||||
compile_files_array.append("lp")
|
||||
compile_files_array.append("../../../cximage/libpsd/")
|
||||
compile_files_array.append(["psd.c", "file_header.c", "color_mode.c", "image_resource.c", "blend.c", "layer_mask.c", "image_data.c", "stream.c", "psd_system.c", "color.c", "pattern_fill.c", "color_balance.c", "channel_image.c", "gradient_fill.c", "invert.c", "posterize.c", "brightness_contrast.c", "solid_color.c", "threshold.c", "effects.c", "selective_color.c", "channel_mixer.c", "photo_filter.c", "type_tool.c", "gradient_map.c", "hue_saturation.c", "levels.c", "curves.c", "pattern.c", "psd_zip.c", "descriptor.c", "drop_shadow.c", "inner_shadow.c", "color_overlay.c", "outer_glow.c", "inner_glow.c", "bevel_emboss.c", "satin.c", "gradient_overlay.c", "stroke.c", "pattern_overlay.c"])
|
||||
|
||||
compile_files_array.append("ra")
|
||||
compile_files_array.append("../../../cximage/raw/")
|
||||
compile_files_array.append(["libdcr.c"])
|
||||
|
||||
compile_files_array.append("jb")
|
||||
compile_files_array.append("../../../raster/JBig2/source/")
|
||||
compile_files_array.append(["JBig2File.cpp", "Encoder/jbig2enc.cpp", "Encoder/jbig2arith.cpp", "Encoder/jbig2sym.cpp", "LeptonLib/pixconv.cpp", "LeptonLib/writefile.cpp", "LeptonLib/scale.cpp", "LeptonLib/pix1.cpp", "LeptonLib/pix2.cpp", "LeptonLib/pix3.cpp", "LeptonLib/pix4.cpp", "LeptonLib/pix5.cpp", "LeptonLib/grayquant.cpp", "LeptonLib/grayquantlow.cpp", "LeptonLib/seedfill.cpp", "LeptonLib/jbclass.cpp", "LeptonLib/pixabasic.cpp", "LeptonLib/numabasic.cpp", "LeptonLib/morphseq.cpp", "LeptonLib/binexpandlow.cpp", "LeptonLib/ptabasic.cpp", "LeptonLib/rop.cpp", "LeptonLib/colormap.cpp", "LeptonLib/pngiostub.cpp", "LeptonLib/lepton_utils.cpp", "LeptonLib/scalelow.cpp", "LeptonLib/enhance.cpp", "LeptonLib/jpegio.cpp", "LeptonLib/jpegiostub.cpp", "LeptonLib/spixio.cpp", "LeptonLib/webpio.cpp", "LeptonLib/webpiostub.cpp", "LeptonLib/psio2.cpp", "LeptonLib/gifio.cpp", "LeptonLib/gifiostub.cpp", "LeptonLib/pnmio.cpp", "LeptonLib/tiffio.cpp", "LeptonLib/tiffiostub.cpp", "LeptonLib/bmpio.cpp", "LeptonLib/binexpand.cpp", "LeptonLib/compare.cpp", "LeptonLib/boxbasic.cpp", "LeptonLib/conncomp.cpp", "LeptonLib/pixafunc1.cpp", "LeptonLib/boxfunc1.cpp", "LeptonLib/ptafunc1.cpp", "LeptonLib/binreduce.cpp", "LeptonLib/seedfilllow.cpp", "LeptonLib/sel1.cpp", "LeptonLib/morphapp.cpp", "LeptonLib/correlscore.cpp", "LeptonLib/sarray.cpp", "LeptonLib/morph.cpp", "LeptonLib/roplow.cpp", "LeptonLib/fpix1.cpp", "LeptonLib/stack.cpp", "LeptonLib/pixacc.cpp", "LeptonLib/pixarith.cpp", "LeptonLib/convolve.cpp", "LeptonLib/binreducelow.cpp", "LeptonLib/convolvelow.cpp", "LeptonLib/arithlow.cpp"])
|
||||
|
||||
compiler_flags.append("-I../../../../OfficeUtils/src/zlib-1.2.11 -I../../../cximage/jasper/include")
|
||||
compiler_flags.append("-D__linux__ -DBUILDING_WASM_MODULE -D_tcsnicmp=strncmp -D_lseek=lseek -D_getcwd=getcwd -DNO_CONSOLE_IO")
|
||||
|
||||
# arguments
|
||||
arguments = ""
|
||||
for item in compiler_flags:
|
||||
arguments += (item + " ")
|
||||
|
||||
# command
|
||||
compile_files_array_len = len(compile_files_array)
|
||||
external_file = []
|
||||
|
||||
prefix_call = ""
|
||||
if base.host_platform() == "windows":
|
||||
prefix_call = "call "
|
||||
external_file.append("call emsdk/emsdk_env.bat")
|
||||
else:
|
||||
external_file.append("#!/bin/bash")
|
||||
external_file.append("source ./emsdk/emsdk_env.sh")
|
||||
|
||||
file_index = 0
|
||||
libs = ""
|
||||
while file_index < compile_files_array_len:
|
||||
objects_dir = compile_files_array[file_index]
|
||||
base_dir = compile_files_array[file_index + 1]
|
||||
files = compile_files_array[file_index + 2]
|
||||
file_index += 3
|
||||
base.create_dir("./o/" + objects_dir)
|
||||
for item in files:
|
||||
file_name = os.path.splitext(os.path.basename(item))[0]
|
||||
external_file.append(prefix_call + "emcc -o o/" + objects_dir + "/" + file_name + ".o -c " + arguments + base_dir + item)
|
||||
libs += ("o/" + objects_dir + "/" + file_name + ".o ")
|
||||
|
||||
external_file.append(prefix_call + "emcc -r -o raster.o " + arguments + "wasm/src/raster.cpp " + libs)
|
||||
base.run_as_bat(external_file)
|
||||
|
||||
# clear
|
||||
base.delete_dir("./o")
|
||||
@ -1,60 +0,0 @@
|
||||
window.loadedImage = null;
|
||||
window.onload = function()
|
||||
{
|
||||
var holder = document.body;
|
||||
holder.ondragover = function(e)
|
||||
{
|
||||
var isFile = false;
|
||||
if (e.dataTransfer.types)
|
||||
{
|
||||
for (var i = 0, length = e.dataTransfer.types.length; i < length; ++i)
|
||||
{
|
||||
var type = e.dataTransfer.types[i].toLowerCase();
|
||||
if (type == "files" && e.dataTransfer.items && e.dataTransfer.items.length == 1)
|
||||
{
|
||||
var item = e.dataTransfer.items[0];
|
||||
if (item.kind && "file" == item.kind.toLowerCase())
|
||||
{
|
||||
isFile = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
e.dataTransfer.dropEffect = isFile ? "copy" : "none";
|
||||
e.preventDefault();
|
||||
return false;
|
||||
};
|
||||
holder.ondrop = function(e)
|
||||
{
|
||||
var file = e.dataTransfer.files ? e.dataTransfer.files[0] : null;
|
||||
if (!file)
|
||||
{
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
window.loadedImage = window.nativeRasterEngine.openImage(e.target.result);
|
||||
if (!window.loadedImage)
|
||||
return;
|
||||
|
||||
window.onresize();
|
||||
};
|
||||
reader.readAsArrayBuffer(file);
|
||||
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
window.onresize = function()
|
||||
{
|
||||
var dst = document.getElementById("main");
|
||||
if (!window.loadedImage)
|
||||
return;
|
||||
dst.height = window.loadedImage.height > 1000 ? 1000 : window.loadedImage.height;
|
||||
dst.width = dst.height == 1000 ? 1000 * window.loadedImage.width / window.loadedImage.height : window.loadedImage.width;
|
||||
dst.getContext("2d").transform(1, 0, 0, -1, 0, dst.height);
|
||||
dst.getContext("2d").drawImage(window.loadedImage, 0, 0, dst.width, dst.height);
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
(function(window, undefined) {
|
||||
|
||||
function getMemoryPathIE(name)
|
||||
{
|
||||
if (self["AscViewer"] && self["AscViewer"]["baseUrl"])
|
||||
return self["AscViewer"]["baseUrl"] + name;
|
||||
return name;
|
||||
}
|
||||
|
||||
var baseFontsPath = "../../../../fonts/";
|
||||
|
||||
var FS = undefined;
|
||||
|
||||
//desktop_fetch
|
||||
|
||||
//polyfill
|
||||
|
||||
//string_utf8
|
||||
|
||||
//module
|
||||
|
||||
//stream
|
||||
|
||||
//file
|
||||
})(window, undefined);
|
||||
@ -1,303 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
//string_utf8
|
||||
|
||||
function CNativePointer()
|
||||
{
|
||||
this.ptr = null;
|
||||
}
|
||||
CNativePointer.prototype.free = function()
|
||||
{
|
||||
if (this.ptr)
|
||||
g_native_drawing_file["FreeWasmData"](this.ptr);
|
||||
this.ptr = null;
|
||||
};
|
||||
CNativePointer.prototype.getMemory = function(isCopy)
|
||||
{
|
||||
if (!this.ptr)
|
||||
return null;
|
||||
|
||||
if (!isCopy)
|
||||
return this.ptr;
|
||||
|
||||
let copyArray = new Uint8Array(this.ptr.length);
|
||||
copyArray.set(this.ptr);
|
||||
|
||||
return copyArray;
|
||||
};
|
||||
CNativePointer.prototype.getReader = function()
|
||||
{
|
||||
if (!this.ptr)
|
||||
return null;
|
||||
|
||||
return new CBinaryReader(this.ptr, 0, this.ptr.length);
|
||||
};
|
||||
|
||||
var g_module_pointer = new CNativePointer();
|
||||
|
||||
// js interface
|
||||
CFile.prototype._free = function(ptr)
|
||||
{
|
||||
// TODO:
|
||||
};
|
||||
CFile.prototype._getUint8Array = function(ptr, len)
|
||||
{
|
||||
// TODO:
|
||||
};
|
||||
CFile.prototype._getUint8ClampedArray = function(ptr, len)
|
||||
{
|
||||
// TODO:
|
||||
};
|
||||
|
||||
// FILE
|
||||
CFile.prototype._openFile = function(buffer, password)
|
||||
{
|
||||
let res = false;
|
||||
if (!buffer)
|
||||
res = -1 !== g_native_drawing_file["GetType"]();
|
||||
|
||||
if (res)
|
||||
this.nativeFile = 1;
|
||||
return res;
|
||||
};
|
||||
|
||||
CFile.prototype._closeFile = function()
|
||||
{
|
||||
g_native_drawing_file["CloseFile"]();
|
||||
this.nativeFile = 0;
|
||||
};
|
||||
|
||||
CFile.prototype._getType = function()
|
||||
{
|
||||
return g_native_drawing_file["GetType"]();
|
||||
};
|
||||
|
||||
CFile.prototype._getError = function()
|
||||
{
|
||||
return g_native_drawing_file["GetErrorCode"]();
|
||||
};
|
||||
|
||||
CFile.prototype._SplitPages = function(pages, changes)
|
||||
{
|
||||
let dataChanges = null;
|
||||
if (changes)
|
||||
dataChanges = (undefined !== changes.byteLength) ? new Uint8Array(changes) : changes;
|
||||
g_module_pointer.ptr = g_native_drawing_file["SplitPages"](pages, dataChanges);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
|
||||
{
|
||||
if (!buffer)
|
||||
return false;
|
||||
|
||||
if (!maxID)
|
||||
maxID = 0;
|
||||
if (!prefixForm)
|
||||
prefixForm = "";
|
||||
|
||||
let data = (undefined !== buffer.byteLength) ? new Uint8Array(buffer) : buffer;
|
||||
return g_native_drawing_file["MergePages"](data, maxID, prefixForm);
|
||||
};
|
||||
|
||||
CFile.prototype._UndoMergePages = function()
|
||||
{
|
||||
return g_native_drawing_file["UnmergePages"]();
|
||||
};
|
||||
|
||||
CFile.prototype._RedactPage = function(pageIndex, box, filler)
|
||||
{
|
||||
let dataFiller = (undefined !== filler.byteLength) ? new Uint8Array(filler) : filler;
|
||||
return g_native_drawing_file["RedactPage"](pageIndex, box, dataFiller);
|
||||
};
|
||||
|
||||
CFile.prototype._UndoRedact = function()
|
||||
{
|
||||
return g_native_drawing_file["UndoRedact"]();
|
||||
};
|
||||
|
||||
CFile.prototype._CheckOwnerPassword = function(password)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
CFile.prototype._CheckPerm = function(perm)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// FONTS
|
||||
CFile.prototype._isNeedCMap = function()
|
||||
{
|
||||
return g_native_drawing_file["IsNeedCMap"]();
|
||||
};
|
||||
|
||||
CFile.prototype._setCMap = function(memoryBuffer)
|
||||
{
|
||||
// none
|
||||
};
|
||||
|
||||
CFile.prototype._getFontByID = function(ID)
|
||||
{
|
||||
return g_native_drawing_file["GetFontBinary"](ID);
|
||||
};
|
||||
|
||||
CFile.prototype._getGIDByUnicode = function(ID)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetGIDByUnicode"](ID);
|
||||
return g_module_pointer;
|
||||
}
|
||||
|
||||
CFile.prototype._getInteractiveFormsFonts = function(type)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetInteractiveFormsFonts"](type);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
// INFO DOCUMENT
|
||||
CFile.prototype._getInfo = function()
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetInfo"]();
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getStructure = function()
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetStructure"]();
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getLinks = function(pageIndex)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetLinks"](pageIndex);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
// WIDGETS & ANNOTATIONS
|
||||
CFile.prototype._getInteractiveFormsInfo = function()
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetInteractiveFormsInfo"]();
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getAnnotationsInfo = function(pageIndex)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetAnnotationsInfo"](pageIndex === undefined ? -1 : pageIndex);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getButtonIcons = function(backgroundColor, pageIndex, isBase64, nWidget, nView)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetButtonIcons"](
|
||||
backgroundColor === undefined ? 0xFFFFFF : backgroundColor,
|
||||
pageIndex,
|
||||
isBase64 ? 1 : 0,
|
||||
nWidget === undefined ? -1 : nWidget,
|
||||
nView);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getAnnotationsAP = function(width, height, backgroundColor, pageIndex, nAnnot, nView)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetAnnotationsAP"](
|
||||
width,
|
||||
height,
|
||||
backgroundColor === undefined ? 0xFFFFFF : backgroundColor,
|
||||
pageIndex,
|
||||
nAnnot === undefined ? -1 : nAnnot,
|
||||
nView);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getInteractiveFormsAP = function(width, height, backgroundColor, pageIndex, nWidget, nView, nButtonView)
|
||||
{
|
||||
g_module_pointer.ptr = g_native_drawing_file["GetInteractiveFormsAP"](
|
||||
width,
|
||||
height,
|
||||
backgroundColor === undefined ? 0xFFFFFF : backgroundColor,
|
||||
pageIndex,
|
||||
nWidget === undefined ? -1 : nWidget,
|
||||
nView, nButtonView);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
// 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);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getImageBase64 = function(rId)
|
||||
{
|
||||
return g_native_drawing_file["GetImageBase64"](rId);
|
||||
};
|
||||
|
||||
// TEXT
|
||||
CFile.prototype._getGlyphs = function(pageIndex)
|
||||
{
|
||||
let res = {};
|
||||
res.info = [0, 0, 0, 0];
|
||||
res.result = [];
|
||||
return res;
|
||||
};
|
||||
|
||||
CFile.prototype._destroyTextInfo = function()
|
||||
{
|
||||
g_native_drawing_file["DestroyTextInfo"](rId);
|
||||
};
|
||||
|
||||
// RASTER
|
||||
CFile.prototype._getPixmap = function(pageIndex, width, height, backgroundColor)
|
||||
{
|
||||
return null;
|
||||
};
|
||||
|
||||
// STATIC FUNCTIONS
|
||||
CFile.prototype._InitializeFonts = function(basePath)
|
||||
{
|
||||
// none
|
||||
};
|
||||
|
||||
CFile.prototype._CheckStreamId = function(data, status)
|
||||
{
|
||||
// none
|
||||
};
|
||||
@ -1,580 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
function CWasmPointer()
|
||||
{
|
||||
this.ptr = 0;
|
||||
}
|
||||
CWasmPointer.prototype.free = function()
|
||||
{
|
||||
Module["_free"](this.ptr);
|
||||
this.ptr = 0;
|
||||
};
|
||||
CWasmPointer.prototype.getMemory = function(isCopy)
|
||||
{
|
||||
if (!this.ptr)
|
||||
return null;
|
||||
|
||||
let lenArr = new Int32Array(Module["HEAP8"].buffer, this.ptr, 1);
|
||||
if (!lenArr)
|
||||
{
|
||||
this.free();
|
||||
return null;
|
||||
}
|
||||
|
||||
let len = lenArr[0];
|
||||
if (len <= 4)
|
||||
{
|
||||
this.free();
|
||||
return null;
|
||||
}
|
||||
|
||||
len -= 4;
|
||||
|
||||
let noCopyArray = new Uint8Array(Module["HEAP8"].buffer, this.ptr + 4, len);
|
||||
if (!isCopy)
|
||||
return noCopyArray;
|
||||
|
||||
let copyArray = new Uint8Array(len);
|
||||
copyArray.set(noCopyArray);
|
||||
|
||||
return copyArray;
|
||||
};
|
||||
CWasmPointer.prototype.getReader = function()
|
||||
{
|
||||
let noCopyArray = this.getMemory(false);
|
||||
if (!noCopyArray)
|
||||
return null;
|
||||
|
||||
return new CBinaryReader(noCopyArray, 0, noCopyArray.length);
|
||||
};
|
||||
|
||||
var g_module_pointer = new CWasmPointer();
|
||||
|
||||
// js interface
|
||||
CFile.prototype._free = function(ptr)
|
||||
{
|
||||
Module["_free"](ptr);
|
||||
};
|
||||
CFile.prototype._getUint8Array = function(ptr, len)
|
||||
{
|
||||
return new Uint8Array(Module["HEAP8"].buffer, ptr, len);
|
||||
};
|
||||
CFile.prototype._getUint8ClampedArray = function(ptr, len)
|
||||
{
|
||||
return new Uint8ClampedArray(Module["HEAP8"].buffer, ptr, len);
|
||||
};
|
||||
|
||||
// FILE
|
||||
CFile.prototype._openFile = function(buffer, password)
|
||||
{
|
||||
if (buffer)
|
||||
{
|
||||
let data = new Uint8Array(buffer);
|
||||
this.stream_size = data.length;
|
||||
this.stream = Module["_malloc"](this.stream_size);
|
||||
Module["HEAP8"].set(data, this.stream);
|
||||
}
|
||||
|
||||
let passwordPtr = 0;
|
||||
if (password !== undefined)
|
||||
{
|
||||
let passwordBuf = password.toUtf8();
|
||||
passwordPtr = Module["_malloc"](passwordBuf.length);
|
||||
Module["HEAP8"].set(passwordBuf, passwordPtr);
|
||||
}
|
||||
|
||||
this.nativeFile = Module["_Open"](this.stream, this.stream_size, passwordPtr);
|
||||
|
||||
if (passwordPtr)
|
||||
Module["_free"](passwordPtr);
|
||||
return this.nativeFile > 0 ? true : false;
|
||||
};
|
||||
|
||||
CFile.prototype._closeFile = function()
|
||||
{
|
||||
Module["_Close"](this.nativeFile);
|
||||
};
|
||||
|
||||
CFile.prototype._getType = function()
|
||||
{
|
||||
return Module["_GetType"](this.nativeFile);
|
||||
};
|
||||
|
||||
CFile.prototype._getError = function()
|
||||
{
|
||||
return Module["_GetErrorCode"](this.nativeFile);
|
||||
};
|
||||
|
||||
CFile.prototype._SplitPages = function(memoryBuffer, arrayBufferChanges)
|
||||
{
|
||||
let changesPtr = 0;
|
||||
let changesLen = 0;
|
||||
if (arrayBufferChanges)
|
||||
{
|
||||
let changes = new Uint8Array(arrayBufferChanges);
|
||||
changesLen = changes.length;
|
||||
changesPtr = Module["_malloc"](changesLen);
|
||||
Module["HEAP8"].set(changes, changesPtr);
|
||||
}
|
||||
|
||||
let pointer = Module["_malloc"](memoryBuffer.length * 4);
|
||||
Module["HEAP32"].set(memoryBuffer, pointer >> 2);
|
||||
let ptr = Module["_SplitPages"](this.nativeFile, pointer, memoryBuffer.length, changesPtr, changesLen);
|
||||
Module["_free"](pointer);
|
||||
if (changesPtr)
|
||||
Module["_free"](changesPtr);
|
||||
|
||||
g_module_pointer.ptr = ptr;
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._MergePages = function(buffer, maxID, prefixForm)
|
||||
{
|
||||
if (!buffer)
|
||||
return false;
|
||||
|
||||
let data = (undefined !== buffer.byteLength) ? new Uint8Array(buffer) : buffer;
|
||||
let stream2 = Module["_malloc"](data.length);
|
||||
Module["HEAP8"].set(data, stream2);
|
||||
|
||||
if (!maxID)
|
||||
maxID = 0;
|
||||
|
||||
let prefixPtr = 0;
|
||||
if (prefixForm)
|
||||
{
|
||||
let prefixBuf = prefixForm.toUtf8();
|
||||
prefixPtr = Module["_malloc"](prefixBuf.length);
|
||||
Module["HEAP8"].set(prefixBuf, prefixPtr);
|
||||
}
|
||||
|
||||
let bRes = Module["_MergePages"](this.nativeFile, stream2, data.length, maxID, prefixPtr);
|
||||
stream2 = 0; // Success or not, stream2 is either taken or freed
|
||||
|
||||
if (prefixPtr)
|
||||
Module["_free"](prefixPtr);
|
||||
|
||||
return bRes == 1;
|
||||
};
|
||||
|
||||
CFile.prototype._UndoMergePages = function()
|
||||
{
|
||||
return Module["_UnmergePages"](this.nativeFile) == 1;
|
||||
};
|
||||
|
||||
CFile.prototype._RedactPage = function(pageIndex, arrRedactBox, arrayBufferFiller)
|
||||
{
|
||||
let changesPtr = 0;
|
||||
let changesLen = 0;
|
||||
if (arrayBufferFiller)
|
||||
{
|
||||
let changes = new Uint8Array(arrayBufferFiller);
|
||||
changesLen = changes.length;
|
||||
changesPtr = Module["_malloc"](changesLen);
|
||||
Module["HEAP8"].set(changes, changesPtr);
|
||||
}
|
||||
|
||||
let memoryBuffer = new Int32Array(arrRedactBox.length);
|
||||
for (let i = 0; i < arrRedactBox.length; i++)
|
||||
memoryBuffer[i] = Math.round(arrRedactBox[i] * 10000);
|
||||
|
||||
let pointer = Module["_malloc"](memoryBuffer.length * 4);
|
||||
Module["HEAP32"].set(memoryBuffer, pointer >> 2);
|
||||
|
||||
let bRes = Module["_RedactPage"](this.nativeFile, pageIndex, pointer, memoryBuffer.length / 8, changesPtr, changesLen);
|
||||
changesPtr = 0; // Success or not, changesPtr is either taken or freed
|
||||
|
||||
Module["_free"](pointer);
|
||||
|
||||
return bRes == 1;
|
||||
};
|
||||
|
||||
CFile.prototype._UndoRedact = function()
|
||||
{
|
||||
return Module["_UndoRedact"](this.nativeFile) == 1;
|
||||
};
|
||||
|
||||
CFile.prototype._CheckOwnerPassword = function(password)
|
||||
{
|
||||
let passwordPtr = 0;
|
||||
if (password !== undefined)
|
||||
{
|
||||
let passwordBuf = password.toUtf8();
|
||||
passwordPtr = Module["_malloc"](passwordBuf.length);
|
||||
Module["HEAP8"].set(passwordBuf, passwordPtr);
|
||||
}
|
||||
|
||||
let bRes = Module["_CheckOwnerPassword"](this.nativeFile, passwordPtr);
|
||||
|
||||
if (passwordPtr)
|
||||
Module["_free"](passwordPtr);
|
||||
|
||||
return bRes == 1;
|
||||
}
|
||||
|
||||
CFile.prototype._CheckPerm = function(perm)
|
||||
{
|
||||
return Module["_CheckPerm"](this.nativeFile, perm) == 1;
|
||||
}
|
||||
|
||||
// FONTS
|
||||
CFile.prototype._isNeedCMap = function()
|
||||
{
|
||||
let isNeed = Module["_IsNeedCMap"](this.nativeFile);
|
||||
return (isNeed === 1) ? true : false;
|
||||
};
|
||||
|
||||
CFile.prototype._setCMap = function(memoryBuffer)
|
||||
{
|
||||
let pointer = Module["_malloc"](memoryBuffer.length);
|
||||
Module.HEAP8.set(memoryBuffer, pointer);
|
||||
Module["_SetCMapData"](this.nativeFile, pointer, memoryBuffer.length);
|
||||
};
|
||||
|
||||
CFile.prototype._getFontByID = function(ID)
|
||||
{
|
||||
if (ID === undefined)
|
||||
return null;
|
||||
|
||||
let idBuffer = ID.toUtf8();
|
||||
let idPointer = Module["_malloc"](idBuffer.length);
|
||||
Module["HEAP8"].set(idBuffer, idPointer);
|
||||
g_module_pointer.ptr = Module["_GetFontBinary"](this.nativeFile, idPointer);
|
||||
Module["_free"](idPointer);
|
||||
|
||||
let reader = g_module_pointer.getReader();
|
||||
if (!reader)
|
||||
return null;
|
||||
|
||||
let nFontLength = reader.readInt();
|
||||
let np1 = reader.readInt();
|
||||
let np2 = reader.readInt();
|
||||
let pFontPointer = np2 << 32 | np1;
|
||||
|
||||
let res = new Uint8Array(Module["HEAP8"].buffer, pFontPointer, nFontLength);
|
||||
g_module_pointer.free();
|
||||
return res;
|
||||
};
|
||||
|
||||
CFile.prototype._getGIDByUnicode = function(ID)
|
||||
{
|
||||
if (ID === undefined)
|
||||
return null;
|
||||
|
||||
let idBuffer = ID.toUtf8();
|
||||
let idPointer = Module["_malloc"](idBuffer.length);
|
||||
Module["HEAP8"].set(idBuffer, idPointer);
|
||||
g_module_pointer.ptr = Module["_GetGIDByUnicode"](this.nativeFile, idPointer);
|
||||
Module["_free"](idPointer);
|
||||
return g_module_pointer;
|
||||
}
|
||||
|
||||
CFile.prototype._getInteractiveFormsFonts = function(type)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetInteractiveFormsFonts"](this.nativeFile, type);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
// INFO DOCUMENT
|
||||
CFile.prototype._getInfo = function()
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetInfo"](this.nativeFile);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getStructure = function()
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetStructure"](this.nativeFile);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getLinks = function(pageIndex)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetLinks"](this.nativeFile, pageIndex);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
// WIDGETS & ANNOTATIONS
|
||||
CFile.prototype._getInteractiveFormsInfo = function()
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetInteractiveFormsInfo"](this.nativeFile);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getAnnotationsInfo = function(pageIndex)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetAnnotationsInfo"](this.nativeFile, pageIndex === undefined ? -1 : pageIndex);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getButtonIcons = function(backgroundColor, pageIndex, isBase64, nWidget, nView)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetButtonIcons"](this.nativeFile,
|
||||
backgroundColor === undefined ? 0xFFFFFF : backgroundColor,
|
||||
pageIndex,
|
||||
isBase64 ? 1 : 0,
|
||||
nWidget === undefined ? -1 : nWidget,
|
||||
nView);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getAnnotationsAP = function(width, height, backgroundColor, pageIndex, nAnnot, nView)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetAnnotationsAP"](this.nativeFile,
|
||||
width,
|
||||
height,
|
||||
backgroundColor === undefined ? 0xFFFFFF : backgroundColor,
|
||||
pageIndex,
|
||||
nAnnot === undefined ? -1 : nAnnot,
|
||||
nView);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getInteractiveFormsAP = function(width, height, backgroundColor, pageIndex, nWidget, nView, nButtonView)
|
||||
{
|
||||
g_module_pointer.ptr = Module["_GetInteractiveFormsAP"](this.nativeFile,
|
||||
width,
|
||||
height,
|
||||
backgroundColor === undefined ? 0xFFFFFF : backgroundColor,
|
||||
pageIndex,
|
||||
nWidget === undefined ? -1 : nWidget,
|
||||
nView, nButtonView);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
// 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);
|
||||
return g_module_pointer;
|
||||
};
|
||||
|
||||
CFile.prototype._getImageBase64 = function(rId)
|
||||
{
|
||||
let strPtr = Module["_GetImageBase64"](this.nativeFile, rId);
|
||||
if (0 == strPtr)
|
||||
return "error";
|
||||
let len = Module["_GetImageBase64Len"](strPtr);
|
||||
let ptr = Module["_GetImageBase64Ptr"](strPtr);
|
||||
|
||||
var buffer = new Uint8Array(Module["HEAP8"].buffer, ptr, len);
|
||||
let result = String.prototype.fromUtf8(buffer, 0, len);
|
||||
Module["_GetImageBase64Free"](strPtr);
|
||||
return result;
|
||||
};
|
||||
|
||||
// TEXT
|
||||
CFile.prototype._getGlyphs = function(pageIndex)
|
||||
{
|
||||
let ptr = Module["_GetGlyphs"](this.nativeFile, pageIndex);
|
||||
if (!ptr)
|
||||
return null;
|
||||
|
||||
let ptrArray = new Int32Array(Module["HEAP8"].buffer, ptr, 5);
|
||||
let len = ptrArray[0];
|
||||
len -= 20;
|
||||
|
||||
let res = {};
|
||||
res.info = [ptrArray[1], ptrArray[2], ptrArray[3], ptrArray[4]];
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
let textCommandsSrc = new Uint8Array(Module["HEAP8"].buffer, ptr + 20, len);
|
||||
res.result = new Uint8Array(len);
|
||||
res.result.set(textCommandsSrc);
|
||||
}
|
||||
else
|
||||
res.result = [];
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
CFile.prototype._destroyTextInfo = function()
|
||||
{
|
||||
Module["_DestroyTextInfo"]();
|
||||
};
|
||||
|
||||
// RASTER
|
||||
CFile.prototype._getPixmap = function(pageIndex, width, height, backgroundColor)
|
||||
{
|
||||
return Module["_GetPixmap"](this.nativeFile, pageIndex, width, height, backgroundColor === undefined ? 0xFFFFFF : backgroundColor);
|
||||
};
|
||||
|
||||
// STATIC FUNCTIONS
|
||||
CFile.prototype._InitializeFonts = function(basePath)
|
||||
{
|
||||
if (undefined !== basePath && "" !== basePath)
|
||||
baseFontsPath = basePath;
|
||||
if (!window["g_fonts_selection_bin"])
|
||||
return;
|
||||
let memoryBuffer = window["g_fonts_selection_bin"].toUtf8();
|
||||
let pointer = Module["_malloc"](memoryBuffer.length);
|
||||
Module.HEAP8.set(memoryBuffer, pointer);
|
||||
Module["_InitializeFontsBase64"](pointer, memoryBuffer.length);
|
||||
Module["_free"](pointer);
|
||||
delete window["g_fonts_selection_bin"];
|
||||
|
||||
// ranges
|
||||
let rangesBuffer = new CBinaryWriter();
|
||||
let ranges = AscFonts.getSymbolRanges();
|
||||
|
||||
let rangesCount = ranges.length;
|
||||
rangesBuffer.writeUint(rangesCount);
|
||||
for (let i = 0; i < rangesCount; i++)
|
||||
{
|
||||
rangesBuffer.writeString(ranges[i].getName());
|
||||
rangesBuffer.writeUint(ranges[i].getStart());
|
||||
rangesBuffer.writeUint(ranges[i].getEnd());
|
||||
}
|
||||
|
||||
let rangesFinalLen = rangesBuffer.dataSize;
|
||||
let rangesFinal = new Uint8Array(rangesBuffer.buffer.buffer, 0, rangesFinalLen);
|
||||
pointer = Module["_malloc"](rangesFinalLen);
|
||||
Module.HEAP8.set(rangesFinal, pointer);
|
||||
Module["_InitializeFontsRanges"](pointer, rangesFinalLen);
|
||||
Module["_free"](pointer);
|
||||
};
|
||||
|
||||
CFile.prototype._CheckStreamId = function(data, status)
|
||||
{
|
||||
let drawingFile = self.drawingFile;
|
||||
if (!drawingFile)
|
||||
return;
|
||||
|
||||
let lenArray = new Int32Array(Module["HEAP8"].buffer, data, 4);
|
||||
let len = lenArray[0];
|
||||
len -= 4;
|
||||
|
||||
let buffer = new Uint8Array(Module["HEAP8"].buffer, data + 4, len);
|
||||
let reader = new CBinaryReader(buffer, 0, len);
|
||||
|
||||
let name = reader.readString();
|
||||
let style = 0;
|
||||
if (reader.readInt() != 0)
|
||||
style |= 1;//AscFonts.FontStyle.FontStyleBold;
|
||||
if (reader.readInt() != 0)
|
||||
style |= 2;//AscFonts.FontStyle.FontStyleItalic;
|
||||
|
||||
let file = AscFonts.pickFont(name, style);
|
||||
let fileId = file.GetID();
|
||||
let fileStatus = file.GetStatus();
|
||||
|
||||
if (fileStatus === 0)
|
||||
{
|
||||
// font was loaded
|
||||
fontToMemory(file, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawingFile.fontStreams[fileId] = drawingFile.fontStreams[fileId] || {};
|
||||
drawingFile.fontStreams[fileId].pages = drawingFile.fontStreams[fileId].pages || [];
|
||||
addToArrayAsDictionary(drawingFile.fontStreams[fileId].pages, drawingFile.fontPageIndex);
|
||||
addToArrayAsDictionary(drawingFile.pages[drawingFile.fontPageIndex].fonts, fileId);
|
||||
|
||||
drawingFile.pages[drawingFile.fontPageIndex].fontsUpdateType |= drawingFile.fontPageUpdateType;
|
||||
|
||||
// font can be loading in editor
|
||||
if (undefined === file.externalCallback)
|
||||
{
|
||||
let _t = file;
|
||||
file.externalCallback = function() {
|
||||
fontToMemory(_t, true);
|
||||
|
||||
let pages = drawingFile.fontStreams[fileId].pages;
|
||||
delete drawingFile.fontStreams[fileId];
|
||||
|
||||
let pagesRepaint_Page = [];
|
||||
let pagesRepaint_Annotation = [];
|
||||
let pagesRepaint_Forms = [];
|
||||
|
||||
for (let i = 0, len = pages.length; i < len; i++)
|
||||
{
|
||||
let pageNum = pages[i];
|
||||
let pageObj = drawingFile.pages[pageNum];
|
||||
let fonts = pageObj.fonts;
|
||||
|
||||
for (let j = 0, len_fonts = fonts.length; j < len_fonts; j++)
|
||||
{
|
||||
if (fonts[j] == fileId)
|
||||
{
|
||||
fonts.splice(j, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == fonts.length)
|
||||
{
|
||||
if (pageObj.fontsUpdateType & UpdateFontsSource.Page)
|
||||
pagesRepaint_Page.push(pageNum);
|
||||
|
||||
if (pageObj.fontsUpdateType & UpdateFontsSource.Annotation)
|
||||
pagesRepaint_Annotation.push(pageNum);
|
||||
|
||||
if (pageObj.fontsUpdateType & UpdateFontsSource.Forms)
|
||||
pagesRepaint_Forms.push(pageNum);
|
||||
|
||||
pageObj.fontsUpdateType = UpdateFontsSource.Undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (pagesRepaint_Page.length > 0 && drawingFile.onRepaintPages)
|
||||
drawingFile.onRepaintPages(pagesRepaint_Page);
|
||||
|
||||
if (pagesRepaint_Annotation.length > 0 && drawingFile.onRepaintAnnotations)
|
||||
drawingFile.onRepaintAnnotations(pagesRepaint_Annotation);
|
||||
|
||||
if (pagesRepaint_Forms.length > 0 && drawingFile.onRepaintForms)
|
||||
drawingFile.onRepaintForms(pagesRepaint_Forms);
|
||||
|
||||
delete _t.externalCallback;
|
||||
};
|
||||
|
||||
if (2 !== file.LoadFontAsync)
|
||||
file.LoadFontAsync(baseFontsPath, null);
|
||||
}
|
||||
}
|
||||
|
||||
let memoryBuffer = fileId.toUtf8();
|
||||
let pointer = Module["_malloc"](memoryBuffer.length);
|
||||
Module.HEAP8.set(memoryBuffer, pointer);
|
||||
Module["HEAP8"][status] = (fileStatus == 0) ? 1 : 0;
|
||||
return pointer;
|
||||
};
|
||||
@ -1,14 +0,0 @@
|
||||
<!doctype html>
|
||||
<html style="width:100%;height:100%;margin:0;padding:0;">
|
||||
<head>
|
||||
<title>ONLYOFFICE Documents</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8">
|
||||
<script src="./code_raster.js"></script>
|
||||
<script src="./raster.js"></script>
|
||||
</head>
|
||||
<body style="width:100%;height:100%;margin:0;padding:0;overflow-x:scroll;overflow-y:scroll;">
|
||||
<div id="pos" style="position:absolute;margin:0;padding:0;left:0px;top:0px;width:0px;height:0px;"></div>
|
||||
<canvas style="position:fixed;left:0px;top:0px;" id="main"></canvas>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,105 +0,0 @@
|
||||
(function(window, undefined){
|
||||
|
||||
var printErr = undefined;
|
||||
var print = undefined;
|
||||
|
||||
var fetch = self.fetch;
|
||||
var getBinaryPromise = null;
|
||||
if (self.AscDesktopEditor && document.currentScript && 0 == document.currentScript.src.indexOf("file:///"))
|
||||
{
|
||||
fetch = undefined; // fetch not support file:/// scheme
|
||||
getBinaryPromise = function() {
|
||||
var wasmPath = "ascdesktop://raster/" + wasmBinaryFile.substr(8);
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', wasmPath, true);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
|
||||
if (xhr.overrideMimeType)
|
||||
xhr.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
else
|
||||
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
|
||||
|
||||
xhr.onload = function () {
|
||||
if (this.status == 200) {
|
||||
resolve(new Uint8Array(this.response));
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getBinaryPromise = function() { return getBinaryPromise2(); }
|
||||
}
|
||||
|
||||
//module
|
||||
|
||||
function Raster()
|
||||
{
|
||||
this.isInit = false;
|
||||
|
||||
this.openImage = function(dataBuffer)
|
||||
{
|
||||
if (!this.isInit)
|
||||
{
|
||||
// module not loaded yet
|
||||
return null;
|
||||
}
|
||||
|
||||
// copy memory to webasm memory
|
||||
var imageFileRawDataSize = dataBuffer.byteLength;
|
||||
var imageFileRawData = Module["_Raster_Malloc"](imageFileRawDataSize);
|
||||
if (0 === imageFileRawData)
|
||||
return null;
|
||||
|
||||
var uint8DataBuffer = new Uint8Array(dataBuffer);
|
||||
Module["HEAP8"].set(uint8DataBuffer, imageFileRawData);
|
||||
|
||||
// load image
|
||||
var imageFile = Module["_Raster_Load"](imageFileRawData, imageFileRawDataSize);
|
||||
if (0 === imageFile)
|
||||
{
|
||||
Module["_Raster_Free"](imageFileRawData);
|
||||
return null;
|
||||
}
|
||||
|
||||
// get image data
|
||||
var imageW = Module["_Raster_GetWidth"](imageFile);
|
||||
var imageH = Module["_Raster_GetHeight"](imageFile);
|
||||
var imageRGBA = Module["_Raster_GetRGBA"](imageFile);
|
||||
|
||||
if (imageW <= 0 || imageH <= 0 || 0 === imageRGBA)
|
||||
{
|
||||
Module["_Raster_Destroy"](imageFile);
|
||||
Module["_Raster_Free"](imageFileRawData);
|
||||
return null;
|
||||
}
|
||||
|
||||
// quickly copy memory to canvas
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.width = imageW;
|
||||
canvas.height = imageH;
|
||||
|
||||
var canvasCtx = canvas.getContext("2d");
|
||||
var imageRGBAClampedArray = new Uint8ClampedArray(Module["HEAP8"].buffer, imageRGBA, 4 * imageW * imageH);
|
||||
var canvasData = new ImageData(imageRGBAClampedArray, imageW, imageH);
|
||||
|
||||
canvasCtx.putImageData(canvasData, 0, 0);
|
||||
|
||||
Module["_Raster_Destroy"](imageFile);
|
||||
Module["_Raster_Free"](imageFileRawData);
|
||||
|
||||
return canvas;
|
||||
}
|
||||
}
|
||||
|
||||
window.nativeRasterEngine = new Raster();
|
||||
window.onEngineInit = function()
|
||||
{
|
||||
window.nativeRasterEngine.isInit = true;
|
||||
};
|
||||
|
||||
})(window, undefined);
|
||||
@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
function CBinaryReader(data, start, size)
|
||||
{
|
||||
this.data = data;
|
||||
this.pos = start;
|
||||
this.limit = start + size;
|
||||
}
|
||||
CBinaryReader.prototype.readByte = function()
|
||||
{
|
||||
let val = this.data[this.pos];
|
||||
this.pos += 1;
|
||||
return val;
|
||||
};
|
||||
CBinaryReader.prototype.readShort = function()
|
||||
{
|
||||
let val = this.data[this.pos] | this.data[this.pos + 1] << 8;
|
||||
this.pos += 2;
|
||||
return val;
|
||||
};
|
||||
CBinaryReader.prototype.readInt = function()
|
||||
{
|
||||
let val = this.data[this.pos] | this.data[this.pos + 1] << 8 | this.data[this.pos + 2] << 16 | this.data[this.pos + 3] << 24;
|
||||
this.pos += 4;
|
||||
return val;
|
||||
};
|
||||
CBinaryReader.prototype.readDouble = function()
|
||||
{
|
||||
return this.readInt() / 100;
|
||||
};
|
||||
CBinaryReader.prototype.readDouble2 = function()
|
||||
{
|
||||
return this.readInt() / 10000;
|
||||
};
|
||||
CBinaryReader.prototype.readDouble3 = function()
|
||||
{
|
||||
return this.readInt() / 100000;
|
||||
};
|
||||
CBinaryReader.prototype.readString = function()
|
||||
{
|
||||
let len = this.readInt();
|
||||
let val = String.prototype.fromUtf8(this.data, this.pos, len);
|
||||
this.pos += len;
|
||||
return val;
|
||||
};
|
||||
CBinaryReader.prototype.readString2 = function()
|
||||
{
|
||||
let len = this.readShort();
|
||||
let val = "";
|
||||
for (let i = 0; i < len; ++i)
|
||||
{
|
||||
let c = this.readShort();
|
||||
val += String.fromCharCode(c);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
CBinaryReader.prototype.readData = function()
|
||||
{
|
||||
let len = this.readInt() - 4;
|
||||
let val = this.data.slice(this.pos, this.pos + len);
|
||||
this.pos += len;
|
||||
return val;
|
||||
};
|
||||
CBinaryReader.prototype.isValid = function()
|
||||
{
|
||||
return (this.pos < this.limit) ? true : false;
|
||||
};
|
||||
CBinaryReader.prototype.Skip = function(nPos)
|
||||
{
|
||||
this.pos += nPos;
|
||||
};
|
||||
|
||||
function CBinaryWriter()
|
||||
{
|
||||
this.size = 100000;
|
||||
this.dataSize = 0;
|
||||
this.buffer = new Uint8Array(this.size);
|
||||
}
|
||||
CBinaryWriter.prototype.checkAlloc = function(addition)
|
||||
{
|
||||
if ((this.dataSize + addition) <= this.size)
|
||||
return;
|
||||
|
||||
let newSize = Math.max(this.size * 2, this.size + addition);
|
||||
let newBuffer = new Uint8Array(newSize);
|
||||
newBuffer.set(this.buffer, 0);
|
||||
|
||||
this.size = newSize;
|
||||
this.buffer = newBuffer;
|
||||
};
|
||||
CBinaryWriter.prototype.writeUint = function(value)
|
||||
{
|
||||
this.checkAlloc(4);
|
||||
let val = (value>2147483647)?value-4294967296:value;
|
||||
this.buffer[this.dataSize++] = (val) & 0xFF;
|
||||
this.buffer[this.dataSize++] = (val >>> 8) & 0xFF;
|
||||
this.buffer[this.dataSize++] = (val >>> 16) & 0xFF;
|
||||
this.buffer[this.dataSize++] = (val >>> 24) & 0xFF;
|
||||
};
|
||||
CBinaryWriter.prototype.writeString = function(value)
|
||||
{
|
||||
let valueUtf8 = value.toUtf8();
|
||||
this.checkAlloc(valueUtf8.length);
|
||||
this.buffer.set(valueUtf8, this.dataSize);
|
||||
this.dataSize += valueUtf8.length;
|
||||
};
|
||||
@ -1,6 +0,0 @@
|
||||
<<<<<<<
|
||||
#define FT_COMPONENT smooth
|
||||
=======
|
||||
#define FT_COMPONENT smooth
|
||||
#include <wasm_jmp.h>
|
||||
>>>>>>>
|
||||
@ -1,71 +0,0 @@
|
||||
<<<<<<<
|
||||
static int
|
||||
gray_convert_glyph_inner( RAS_ARG,
|
||||
int continued )
|
||||
{
|
||||
int error;
|
||||
|
||||
|
||||
if ( ft_setjmp( ras.jump_buffer ) == 0 )
|
||||
{
|
||||
if ( continued )
|
||||
FT_Trace_Disable();
|
||||
error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
|
||||
if ( continued )
|
||||
FT_Trace_Enable();
|
||||
|
||||
if ( !ras.invalid )
|
||||
gray_record_cell( RAS_VAR );
|
||||
|
||||
FT_TRACE7(( "band [%d..%d]: %ld cell%s\n",
|
||||
ras.min_ey,
|
||||
ras.max_ey,
|
||||
ras.num_cells,
|
||||
ras.num_cells == 1 ? "" : "s" ));
|
||||
}
|
||||
else
|
||||
{
|
||||
error = FT_THROW( Memory_Overflow );
|
||||
|
||||
FT_TRACE7(( "band [%d..%d]: to be bisected\n",
|
||||
ras.min_ey, ras.max_ey ));
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
=======
|
||||
static int
|
||||
gray_convert_glyph_inner( RAS_ARG,
|
||||
int continued )
|
||||
{
|
||||
int error;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if ( continued )
|
||||
FT_Trace_Disable();
|
||||
error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
|
||||
if ( continued )
|
||||
FT_Trace_Enable();
|
||||
|
||||
if ( !ras.invalid )
|
||||
gray_record_cell( RAS_VAR );
|
||||
|
||||
FT_TRACE7(( "band [%d..%d]: %ld cell%s\n",
|
||||
ras.min_ey,
|
||||
ras.max_ey,
|
||||
ras.num_cells,
|
||||
ras.num_cells == 1 ? "" : "s" ));
|
||||
}
|
||||
catch(int jmp)
|
||||
{
|
||||
error = FT_THROW( Memory_Overflow );
|
||||
|
||||
FT_TRACE7(( "band [%d..%d]: to be bisected\n",
|
||||
ras.min_ey, ras.max_ey ));
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
>>>>>>>
|
||||
@ -1,5 +0,0 @@
|
||||
<<<<<<<
|
||||
ft_longjmp( ras.jump_buffer, 1 );
|
||||
=======
|
||||
ft_longjmp_ex( ras.jump_buffer, 1 );
|
||||
>>>>>>>
|
||||
@ -1,7 +0,0 @@
|
||||
<<<<<<<
|
||||
#include <freetype/ftlist.h>
|
||||
=======
|
||||
#include <wasm_jmp.h>
|
||||
|
||||
#include <freetype/ftlist.h>
|
||||
>>>>>>>
|
||||
@ -1,5 +0,0 @@
|
||||
<<<<<<<
|
||||
ft_longjmp( *(ft_jmp_buf*) jump_buffer, 1 );
|
||||
=======
|
||||
ft_longjmp_ex( *(ft_jmp_buf*) jump_buffer, 1 );
|
||||
>>>>>>>
|
||||
@ -1,8 +0,0 @@
|
||||
<<<<<<<
|
||||
#include <stdio.h>
|
||||
=======
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
>>>>>>>
|
||||
@ -1,5 +0,0 @@
|
||||
<<<<<<<
|
||||
#include "ttcmap.c"
|
||||
=======
|
||||
#include "ttcmap.cpp"
|
||||
>>>>>>>
|
||||
@ -1,5 +0,0 @@
|
||||
<<<<<<<
|
||||
#include "ftgrays.c"
|
||||
=======
|
||||
#include "ftgrays.cpp"
|
||||
>>>>>>>
|
||||
@ -1,16 +0,0 @@
|
||||
<<<<<<<
|
||||
if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer) == 0 )
|
||||
{
|
||||
/* validate this cmap sub-table */
|
||||
error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );
|
||||
}
|
||||
=======
|
||||
try
|
||||
{
|
||||
/* validate this cmap sub-table */
|
||||
error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );
|
||||
}
|
||||
catch (int jmp)
|
||||
{
|
||||
}
|
||||
>>>>>>>
|
||||
@ -32,6 +32,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#include "HTMLRendererText.h"
|
||||
#include "Text.h"
|
||||
|
||||
@ -357,6 +358,17 @@ namespace NSHtmlRenderer
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CHTMLRendererText::CommandDrawType3CHAR(const std::wstring& wsUnicodeText, const double& x, const double& y, const double& w, const double& h, const double& ascent, const double& descent, const double& unitsPerEm)
|
||||
{
|
||||
m_pInternal->m_oSmartText.m_oFontManager.SetType3Metrics(ascent, descent, unitsPerEm, w);
|
||||
|
||||
m_pInternal->GetUnicodes(wsUnicodeText);
|
||||
m_pInternal->WriteText(m_pInternal->m_pTempUnicodes, NULL, m_pInternal->m_nTempUnicodesLen, x, y);
|
||||
|
||||
m_pInternal->m_oSmartText.m_oFontManager.ClearType3();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-------- Command markers ---------------------------------------------------------------
|
||||
HRESULT CHTMLRendererText::BeginCommand(const DWORD& lType) { return S_OK; }
|
||||
HRESULT CHTMLRendererText::EndCommand(const DWORD& lType) { return S_OK; }
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifndef _ASC_HTMLRENDERER3_TEXT_H_
|
||||
#define _ASC_HTMLRENDERER3_TEXT_H_
|
||||
|
||||
@ -144,6 +145,8 @@ namespace NSHtmlRenderer
|
||||
virtual HRESULT CommandDrawTextExCHAR(const LONG& c, const LONG& gid, const double& x, const double& y, const double& w, const double& h);
|
||||
virtual HRESULT CommandDrawTextEx(const std::wstring& bsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& x, const double& y, const double& w, const double& h);
|
||||
|
||||
virtual HRESULT CommandDrawType3CHAR(const std::wstring& wsUnicodeText, const double& x, const double& y, const double& w, const double& h, const double& ascent, const double& descent, const double& unitsPerEm);
|
||||
|
||||
//-------- Command markers ---------------------------------------------------------------
|
||||
virtual HRESULT BeginCommand(const DWORD& lType);
|
||||
virtual HRESULT EndCommand(const DWORD& lType);
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifndef _ASC_HTMLRENDERER_TEXT_H_
|
||||
#define _ASC_HTMLRENDERER_TEXT_H_
|
||||
|
||||
@ -45,9 +46,9 @@ namespace NSHtmlRenderer
|
||||
{
|
||||
struct CHFontInfo
|
||||
{
|
||||
int m_lAscent;
|
||||
int m_lDescent;
|
||||
int m_lUnitsPerEm;
|
||||
double m_lAscent;
|
||||
double m_lDescent;
|
||||
double m_lUnitsPerEm;
|
||||
|
||||
CHFontInfo() : m_lAscent(0), m_lDescent(0), m_lUnitsPerEm(0) {}
|
||||
CHFontInfo(const CHFontInfo& oSrc) : m_lAscent(oSrc.m_lAscent), m_lDescent(oSrc.m_lDescent), m_lUnitsPerEm(oSrc.m_lUnitsPerEm) {}
|
||||
@ -68,13 +69,29 @@ namespace NSHtmlRenderer
|
||||
NSStructures::CFont* m_pFont;
|
||||
CHFontInfo m_oCurrentInfo;
|
||||
|
||||
bool m_bIsType3;
|
||||
double m_dType3GlyphWidth;
|
||||
|
||||
public:
|
||||
CFontManagerWrapper() : m_pManager(NULL) {}
|
||||
CFontManagerWrapper() : m_pManager(NULL), m_bIsType3(false), m_dType3GlyphWidth(0) {}
|
||||
virtual ~CFontManagerWrapper()
|
||||
{
|
||||
RELEASEOBJECT(m_pManager);
|
||||
}
|
||||
|
||||
void SetType3Metrics(double dAscent, double dDescent, double dUnitsPerEm, double dGlyphWidth)
|
||||
{
|
||||
m_bIsType3 = true;
|
||||
m_dType3GlyphWidth = dGlyphWidth;
|
||||
m_oCurrentInfo.m_lAscent = dAscent;
|
||||
m_oCurrentInfo.m_lDescent = dDescent;
|
||||
m_oCurrentInfo.m_lUnitsPerEm = dUnitsPerEm > 0 ? dUnitsPerEm : 1000;
|
||||
}
|
||||
void ClearType3()
|
||||
{
|
||||
m_bIsType3 = false;
|
||||
}
|
||||
|
||||
void Init(NSFonts::IApplicationFonts* pApplicationFonts, int nCacheSize = 0)
|
||||
{
|
||||
RELEASEOBJECT(m_pManager);
|
||||
@ -98,15 +115,25 @@ namespace NSHtmlRenderer
|
||||
else
|
||||
LoadFontByFile(m_pFont->Path, m_pFont->Size);
|
||||
}
|
||||
double MeasureString(const unsigned int* symbols, const int& count, double x, double y)
|
||||
TBBox MeasureString(const unsigned int* symbols, const int& count, double x, double y)
|
||||
{
|
||||
if (m_bIsType3)
|
||||
{
|
||||
TBBox oBox;
|
||||
double dUnitsPerEm = m_oCurrentInfo.m_lUnitsPerEm > 0 ? m_oCurrentInfo.m_lUnitsPerEm : 1000;
|
||||
double dFontSizePt = m_pFont ? m_pFont->Size : 10.0;
|
||||
oBox.fMinX = (float)x;
|
||||
oBox.fMinY = (float)(-(m_oCurrentInfo.m_lAscent / dUnitsPerEm) * dFontSizePt);
|
||||
oBox.fMaxX = (float)(x + m_dType3GlyphWidth);
|
||||
oBox.fMaxY = (float)( (m_oCurrentInfo.m_lDescent / dUnitsPerEm) * dFontSizePt);
|
||||
return oBox;
|
||||
}
|
||||
|
||||
if (!m_pManager)
|
||||
return 0;
|
||||
return TBBox();
|
||||
|
||||
m_pManager->LoadString1(symbols, count, (float)x, (float)y);
|
||||
TBBox _box = m_pManager->MeasureString2();
|
||||
|
||||
return abs((_box.fMaxX - _box.fMinX) * 25.4 / 72.0);
|
||||
return m_pManager->MeasureString2();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -358,7 +385,7 @@ namespace NSHtmlRenderer
|
||||
}
|
||||
|
||||
// done, baseline is set. now just continue the line
|
||||
if (bIsDumpFont)
|
||||
if (bIsDumpFont && !m_oFontManager.m_bIsType3)
|
||||
m_oFontManager.LoadCurrentFont();
|
||||
|
||||
double dKoef = m_oFontManager.m_pFont->Size * 25.4 / (72 * m_oFontManager.m_oCurrentInfo.m_lUnitsPerEm);
|
||||
@ -386,7 +413,14 @@ namespace NSHtmlRenderer
|
||||
double dPrevW = dOffsetX;
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
double dW = m_oFontManager.MeasureString((const unsigned int*)(input + i), 1, 0, 0);
|
||||
TBBox bBox = m_oFontManager.MeasureString((const unsigned int*)(input + i), 1, 0, 0);
|
||||
double dW = std::abs((bBox.fMaxX - bBox.fMinX) * 25.4 / 72.0);
|
||||
double dMeasureAscent = std::abs(bBox.fMinY * 25.4 / 72.0);
|
||||
double dMeasureDescent = std::abs(bBox.fMaxY * 25.4 / 72.0);
|
||||
if (m_oLine.m_dAscent < dMeasureAscent)
|
||||
m_oLine.m_dAscent = dMeasureAscent;
|
||||
if (m_oLine.m_dDescent < dMeasureDescent)
|
||||
m_oLine.m_dDescent = dMeasureDescent;
|
||||
|
||||
NSWasm::CHChar* pChar = m_oLine.AddTail();
|
||||
pChar->unicode = pUnicodes[i];
|
||||
|
||||
@ -1,233 +0,0 @@
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../../../../../common/Base64.h"
|
||||
#include "../../../../../doctrenderer/drawingfile.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WASM_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define WASM_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
NSFonts::IApplicationFonts* g_applicationFonts = NULL;
|
||||
WASM_EXPORT void InitializeFontsBin(BYTE* data, int size)
|
||||
{
|
||||
if (!g_applicationFonts)
|
||||
{
|
||||
g_applicationFonts = NSFonts::NSApplication::Create();
|
||||
g_applicationFonts->InitializeFromBin(data, (unsigned int)size);
|
||||
}
|
||||
}
|
||||
WASM_EXPORT void InitializeFontsBase64(BYTE* pDataSrc, int nLenSrc)
|
||||
{
|
||||
if (!g_applicationFonts)
|
||||
{
|
||||
g_applicationFonts = NSFonts::NSApplication::Create();
|
||||
|
||||
int nLenDst = NSBase64::Base64DecodeGetRequiredLength(nLenSrc);
|
||||
BYTE* pDataDst = new BYTE[nLenDst];
|
||||
|
||||
if (FALSE == NSBase64::Base64Decode((const char*)pDataSrc, nLenSrc, pDataDst, &nLenDst))
|
||||
{
|
||||
RELEASEARRAYOBJECTS(pDataDst);
|
||||
return;
|
||||
}
|
||||
|
||||
g_applicationFonts->InitializeFromBin(pDataDst, (unsigned int)nLenDst);
|
||||
RELEASEARRAYOBJECTS(pDataDst);
|
||||
}
|
||||
}
|
||||
WASM_EXPORT void InitializeFontsRanges(BYTE* pDataSrc)
|
||||
{
|
||||
if (g_applicationFonts && pDataSrc)
|
||||
g_applicationFonts->InitializeRanges(pDataSrc);
|
||||
}
|
||||
WASM_EXPORT void SetFontBinary(char* path, BYTE* data, int size)
|
||||
{
|
||||
NSFonts::IFontsMemoryStorage* pStorage = CDrawingFile::GetFontsStorage();
|
||||
if (pStorage)
|
||||
{
|
||||
std::string sPathA(path);
|
||||
pStorage->Add(UTF8_TO_U(sPathA), data, size, true);
|
||||
}
|
||||
}
|
||||
WASM_EXPORT int IsFontBinaryExist(char* path)
|
||||
{
|
||||
NSFonts::IFontsMemoryStorage* pStorage = CDrawingFile::GetFontsStorage();
|
||||
if (pStorage)
|
||||
{
|
||||
std::string sPathA(path);
|
||||
NSFonts::IFontStream* pStream = pStorage->Get(UTF8_TO_U(sPathA));
|
||||
if (pStream)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
WASM_EXPORT CDrawingFile* Open(BYTE* data, LONG size, const char* password)
|
||||
{
|
||||
if (!g_applicationFonts)
|
||||
g_applicationFonts = NSFonts::NSApplication::Create();
|
||||
|
||||
// always recreate storage
|
||||
CDrawingFile::InitFontsGlobalStorage();
|
||||
|
||||
CDrawingFile* pFile = new CDrawingFile(g_applicationFonts);
|
||||
std::wstring sPassword = L"";
|
||||
if (NULL != password)
|
||||
sPassword = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)password, strlen(password));
|
||||
pFile->OpenFile(data, size, password ? sPassword.c_str() : NULL);
|
||||
return pFile;
|
||||
}
|
||||
WASM_EXPORT int GetType(CDrawingFile* pFile)
|
||||
{
|
||||
// 0 - PDF
|
||||
// 1 - DJVU
|
||||
// 2 - XPS
|
||||
return pFile->GetType();
|
||||
}
|
||||
WASM_EXPORT int GetErrorCode(CDrawingFile* pFile)
|
||||
{
|
||||
if (!pFile)
|
||||
return -1;
|
||||
return pFile->GetErrorCode();
|
||||
}
|
||||
WASM_EXPORT void Close(CDrawingFile* pFile)
|
||||
{
|
||||
delete pFile;
|
||||
g_applicationFonts->GetStreams()->Clear();
|
||||
NSFonts::NSApplicationFontStream::SetGlobalMemoryStorage(NULL);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetInfo(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->GetInfo();
|
||||
}
|
||||
WASM_EXPORT BYTE* GetPixmap(CDrawingFile* pFile, int nPageIndex, int nRasterW, int nRasterH, int nBackgroundColor)
|
||||
{
|
||||
return pFile->GetPixmap(nPageIndex, nRasterW, nRasterH, nBackgroundColor);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetGlyphs(CDrawingFile* pFile, int nPageIndex)
|
||||
{
|
||||
return pFile->GetGlyphs(nPageIndex);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetLinks(CDrawingFile* pFile, int nPageIndex)
|
||||
{
|
||||
return pFile->GetLinks(nPageIndex);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetStructure(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->GetStructure();
|
||||
}
|
||||
WASM_EXPORT BYTE* GetInteractiveFormsInfo(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->GetInteractiveFormsInfo();
|
||||
}
|
||||
WASM_EXPORT BYTE* GetInteractiveFormsFonts(CDrawingFile* pFile, int nType)
|
||||
{
|
||||
return pFile->GetInteractiveFormsFonts(nType);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetInteractiveFormsAP(CDrawingFile* pFile, int nRasterW, int nRasterH, int nBackgroundColor, int nPageIndex, int nWidget, int nView, int nButtonView)
|
||||
{
|
||||
return pFile->GetInteractiveFormsAP(nRasterW, nRasterH, nBackgroundColor, nPageIndex, nWidget, nView, nButtonView);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetButtonIcons(CDrawingFile* pFile, int nBackgroundColor, int nPageIndex, int bBase64, int nButtonWidget, int nIconView)
|
||||
{
|
||||
return pFile->GetButtonIcons(nBackgroundColor, nPageIndex, bBase64 ? true : false, nButtonWidget, nIconView);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetAnnotationsInfo(CDrawingFile* pFile, int nPageIndex)
|
||||
{
|
||||
return pFile->GetAnnotationsInfo(nPageIndex);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetAnnotationsAP(CDrawingFile* pFile, int nRasterW, int nRasterH, int nBackgroundColor, int nPageIndex, int nAnnot, int nView)
|
||||
{
|
||||
return pFile->GetAnnotationsAP(nRasterW, nRasterH, nBackgroundColor, nPageIndex, nAnnot, nView);
|
||||
}
|
||||
WASM_EXPORT BYTE* GetFontBinary(CDrawingFile* pFile, char* path)
|
||||
{
|
||||
return pFile->GetFontBinary(std::string(path));
|
||||
}
|
||||
WASM_EXPORT BYTE* GetGIDByUnicode(CDrawingFile* pFile, char* path)
|
||||
{
|
||||
return pFile->GetGIDByUnicode(std::string(path));
|
||||
}
|
||||
WASM_EXPORT void DestroyTextInfo(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->DestroyTextInfo();
|
||||
}
|
||||
WASM_EXPORT int IsNeedCMap(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->IsNeedCMap() ? 1 : 0;
|
||||
}
|
||||
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);
|
||||
}
|
||||
WASM_EXPORT BYTE* SplitPages(CDrawingFile* pFile, int* arrPageIndex, int nLength, BYTE* data, LONG size)
|
||||
{
|
||||
return pFile->SplitPages(arrPageIndex, nLength, data, size);
|
||||
}
|
||||
WASM_EXPORT int MergePages(CDrawingFile* pFile, BYTE* data, LONG size, int nMaxID, const char* sPrefixForm)
|
||||
{
|
||||
return pFile->MergePages(data, size, nMaxID, sPrefixForm) ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT int UnmergePages(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->UnmergePages() ? 1 : 0;
|
||||
}
|
||||
WASM_EXPORT int RedactPage(CDrawingFile* pFile, int nPageIndex, int* arrRedactBox, int nLengthX8, BYTE* data, int size)
|
||||
{
|
||||
double* arrDRedactBox = new double[nLengthX8 * 8];
|
||||
for (int i = 0; i < nLengthX8 * 8; ++i)
|
||||
arrDRedactBox[i] = arrRedactBox[i] / 10000.0;
|
||||
int nRes = pFile->RedactPage(nPageIndex, arrDRedactBox, nLengthX8, data, size) ? 1 : 0;
|
||||
delete[] arrDRedactBox;
|
||||
return nRes;
|
||||
}
|
||||
WASM_EXPORT int UndoRedact(CDrawingFile* pFile)
|
||||
{
|
||||
return pFile->UndoRedact() ? 1 : 0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
WASM_EXPORT int CheckPerm(CDrawingFile* pFile, int nPermFlag)
|
||||
{
|
||||
return pFile->CheckPerm(nPermFlag) ? 1 : 0;
|
||||
}
|
||||
|
||||
WASM_EXPORT void* GetImageBase64(CDrawingFile* pFile, int rId)
|
||||
{
|
||||
return pFile->GetImageBase64(rId);
|
||||
}
|
||||
WASM_EXPORT int GetImageBase64Len(std::string* p)
|
||||
{
|
||||
return (int)p->length();
|
||||
}
|
||||
WASM_EXPORT char* GetImageBase64Ptr(std::string* p)
|
||||
{
|
||||
return (char*)p->c_str();
|
||||
}
|
||||
WASM_EXPORT void GetImageBase64Free(std::string* p)
|
||||
{
|
||||
*p = "";
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
#include "./wasm_jmp.h"
|
||||
|
||||
void ft_longjmp_ex(void* env, int val)
|
||||
{
|
||||
throw val;
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
#ifndef WASM_LONG_JMP_H_
|
||||
#define WASM_LONG_JMP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ft_longjmp_ex(void* env, int val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WASM_LONG_JMP_H_ */
|
||||
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
#include "../../../Image.h"
|
||||
|
||||
namespace MetaFile
|
||||
{
|
||||
class CMetaFile : public IMetaFile
|
||||
{
|
||||
public:
|
||||
CMetaFile(NSFonts::IApplicationFonts *pAppFonts) : IMetaFile(pAppFonts) {}
|
||||
virtual ~CMetaFile() {}
|
||||
|
||||
virtual void SetImageSize(int nWidth, int nHeight) {}
|
||||
virtual bool LoadFromFile(const wchar_t* wsFilePath) { return false; }
|
||||
virtual bool LoadFromBuffer(BYTE* pBuffer, unsigned int unSize) { return false; }
|
||||
virtual bool LoadFromString(const std::wstring& data) { return false; }
|
||||
virtual bool DrawOnRenderer(IRenderer* pRenderer, double dX, double dY, double dWidth, double dHeight) { return false; }
|
||||
virtual void Close() {}
|
||||
virtual void GetBounds(double* pdX, double* pdY, double* pdW, double* pdH) {}
|
||||
virtual int GetType() { return 0; }
|
||||
virtual void ConvertToRaster(const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
|
||||
virtual NSFonts::IFontManager* get_FontManager() { return NULL; }
|
||||
|
||||
virtual std::wstring ConvertToSvg(unsigned int unWidth = 0, unsigned int unHeight = 0) { return L""; }
|
||||
virtual void SetTempDirectory(const std::wstring& dir) {}
|
||||
|
||||
virtual void ConvertToXml(const wchar_t* wsFilePath) {}
|
||||
virtual void ConvertToXmlAndRaster(const wchar_t *wsXmlFilePath, const wchar_t* wsOutFilePath, unsigned int unFileType, int nWidth, int nHeight = -1) {}
|
||||
|
||||
virtual bool LoadFromXmlFile(const wchar_t* wsFilePath) { return false; }
|
||||
virtual void ConvertToEmf(const wchar_t *wsFilePath) {}
|
||||
};
|
||||
|
||||
IMetaFile* Create(NSFonts::IApplicationFonts *pAppFonts)
|
||||
{
|
||||
return new CMetaFile(pAppFonts);
|
||||
}
|
||||
}
|
||||
@ -1,184 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
#include "../../../../../../PdfFile/PdfWriter.h"
|
||||
|
||||
#ifdef BUILDING_WASM_MODULE
|
||||
CPdfWriter::CPdfWriter(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA, IRenderer* pRenderer, bool bCreate) : m_oCommandManager(this) {}
|
||||
CPdfWriter::~CPdfWriter() {}
|
||||
int CPdfWriter::SaveToFile(const std::wstring& wsPath) { return 0; }
|
||||
void CPdfWriter::SetPassword(const std::wstring& wsPassword) {}
|
||||
void CPdfWriter::SetDocumentID(const std::wstring& wsDocumentID) {}
|
||||
void CPdfWriter::SetDocumentInfo(const std::wstring& wsTitle, const std::wstring& wsCreator, const std::wstring& wsSubject, const std::wstring& wsKeywords) {}
|
||||
HRESULT CPdfWriter::NewPage() { return 0; }
|
||||
HRESULT CPdfWriter::get_Height(double* dHeight) { return 0; }
|
||||
HRESULT CPdfWriter::put_Height(const double& dHeight) { return 0; }
|
||||
HRESULT CPdfWriter::get_Width(double* dWidth) { return 0; }
|
||||
HRESULT CPdfWriter::put_Width(const double& dWidth) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenColor(LONG* lColor) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenColor(const LONG& lColor) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenAlpha(LONG* lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenAlpha(const LONG& lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenSize(double* dSize) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenSize(const double& dSize) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenDashStyle(BYTE* nDashStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenDashStyle(const BYTE& nDashStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenLineStartCap(BYTE* nCapStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenLineStartCap(const BYTE& nCapStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenLineEndCap(BYTE* nCapStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenLineEndCap(const BYTE& nCapStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenLineJoin(BYTE* nJoinStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenLineJoin(const BYTE& nJoinStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenDashOffset(double* dOffset) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenDashOffset(const double& dOffset) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenAlign(LONG* lAlign) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenAlign(const LONG& lAlign) { return 0; }
|
||||
HRESULT CPdfWriter::get_PenMiterLimit(double* dMiter) { return 0; }
|
||||
HRESULT CPdfWriter::put_PenMiterLimit(const double& dMiter) { return 0; }
|
||||
HRESULT CPdfWriter::PenDashPattern(double* pPattern, LONG lCount) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushType(LONG* lType) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushType(const LONG& lType) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushColor1(LONG* lColor) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushColor1(const LONG& lColor) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushAlpha1(LONG* lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushAlpha1(const LONG& lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushColor2(LONG* lColor) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushColor2(const LONG& lColor) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushAlpha2(LONG* lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushAlpha2(const LONG& lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushTexturePath(std::wstring* wsPath) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushTexturePath(const std::wstring& wsPath) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushTextureMode(LONG* lMode) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushTextureMode(const LONG& lMode) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushTextureAlpha(LONG* lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushTextureAlpha(const LONG& lAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushLinearAngle(double* dAngle) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushLinearAngle(const double& dAngle) { return 0; }
|
||||
HRESULT CPdfWriter::BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushTextureImage(Aggplus::CImage** pImage) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushTextureImage(Aggplus::CImage* pImage) { return 0; }
|
||||
HRESULT CPdfWriter::get_BrushTransform(Aggplus::CMatrix& oMatrix) { return 0; }
|
||||
HRESULT CPdfWriter::put_BrushTransform(const Aggplus::CMatrix& oMatrix) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontName(std::wstring* wsName) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontName(const std::wstring& wsName) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontPath(std::wstring* wsPath) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontPath(const std::wstring& wsPath) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontSize(double* dSize) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontSize(const double& dSize) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontStyle(LONG* lStyle) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontStyle(const LONG& lStyle) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontStringGID(INT* bGid) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontStringGID(const INT& bGid) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontCharSpace(double* dSpace) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontCharSpace(const double& dSpace) { return 0; }
|
||||
HRESULT CPdfWriter::get_FontFaceIndex(int* lFaceIndex) { return 0; }
|
||||
HRESULT CPdfWriter::put_FontFaceIndex(const int& lFaceIndex) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::CommandDrawTextCHAR2 (unsigned int* unUnicode, const unsigned int& unUnicodeCount, const unsigned int& unGid, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::EndCommand(const DWORD& lType) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandMoveTo(const double& dX, const double& dY) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandLineTo(const double& dX, const double& dY) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandLinesTo(double* pPoints, const int& nCount) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandCurveTo(const double& dX1, const double& dY1, const double& dX2, const double& dY2, const double& dXe, const double& dYe) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandCurvesTo(double* pPoints, const int& nCount) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandArcTo(const double& dX, const double& dY, const double& dW, const double& dH, const double& dStartAngle, const double& dSweepAngle) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandClose() { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandEnd() { return 0; }
|
||||
HRESULT CPdfWriter::DrawPath(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory, const LONG& lType) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandStart() { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandGetCurrentPoint(double* dX, double* dY) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory, const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha) { return 0; }
|
||||
HRESULT CPdfWriter::SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY) { return 0; }
|
||||
HRESULT CPdfWriter::GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY) { return 0; }
|
||||
HRESULT CPdfWriter::ResetTransform() { return 0; }
|
||||
HRESULT CPdfWriter::get_ClipMode(LONG* lMode) { return 0; }
|
||||
HRESULT CPdfWriter::put_ClipMode(const LONG& lMode) { return 0; }
|
||||
HRESULT CPdfWriter::AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip) { return 0; }
|
||||
HRESULT CPdfWriter::AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage) { return 0; }
|
||||
HRESULT CPdfWriter::AddFormField(NSFonts::IApplicationFonts* pAppFonts, CFormFieldInfo* pInfo, const std::wstring& wsTempDirectory) { return 0; }
|
||||
HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotFieldInfo* pFieldInfo) { return 0; }
|
||||
HRESULT CPdfWriter::AddMetaData(const std::wstring& sMetaName, BYTE* pMetaData, DWORD nMetaLength) { return 0; }
|
||||
HRESULT CPdfWriter::DrawImage1bpp(NSImages::CPixJbig2* pImageBuffer, const unsigned int& unWidth, const unsigned int& unHeight, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
HRESULT CPdfWriter::EnableBrushRect(const LONG& lEnable) { return 0; }
|
||||
HRESULT CPdfWriter::SetLinearGradient(const double& dX1, const double& dY1, const double& dX2, const double& dY2) { return 0; }
|
||||
HRESULT CPdfWriter::SetRadialGradient(const double& dX1, const double& dY1, const double& dR1, const double& dX2, const double& dY2, const double& dR2) { return 0; }
|
||||
HRESULT CPdfWriter::DrawImageWith1bppMask(IGrObject* pImage, NSImages::CPixJbig2* pMaskBuffer, const unsigned int& unMaskWidth, const unsigned int& unMaskHeight, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; }
|
||||
bool CPdfWriter::EditPage(PdfWriter::CPage* pNewPage) { return false; }
|
||||
bool CPdfWriter::AddPage(int nPageIndex) { return false; }
|
||||
bool CPdfWriter::EditClose() { return false; }
|
||||
void CPdfWriter::PageRotate(int nRotate) {}
|
||||
void CPdfWriter::Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate) {}
|
||||
HRESULT CPdfWriter::EditWidgetParents(NSFonts::IApplicationFonts* pAppFonts, CWidgetsInfo* pFieldInfo, const std::wstring& wsTempDirectory) { return 0; }
|
||||
PdfWriter::CDocument* CPdfWriter::GetDocument() { return NULL; }
|
||||
PdfWriter::CPage* CPdfWriter::GetPage() { return NULL; }
|
||||
void CPdfWriter::AddFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic, const std::wstring& wsFontPath, const LONG& lFaceIndex) {}
|
||||
void CPdfWriter::SetHeadings(CHeadings* pCommand) {}
|
||||
PdfWriter::CImageDict* CPdfWriter::LoadImage(Aggplus::CImage* pImage, BYTE nAlpha) { return NULL; }
|
||||
PdfWriter::CImageDict* CPdfWriter::DrawImage(Aggplus::CImage* pImage, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha) { return NULL; }
|
||||
bool CPdfWriter::DrawText(unsigned char* pCodes, const unsigned int& unLen, const double& dX, const double& dY, const std::string& sPUA) { return false; }
|
||||
bool CPdfWriter::DrawTextToRenderer(const unsigned int* unGid, const unsigned int& unLen, const double& dX, const double& dY) { return false; }
|
||||
bool CPdfWriter::PathCommandDrawText(unsigned int* pUnicodes, unsigned int unLen, const double& dX, const double& dY, const unsigned int* pGids) { return false; }
|
||||
bool CPdfWriter::UpdateFont() { return false; }
|
||||
bool CPdfWriter::GetFontPath(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic, std::wstring& wsFontPath, LONG& lFaceIndex) { return false; }
|
||||
PdfWriter::CFontCidTrueType* CPdfWriter::GetFont(const std::wstring& wsFontPath, const LONG& lFontIndex) { return NULL; }
|
||||
PdfWriter::CFontCidTrueType* CPdfWriter::GetFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic) { return NULL; }
|
||||
void CPdfWriter::UpdateTransform() {}
|
||||
void CPdfWriter::UpdatePen() {}
|
||||
void CPdfWriter::UpdateBrush(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory) {}
|
||||
void CPdfWriter::Reset() {}
|
||||
bool CPdfWriter::IsValid() { return false; }
|
||||
bool CPdfWriter::IsPageValid() { return false; }
|
||||
void CPdfWriter::SetError() {}
|
||||
void CPdfWriter::AddLink(PdfWriter::CPage* pPage, const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const unsigned int& unDestPage) {}
|
||||
unsigned char* CPdfWriter::EncodeString(const unsigned int* pUnicodes, const unsigned int& unUnicodesCount, const unsigned int* pGIDs) { return NULL; }
|
||||
unsigned char* CPdfWriter::EncodeGID(const unsigned int& unGID, const unsigned int* pUnicodes, const unsigned int& unUnicodesCount) { return NULL; }
|
||||
std::wstring CPdfWriter::GetDownloadFile(const std::wstring& sUrl, const std::wstring& wsTempDirectory) { return std::wstring(); }
|
||||
|
||||
CCommandManager::CCommandManager(CPdfWriter* pRenderer) {}
|
||||
CCommandManager::~CCommandManager() {}
|
||||
CRendererTextCommand* CCommandManager::AddText(unsigned char* pCodes, unsigned int nLen, const double& dX, const double& dY) { return NULL; }
|
||||
void CCommandManager::Flush() {}
|
||||
void CCommandManager::Add(CRendererCommandBase* pCommand) {}
|
||||
void CCommandManager::Clear() {}
|
||||
void CBrushState::Reset() {}
|
||||
#endif // BUILDING_WASM_MODULE
|
||||
@ -1,70 +0,0 @@
|
||||
#include "raster.h"
|
||||
|
||||
void* Raster_Malloc(unsigned int size)
|
||||
{
|
||||
return ::malloc(size);
|
||||
}
|
||||
void Raster_Free(void* p)
|
||||
{
|
||||
if (p) ::free(p);
|
||||
}
|
||||
CBgraFrame* Raster_Create()
|
||||
{
|
||||
return new CBgraFrame();
|
||||
}
|
||||
CBgraFrame* Raster_Load(unsigned char* buffer, int size)
|
||||
{
|
||||
CBgraFrame* oRes = new CBgraFrame();
|
||||
oRes->put_IsRGBA(true);
|
||||
oRes->Decode(buffer, size);
|
||||
return oRes;
|
||||
}
|
||||
CBgraFrame* Raster_Init(double width_px, double height_px)
|
||||
{
|
||||
int nRasterW = (int)width_px;
|
||||
int nRasterH = (int)height_px;
|
||||
BYTE* pData = new BYTE[4 * nRasterW * nRasterH];
|
||||
|
||||
unsigned int back = 0xffffff;
|
||||
unsigned int* pData32 = (unsigned int*)pData;
|
||||
unsigned int* pData32End = pData32 + nRasterW * nRasterH;
|
||||
while (pData32 < pData32End)
|
||||
*pData32++ = back;
|
||||
|
||||
CBgraFrame* oRes = new CBgraFrame();
|
||||
oRes->put_IsRGBA(true);
|
||||
oRes->put_Data(pData);
|
||||
oRes->put_Width(nRasterW);
|
||||
oRes->put_Height(nRasterH);
|
||||
return oRes;
|
||||
}
|
||||
void Raster_Destroy(CBgraFrame* p)
|
||||
{
|
||||
if (p) delete p;
|
||||
}
|
||||
int Raster_GetHeight(CBgraFrame* p)
|
||||
{
|
||||
if (p) return p->get_Height();
|
||||
return -1;
|
||||
}
|
||||
int Raster_GetWidth (CBgraFrame* p)
|
||||
{
|
||||
if (p) return p->get_Width();
|
||||
return -1;
|
||||
}
|
||||
bool Raster_Decode(CBgraFrame* p, unsigned char* buffer, int size)
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
p->put_IsRGBA(true);
|
||||
bool bRes = p->Decode(buffer, size);
|
||||
return bRes;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
unsigned char* Raster_GetRGBA(CBgraFrame* p)
|
||||
{
|
||||
unsigned char* buffer = NULL;
|
||||
if (p) buffer = p->get_Data();
|
||||
return buffer;
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
#ifndef _RASTER_H
|
||||
#define _RASTER_H
|
||||
|
||||
#ifndef RASTER_USE_DYNAMIC_LIBRARY
|
||||
#define RASTER_DECL_EXPORT
|
||||
#else
|
||||
#include "../../../../../common/base_export.h"
|
||||
#define RASTER_DECL_EXPORT Q_DECL_EXPORT
|
||||
#endif
|
||||
|
||||
#include <malloc.h>
|
||||
#include "../../../../../raster/BgraFrame.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
RASTER_DECL_EXPORT void* Raster_Malloc(unsigned int size);
|
||||
RASTER_DECL_EXPORT void Raster_Free(void* p);
|
||||
|
||||
RASTER_DECL_EXPORT CBgraFrame* Raster_Create();
|
||||
RASTER_DECL_EXPORT CBgraFrame* Raster_Load(unsigned char* buffer, int size);
|
||||
RASTER_DECL_EXPORT CBgraFrame* Raster_Init(double width_px, double height_px);
|
||||
RASTER_DECL_EXPORT void Raster_Destroy(CBgraFrame* p);
|
||||
|
||||
RASTER_DECL_EXPORT int Raster_GetHeight(CBgraFrame* p);
|
||||
RASTER_DECL_EXPORT int Raster_GetWidth (CBgraFrame* p);
|
||||
|
||||
RASTER_DECL_EXPORT bool Raster_Decode(CBgraFrame* p, unsigned char* buffer, int size);
|
||||
RASTER_DECL_EXPORT unsigned char* Raster_GetRGBA(CBgraFrame* p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _RASTER_H
|
||||
@ -1,3 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#ifndef _WASM_SERIALIZE_H
|
||||
#define _WASM_SERIALIZE_H
|
||||
|
||||
|
||||
@ -144,3 +144,5 @@ void IOfficeDrawingFile::ConvertToRaster(int nPageIndex, const std::wstring& pat
|
||||
pFrame->SaveFile(path, nImageType);
|
||||
RELEASEOBJECT(pFrame);
|
||||
}
|
||||
|
||||
void IOfficeDrawingFile::SetPainter(IOfficeDrawingFilePainter* pPainter) {}
|
||||
|
||||
@ -59,6 +59,26 @@ struct COfficeDrawingPageParams
|
||||
}
|
||||
};
|
||||
|
||||
class IOfficeDrawingFilePainter
|
||||
{
|
||||
public:
|
||||
enum class State
|
||||
{
|
||||
Paused,
|
||||
Stopped,
|
||||
Runned
|
||||
};
|
||||
|
||||
enum class Status
|
||||
{
|
||||
Ok,
|
||||
Cancel
|
||||
};
|
||||
|
||||
virtual State GetState() = 0;
|
||||
virtual void OnPaint(const Status&) = 0;
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL IOfficeDrawingFile
|
||||
{
|
||||
public:
|
||||
@ -106,6 +126,9 @@ public:
|
||||
virtual std::wstring GetInfo() = 0;
|
||||
virtual unsigned char* GetStructure() = 0;
|
||||
virtual unsigned char* GetLinks(int nPageIndex) = 0;
|
||||
|
||||
// DrawingFile control
|
||||
virtual void SetPainter(IOfficeDrawingFilePainter* pPainter);
|
||||
};
|
||||
|
||||
#endif // _OFFICE_DRAWING_FILE_H
|
||||
|
||||
@ -119,8 +119,8 @@ namespace XmlUtils
|
||||
void GetTextWithHHHH(bool bPreserve, wchar_t*& sBuffer, long& nSize, long& nLen);
|
||||
std::wstring GetTextWithHHHH(bool bPreserve);
|
||||
|
||||
std::wstring GetOuterXml();
|
||||
std::wstring GetInnerXml();
|
||||
std::wstring GetOuterXml(bool bEncodingXml = true);
|
||||
std::wstring GetInnerXml(bool bEncodingXml = true);
|
||||
|
||||
int GetAttributesCount();
|
||||
bool MoveToFirstAttribute();
|
||||
|
||||
@ -211,13 +211,13 @@ namespace XmlUtils
|
||||
return m_pInternal->GetTextWithHHHH(bPreserve);
|
||||
}
|
||||
|
||||
std::wstring CXmlLiteReader::GetOuterXml()
|
||||
std::wstring CXmlLiteReader::GetOuterXml(bool bEncodingXml)
|
||||
{
|
||||
return m_pInternal->GetOuterXml();
|
||||
return m_pInternal->GetOuterXml(bEncodingXml);
|
||||
}
|
||||
std::wstring CXmlLiteReader::GetInnerXml()
|
||||
std::wstring CXmlLiteReader::GetInnerXml(bool bEncodingXml)
|
||||
{
|
||||
return m_pInternal->GetInnerXml();
|
||||
return m_pInternal->GetInnerXml(bEncodingXml);
|
||||
}
|
||||
|
||||
int CXmlLiteReader::GetAttributesCount()
|
||||
|
||||
@ -638,13 +638,13 @@ namespace XmlUtils
|
||||
GetTextWithHHHH(bPreserve, pUnicodes, nSize, nLen);
|
||||
return std::wstring(pUnicodes, nLen);
|
||||
}
|
||||
inline std::wstring GetOuterXml()
|
||||
inline std::wstring GetOuterXml(bool bEncodingXml = true)
|
||||
{
|
||||
return GetXml(false);
|
||||
return GetXml(false, bEncodingXml);
|
||||
}
|
||||
inline std::wstring GetInnerXml()
|
||||
inline std::wstring GetInnerXml(bool bEncodingXml = true)
|
||||
{
|
||||
return GetXml(true);
|
||||
return GetXml(true, bEncodingXml);
|
||||
}
|
||||
|
||||
inline int GetAttributesCount()
|
||||
@ -703,7 +703,7 @@ namespace XmlUtils
|
||||
}
|
||||
|
||||
private:
|
||||
inline std::wstring GetXml(bool bInner)
|
||||
inline std::wstring GetXml(bool bInner, bool bEncodingXml = true)
|
||||
{
|
||||
if (!IsValid())
|
||||
return L"";
|
||||
@ -733,7 +733,7 @@ namespace XmlUtils
|
||||
eNodeType == XmlNodeType_Whitespace ||
|
||||
eNodeType == XmlNodeType_SIGNIFICANT_WHITESPACE ||
|
||||
eNodeType == XmlNodeType_CDATA)
|
||||
oResult.WriteEncodeXmlString(GetText().c_str());
|
||||
(bEncodingXml)? oResult.WriteEncodeXmlString(GetText().c_str()): oResult.WriteString(GetText().c_str());
|
||||
else if (eNodeType == XmlNodeType_Element)
|
||||
WriteElement(oResult);
|
||||
else if (eNodeType == XmlNodeType_EndElement)
|
||||
|
||||
113
DocxRenderer/DocxRenderer.pri
Normal file
113
DocxRenderer/DocxRenderer.pri
Normal file
@ -0,0 +1,113 @@
|
||||
# Copyright (C) Ascensio System SIA, 2009-2026
|
||||
#
|
||||
# This program is a free software product. You can redistribute it and/or
|
||||
# modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
# version 3 as published by the Free Software Foundation, together with the
|
||||
# additional terms provided in the LICENSE file.
|
||||
#
|
||||
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
# details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
#
|
||||
# You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
# or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
# LV-1050, Latvia, European Union.
|
||||
#
|
||||
# The interactive user interfaces in modified versions of the Program
|
||||
# are required to display Appropriate Legal Notices in accordance with
|
||||
# Section 5 of the GNU AGPL version 3.
|
||||
#
|
||||
# No trademark rights are granted under this License.
|
||||
#
|
||||
# All non-code elements of the Product, including illustrations,
|
||||
# icon sets, and technical writing content, are licensed under the
|
||||
# Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
# https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
#
|
||||
# This license applies only to such non-code elements and does not
|
||||
# modify or replace the licensing terms applicable to the Program's
|
||||
# source code, which remains licensed under the GNU Affero General
|
||||
# Public License v3.
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
QT -= core gui
|
||||
|
||||
VERSION = 1.0.0.4
|
||||
TARGET = DocxRenderer
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += c++11
|
||||
CONFIG += shared
|
||||
CONFIG += plugin
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include(../Common/base.pri)
|
||||
|
||||
DEFINES += DOCXRENDERER_USE_DYNAMIC_LIBRARY
|
||||
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel, graphics)
|
||||
|
||||
# Flag for disable full document creation. Enabled in pdf editor
|
||||
#CONFIG += disable_full_document_creation
|
||||
|
||||
core_windows {
|
||||
LIBS += \
|
||||
-lgdi32 \
|
||||
-ladvapi32 \
|
||||
-luser32 \
|
||||
-lshell32
|
||||
}
|
||||
|
||||
HEADERS += \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/BaseItem.h \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/ContText.h \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/Paragraph.h \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/Shape.h \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/Table.h \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/TextLine.h \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/ExternalImageStorage.h \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/FontStyleManager.h \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/ImageManager.h \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/FontManager.h \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/ParagraphStyleManager.h \
|
||||
$$PWD_ROOT_DIR/src/logic/styles/FontStyle.h \
|
||||
$$PWD_ROOT_DIR/src/logic/styles/ParagraphStyle.h \
|
||||
$$PWD_ROOT_DIR/src/resources/ColorTable.h \
|
||||
$$PWD_ROOT_DIR/src/resources/Constants.h \
|
||||
$$PWD_ROOT_DIR/src/resources/ImageInfo.h \
|
||||
$$PWD_ROOT_DIR/src/resources/LinesTable.h \
|
||||
$$PWD_ROOT_DIR/src/resources/VectorGraphics.h \
|
||||
$$PWD_ROOT_DIR/src/resources/resources.h \
|
||||
$$PWD_ROOT_DIR/src/resources/utils.h \
|
||||
$$PWD_ROOT_DIR/src/logic/Page.h \
|
||||
$$PWD_ROOT_DIR/src/logic/Document.h \
|
||||
$$PWD_ROOT_DIR/DocxRenderer.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/BaseItem.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/ContText.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/Paragraph.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/Shape.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/elements/TextLine.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/FontManager.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/FontStyleManager.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/ImageManager.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/managers/ParagraphStyleManager.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/styles/FontStyle.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/Page.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/Document.cpp \
|
||||
$$PWD_ROOT_DIR/src/logic/styles/ParagraphStyle.cpp \
|
||||
$$PWD_ROOT_DIR/src/resources/VectorGraphics.cpp \
|
||||
$$PWD_ROOT_DIR/DocxRenderer.cpp
|
||||
|
||||
disable_full_document_creation {
|
||||
DEFINES += DISABLE_FULL_DOCUMENT_CREATION
|
||||
} else {
|
||||
SOURCES += \
|
||||
$$PWD_ROOT_DIR/src/resources/resources.cpp
|
||||
}
|
||||
|
||||
DISTFILES += \
|
||||
$$PWD_ROOT_DIR/readme.md
|
||||
@ -31,84 +31,8 @@
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
QT -= core gui
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
VERSION = 1.0.0.4
|
||||
TARGET = DocxRenderer
|
||||
TEMPLATE = lib
|
||||
include(DocxRenderer.pri)
|
||||
|
||||
CONFIG += c++11
|
||||
CONFIG += shared
|
||||
CONFIG += plugin
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include(../Common/base.pri)
|
||||
|
||||
DEFINES += DOCXRENDERER_USE_DYNAMIC_LIBRARY
|
||||
|
||||
ADD_DEPENDENCY(UnicodeConverter, kernel, graphics)
|
||||
|
||||
# Flag for disable full document creation. Enabled in pdf editor
|
||||
#CONFIG += disable_full_document_creation
|
||||
|
||||
core_windows {
|
||||
LIBS += \
|
||||
-lgdi32 \
|
||||
-ladvapi32 \
|
||||
-luser32 \
|
||||
-lshell32
|
||||
}
|
||||
|
||||
HEADERS += \
|
||||
src/logic/elements/BaseItem.h \
|
||||
src/logic/elements/ContText.h \
|
||||
src/logic/elements/Paragraph.h \
|
||||
src/logic/elements/Shape.h \
|
||||
src/logic/elements/Table.h \
|
||||
src/logic/elements/TextLine.h \
|
||||
src/logic/managers/ExternalImageStorage.h \
|
||||
src/logic/managers/FontStyleManager.h \
|
||||
src/logic/managers/ImageManager.h \
|
||||
src/logic/managers/FontManager.h \
|
||||
src/logic/managers/ParagraphStyleManager.h \
|
||||
src/logic/styles/FontStyle.h \
|
||||
src/logic/styles/ParagraphStyle.h \
|
||||
src/resources/ColorTable.h \
|
||||
src/resources/Constants.h \
|
||||
src/resources/ImageInfo.h \
|
||||
src/resources/LinesTable.h \
|
||||
src/resources/VectorGraphics.h \
|
||||
src/resources/resources.h \
|
||||
src/resources/utils.h \
|
||||
src/logic/Page.h \
|
||||
src/logic/Document.h \
|
||||
DocxRenderer.h
|
||||
|
||||
SOURCES += \
|
||||
src/logic/elements/BaseItem.cpp \
|
||||
src/logic/elements/ContText.cpp \
|
||||
src/logic/elements/Paragraph.cpp \
|
||||
src/logic/elements/Shape.cpp \
|
||||
src/logic/elements/Table.cpp \
|
||||
src/logic/elements/TextLine.cpp \
|
||||
src/logic/managers/FontManager.cpp \
|
||||
src/logic/managers/FontStyleManager.cpp \
|
||||
src/logic/managers/ImageManager.cpp \
|
||||
src/logic/managers/ParagraphStyleManager.cpp \
|
||||
src/logic/styles/FontStyle.cpp \
|
||||
src/logic/Page.cpp \
|
||||
src/logic/Document.cpp \
|
||||
src/logic/styles/ParagraphStyle.cpp \
|
||||
src/resources/VectorGraphics.cpp \
|
||||
DocxRenderer.cpp
|
||||
|
||||
disable_full_document_creation {
|
||||
DEFINES += DISABLE_FULL_DOCUMENT_CREATION
|
||||
} else {
|
||||
SOURCES += \
|
||||
src/resources/resources.cpp
|
||||
}
|
||||
|
||||
DISTFILES += \
|
||||
readme.md
|
||||
SOURCES += $$PWD/src/logic/elements/Table.cpp
|
||||
|
||||
@ -36,8 +36,6 @@
|
||||
#include "Page.h"
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <set>
|
||||
// #include <assert.h>
|
||||
|
||||
#include "../../../DesktopEditor/graphics/pro/Graphics.h"
|
||||
@ -51,6 +49,7 @@ namespace NSDocxRenderer
|
||||
m_oManagers(oManagers), m_oContBuilder(oManagers.pFontStyleManager, oManagers.pFontSelector)
|
||||
{
|
||||
m_pAppFonts = pAppFonts;
|
||||
m_pTableBuilder = NSTables::Create();
|
||||
CShape::ResetRelativeHeight();
|
||||
}
|
||||
|
||||
@ -112,6 +111,8 @@ namespace NSDocxRenderer
|
||||
CPage::~CPage()
|
||||
{
|
||||
Clear();
|
||||
if (m_pTableBuilder)
|
||||
delete m_pTableBuilder;
|
||||
}
|
||||
|
||||
void CPage::DeleteTextClipPage()
|
||||
@ -422,11 +423,23 @@ namespace NSDocxRenderer
|
||||
|
||||
auto text_line_groups = BuildTextLineGroups();
|
||||
|
||||
if (m_bIsBuildTables)
|
||||
{
|
||||
m_pTableBuilder->SetShapes(std::move(m_arShapes));
|
||||
m_pTableBuilder->BuildGraphicallCells();
|
||||
m_arShapes = std::move(m_pTableBuilder->ReturnShapes());
|
||||
}
|
||||
|
||||
// building final objects
|
||||
m_arParagraphs = BuildParagraphs(text_line_groups);
|
||||
|
||||
// if (m_bIsBuildTables)
|
||||
// m_arTables = BuildTables(text_line_groups);
|
||||
if (m_bIsBuildTables)
|
||||
{
|
||||
m_pTableBuilder->SetParagraphs(std::move(m_arParagraphs));
|
||||
m_pTableBuilder->BuildTables();
|
||||
m_arParagraphs = std::move(m_pTableBuilder->ReturnParagraphs());
|
||||
m_arTables = std::move(m_pTableBuilder->GetTables());
|
||||
}
|
||||
|
||||
// post analyze
|
||||
CalcSelected();
|
||||
@ -434,8 +447,8 @@ namespace NSDocxRenderer
|
||||
CalcShapesRotation();
|
||||
|
||||
m_arOutputObjects = BuildOutputObjects();
|
||||
// for (auto& t : m_arTables)
|
||||
// m_arOutputObjects.push_back(t);
|
||||
for (auto& t : m_arTables)
|
||||
m_arOutputObjects.push_back(t);
|
||||
}
|
||||
|
||||
void CPage::Record(NSStringUtils::CStringBuilder& oWriter, bool bIsLastPage)
|
||||
@ -2073,595 +2086,6 @@ namespace NSDocxRenderer
|
||||
return ar_paragraphs;
|
||||
}
|
||||
|
||||
std::vector<CPage::text_cell_group_ptr_t> CPage::BuildTextCellGroups(const std::vector<CPage::text_line_group_ptr_t>& arTextLineGroups)
|
||||
{
|
||||
std::vector<CPage::text_cell_ptr_t> text_cells;
|
||||
for (const auto& text_line_group : arTextLineGroups)
|
||||
{
|
||||
auto text_cell_new = std::make_shared<CTextCell>();
|
||||
text_cell_new->RecalcWithNewItem(text_line_group.get());
|
||||
text_cells.push_back(std::move(text_cell_new));
|
||||
}
|
||||
|
||||
std::sort(text_cells.begin(), text_cells.end(),
|
||||
[] (const text_cell_ptr_t& cell1, const text_cell_ptr_t& cell2) {
|
||||
if (fabs(cell1->m_dTop - cell2->m_dTop) < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
return cell1->m_dLeft < cell2->m_dLeft;
|
||||
return cell1->m_dTop < cell2->m_dTop;
|
||||
});
|
||||
|
||||
std::vector<text_cell_group_ptr_t> text_cell_groups;
|
||||
text_cell_group_ptr_t curr_group = std::make_shared<CBaseItemGroup<CTextCell>>();
|
||||
curr_group->AddItem(text_cells[0]);
|
||||
|
||||
double curr_bot = text_cells[0]->m_dBot;
|
||||
for (size_t i = 1; i < text_cells.size(); ++i)
|
||||
{
|
||||
const auto& cell = text_cells[i];
|
||||
if (cell->m_dTop - curr_bot < 10)
|
||||
curr_group->AddItem(cell);
|
||||
else
|
||||
{
|
||||
text_cell_groups.push_back(std::move(curr_group));
|
||||
curr_group = std::make_shared<CBaseItemGroup<CTextCell>>();
|
||||
curr_group->AddItem(cell);
|
||||
}
|
||||
curr_bot = cell->m_dBot;
|
||||
}
|
||||
text_cell_groups.push_back(curr_group);
|
||||
|
||||
auto vert_crossing = [] (const CBaseItem* item1, const CBaseItem* item2) {
|
||||
bool left_inside = item1->m_dLeft < item2->m_dRight;
|
||||
bool right_inside = item1->m_dRight > item2->m_dLeft;
|
||||
return left_inside && right_inside;
|
||||
};
|
||||
|
||||
auto hor_crossing = [] (const CBaseItem* item1, const CBaseItem* item2) {
|
||||
bool left_inside = item1->m_dTop < item2->m_dBot;
|
||||
bool right_inside = item1->m_dBot > item2->m_dTop;
|
||||
return left_inside && right_inside;
|
||||
};
|
||||
|
||||
for (const auto& text_cells : text_cell_groups)
|
||||
{
|
||||
// calc max gaps between groups bot / right
|
||||
for (size_t i = 0; i < text_cells->m_arItems.size(); ++i)
|
||||
{
|
||||
// max bot calc
|
||||
for (size_t j = 0; j < text_cells->m_arItems.size(); ++j)
|
||||
if (text_cells->m_arItems[i]->m_dBot < text_cells->m_arItems[j]->m_dTop && vert_crossing(text_cells->m_arItems[i].get(), text_cells->m_arItems[j].get()))
|
||||
text_cells->m_arItems[i]->m_dMaxPossibleBot = std::min(text_cells->m_arItems[i]->m_dMaxPossibleBot, text_cells->m_arItems[j]->m_dTop);
|
||||
|
||||
// max right calc
|
||||
for (size_t j = 0; j < text_cells->m_arItems.size(); ++j)
|
||||
if (text_cells->m_arItems[i]->m_dRight < text_cells->m_arItems[j]->m_dLeft &&
|
||||
hor_crossing(text_cells->m_arItems[i].get(), text_cells->m_arItems[j].get()))
|
||||
text_cells->m_arItems[i]->m_dMaxPossibleRight = std::min(text_cells->m_arItems[i]->m_dMaxPossibleRight, text_cells->m_arItems[j]->m_dLeft);
|
||||
}
|
||||
|
||||
// setting aligned params bot / right
|
||||
for (size_t i = 0; i < text_cells->m_arItems.size(); ++i)
|
||||
{
|
||||
// bot recalc
|
||||
for (size_t j = 0; j < text_cells->m_arItems.size(); ++j)
|
||||
{
|
||||
if (hor_crossing(text_cells->m_arItems[i].get(), text_cells->m_arItems[j].get()) && i != j)
|
||||
{
|
||||
if (text_cells->m_arItems[i]->m_dMaxPossibleBot > text_cells->m_arItems[j]->m_dBot)
|
||||
{
|
||||
text_cells->m_arItems[i]->m_dBot = std::max(text_cells->m_arItems[i]->m_dBot, text_cells->m_arItems[j]->m_dBot);
|
||||
text_cells->m_arItems[i]->m_dHeight = text_cells->m_arItems[i]->m_dBot - text_cells->m_arItems[i]->m_dTop;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// right recalc
|
||||
for (size_t j = 0; j < text_cells->m_arItems.size(); ++j)
|
||||
{
|
||||
if (vert_crossing(text_cells->m_arItems[i].get(), text_cells->m_arItems[j].get()) && i != j)
|
||||
{
|
||||
if (text_cells->m_arItems[i]->m_dMaxPossibleRight > text_cells->m_arItems[j]->m_dRight)
|
||||
{
|
||||
text_cells->m_arItems[i]->m_dRight = std::max(text_cells->m_arItems[i]->m_dRight, text_cells->m_arItems[j]->m_dRight);
|
||||
text_cells->m_arItems[i]->m_dWidth = text_cells->m_arItems[i]->m_dRight - text_cells->m_arItems[i]->m_dLeft;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calc max gaps between groups top / left
|
||||
for (int i = text_cells->m_arItems.size() - 1; i >= 0; --i)
|
||||
{
|
||||
// max top calc
|
||||
for (int j = text_cells->m_arItems.size() - 1; j >= 0; --j)
|
||||
if (text_cells->m_arItems[i]->m_dTop > text_cells->m_arItems[j]->m_dBot &&
|
||||
vert_crossing(text_cells->m_arItems[i].get(), text_cells->m_arItems[j].get()))
|
||||
text_cells->m_arItems[i]->m_dMinPossibleTop = std::max(text_cells->m_arItems[i]->m_dMinPossibleTop, text_cells->m_arItems[j]->m_dBot);
|
||||
|
||||
// max left calc
|
||||
for (int j = text_cells->m_arItems.size() - 1; j >= 0; --j)
|
||||
if (text_cells->m_arItems[i]->m_dLeft > text_cells->m_arItems[j]->m_dRight &&
|
||||
hor_crossing(text_cells->m_arItems[i].get(), text_cells->m_arItems[j].get()))
|
||||
text_cells->m_arItems[i]->m_dMinPossibleLeft = std::max(text_cells->m_arItems[i]->m_dMinPossibleLeft, text_cells->m_arItems[j]->m_dRight);
|
||||
}
|
||||
|
||||
// setting aligned params top / left
|
||||
for (int i = text_cells->m_arItems.size() - 1; i >= 0; --i)
|
||||
{
|
||||
// top recalc
|
||||
for (int j = text_cells->m_arItems.size() - 1; j >= 0; --j)
|
||||
{
|
||||
if (hor_crossing(text_cells->m_arItems[i].get(), text_cells->m_arItems[j].get()) && i != j)
|
||||
{
|
||||
if (text_cells->m_arItems[i]->m_dMinPossibleTop < text_cells->m_arItems[j]->m_dTop)
|
||||
{
|
||||
text_cells->m_arItems[i]->m_dTop = std::min(text_cells->m_arItems[i]->m_dTop, text_cells->m_arItems[j]->m_dTop);
|
||||
text_cells->m_arItems[i]->m_dHeight = text_cells->m_arItems[i]->m_dBot - text_cells->m_arItems[i]->m_dTop;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// left recalc
|
||||
for (int j = text_cells->m_arItems.size() - 1; j >= 0; --j)
|
||||
{
|
||||
if (vert_crossing(text_cells->m_arItems[i].get(), text_cells->m_arItems[j].get()) && i != j)
|
||||
{
|
||||
if (text_cells->m_arItems[i]->m_dMinPossibleLeft > text_cells->m_arItems[j]->m_dLeft)
|
||||
{
|
||||
text_cells->m_arItems[i]->m_dRight = std::min(text_cells->m_arItems[i]->m_dLeft, text_cells->m_arItems[j]->m_dLeft);
|
||||
text_cells->m_arItems[i]->m_dWidth = text_cells->m_arItems[i]->m_dRight - text_cells->m_arItems[i]->m_dLeft;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return text_cell_groups;
|
||||
}
|
||||
|
||||
std::vector<CPage::table_ptr_t> CPage::BuildTables(const std::vector<text_line_group_ptr_t>& arTextLineGroups)
|
||||
{
|
||||
auto graphical_cells = BuildGraphicalCells();
|
||||
auto text_cell_groups = BuildTextCellGroups(arTextLineGroups);
|
||||
|
||||
std::vector<cell_group_ptr_t> cell_groups;
|
||||
for (const auto& text_cell_group : text_cell_groups)
|
||||
{
|
||||
cell_group_ptr_t cell_group_new = std::make_shared<CBaseItemGroup<CTable::CCell>>();
|
||||
for (auto& text_cell : text_cell_group->m_arItems)
|
||||
{
|
||||
auto cell_new = std::make_shared<CTable::CCell>();
|
||||
cell_new->RecalcWithNewItem(text_cell.get());
|
||||
cell_group_new->AddItem(std::move(cell_new));
|
||||
}
|
||||
cell_groups.push_back(std::move(cell_group_new));
|
||||
cell_group_new = std::make_shared<CBaseItemGroup<CTable::CCell>>();
|
||||
}
|
||||
|
||||
if (cell_groups.empty())
|
||||
return {};
|
||||
|
||||
// sets paragraphs into cells
|
||||
for (auto& cells : cell_groups)
|
||||
for (auto& cell : cells->m_arItems)
|
||||
for (auto& paragraph : m_arParagraphs)
|
||||
{
|
||||
if (!paragraph)
|
||||
continue;
|
||||
|
||||
bool top = fabs(cell->m_dTop - paragraph->m_arTextLines.front()->m_dTopWithMaxAscent) < c_dGRAPHICS_ERROR_MM
|
||||
|| paragraph->m_arTextLines.front()->m_dTopWithMaxAscent > cell->m_dTop;
|
||||
bool bot = fabs(cell->m_dBot - paragraph->m_dBot) < c_dGRAPHICS_ERROR_MM
|
||||
|| paragraph->m_dBot < cell->m_dBot;
|
||||
bool left = fabs(cell->m_dLeft - paragraph->m_dLeft) < c_dGRAPHICS_ERROR_MM
|
||||
|| paragraph->m_dLeft > cell->m_dLeft;
|
||||
bool right = fabs(cell->m_dRight - paragraph->m_dRight) < c_dGRAPHICS_ERROR_MM
|
||||
|| paragraph->m_dRight < cell->m_dRight;
|
||||
if (top && bot && left && right)
|
||||
{
|
||||
paragraph->m_dLeftBorder = paragraph->m_dLeft - cell->m_dLeft;
|
||||
paragraph->m_dRightBorder = 0;
|
||||
if (!cell->m_arParagraphs.empty())
|
||||
paragraph->m_dSpaceBefore = paragraph->m_dTop - cell->m_arParagraphs.back()->m_dBot;
|
||||
else if (paragraph->m_dTop - cell->m_dTop > 0)
|
||||
paragraph->m_dSpaceBefore = paragraph->m_dTop - cell->m_dTop;
|
||||
else
|
||||
paragraph->m_dSpaceBefore = 0;
|
||||
paragraph->m_dSpaceAfter = 0;
|
||||
cell->AddParagraph(paragraph);
|
||||
paragraph = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
auto right = MoveNullptr(m_arParagraphs.begin(), m_arParagraphs.end());
|
||||
m_arParagraphs.erase(right, m_arParagraphs.end());
|
||||
|
||||
std::sort(m_arParagraphs.begin(), m_arParagraphs.end(), [] (const paragraph_ptr_t& p1, const paragraph_ptr_t& p2) {
|
||||
return p1->m_dBot < p2->m_dBot;
|
||||
});
|
||||
|
||||
std::vector<CTable::row_ptr_t> rows;
|
||||
CTable::row_ptr_t curr_row = nullptr;
|
||||
for (auto& cells : cell_groups)
|
||||
for (auto& cell : cells->m_arItems)
|
||||
{
|
||||
if (!curr_row)
|
||||
{
|
||||
curr_row = std::make_shared<CTable::CRow>();
|
||||
}
|
||||
else if (fabs(curr_row->m_dBot - cell->m_dBot) > c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
rows.push_back(std::move(curr_row));
|
||||
curr_row = std::make_shared<CTable::CRow>();
|
||||
}
|
||||
curr_row->AddCell(cell);
|
||||
}
|
||||
if (!curr_row->IsEmpty())
|
||||
rows.push_back(std::move(curr_row));
|
||||
|
||||
std::vector<table_ptr_t> tables;
|
||||
table_ptr_t curr_table = nullptr;
|
||||
for (const auto& row : rows)
|
||||
{
|
||||
if (!curr_table)
|
||||
{
|
||||
curr_table = std::make_shared<CTable>();
|
||||
}
|
||||
else if (fabs(curr_table->m_dBot - row->m_dTop) > c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
tables.push_back(std::move(curr_table));
|
||||
curr_table = std::make_shared<CTable>();
|
||||
}
|
||||
curr_table->AddRow(row);
|
||||
}
|
||||
if (!curr_table->IsEmpty())
|
||||
tables.push_back(std::move(curr_table));
|
||||
|
||||
|
||||
for (auto& t : tables)
|
||||
t->CalcGridCols();
|
||||
|
||||
return tables;
|
||||
}
|
||||
|
||||
std::vector<CPage::graphical_cell_ptr_t> CPage::BuildGraphicalCells()
|
||||
{
|
||||
struct Crossing;
|
||||
struct Line;
|
||||
|
||||
enum class eLineDirection
|
||||
{
|
||||
ldTop,
|
||||
ldBot,
|
||||
ldLeft,
|
||||
ldRight
|
||||
};
|
||||
|
||||
struct Line
|
||||
{
|
||||
Crossing* crossing;
|
||||
size_t shape_index;
|
||||
eLineDirection direction;
|
||||
};
|
||||
|
||||
// crossing is a logical intersection between two lines
|
||||
// contains the lines from this crossing
|
||||
struct Crossing
|
||||
{
|
||||
Point p {};
|
||||
std::vector<Line> lines {};
|
||||
|
||||
Crossing() = default;
|
||||
Crossing(const Point& _p, const std::vector<Line> _lines)
|
||||
{
|
||||
p = _p;
|
||||
lines = _lines;
|
||||
}
|
||||
};
|
||||
|
||||
// returns index of the line with a direction
|
||||
auto get_line = [] (const eLineDirection& direction, const std::vector<Line>& lines) -> const Line* {
|
||||
for (size_t i = 0; i < lines.size(); ++i)
|
||||
if (lines[i].direction == direction)
|
||||
return &lines[i];
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
// goes into direction through crossings (like a graph).
|
||||
// add used shapes into out_indexes to remove it later
|
||||
auto go_direction_until = [&get_line] (Crossing* crossing,
|
||||
const Point& p,
|
||||
const eLineDirection& direction,
|
||||
std::set<size_t>& out_indexes) -> bool {
|
||||
|
||||
// difference depends on direction
|
||||
auto diff = [&crossing, &p, &direction] () -> double {
|
||||
if (direction == eLineDirection::ldRight) return p.x - crossing->p.x;
|
||||
if (direction == eLineDirection::ldLeft) return crossing->p.x - p.x;
|
||||
if (direction == eLineDirection::ldBot) return p.y - crossing->p.y;
|
||||
if (direction == eLineDirection::ldTop) return crossing->p.y - p.y;
|
||||
return 0;
|
||||
};
|
||||
|
||||
while (diff() > c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
auto curr_line = get_line(direction, crossing->lines);
|
||||
if (!curr_line)
|
||||
return false;
|
||||
|
||||
out_indexes.insert(curr_line->shape_index);
|
||||
crossing = curr_line->crossing;
|
||||
|
||||
if (fabs(diff()) < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// vector contains ptrs for easy exist-check
|
||||
std::vector<std::shared_ptr<Crossing>> crossings;
|
||||
auto find_crossing = [&crossings] (const Point& p) -> Crossing* {
|
||||
for (auto& crossing : crossings)
|
||||
{
|
||||
if (!crossing)
|
||||
continue;
|
||||
|
||||
if (fabs(crossing->p.x - p.x) < c_dMAX_TABLE_LINE_WIDTH_MM &&
|
||||
fabs(crossing->p.y - p.y) < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
return crossing.get();
|
||||
}
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
auto precise_crossing_p = [] (Crossing* cr, const Point& p, const eLineDirection& direction) {
|
||||
if (cr->lines.size() == 1)
|
||||
{
|
||||
switch (cr->lines[0].direction)
|
||||
{
|
||||
case eLineDirection::ldLeft:
|
||||
case eLineDirection::ldRight:
|
||||
if (direction == eLineDirection::ldLeft || direction == eLineDirection::ldRight)
|
||||
cr->p.x = (cr->p.x + p.x) / 2;
|
||||
else
|
||||
cr->p.x = p.x;
|
||||
break;
|
||||
case eLineDirection::ldBot:
|
||||
case eLineDirection::ldTop:
|
||||
if (direction == eLineDirection::ldBot || direction == eLineDirection::ldTop)
|
||||
cr->p.y = (cr->p.y + p.y) / 2;
|
||||
else
|
||||
cr->p.y = p.y;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// check and adds points
|
||||
auto add_crossings = [&precise_crossing_p, &crossings, &find_crossing, this] (const Point& p1, const Point& p2, size_t index) {
|
||||
Crossing* crossing1 = find_crossing(p1);
|
||||
Crossing* crossing2 = find_crossing(p2);
|
||||
|
||||
eLineDirection direction12;
|
||||
eLineDirection direction21;
|
||||
|
||||
if (fabs(p1.y - p2.y) < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
direction12 = p1.x > p2.x ? eLineDirection::ldLeft : eLineDirection::ldRight;
|
||||
direction21 = p1.x < p2.x ? eLineDirection::ldLeft : eLineDirection::ldRight;
|
||||
}
|
||||
|
||||
else if (fabs(p1.x - p2.x) < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
direction12 = p1.y > p2.y ? eLineDirection::ldTop : eLineDirection::ldBot;
|
||||
direction21 = p1.y < p2.y ? eLineDirection::ldTop : eLineDirection::ldBot;
|
||||
}
|
||||
|
||||
// add empty crossing if no exists
|
||||
if (!crossing1)
|
||||
{
|
||||
Crossing cr;
|
||||
cr.p = p1;
|
||||
crossings.push_back(std::make_shared<Crossing>(cr));
|
||||
crossing1 = crossings.back().get();
|
||||
}
|
||||
if (!crossing2)
|
||||
{
|
||||
Crossing cr;
|
||||
cr.p = p2;
|
||||
crossings.push_back(std::make_shared<Crossing>(cr));
|
||||
crossing2 = crossings.back().get();
|
||||
}
|
||||
|
||||
auto curr_crossing_eq = [&crossing1] (const Line& line) -> bool {
|
||||
return line.crossing == crossing1;
|
||||
};
|
||||
if (std::find_if(crossing2->lines.begin(), crossing2->lines.end(), curr_crossing_eq) == crossing2->lines.end())
|
||||
{
|
||||
precise_crossing_p(crossing2, p2, direction21);
|
||||
Line line {crossing1, index, direction21};
|
||||
crossing2->lines.push_back(std::move(line));
|
||||
}
|
||||
|
||||
auto prev_crossing_eq = [&crossing2] (const Line& line) -> bool {
|
||||
return line.crossing == crossing2;
|
||||
};
|
||||
if (std::find_if(crossing1->lines.begin(), crossing1->lines.end(), prev_crossing_eq) == crossing1->lines.end())
|
||||
{
|
||||
precise_crossing_p(crossing1, p1, direction12);
|
||||
Line line {crossing2, index, direction12};
|
||||
crossing1->lines.push_back(std::move(line));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// 2 main cases
|
||||
// 1. lines of tables as a big rectangles with lines (onlyoffice), work with path commands
|
||||
// 2. lines of tables as a small rectangels for a single line (adobe), work with entire shape
|
||||
// also word -> pdf adobe sets points as crossings of the table lines, so we can use it
|
||||
|
||||
// check for adobe points
|
||||
std::vector<std::pair<const Crossing*, size_t>> points_delete_later;
|
||||
for (size_t i = 0; i < m_arShapes.size(); ++i)
|
||||
{
|
||||
auto& shape = m_arShapes[i];
|
||||
if (!shape || shape->m_eGraphicsType != eGraphicsType::gtRectangle || shape->m_pImageInfo != nullptr)
|
||||
continue;
|
||||
|
||||
// possible point of crossing in a adobe table
|
||||
if (shape->m_dWidth < c_dMAX_TABLE_LINE_WIDTH_MM && shape->m_dHeight < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
Crossing cr;
|
||||
cr.p.x = shape->m_dLeft + shape->m_dWidth / 2;
|
||||
cr.p.y = shape->m_dTop + shape->m_dHeight;
|
||||
auto cr_ptr = std::make_shared<Crossing>(cr);
|
||||
crossings.push_back(cr_ptr);
|
||||
points_delete_later.push_back({cr_ptr.get(), i});
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_arShapes.size(); ++i)
|
||||
{
|
||||
auto& shape = m_arShapes[i];
|
||||
if (!shape || shape->m_eGraphicsType != eGraphicsType::gtRectangle || shape->m_pImageInfo != nullptr)
|
||||
continue;
|
||||
|
||||
bool is_done = false;
|
||||
if (shape->m_eSimpleLineType == eSimpleLineType::sltUnknown)
|
||||
{
|
||||
// possible point of crossing in a adobe table
|
||||
if (shape->m_dWidth < c_dMAX_TABLE_LINE_WIDTH_MM && shape->m_dHeight < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
is_done = true;
|
||||
}
|
||||
|
||||
// vertical line
|
||||
else if (shape->m_dWidth < c_dMAX_TABLE_LINE_WIDTH_MM && shape->m_dHeight > c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
Point p1(shape->m_dLeft + shape->m_dWidth / 2, shape->m_dTop);
|
||||
Point p2(shape->m_dLeft + shape->m_dWidth / 2, shape->m_dBot);
|
||||
add_crossings(p1, p2, i);
|
||||
is_done = true;
|
||||
}
|
||||
|
||||
// horizontal line
|
||||
else if (shape->m_dWidth > c_dMAX_TABLE_LINE_WIDTH_MM && shape->m_dHeight < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
Point p1(shape->m_dLeft, shape->m_dTop + shape->m_dHeight / 2);
|
||||
Point p2(shape->m_dRight, shape->m_dTop + shape->m_dHeight / 2);
|
||||
add_crossings(p1, p2, i);
|
||||
is_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_done)
|
||||
continue;
|
||||
|
||||
Point prev {};
|
||||
for (const auto& command : shape->m_oVector.GetData())
|
||||
{
|
||||
if (!command.points.empty())
|
||||
{
|
||||
if (command.type == CVectorGraphics::ePathCommandType::pctLine)
|
||||
{
|
||||
const auto& curr = command.points.back();
|
||||
|
||||
// pure vertical / horizontal lines only
|
||||
// not small lines
|
||||
if (fabs(prev.x - curr.x) > c_dMAX_TABLE_LINE_WIDTH_MM && fabs(prev.y - curr.y) > c_dMAX_TABLE_LINE_WIDTH_MM ||
|
||||
(fabs(prev.x - curr.x) < c_dMAX_TABLE_LINE_WIDTH_MM && fabs(prev.y - curr.y) < c_dMAX_TABLE_LINE_WIDTH_MM))
|
||||
{
|
||||
prev = curr;
|
||||
continue;
|
||||
}
|
||||
add_crossings(prev, curr, i);
|
||||
}
|
||||
prev = command.points.back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove adobe points line crossing shapes if used
|
||||
for (auto& cr : points_delete_later)
|
||||
if (!cr.first->lines.empty())
|
||||
m_arShapes[cr.second] = nullptr;
|
||||
|
||||
// remove empty crossings
|
||||
for (auto& cr : crossings)
|
||||
if (cr && cr->lines.empty())
|
||||
cr = nullptr;
|
||||
|
||||
auto cr_right = MoveNullptr(crossings.begin(), crossings.end());
|
||||
crossings.erase(cr_right, crossings.end());
|
||||
|
||||
// sorting guarantee creating cell once (by taking second cross j > i)
|
||||
std::sort(crossings.begin(), crossings.end(), [] (const std::shared_ptr<Crossing>& c1, const std::shared_ptr<Crossing>& c2) {
|
||||
if (fabs(c1->p.y - c2->p.y) < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
return c1->p.x < c2->p.x;
|
||||
return c1->p.y < c2->p.y;
|
||||
});
|
||||
|
||||
std::vector<graphical_cell_ptr_t> graphical_cells;
|
||||
std::map<size_t, bool> remove_later;
|
||||
for (size_t i = 0; i < crossings.size(); ++i)
|
||||
{
|
||||
for (size_t j = i + 1; j < crossings.size(); ++j)
|
||||
{
|
||||
const auto& cr_first = crossings.at(i);
|
||||
const auto& cr_second = crossings.at(j);
|
||||
|
||||
// first should be top left corner
|
||||
// and second right bot (not the same line ofc)
|
||||
if (fabs(cr_first->p.x - cr_second->p.x) < c_dMAX_TABLE_LINE_WIDTH_MM ||
|
||||
cr_first->p.x > cr_second->p.x ||
|
||||
fabs(cr_first->p.y - cr_second->p.y) < c_dMAX_TABLE_LINE_WIDTH_MM ||
|
||||
cr_first->p.y > cr_second->p.y)
|
||||
continue;
|
||||
|
||||
const Line* cr_f_top = get_line(eLineDirection::ldRight, cr_first->lines);
|
||||
const Line* cr_f_left = get_line(eLineDirection::ldBot, cr_first->lines);
|
||||
const Line* cr_s_bot = get_line(eLineDirection::ldLeft, cr_second->lines);
|
||||
const Line* cr_s_right = get_line(eLineDirection::ldTop, cr_second->lines);
|
||||
|
||||
if (!cr_f_top || !cr_f_left || !cr_s_bot || !cr_s_right)
|
||||
continue;
|
||||
|
||||
std::set<size_t> shape_indexes;
|
||||
bool is_connected = go_direction_until(cr_first.get(), cr_second->p, eLineDirection::ldRight, shape_indexes);
|
||||
is_connected &= go_direction_until(cr_first.get(), cr_second->p, eLineDirection::ldBot, shape_indexes);
|
||||
is_connected &= go_direction_until(cr_second.get(), cr_first->p, eLineDirection::ldLeft, shape_indexes);
|
||||
is_connected &= go_direction_until(cr_second.get(), cr_first->p, eLineDirection::ldTop, shape_indexes);
|
||||
|
||||
if (!is_connected)
|
||||
continue;
|
||||
|
||||
for (const auto& index : shape_indexes)
|
||||
remove_later[index] = true;
|
||||
|
||||
auto graphical_cell = std::make_shared<CGraphicalCell>();
|
||||
graphical_cell->m_dLeft = cr_first->p.x;
|
||||
graphical_cell->m_dRight = cr_second->p.x;
|
||||
graphical_cell->m_dTop = cr_first->p.y;
|
||||
graphical_cell->m_dBot = cr_second->p.y;
|
||||
graphical_cell->m_dWidth = graphical_cell->m_dRight - graphical_cell->m_dLeft;
|
||||
graphical_cell->m_dHeight = graphical_cell->m_dBot - graphical_cell->m_dTop;
|
||||
graphical_cells.push_back(std::move(graphical_cell));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return graphical_cells;
|
||||
}
|
||||
|
||||
CPage::shape_ptr_t CPage::CreateSingleLineShape(text_line_ptr_t& pLine)
|
||||
{
|
||||
auto pParagraph = std::make_shared<CParagraph>();
|
||||
@ -2766,6 +2190,20 @@ namespace NSDocxRenderer
|
||||
pShape->m_dImageTop = imageVector.GetTop();
|
||||
pShape->m_dImageLeft = imageVector.GetLeft();
|
||||
pShape->m_dImageRight = imageVector.GetRight();
|
||||
|
||||
// for reflection along the x-axis
|
||||
if (fabs(fabs(pShape->m_dRotation) - 180.0) < 0.01 && m_oTransform.sx() > 0.0)
|
||||
{
|
||||
std::swap(pShape->m_dImageBot, pShape->m_dImageTop);
|
||||
pShape->m_dRotation = 0.0;
|
||||
}
|
||||
|
||||
// for reflection along the y-axis
|
||||
if (fabs(fabs(pShape->m_dRotation) - 180.0) < 0.01 && m_oTransform.sy() > 0.0)
|
||||
{
|
||||
std::swap(pShape->m_dImageLeft, pShape->m_dImageRight);
|
||||
pShape->m_dRotation = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void CPage::DrawGradient(shape_ptr_t pShape)
|
||||
|
||||
@ -82,7 +82,7 @@ namespace NSDocxRenderer
|
||||
bool m_bUseDefaultFont {false};
|
||||
bool m_bWriteStyleRaw {false};
|
||||
bool m_bCollectMetaInfo {false};
|
||||
bool m_bIsBuildTables {false};
|
||||
bool m_bIsBuildTables {true};
|
||||
bool m_bIsLuminosityShapesFiled{false};
|
||||
bool m_bFontSubstitution {false};
|
||||
bool m_bFirstParagraphLineCorrection{false};
|
||||
@ -133,15 +133,8 @@ namespace NSDocxRenderer
|
||||
using base_item_ptr_t = std::shared_ptr<CBaseItem>;
|
||||
using ooxml_item_ptr_t = std::shared_ptr<IOoxmlItem>;
|
||||
using paragraph_ptr_t = std::shared_ptr<CParagraph>;
|
||||
using table_ptr_t = std::shared_ptr<CTable>;
|
||||
|
||||
using graphical_cell_ptr_t = std::shared_ptr<CGraphicalCell>;
|
||||
using text_cell_ptr_t = std::shared_ptr<CTextCell>;
|
||||
using cell_ptr_t = std::shared_ptr<CTable::CCell>;
|
||||
|
||||
using text_line_group_ptr_t = std::shared_ptr<CBaseItemGroup<CTextLine>>;
|
||||
using text_cell_group_ptr_t = std::shared_ptr<CBaseItemGroup<CTextCell>>;
|
||||
using cell_group_ptr_t = std::shared_ptr<CBaseItemGroup<CTable::CCell>>;
|
||||
|
||||
// returns std::vector of conts with diac. symbols and remove it from m_arConts
|
||||
std::vector<cont_ptr_t> MoveDiacriticalSymbols();
|
||||
@ -155,15 +148,6 @@ namespace NSDocxRenderer
|
||||
// returns std::vector of paragraphs builded from m_arTextLines
|
||||
std::vector<paragraph_ptr_t> BuildParagraphs(const std::vector<text_line_group_ptr_t>& arTextLineGroups);
|
||||
|
||||
// return groups of text cells
|
||||
std::vector<text_cell_group_ptr_t> BuildTextCellGroups(const std::vector<text_line_group_ptr_t>& arTextLineGroups);
|
||||
|
||||
// returns std::vector of tables builded from shapes and paragraphes
|
||||
std::vector<table_ptr_t> BuildTables(const std::vector<text_line_group_ptr_t>& arTextLineGroups);
|
||||
|
||||
// return std::vector of graphical cells (from shapes)
|
||||
std::vector<graphical_cell_ptr_t> BuildGraphicalCells();
|
||||
|
||||
// returns std::vector of base items builded from m_arParagraphs
|
||||
std::vector<ooxml_item_ptr_t> BuildOutputObjects();
|
||||
|
||||
@ -257,10 +241,12 @@ namespace NSDocxRenderer
|
||||
CContTextBuilder m_oContBuilder;
|
||||
CHorVerLinesCollector m_oHorVerLinesCollector;
|
||||
|
||||
ITableBuilder* m_pTableBuilder{nullptr};
|
||||
|
||||
std::vector<shape_ptr_t> m_arShapes;
|
||||
std::vector<text_line_ptr_t> m_arTextLines;
|
||||
std::vector<paragraph_ptr_t> m_arParagraphs;
|
||||
std::vector<table_ptr_t> m_arTables;
|
||||
std::vector<ooxml_item_ptr_t> m_arTables;
|
||||
std::vector<ooxml_item_ptr_t> m_arOutputObjects;
|
||||
|
||||
std::vector<std::wstring> m_arCompleteObjectsXml;
|
||||
|
||||
@ -84,18 +84,18 @@ namespace NSDocxRenderer
|
||||
oWriter.WriteString(L"/>"); // end of w:spacing
|
||||
|
||||
oWriter.WriteString(L"<w:ind");
|
||||
if (m_dLeftBorder > 0)
|
||||
{
|
||||
//if (m_dLeftBorder > 0)
|
||||
//{
|
||||
oWriter.WriteString(L" w:left=\"");
|
||||
oWriter.AddInt(static_cast<int>(m_dLeftBorder * c_dMMToDx));
|
||||
oWriter.WriteString(L"\"");
|
||||
}
|
||||
if (m_dRightBorder > 0)
|
||||
{
|
||||
//}
|
||||
//if (m_dRightBorder > 0)
|
||||
//{
|
||||
oWriter.WriteString(L" w:right=\"");
|
||||
oWriter.AddInt(static_cast<int>(m_dRightBorder * c_dMMToDx)); // here m_dRight is the distance from the right edge
|
||||
oWriter.WriteString(L"\"");
|
||||
}
|
||||
//}
|
||||
if (m_bIsNeedFirstLineIndent)
|
||||
{
|
||||
if (m_dFirstLine > 0)
|
||||
|
||||
@ -1,265 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) Ascensio System SIA, 2009-2026
|
||||
* (c) Copyright Ascensio System SIA 2010-2023
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation, together with the
|
||||
* additional terms provided in the LICENSE file.
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at info@onlyoffice.com
|
||||
* or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga,
|
||||
* LV-1050, Latvia, European Union.
|
||||
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified versions of the Program
|
||||
* are required to display Appropriate Legal Notices in accordance with
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* No trademark rights are granted under this License.
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All non-code elements of the Product, including illustrations,
|
||||
* icon sets, and technical writing content, are licensed under the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License:
|
||||
* https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
* This license applies only to such non-code elements and does not
|
||||
* modify or replace the licensing terms applicable to the Program's
|
||||
* source code, which remains licensed under the GNU Affero General
|
||||
* Public License v3.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
#include "Table.h"
|
||||
|
||||
#include "../../resources/SingletonTemplate.h"
|
||||
#include "../../resources/utils.h"
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
CTable::CCell::CCell(const CCell& other)
|
||||
namespace NSTables
|
||||
{
|
||||
*this = other;
|
||||
}
|
||||
void CTable::CCell::Clear()
|
||||
{
|
||||
m_arParagraphs.clear();
|
||||
}
|
||||
void CTable::CCell::ToXml(NSStringUtils::CStringBuilder& oWriter) const
|
||||
{
|
||||
oWriter.WriteString(L"<w:tc>");
|
||||
oWriter.WriteString(L"<w:tcPr>");
|
||||
oWriter.WriteString(L"<w:tcW w:w=\"");
|
||||
oWriter.AddUInt(static_cast<unsigned int>(m_dWidth * c_dMMToDx));
|
||||
oWriter.WriteString(L"\" w:type=\"dxa\"/>");
|
||||
|
||||
oWriter.WriteString(L"<w:gridSpan w:val=\"");
|
||||
oWriter.AddUInt(m_nGridSpan);
|
||||
oWriter.WriteString(L"\"/>");
|
||||
|
||||
oWriter.WriteString(L"<w:vMerge w:val=\"");
|
||||
switch (m_eVMerge) {
|
||||
case eVMerge::vmContinue:
|
||||
oWriter.WriteString(L"continue");
|
||||
break;
|
||||
case eVMerge::vmRestart:
|
||||
oWriter.WriteString(L"restart");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
oWriter.WriteString(L"\"/>");
|
||||
|
||||
oWriter.WriteString(L"<w:tcBorders>");
|
||||
auto write_border = [&oWriter] (const CBorder& border, const std::wstring& prefix) {
|
||||
oWriter.WriteString(L"<w:");
|
||||
oWriter.WriteString(prefix);
|
||||
oWriter.WriteString(L" w:val=");
|
||||
oWriter.WriteString(SingletonInstance<LinesTable>().ConvertLineToString(border.lineType));
|
||||
oWriter.WriteString(L" w:sz=\"");
|
||||
oWriter.AddUInt(static_cast<unsigned int>(border.dWidth * c_dMMToPt * 8));
|
||||
oWriter.WriteString(L"\" w:space=\"");
|
||||
oWriter.AddUInt(static_cast<unsigned int>(border.dSpacing * c_dMMToPt));
|
||||
oWriter.WriteString(L"\" w:color=\"");
|
||||
oWriter.WriteHexInt3(ConvertColorBGRToRGB(border.lColor));
|
||||
oWriter.WriteString(L"\" />");
|
||||
};
|
||||
|
||||
write_border(m_oBorderTop, L"top");
|
||||
write_border(m_oBorderBot, L"bottom");
|
||||
write_border(m_oBorderLeft, L"left");
|
||||
write_border(m_oBorderRight, L"right");
|
||||
|
||||
oWriter.WriteString(L"</w:tcBorders>");
|
||||
oWriter.WriteString(L"</w:tcPr>");
|
||||
|
||||
for (const auto& p : m_arParagraphs)
|
||||
p->ToXml(oWriter);
|
||||
|
||||
oWriter.WriteString(L"</w:tc>");
|
||||
}
|
||||
void CTable::CCell::ToXmlPptx(NSStringUtils::CStringBuilder& oWriter) const
|
||||
{
|
||||
|
||||
}
|
||||
void CTable::CCell::ToBin(NSWasm::CData& oWriter) const
|
||||
{
|
||||
|
||||
}
|
||||
CTable::CCell& CTable::CCell::operator=(const CCell& other)
|
||||
{
|
||||
CBaseItem::operator=(other);
|
||||
|
||||
m_oBorderBot = other.m_oBorderBot;
|
||||
m_oBorderTop = other.m_oBorderTop;
|
||||
m_oBorderLeft = other.m_oBorderLeft;
|
||||
m_oBorderRight = other.m_oBorderRight;
|
||||
|
||||
m_nGridSpan = other.m_nGridSpan;
|
||||
m_eVMerge = other.m_eVMerge;
|
||||
|
||||
m_arParagraphs.clear();
|
||||
for (const auto& p : other.m_arParagraphs)
|
||||
m_arParagraphs.push_back(p);
|
||||
|
||||
return *this;
|
||||
}
|
||||
void CTable::CCell::AddParagraph(const paragraph_ptr_t& pParagraph)
|
||||
{
|
||||
m_arParagraphs.push_back(pParagraph);
|
||||
}
|
||||
|
||||
void CTable::CRow::Clear()
|
||||
{
|
||||
m_arCells.clear();
|
||||
}
|
||||
void CTable::CRow::ToXml(NSStringUtils::CStringBuilder& oWriter) const
|
||||
{
|
||||
oWriter.WriteString(L"<w:tr>");
|
||||
|
||||
oWriter.WriteString(L"<w:trPr>");
|
||||
oWriter.WriteString(L"<w:trHeight w:val=\"");
|
||||
oWriter.AddUInt(static_cast<unsigned int>(m_dHeight * c_dMMToDx));
|
||||
oWriter.WriteString(L"\" w:hRule=\"exact\"/>");
|
||||
oWriter.WriteString(L"</w:trPr>");
|
||||
|
||||
for (const auto& c : m_arCells)
|
||||
c->ToXml(oWriter);
|
||||
|
||||
oWriter.WriteString(L"</w:tr>");
|
||||
}
|
||||
void CTable::CRow::ToXmlPptx(NSStringUtils::CStringBuilder& oWriter) const
|
||||
{
|
||||
|
||||
}
|
||||
void CTable::CRow::ToBin(NSWasm::CData& oWriter) const
|
||||
{
|
||||
|
||||
}
|
||||
void CTable::CRow::AddCell(const cell_ptr_t& pCell)
|
||||
{
|
||||
CBaseItem::RecalcWithNewItem(pCell.get());
|
||||
m_arCells.push_back(pCell);
|
||||
}
|
||||
bool CTable::CRow::IsEmpty() const
|
||||
{
|
||||
return m_arCells.empty();
|
||||
}
|
||||
|
||||
void CTable::Clear()
|
||||
{
|
||||
m_arRows.clear();
|
||||
}
|
||||
void CTable::ToXml(NSStringUtils::CStringBuilder& oWriter) const
|
||||
{
|
||||
oWriter.WriteString(L"<w:tbl>");
|
||||
|
||||
oWriter.WriteString(L"<w:tblPr>");
|
||||
oWriter.WriteString(L"<w:tblpPr ");
|
||||
|
||||
oWriter.WriteString(L"w:horzAnchor=\"page\" w:vertAnchor=\"page\" w:tblpX=\"");
|
||||
oWriter.AddInt64(static_cast<long long>(m_dLeft * c_dMMToDx));
|
||||
oWriter.WriteString(L"\" w:tblpY=\"");
|
||||
oWriter.AddInt64(static_cast<long long>(m_dTop * c_dMMToDx));
|
||||
oWriter.WriteString(L"\" />");
|
||||
|
||||
oWriter.WriteString(L"<w:tblW w:w=\"");
|
||||
oWriter.AddUInt(static_cast<unsigned int>(m_dWidth * c_dMMToDx));
|
||||
oWriter.WriteString(L"\" w:type=\"dxa\"/>");
|
||||
oWriter.WriteString(L"</w:tblPr>");
|
||||
|
||||
oWriter.WriteString(L"<w:tblGrid>");
|
||||
for (const auto& gc : m_arGridCols)
|
||||
ITableBuilder* Create()
|
||||
{
|
||||
oWriter.WriteString(L"<w:gridCol w:w=\"");
|
||||
oWriter.AddUInt(static_cast<unsigned int>(gc * c_dMMToDx));
|
||||
oWriter.WriteString(L"\" />");
|
||||
return new ITableBuilder();
|
||||
}
|
||||
oWriter.WriteString(L"</w:tblGrid>");
|
||||
|
||||
for (const auto& r : m_arRows)
|
||||
r->ToXml(oWriter);
|
||||
|
||||
oWriter.WriteString(L"</w:tbl>");
|
||||
}
|
||||
void CTable::ToXmlPptx(NSStringUtils::CStringBuilder& oWriter) const
|
||||
{
|
||||
|
||||
}
|
||||
void CTable::ToBin(NSWasm::CData& oWriter) const
|
||||
{
|
||||
|
||||
}
|
||||
void CTable::AddRow(const row_ptr_t& pRow)
|
||||
{
|
||||
CBaseItem::RecalcWithNewItem(pRow.get());
|
||||
m_arRows.push_back(pRow);
|
||||
}
|
||||
void CTable::CalcGridCols()
|
||||
{
|
||||
std::vector<double> cells_left;
|
||||
auto add_if_no_exists = [&cells_left] (double val) {
|
||||
bool exists = false;
|
||||
for (const auto& curr : cells_left)
|
||||
{
|
||||
if (fabs(curr - val) < c_dMAX_TABLE_LINE_WIDTH_MM)
|
||||
{
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exists)
|
||||
cells_left.push_back(val);
|
||||
};
|
||||
|
||||
double right = 0;
|
||||
for (const auto& row : m_arRows)
|
||||
{
|
||||
for (const auto& cell : row->m_arCells)
|
||||
{
|
||||
right = std::max(right, cell->m_dRight);
|
||||
add_if_no_exists(cell->m_dLeft);
|
||||
}
|
||||
}
|
||||
std::sort(cells_left.begin(), cells_left.end(), std::less<double>{});
|
||||
|
||||
for (size_t i = 0; i < cells_left.size() - 1; ++i)
|
||||
m_arGridCols.push_back(cells_left[i + 1] - cells_left[i]);
|
||||
|
||||
m_arGridCols.push_back(right - cells_left.back());
|
||||
}
|
||||
bool CTable::IsEmpty() const
|
||||
{
|
||||
return m_arRows.empty();
|
||||
}
|
||||
|
||||
void CTextCell::AddTextLine(const std::shared_ptr<CTextLine>& pTextLine)
|
||||
{
|
||||
CBaseItem::RecalcWithNewItem(pTextLine.get());
|
||||
m_arTextLines.push_back(pTextLine);
|
||||
}
|
||||
|
||||
} // namespace NSDocxRenderer
|
||||
}
|
||||
|
||||
@ -40,119 +40,52 @@
|
||||
|
||||
#include "BaseItem.h"
|
||||
#include "Paragraph.h"
|
||||
#include "Shape.h"
|
||||
|
||||
#include "../../resources/LinesTable.h"
|
||||
|
||||
namespace NSDocxRenderer
|
||||
{
|
||||
class CGraphicalCell;
|
||||
class CTextCell;
|
||||
class ITableBuilder
|
||||
{
|
||||
public:
|
||||
using shape_ptr_t = std::shared_ptr<CShape>;
|
||||
using paragraph_ptr_t = std::shared_ptr<CParagraph>;
|
||||
using ooxml_item_ptr_t = std::shared_ptr<IOoxmlItem>;
|
||||
|
||||
class CTable : public CBaseItem, public IOoxmlItem
|
||||
ITableBuilder() = default;
|
||||
~ITableBuilder() = default;
|
||||
|
||||
virtual void SetShapes(std::vector<shape_ptr_t>&& shapes)
|
||||
{
|
||||
public:
|
||||
class CCell;
|
||||
class CRow;
|
||||
|
||||
using cell_ptr_t = std::shared_ptr<CCell>;
|
||||
using row_ptr_t = std::shared_ptr<CRow>;
|
||||
using paragraph_ptr_t = std::shared_ptr<CParagraph>;
|
||||
|
||||
public:
|
||||
class CCell : public CBaseItem, public IOoxmlItem
|
||||
{
|
||||
friend class CTable;
|
||||
public:
|
||||
struct CBorder
|
||||
{
|
||||
double dWidth{};
|
||||
double dSpacing{};
|
||||
long lColor{};
|
||||
eLineType lineType{eLineType::ltNone};
|
||||
};
|
||||
|
||||
enum class eVMerge
|
||||
{
|
||||
vmRestart,
|
||||
vmContinue
|
||||
};
|
||||
|
||||
CCell() = default;
|
||||
CCell(const CCell& other);
|
||||
virtual ~CCell() = default;
|
||||
virtual void Clear();
|
||||
virtual void ToXml(NSStringUtils::CStringBuilder& oWriter) const override final;
|
||||
virtual void ToXmlPptx(NSStringUtils::CStringBuilder& oWriter) const override final;
|
||||
virtual void ToBin(NSWasm::CData& oWriter) const override final;
|
||||
|
||||
CCell& operator=(const CCell& other);
|
||||
|
||||
void AddParagraph(const paragraph_ptr_t& pParagraph);
|
||||
|
||||
CBorder m_oBorderTop;
|
||||
CBorder m_oBorderBot;
|
||||
CBorder m_oBorderLeft;
|
||||
CBorder m_oBorderRight;
|
||||
|
||||
unsigned int m_nGridSpan = 1;
|
||||
eVMerge m_eVMerge = CTable::CCell::eVMerge::vmRestart;
|
||||
|
||||
std::vector<paragraph_ptr_t> m_arParagraphs;
|
||||
};
|
||||
class CRow : public CBaseItem, IOoxmlItem
|
||||
{
|
||||
friend class CTable;
|
||||
public:
|
||||
CRow() = default;
|
||||
virtual ~CRow() = default;
|
||||
virtual void Clear();
|
||||
virtual void ToXml(NSStringUtils::CStringBuilder& oWriter) const override final;
|
||||
virtual void ToXmlPptx(NSStringUtils::CStringBuilder& oWriter) const override final;
|
||||
virtual void ToBin(NSWasm::CData& oWriter) const override final;
|
||||
|
||||
void AddCell(const cell_ptr_t& pCell);
|
||||
bool IsEmpty() const;
|
||||
|
||||
private:
|
||||
std::vector<cell_ptr_t> m_arCells;
|
||||
};
|
||||
|
||||
CTable() = default;
|
||||
virtual ~CTable() = default;
|
||||
virtual void Clear();
|
||||
virtual void ToXml(NSStringUtils::CStringBuilder& oWriter) const override final;
|
||||
virtual void ToXmlPptx(NSStringUtils::CStringBuilder& oWriter) const override final;
|
||||
virtual void ToBin(NSWasm::CData& oWriter) const override final;
|
||||
|
||||
void AddRow(const row_ptr_t& pRow);
|
||||
void CalcGridCols();
|
||||
bool IsEmpty() const;
|
||||
|
||||
private:
|
||||
std::vector<row_ptr_t> m_arRows;
|
||||
std::vector<double> m_arGridCols;
|
||||
};
|
||||
|
||||
class CGraphicalCell : public CBaseItem
|
||||
m_arShapes = std::move(shapes);
|
||||
}
|
||||
virtual void SetParagraphs(std::vector<paragraph_ptr_t>&& paragraphs)
|
||||
{
|
||||
public:
|
||||
// realization
|
||||
};
|
||||
m_arParagraphs = paragraphs;
|
||||
}
|
||||
|
||||
class CTextCell : public CBaseItem
|
||||
virtual std::vector<shape_ptr_t>&& ReturnShapes()
|
||||
{
|
||||
public:
|
||||
void AddTextLine(const std::shared_ptr<CTextLine>& pTextLine);
|
||||
std::vector<std::shared_ptr<CTextLine>> m_arTextLines;
|
||||
return std::move(m_arShapes);
|
||||
}
|
||||
virtual std::vector<paragraph_ptr_t>&& ReturnParagraphs()
|
||||
{
|
||||
return std::move(m_arParagraphs);
|
||||
}
|
||||
virtual std::vector<ooxml_item_ptr_t>&& GetTables()
|
||||
{
|
||||
return std::move(m_arTables);
|
||||
}
|
||||
|
||||
double m_dMinPossibleTop = std::numeric_limits<double>::lowest();
|
||||
double m_dMinPossibleLeft = std::numeric_limits<double>::lowest();
|
||||
public:
|
||||
virtual void BuildGraphicallCells() noexcept {};
|
||||
virtual void BuildTables() noexcept {};
|
||||
|
||||
double m_dMaxPossibleBot = std::numeric_limits<double>::max();
|
||||
double m_dMaxPossibleRight = std::numeric_limits<double>::max();
|
||||
};
|
||||
private:
|
||||
std::vector<ooxml_item_ptr_t> m_arTables;
|
||||
std::vector<shape_ptr_t> m_arShapes;
|
||||
std::vector<paragraph_ptr_t> m_arParagraphs;
|
||||
};
|
||||
|
||||
namespace NSTables {
|
||||
ITableBuilder* Create();
|
||||
}
|
||||
} // namespace NSDocxRenderer
|
||||
|
||||
|
||||
|
||||
|
||||
@ -44,6 +44,8 @@
|
||||
#define USING_DELETE_DUPLICATING_CONTS 0 // 0 - all duplicate lines become shapes, 1 - duplicate lines are deleted
|
||||
// #define USE_DEFAULT_FONT_TO_RECALC
|
||||
|
||||
const double c_dCOMPARE_EPSILON = 0.1;
|
||||
|
||||
const double c_dDpiX = 72.0;
|
||||
const double c_dDpiY = 72.0;
|
||||
|
||||
@ -68,9 +70,10 @@ 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;
|
||||
const double c_dERROR_FOR_TEXT_WITH_GRAPHICS_MM = 0.1;
|
||||
const double c_dGRAPHICS_ERROR_MM = 0.5;
|
||||
const double c_dGRAPHICS_ERROR_MM = 1.0;
|
||||
const double c_dMAX_TABLE_LINE_WIDTH_MM = 2.2;
|
||||
const double c_dMAX_TABLE_CELL_DIFF_MM = 7.0;
|
||||
const double c_dMIN_TABLE_DIFF_MM = 0.3;
|
||||
const double c_dGRAPHICS_ERROR_IN_LINES_MM = 0.3;
|
||||
const double c_dMAX_LINE_HEIGHT_MM = 2.5;
|
||||
const double c_dMAX_LINE_WITH_TEXT_ERROR_MM = 2.5;
|
||||
@ -85,6 +88,8 @@ const double c_dAVERAGE_SPACE_WIDTH_COEF = 0.9;
|
||||
const double c_dSPACE_WIDTH_COEF = 0.39;
|
||||
const double c_dMIN_ROTATION = 0.01;
|
||||
const double c_dMAX_FIRST_LINE_INDENT = 20.0;
|
||||
const double c_dMIN_RIGHT_MARGIN = 0.4;
|
||||
constexpr double c_dSTANDART_TABLE_SPACING_MM = 108.0 / c_dMMToDx;
|
||||
|
||||
const UINT c_iWhiteColor = 0xFFFFFF;
|
||||
const UINT c_iBlackColor = 0x000000;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include <type_traits>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#include "../../../DesktopEditor/common/Types.h"
|
||||
|
||||
@ -71,3 +72,11 @@ bool CmpOrEqual(const T& val1,
|
||||
{
|
||||
return std::abs(val1 - val2) < eps || cmp(val1, val2);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::function<bool(const T&, const T&)> makeEqualComp(T eps)
|
||||
{
|
||||
return [eps](const T& a, const T& b) -> bool {
|
||||
return std::abs(a - b) < eps;
|
||||
};
|
||||
}
|
||||
|
||||
@ -38,6 +38,10 @@
|
||||
|
||||
#include <string>
|
||||
#include "../DesktopEditor/common/StringBuilder.h"
|
||||
#include "../DesktopEditor/common/ProcessEnv.h"
|
||||
#include "../DesktopEditor/common/Path.h"
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
namespace HTML
|
||||
{
|
||||
@ -94,6 +98,31 @@ inline void WriteToStringBuilder(NSStringUtils::CStringBuilder& oSrcStringBuilde
|
||||
}
|
||||
}
|
||||
|
||||
inline bool GetStatusUsingExternalLocalFiles()
|
||||
{
|
||||
if (NSProcessEnv::IsPresent(NSProcessEnv::Converter::gc_allowPrivateIP))
|
||||
return NSProcessEnv::GetBoolValue(NSProcessEnv::Converter::gc_allowPrivateIP);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool CanUseThisPath(const std::wstring& wsPath, const std::wstring& wsSrcPath, const std::wstring& wsCorePath, bool bIsAllowExternalLocalFiles)
|
||||
{
|
||||
if (bIsAllowExternalLocalFiles)
|
||||
return true;
|
||||
|
||||
if (!wsCorePath.empty())
|
||||
{
|
||||
const std::wstring wsFullPath = NSSystemPath::ShortenPath(NSSystemPath::Combine(wsSrcPath, wsPath));
|
||||
return boost::starts_with(wsFullPath, wsCorePath);
|
||||
}
|
||||
|
||||
if (wsPath.length() >= 3 && L"../" == wsPath.substr(0, 3))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // COMMON_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -36,8 +36,6 @@
|
||||
#ifndef HTMLREADER_H
|
||||
#define HTMLREADER_H
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "../Common/3dParty/html/css/src/CCssCalculator.h"
|
||||
#include "../DesktopEditor/xml/include/xmlutils.h"
|
||||
|
||||
@ -48,11 +46,12 @@
|
||||
#include "Tags/HTMLTags.h"
|
||||
#include "Table.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
namespace HTML
|
||||
{
|
||||
class CHTMLReader
|
||||
{
|
||||
XmlUtils::CXmlLiteReader m_oLightReader; // SAX Reader
|
||||
NSCSS::CCssCalculator m_oCSSCalculator; // CSS calculator
|
||||
|
||||
bool m_bIsTempDirOwner;
|
||||
@ -64,7 +63,11 @@ class CHTMLReader
|
||||
|
||||
IWriter *m_pWriter;
|
||||
|
||||
std::unordered_map<UINT, std::shared_ptr<ITag>> m_mTags;
|
||||
CTableElement* m_pTableElement; // Table Converter
|
||||
|
||||
std::set<std::wstring> m_arStopTags;
|
||||
|
||||
std::map<int, std::shared_ptr<ITag>> m_mTags;
|
||||
public:
|
||||
CHTMLReader();
|
||||
~CHTMLReader();
|
||||
@ -87,10 +90,10 @@ public:
|
||||
NSCSS::CCssCalculator* GetCSSCalculator();
|
||||
private:
|
||||
void Clear();
|
||||
void InitOOXMLTags(THTMLParameters* pParametrs = nullptr);
|
||||
void InitMDTags(TMarkdownParameters* pParametrs = nullptr);
|
||||
bool InitOOXMLTags(THTMLParameters* pParametrs = nullptr);
|
||||
bool InitMDTags(TMarkdownParameters* pParametrs = nullptr);
|
||||
|
||||
bool IsHTML();
|
||||
bool IsHTML(XmlUtils::CXmlLiteReader& oReader);
|
||||
|
||||
typedef std::function<bool(const std::wstring&, XmlUtils::CXmlLiteReader&)> Convert_Func;
|
||||
|
||||
@ -99,29 +102,28 @@ private:
|
||||
|
||||
bool Convert(const std::wstring& wsPath, Convert_Func Convertation);
|
||||
|
||||
void ReadStyle();
|
||||
void ReadStyle2();
|
||||
void ReadStyleFromNetwork();
|
||||
void ReadStyle(XmlUtils::CXmlLiteReader& oReader);
|
||||
void ReadStyle2(XmlUtils::CXmlLiteReader& oReader);
|
||||
void ReadStyleFromNetwork(XmlUtils::CXmlLiteReader& oReader);
|
||||
|
||||
void ReadDocument();
|
||||
void ReadHead();
|
||||
void ReadBody();
|
||||
void ReadDocument(XmlUtils::CXmlLiteReader& oReader);
|
||||
void ReadHead(XmlUtils::CXmlLiteReader& oReader);
|
||||
void ReadBody(XmlUtils::CXmlLiteReader& oReader);
|
||||
|
||||
bool ReadStream(std::vector<NSCSS::CNode>& arSelectors, bool bInsertEmptyP = false);
|
||||
bool ReadInside(std::vector<NSCSS::CNode>& arSelectors);
|
||||
bool ReadStream(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors, bool bInsertEmptyP = false);
|
||||
bool ReadInside(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors);
|
||||
|
||||
bool ReadText(std::vector<NSCSS::CNode>& arSelectors);
|
||||
bool ReadText(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors);
|
||||
|
||||
bool ReadSVG(const std::vector<NSCSS::CNode>& arSelectors);
|
||||
bool ReadEmptyTag(UINT unTag, const std::vector<NSCSS::CNode>& arSelectors);
|
||||
bool ReadDefaultTag(UINT unTag, std::vector<NSCSS::CNode>& arSelectors);
|
||||
bool ReadTable(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors);
|
||||
|
||||
bool ReadTable(std::vector<NSCSS::CNode>& arSelectors);
|
||||
void ReadTableCaption(CStorageTable& oTable, std::vector<NSCSS::CNode>& arSelectors);
|
||||
void ReadTableRows(CStorageTable& oTable, std::vector<NSCSS::CNode>& arSelectors, ERowParseMode eMode);
|
||||
void ReadTableColspan(CStorageTable& oTable);
|
||||
bool ReadEmptyTag(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors, std::shared_ptr<ITag> pTag);
|
||||
bool ReadTag(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors, std::shared_ptr<ITag> pTag);
|
||||
|
||||
void GetSubClass(std::vector<NSCSS::CNode>& arSelectors);
|
||||
std::shared_ptr<ITag> GetTag(int nTag);
|
||||
|
||||
void AddStopTag(const std::wstring& wsTag);
|
||||
void ClearStopTags();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -36,10 +36,12 @@
|
||||
#ifndef TABLE_H
|
||||
#define TABLE_H
|
||||
|
||||
#include "../DesktopEditor/common/StringBuilder.h"
|
||||
#include "../Common/3dParty/html/css/src/StyleProperties.h"
|
||||
#include "../Common/3dParty/html/css/src/CNode.h"
|
||||
#include "../DesktopEditor/xml/include/xmlutils.h"
|
||||
|
||||
#include "Writers/IWriter.h"
|
||||
#include "src/StringFinder.h"
|
||||
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
namespace HTML
|
||||
@ -47,244 +49,330 @@ namespace HTML
|
||||
#define MAXCOLUMNSINTABLE 63
|
||||
#define MAXROWSINTABLE 32767
|
||||
|
||||
enum class ERowParseMode
|
||||
struct TCurentTablePosition
|
||||
{
|
||||
Header,
|
||||
Body,
|
||||
Foother
|
||||
size_t m_unRowIndex;
|
||||
size_t m_unColumnIndex;
|
||||
|
||||
size_t m_unStartRowIndex;
|
||||
size_t m_unStartColumnIndex;
|
||||
|
||||
TCurentTablePosition(size_t unRowIndex, size_t unColumnIndex, size_t unStartRowIndex, size_t unStartColumnIndex)
|
||||
: m_unRowIndex{unRowIndex}, m_unColumnIndex{unColumnIndex},
|
||||
m_unStartRowIndex{unStartRowIndex}, m_unStartColumnIndex{unStartColumnIndex}
|
||||
{}
|
||||
};
|
||||
|
||||
enum class ERowPosition
|
||||
|
||||
enum class ETableElement
|
||||
{
|
||||
First,
|
||||
Middle,
|
||||
Last
|
||||
FillingCell,
|
||||
Cell,
|
||||
FlatTable,
|
||||
TableContainer
|
||||
};
|
||||
|
||||
struct TTableRowStyle
|
||||
// !TODO!:: At the moment, I don't really like the implementation where there is a table inside a cell,
|
||||
// or when there are multiple nested tables inside a cell
|
||||
|
||||
// Perhaps it's worth doing it as follows:
|
||||
// ITableCell -> CTableCell (A regular cell that does not contain nested tables)
|
||||
// -> CTableCellContainer (Stores anything (like default, but has a container for storing nested tables))
|
||||
|
||||
class ITableElementCell
|
||||
{
|
||||
UINT m_unMaxIndex;
|
||||
UINT m_unMaxHeight;
|
||||
bool m_bIsHeader;
|
||||
size_t m_unColspan;
|
||||
protected:
|
||||
ITableElementCell(size_t unColspan);
|
||||
public:
|
||||
virtual ~ITableElementCell() = default;
|
||||
|
||||
TTableRowStyle();
|
||||
virtual ETableElement GetType() const = 0;
|
||||
|
||||
bool Empty() const;
|
||||
void SetColspan(size_t unColspan);
|
||||
|
||||
size_t GetColspan() const;
|
||||
};
|
||||
|
||||
struct TTableCellStyle
|
||||
class CTableElementCell : public ITableElementCell
|
||||
{
|
||||
NSCSS::NSProperties::CDigit m_oWidth;
|
||||
NSCSS::NSProperties::CDigit m_oHeight;
|
||||
NSCSS::NSProperties::CBorder m_oBorder;
|
||||
NSCSS::NSProperties::CIndent m_oPadding;
|
||||
NSCSS::NSProperties::CColor m_oBackground;
|
||||
ETableElement m_eType;
|
||||
|
||||
std::wstring m_wsHAlign;
|
||||
std::wstring m_wsVAlign;
|
||||
protected:
|
||||
CTableElementCell(bool bIsFilling, size_t unColspan);
|
||||
public:
|
||||
virtual ~CTableElementCell();
|
||||
|
||||
TTableCellStyle();
|
||||
ETableElement GetType() const override;
|
||||
|
||||
bool Empty();
|
||||
void Copy(const TTableCellStyle* pTableCellStyle);
|
||||
void IsFlatTable();
|
||||
|
||||
TTableCellStyle& operator+=(const TTableCellStyle* pCellStyle);
|
||||
static CTableElementCell* CreateCell(const size_t& unColspan = 1);
|
||||
static CTableElementCell* CreateFillingCell(const size_t& unColspan = 1);
|
||||
};
|
||||
|
||||
class CStorageTable;
|
||||
class ITag;
|
||||
class IWriter;
|
||||
|
||||
class CStorageTableCell
|
||||
struct TExternalTableData
|
||||
{
|
||||
typedef std::function<bool(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors)> FuncReadStream;
|
||||
typedef std::function<void(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors)> FuncGetSubClass;
|
||||
typedef std::function<bool(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors)> FuncReadInside;
|
||||
typedef std::function<void(const std::wstring& wsTag)> FuncAddStopTag;
|
||||
typedef std::function<void()> FuncClearStopTags;
|
||||
|
||||
FuncReadStream ReadStream;
|
||||
FuncGetSubClass GetSubClass;
|
||||
FuncReadInside ReadInside;
|
||||
FuncAddStopTag AddStopTag;
|
||||
FuncClearStopTags ClearStopTags;
|
||||
|
||||
IWriter* m_pWriter{nullptr};
|
||||
};
|
||||
|
||||
typedef std::vector<ITableElementCell*> Row;
|
||||
typedef std::vector<Row> Table;
|
||||
|
||||
class IWriter;
|
||||
|
||||
class CTableMatrix
|
||||
{
|
||||
public:
|
||||
CStorageTableCell();
|
||||
CStorageTableCell(UINT unColspan, UINT unRowspan, bool bIsMerged, bool bIsEmpty);
|
||||
CStorageTableCell(CStorageTableCell& oCell);
|
||||
CTableMatrix();
|
||||
virtual ~CTableMatrix();
|
||||
|
||||
bool Empty() const;
|
||||
bool Merged() const;
|
||||
|
||||
CStorageTableCell* Copy();
|
||||
void Clear();
|
||||
|
||||
static CStorageTableCell* CreateEmpty(UINT unColspan = 1, bool m_bIsMerged = false, const TTableCellStyle* pStyle = NULL);
|
||||
static CStorageTableCell* CreateEmpty(const TTableCellStyle* pStyle);
|
||||
bool SetCell(size_t unRowIndex, size_t unColumnIndex, ITableElementCell* pCell, bool bAutoClean = true);
|
||||
|
||||
void SetColspan(UINT unColspan, UINT unCurrentIndex);
|
||||
UINT GetColspan() const;
|
||||
void NormalizeNumberColumns(size_t unNumberColumns);
|
||||
|
||||
void SetRowspan(UINT unRowspan);
|
||||
UINT GetRowspan() const;
|
||||
bool IsFillingCell(size_t unRowIndex, size_t unColumnIndex) const;
|
||||
bool IsNotNullCell(size_t unRowIndex, size_t unColumnIndex) const;
|
||||
|
||||
NSStringUtils::CStringBuilder* GetData();
|
||||
size_t GetRowSize() const;
|
||||
size_t GetColumnSize() const;
|
||||
|
||||
const TTableCellStyle* GetStyles() const;
|
||||
TTableCellStyle* GetStyles();
|
||||
const Table& GetMatrixCells() const;
|
||||
Table& GetMatrixCells();
|
||||
|
||||
void SetWidth(const NSCSS::NSProperties::CDigit& oWidth);
|
||||
void SetHeight(const NSCSS::NSProperties::CDigit& oHeight);
|
||||
|
||||
UINT GetWidth() const;
|
||||
UINT GetHeight() const;
|
||||
|
||||
void SetBorder(const NSCSS::NSProperties::CBorder& oBorder);
|
||||
|
||||
void ClearTopBorder();
|
||||
void ClearLeftBorder();
|
||||
void ClearBottomBorder();
|
||||
void ClearRightBorder();
|
||||
|
||||
void SetPadding(const NSCSS::NSProperties::CIndent& oPadding);
|
||||
void SetHAlign(const std::wstring& wsAlign);
|
||||
void SetVAlign(const std::wstring& wsAlign);
|
||||
void SetBackground(const NSCSS::NSProperties::CColor& oColor);
|
||||
private:
|
||||
UINT m_unColspan;
|
||||
UINT m_unRowSpan;
|
||||
|
||||
bool m_bIsMerged;
|
||||
bool m_bIsEmpty;
|
||||
|
||||
TTableCellStyle m_oStyles;
|
||||
NSStringUtils::CStringBuilder m_oData;
|
||||
};
|
||||
|
||||
class CStorageTableRow
|
||||
{
|
||||
public:
|
||||
CStorageTableRow();
|
||||
~CStorageTableRow();
|
||||
|
||||
void AddCell(CStorageTableCell* pCell);
|
||||
void InsertCell(CStorageTableCell *pCell, int nPosition);
|
||||
|
||||
UINT GetIndex() const;
|
||||
UINT GetCount() const;
|
||||
|
||||
CStorageTableCell* operator[](UINT unIndex);
|
||||
|
||||
bool Empty() const;
|
||||
const TTableRowStyle& GetStyles() const;
|
||||
const std::vector<CStorageTableCell*>& GetCells() const;
|
||||
private:
|
||||
TTableRowStyle m_oStyles;
|
||||
std::vector<CStorageTableCell*> m_arCells;
|
||||
const ITableElementCell* GetCell(size_t unRowIndex, size_t unColumnIndex) const;
|
||||
ITableElementCell* GetCell(size_t unRowIndex, size_t unColumnIndex);
|
||||
protected:
|
||||
Table m_arCells;
|
||||
};
|
||||
|
||||
class CTableCol
|
||||
{
|
||||
public:
|
||||
CTableCol(UINT unSpan);
|
||||
CTableCol(const NSCSS::CNode& oTableColNode);
|
||||
CTableCol(NSCSS::CNode& oTableColNode);
|
||||
~CTableCol();
|
||||
|
||||
UINT GetSpan() const;
|
||||
TTableCellStyle* GetStyle();
|
||||
const TTableCellStyle* GetStyle() const;
|
||||
const NSCSS::CCompiledStyle* GetStyle() const;
|
||||
private:
|
||||
UINT m_unSpan;
|
||||
TTableCellStyle m_oStyle;
|
||||
NSCSS::CCompiledStyle* m_pStyle;
|
||||
};
|
||||
|
||||
class CTableColgroup
|
||||
{
|
||||
public:
|
||||
CTableColgroup(NSCSS::CNode& oTableColgroupNode);
|
||||
CTableColgroup(const NSCSS::CNode& oTableColgroupNode);
|
||||
~CTableColgroup();
|
||||
|
||||
bool Empty() const;
|
||||
|
||||
void AddCol(CTableCol* pCol);
|
||||
|
||||
UINT GetTotalSpans() const;
|
||||
const std::vector<CTableCol*>& GetCols() const;
|
||||
const NSCSS::CCompiledStyle* GetColStyle(size_t unIndex) const;
|
||||
private:
|
||||
std::vector<CTableCol*> m_arCols;
|
||||
UINT m_unWidth;
|
||||
UINT m_unTotalSpans;
|
||||
};
|
||||
|
||||
//Required table styles
|
||||
struct TTableStyles
|
||||
{
|
||||
NSCSS::NSProperties::CIndent m_oPadding;
|
||||
NSCSS::NSProperties::CIndent m_oMargin;
|
||||
NSCSS::NSProperties::CBorder m_oBorder;
|
||||
NSCSS::NSProperties::CDigit m_oWidth;
|
||||
|
||||
int m_nCellSpacing;
|
||||
|
||||
std::wstring m_wsAlign;
|
||||
|
||||
enum ETableRules
|
||||
{
|
||||
All,
|
||||
Groups,
|
||||
Cols,
|
||||
None,
|
||||
Rows
|
||||
} m_enRules;
|
||||
|
||||
TTableStyles();
|
||||
|
||||
bool Empty() const;
|
||||
};
|
||||
|
||||
class CStorageTable
|
||||
class CTableElement
|
||||
{
|
||||
protected:
|
||||
CTableElement(TExternalTableData &oExternalData);
|
||||
public:
|
||||
CStorageTable();
|
||||
~CStorageTable();
|
||||
virtual ~CTableElement();
|
||||
|
||||
CStorageTableRow* operator[](UINT unIndex);
|
||||
void Clear();
|
||||
|
||||
bool Empty() const;
|
||||
bool HaveCaption();
|
||||
bool HaveColgroups() const;
|
||||
bool HaveHeader() const;
|
||||
UINT GetRowCount() const;
|
||||
const TTableStyles& GetTableStyles() const;
|
||||
const TTableCellStyle* GetColStyle(UINT unColumnNumber) const;
|
||||
bool HaveCaption() const;
|
||||
|
||||
void AddRows(std::vector<CStorageTableRow*>& m_arRows, ERowParseMode eParseMode = ERowParseMode::Body);
|
||||
void AddRow(CStorageTableRow* pRow, ERowParseMode eParseMode = ERowParseMode::Body);
|
||||
virtual bool PreParse(XmlUtils::CXmlLiteReader& oReader) = 0;
|
||||
virtual void Normalize() = 0;
|
||||
virtual bool Convert(XmlUtils::CXmlLiteReader& oReader, const NSCSS::CNode& oTableNode) = 0;
|
||||
protected:
|
||||
CTableMatrix m_oHeader;
|
||||
CTableMatrix m_oBody;
|
||||
CTableMatrix m_oFoother;
|
||||
|
||||
NSStringUtils::CStringBuilder* GetCaptionData();
|
||||
|
||||
void SetPadding(const NSCSS::NSProperties::CIndent& oPadding);
|
||||
const NSCSS::NSProperties::CIndent& GetPadding() const;
|
||||
|
||||
void SetMargin(const NSCSS::NSProperties::CIndent& oMargin);
|
||||
void SetBorder(const NSCSS::NSProperties::CBorder& oBorder);
|
||||
|
||||
void SetWidth(const NSCSS::NSProperties::CDigit& oWidth);
|
||||
void SetCellSpacing(int nCellSpacing);
|
||||
void SetAlign(const std::wstring& wsValue);
|
||||
void SetRules(const std::wstring& wsValue);
|
||||
|
||||
void AddColgroup(CTableColgroup* pElement);
|
||||
|
||||
void RecalculateMaxColumns();
|
||||
void Shorten();
|
||||
void CompleteTable();
|
||||
|
||||
//TODO:: refactor to const std::vector<const T*> Get...() const;
|
||||
const std::vector<std::vector<CStorageTableRow*>>& GetHeaders() const;
|
||||
const std::vector<CStorageTableRow*>& GetFoothers() const;
|
||||
const std::vector<CStorageTableRow*>& GetRows() const;
|
||||
const std::vector<CTableColgroup*> GetColgroups() const;
|
||||
|
||||
UINT GetMaxColumns() const;
|
||||
private:
|
||||
std::vector<std::vector<CStorageTableRow*>> m_arHeaders;
|
||||
std::vector<CStorageTableRow*> m_arFoother;
|
||||
std::vector<CStorageTableRow*> m_arRows;
|
||||
|
||||
std::vector<UINT> m_arMinColspan;
|
||||
|
||||
NSStringUtils::CStringBuilder m_oCaption;
|
||||
XmlString *m_pCaption;
|
||||
|
||||
std::vector<CTableColgroup*> m_arColgroups;
|
||||
|
||||
TTableStyles m_oStyles;
|
||||
TExternalTableData m_oExternalData;
|
||||
|
||||
UINT m_unMaxColumns;
|
||||
const NSCSS::CCompiledStyle* GetColStyle(size_t unColIndex) const;
|
||||
|
||||
virtual bool ParseCaption(XmlUtils::CXmlLiteReader& oReader, XmlString*& pCaption) = 0;
|
||||
virtual bool ParseColgroup(XmlUtils::CXmlLiteReader& oReader, std::vector<CTableColgroup*>& arColgroups) = 0;
|
||||
template<typename T>
|
||||
inline bool ParseTable(XmlUtils::CXmlLiteReader& oReader, T* pTable);
|
||||
template<typename T>
|
||||
inline bool ParseMatrix(XmlUtils::CXmlLiteReader& oReader, CTableMatrix* pMatrix, size_t& unRowIndex, size_t& unColumnIndex);
|
||||
};
|
||||
|
||||
class CTableContainer : public ITableElementCell
|
||||
{
|
||||
public:
|
||||
CTableContainer();
|
||||
virtual ~CTableContainer();
|
||||
|
||||
ETableElement GetType() const override;
|
||||
|
||||
void AddTable(CTableElement* pTable);
|
||||
const std::vector<CTableElement*>& GetTables() const;
|
||||
private:
|
||||
std::vector<CTableElement*> m_arTables;
|
||||
};
|
||||
|
||||
struct TTableData
|
||||
{
|
||||
CTableMatrix m_oHeader;
|
||||
CTableMatrix m_oBody;
|
||||
CTableMatrix m_oFoother;
|
||||
|
||||
XmlString *m_pCaption;
|
||||
|
||||
std::vector<CTableColgroup*> m_arColgroups;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline bool CTableElement::ParseTable(XmlUtils::CXmlLiteReader& oReader, T* pTable)
|
||||
{
|
||||
const int nDeath{oReader.GetDepth()};
|
||||
std::wstring wsName;
|
||||
|
||||
while(oReader.ReadNextSiblingNode(nDeath))
|
||||
{
|
||||
wsName = oReader.GetName();
|
||||
|
||||
size_t unRowIndex{0}, unColumnIndex{0};
|
||||
|
||||
if(L"thead" == wsName)
|
||||
ParseMatrix<T>(oReader, &pTable->m_oHeader, unRowIndex, unColumnIndex);
|
||||
if(L"tbody" == wsName)
|
||||
ParseMatrix<T>(oReader, &pTable->m_oBody, unRowIndex, unColumnIndex);
|
||||
else if(L"tfoot" == wsName)
|
||||
ParseMatrix<T>(oReader, &pTable->m_oFoother, unRowIndex, unColumnIndex);
|
||||
else if (L"caption" == wsName)
|
||||
ParseCaption(oReader, pTable->m_pCaption);
|
||||
else if (L"colgroup" == wsName)
|
||||
ParseColgroup(oReader, pTable->m_arColgroups);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool CTableElement::ParseMatrix(XmlUtils::CXmlLiteReader& oReader, CTableMatrix* pMatrix, size_t& unRowIndex, size_t& unColumnIndex)
|
||||
{
|
||||
const std::wstring wsElementName{oReader.GetName()};
|
||||
|
||||
if (L"table" == wsElementName)
|
||||
{
|
||||
T* pNewTable{new T(m_oExternalData)};
|
||||
|
||||
if (nullptr == pNewTable)
|
||||
return false;
|
||||
|
||||
ITableElementCell* pTableElement{pMatrix->GetCell(unRowIndex - 1, unColumnIndex - 1)};
|
||||
CTableContainer *pContainer{nullptr};
|
||||
|
||||
if (nullptr != pTableElement && ETableElement::TableContainer == pTableElement->GetType())
|
||||
pContainer = dynamic_cast<CTableContainer*>(pTableElement);
|
||||
else
|
||||
{
|
||||
pContainer = new CTableContainer();
|
||||
pMatrix->SetCell(unRowIndex - 1, unColumnIndex - 1, pContainer);
|
||||
}
|
||||
|
||||
if (nullptr == pContainer)
|
||||
return false;
|
||||
|
||||
pContainer->AddTable(pNewTable);
|
||||
|
||||
ParseTable<T>(oReader, pNewTable);
|
||||
}
|
||||
else if (L"tr" == wsElementName)
|
||||
{
|
||||
const int nDepth{oReader.GetDepth()};
|
||||
++unRowIndex;
|
||||
unColumnIndex = 0;
|
||||
|
||||
while (oReader.ReadNextSiblingNode(nDepth))
|
||||
{
|
||||
if (L"td" != oReader.GetName() && L"th" != oReader.GetName())
|
||||
continue;
|
||||
|
||||
ParseMatrix<T>(oReader, pMatrix, unRowIndex, unColumnIndex);
|
||||
}
|
||||
}
|
||||
else if (L"td" == wsElementName || L"th" == wsElementName)
|
||||
{
|
||||
++unColumnIndex;
|
||||
|
||||
while (pMatrix->IsFillingCell(unRowIndex - 1, unColumnIndex - 1))
|
||||
++unColumnIndex;
|
||||
|
||||
size_t unRowspan{1}, unColspan{1};
|
||||
|
||||
if (oReader.MoveToFirstAttribute())
|
||||
{
|
||||
do
|
||||
{
|
||||
if (L"rowspan" == oReader.GetName())
|
||||
unRowspan = NSStringFinder::ToInt(oReader.GetText(), 1);
|
||||
else if (L"colspan" == oReader.GetName())
|
||||
unColspan = NSStringFinder::ToInt(oReader.GetText(), 1);
|
||||
}while (oReader.MoveToNextAttribute());
|
||||
oReader.MoveToElement();
|
||||
}
|
||||
|
||||
if (!pMatrix->SetCell(unRowIndex - 1, unColumnIndex - 1, CTableElementCell::CreateCell(unColspan)))
|
||||
return false;
|
||||
|
||||
for (size_t unRow = 1; unRow < unRowspan; ++unRow)
|
||||
pMatrix->SetCell(unRowIndex + unRow - 1, unColumnIndex - 1, CTableElementCell::CreateFillingCell(unColspan));
|
||||
|
||||
const int nDepth{oReader.GetDepth()};
|
||||
while (oReader.ReadNextSiblingNode(nDepth))
|
||||
ParseMatrix<T>(oReader, pMatrix, unRowIndex, unColumnIndex);
|
||||
}
|
||||
else if (oReader.IsEmptyNode())
|
||||
return false;
|
||||
else
|
||||
{
|
||||
const int nDepth{oReader.GetDepth()};
|
||||
while (oReader.ReadNextSiblingNode(nDepth))
|
||||
ParseMatrix<T>(oReader, pMatrix, unRowIndex, unColumnIndex);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MoveToNextTableCell(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors, std::stack<int>& arDepths, TExternalTableData::FuncGetSubClass& GetSubClass);
|
||||
}
|
||||
|
||||
#endif // TABLE_H
|
||||
|
||||
@ -37,89 +37,56 @@
|
||||
#define HTMLTAGS_H
|
||||
|
||||
#include "../Common/3dParty/html/css/src/CNode.h"
|
||||
#include <boost/any.hpp>
|
||||
|
||||
namespace HTML
|
||||
{
|
||||
class ITag
|
||||
{
|
||||
public:
|
||||
ITag() = default;
|
||||
virtual ~ITag() = default;
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) = 0;
|
||||
|
||||
virtual bool Open (const std::vector<NSCSS::CNode>& arSelectors) = 0;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) = 0;
|
||||
};
|
||||
|
||||
template<class Writer>
|
||||
class IHTMLTag : public ITag
|
||||
{
|
||||
protected:
|
||||
Writer* m_pWriter;
|
||||
|
||||
bool Valid() const
|
||||
{
|
||||
return nullptr != m_pWriter;
|
||||
}
|
||||
public:
|
||||
IHTMLTag(Writer* pWriter)
|
||||
: m_pWriter(pWriter) {};
|
||||
virtual ~IHTMLTag() = default;
|
||||
|
||||
virtual bool Open (const std::vector<NSCSS::CNode>& arSelectors) = 0;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) = 0;
|
||||
};
|
||||
|
||||
#define CREATE_TAG(tag_name, writer)\
|
||||
class C ## tag_name ## Tag : public IHTMLTag<writer>\
|
||||
{\
|
||||
public:\
|
||||
C ## tag_name ## Tag(writer *pWriter)\
|
||||
: IHTMLTag(pWriter) {}\
|
||||
\
|
||||
bool Open (const std::vector<NSCSS::CNode>& arSelectors) override;\
|
||||
void Close(const std::vector<NSCSS::CNode>& arSelectors) override;\
|
||||
}
|
||||
|
||||
class CEmptyTag : public ITag
|
||||
{
|
||||
public:
|
||||
virtual ~CEmptyTag() = default;
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any())
|
||||
{
|
||||
return true;
|
||||
};
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) {};
|
||||
CEmptyTag() = default;
|
||||
|
||||
bool Open (const std::vector<NSCSS::CNode>& arSelectors) override { return true; }
|
||||
void Close(const std::vector<NSCSS::CNode>& arSelectors) override {};
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class CTag : public ITag
|
||||
{
|
||||
protected:
|
||||
T* m_pWriter;
|
||||
public:
|
||||
CTag(T* pWriter)
|
||||
: m_pWriter(pWriter)
|
||||
{}
|
||||
virtual ~CTag() = default;
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) = 0;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) = 0;
|
||||
|
||||
bool ValidWriter() const
|
||||
{
|
||||
return nullptr != m_pWriter;
|
||||
}
|
||||
};
|
||||
|
||||
#define CREATE_TAG(tag_name)\
|
||||
template<class T>\
|
||||
class tag_name : public CTag<T>\
|
||||
{\
|
||||
public:\
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors) = 0;\
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) = 0;\
|
||||
}
|
||||
|
||||
CREATE_TAG(CAnchor);
|
||||
CREATE_TAG(CAbbr);
|
||||
CREATE_TAG(CBold);
|
||||
CREATE_TAG(CBidirectional);
|
||||
CREATE_TAG(CBreak);
|
||||
CREATE_TAG(CCenter);
|
||||
CREATE_TAG(CItalic);
|
||||
CREATE_TAG(CKbd);
|
||||
CREATE_TAG(CStrike);
|
||||
CREATE_TAG(CUnderline);
|
||||
CREATE_TAG(CMark);
|
||||
CREATE_TAG(CQuotation);
|
||||
CREATE_TAG(CSup);
|
||||
CREATE_TAG(CSpan);
|
||||
CREATE_TAG(CDD);
|
||||
CREATE_TAG(CPreformatted);
|
||||
CREATE_TAG(CHeader);
|
||||
CREATE_TAG(CDivision);
|
||||
CREATE_TAG(CImage);
|
||||
CREATE_TAG(CFont);
|
||||
CREATE_TAG(CInput);
|
||||
CREATE_TAG(CBaseFont);
|
||||
CREATE_TAG(CBlockquote);
|
||||
CREATE_TAG(CHorizontalRule);
|
||||
CREATE_TAG(CList);
|
||||
CREATE_TAG(CListElement);
|
||||
CREATE_TAG(CCaption);
|
||||
CREATE_TAG(CTable);
|
||||
CREATE_TAG(CTableRow);
|
||||
CREATE_TAG(CTableCell);
|
||||
CREATE_TAG(CCode);
|
||||
CREATE_TAG(CHTML);
|
||||
|
||||
}
|
||||
#endif // HTMLTAGS_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -38,162 +38,59 @@
|
||||
|
||||
#include "HTMLTags.h"
|
||||
#include "../Writers/MDWriter.h"
|
||||
#include "../Table.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace HTML
|
||||
{
|
||||
template<>
|
||||
class CAnchor<CMDWriter> : public CTag<CMDWriter>
|
||||
#define CREATE_MD_TAG(class_name) CREATE_TAG(class_name##MD, CMDWriter)
|
||||
|
||||
CREATE_MD_TAG(Anchor);
|
||||
CREATE_MD_TAG(Break);
|
||||
CREATE_MD_TAG(Preformatted);
|
||||
CREATE_MD_TAG(Header);
|
||||
CREATE_MD_TAG(Image);
|
||||
CREATE_MD_TAG(HorizontalRule);
|
||||
CREATE_MD_TAG(Blockquote);
|
||||
CREATE_MD_TAG(List);
|
||||
CREATE_MD_TAG(ListElement);
|
||||
CREATE_MD_TAG(Code);
|
||||
|
||||
void InitTagsForMD(std::map<int, std::shared_ptr<ITag>>& mTags, CMDWriter* pWriter);
|
||||
|
||||
struct TElementInfo
|
||||
{
|
||||
public:
|
||||
CAnchor(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
size_t m_unRows;
|
||||
size_t m_unColumns;
|
||||
|
||||
TElementInfo()
|
||||
: m_unRows{0}, m_unColumns{0}
|
||||
{}
|
||||
|
||||
TElementInfo(const size_t& unRows, const size_t& m_unColumns)
|
||||
: m_unRows{unRows}, m_unColumns{m_unColumns}
|
||||
{}
|
||||
};
|
||||
|
||||
template<>
|
||||
class CBold<CMDWriter> : public CTag<CMDWriter>
|
||||
class CMarkdownTable : public CTableElement
|
||||
{
|
||||
public:
|
||||
CBold(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
CMarkdownTable(TExternalTableData &oExternalData);
|
||||
virtual ~CMarkdownTable();
|
||||
|
||||
template<>
|
||||
class CBreak<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CBreak(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
bool PreParse(XmlUtils::CXmlLiteReader& oReader) override;
|
||||
void Normalize() override;
|
||||
bool Convert(XmlUtils::CXmlLiteReader& oReader, const NSCSS::CNode& oTableNode) override;
|
||||
private:
|
||||
bool ParseCaption(XmlUtils::CXmlLiteReader& oReader, XmlString*& pCaption) override;
|
||||
bool ParseColgroup(XmlUtils::CXmlLiteReader& oReader, std::vector<CTableColgroup*>& arColgroups) override;
|
||||
|
||||
template<>
|
||||
class CItalic<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CItalic(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
bool ConvertMatrix(XmlUtils::CXmlLiteReader& oReader, std::vector<NSCSS::CNode>& arSelectors, const Table& oMatrix, CMDWriter* pWriter, bool bIsHeader = false);
|
||||
|
||||
template<>
|
||||
class CStrike<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CStrike(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CQuotation<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CQuotation(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CPreformatted<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CPreformatted(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CHeader<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CHeader(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CImage<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CImage(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CHorizontalRule<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CHorizontalRule(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CBlockquote<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CBlockquote(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CTable<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CTable(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CTableRow<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
UINT m_unLastRowType;
|
||||
public:
|
||||
CTableRow(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CTableCell<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
UINT m_unNeedEmptyCells;
|
||||
public:
|
||||
CTableCell(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CList<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CList(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CListElement<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CListElement(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CCode<CMDWriter> : public CTag<CMDWriter>
|
||||
{
|
||||
public:
|
||||
CCode(CMDWriter* pWriter);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
static Table Flatten(Table&& srcTable);
|
||||
static TElementInfo ComputeInfo(const ITableElementCell* pCell);
|
||||
static TElementInfo ComputeInfo(const CTableElement* pTable);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -38,164 +38,132 @@
|
||||
|
||||
#include "HTMLTags.h"
|
||||
#include "../Writers/OOXMLWriter.h"
|
||||
#include "../Table.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace HTML
|
||||
{
|
||||
template<>
|
||||
class CAnchor<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CAnchor(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
#define CREATE_OOXML_TAG(class_name) CREATE_TAG(class_name##OOXML, COOXMLWriter)
|
||||
|
||||
template<>
|
||||
class CAbbr<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CAbbr(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
CREATE_OOXML_TAG(Anchor);
|
||||
CREATE_OOXML_TAG(Abbr);
|
||||
CREATE_OOXML_TAG(Break);
|
||||
CREATE_OOXML_TAG(Font);
|
||||
CREATE_OOXML_TAG(Input);
|
||||
CREATE_OOXML_TAG(BaseFont);
|
||||
CREATE_OOXML_TAG(List);
|
||||
CREATE_OOXML_TAG(ListElement);
|
||||
CREATE_OOXML_TAG(HTML);
|
||||
|
||||
template<>
|
||||
class CBreak<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CBreak(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CDivision<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
class CDivisionOOXMLTag : public IHTMLTag<COOXMLWriter>
|
||||
{
|
||||
std::stack<UINT> m_arFootnoteIDs;
|
||||
public:
|
||||
CDivision(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
CDivisionOOXMLTag(COOXMLWriter *pWriter);
|
||||
|
||||
bool Open (const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CImage<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
class CImageOOXMLTag : public IHTMLTag<COOXMLWriter>
|
||||
{
|
||||
std::vector<std::wstring> m_arrImages;
|
||||
std::vector<std::wstring> m_arImages;
|
||||
public:
|
||||
CImage(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
CImageOOXMLTag(COOXMLWriter *pWriter);
|
||||
|
||||
bool Open (const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CFont<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
class CBlockquoteOOXMLTag : public IHTMLTag<COOXMLWriter>
|
||||
{
|
||||
std::map<std::wstring, UINT> m_mDivs;
|
||||
public:
|
||||
CFont(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
CBlockquoteOOXMLTag(COOXMLWriter *pWriter);
|
||||
|
||||
bool Open (const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CInput<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CInput(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CBaseFont<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CBaseFont(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CBlockquote<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
std::map<std::wstring, UINT> m_mDivs;
|
||||
public:
|
||||
CBlockquote(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CHorizontalRule<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
class CHorizontalRuleOOXMLTag : public IHTMLTag<COOXMLWriter>
|
||||
{
|
||||
UINT m_unShapeId;
|
||||
public:
|
||||
CHorizontalRule(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
CHorizontalRuleOOXMLTag(COOXMLWriter *pWriter);
|
||||
|
||||
bool Open (const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
|
||||
template<>
|
||||
class CList<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
void InitTagsForOOXML(std::map<int, std::shared_ptr<ITag>>& mTags, COOXMLWriter* pWriter);
|
||||
|
||||
enum class ETableRules
|
||||
{
|
||||
public:
|
||||
CList(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
All,
|
||||
Groups,
|
||||
Cols,
|
||||
None,
|
||||
Rows
|
||||
};
|
||||
|
||||
template<>
|
||||
class CListElement<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
class COOXMLTable : public CTableElement
|
||||
{
|
||||
public:
|
||||
CListElement(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
COOXMLTable(TExternalTableData &oExternalData);
|
||||
virtual ~COOXMLTable();
|
||||
|
||||
template<>
|
||||
class CCaption<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CCaption(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
bool PreParse(XmlUtils::CXmlLiteReader& oReader) override;
|
||||
void Normalize() override;
|
||||
bool Convert(XmlUtils::CXmlLiteReader& oReader, const NSCSS::CNode& oTableNode) override;
|
||||
private:
|
||||
bool ParseCaption(XmlUtils::CXmlLiteReader& oReader, XmlString*& pCaption) override;
|
||||
bool ParseColgroup(XmlUtils::CXmlLiteReader& oReader, std::vector<CTableColgroup*>& arColgroups) override;
|
||||
|
||||
template<>
|
||||
class CTable<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CTable(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
bool HaveColgroups() const;
|
||||
size_t GetColumnsCount() const;
|
||||
|
||||
template<>
|
||||
class CTableRow<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CTableRow(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
struct TTableStyles
|
||||
{
|
||||
size_t m_unCellSpacing;
|
||||
ETableRules m_enRules;
|
||||
|
||||
template<>
|
||||
class CTableCell<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CTableCell(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
};
|
||||
const COOXMLTable *m_pTable;
|
||||
|
||||
template<>
|
||||
class CHTML<COOXMLWriter> : public CTag<COOXMLWriter>
|
||||
{
|
||||
public:
|
||||
CHTML(COOXMLWriter* pInterpretator);
|
||||
virtual bool Open(const std::vector<NSCSS::CNode>& arSelectors, const boost::any& oExtraData = boost::any()) override;
|
||||
virtual void Close(const std::vector<NSCSS::CNode>& arSelectors) override;
|
||||
NSCSS::NSProperties::CBorder m_oBorder;
|
||||
NSCSS::NSProperties::CIndent m_oPadding;
|
||||
|
||||
TTableStyles()
|
||||
: m_unCellSpacing{0}, m_enRules{ETableRules::All}, m_pTable{nullptr}
|
||||
{}
|
||||
};
|
||||
|
||||
enum class ERowParseMode
|
||||
{
|
||||
Header,
|
||||
Body,
|
||||
Foother
|
||||
};
|
||||
|
||||
enum class ERowPosition
|
||||
{
|
||||
First,
|
||||
Middle,
|
||||
Last
|
||||
};
|
||||
|
||||
void OpenTable(XmlString& oXmlString, const NSCSS::CNode& oTableNode, TTableStyles& oTableStyles, const COOXMLTable& oTable);
|
||||
void CloseTable(XmlString& oXmlString);
|
||||
|
||||
void OpenRow(XmlString& oXmlString, bool bIsHeader, size_t unMaxHeight, size_t unCellSpacing);
|
||||
void CloseRow(XmlString& oXmlString);
|
||||
|
||||
void OpenCell(XmlString& oXmlString);
|
||||
void OpenCell(XmlString& oXmlString, const NSCSS::CNode& oCellNode, ITableElementCell* pCell, size_t unColumnIndex, ERowParseMode eRowParseMode, ERowPosition eRowPosition, size_t& unHeight, const TTableStyles& oTableStyles, std::unordered_map<size_t, NSCSS::CNode>& mFillingColumn);
|
||||
void CloseCell(XmlString& oXmlString);
|
||||
|
||||
void ConvertTable(XmlUtils::CXmlLiteReader& oReader, COOXMLWriter& oWriter, const COOXMLTable& oTable, const NSCSS::CNode& oTableNode);
|
||||
void ConvertMatrix(XmlUtils::CXmlLiteReader& oReader, COOXMLWriter& oWriter, std::vector<NSCSS::CNode>& arSelectors, std::stack<int>& arDepths, const Table& oMatrix, TTableStyles& oTableStyles, ERowParseMode eRowParseMode);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
#ifndef IWRITER_H
|
||||
#define IWRITER_H
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
#include "../../Common/3dParty/html/css/src/CNode.h"
|
||||
#include "../Common.h"
|
||||
|
||||
@ -43,9 +45,25 @@ namespace HTML
|
||||
{
|
||||
class IWriter
|
||||
{
|
||||
protected:
|
||||
const std::wstring *m_pTempDir; // Temp folder
|
||||
const std::wstring *m_pSrcPath; // Source directory
|
||||
const std::wstring *m_pBasePath; // Full base path
|
||||
const std::wstring *m_pCorePath; // Path to the root file (used for working with Epub)
|
||||
|
||||
NSFonts::IApplicationFonts* m_pFonts; // Necessary for optimizing font handling
|
||||
public:
|
||||
IWriter() = default;
|
||||
virtual ~IWriter() = default;
|
||||
IWriter()
|
||||
: m_pTempDir(nullptr), m_pSrcPath(nullptr),
|
||||
m_pBasePath(nullptr), m_pCorePath(nullptr),
|
||||
m_pFonts(nullptr)
|
||||
{};
|
||||
|
||||
virtual ~IWriter()
|
||||
{
|
||||
if (nullptr != m_pFonts)
|
||||
delete m_pFonts;
|
||||
};
|
||||
|
||||
virtual void Begin(const std::wstring& wsDst) = 0;
|
||||
virtual void End(const std::wstring& wsDst) = 0;
|
||||
@ -64,8 +82,52 @@ public:
|
||||
|
||||
virtual XmlString* GetCurrentDocument() const = 0;
|
||||
|
||||
//TODO:: move nested tables handling to conversion after changing how tables work
|
||||
virtual bool SupportNestedTables() const = 0;
|
||||
void SetSrcDirectory (const std::wstring& wsPath)
|
||||
{
|
||||
m_pSrcPath = &wsPath;
|
||||
}
|
||||
void SetTempDirectory(const std::wstring& wsPath)
|
||||
{
|
||||
m_pTempDir = &wsPath;
|
||||
}
|
||||
void SetBaseDirectory(const std::wstring& wsPath)
|
||||
{
|
||||
m_pBasePath = &wsPath;
|
||||
}
|
||||
void SetCoreDirectory(const std::wstring& wsPath)
|
||||
{
|
||||
m_pCorePath = &wsPath;
|
||||
}
|
||||
|
||||
std::wstring GetTempDir() const
|
||||
{
|
||||
return (nullptr != m_pTempDir) ? *m_pTempDir : std::wstring();
|
||||
}
|
||||
std::wstring GetSrcPath() const
|
||||
{
|
||||
return (nullptr != m_pSrcPath) ? *m_pSrcPath : std::wstring();
|
||||
}
|
||||
std::wstring GetBasePath() const
|
||||
{
|
||||
return (nullptr != m_pBasePath) ? *m_pBasePath : std::wstring();
|
||||
}
|
||||
std::wstring GetCorePath() const
|
||||
{
|
||||
return (nullptr != m_pCorePath) ? *m_pCorePath : std::wstring();
|
||||
}
|
||||
|
||||
NSFonts::IApplicationFonts* GetFonts()
|
||||
{
|
||||
if (nullptr == m_pFonts)
|
||||
{
|
||||
m_pFonts = NSFonts::NSApplication::Create();
|
||||
|
||||
if (NULL != m_pFonts)
|
||||
m_pFonts->Initialize();
|
||||
}
|
||||
|
||||
return m_pFonts;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -50,9 +50,7 @@ CMDWriter::CMDWriter(const TMarkdownParameters& oMDParametrs)
|
||||
}
|
||||
|
||||
void CMDWriter::Begin(const std::wstring& wsDst)
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
void CMDWriter::End(const std::wstring& wsDst)
|
||||
{
|
||||
@ -83,6 +81,77 @@ inline void ReplaceSpaces(std::wstring& wsValue)
|
||||
}
|
||||
}
|
||||
|
||||
void ReplaceSpecialCharsInEdges(std::wstring& wsText)
|
||||
{
|
||||
// Hexadecimal codes of the characters being replaced
|
||||
const wchar_t SP {0x20}; // space
|
||||
const wchar_t NBSP{0xA0}; // non-breaking space
|
||||
const wchar_t ENSP{0x2002}; // en space
|
||||
const wchar_t EMSP{0x2003}; // em space
|
||||
|
||||
// Corresponding HTML sequences
|
||||
const std::wstring NBSP_REP{L" "};
|
||||
const std::wstring ENSP_REP{L" "};
|
||||
const std::wstring EMSP_REP{L" "};
|
||||
|
||||
auto is_special = [&](wchar_t c) -> bool {
|
||||
return c == SP || c == NBSP || c == ENSP || c == EMSP;
|
||||
};
|
||||
|
||||
size_t unFirstNormal{0};
|
||||
while (unFirstNormal < wsText.size() && is_special(wsText[unFirstNormal]))
|
||||
++unFirstNormal;
|
||||
|
||||
if (unFirstNormal == wsText.size())
|
||||
{
|
||||
std::wstring wsResult;
|
||||
wsResult.reserve(wsText.size() * 6); // each character will be replaced by 6
|
||||
for (wchar_t c : wsText)
|
||||
{
|
||||
if (c == SP || c == NBSP) wsResult.append(NBSP_REP);
|
||||
else if (c == ENSP) wsResult.append(ENSP_REP);
|
||||
else if (c == EMSP) wsResult.append(EMSP_REP);
|
||||
else wsResult.push_back(c);
|
||||
}
|
||||
wsText = std::move(wsResult);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t unLastNormal{wsText.size() - 1};
|
||||
while (unLastNormal > unFirstNormal && is_special(wsText[unLastNormal]))
|
||||
--unLastNormal;
|
||||
|
||||
const size_t unLeftCount {unFirstNormal};
|
||||
const size_t unRightCount{wsText.size() - 1 - unLastNormal};
|
||||
|
||||
const size_t unNormalLen{unLastNormal - unFirstNormal + 1};
|
||||
const size_t unNewLen {unNormalLen + unLeftCount * 6 + unRightCount * 6};
|
||||
|
||||
std::wstring wsResult;
|
||||
wsResult.reserve(unNewLen);
|
||||
|
||||
for (size_t i = 0; i < unLeftCount; ++i)
|
||||
{
|
||||
wchar_t c = wsText[i];
|
||||
if (c == SP || c == NBSP) wsResult.append(NBSP_REP);
|
||||
else if (c == ENSP) wsResult.append(ENSP_REP);
|
||||
else if (c == EMSP) wsResult.append(EMSP_REP);
|
||||
}
|
||||
|
||||
for (size_t i = unFirstNormal; i <= unLastNormal; ++i)
|
||||
wsResult.push_back(wsText[i]);
|
||||
|
||||
for (size_t i = unLastNormal + 1; i < wsText.size(); ++i)
|
||||
{
|
||||
wchar_t c = wsText[i];
|
||||
if (c == SP || c == NBSP) wsResult.append(NBSP_REP);
|
||||
else if (c == ENSP) wsResult.append(ENSP_REP);
|
||||
else if (c == EMSP) wsResult.append(EMSP_REP);
|
||||
}
|
||||
|
||||
wsText = std::move(wsResult);
|
||||
}
|
||||
|
||||
bool CMDWriter::WriteText(std::wstring wsText, const std::vector<NSCSS::CNode>& arSelectors)
|
||||
{
|
||||
bool bPreformatted{InPreformatted()};
|
||||
@ -125,44 +194,51 @@ bool CMDWriter::WriteText(std::wstring wsText, const std::vector<NSCSS::CNode>&
|
||||
WriteString(L"> ", true);
|
||||
}
|
||||
|
||||
const bool bOnlySpaces{wsText.end() == std::find_if_not(wsText.begin(), wsText.end(), [](wchar_t wchChar){ return iswspace(wchChar);})};
|
||||
|
||||
if (!bPreformatted && !InCode())
|
||||
ReplaceSpaces(wsText);
|
||||
|
||||
bool bNeedBold{false}, bNeedItalic{false}, bNeedStrike{false};
|
||||
|
||||
if (nullptr != pCompiledStyle)
|
||||
{
|
||||
if (!IsBold() && pCompiledStyle->m_oFont.Bold())
|
||||
ReplaceSpaces(wsText);
|
||||
ReplaceSpecialCharsInEdges(wsText);
|
||||
}
|
||||
|
||||
bool bNeedBold {false},
|
||||
bNeedItalic{false},
|
||||
bNeedStrike{false};
|
||||
|
||||
if (nullptr != pCompiledStyle && !bOnlySpaces)
|
||||
{
|
||||
if (pCompiledStyle->m_oFont.Bold())
|
||||
bNeedBold = true;
|
||||
|
||||
if (!IsItalic() && pCompiledStyle->m_oFont.Italic())
|
||||
if (pCompiledStyle->m_oFont.Italic())
|
||||
bNeedItalic = true;
|
||||
|
||||
if (!IsStrike() && pCompiledStyle->m_oText.LineThrough())
|
||||
if (pCompiledStyle->m_oText.LineThrough())
|
||||
bNeedStrike = true;
|
||||
}
|
||||
|
||||
if (bNeedBold)
|
||||
WriteString(L"**");
|
||||
WriteOpenSpecialString(L"**");
|
||||
|
||||
if (bNeedItalic)
|
||||
WriteString(L"*");
|
||||
WriteOpenSpecialString(L"*");
|
||||
|
||||
if (bNeedStrike)
|
||||
WriteString(L"~~");
|
||||
WriteOpenSpecialString(L"~~");
|
||||
|
||||
ApplyAlternativeTags(pCompiledStyle);
|
||||
WriteString(wsText);
|
||||
ApplyAlternativeTags(pCompiledStyle, true);
|
||||
|
||||
if (bNeedBold)
|
||||
WriteString(L"**");
|
||||
WriteCloseSpecialString(L"**");
|
||||
|
||||
if (bNeedItalic)
|
||||
WriteString(L"*");
|
||||
WriteCloseSpecialString(L"*");
|
||||
|
||||
if (bNeedStrike)
|
||||
WriteString(L"~~");
|
||||
WriteCloseSpecialString(L"~~");
|
||||
|
||||
if (L'\n' == wsText.back())
|
||||
m_arStates.top().m_bNeedBreakLine = false;
|
||||
@ -212,22 +288,32 @@ void CMDWriter::WriteString(const std::wstring& wsString, bool bSpecialString)
|
||||
m_arStates.top().m_bEmptyLine = wsString.empty();
|
||||
|
||||
if (!bSpecialString)
|
||||
{
|
||||
if (!m_arStates.top().m_oSpecialString.m_wsLastSpecialString.empty() &&
|
||||
m_arStates.top().m_oSpecialString.m_bClosed)
|
||||
m_arStates.top().m_oSpecialString.m_wsLastSpecialString.clear();
|
||||
|
||||
m_arStates.top().m_bNeedBreakLine = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CMDWriter::WriteOpenSpecialString(const std::wstring& wsString)
|
||||
{
|
||||
if (m_arStates.top().m_wsLastSpecialString == wsString)
|
||||
if (!m_arStates.top().m_oSpecialString.m_wsLastSpecialString.empty() &&
|
||||
(m_arStates.top().m_oSpecialString.m_wsLastSpecialString == wsString ||
|
||||
(L'*' == m_arStates.top().m_oSpecialString.m_wsLastSpecialString.front() && L'*' == wsString.front())))
|
||||
GetCurrentDocument()->WriteString(L" ");
|
||||
|
||||
m_arStates.top().m_wsLastSpecialString.clear();
|
||||
m_arStates.top().m_oSpecialString.m_wsLastSpecialString.clear();
|
||||
m_arStates.top().m_oSpecialString.m_bClosed = false;
|
||||
|
||||
WriteString(wsString, true);
|
||||
}
|
||||
|
||||
void CMDWriter::WriteCloseSpecialString(const std::wstring& wsString)
|
||||
{
|
||||
m_arStates.top().m_wsLastSpecialString = wsString;
|
||||
m_arStates.top().m_oSpecialString.m_wsLastSpecialString = wsString;
|
||||
m_arStates.top().m_oSpecialString.m_bClosed = true;
|
||||
|
||||
WriteString(wsString, true);
|
||||
}
|
||||
@ -237,11 +323,6 @@ XmlString* CMDWriter::GetCurrentDocument() const
|
||||
return m_arStates.top().m_pCurrentDocument;
|
||||
}
|
||||
|
||||
bool CMDWriter::SupportNestedTables() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CMDWriter::WriteBreakLine(bool bNeedChecked)
|
||||
{
|
||||
if (bNeedChecked && !m_arStates.top().m_bNeedBreakLine)
|
||||
@ -266,52 +347,6 @@ void CMDWriter::WriteBreakLine(bool bNeedChecked)
|
||||
|
||||
m_arStates.top().m_bEmptyLine = true;
|
||||
m_arStates.top().m_bNeedBreakLine = false;
|
||||
m_arStates.top().m_wsLastSpecialString.clear();
|
||||
}
|
||||
|
||||
void CMDWriter::EnteredBold()
|
||||
{
|
||||
m_arStates.top().m_bBold = true;
|
||||
}
|
||||
|
||||
void CMDWriter::OutBold()
|
||||
{
|
||||
m_arStates.top().m_bBold = false;
|
||||
}
|
||||
|
||||
bool CMDWriter::IsBold()
|
||||
{
|
||||
return m_arStates.top().m_bBold;
|
||||
}
|
||||
|
||||
void CMDWriter::EnteredItalic()
|
||||
{
|
||||
m_arStates.top().m_bItalic = true;
|
||||
}
|
||||
|
||||
void CMDWriter::OutItalic()
|
||||
{
|
||||
m_arStates.top().m_bItalic = false;
|
||||
}
|
||||
|
||||
bool CMDWriter::IsItalic()
|
||||
{
|
||||
return m_arStates.top().m_bItalic;
|
||||
}
|
||||
|
||||
void CMDWriter::EnteredStrike()
|
||||
{
|
||||
m_arStates.top().m_bStrike = true;
|
||||
}
|
||||
|
||||
void CMDWriter::OutStrike()
|
||||
{
|
||||
m_arStates.top().m_bStrike = false;
|
||||
}
|
||||
|
||||
bool CMDWriter::IsStrike()
|
||||
{
|
||||
return m_arStates.top().m_bStrike;
|
||||
}
|
||||
|
||||
void CMDWriter::EnteredBlockquote()
|
||||
|
||||
@ -56,10 +56,6 @@ class CMDWriter : public IWriter
|
||||
|
||||
UINT m_unLevelBlockquote{0};
|
||||
|
||||
bool m_bBold{false};
|
||||
bool m_bItalic{false};
|
||||
bool m_bStrike{false};
|
||||
|
||||
bool m_bInTable{false};
|
||||
bool m_bInPreformatted{false};
|
||||
bool m_bInCode{false};
|
||||
@ -69,7 +65,11 @@ class CMDWriter : public IWriter
|
||||
UINT m_unLevelList{0};
|
||||
UINT m_unIndexListElement{1};
|
||||
|
||||
std::wstring m_wsLastSpecialString;
|
||||
struct TSpecialString
|
||||
{
|
||||
std::wstring m_wsLastSpecialString;
|
||||
bool m_bClosed{false};
|
||||
}m_oSpecialString;
|
||||
};
|
||||
|
||||
std::stack<TState> m_arStates;
|
||||
@ -100,22 +100,8 @@ public:
|
||||
|
||||
XmlString* GetCurrentDocument() const override;
|
||||
|
||||
bool SupportNestedTables() const override;
|
||||
|
||||
void WriteBreakLine(bool bNeedChecked = true);
|
||||
|
||||
void EnteredBold();
|
||||
void OutBold();
|
||||
bool IsBold();
|
||||
|
||||
void EnteredItalic();
|
||||
void OutItalic();
|
||||
bool IsItalic();
|
||||
|
||||
void EnteredStrike();
|
||||
void OutStrike();
|
||||
bool IsStrike();
|
||||
|
||||
void EnteredBlockquote();
|
||||
void OutBlockquote();
|
||||
UINT GetLevelBlockquote();
|
||||
|
||||
@ -41,8 +41,6 @@
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../DesktopEditor/common/SystemUtils.h"
|
||||
|
||||
#include "../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
|
||||
#include "../src/Languages.h"
|
||||
|
||||
namespace HTML
|
||||
@ -54,11 +52,8 @@ namespace HTML
|
||||
|
||||
#define MAX_STRING_BLOCK_SIZE (size_t)10485760
|
||||
|
||||
#define MAXCOLUMNSINTABLE 63
|
||||
#define MAXROWSINTABLE 32767
|
||||
|
||||
#define DEFAULT_PAGE_WIDTH 12240 // Value in Twips
|
||||
#define DEFAULT_PAGE_HEIGHT 15840 // Value in Twips
|
||||
#define DEFAULT_PAGE_WIDTH 12240 // Value in twips
|
||||
#define DEFAULT_PAGE_HEIGHT 15840 // Value in twips
|
||||
|
||||
#define DEFAULT_LANGUAGE std::wstring(L"en-US")
|
||||
#define DEFAULT_FONT_FAMILY std::wstring(L"Times New Roman")
|
||||
@ -76,10 +71,9 @@ inline UINT GetFontSizeByLevel(UINT unLevel);
|
||||
inline void ReplaceSpaces(std::wstring& wsValue);
|
||||
|
||||
COOXMLWriter::COOXMLWriter(THTMLParameters* pHTMLParameters, NSCSS::CCssCalculator* pCSSCalculator)
|
||||
: m_pDstPath(nullptr), m_pTempDir(nullptr), m_pSrcPath(nullptr),
|
||||
m_pBasePath(nullptr), m_pCorePath(nullptr), m_pStylesCalculator(pCSSCalculator),
|
||||
: m_pDstPath(nullptr), m_pStylesCalculator(pCSSCalculator),
|
||||
m_pHTMLParameters(pHTMLParameters), m_nFootnoteId(1), m_nHyperlinkId(1), m_nListId(1),
|
||||
m_nElementId(1), m_bBanUpdatePageData(false), m_bWasDivs(false), m_pFonts(nullptr)
|
||||
m_nElementId(1), m_bBanUpdatePageData(false), m_bWasDivs(false)
|
||||
{
|
||||
m_oPageData.SetWidth (DEFAULT_PAGE_WIDTH, NSCSS::UnitMeasure::Twips, 0, true);
|
||||
m_oPageData.SetHeight(DEFAULT_PAGE_HEIGHT, NSCSS::UnitMeasure::Twips, 0, true);
|
||||
@ -91,31 +85,11 @@ COOXMLWriter::COOXMLWriter(THTMLParameters* pHTMLParameters, NSCSS::CCssCalculat
|
||||
m_arStates.top().m_pCurrentDocument = &m_oDocXml;
|
||||
}
|
||||
|
||||
void COOXMLWriter::SetSrcDirectory(const std::wstring& wsPath)
|
||||
{
|
||||
m_pSrcPath = &wsPath;
|
||||
}
|
||||
|
||||
void COOXMLWriter::SetDstDirectory(const std::wstring& wsPath)
|
||||
{
|
||||
m_pDstPath = &wsPath;
|
||||
}
|
||||
|
||||
void COOXMLWriter::SetTempDirectory(const std::wstring& wsPath)
|
||||
{
|
||||
m_pTempDir = &wsPath;
|
||||
}
|
||||
|
||||
void COOXMLWriter::SetBaseDirectory(const std::wstring& wsPath)
|
||||
{
|
||||
m_pBasePath = &wsPath;
|
||||
}
|
||||
|
||||
void COOXMLWriter::SetCoreDirectory(const std::wstring& wsPath)
|
||||
{
|
||||
m_pCorePath = &wsPath;
|
||||
}
|
||||
|
||||
void COOXMLWriter::Begin(const std::wstring& wsDst)
|
||||
{
|
||||
// Create empty folders
|
||||
@ -592,12 +566,12 @@ void COOXMLWriter::SetCurrentDocument(XmlString* pNewDocument)
|
||||
m_arStates.top().m_bRemoveCurrentDocument = false;
|
||||
}
|
||||
|
||||
void COOXMLWriter::Break(const std::vector<NSCSS::CNode>& arSelectors)
|
||||
void COOXMLWriter::Break(const NSCSS::CNode& oTagNode)
|
||||
{
|
||||
if (m_arStates.top().m_bInP)
|
||||
{
|
||||
OpenR();
|
||||
if(arSelectors.back().m_pCompiledStyle->m_oText.GetAlign() == L"both")
|
||||
if(oTagNode.m_pCompiledStyle->m_oText.GetAlign() == L"both")
|
||||
m_arStates.top().m_pCurrentDocument->WriteString(L"<w:tab/>");
|
||||
m_arStates.top().m_pCurrentDocument->WriteString(L"<w:br/>");
|
||||
CloseR();
|
||||
@ -852,7 +826,7 @@ bool COOXMLWriter::WriteText(std::wstring wsText, const std::vector<NSCSS::CNode
|
||||
return false;
|
||||
|
||||
bool bBidirectional{false}, bPreformatted{false}, bQuotation{false},
|
||||
bAddSpaces{true}, bMergedText{false}, bDeleted{false};
|
||||
bAddSpaces{true}, bDeleted{false};
|
||||
|
||||
for (const NSCSS::CNode& oNode : arSelectors)
|
||||
{
|
||||
@ -982,9 +956,6 @@ bool COOXMLWriter::WriteText(std::wstring wsText, const std::vector<NSCSS::CNode
|
||||
else
|
||||
GetCurrentDocument()->WriteString(L"<w:delText>");
|
||||
|
||||
if (bMergedText && !m_arStates.top().m_bWasSpace && bInT && !bPreformatted)
|
||||
m_arStates.top().m_pCurrentDocument->WriteEncodeXmlString(L" ");
|
||||
|
||||
if (!wsText.empty())
|
||||
{
|
||||
m_arStates.top().m_bWasSpace = std::iswspace(wsText.back());
|
||||
@ -1000,8 +971,7 @@ bool COOXMLWriter::WriteText(std::wstring wsText, const std::vector<NSCSS::CNode
|
||||
else
|
||||
GetCurrentDocument()->WriteString(L"</w:delText>");
|
||||
|
||||
if (!bMergedText)
|
||||
CloseR();
|
||||
CloseR();
|
||||
|
||||
if (bDeleted)
|
||||
GetCurrentDocument()->WriteString(L"</w:del>");
|
||||
@ -1296,54 +1266,16 @@ XmlString* COOXMLWriter::GetCurrentDocument() const
|
||||
return m_arStates.top().m_pCurrentDocument;
|
||||
}
|
||||
|
||||
bool COOXMLWriter::SupportNestedTables() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const NSCSS::NSProperties::CPage* COOXMLWriter::GetPageData() const
|
||||
{
|
||||
return &m_oPageData;
|
||||
}
|
||||
|
||||
NSFonts::IApplicationFonts* COOXMLWriter::GetFonts()
|
||||
{
|
||||
if (nullptr == m_pFonts)
|
||||
{
|
||||
m_pFonts = NSFonts::NSApplication::Create();
|
||||
|
||||
if (NULL != m_pFonts)
|
||||
m_pFonts->Initialize();
|
||||
}
|
||||
|
||||
return m_pFonts;
|
||||
}
|
||||
|
||||
std::wstring COOXMLWriter::GetMediaDir() const
|
||||
{
|
||||
return ((nullptr != m_pDstPath) ? *m_pDstPath : std::wstring()) + L"/word/media/";
|
||||
}
|
||||
|
||||
std::wstring COOXMLWriter::GetTempDir() const
|
||||
{
|
||||
return (nullptr != m_pTempDir) ? *m_pTempDir : std::wstring();
|
||||
}
|
||||
|
||||
std::wstring COOXMLWriter::GetSrcPath() const
|
||||
{
|
||||
return (nullptr != m_pSrcPath) ? *m_pSrcPath : std::wstring();
|
||||
}
|
||||
|
||||
std::wstring COOXMLWriter::GetBasePath() const
|
||||
{
|
||||
return (nullptr != m_pBasePath) ? *m_pBasePath : std::wstring();
|
||||
}
|
||||
|
||||
std::wstring COOXMLWriter::GetCorePath() const
|
||||
{
|
||||
return (nullptr != m_pCorePath) ? *m_pCorePath : std::wstring();
|
||||
}
|
||||
|
||||
inline bool ElementInTable(const std::vector<NSCSS::CNode>& arSelectors)
|
||||
{
|
||||
return arSelectors.crend() != std::find_if(arSelectors.crbegin(), arSelectors.crend(), [](const NSCSS::CNode& oNode) { return L"table" == oNode.m_wsName; });
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user