Compare commits

..

48 Commits

Author SHA1 Message Date
9c17190c0c [docs] Document x2t params.xml parsing classes with Doxygen 2025-08-28 17:02:21 +03:00
40809ea3c2 fix build 2025-08-28 15:34:21 +03:00
13158b2956 Merge pull request 'fix bug #76439' (#422) from fix/bug76439 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/422
2025-08-28 11:22:22 +00:00
9e8beb5651 Merge pull request 'fix/bug56564' (#425) from fix/bug56564 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/425
2025-08-28 11:20:43 +00:00
711e80e62c Merge pull request 'Fix bug 76484, 76443' (#426) from fix/bug-76484 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/426
2025-08-28 10:28:36 +00:00
3404aab782 Fix bug 76484 2025-08-28 12:10:22 +03:00
9c3ba26fab fix/bug56564 2025-08-28 11:38:17 +03:00
02f4c10cd6 Merge branch 'fix/bug56564' of git.onlyoffice.com:ONLYOFFICE/core into fix/bug56564 2025-08-28 11:30:09 +03:00
0d912533bf fix/bug56564 2025-08-28 11:30:06 +03:00
066793921b revert 518a38e178
revert fix/bug56564

fix bug with uncorrected table of contents
2025-08-28 08:29:11 +00:00
9b2b7263c2 revert 518a38e178
revert fix/bug56564

fix bug with uncorrected table of contents
2025-08-28 08:25:05 +00:00
31c28903d6 Merge pull request 'Fix bug 56419' (#423) from fix/rtfFormat into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/423
2025-08-27 22:46:36 +00:00
518a38e178 fix/bug56564
fix bug with uncorrected table of contents
2025-08-27 22:39:10 +03:00
631c2d4490 Fix bug 56419 2025-08-27 22:04:15 +03:00
0d0003ad5a fix bug #76439 2025-08-27 19:12:03 +06:00
eb3bedd840 Fix build with xcode 14- 2025-08-27 13:55:11 +03:00
0e9db67173 Merge pull request 'Fix bug 76416' (#421) from fix/bug-76416 into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/421
2025-08-27 09:18:46 +00:00
1a65242d46 Fix build 2025-08-27 12:04:48 +03:00
30da4b631f Fix build 2025-08-26 16:07:41 +03:00
a988e6741c Merge branch 'release/v9.1.0' of https://git.onlyoffice.com/ONLYOFFICE/core into release/v9.1.0 2025-08-26 09:56:18 +03:00
29c2239df2 Fix build 2025-08-26 09:56:07 +03:00
0d7ddfb580 Merge pull request 'Fix bug 56063' (#420) from fix/rtfFormat into release/v9.1.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/420
2025-08-26 06:03:47 +00:00
8bbb21263d Fix build 2025-08-25 22:53:43 +03:00
a652bd6591 Fix bug 56063 2025-08-25 16:19:02 +03:00
78532c27cf Fix bug 76416 2025-08-25 16:01:47 +03:00
63d3999072 Fix build with c++17 2025-08-22 23:50:22 +03:00
d055522aa0 Merge branch 'feature/libheif' into release/v9.1.0 2025-08-22 22:33:26 +03:00
c5e63a8d26 fix bug #76396 2025-08-22 16:23:28 +03:00
e56da8e641 Add ios and android libheif support 2025-08-22 13:15:44 +04:00
72f0b0403e Fix for Linux 2025-08-13 16:19:47 +04:00
06c47b07ec Remove usage of C++17 features in heif code 2025-08-13 11:38:12 +04:00
e2bcf62cc4 Fix for windows 2025-08-13 11:36:10 +04:00
9cef29c201 Fix for unix 2025-08-11 18:52:51 +04:00
c86387c015 Merge branch 'feature/mac-frameworks' into feature/libheif 2025-08-11 16:26:32 +04:00
e8f7720387 Move libs and includes to heif.pri 2025-08-11 16:26:17 +04:00
c3dd5c8fc9 Add heif directory to 3dParty 2025-08-09 00:15:39 +04:00
81f057ba78 Merge branch 'hotfix/v9.0.4' into feature/libheif 2025-08-04 17:47:50 +04:00
fcd7818675 Add test for heif 2025-08-04 12:51:33 +03:00
6d707ebae2 Fix decode 2025-07-28 13:28:20 +03:00
41dc23ce53 Add Release/Debug libs 2025-07-24 12:10:26 +03:00
a817cd54d5 Fix static build 2025-07-17 20:11:46 +03:00
f5ddf8c6ce Fix build 2025-07-10 18:27:15 +03:00
29355d337b Fix encode 2025-07-07 18:01:25 +03:00
8c6a26895b Add read from memory 2025-07-02 13:22:30 +03:00
0154543b01 Remove temp file 2025-06-30 16:25:28 +03:00
3e2dee5719 Fix heif encode 2025-06-30 16:13:03 +03:00
c25f8cc204 Fix heif image convert 2025-06-30 13:51:05 +03:00
d3aae6dfcb Add heif decode and encode 2025-06-29 10:08:51 +03:00
37 changed files with 689 additions and 81 deletions

View File

@ -39,6 +39,8 @@ core_windows {
core_win_arm64:VS_ARCH=a64
vs2019:VS_VERSION=142
DEFINES += BOOST_USE_WINDOWS_H BOOST_WINAPI_NO_REDECLARATIONS
BOOST_POSTFIX = -vc$${VS_VERSION}-mt-$${VS_DEBUG}$${VS_ARCH}-1_72
core_boost_libs:LIBS += -L$$CORE_BOOST_LIBS -llibboost_system$$BOOST_POSTFIX -llibboost_filesystem$$BOOST_POSTFIX

4
Common/3dParty/heif/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
x265_git
libde265
libheif
ios-cmake

View File

@ -0,0 +1,42 @@
DEFINES += LIBHEIF_STATIC_BUILD
HEIF_BUILDS_PLATFORM_PREFIX = $$CORE_BUILDS_PLATFORM_PREFIX
core_ios : xcframework_platform_ios_simulator {
HEIF_BUILDS_PLATFORM_PREFIX = ios_simulator
}
HEIF_BUILD_PATH = $$PWD/libheif/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX
INCLUDEPATH += \
$$PWD/libheif/libheif/api \
$$HEIF_BUILD_PATH # for heif_version.h
core_windows {
core_debug {
BUILD_TYPE = Debug
} else {
BUILD_TYPE = Release
}
LIBS += \
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/$$BUILD_TYPE -lx265-static \
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265/$$BUILD_TYPE -llibde265 \
-L$$HEIF_BUILD_PATH/libheif/$$BUILD_TYPE -lheif
}
core_linux | core_android {
# we need to wrap x265 and de265 libraries in `whole-archive` flags to avoid "undefined symbol" errors when later linking with graphics.so
LIBS += \
-Wl,--whole-archive \
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX -lx265 \
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265 -lde265 \
-Wl,--no-whole-archive \
-L$$HEIF_BUILD_PATH/libheif -lheif
}
core_mac | core_ios {
LIBS += \
-L$$PWD/x265_git/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX -lx265 \
-L$$PWD/libde265/build/$$HEIF_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX/libde265 -lde265 \
-L$$HEIF_BUILD_PATH/libheif -lheif
}

View File

@ -15,6 +15,10 @@
#include "../../../UnicodeConverter/UnicodeConverter.h"
#include "../../../HtmlFile2/src/StringFinder.h"
#if defined(CreateDirectory)
#undef CreateDirectory
#endif
static std::string nonbreaking_inline = "|a|abbr|acronym|b|bdo|big|cite|code|dfn|em|font|i|img|kbd|nobr|s|small|span|strike|strong|sub|sup|tt|";
static std::string empty_tags = "|area|base|basefont|bgsound|br|command|col|embed|event-source|frame|hr|image|img|input|keygen|link|menuitem|meta|param|source|spacer|track|wbr|";
static std::string preserve_whitespace = "|pre|textarea|script|style|";

View File

@ -34,6 +34,8 @@
#include "../../../../DesktopEditor/common/StringExt.h"
#include <wininet.h>
#include <objbase.h>
#include <urlmon.h>
#pragma comment(lib, "Wininet")
#pragma comment(lib, "Ole32.lib")

View File

@ -198,6 +198,8 @@ core_windows {
DEFINES += WIN32 _WIN32
DEFINES += NOMINMAX
#DEFINES += WIN32_LEAN_AND_MEAN
# use default _ITERATOR_DEBUG_LEVEL value
#core_debug:DEFINES += "_ITERATOR_DEBUG_LEVEL=0"
}
@ -238,7 +240,11 @@ core_mac {
QMAKE_LFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH
# xcode15 add new linker
QMAKE_LFLAGS += -Wl,-ld_classic
greaterThan(QMAKE_XCODE_VERSION, 1499) {
QMAKE_LFLAGS += -Wl,-ld_classic
} else {
CONFIG += c++14
}
QMAKE_CFLAGS += "-Wno-implicit-function-declaration"
@ -255,8 +261,8 @@ core_linux_clang {
# PREFIXES
core_windows {
CONFIG -= debug_and_release debug_and_release_target
QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
QMAKE_CXXFLAGS -= -Zc:strictStrings
QMAKE_CXXFLAGS_RELEASE += /Zc:strictStrings-
QMAKE_CXXFLAGS += /Zc:strictStrings-
QMAKE_CXXFLAGS += /MP
MSVC_VERSION_DETECT = $$(VisualStudioVersion)

View File

@ -46,8 +46,10 @@
#define CXIMAGE_SUPPORT_PSD 1
#ifndef BUILDING_WASM_MODULE
#define CXIMAGE_SUPPORT_HEIF 1
#define CXIMAGE_SUPPORT_RAW 1
#else
#define CXIMAGE_SUPPORT_HEIF 0
#define CXIMAGE_SUPPORT_RAW 0
#endif

View File

@ -133,13 +133,17 @@ CXIMAGE_FORMAT_PSD = 20,
#if CXIMAGE_SUPPORT_PIC
CXIMAGE_FORMAR_PIC = 25,
#endif
#if CXIMAGE_SUPPORT_HEIF
CXIMAGE_FORMAT_HEIF = 26,
#endif
CMAX_IMAGE_FORMATS = CXIMAGE_SUPPORT_BMP + CXIMAGE_SUPPORT_GIF + CXIMAGE_SUPPORT_JPG +
CXIMAGE_SUPPORT_PNG + CXIMAGE_SUPPORT_MNG + CXIMAGE_SUPPORT_ICO +
CXIMAGE_SUPPORT_TIF + CXIMAGE_SUPPORT_TGA + CXIMAGE_SUPPORT_PCX +
CXIMAGE_SUPPORT_WBMP+ CXIMAGE_SUPPORT_WMF + CXIMAGE_SUPPORT_PIC +
CXIMAGE_SUPPORT_JBG + CXIMAGE_SUPPORT_JP2 + CXIMAGE_SUPPORT_JPC +
CXIMAGE_SUPPORT_PGX + CXIMAGE_SUPPORT_PNM + CXIMAGE_SUPPORT_RAS +
CXIMAGE_SUPPORT_SKA + CXIMAGE_SUPPORT_RAW + CXIMAGE_SUPPORT_PSD + 1
CXIMAGE_SUPPORT_SKA + CXIMAGE_SUPPORT_RAW + CXIMAGE_SUPPORT_PSD +
CXIMAGE_SUPPORT_HEIF + 1
};
#if CXIMAGE_SUPPORT_EXIF

View File

@ -23,14 +23,14 @@
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#pragma warning (disable : 4550)
#pragma warning (disable : 4550)
/*
* TIFF Library
*
* Read and return a packed RGBA image.
*/
*/
#include "tiffiop.h"
#include <stdio.h>
@ -828,11 +828,12 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
nrowsub = nrow;
if ((nrowsub%subsamplingver)!=0)
nrowsub+=subsamplingver-nrowsub%subsamplingver;
if (TIFFReadEncodedStrip(tif,
TIFFComputeStrip(tif,row+img->row_offset, 0),
buf,
((row + img->row_offset)%rowsperstrip + nrowsub) * scanline) < 0
&& img->stoponerr)
((row + img->row_offset)%rowsperstrip + nrowsub) * scanline) < 0
&& img->stoponerr)
{
ret = 0;
break;

View File

@ -163,7 +163,7 @@
},
{
"folder": "../../../../Common/3dParty/icu/icu/source/common/",
"files": ["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"]
"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/",

View File

@ -14,13 +14,15 @@ DEFINES += \
MNG_STORE_CHUNKS\
MNG_ERROR_TELLTALE
include($$CORE_ROOT_DIR/Common/3dParty/heif/heif.pri)
core_linux {
DEFINES += HAVE_UNISTD_H HAVE_FCNTL_H
QMAKE_CXXFLAGS += -Wno-narrowing
}
core_linux_clang {
QMAKE_CFLAGS += -Wno-incompatible-function-pointer-types
QMAKE_CFLAGS += -Wno-incompatible-function-pointer-types
}
core_mac {
@ -285,6 +287,9 @@ SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/PICFile.cpp \
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/pic.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/raster/heif/heif.cpp
SOURCES += \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_cm.c \
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_debug.c \

View File

@ -0,0 +1,9 @@
#include "../../pro/Graphics.h"
int main(int argc, char *argv[])
{
Aggplus::CImage img(L"C:\\Users\\KProkhorov\\Work\\core\\DesktopEditor\\graphics\\tests\\testHeic\\image1.heic");
img.SaveFile(L"C:\\Users\\KProkhorov\\Work\\core\\DesktopEditor\\graphics\\tests\\testHeic\\image1.bmp", 1);
return 0;
}

View File

@ -0,0 +1,24 @@
QT -= core
QT -= gui
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
CORE_ROOT_DIR = $$PWD/../../../..
PWD_ROOT_DIR = $$PWD
include($$CORE_ROOT_DIR/Common/base.pri)
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
ADD_DEPENDENCY(kernel, graphics, UnicodeConverter)
GRAPHICS_AGG_PATH = $$PWD/../../../agg-2.4
INCLUDEPATH += \
$$GRAPHICS_AGG_PATH/include
SOURCES += main.cpp
DESTDIR = $$PWD_ROOT_DIR/build/$$CORE_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX

View File

@ -44,6 +44,10 @@
#include "PICT/PICFile.h"
#endif
#if CXIMAGE_SUPPORT_HEIF
#include "heif/heif.h"
#endif
#include <cmath>
#define BGRA_FRAME_CXIMAGE_MAX_MEMORY 67108864 // 256Mb (*4 channel)
@ -444,11 +448,18 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
#endif
#if CXIMAGE_SUPPORT_PIC
if (CXIMAGE_FORMAR_PIC == m_nFileType)
{
PICT::CPictFile PIC;
return PIC.Open(this, strFileName, !m_bIsRGBA);
}
if (CXIMAGE_FORMAR_PIC == m_nFileType)
{
PICT::CPictFile PIC;
return PIC.Open(this, strFileName, !m_bIsRGBA);
}
#endif
#if CXIMAGE_SUPPORT_HEIF
if (CXIMAGE_FORMAT_HEIF == m_nFileType)
{
return NSHeif::CHeifFile::Open(this, strFileName);
}
#endif
NSFile::CFileBinary oFile;
@ -534,6 +545,13 @@ bool CBgraFrame::Decode(BYTE* pBuffer, int nSize, unsigned int nFileType)
}
#endif
#if CXIMAGE_SUPPORT_HEIF
if (CXIMAGE_FORMAT_HEIF == m_nFileType)
{
return NSHeif::CHeifFile::Open(this, pBuffer, nSize);
}
#endif
CxImage img;
if (!img.Decode(pBuffer, nSize, m_nFileType))
@ -562,28 +580,32 @@ bool CBgraFrame::SaveFile(const std::wstring& strFileName, unsigned int nFileTyp
return res;
}
else
#endif
#if CXIMAGE_SUPPORT_HEIF
if (CXIMAGE_FORMAT_HEIF == nFileType)
{
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(strFileName))
return false;
CxImage img;
if (!img.CreateFromArray(m_pData, m_lWidth, m_lHeight, lBitsPerPixel * 8, lStride, (m_lStride >= 0) ? true : false, !m_bIsRGBA))
return false;
if (m_pPalette)
{
img.SetPalette((RGBQUAD*)m_pPalette, m_lPaletteColors);
}
if (!img.Encode(oFile.GetFileNative(), nFileType))
return false;
oFile.CloseFile();
return NSHeif::CHeifFile::Save(m_pData, m_lWidth, m_lHeight, m_lStride, strFileName);
}
#endif
NSFile::CFileBinary oFile;
if (!oFile.CreateFileW(strFileName))
return false;
CxImage img;
if (!img.CreateFromArray(m_pData, m_lWidth, m_lHeight, lBitsPerPixel * 8, lStride, (m_lStride >= 0) ? true : false, !m_bIsRGBA))
return false;
if (m_pPalette)
{
img.SetPalette((RGBQUAD*)m_pPalette, m_lPaletteColors);
}
if (!img.Encode(oFile.GetFileNative(), nFileType))
return false;
oFile.CloseFile();
return true;
}
bool CBgraFrame::Encode(BYTE*& pBuffer, int& nSize, unsigned int nFileType)

View File

@ -32,6 +32,9 @@
#include "ImageFileFormatChecker.h"
#include "../common/File.h"
#include "../cximage/CxImage/ximacfg.h"
#if CXIMAGE_SUPPORT_HEIF
#include "heif/heif.h"
#endif
#ifndef IMAGE_CHECKER_DISABLE_XML
#include "../xml/include/xmlutils.h"
@ -432,6 +435,15 @@ bool CImageFileFormatChecker::isPicFile(BYTE *pBuffer, DWORD dwBytes)
return false;
}
bool CImageFileFormatChecker::isHeifFile(BYTE* pBuffer, DWORD dwBytes)
{
#if CXIMAGE_SUPPORT_HEIF
return NSHeif::CHeifFile::isHeif(pBuffer, dwBytes);
#else
return false;
#endif
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CImageFileFormatChecker::isImageFile(const std::wstring& fileName)
{
@ -554,6 +566,10 @@ bool CImageFileFormatChecker::isImageFile(const std::wstring& fileName)
{
eFileType = _CXIMAGE_FORMAT_PIC;
}
else if (isHeifFile(fileName))
{
eFileType = _CXIMAGE_FORMAT_HEIF;
}
///////////////////////////////////////////////////////////////////////
delete [] buffer;
@ -669,6 +685,10 @@ bool CImageFileFormatChecker::isImageFile(BYTE* buffer, DWORD sizeRead)
{
eFileType = _CXIMAGE_FORMAT_PIC;
}
if (isHeifFile(buffer, sizeRead))
{
eFileType = _CXIMAGE_FORMAT_HEIF;
}
///////////////////////////////////////////////////////////////////////
if (eFileType) return true;
return false;
@ -786,6 +806,14 @@ bool CImageFileFormatChecker::isSvgFile(const std::wstring& fileName)
return bFind;
#endif
}
bool CImageFileFormatChecker::isHeifFile(const std::wstring& fileName)
{
#if CXIMAGE_SUPPORT_HEIF
return NSHeif::CHeifFile::isHeif(fileName);
#else
return false;
#endif
}
std::wstring CImageFileFormatChecker::DetectFormatByData(BYTE *Data, int DataSize)
{

View File

@ -63,6 +63,7 @@ enum __ENUM_CXIMAGE_FORMATS
_CXIMAGE_FORMAT_SVM = 23,
_CXIMAGE_FORMAT_SVG = 24,
_CXIMAGE_FORMAT_PIC = 25,
_CXIMAGE_FORMAT_HEIF = 26,
};
class GRAPHICS_DECL CImageFileFormatChecker
@ -82,6 +83,7 @@ public:
bool isRawFile(const std::wstring& fileName);
bool isSvgFile(const std::wstring& fileName);
bool isHeifFile(const std::wstring& fileName);
bool isImageFile(BYTE* pBuffer,DWORD dwBytes);
bool isBmpFile(BYTE* pBuffer,DWORD dwBytes);
@ -111,6 +113,7 @@ public:
bool isSvgFile(BYTE* pBuffer,DWORD dwBytes);
bool isRawFile(BYTE* pBuffer,DWORD dwBytes);
bool isPicFile(BYTE* pBuffer,DWORD dwBytes);
bool isHeifFile(BYTE* pBuffer, DWORD dwBytes);
std::wstring DetectFormatByData(BYTE *Data, int DataSize);

View File

@ -0,0 +1,154 @@
#include "heif.h"
#include "../../common/File.h"
#include <functional>
#define CONCAT_IMPL(x, y) x##y
#define CONCAT(x, y) CONCAT_IMPL(x, y)
#define defer(code) Defer CONCAT(_defer_, __COUNTER__)([&](){code;})
class Defer {
std::function<void()> func;
public:
explicit Defer(std::function<void()> func) : func(func) {}
~Defer() { func(); }
};
namespace NSHeif {
NSUnicodeConverter::CUnicodeConverter CHeifFile::m_oConverter{};
bool CHeifFile::isHeif(const std::wstring& fileName)
{
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
return !IsError(heif_context_read_from_file(ctx, m_oConverter.fromUnicode(fileName, "UTF-8").c_str(), nullptr));
}
bool CHeifFile::isHeif(BYTE* buffer, DWORD size)
{
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
return !IsError(heif_context_read_from_memory_without_copy(ctx, buffer, size, nullptr));
}
bool CHeifFile::Open(CBgraFrame *frame, const std::wstring& fileName)
{
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
if (IsError(heif_context_read_from_file(ctx, m_oConverter.fromUnicode(fileName, "UTF-8").c_str(), nullptr)))
return false;
return Decode(ctx, frame);
}
bool CHeifFile::Open(CBgraFrame *frame, BYTE* buffer, DWORD size)
{
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
if (IsError(heif_context_read_from_memory_without_copy(ctx, buffer, size, nullptr)))
return false;
return Decode(ctx, frame);
}
bool CHeifFile::Save(const BYTE* source, int width, int height, int sourceStride, const std::wstring& dstPath)
{
if (!source)
return false;
heif_image* img;
defer(heif_image_release(img););
if (IsError(heif_image_create(width, height, heif_colorspace_RGB, heif_chroma_interleaved_RGB, &img)))
return false;
if (IsError(heif_image_add_plane(img, heif_channel_interleaved, width, height, 24)))
return false;
int stride;
BYTE* data = heif_image_get_plane(img, heif_channel_interleaved, &stride);
if (!data || stride == 0)
return false;
for (size_t i = 0; i < height; ++i)
{
const BYTE* row = source + (height - i - 1) * (sourceStride < 0 ? -sourceStride : sourceStride);
for (size_t j = 0; j < width; ++j)
{
data[(i * width + j) * 3 + 0] = row[(width - j - 1) * 4 + 2];
data[(i * width + j) * 3 + 1] = row[(width - j - 1) * 4 + 1];
data[(i * width + j) * 3 + 2] = row[(width - j - 1) * 4 + 0];
}
}
heif_context* ctx = heif_context_alloc();
defer(heif_context_free(ctx););
heif_encoder* encoder;
defer(heif_encoder_release(encoder););
if (IsError(heif_context_get_encoder_for_format(ctx, heif_compression_HEVC, &encoder)))
return false;
if (IsError(heif_context_encode_image(ctx, img, encoder, nullptr, nullptr)))
return false;
if (IsError(heif_context_write_to_file(ctx, m_oConverter.fromUnicode(dstPath, "UTF-8").c_str())))
return false;
return true;
}
inline bool CHeifFile::IsError(heif_error err)
{
return err.code != heif_error_Ok;
}
inline bool CHeifFile::Decode(heif_context* ctx, CBgraFrame* frame)
{
heif_image_handle* handle;
defer(heif_image_handle_release(handle););
if (IsError(heif_context_get_primary_image_handle(ctx, &handle)))
return false;
heif_image* img;
defer(heif_image_release(img););
if (IsError(heif_decode_image(handle, &img, heif_colorspace_RGB, heif_chroma_444, nullptr)))
return false;
int width = heif_image_get_primary_width(img);
int height = heif_image_get_primary_height(img);
int stride_R, stride_G, stride_B;
const BYTE* source_R = heif_image_get_plane_readonly(img, heif_channel_R, &stride_R);
const BYTE* source_G = heif_image_get_plane_readonly(img, heif_channel_G, &stride_G);
const BYTE* source_B = heif_image_get_plane_readonly(img, heif_channel_B, &stride_B);
if (stride_R == 0 || !source_R)
return false;
BYTE* data = new BYTE[4 * width * height];
frame->put_Width(width);
frame->put_Height(height);
frame->put_Stride(4 * width);
frame->put_Data(data);
for (size_t i = 0; i < height; ++i)
{
const BYTE* row_R = source_R + i * stride_R;
const BYTE* row_G = source_G + i * stride_G;
const BYTE* row_B = source_B + i * stride_B;
for (size_t j = 0; j < width; ++j)
{
data[(i * width + j) * 4 + 0] = row_B[j];
data[(i * width + j) * 4 + 1] = row_G[j];
data[(i * width + j) * 4 + 2] = row_R[j];
data[(i * width + j) * 4 + 3] = 255;
}
}
return true;
}
}

View File

@ -0,0 +1,22 @@
#include "../BgraFrame.h"
#include "../../Common/3dParty/heif/libheif/libheif/api/libheif/heif.h"
#include "../../UnicodeConverter/UnicodeConverter.h"
namespace NSHeif {
class GRAPHICS_DECL CHeifFile {
private:
CHeifFile() = delete;
public:
static bool isHeif(const std::wstring& fileName);
static bool isHeif(BYTE* buffer, DWORD size);
static bool Open(CBgraFrame* frame, const std::wstring& fileName);
static bool Open(CBgraFrame* frame, BYTE* buffer, DWORD size);
static bool Save(const BYTE* source, int width, int height, int sourceStride, const std::wstring& dstPath);
private:
static bool IsError(heif_error err);
static bool Decode(heif_context* ctx, CBgraFrame* frame);
static NSUnicodeConverter::CUnicodeConverter m_oConverter;
};
}

View File

@ -1,4 +1,4 @@
/*
/*
* (c) Copyright Ascensio System SIA 2010-2023
*
* This program is a free software product. You can redistribute it and/or
@ -33,13 +33,17 @@
namespace NSDocxRenderer
{
/**
* @enum TextAssociationType
* @brief Specifies how extracted text is associated with layout elements.
*/
enum class TextAssociationType
{
tatBlockChar = 0, // Каждый символ во фрейме
tatBlockLine = 1, // Каждая линия - параграф во фрейме. Линии могут объединяться в рамках одного блока.
tatPlainLine = 2, // Каждая линия - параграф обычный
tatShapeLine = 3, // Каждая линия - параграф в шейпе. Линии могут объединяться в рамках одного блока.
tatPlainParagraph = 4, // Все линии объединяются в параграфы
tatParagraphToShape = 5 // Параграфы записываем в шейпы
tatBlockChar = 0, ///< Each character is placed in a frame.
tatBlockLine = 1, ///< Each line becomes a paragraph in a frame; lines may merge within one block.
tatPlainLine = 2, ///< Each line becomes a regular paragraph.
tatShapeLine = 3, ///< Each line becomes a paragraph in a shape; lines may merge within one block.
tatPlainParagraph = 4, ///< All lines are grouped into paragraphs.
tatParagraphToShape = 5 ///< Paragraphs are written into shapes.
};
}

View File

@ -38,7 +38,9 @@
#include "../../Common/Utils/simple_xml_writer.h"
#if defined(_WIN32) || defined(_WIN64)
#pragma comment(lib, "Ole32.lib")
#include <Ole2.h>
#include <ObjIdl.h>
#pragma comment(lib, "Ole32.lib")
#endif
namespace oox {

View File

@ -32,6 +32,11 @@
#pragma once
#include <boost/shared_ptr.hpp>
#if defined(GetTempPath)
#undef GetTempPath
#endif
#include <list>
#include <sstream>

View File

@ -76,10 +76,10 @@ public:
Xnum numFtr;
_UINT32 iCopies = 1;
std::wstring szRelID; // biff12
bool fLandscape; // biff12
std::wstring szRelID = L""; // biff12
bool fLandscape = false; // biff12
bool _isChart;
bool _isChart = false;
};
} // namespace XLS

View File

@ -2222,7 +2222,6 @@ namespace SimpleTypes
}
}
template<>
CDoubleOrAutomatic<typeAuto>::CDoubleOrAutomatic() : m_dValue(0){}

View File

@ -979,8 +979,8 @@ namespace SimpleTypes
double m_dValue;
CDoubleOrAutomatic() : m_dValue(0){}
CDoubleOrAutomatic(const double & val) { m_dValue = val; this->m_eValue = typeDouble; }
CDoubleOrAutomatic(const EDoubleOrAutomatic & val) { this->m_eValue = val; m_dValue = 0; }
CDoubleOrAutomatic(const double& val);
CDoubleOrAutomatic(const EDoubleOrAutomatic& val);
virtual EDoubleOrAutomatic FromString(const std::wstring &sValue);
double GetDoubleValue() const;

View File

@ -69,7 +69,7 @@ text_position text_position::parse(const std::wstring & Str)
std::vector< std::wstring > splitted;
boost::algorithm::split(splitted, tmp, boost::algorithm::is_any_of(L" \t"), boost::algorithm::token_compress_on);
text_position::type type_= text_position::Sub;
text_position::type type_position_ = text_position::Sub;
percent position_;
bool has_font_width_ = false;
percent font_width_;
@ -77,13 +77,18 @@ text_position text_position::parse(const std::wstring & Str)
if (splitted.size() > 0)
{
if (splitted[0] == L"sub")
type_ = text_position::Sub;
type_position_ = text_position::Sub;
else if (splitted[0] == L"super")
type_ = text_position::Super;
type_position_ = text_position::Super;
else if (boost::algorithm::contains(splitted[0], L"%"))
{
position_ = percent::parse(splitted[0]);
type_ = text_position::Percent;
type_position_ = text_position::Percent;
}
else
{
position_ = 0;
type_position_ = text_position::Percent;
}
}
@ -93,12 +98,12 @@ text_position text_position::parse(const std::wstring & Str)
has_font_width_ = true;
}
if (type_ != text_position::Percent)
if (type_position_ != text_position::Percent)
{
if (!has_font_width_)
return text_position(type_);
return text_position(type_position_);
else
return text_position(type_, font_width_.get_value());
return text_position(type_position_, font_width_.get_value());
}
else
{

View File

@ -113,7 +113,18 @@ void tabs_context::add(const odf_reader::office_element_ptr & element, double ma
{
tab_stop->margin_left = margin_left;
double pos = margin_left + tab_stop->style_position_.get_value_unit(odf_types::length::pt);
auto type = tab_stop->style_type_ ? tab_stop->style_type_->get_type() : odf_types::style_type::Left;
double pos;
if( type == odf_types::style_type::Right )
{
pos = tab_stop->style_position_.get_value_unit(odf_types::length::pt);
}
else
{
pos = margin_left + tab_stop->style_position_.get_value_unit(odf_types::length::pt);
}
std::map<int, odf_reader::office_element_ptr>::iterator pFind = clear_tabs.find((int)pos);

View File

@ -64,7 +64,9 @@ void oox_title::oox_content_serialize(std::wostream & _Wostream, odf_reader::cha
//odf_reader::fonts_container & fonts = context.fontContainer();
odf_reader::fonts_container fonts;
if (content.text_properties_)
{
content.text_properties_->oox_serialize(CP_XML_STREAM(), true, fonts);
}
CP_XML_NODE(L"a:t")
{

View File

@ -209,15 +209,15 @@ void calc_tab_stops(const style_instance * styleInstance, oox::tabs_context & co
if (parProps[i]->content_.fo_margin_left_)
margin_left = 20.0 * parProps[i]->content_.fo_margin_left_->get_length().get_value_unit(odf_types::length::pt);
if (parProps[i]->content_.style_tab_stops_)
{
style_tab_stops *tab_stops = dynamic_cast<style_tab_stops*>(parProps[i]->content_.style_tab_stops_.get());
context.reset();
for (size_t j = 0; j < tab_stops->content_.size(); j++)
{
context.add(tab_stops->content_[j], margin_left);
}
}
if ( parProps[i]->content_.style_tab_stops_ )
{
style_tab_stops *tab_stops = dynamic_cast<style_tab_stops*>(parProps[i]->content_.style_tab_stops_.get());
context.reset();
for (size_t j = 0; j < tab_stops->content_.size(); j++)
{
context.add(tab_stops->content_[j], margin_left);
}
}
}
}

View File

@ -353,9 +353,14 @@ void text_format_properties::drawing_serialize(std::wostream & strm, std::wstrin
if ((style_text_position_) && (style_text_position_->has_font_size()))
{
mul = style_text_position_->font_size().get_value() / 100.;
mul *= 1.725; //ms 100% - 1.725
if (style_text_position_->get_type() != text_position::Percent ||
style_text_position_->get_position().get_value() > 0.1 || style_text_position_->get_position().get_value() < -0.1)
{
mul *= 1.725;
}
}
if (fontSizeVal > 0)
if (fontSizeVal > 0)
{
CP_XML_ATTR(L"sz", (int)(fontSizeVal/2. * mul * 100 + 0.5)); //in pt *100
}
@ -382,6 +387,16 @@ void text_format_properties::drawing_serialize(std::wostream & strm, std::wstrin
underline = L"sng";
}
}
if ((fo_letter_spacing_) && (fo_letter_spacing_->get_type() != letter_spacing::Normal))
{
CP_XML_ATTR(L"spc", (int)(100. * fo_letter_spacing_->get_length().get_value_unit(length::pt)));
}
else if (style_text_scale_)
{
mul = style_text_scale_->get_value();
CP_XML_ATTR(L"spc", (int)(mul * 2));
}
const int W = process_font_weight(fo_font_weight_);
if (W > 0) CP_XML_ATTR(L"b", true);
@ -457,11 +472,6 @@ void text_format_properties::drawing_serialize(std::wostream & strm, std::wstrin
}
else CP_XML_ATTR(L"strike",L"noStrike");
if ((fo_letter_spacing_) && (fo_letter_spacing_->get_type() != letter_spacing::Normal))
{
CP_XML_ATTR(L"spc",(int)(100. * fo_letter_spacing_->get_length().get_value_unit(length::pt)));
}
if (style_text_position_)
{
if (style_text_position_->get_type() == text_position::Percent)

View File

@ -1405,10 +1405,8 @@ namespace PdfWriter
std::string sValue = U_TO_UTF8(wsT);
CDictObject* pOwner = GetObjOwnValue("T");
if (!pOwner)
{
pOwner = this;
pOwner->Add("T", new CStringObject(sValue.c_str(), true));
}
pOwner->Add("T", new CStringObject(sValue.c_str(), true));
}
void CWidgetAnnotation::SetBC(const std::vector<double>& arrBC)
{

View File

@ -741,6 +741,7 @@ namespace PdfWriter
}
void CDocument::AddAnnotation(const int& nID, CAnnotation* pAnnot)
{
pAnnot->SetXref(m_pXref);
m_mAnnotations[nID] = pAnnot;
}
CImageDict* CDocument::CreateImage()

View File

@ -302,6 +302,7 @@ XRef::XRef(BaseStream *strA, GBool repair) {
size = 0;
last = -1;
entries = NULL;
lastXRefPos = 0;
lastStartxrefPos = 0;
xrefTablePos = NULL;
xrefTablePosLen = 0;
@ -838,7 +839,8 @@ GBool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) {
}
gen = (gen << 8) + c;
}
if (gen < 0 || gen > INT_MAX) {
// bug 76416: gen of a free object should be 65535, but here it is not
if (gen < 0 || gen > UINT_MAX) {
return gFalse;
}
if (entries[i].offset == (GFileOffset)-1) {

View File

@ -1141,6 +1141,8 @@ bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRea
#ifdef USE_STYLE_COLOR
if (charProps->m_nForeColor == PROP_DEF)
charProps->m_nForeColor = 0;
charProps->m_eUnderStyle = RtfCharProperty::uls_none;
charProps->m_bBold = 0;
#endif
}
@ -1169,8 +1171,18 @@ bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRea
else
charProps->m_bRightToLeft = 1;
}
COMMAND_RTF_BOOL( "rtlch", charProps->m_bRightToLeft, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "lang", charProps->m_nLanguage, sCommand, hasParameter, parameter)
else if ("rtlch" == sCommand)
{
if ( false == hasParameter || 0 != parameter )
{
charProps->m_bRightToLeft = 1;
charProps->m_nComplexScript = 1;
}
else
charProps->m_bRightToLeft = 0;
}
//COMMAND_RTF_BOOL( "rtlch", charProps->m_bRightToLeft, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "lang", charProps->m_nLanguage, sCommand, hasParameter, parameter)
COMMAND_RTF_INT ( "langfe", charProps->m_nLanguageAsian,sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( "outl", charProps->m_bOutline, sCommand, hasParameter, parameter)

View File

@ -1791,7 +1791,11 @@ std::wstring RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
default:
break;
}
}
}
else
{
sResult += L"<w:u w:val=\"none\"/>";
}
RENDER_OOX_INT( m_nUp, sResult, L"w:position" )

View File

@ -0,0 +1,44 @@
# Minimal Doxyfile for ONLYOFFICE Core - X2tConverter
# Generated to build HTML docs for C++ headers/sources in X2tConverter/src
# Project
PROJECT_NAME = "ONLYOFFICE Core - X2tConverter"
PROJECT_BRIEF = "Doxygen documentation for X2tConverter C++ sources"
OUTPUT_DIRECTORY = .
# Outputs
GENERATE_HTML = YES
HTML_OUTPUT = html
GENERATE_LATEX = NO
# Input
INPUT = ../src \
../../Common/OfficeFileFormats.h \
../../UnicodeConverter/UnicodeConverter_Encodings.h \
../../DocxRenderer/convert_params.h
FILE_PATTERNS = *.h \
*.hpp \
*.cpp
RECURSIVE = YES
# Parsing/formatting
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH = ../..
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
MARKDOWN_SUPPORT = YES
# UI
GENERATE_TREEVIEW = YES
SEARCHENGINE = YES
# Diagrams (disable Graphviz dependency by default)
HAVE_DOT = NO
# Warnings
QUIET = NO
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES

View File

@ -0,0 +1,35 @@
# X2tConverter Generate HTML API Documentation
This guide explains how to install Doxygen and generate the HTML documentation for the C++ sources in `X2tConverter/src/`.
## Prerequisites
- Doxygen
### Windows (PowerShell)
- Install Doxygen:
```powershell
winget install doxygen
```
### Linux (Debian/Ubuntu)
```bash
sudo apt-get update && sudo apt-get install -y doxygen
```
## Build the HTML docs
From current directory, run:
```
doxygen ./Doxyfile
```
Output will be generated here:
- `html/index.html`
Open that file in a browser to view the documentation.
## Configuration notes
- The Doxygen config lives at `Doxyfile`.

View File

@ -255,20 +255,60 @@ namespace NExtractTools
bool copyOrigin(const std::wstring& sFileFrom, const std::wstring& sFileTo);
/**
* @brief Mail merge related parameters.
* @details Parsed from the <m_oMailMergeSend> section in the input XML.
*/
class InputParamsMailMerge
{
public:
/**
* @brief File name.
*/
std::wstring* fileName;
/**
* @brief Sender's email address.
*/
std::wstring* from;
/**
* @brief [Deprecated].
*/
std::wstring* jsonKey;
/**
* @brief Attachment format docx, pdf, html (see \ref AVS_OFFICESTUDIO_FILE_DOCUMENT).
*/
int* mailFormat;
/**
* @brief Email body.
*/
std::wstring* message;
/**
* @brief Number of records.
*/
int* recordCount;
/**
* @brief Starting record index.
*/
int* recordFrom;
/**
* @brief Ending record index.
*/
int* recordTo;
/**
* @brief Email subject.
*/
std::wstring* subject;
/**
* @brief Recipient's email address.
*/
std::wstring* to;
/**
* @brief URL.
*/
std::wstring* url;
/**
* @brief User ID.
*/
std::wstring* userid;
InputParamsMailMerge()
{
@ -348,14 +388,25 @@ namespace NExtractTools
}
};
/**
* @brief Thumbnail generation parameters.
* @details Parsed from the <m_oThumbnail> element in the input XML.
* Members map to child nodes: format, aspect, first, zip, width, height.
*/
class InputParamsThumbnail
{
public:
/** @brief Output image format for thumbnails (bmp = 1, gif = 2, jpg = 3, png = 4). */
int* format;
/** @brief Fit mode: 0=stretch to width/height; 1=keep aspect; 2=use page metrics at 96 dpi (default). */
int* aspect;
/** @brief If true, generate a thumbnail for the first page only (default). If false, generate for all pages. */
bool* first;
/** @brief When generating thumbnails for all pages (first=false), output a ZIP archive with per-page images. */
bool* zip;
/** @brief Thumbnail width in pixels (default: 100). */
int* width;
/** @brief Thumbnail height in pixels (default: 100). */
int* height;
InputParamsThumbnail()
{
@ -410,9 +461,14 @@ namespace NExtractTools
}
};
/**
* @brief Text-conversion related parameters.
* @details Parsed from the <m_oTextParams> element in the input XML.
*/
class InputParamsText
{
public:
/** @brief [Optional] Text association type (see \ref NSDocxRenderer::TextAssociationType). XML: <m_nTextAssociationType>. */
int* m_nTextAssociationType;
InputParamsText()
{
@ -448,11 +504,18 @@ namespace NExtractTools
}
};
/**
* @brief Input constraints for particular input file types.
* @details Used for ZIP entries: compressed/uncompressed sizes and a name template.
*/
class InputLimit
{
public:
/** @brief [Optional] Defines the total compressed file size for text documents/spreadsheets/presentations. */
ULONG64 compressed;
/** @brief [Optional] Defines the total uncompressed file size for text documents/spreadsheets/presentations. */
ULONG64 uncompressed;
/** @brief [Optional] Defines the name template for files which sizes are counted.(Example: "*.xml") */
std::wstring pattern;
InputLimit()
{
@ -490,38 +553,115 @@ namespace NExtractTools
std::wstring m_sPdfOformMetaData;
};
/**
* @brief Container for all input parameters parsed from XML.
* @details Holds file paths, formats, CSV/TXT options, mail merge, thumbnail and
* text parameters, passwords, temporary paths, input limits, and flags
* controlling conversion behavior.
*/
class InputParams
{
public:
/// \name File paths and metadata
/// @{
/** @brief [Optional] Contains the document ID. For debugging purposes only. XML: <m_sKey>. */
std::wstring* m_sKey;
/** @brief [Required] Source file path. XML: <m_sFileFrom>. */
std::wstring* m_sFileFrom;
/** @brief [Required] Destination file path. XML: <m_sFileTo>. */
std::wstring* m_sFileTo;
/** @brief [Optional] Document title. Used for metadata in some output formats. XML: <m_sTitle>. */
std::wstring* m_sTitle;
/// @}
/// \name Formats
/// @{
/** @brief [Optional] Source format code. See \ref AVS_OFFICESTUDIO_FILE_DOCUMENT and related macros. Inferred from the file body or name when not specified. XML: <m_nFormatFrom>. */
int* m_nFormatFrom;
/** @brief [Required] Destination format code. See \ref AVS_OFFICESTUDIO_FILE_DOCUMENT and related macros. XML: <m_nFormatTo>. */
int* m_nFormatTo;
/// @}
/// \name CSV/TXT options
/// @{
/** @brief [Optional] Character encoding (code page) for CSV/TXT (see \ref NSUnicodeConverter::Encodings "Encodings table"). XML: <m_nCsvTxtEncoding>. */
int* m_nCsvTxtEncoding;
/** @brief [Optional] CSV delimiter type (see \ref TCsvDelimiter). XML: <m_nCsvDelimiter>. */
int* m_nCsvDelimiter;
/** @brief [Optional] Custom delimiter character(s); overrides m_nCsvDelimiter. XML: <m_nCsvDelimiterChar>. */
std::wstring* m_sCsvDelimiterChar;
/** @brief [Optional] Locale identifier (LCID) used in DOC and RTF to interpret strings when not specified in the file. XML: <m_nLcid>. */
int* m_nLcid;
/// @}
/// \name Processing flags
/// @{
/** @brief [Deprecated] Paid conversion flag. XML: <m_bPaid>. */
bool* m_bPaid;
/** @brief [Optional] Apply changes from the "changes" subfolder if present. XML: <m_bFromChanges>. */
bool* m_bFromChanges;
/** @brief [Optional] Suppress saving additional artifacts (such as the original file and changes.zip). XML: <m_bDontSaveAdditional>. */
bool* m_bDontSaveAdditional;
/// @}
/// \name Fonts and themes
/// @{
/** @brief [Deprecated] Path to AllFonts.js. XML: <m_sAllFontsPath>. */
std::wstring* m_sAllFontsPath;
/** @brief [Optional] Path to the directory containing font_selection.bin. XML: <m_sFontDir>. */
std::wstring* m_sFontDir;
/** @brief [Optional] Built-in themes directory path. XML: <m_sThemeDir>. */
std::wstring* m_sThemeDir;
/// @}
/// \name Nested parameter objects
/// @{
/** @brief [Optional] Mail merge configuration. XML: <m_oMailMergeSend>. See \ref InputParamsMailMerge. */
InputParamsMailMerge* m_oMailMergeSend;
/** @brief [Optional] Thumbnail configuration. XML: <m_oThumbnail>. See \ref InputParamsThumbnail. */
InputParamsThumbnail* m_oThumbnail;
/** @brief [Optional] Text configuration. XML: <m_oTextParams>. See \ref InputParamsText. */
InputParamsText* m_oTextParams;
/// @}
/// \name Additional input options
/// @{
/** @brief [Optional] JSON renderer options; supports keys like documentLayout, spreadsheetLayout, and watermark. See https://api.onlyoffice.com/docs/docs-api/additional-api/conversion-api/request/. XML: <m_sJsonParams>. */
std::wstring* m_sJsonParams;
/// @}
/// \name Security and identifiers
/// @{
/** @brief [Optional] Source file open password. XML: <m_sPassword>. */
std::wstring* m_sPassword;
/** @brief [Optional] Destination file save password. XML: <m_sSavePassword>. */
std::wstring* m_sSavePassword;
/** @brief [Optional] Document identifier. XML: <m_sDocumentID>. */
std::wstring* m_sDocumentID;
/// @}
/// \name Temp and encoding
/// @{
/** @brief [Optional] Explicit temp directory. XML: <m_sTempDir>. */
std::wstring* m_sTempDir;
/** @brief [Optional] Treat Editor.bin as not Base64-encoded when true (default when absent). XML: <m_bIsNoBase64>. */
bool* m_bIsNoBase64;
/// @}
/// \name Input constraints
/// @{
/** @brief [Optional] Defines the OOXML file types for which the limits are specified (text documents/spreadsheets/presentations). This does not include other objects, like images. XML: <m_oInputLimits>; values are \ref InputLimit. */
boost::unordered_map<int, std::vector<InputLimit>> m_mapInputLimits;
/// @}
/// \name Output preferences
/// @{
/** @brief [Optional] Request PDF/A output when applicable. XML: <m_bIsPDFA>. */
bool* m_bIsPDFA;
/** @brief [Optional] List of extensions to also produce in the original format (Open in browser). XML: <m_sConvertToOrigin>. */
std::wstring* m_sConvertToOrigin;
// output params
/// @}
mutable bool m_bOutputConvertCorrupted;
mutable bool m_bMacro;