diff --git a/Common/.gitignore b/Common/.gitignore new file mode 100644 index 0000000000..2a42734aeb --- /dev/null +++ b/Common/.gitignore @@ -0,0 +1 @@ +**/module.version diff --git a/Common/3dParty/boost/boost.pri b/Common/3dParty/boost/boost.pri index 7d6f30de2d..d2641185d6 100644 --- a/Common/3dParty/boost/boost.pri +++ b/Common/3dParty/boost/boost.pri @@ -26,12 +26,17 @@ bundle_xcframeworks { } } +core_win_arm64 { + DEFINES += MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0 +} + core_windows { VS_VERSION=140 VS_DEBUG= VS_ARCH=x64 core_debug:VS_DEBUG=gd- core_win_32:VS_ARCH=x32 + core_win_arm64:VS_ARCH=a64 vs2019:VS_VERSION=142 BOOST_POSTFIX = -vc$${VS_VERSION}-mt-$${VS_DEBUG}$${VS_ARCH}-1_72 diff --git a/Common/3dParty/heif/.gitignore b/Common/3dParty/heif/.gitignore new file mode 100644 index 0000000000..dd025901d7 --- /dev/null +++ b/Common/3dParty/heif/.gitignore @@ -0,0 +1,4 @@ +x265_git +libde265 +libheif +ios-cmake diff --git a/Common/3dParty/heif/heif.pri b/Common/3dParty/heif/heif.pri new file mode 100644 index 0000000000..65d55e9026 --- /dev/null +++ b/Common/3dParty/heif/heif.pri @@ -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 +} diff --git a/Common/3dParty/icu/icu.pri b/Common/3dParty/icu/icu.pri index c5ae929f8a..c872f8abd4 100644 --- a/Common/3dParty/icu/icu.pri +++ b/Common/3dParty/icu/icu.pri @@ -1,4 +1,4 @@ -ICU_MAJOR_VER = 58 +ICU_MAJOR_VER = 74 core_windows { exists($$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/icu) { @@ -20,8 +20,15 @@ core_linux { core_mac { INCLUDEPATH += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/include - LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicuuc.$${ICU_MAJOR_VER}.dylib - LIBS += $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build/libicudata.$${ICU_MAJOR_VER}.dylib + ICU_LIBS_PATH_MAC = $$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/build + bundle_dylibs { + LIBS += $$ICU_LIBS_PATH_MAC/libicudata.a + LIBS += $$ICU_LIBS_PATH_MAC/libicui18n.a + LIBS += $$ICU_LIBS_PATH_MAC/libicuuc.a + } else { + LIBS += $$ICU_LIBS_PATH_MAC/libicuuc.$${ICU_MAJOR_VER}.dylib + LIBS += $$ICU_LIBS_PATH_MAC/libicudata.$${ICU_MAJOR_VER}.dylib + } } core_ios { diff --git a/Common/3dParty/icu/icu_ios.sh b/Common/3dParty/icu/icu_ios.sh index 7b6bbba71b..9f3df4ea83 100755 --- a/Common/3dParty/icu/icu_ios.sh +++ b/Common/3dParty/icu/icu_ios.sh @@ -1,7 +1,5 @@ #!/bin/bash -ICU_VERSION="58" - ICU_DIR="$PWD/icu" ICU_SOURCE="${ICU_DIR}/source" @@ -47,8 +45,6 @@ defines_utypes=( function prebuild() { - svn export http://source.icu-project.org/repos/icu/tags/release-${ICU_VERSION}/icu4c/ ${ICU_DIR} --native-eol LF - echo "===== REMOVING data from bundle =====" #Data bundle reduction diff --git a/Common/base.pri b/Common/base.pri index edc6698a55..1b964dde32 100644 --- a/Common/base.pri +++ b/Common/base.pri @@ -91,6 +91,10 @@ isEqual(QT_MAJOR_VERSION, 5) { greaterThan(QT_MAJOR_VERSION, 5) { DEFINES += QT_VERSION_6 + + core_windows { + QMAKE_CXXFLAGS += /permissive- + } } ios { @@ -108,6 +112,10 @@ win32:contains(QMAKE_TARGET.arch, x86_64): { win32:!contains(QMAKE_TARGET.arch, x86_64): { CONFIG += core_win_32 } +win32:contains(QMAKE_TARGET.arch, arm64): { + CONFIG -= core_win_32 + CONFIG += core_win_arm64 +} linux-clang-libc++ { CONFIG += core_linux @@ -199,6 +207,25 @@ core_win_64 { core_linux { DEFINES += LINUX _LINUX + + QMAKE_CUSTOM_SYSROOT = $$(QMAKE_CUSTOM_SYSROOT) + QMAKE_CUSTOM_SYSROOT_BIN = $$(QMAKE_CUSTOM_SYSROOT)/usr/bin/ + + core_linux_64 { + !linux_arm64 { # x86_64 + QMAKE_CUSTOM_SYSROOT_LIB = $$(QMAKE_CUSTOM_SYSROOT)/usr/lib/x86_64-linux-gnu + !isEmpty(QMAKE_CUSTOM_SYSROOT) { + message("using custom sysroot $$QMAKE_CUSTOM_SYSROOT") + QMAKE_CC = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "gcc") + QMAKE_CXX = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++") + QMAKE_LINK = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++") + QMAKE_LINK_SHLIB = $$join(QMAKE_CUSTOM_SYSROOT_BIN, , , "g++") + + QMAKE_CXXFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT + QMAKE_LFLAGS += --sysroot $$QMAKE_CUSTOM_SYSROOT + } + } + } } core_linux_host_arm64 { message("build on arm64") @@ -228,8 +255,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) @@ -285,6 +312,9 @@ core_win_32 { core_win_64 { CORE_BUILDS_PLATFORM_PREFIX = win_64 } +core_win_arm64 { + CORE_BUILDS_PLATFORM_PREFIX = win_arm64 +} core_linux_32 { CORE_BUILDS_PLATFORM_PREFIX = linux_32 } @@ -311,8 +341,8 @@ linux_arm64 { !isEmpty(ARM64_TOOLCHAIN_BIN){ !isEmpty(ARM64_TOOLCHAIN_BIN_PREFIX){ - ARM64_TOOLCHAIN_BIN_FULL = $$ARM64_TOOLCHAIN_BIN/$$ARM64_TOOLCHAIN_BIN_PREFIX + message("using arm64 toolchain $$ARM64_TOOLCHAIN_BIN") QMAKE_CC = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "gcc") QMAKE_CXX = $$join(ARM64_TOOLCHAIN_BIN_FULL, , , "g++") @@ -572,42 +602,45 @@ core_windows { DEFINES += CRYPTOPP_DISABLE_ASM } -core_ios:CONFIG+=support_bundle_dylibs +core_ios|core_mac { + CONFIG += support_bundle_dylibs +} !support_bundle_dylibs:CONFIG-=bundle_dylibs -core_ios { - bundle_dylibs { - plugin { - CONFIG -= plugin - CONFIG += lib_bundle +bundle_dylibs { + plugin { + CONFIG -= plugin + CONFIG += lib_bundle - QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/ - #QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @executable_path/Frameworks - #QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @loader_path/Frameworks + QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/ + #QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @executable_path/Frameworks + #QMAKE_LFLAGS += -Xlinker -rpath -Xlinker @loader_path/Frameworks - # correct version to < 256 - VERSIONS = $$split(VERSION, ".") - VERSION_1 = $$member(VERSIONS, 0) - VERSION_2 = $$member(VERSIONS, 1) - VERSION_3 = $$member(VERSIONS, 2) - VERSION_4 = $$member(VERSIONS, 3) + # correct version to < 256 + VERSIONS = $$split(VERSION, ".") + VERSION_1 = $$member(VERSIONS, 0) + VERSION_2 = $$member(VERSIONS, 1) + VERSION_3 = $$member(VERSIONS, 2) + VERSION_4 = $$member(VERSIONS, 3) - greaterThan(VERSION_1, 255): VERSION_1 = 255 - greaterThan(VERSION_2, 255): VERSION_2 = 255 - greaterThan(VERSION_3, 255): VERSION_3 = 255 - greaterThan(VERSION_4, 255): VERSION_4 = 255 + greaterThan(VERSION_1, 255): VERSION_1 = 255 + greaterThan(VERSION_2, 255): VERSION_2 = 255 + greaterThan(VERSION_3, 255): VERSION_3 = 255 + greaterThan(VERSION_4, 255): VERSION_4 = 255 - VERSION_CORRECT = $$VERSION_1 - VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".") - VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_2) - VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".") - VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_3) - VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".") - VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_4) + VERSION_CORRECT = $$VERSION_1 + VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".") + VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_2) + VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".") + VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_3) + VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", ".") + VERSION_CORRECT = $$join(VERSION_CORRECT, "", "", $$VERSION_4) - VERSION = $$VERSION_CORRECT - } + VERSION = $$VERSION_CORRECT + MAJOR_VERSION = $$VERSION_1 + # set framework version as A + QMAKE_FRAMEWORK_VERSION = A } } diff --git a/DesktopEditor/cximage/CxImage/ximacfg.h b/DesktopEditor/cximage/CxImage/ximacfg.h index d6189f4bdc..c134fc24c1 100644 --- a/DesktopEditor/cximage/CxImage/ximacfg.h +++ b/DesktopEditor/cximage/CxImage/ximacfg.h @@ -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 diff --git a/DesktopEditor/cximage/CxImage/ximage.h b/DesktopEditor/cximage/CxImage/ximage.h index 4ac5415f81..ab0ce0aaff 100644 --- a/DesktopEditor/cximage/CxImage/ximage.h +++ b/DesktopEditor/cximage/CxImage/ximage.h @@ -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 diff --git a/DesktopEditor/cximage/tiff/tif_getimage.c b/DesktopEditor/cximage/tiff/tif_getimage.c index c30b2b0490..b87e7476da 100644 --- a/DesktopEditor/cximage/tiff/tif_getimage.c +++ b/DesktopEditor/cximage/tiff/tif_getimage.c @@ -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 @@ -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; diff --git a/DesktopEditor/doctrenderer/docbuilder.java/src/java/docbuilder/utils/NativeLibraryLoader.java b/DesktopEditor/doctrenderer/docbuilder.java/src/java/docbuilder/utils/NativeLibraryLoader.java index d4fede0687..3c540917f7 100644 --- a/DesktopEditor/doctrenderer/docbuilder.java/src/java/docbuilder/utils/NativeLibraryLoader.java +++ b/DesktopEditor/doctrenderer/docbuilder.java/src/java/docbuilder/utils/NativeLibraryLoader.java @@ -23,6 +23,30 @@ public class NativeLibraryLoader { } } + private static String libPrefix; + private static String libExtension; + + private static boolean loadIfExist(String libPath) { + File libFile = new File(libPath); + if (libFile.exists()) { + System.load(libPath); + return true; + } + return false; + } + + private static void load(Path libDirPath, String libName) { + String libPath = libDirPath.resolve(libPrefix + libName + libExtension).toString(); + if (OSChecker.isMac()) { + if (!loadIfExist(libPath)) { + // if dylib does not exist, load framework library + System.load(libDirPath.resolve(libName + ".framework/" + libName).toString()); + } + } else { + System.load(libPath); + } + } + static { try { Path libDirPath = getLibPath(); @@ -31,8 +55,8 @@ public class NativeLibraryLoader { System.load(libDirPath.resolve("icudt58.dll").toString()); System.load(libDirPath.resolve("icuuc58.dll").toString()); } else if (OSChecker.isMac()) { - System.load(libDirPath.resolve("libicudata.58.dylib").toString()); - System.load(libDirPath.resolve("libicuuc.58.dylib").toString()); + loadIfExist(libDirPath.resolve("libicudata.58.dylib").toString()); + loadIfExist(libDirPath.resolve("libicuuc.58.dylib").toString()); } else if (OSChecker.isLinux()) { System.load(libDirPath.resolve("libicudata.so.58").toString()); System.load(libDirPath.resolve("libicuuc.so.58").toString()); @@ -42,24 +66,25 @@ public class NativeLibraryLoader { String[] libs = {"UnicodeConverter", "kernel", "kernel_network", "graphics", "PdfFile", "XpsFile", "DjVuFile", "DocxRenderer", "doctrenderer", "docbuilder.jni"}; - String prefix = ""; + libPrefix = ""; if (OSChecker.isMac() || OSChecker.isLinux()) { - prefix = "lib"; + libPrefix = "lib"; } - String extension = ""; + libExtension = ""; if (OSChecker.isWindows()) { - extension = ".dll"; + libExtension = ".dll"; } else if (OSChecker.isMac()) { - extension = ".dylib"; + libExtension = ".dylib"; } else { - extension = ".so"; + libExtension = ".so"; } for (String lib : libs) { - System.load(libDirPath.resolve(prefix + lib + extension).toString()); + load(libDirPath, lib); } - } catch (UnsatisfiedLinkError e) { + } catch (Exception e) { + System.out.println(e.getMessage()); throw new RuntimeException("Cannot load dynamic libraries. Check if JAR file is in the same directory as all docbuilder libraries."); } } diff --git a/DesktopEditor/doctrenderer/docbuilder.net/.gitignore b/DesktopEditor/doctrenderer/docbuilder.net/.gitignore new file mode 100644 index 0000000000..ad5e6cfb62 --- /dev/null +++ b/DesktopEditor/doctrenderer/docbuilder.net/.gitignore @@ -0,0 +1 @@ +deploy/ diff --git a/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py b/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py index 5fa6d5c624..3e2b988091 100644 --- a/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py +++ b/DesktopEditor/doctrenderer/docbuilder.python/src/docbuilder.py @@ -24,6 +24,10 @@ def _loadLibrary(path): library_name = 'libdocbuilder.c.so' elif 'darwin' == os_name: library_name = 'libdocbuilder.c.dylib' + # if there is no dylib file, get library from framework + if not os.path.exists(path + '/' + library_name): + path = path + '/docbuilder.c.framework' + library_name = 'docbuilder.c' _lib = ctypes.CDLL(path + '/' + library_name) @@ -437,7 +441,7 @@ class CDocBuilderValue: return CDocBuilderValue(OBJECT_HANDLE(_lib.CDocBuilderValue_Call6(self._internal, ctypes.c_wchar_p(name), values[0]._internal, values[1]._internal, values[2]._internal, values[3]._internal, values[4]._internal, values[5]._internal))) else: raise TypeError("Call() expects at most 6 arguments") - + def append(self, value): if not self.IsArray(): raise TypeError("Object is not an array") diff --git a/DesktopEditor/graphics/pro/js/drawingfile.json b/DesktopEditor/graphics/pro/js/drawingfile.json index edbedf7584..a6e2aa7b91 100644 --- a/DesktopEditor/graphics/pro/js/drawingfile.json +++ b/DesktopEditor/graphics/pro/js/drawingfile.json @@ -165,7 +165,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/", diff --git a/DesktopEditor/graphics/pro/raster.pri b/DesktopEditor/graphics/pro/raster.pri index 28d4b2d2d8..31ff5a994e 100644 --- a/DesktopEditor/graphics/pro/raster.pri +++ b/DesktopEditor/graphics/pro/raster.pri @@ -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 \ diff --git a/DesktopEditor/graphics/tests/testHeic/main.cpp b/DesktopEditor/graphics/tests/testHeic/main.cpp new file mode 100644 index 0000000000..a6065e1ba2 --- /dev/null +++ b/DesktopEditor/graphics/tests/testHeic/main.cpp @@ -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; +} diff --git a/DesktopEditor/graphics/tests/testHeic/testHeic.pro b/DesktopEditor/graphics/tests/testHeic/testHeic.pro new file mode 100644 index 0000000000..5610ac7a15 --- /dev/null +++ b/DesktopEditor/graphics/tests/testHeic/testHeic.pro @@ -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 diff --git a/DesktopEditor/raster/BgraFrame.cpp b/DesktopEditor/raster/BgraFrame.cpp index d39f05fddd..8edb32c2bf 100644 --- a/DesktopEditor/raster/BgraFrame.cpp +++ b/DesktopEditor/raster/BgraFrame.cpp @@ -44,6 +44,10 @@ #include "PICT/PICFile.h" #endif +#if CXIMAGE_SUPPORT_HEIF +#include "heif/heif.h" +#endif + #include #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) diff --git a/DesktopEditor/raster/ImageFileFormatChecker.cpp b/DesktopEditor/raster/ImageFileFormatChecker.cpp index 020119a96c..89d045b83f 100644 --- a/DesktopEditor/raster/ImageFileFormatChecker.cpp +++ b/DesktopEditor/raster/ImageFileFormatChecker.cpp @@ -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) { diff --git a/DesktopEditor/raster/ImageFileFormatChecker.h b/DesktopEditor/raster/ImageFileFormatChecker.h index 51c06178de..6cbf6df80b 100644 --- a/DesktopEditor/raster/ImageFileFormatChecker.h +++ b/DesktopEditor/raster/ImageFileFormatChecker.h @@ -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); diff --git a/DesktopEditor/raster/heif/heif.cpp b/DesktopEditor/raster/heif/heif.cpp new file mode 100644 index 0000000000..ff4d7fa530 --- /dev/null +++ b/DesktopEditor/raster/heif/heif.cpp @@ -0,0 +1,154 @@ +#include "heif.h" +#include "../../common/File.h" + +#include + +#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 func; +public: + explicit Defer(std::function 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; + } +} diff --git a/DesktopEditor/raster/heif/heif.h b/DesktopEditor/raster/heif/heif.h new file mode 100644 index 0000000000..06d094ea46 --- /dev/null +++ b/DesktopEditor/raster/heif/heif.h @@ -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; + }; +} diff --git a/HwpFile/HwpDoc/Common/XMLReader.cpp b/HwpFile/HwpDoc/Common/XMLReader.cpp index ea0312480e..17efbc235f 100644 --- a/HwpFile/HwpDoc/Common/XMLReader.cpp +++ b/HwpFile/HwpDoc/Common/XMLReader.cpp @@ -1,5 +1,6 @@ #include "XMLReader.h" #include +#include namespace HWP { diff --git a/OFDFile/src/Utils/Utils.h b/OFDFile/src/Utils/Utils.h index 55a69b398e..4d5b74eca5 100644 --- a/OFDFile/src/Utils/Utils.h +++ b/OFDFile/src/Utils/Utils.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "../../../DesktopEditor/common/Path.h" #include "../../../DesktopEditor/common/ProcessEnv.h" @@ -169,7 +170,7 @@ inline bool CanUseThisPath(const std::wstring& wsPath, const std::wstring& wsRoo inline bool IsZeroValue(const double& dValue) { - return DBL_EPSILON > std::abs(dValue); + return DBL_EPSILON > std::fabs(dValue); } } #endif // UTILS_H diff --git a/OOXML/Binary/Presentation/BinaryFileReaderWriter.cpp b/OOXML/Binary/Presentation/BinaryFileReaderWriter.cpp index 6f62666178..7b91f83036 100644 --- a/OOXML/Binary/Presentation/BinaryFileReaderWriter.cpp +++ b/OOXML/Binary/Presentation/BinaryFileReaderWriter.cpp @@ -1643,15 +1643,15 @@ namespace NSBinPptxRW m_lNextRelsID = 3; } - void CRelsGenerator::WriteMasters(int nCount) + std::wstring CRelsGenerator::WriteMaster(int nIndex) { - for (int i = 0; i < nCount; ++i) - { - std::wstring strRels = L""; - m_pWriter->WriteString(strRels); - } + std::wstring rid = L"rId" + std::to_wstring(m_lNextRelsID++); + std::wstring strRels = L""; + m_pWriter->WriteString(strRels); + + return rid; } void CRelsGenerator::WriteThemes(int nCount) { @@ -1663,23 +1663,26 @@ namespace NSBinPptxRW m_pWriter->WriteString(strRels); } } - void CRelsGenerator::WriteSlides(int nCount) + std::wstring CRelsGenerator::WriteSlide(int nIndex) { - for (int i = 0; i < nCount; ++i) - { - std::wstring strRels = L""; - m_pWriter->WriteString(strRels); - } + std::wstring rid = L"rId" + std::to_wstring(m_lNextRelsID++); + + std::wstring strRels = L""; + m_pWriter->WriteString(strRels); + + return rid; } - void CRelsGenerator::WriteSlideComments(int nComment) + std::wstring CRelsGenerator::WriteSlideComments(int nIndexComment) { - std::wstring strRels = L""; + std::to_wstring(nIndexComment) + L".xml\"/>"; m_pWriter->WriteString(strRels); + return rid; } void CRelsGenerator::WriteNotesMaster() { @@ -1687,23 +1690,23 @@ namespace NSBinPptxRW L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster\" Target=\"notesMasters/notesMaster1.xml\"/>"; m_pWriter->WriteString(strRels0); } - void CRelsGenerator::WritePresentationComments(int nComment) + std::wstring CRelsGenerator::WritePresentationComments(int nIndexComment) { - std::wstring strRels = L""; + std::to_wstring(nIndexComment) + L".xml\"/>"; m_pWriter->WriteString(strRels); + return rid; } - void CRelsGenerator::WriteCustoms(int nCount) + std::wstring CRelsGenerator::WriteCustom(const std::wstring & file_name) { - for (int i = 0; i < nCount; ++i) - { - std::wstring strRels = L""; + std::wstring rid = L"rId" + std::to_wstring(m_lNextRelsID++); + std::wstring strRels = L""; m_pWriter->WriteString(strRels); - } + return rid; } void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsVbaProject, bool bIsJsaProject) { diff --git a/OOXML/Binary/Presentation/BinaryFileReaderWriter.h b/OOXML/Binary/Presentation/BinaryFileReaderWriter.h index f13574ec1a..5a75904398 100644 --- a/OOXML/Binary/Presentation/BinaryFileReaderWriter.h +++ b/OOXML/Binary/Presentation/BinaryFileReaderWriter.h @@ -500,16 +500,16 @@ namespace NSBinPptxRW void StartNotes (int nIndexSlide); void StartThemeNotesMaster(int nIndexTheme); - void WriteMasters (int nCount); void WriteThemes (int nCount); - void WriteSlides (int nCount); void WriteNotesMaster(); - void WriteSlideComments (int nComment); - void WritePresentationComments (int nComment); + std::wstring WriteSlideComments(int nIndexComment); + std::wstring WritePresentationComments(int nIndexComment); + + std::wstring WriteCustom(const std::wstring& file_name); + std::wstring WriteMaster(int nIndex); + std::wstring WriteSlide(int nIndex); - void WriteCustoms(int nCount); - unsigned int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode); unsigned int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit); diff --git a/OOXML/Binary/Presentation/Converter.cpp b/OOXML/Binary/Presentation/Converter.cpp index e63dbeecea..2e984b106d 100644 --- a/OOXML/Binary/Presentation/Converter.cpp +++ b/OOXML/Binary/Presentation/Converter.cpp @@ -31,7 +31,7 @@ */ #include "Converter.h" -#include "../../PPTXFormat/Presentation/SldSz.h" +#include "../../PPTXFormat/Presentation/PresentationChildElements.h" #include "../../PPTXFormat/NotesSlide.h" namespace PPTX2EditorAdvanced diff --git a/OOXML/Binary/Presentation/PPTXWriter.cpp b/OOXML/Binary/Presentation/PPTXWriter.cpp index 1bb67561ab..adf155cd7b 100644 --- a/OOXML/Binary/Presentation/PPTXWriter.cpp +++ b/OOXML/Binary/Presentation/PPTXWriter.cpp @@ -703,46 +703,6 @@ namespace NSBinPptxRW SetRequiredDefaultsCore(); } - pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::CustomProperties); - if (m_mainTables.end() != pPair) - { - m_oReader.Seek(pPair->second); - try - { - m_oCustomProperties = new PPTX::CustomProperties(&m_oDocument); - m_oCustomProperties->fromPPTY(&m_oReader); - } - catch (...) - { - } - } - // customs - pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::Customs); - if (m_mainTables.end() != pPair) - { - OOX::CPath pathFolder = m_strDstFolder + FILE_SEPARATOR_STR + _T("customXml"); - OOX::CPath pathFolderRels = pathFolder + FILE_SEPARATOR_STR + _T("_rels"); - - NSDirectory::CreateDirectory(pathFolder.GetPath()); - NSDirectory::CreateDirectory(pathFolderRels.GetPath()); - - m_oReader.Seek(pPair->second); - int nCountCustoms = m_oReader.GetLong(); - - for (int i = 0; i < nCountCustoms; ++i) - { - smart_ptr pCustomXml = new OOX::CCustomXML(NULL, false); - - pCustomXml->fromPPTY(&m_oReader); - - //smart_ptr pCustomXmlFile = pCustomXml.smart_dynamic_cast(); - //m_oPresentation.Add(pCustomXmlFile); - OOX::CPath filename(L"item" + std::to_wstring(i + 1) + L".xml"); - pCustomXml->write(pathFolder / filename, OOX::CPath(m_strDstFolder), *m_oImageManager.m_pContentTypes); - } - m_oReader.m_pRels->WriteCustoms(nCountCustoms); - } - // presProps pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::PresProps); if (m_mainTables.end() != pPair) @@ -836,6 +796,45 @@ namespace NSBinPptxRW m_oReader.m_pRels->Clear(); m_oReader.m_pRels->StartRels(); + pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::CustomProperties); + if (m_mainTables.end() != pPair) + { + m_oReader.Seek(pPair->second); + try + { + m_oCustomProperties = new PPTX::CustomProperties(&m_oDocument); + m_oCustomProperties->fromPPTY(&m_oReader); + } + catch (...) + { + } + } + // customs + pPair = m_mainTables.find(NSBinPptxRW::NSMainTables::Customs); + if (m_mainTables.end() != pPair) + { + OOX::CPath pathFolder = m_strDstFolder + FILE_SEPARATOR_STR + _T("customXml"); + OOX::CPath pathFolderRels = pathFolder + FILE_SEPARATOR_STR + _T("_rels"); + + NSDirectory::CreateDirectory(pathFolder.GetPath()); + NSDirectory::CreateDirectory(pathFolderRels.GetPath()); + + m_oReader.Seek(pPair->second); + int nCountCustoms = m_oReader.GetLong(); + + for (int i = 0; i < nCountCustoms; ++i) + { + smart_ptr pCustomXml = new OOX::CCustomXML(NULL, false); + + pCustomXml->fromPPTY(&m_oReader); + + OOX::CPath filename(L"item" + std::to_wstring(i + 1) + L".xml"); + pCustomXml->write(pathFolder / filename, OOX::CPath(m_strDstFolder), *m_oImageManager.m_pContentTypes); + + std::wstring rid = m_oReader.m_pRels->WriteCustom(filename.GetPath()); + m_oPresentation.custDataLst.push_back(rid); + } + } // tablestyles oXmlWriter.ClearNoAttack(); m_oTableStyles.toXmlWriter(&oXmlWriter); @@ -869,16 +868,14 @@ namespace NSBinPptxRW std::wstring sId = std::to_wstring((_UINT64)(0x80000000 + (_UINT64)nCountLayouts)); + std::wstring rid = m_oReader.m_pRels->WriteMaster(i + 1); m_oPresentation.sldMasterIdLst[i].id = sId; - m_oPresentation.sldMasterIdLst[i].rid = (size_t)(i + 1); + m_oPresentation.sldMasterIdLst[i].rid = rid; nCountLayouts += (LONG)(m_arSlideMasters_Theme[i].m_arLayouts.size() + 1); } - m_oReader.m_pRels->WriteMasters(nCountMasters); m_oReader.m_pRels->WriteThemes(nCountThemes); - unsigned int nCurrentRels = m_oReader.m_pRels->m_lNextRelsID; - m_oPresentation.sldIdLst.clear(); for (LONG i = 0; i < nCountSlides; ++i) { @@ -887,9 +884,8 @@ namespace NSBinPptxRW std::wstring sId = std::to_wstring(256 + i); m_oPresentation.sldIdLst[i].id = sId; - m_oPresentation.sldIdLst[i].rid = nCurrentRels++; + m_oPresentation.sldIdLst[i].rid = m_oReader.m_pRels->WriteSlide(i + 1); } - m_oReader.m_pRels->WriteSlides(nCountSlides); m_oPresentation.notesMasterIdLst.clear(); if (bNotesMasterPresent) diff --git a/OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp b/OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp index 58a24156a6..66011b338b 100644 --- a/OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp +++ b/OOXML/PPTXFormat/Logic/Colors/SchemeClr.cpp @@ -232,13 +232,6 @@ namespace PPTX RGB = parentFileAs().GetABGRFromScheme(str); } } - else if(parentFileIs()) - RGB = parentFileAs().GetARGBFromMap(str); - //{ - // if(val.get() == "phClr") - // RGB = rgb; - // else RGB = parentFileAs().GetARGBFromScheme(str); - //} blue = static_cast(RGB & 0xFF); green = static_cast((RGB & 0xFF00)>>8); diff --git a/OOXML/PPTXFormat/Logic/ExtP.h b/OOXML/PPTXFormat/Logic/ExtP.h index 0ccdbc3ec7..d7d2b302cb 100644 --- a/OOXML/PPTXFormat/Logic/ExtP.h +++ b/OOXML/PPTXFormat/Logic/ExtP.h @@ -32,62 +32,12 @@ #pragma once -#include "../Presentation/SectionLst.h" +#include "../Presentation/PresentationChildElements.h" //-------------------------------------------------------------------------------------------------------------- -// -// -// -// -// -//-------------------------------------------------------------------------------------------------------------- -// -// -// -// -// -// -// -// -// -// -// -// -// -// Лист1!D10:D12 -// H12 -// -// -// -// -// -//-------------------------------------------------------------------------------------------------------------- -// -// -// -//-------------------------------------------------------------------------------------------------------------- - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // - // // // // - // namespace PPTX { diff --git a/OOXML/PPTXFormat/PresProps.cpp b/OOXML/PPTXFormat/PresProps.cpp index f9f230dea9..42b8f3b14d 100644 --- a/OOXML/PPTXFormat/PresProps.cpp +++ b/OOXML/PPTXFormat/PresProps.cpp @@ -34,7 +34,6 @@ #include "ShowPr/PresentationPr.h" #include "ShowPr/Browse.h" -#include "ShowPr/CustShow.h" #include "ShowPr/Kiosk.h" #include "ShowPr/Present.h" #include "ShowPr/SldAll.h" @@ -55,7 +54,7 @@ namespace PPTX void PresProps::read(const OOX::CPath& filename, FileMap& map) { XmlUtils::CXmlNode oNode; - oNode.FromXmlFile(filename.m_strFilename); + oNode.FromXmlFile(filename.m_strFilename); // ClrMru.clear(); XmlUtils::CXmlNode oNodeClr; @@ -141,12 +140,12 @@ namespace PPTX }break; case 1: { - showPr = new nsPresentationPr::ShowPr(); + showPr = new nsPresentation::ShowPr(); showPr->fromPPTY(pReader); }break; case 2: { - printPr = new nsPresentationPr::PrintPr(); + printPr = new nsPresentation::PrintPr(); printPr->fromPPTY(pReader); }break; default: diff --git a/OOXML/PPTXFormat/PresProps.h b/OOXML/PPTXFormat/PresProps.h index fb92004ba8..6730ad9633 100644 --- a/OOXML/PPTXFormat/PresProps.h +++ b/OOXML/PPTXFormat/PresProps.h @@ -39,7 +39,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class ShowPr; class PrintPr; @@ -64,7 +64,7 @@ namespace PPTX virtual const OOX::CPath DefaultFileName() const; std::vector ClrMru; - nullable showPr; - nullable printPr; + nullable showPr; + nullable printPr; }; } // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation.cpp b/OOXML/PPTXFormat/Presentation.cpp index 46ba195f6b..26ac0f2546 100644 --- a/OOXML/PPTXFormat/Presentation.cpp +++ b/OOXML/PPTXFormat/Presentation.cpp @@ -33,11 +33,6 @@ #include "FileContainer.h" #include "FileTypes.h" -#include "Presentation/EmbeddedFont.h" -#include "Presentation/Kinsoku.h" -#include "Presentation/NotesSz.h" -#include "Presentation/PhotoAlbum.h" -#include "Presentation/SldSz.h" #include "CommentAuthors.h" #include "Limit/Conformance.h" @@ -68,118 +63,137 @@ namespace PPTX } void Presentation::read(const OOX::CPath& filename, FileMap& map) { - XmlUtils::CXmlNode oNode; - oNode.FromXmlFile(filename.m_strFilename); - - XmlMacroReadAttributeBase(oNode, L"autoCompressPictures", attrAutoCompressPictures); - XmlMacroReadAttributeBase(oNode, L"bookmarkIdSeed", attrBookmarkIdSeed); - XmlMacroReadAttributeBase(oNode, L"compatMode", attrCompatMode); - XmlMacroReadAttributeBase(oNode, L"conformance", attrConformance); - XmlMacroReadAttributeBase(oNode, L"embedTrueTypeFonts", attrEmbedTrueTypeFonts); - XmlMacroReadAttributeBase(oNode, L"firstSlideNum", attrFirstSlideNum); - XmlMacroReadAttributeBase(oNode, L"removePersonalInfoOnSave", attrRemovePersonalInfoOnSave); - XmlMacroReadAttributeBase(oNode, L"rtl", attrRtl); - XmlMacroReadAttributeBase(oNode, L"saveSubsetFonts", attrSaveSubsetFonts); - XmlMacroReadAttributeBase(oNode, L"serverZoom", attrServerZoom); - XmlMacroReadAttributeBase(oNode, L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld); - XmlMacroReadAttributeBase(oNode, L"strictFirstAndLastChars", attrStrictFirstAndLastChars); - - //custDataLst (Customer Data List) - //custShowLst (List of Custom Shows) - defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle")); - if (defaultTextStyle.is_init()) - defaultTextStyle->SetParentFilePointer(this); - embeddedFontLst.clear(); - XmlUtils::CXmlNode oNodeEmbeddedFonts; - if (oNode.GetNode(_T("p:embeddedFontLst"), oNodeEmbeddedFonts)) - { - XmlMacroLoadArray(oNodeEmbeddedFonts, _T("p:embeddedFont"), embeddedFontLst, nsPresentation::EmbeddedFont); - - for (size_t i = 0; i < embeddedFontLst.size(); ++i) - embeddedFontLst[i].SetParentFilePointer(this); - } - handoutMasterIdLst.clear(); - XmlUtils::CXmlNode oNodeHMList; - if (oNode.GetNode(_T("p:handoutMasterIdLst"), oNodeHMList)) - { - XmlMacroLoadArray(oNodeHMList, _T("p:handoutMasterId"), handoutMasterIdLst, Logic::XmlId); - - for (size_t i = 0; i < handoutMasterIdLst.size(); ++i) - handoutMasterIdLst[i].SetParentFilePointer(this); - } - - - kinsoku = oNode.ReadNode(_T("p:kinsoku")); - if (kinsoku.is_init()) - kinsoku->SetParentFilePointer(this); - - //modifyVerifier (Modification Verifier) - notesMasterIdLst.clear(); - XmlUtils::CXmlNode oNodeMIDList; - if (oNode.GetNode(_T("p:notesMasterIdLst"), oNodeMIDList)) - { - XmlMacroLoadArray(oNodeMIDList, _T("p:notesMasterId"), notesMasterIdLst, Logic::XmlId); - - for (size_t i = 0; i < notesMasterIdLst.size(); ++i) - notesMasterIdLst[i].SetParentFilePointer(this); - } - - notesSz = oNode.ReadNode(_T("p:notesSz")); - if (notesSz.is_init()) - notesSz->SetParentFilePointer(this); - - photoAlbum = oNode.ReadNode(_T("p:photoAlbum")); - if (photoAlbum.is_init()) - photoAlbum->SetParentFilePointer(this); - sldIdLst.clear(); - XmlUtils::CXmlNode oNode_sldId; - if (oNode.GetNode(_T("p:sldIdLst"), oNode_sldId)) - { - XmlMacroLoadArray(oNode_sldId, _T("p:sldId"), sldIdLst, Logic::XmlId); - - for (size_t i = 0; i < sldIdLst.size(); ++i) - sldIdLst[i].SetParentFilePointer(this); - } - sldMasterIdLst.clear(); - XmlUtils::CXmlNode oNode_sldM_Id; - if (oNode.GetNode(_T("p:sldMasterIdLst"), oNode_sldM_Id)) + + XmlUtils::CXmlNode oNodeRoot; + oNodeRoot.FromXmlFile(filename.m_strFilename); + + XmlMacroReadAttributeBase(oNodeRoot, L"autoCompressPictures", attrAutoCompressPictures); + XmlMacroReadAttributeBase(oNodeRoot, L"bookmarkIdSeed", attrBookmarkIdSeed); + XmlMacroReadAttributeBase(oNodeRoot, L"compatMode", attrCompatMode); + XmlMacroReadAttributeBase(oNodeRoot, L"conformance", attrConformance); + XmlMacroReadAttributeBase(oNodeRoot, L"embedTrueTypeFonts", attrEmbedTrueTypeFonts); + XmlMacroReadAttributeBase(oNodeRoot, L"firstSlideNum", attrFirstSlideNum); + XmlMacroReadAttributeBase(oNodeRoot, L"removePersonalInfoOnSave", attrRemovePersonalInfoOnSave); + XmlMacroReadAttributeBase(oNodeRoot, L"rtl", attrRtl); + XmlMacroReadAttributeBase(oNodeRoot, L"saveSubsetFonts", attrSaveSubsetFonts); + XmlMacroReadAttributeBase(oNodeRoot, L"serverZoom", attrServerZoom); + XmlMacroReadAttributeBase(oNodeRoot, L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld); + XmlMacroReadAttributeBase(oNodeRoot, L"strictFirstAndLastChars", attrStrictFirstAndLastChars); + + //smartTags (Smart Tags) + //modifyVerifier (Modification Verifier) + + std::vector oNodes; + if (oNodeRoot.GetNodes(L"*", oNodes)) { - XmlMacroLoadArray(oNode_sldM_Id, _T("p:sldMasterId"), sldMasterIdLst, Logic::XmlId); - - for (size_t i = 0; i < sldMasterIdLst.size(); ++i) - sldMasterIdLst[i].SetParentFilePointer(this); - } - - sldSz = oNode.ReadNode(_T("p:sldSz")); - if (sldSz.is_init()) - sldSz->SetParentFilePointer(this); - - XmlUtils::CXmlNode list = oNode.ReadNodeNoNS(_T("extLst")); - if (list.IsValid()) - { - std::vector oNodes; - if (list.GetNodes(_T("*"), oNodes)) + for (size_t i = 0; i < oNodes.size(); ++i) { - size_t nCount = oNodes.size(); - for (size_t i = 0; i < nCount; ++i) - { - XmlUtils::CXmlNode& oNode = oNodes[i]; + XmlUtils::CXmlNode& oNode = oNodes[i]; - PPTX::Logic::Ext ext; - ext.fromXML(oNode); - if (ext.sectionLst.IsInit()) + std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName()); + + if (L"custDataLst" == strName) + { + std::vector oCustDataLstNodes; + if (oNode.GetNodes(L"custData", oCustDataLstNodes)) { - sectionLst = ext.sectionLst; + for (auto n : oCustDataLstNodes) + { + custDataLst.emplace_back(); + XmlMacroReadAttributeBase(n, L"r:id", custDataLst.back()); + } + } + } + else if (L"custShowLst" == strName) + { + custShowLst = oNode; + if (custShowLst.is_init()) custShowLst->SetParentFilePointer(this); + } + else if (L"defaultTextStyle" == strName) + { + defaultTextStyle = oNode; + if (defaultTextStyle.is_init()) defaultTextStyle->SetParentFilePointer(this); + } + else if (L"embeddedFontLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:embeddedFont", embeddedFontLst, nsPresentation::EmbeddedFont); + + for (size_t i = 0; i < embeddedFontLst.size(); ++i) + embeddedFontLst[i].SetParentFilePointer(this); + } + else if (L"handoutMasterIdLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:handoutMasterId", handoutMasterIdLst, Logic::XmlId); + + for (size_t i = 0; i < handoutMasterIdLst.size(); ++i) + handoutMasterIdLst[i].SetParentFilePointer(this); + } + else if (L"kinsoku" == strName) + { + kinsoku = oNode; + if (kinsoku.is_init()) kinsoku->SetParentFilePointer(this); + } + else if (L"notesMasterIdLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:notesMasterId", notesMasterIdLst, Logic::XmlId); + + for (size_t i = 0; i < notesMasterIdLst.size(); ++i) + notesMasterIdLst[i].SetParentFilePointer(this); + } + else if (L"notesSz" == strName) + { + notesSz = oNode; + if (notesSz.is_init()) notesSz->SetParentFilePointer(this); + } + else if (L"photoAlbum" == strName) + { + photoAlbum = oNode; + if (photoAlbum.is_init()) photoAlbum->SetParentFilePointer(this); + } + else if (L"sldIdLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:sldId", sldIdLst, Logic::XmlId); + + for (size_t i = 0; i < sldIdLst.size(); ++i) + sldIdLst[i].SetParentFilePointer(this); + } + else if (L"sldMasterIdLst" == strName) + { + XmlMacroLoadArray(oNode, L"p:sldMasterId", sldMasterIdLst, Logic::XmlId); + + for (size_t i = 0; i < sldMasterIdLst.size(); ++i) + sldMasterIdLst[i].SetParentFilePointer(this); + } + else if (L"sldSz" == strName) + { + sldSz = oNode; + if (sldSz.is_init()) sldSz->SetParentFilePointer(this); + } + else if (L"extLst" == strName) + { + if (oNode.IsValid()) + { + std::vector oExtLstNodes; + if (oNode.GetNodes(L"*", oExtLstNodes)) + { + for (auto n : oExtLstNodes) + { + PPTX::Logic::Ext ext; + ext.fromXML(n); + if (ext.sectionLst.IsInit()) + { + sectionLst = ext.sectionLst; + } + } + } } } } } - - //smartTags (Smart Tags) Normalize(); } void Presentation::write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const @@ -277,7 +291,7 @@ namespace PPTX case 0: { defaultTextStyle = PPTX::Logic::TextListStyle(); - defaultTextStyle->m_name = _T("p:defaultTextStyle"); + defaultTextStyle->m_name = L"p:defaultTextStyle"; defaultTextStyle->fromPPTY(pReader); break; } @@ -378,28 +392,28 @@ namespace PPTX void Presentation::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("p:presentation")); + pWriter->StartNode(L"p:presentation"); pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("xmlns:a"), PPTX::g_Namespaces.a.m_strLink); - pWriter->WriteAttribute(_T("xmlns:r"), PPTX::g_Namespaces.r.m_strLink); - pWriter->WriteAttribute(_T("xmlns:p"), PPTX::g_Namespaces.p.m_strLink); - pWriter->WriteAttribute(_T("xmlns:m"), PPTX::g_Namespaces.m.m_strLink); - pWriter->WriteAttribute(_T("xmlns:w"), PPTX::g_Namespaces.w.m_strLink); + pWriter->WriteAttribute(L"xmlns:a", PPTX::g_Namespaces.a.m_strLink); + pWriter->WriteAttribute(L"xmlns:r", PPTX::g_Namespaces.r.m_strLink); + pWriter->WriteAttribute(L"xmlns:p", PPTX::g_Namespaces.p.m_strLink); + pWriter->WriteAttribute(L"xmlns:m", PPTX::g_Namespaces.m.m_strLink); + pWriter->WriteAttribute(L"xmlns:w", PPTX::g_Namespaces.w.m_strLink); - pWriter->WriteAttribute(_T("autoCompressPictures"), attrAutoCompressPictures); - pWriter->WriteAttribute(_T("bookmarkIdSeed"), attrBookmarkIdSeed); - pWriter->WriteAttribute(_T("compatMode"), attrCompatMode); - pWriter->WriteAttribute(_T("conformance"), attrConformance); - pWriter->WriteAttribute(_T("embedTrueTypeFonts"), attrEmbedTrueTypeFonts); - pWriter->WriteAttribute(_T("firstSlideNum"), attrFirstSlideNum); - pWriter->WriteAttribute(_T("removePersonalInfoOnSave"), attrRemovePersonalInfoOnSave); - pWriter->WriteAttribute(_T("rtl"), attrRtl); - pWriter->WriteAttribute(_T("saveSubsetFonts"), attrSaveSubsetFonts); - pWriter->WriteAttribute(_T("serverZoom"), attrServerZoom); - pWriter->WriteAttribute(_T("showSpecialPlsOnTitleSld"), attrShowSpecialPlsOnTitleSld); - pWriter->WriteAttribute(_T("strictFirstAndLastChars"), attrStrictFirstAndLastChars); + pWriter->WriteAttribute(L"autoCompressPictures", attrAutoCompressPictures); + pWriter->WriteAttribute(L"bookmarkIdSeed", attrBookmarkIdSeed); + pWriter->WriteAttribute(L"compatMode", attrCompatMode); + pWriter->WriteAttribute(L"conformance", attrConformance); + pWriter->WriteAttribute(L"embedTrueTypeFonts", attrEmbedTrueTypeFonts); + pWriter->WriteAttribute(L"firstSlideNum", attrFirstSlideNum); + pWriter->WriteAttribute(L"removePersonalInfoOnSave", attrRemovePersonalInfoOnSave); + pWriter->WriteAttribute(L"rtl", attrRtl); + pWriter->WriteAttribute(L"saveSubsetFonts", attrSaveSubsetFonts); + pWriter->WriteAttribute(L"serverZoom", attrServerZoom); + pWriter->WriteAttribute(L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld); + pWriter->WriteAttribute(L"strictFirstAndLastChars", attrStrictFirstAndLastChars); pWriter->EndAttributes(); @@ -413,6 +427,26 @@ namespace PPTX pWriter->Write(notesSz); pWriter->Write(photoAlbum); pWriter->Write(kinsoku); + + if (false == custDataLst.empty()) + { + pWriter->StartNode(L"p:custDataLst"); + pWriter->EndAttributes(); + + for (auto cust : custDataLst) + { + pWriter->StartNode(L"p:custData"); + pWriter->StartAttributes(); + pWriter->WriteAttribute(L"r:id", cust.ToString()); + + pWriter->EndAttributes(); + pWriter->EndNode(L"p:custData"); + } + + pWriter->EndNode(L"p:custDataLst"); + } + pWriter->Write(custShowLst); + pWriter->Write(defaultTextStyle); std::vector extLst; diff --git a/OOXML/PPTXFormat/Presentation.h b/OOXML/PPTXFormat/Presentation.h index 9aae1337ae..cc6ea6f50f 100644 --- a/OOXML/PPTXFormat/Presentation.h +++ b/OOXML/PPTXFormat/Presentation.h @@ -35,7 +35,7 @@ #include "FileContainer.h" #include "FileTypes.h" -#include "Presentation/EmbeddedFont.h" +#include "Presentation/PresentationChildElements.h" #include "CommentAuthors.h" #include "Limit/Conformance.h" @@ -88,9 +88,6 @@ namespace PPTX return type().DefaultFileName(); } - //Childs - //custDataLst (Customer Data List) - //property > custShowLst (List of Custom Shows) nullable defaultTextStyle; std::vector embeddedFontLst; std::vector handoutMasterIdLst; @@ -101,11 +98,12 @@ namespace PPTX nullable photoAlbum; std::vector sldIdLst; std::vector sldMasterIdLst; + std::vector custDataLst; + nullable custShowLst; nullable sldSz; nullable sectionLst; //smartTags (Smart Tags) - // Attrs nullable_bool attrAutoCompressPictures; nullable_int attrBookmarkIdSeed; nullable_bool attrCompatMode; @@ -119,36 +117,12 @@ namespace PPTX nullable_bool attrShowSpecialPlsOnTitleSld; nullable_bool attrStrictFirstAndLastChars; - smart_ptr commentAuthors; + smart_ptr commentAuthors; + smart_ptr comments; - private: - Logic::ClrMap m_clrMap; - nsTheme::ClrScheme m_clrScheme; - public: bool m_bMacroEnabled; smart_ptr m_pVbaProject; - smart_ptr m_pJsaProject; - smart_ptr comments; - - void SetClrMap(Logic::ClrMap map) {m_clrMap = map;} - void SetClrScheme(nsTheme::ClrScheme scheme) {m_clrScheme = scheme;} - - DWORD GetRGBAFromMap(const std::wstring& str)const - { - return m_clrScheme.GetRGBAFromScheme(m_clrMap.GetColorSchemeIndex(str)); - } - DWORD GetARGBFromMap(const std::wstring& str)const - { - return m_clrScheme.GetARGBFromScheme(m_clrMap.GetColorSchemeIndex(str)); - } - DWORD GetBGRAFromMap(const std::wstring& str)const - { - return m_clrScheme.GetBGRAFromScheme(m_clrMap.GetColorSchemeIndex(str)); - } - DWORD GetABGRFromMap(const std::wstring& str)const - { - return m_clrScheme.GetABGRFromScheme(m_clrMap.GetColorSchemeIndex(str)); - } + smart_ptr m_pJsaProject; private: void Normalize(); diff --git a/OOXML/PPTXFormat/Presentation/EmbeddedFont.cpp b/OOXML/PPTXFormat/Presentation/EmbeddedFont.cpp deleted file mode 100644 index beab4859d8..0000000000 --- a/OOXML/PPTXFormat/Presentation/EmbeddedFont.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "EmbeddedFont.h" - -namespace PPTX -{ - namespace nsPresentation - { - void EmbeddedFont::fromXML(XmlUtils::CXmlNode& node) - { - Bold = node.ReadNode(_T("p:bold")); - BoldItalic = node.ReadNode(_T("p:boldItalic")); - Italic = node.ReadNode(_T("p:italic")); - Regular = node.ReadNode(_T("p:regular")); - Font = node.ReadNode(_T("p:font")); - - FillParentPointersForChilds(); - } - std::wstring EmbeddedFont::toXML() const - { - XmlUtils::CNodeValue oValue; - oValue.WriteNullable(Bold); - oValue.WriteNullable(BoldItalic); - oValue.WriteNullable(Italic); - oValue.WriteNullable(Regular); - oValue.Write(Font); - - return XmlUtils::CreateNode(_T("p:embeddedFont"), oValue); - } - void EmbeddedFont::FillParentPointersForChilds() - { - if(Bold.is_init()) - Bold->SetParentPointer(this); - if(BoldItalic.is_init()) - BoldItalic->SetParentPointer(this); - if(Italic.is_init()) - Italic->SetParentPointer(this); - if(Regular.is_init()) - Regular->SetParentPointer(this); - Font.SetParentPointer(this); - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/EmbeddedFont.h b/OOXML/PPTXFormat/Presentation/EmbeddedFont.h deleted file mode 100644 index 71f421402d..0000000000 --- a/OOXML/PPTXFormat/Presentation/EmbeddedFont.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once -#ifndef PPTX_PRESENTATION_EMBEDDEDFONT_INCLUDE_H_ -#define PPTX_PRESENTATION_EMBEDDEDFONT_INCLUDE_H_ - -#include "./../WrapperWritingElement.h" -#include "EmbeddedFontDataId.h" -#include "./../Logic/TextFont.h" - -namespace PPTX -{ - namespace nsPresentation - { - class EmbeddedFont : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(EmbeddedFont) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - public: - nullable Bold; - nullable BoldItalic; - nullable Italic; - nullable Regular; - Logic::TextFont Font; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsPresentation -} // namespace PPTX - -#endif // PPTX_PRESENTATION_EMBEDDEDFONT_INCLUDE_H_ diff --git a/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.cpp b/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.cpp deleted file mode 100644 index 53eb0ca4fb..0000000000 --- a/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "EmbeddedFontDataId.h" - -namespace PPTX -{ - namespace nsPresentation - { - void EmbeddedFontDataId::fromXML(XmlUtils::CXmlNode& node) - { - m_name = XmlUtils::GetNameNoNS(node.GetName()); - - rid = node.GetAttribute(L"r:id"); - } - std::wstring EmbeddedFontDataId::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(L"r:id", rid); - - return XmlUtils::CreateNode(L"p:" + m_name, oAttr); - } - void EmbeddedFontDataId::FillParentPointersForChilds() - { - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.h b/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.h deleted file mode 100644 index 03a3caa0e3..0000000000 --- a/OOXML/PPTXFormat/Presentation/EmbeddedFontDataId.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "./../WrapperWritingElement.h" - -namespace PPTX -{ - namespace nsPresentation - { - class EmbeddedFontDataId : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(EmbeddedFontDataId) - - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - std::wstring rid; - std::wstring m_name; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/Kinsoku.cpp b/OOXML/PPTXFormat/Presentation/Kinsoku.cpp deleted file mode 100644 index 3b4b5f213c..0000000000 --- a/OOXML/PPTXFormat/Presentation/Kinsoku.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Kinsoku.h" - -namespace PPTX -{ - namespace nsPresentation - { - void Kinsoku::fromXML(XmlUtils::CXmlNode& node) - { - invalEndChars = node.GetAttribute(_T("invalEndChars")); - invalStChars = node.GetAttribute(_T("invalStChars")); - - XmlMacroReadAttributeBase(node, L"lang", lang); - } - std::wstring Kinsoku::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("invalEndChars"), invalEndChars); - oAttr.Write(_T("invalStChars"), invalStChars); - oAttr.Write(_T("lang"), lang); - - return XmlUtils::CreateNode(_T("p:kinsoku"), oAttr); - } - void Kinsoku::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - // TODO: - } - void Kinsoku::FillParentPointersForChilds() - { - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/Kinsoku.h b/OOXML/PPTXFormat/Presentation/Kinsoku.h deleted file mode 100644 index 79ec1775ab..0000000000 --- a/OOXML/PPTXFormat/Presentation/Kinsoku.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once -#ifndef PPTX_PRESENTATION_KINSOKU_INCLUDE_H_ -#define PPTX_PRESENTATION_KINSOKU_INCLUDE_H_ - -#include "./../WrapperWritingElement.h" - -namespace PPTX -{ - namespace nsPresentation - { - class Kinsoku : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(Kinsoku) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - - public: - std::wstring invalEndChars; - std::wstring invalStChars; - nullable_string lang; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsPresentation -} // namespace PPTX - -#endif // PPTX_PRESENTATION_KINSOKU_INCLUDE_H_ diff --git a/OOXML/PPTXFormat/Presentation/NotesSz.cpp b/OOXML/PPTXFormat/Presentation/NotesSz.cpp deleted file mode 100644 index 472c869bd4..0000000000 --- a/OOXML/PPTXFormat/Presentation/NotesSz.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "NotesSz.h" - -namespace PPTX -{ - namespace nsPresentation - { - void NotesSz::fromXML(XmlUtils::CXmlNode& node) - { - cx = node.ReadAttributeInt(L"cx"); - cy = node.ReadAttributeInt(L"cy"); - - Normalize(); - } - std::wstring NotesSz::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("cx"), cx); - oAttr.Write(_T("cy"), cy); - - return XmlUtils::CreateNode(_T("p:notesSz"), oAttr); - } - void NotesSz::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); - - pWriter->WriteInt1(0, cx); - pWriter->WriteInt1(1, cy); - - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); - } - void NotesSz::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(_T("p:notesSz")); - pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("cx"), cx); - pWriter->WriteAttribute(_T("cy"), cy); - pWriter->EndAttributes(); - pWriter->EndNode(_T("p:notesSz")); - } - void NotesSz::FillParentPointersForChilds() - { - } - void NotesSz::Normalize() - { - if (cx < 0) - cx = 0; - if (cy < 0) - cy = 0; - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/NotesSz.h b/OOXML/PPTXFormat/Presentation/NotesSz.h deleted file mode 100644 index b82b33232c..0000000000 --- a/OOXML/PPTXFormat/Presentation/NotesSz.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once -#ifndef PPTX_PRESENTATION_NOTESSZ_INCLUDE_H_ -#define PPTX_PRESENTATION_NOTESSZ_INCLUDE_H_ - -#include "./../WrapperWritingElement.h" - -namespace PPTX -{ - namespace nsPresentation - { - class NotesSz : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(NotesSz) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - - public: - int cx; - int cy; - - protected: - virtual void FillParentPointersForChilds(); - void Normalize(); - }; - } // namespace nsPresentation -} // namespace PPTX - -#endif // PPTX_PRESENTATION_NOTESSZ_INCLUDE_H_ diff --git a/OOXML/PPTXFormat/Presentation/PhotoAlbum.cpp b/OOXML/PPTXFormat/Presentation/PhotoAlbum.cpp deleted file mode 100644 index 9d9c198be8..0000000000 --- a/OOXML/PPTXFormat/Presentation/PhotoAlbum.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "PhotoAlbum.h" - -namespace PPTX -{ - namespace nsPresentation - { - void PhotoAlbum::fromXML(XmlUtils::CXmlNode& node) - { - XmlMacroReadAttributeBase(node, L"bw", bw); - XmlMacroReadAttributeBase(node, L"frame", frame); - XmlMacroReadAttributeBase(node, L"layout", layout); - XmlMacroReadAttributeBase(node, L"showCaptions", showCaptions); - } - std::wstring PhotoAlbum::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("bw"), bw); - oAttr.WriteLimitNullable(_T("frame"), frame); - oAttr.WriteLimitNullable(_T("layout"), layout); - oAttr.Write(_T("showCaptions"), showCaptions); - - return XmlUtils::CreateNode(_T("p:photoAlbum"), oAttr); - } - void PhotoAlbum::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - } - void PhotoAlbum::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - } - void PhotoAlbum::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) - { - } - void PhotoAlbum::FillParentPointersForChilds() - { - } - } // namespace nsPresentation -} // namespace PPTX - diff --git a/OOXML/PPTXFormat/Presentation/PhotoAlbum.h b/OOXML/PPTXFormat/Presentation/PhotoAlbum.h deleted file mode 100644 index 7e98af8307..0000000000 --- a/OOXML/PPTXFormat/Presentation/PhotoAlbum.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "./../WrapperWritingElement.h" -#include "./../Limit/FrameShape.h" -#include "./../Limit/AlbumLayout.h" - -namespace PPTX -{ - namespace nsPresentation - { - class PhotoAlbum : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(PhotoAlbum) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); - - nullable_bool bw; - nullable_limit frame; - nullable_limit layout; - nullable_bool showCaptions; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsPresentation -} // namespace PPTX - diff --git a/OOXML/PPTXFormat/Presentation/PresentationChildElements.cpp b/OOXML/PPTXFormat/Presentation/PresentationChildElements.cpp new file mode 100644 index 0000000000..fc0f06d46c --- /dev/null +++ b/OOXML/PPTXFormat/Presentation/PresentationChildElements.cpp @@ -0,0 +1,571 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +#include "PresentationChildElements.h" + +namespace PPTX +{ + namespace nsPresentation + { + void EmbeddedFont::fromXML(XmlUtils::CXmlNode& node) + { + Bold = node.ReadNode(_T("p:bold")); + BoldItalic = node.ReadNode(_T("p:boldItalic")); + Italic = node.ReadNode(_T("p:italic")); + Regular = node.ReadNode(_T("p:regular")); + Font = node.ReadNode(_T("p:font")); + + FillParentPointersForChilds(); + } + std::wstring EmbeddedFont::toXML() const + { + XmlUtils::CNodeValue oValue; + oValue.WriteNullable(Bold); + oValue.WriteNullable(BoldItalic); + oValue.WriteNullable(Italic); + oValue.WriteNullable(Regular); + oValue.Write(Font); + + return XmlUtils::CreateNode(_T("p:embeddedFont"), oValue); + } + void EmbeddedFont::FillParentPointersForChilds() + { + if (Bold.is_init()) + Bold->SetParentPointer(this); + if (BoldItalic.is_init()) + BoldItalic->SetParentPointer(this); + if (Italic.is_init()) + Italic->SetParentPointer(this); + if (Regular.is_init()) + Regular->SetParentPointer(this); + Font.SetParentPointer(this); + } + void EmbeddedFontDataId::fromXML(XmlUtils::CXmlNode& node) + { + m_name = XmlUtils::GetNameNoNS(node.GetName()); + + rid = node.GetAttribute(L"r:id"); + } + std::wstring EmbeddedFontDataId::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(L"r:id", rid); + + return XmlUtils::CreateNode(L"p:" + m_name, oAttr); + } + void EmbeddedFontDataId::FillParentPointersForChilds() + { + } + void NotesSz::fromXML(XmlUtils::CXmlNode& node) + { + cx = node.ReadAttributeInt(L"cx"); + cy = node.ReadAttributeInt(L"cy"); + + Normalize(); + } + std::wstring NotesSz::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("cx"), cx); + oAttr.Write(_T("cy"), cy); + + return XmlUtils::CreateNode(_T("p:notesSz"), oAttr); + } + void NotesSz::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); + + pWriter->WriteInt1(0, cx); + pWriter->WriteInt1(1, cy); + + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); + } + void NotesSz::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(_T("p:notesSz")); + pWriter->StartAttributes(); + pWriter->WriteAttribute(_T("cx"), cx); + pWriter->WriteAttribute(_T("cy"), cy); + pWriter->EndAttributes(); + pWriter->EndNode(_T("p:notesSz")); + } + void NotesSz::FillParentPointersForChilds() + { + } + void NotesSz::Normalize() + { + if (cx < 0) + cx = 0; + if (cy < 0) + cy = 0; + } + void Kinsoku::fromXML(XmlUtils::CXmlNode& node) + { + invalEndChars = node.GetAttribute(_T("invalEndChars")); + invalStChars = node.GetAttribute(_T("invalStChars")); + + XmlMacroReadAttributeBase(node, L"lang", lang); + } + std::wstring Kinsoku::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("invalEndChars"), invalEndChars); + oAttr.Write(_T("invalStChars"), invalStChars); + oAttr.Write(_T("lang"), lang); + + return XmlUtils::CreateNode(_T("p:kinsoku"), oAttr); + } + void Kinsoku::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + // TODO: + } + void Kinsoku::FillParentPointersForChilds() + { + } + void PhotoAlbum::fromXML(XmlUtils::CXmlNode& node) + { + XmlMacroReadAttributeBase(node, L"bw", bw); + XmlMacroReadAttributeBase(node, L"frame", frame); + XmlMacroReadAttributeBase(node, L"layout", layout); + XmlMacroReadAttributeBase(node, L"showCaptions", showCaptions); + } + std::wstring PhotoAlbum::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("bw"), bw); + oAttr.WriteLimitNullable(_T("frame"), frame); + oAttr.WriteLimitNullable(_T("layout"), layout); + oAttr.Write(_T("showCaptions"), showCaptions); + + return XmlUtils::CreateNode(_T("p:photoAlbum"), oAttr); + } + void PhotoAlbum::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + } + void PhotoAlbum::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + } + void PhotoAlbum::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + } + void PhotoAlbum::FillParentPointersForChilds() + { + } + void SldSz::fromXML(XmlUtils::CXmlNode& node) + { + cx = node.ReadAttributeInt(L"cx"); + cy = node.ReadAttributeInt(L"cy"); + + XmlMacroReadAttributeBase(node, L"type", type); + + Normalize(); + } + std::wstring SldSz::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("cx"), cx); + oAttr.Write(_T("cy"), cy); + oAttr.WriteLimitNullable(_T("type"), type); + + return XmlUtils::CreateNode(_T("p:sldSz"), oAttr); + } + void SldSz::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); + + pWriter->WriteInt1(0, cx); + pWriter->WriteInt1(1, cy); + pWriter->WriteLimit2(2, type); + + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); + } + void SldSz::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(_T("p:sldSz")); + pWriter->StartAttributes(); + pWriter->WriteAttribute(_T("cx"), cx); + pWriter->WriteAttribute(_T("cy"), cy); + pWriter->WriteAttribute(_T("type"), type); + pWriter->EndAttributes(); + pWriter->EndNode(_T("p:sldSz")); + } + void SldSz::FillParentPointersForChilds() + { + } + void SldSz::Normalize() + { + cx = (std::min)((std::max)(cx, 914400), 51206400); + cy = (std::min)((std::max)(cy, 914400), 51206400); + } +//----------------------------------------------------------------------------------------------------------- + void SectionLst::fromXML(XmlUtils::CXmlNode& node) + { + std::vector oNodes; + if (node.GetNodes(_T("*"), oNodes)) + { + size_t nCount = oNodes.size(); + for (int i = 0; i < nCount; ++i) + { + XmlUtils::CXmlNode& oNode = oNodes[i]; + + Section sect; + arSectionLst.push_back(sect); + + arSectionLst.back().fromXML(oNode); + } + } + } + std::wstring SectionLst::toXML() const + { + return L""; + } + void SectionLst::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG end = pReader->GetPos() + pReader->GetRecordSize() + 4; + + while (pReader->GetPos() < end) + { + BYTE _rec = pReader->GetUChar(); + + switch (_rec) + { + case 0: + { + pReader->Skip(4); // len + ULONG lCount = pReader->GetULong(); + + for (ULONG i = 0; i < lCount; ++i) + { + pReader->Skip(1); + + Section sect; + + arSectionLst.push_back(sect); + arSectionLst.back().fromPPTY(pReader); + } + + break; + } + default: + { + pReader->SkipRecord(); + break; + } + } + } + + pReader->Seek(end); + } + void SectionLst::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteRecordArray(0, 0, arSectionLst); + } + void SectionLst::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(L"p14:sectionLst"); + + pWriter->StartAttributes(); + pWriter->WriteAttribute(L"xmlns:p14", PPTX::g_Namespaces.p14.m_strLink); + pWriter->EndAttributes(); + + pWriter->WriteArray2(arSectionLst); + + pWriter->EndNode(L"p14:sectionLst"); + } +//---------------------------------------------------------------------------------------------------------------------- + void Section::fromXML(XmlUtils::CXmlNode& node) + { + XmlMacroReadAttributeBase(node, L"id", id); + XmlMacroReadAttributeBase(node, L"name", name); + + XmlUtils::CXmlNode oNodeSldIdLst; + if (node.GetNode(L"p14:sldIdLst", oNodeSldIdLst)) + { + XmlMacroLoadArray(oNodeSldIdLst, L"p14:sldId", arSldIdLst, Logic::XmlId); + } + } + std::wstring Section::toXML() const + { + return L""; + } + void Section::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(L"p14:section"); + + pWriter->StartAttributes(); + pWriter->WriteAttribute2(L"name", name); + pWriter->WriteAttribute(L"id", id); + + pWriter->EndAttributes(); + + pWriter->StartNode(L"p14:sldIdLst"); + pWriter->EndAttributes(); + pWriter->WriteArray2(arSldIdLst); + pWriter->EndNode(L"p14:sldIdLst"); + + pWriter->EndNode(L"p14:section"); + } + void Section::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); + pWriter->WriteString2(0, id); + pWriter->WriteString2(1, name); + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); + + pWriter->WriteRecordArray(0, 0, arSldIdLst); + + } + void Section::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 4; + + pReader->Skip(1); // start attributes + + while (true) + { + BYTE _at = pReader->GetUChar_TypeNode(); + if (_at == NSBinPptxRW::g_nodeAttributeEnd) + break; + + switch (_at) + { + case 0: + id = pReader->GetString2(); + break; + case 1: + name = pReader->GetString2(); + break; + default: + break; + } + } + + while (pReader->GetPos() < _end_rec) + { + BYTE _rec = pReader->GetUChar(); + + switch (_rec) + { + case 0: + { + pReader->Skip(4); // len + ULONG lCount = pReader->GetULong(); + + for (ULONG i = 0; i < lCount; ++i) + { + pReader->Skip(1); + + Logic::XmlId sldId(L"p14:sldId"); + + arSldIdLst.push_back(sldId); + arSldIdLst.back().fromPPTY(pReader); + } + + break; + } + default: + { + pReader->SkipRecord(); + break; + } + } + } + pReader->Seek(_end_rec); + } +//---------------------------------------------------------------------------------------------------------------------- + void CustShowLst::fromXML(XmlUtils::CXmlNode& node) + { + std::vector oNodes; + if (node.GetNodes(_T("*"), oNodes)) + { + size_t nCount = oNodes.size(); + for (int i = 0; i < nCount; ++i) + { + XmlUtils::CXmlNode& oNode = oNodes[i]; + + arCustShowLst.emplace_back(); + arCustShowLst.back().fromXML(oNode); + } + } + } + std::wstring CustShowLst::toXML() const + { + return L""; + } + void CustShowLst::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG end = pReader->GetPos() + pReader->GetRecordSize() + 4; + + while (pReader->GetPos() < end) + { + BYTE _rec = pReader->GetUChar(); + + switch (_rec) + { + case 0: + { + pReader->Skip(4); // len + ULONG lCount = pReader->GetULong(); + + for (ULONG i = 0; i < lCount; ++i) + { + pReader->Skip(1); + + CustShow custShow; + + arCustShowLst.push_back(custShow); + arCustShowLst.back().fromPPTY(pReader); + } + + break; + } + default: + { + pReader->SkipRecord(); + break; + } + } + } + + pReader->Seek(end); + } + void CustShowLst::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteRecordArray(0, 0, arCustShowLst); + } + void CustShowLst::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(L"p:custShowLst"); + + pWriter->StartAttributes(); + pWriter->EndAttributes(); + + pWriter->WriteArray2(arCustShowLst); + + pWriter->EndNode(L"p:custShowLst"); + } +//---------------------------------------------------------------------------------------------------------------------- + void CustShow::fromXML(XmlUtils::CXmlNode& node) + { + XmlUtils::CXmlNode oNodeSldIdLst; + if (node.GetNode(L"p:sldIdLst", oNodeSldIdLst)) + { + if (oNodeSldIdLst.IsValid()) + { + std::vector arrNodeSldId; + if (oNodeSldIdLst.GetNodes(L"sldId", arrNodeSldId)) + + for (auto n : arrNodeSldId) + { + arSldIdLst.emplace_back(); + XmlMacroReadAttributeBase(n, L"r:id", arSldIdLst.back()); + } + } + } + } + std::wstring CustShow::toXML() const + { + return L""; + } + void CustShow::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(L"p:custShow"); + + pWriter->StartAttributes(); + pWriter->EndAttributes(); + + pWriter->StartNode(L"p:sldIdLst"); + pWriter->EndAttributes(); + for (auto sld : arSldIdLst) + { + pWriter->StartNode(L"p:sldId"); + std::wstring sRid = sld.ToString(); + if (sRid.empty() == false) + { + pWriter->WriteAttribute(L"r:id", sRid); + } + pWriter->EndAttributes(); + pWriter->EndNode(L"p:sldId"); + } + pWriter->EndNode(L"p:sldIdLst"); + + pWriter->EndNode(L"p:custShow"); + } + void CustShow::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->StartRecord(0); + + _UINT32 len = (_UINT32)arSldIdLst.size(); + pWriter->WriteULONG(len); + + for (_UINT32 i = 0; i < len; ++i) + { + pWriter->WriteString(arSldIdLst[i].ToString()); + } + + pWriter->EndRecord(); + } + void CustShow::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 4; + + while (pReader->GetPos() < _end_rec) + { + BYTE _rec = pReader->GetUChar(); + + switch (_rec) + { + case 0: + { + pReader->Skip(4); // len + ULONG lCount = pReader->GetULong(); + + for (ULONG i = 0; i < lCount; ++i) + { + pReader->Skip(1); + + arSldIdLst.emplace_back(); + arSldIdLst.back() = pReader->GetString2(); + } + + }break; + default: + { + pReader->SkipRecord(); + break; + } + } + } + pReader->Seek(_end_rec); + } + } // namespace +} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/PresentationChildElements.h b/OOXML/PPTXFormat/Presentation/PresentationChildElements.h new file mode 100644 index 0000000000..b1e05942d5 --- /dev/null +++ b/OOXML/PPTXFormat/Presentation/PresentationChildElements.h @@ -0,0 +1,230 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +#pragma once + +#include "../Logic/XmlId.h" +#include "./../Limit/FrameShape.h" +#include "./../Limit/AlbumLayout.h" +#include "./../Limit/SlideSize.h" +#include "./../Logic/TextFont.h" + +namespace PPTX +{ + namespace nsPresentation + { + class Section : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(Section) + + nullable_string id; + nullable_string name; + std::vector arSldIdLst; + + virtual void fromXML(XmlUtils::CXmlNode& node); + + virtual std::wstring toXML() const; + + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + + virtual void FillParentPointersForChilds() {} + }; + + class SectionLst : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(SectionLst) + + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + std::vector
arSectionLst; + + protected: + virtual void FillParentPointersForChilds() {}; + }; + + class SldSz : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(SldSz) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + public: + int cx; + int cy; + nullable_limit type; + + protected: + virtual void FillParentPointersForChilds(); + void Normalize(); + }; + class PhotoAlbum : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(PhotoAlbum) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + + nullable_bool bw; + nullable_limit frame; + nullable_limit layout; + nullable_bool showCaptions; + + protected: + virtual void FillParentPointersForChilds(); + }; + class NotesSz : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(NotesSz) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + public: + int cx; + int cy; + + protected: + virtual void FillParentPointersForChilds(); + void Normalize(); + }; + class Kinsoku : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(Kinsoku) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + + public: + std::wstring invalEndChars; + std::wstring invalStChars; + nullable_string lang; + + protected: + virtual void FillParentPointersForChilds(); + }; + class EmbeddedFontDataId : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(EmbeddedFontDataId) + + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + std::wstring rid; + std::wstring m_name; + + protected: + virtual void FillParentPointersForChilds(); + }; + class EmbeddedFont : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(EmbeddedFont) + + public: + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + public: + nullable Bold; + nullable BoldItalic; + nullable Italic; + nullable Regular; + Logic::TextFont Font; + + protected: + virtual void FillParentPointersForChilds(); + }; + class CustShow : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(CustShow) + + std::vector arSldIdLst; + + virtual void fromXML(XmlUtils::CXmlNode& node); + + virtual std::wstring toXML() const; + + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + + virtual void FillParentPointersForChilds() {} + }; + class CustShowLst : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(CustShowLst) + + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + std::vector arCustShowLst; + + protected: + virtual void FillParentPointersForChilds() {}; + }; + } +} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/SectionLst.cpp b/OOXML/PPTXFormat/Presentation/SectionLst.cpp deleted file mode 100644 index 0729268049..0000000000 --- a/OOXML/PPTXFormat/Presentation/SectionLst.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ diff --git a/OOXML/PPTXFormat/Presentation/SectionLst.h b/OOXML/PPTXFormat/Presentation/SectionLst.h deleted file mode 100644 index bba6089d56..0000000000 --- a/OOXML/PPTXFormat/Presentation/SectionLst.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "../Logic/XmlId.h" - -namespace PPTX -{ - namespace Logic - { - class Section : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(Section) - - nullable_string id; - nullable_string name; - std::vector arSldIdLst; - - virtual void fromXML(XmlUtils::CXmlNode& node) - { - XmlMacroReadAttributeBase(node, L"id", id); - XmlMacroReadAttributeBase(node, L"name", name); - - XmlUtils::CXmlNode oNodeSldIdLst; - if (node.GetNode(L"p14:sldIdLst", oNodeSldIdLst)) - { - XmlMacroLoadArray(oNodeSldIdLst, L"p14:sldId", arSldIdLst, Logic::XmlId); - } - } - - virtual std::wstring toXML() const - { - return L""; - } - - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(L"p14:section"); - - pWriter->StartAttributes(); - pWriter->WriteAttribute2(L"name", name); - pWriter->WriteAttribute(L"id", id); - - pWriter->EndAttributes(); - - pWriter->StartNode(L"p14:sldIdLst"); - pWriter->EndAttributes(); - pWriter->WriteArray2(arSldIdLst); - pWriter->EndNode(L"p14:sldIdLst"); - - pWriter->EndNode(L"p14:section"); - } - - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); - pWriter->WriteString2(0, id); - pWriter->WriteString2(1, name); - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); - - pWriter->WriteRecordArray(0, 0, arSldIdLst); - - } - virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) - { - LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 4; - - pReader->Skip(1); // start attributes - - while (true) - { - BYTE _at = pReader->GetUChar_TypeNode(); - if (_at == NSBinPptxRW::g_nodeAttributeEnd) - break; - - switch (_at) - { - case 0: - id = pReader->GetString2(); - break; - case 1: - name = pReader->GetString2(); - break; - default: - break; - } - } - - while (pReader->GetPos() < _end_rec) - { - BYTE _rec = pReader->GetUChar(); - - switch (_rec) - { - case 0: - { - pReader->Skip(4); // len - ULONG lCount = pReader->GetULong(); - - for (ULONG i = 0; i < lCount; ++i) - { - pReader->Skip(1); - - Logic::XmlId sldId(L"p14:sldId"); - - arSldIdLst.push_back(sldId); - arSldIdLst.back().fromPPTY(pReader); - } - - break; - } - default: - { - pReader->SkipRecord(); - break; - } - } - } - - pReader->Seek(_end_rec); - } - - virtual void FillParentPointersForChilds() - { - } - }; - } - - namespace nsPresentation - { - class SectionLst : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(SectionLst) - - virtual void fromXML(XmlUtils::CXmlNode& node) - { - std::vector oNodes; - if (node.GetNodes(_T("*"), oNodes)) - { - size_t nCount = oNodes.size(); - for (int i = 0; i < nCount; ++i) - { - XmlUtils::CXmlNode & oNode = oNodes[i]; - - Logic::Section sect; - arSectionLst.push_back(sect); - - arSectionLst.back().fromXML(oNode); - } - } - } - virtual std::wstring toXML() const - { - return L""; - } - virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) - { - LONG end = pReader->GetPos() + pReader->GetRecordSize() + 4; - - while (pReader->GetPos() < end) - { - BYTE _rec = pReader->GetUChar(); - - switch (_rec) - { - case 0: - { - pReader->Skip(4); // len - ULONG lCount = pReader->GetULong(); - - for (ULONG i = 0; i < lCount; ++i) - { - pReader->Skip(1); - - Logic::Section sect; - - arSectionLst.push_back(sect); - arSectionLst.back().fromPPTY(pReader); - } - - break; - } - default: - { - pReader->SkipRecord(); - break; - } - } - } - - pReader->Seek(end); - } - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteRecordArray(0, 0, arSectionLst); - } - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(L"p14:sectionLst"); - - pWriter->StartAttributes(); - pWriter->WriteAttribute(L"xmlns:p14", PPTX::g_Namespaces.p14.m_strLink); - pWriter->EndAttributes(); - - pWriter->WriteArray2(arSectionLst); - - pWriter->EndNode(L"p14:sectionLst"); - } - - std::vector arSectionLst; - - protected: - virtual void FillParentPointersForChilds(){}; - }; - } -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/SldSz.cpp b/OOXML/PPTXFormat/Presentation/SldSz.cpp deleted file mode 100644 index d7be5eb187..0000000000 --- a/OOXML/PPTXFormat/Presentation/SldSz.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "SldSz.h" - -namespace PPTX -{ - namespace nsPresentation - { - void SldSz::fromXML(XmlUtils::CXmlNode& node) - { - cx = node.ReadAttributeInt(L"cx"); - cy = node.ReadAttributeInt(L"cy"); - - XmlMacroReadAttributeBase(node, L"type", type); - - Normalize(); - } - std::wstring SldSz::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("cx"), cx); - oAttr.Write(_T("cy"), cy); - oAttr.WriteLimitNullable(_T("type"), type); - - return XmlUtils::CreateNode(_T("p:sldSz"), oAttr); - } - void SldSz::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); - - pWriter->WriteInt1(0, cx); - pWriter->WriteInt1(1, cy); - pWriter->WriteLimit2(2, type); - - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); - } - void SldSz::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(_T("p:sldSz")); - pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("cx"), cx); - pWriter->WriteAttribute(_T("cy"), cy); - pWriter->WriteAttribute(_T("type"), type); - pWriter->EndAttributes(); - pWriter->EndNode(_T("p:sldSz")); - } - void SldSz::FillParentPointersForChilds() - { - } - void SldSz::Normalize() - { - cx = (std::min)((std::max)(cx, 914400), 51206400); - cy = (std::min)((std::max)(cy, 914400), 51206400); - } - } // namespace nsPresentation -} // namespace PPTX diff --git a/OOXML/PPTXFormat/Presentation/SldSz.h b/OOXML/PPTXFormat/Presentation/SldSz.h deleted file mode 100644 index c0be8951e0..0000000000 --- a/OOXML/PPTXFormat/Presentation/SldSz.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once -#ifndef PPTX_PRESENTATION_SLDSZ_INCLUDE_H_ -#define PPTX_PRESENTATION_SLDSZ_INCLUDE_H_ - -#include "./../WrapperWritingElement.h" -#include "./../Limit/SlideSize.h" - -namespace PPTX -{ - namespace nsPresentation - { - class SldSz : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(SldSz) - - public: - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - - public: - int cx; - int cy; - nullable_limit type; - - protected: - virtual void FillParentPointersForChilds(); - void Normalize(); - }; - } // namespace nsPresentation -} // namespace PPTX - -#endif // PPTX_PRESENTATION_SLDSZ_INCLUDE_H_ diff --git a/OOXML/PPTXFormat/ShowPr/Browse.cpp b/OOXML/PPTXFormat/ShowPr/Browse.cpp index cf6d0d16df..141337ced6 100644 --- a/OOXML/PPTXFormat/ShowPr/Browse.cpp +++ b/OOXML/PPTXFormat/ShowPr/Browse.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void Browse::fromXML(XmlUtils::CXmlNode& node) { @@ -88,5 +88,5 @@ namespace PPTX void Browse::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Browse.h b/OOXML/PPTXFormat/ShowPr/Browse.h index 3f3c763331..4efe2ea515 100644 --- a/OOXML/PPTXFormat/ShowPr/Browse.h +++ b/OOXML/PPTXFormat/ShowPr/Browse.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class Browse : public WrapperWritingElement { @@ -55,6 +55,6 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/CustShow.cpp b/OOXML/PPTXFormat/ShowPr/CustomShowId.cpp similarity index 76% rename from OOXML/PPTXFormat/ShowPr/CustShow.cpp rename to OOXML/PPTXFormat/ShowPr/CustomShowId.cpp index 1d8847541e..638aa7e72c 100644 --- a/OOXML/PPTXFormat/ShowPr/CustShow.cpp +++ b/OOXML/PPTXFormat/ShowPr/CustomShowId.cpp @@ -30,42 +30,42 @@ * */ -#include "CustShow.h" +#include "CustomShowId.h" namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { - void CustShow::fromXML(XmlUtils::CXmlNode& node) + void CustomShowId::fromXML(XmlUtils::CXmlNode& node) { - XmlMacroReadAttributeBase(node, _T("id"), id); + XmlMacroReadAttributeBase(node, L"id", id); } - std::wstring CustShow::toXML() const + std::wstring CustomShowId::toXML() const { XmlUtils::CAttribute oAttr; - oAttr.Write(_T("id"), id); + oAttr.Write(L"id", id); - return XmlUtils::CreateNode(_T("p:custShow"), oAttr); + return XmlUtils::CreateNode(L"p:custShow", oAttr); } - void CustShow::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + void CustomShowId::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const { pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); pWriter->WriteInt2(0, id); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); } - void CustShow::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + void CustomShowId::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - pWriter->StartNode(_T("p:custShow")); + pWriter->StartNode(L"p:custShow"); pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("id"), id); + pWriter->WriteAttribute(L"id", id); pWriter->EndAttributes(); - pWriter->EndNode(_T("p:custShow")); + pWriter->EndNode(L"p:custShow"); } - void CustShow::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + void CustomShowId::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4; @@ -85,8 +85,8 @@ namespace PPTX pReader->Seek(_end_rec); } - void CustShow::FillParentPointersForChilds() + void CustomShowId::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/CustShow.h b/OOXML/PPTXFormat/ShowPr/CustomShowId.h similarity index 93% rename from OOXML/PPTXFormat/ShowPr/CustShow.h rename to OOXML/PPTXFormat/ShowPr/CustomShowId.h index 5464ef3800..1e6237e3c3 100644 --- a/OOXML/PPTXFormat/ShowPr/CustShow.h +++ b/OOXML/PPTXFormat/ShowPr/CustomShowId.h @@ -35,12 +35,12 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { - class CustShow : public WrapperWritingElement + class CustomShowId : public WrapperWritingElement { public: - PPTX_LOGIC_BASE(CustShow) + PPTX_LOGIC_BASE(CustomShowId) virtual void fromXML(XmlUtils::CXmlNode& node); virtual std::wstring toXML() const; @@ -54,5 +54,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Kiosk.cpp b/OOXML/PPTXFormat/ShowPr/Kiosk.cpp index d669071604..19373a48bb 100644 --- a/OOXML/PPTXFormat/ShowPr/Kiosk.cpp +++ b/OOXML/PPTXFormat/ShowPr/Kiosk.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void Kiosk::fromXML(XmlUtils::CXmlNode& node) { @@ -88,5 +88,5 @@ namespace PPTX void Kiosk::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Kiosk.h b/OOXML/PPTXFormat/ShowPr/Kiosk.h index 5063ab1f7d..eb0b8729df 100644 --- a/OOXML/PPTXFormat/ShowPr/Kiosk.h +++ b/OOXML/PPTXFormat/ShowPr/Kiosk.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class Kiosk : public WrapperWritingElement { @@ -54,5 +54,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Present.cpp b/OOXML/PPTXFormat/ShowPr/Present.cpp index 4a4a58d6ab..eae17e076a 100644 --- a/OOXML/PPTXFormat/ShowPr/Present.cpp +++ b/OOXML/PPTXFormat/ShowPr/Present.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void Present::fromXML(XmlUtils::CXmlNode& node) { @@ -53,5 +53,5 @@ namespace PPTX void Present::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/Present.h b/OOXML/PPTXFormat/ShowPr/Present.h index 5ffa218cbd..81591e94cf 100644 --- a/OOXML/PPTXFormat/ShowPr/Present.h +++ b/OOXML/PPTXFormat/ShowPr/Present.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class Present : public WrapperWritingElement { @@ -51,5 +51,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/PresentationPr.cpp b/OOXML/PPTXFormat/ShowPr/PresentationPr.cpp index c9185ae035..0ee6e53500 100644 --- a/OOXML/PPTXFormat/ShowPr/PresentationPr.cpp +++ b/OOXML/PPTXFormat/ShowPr/PresentationPr.cpp @@ -33,7 +33,7 @@ #include "PresentationPr.h" #include "./Browse.h" -#include "./CustShow.h" +#include "./CustomShowId.h" #include "./Kiosk.h" #include "./Present.h" #include "./SldAll.h" @@ -41,7 +41,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void ShowPr::fromXML(XmlUtils::CXmlNode& node) { @@ -51,7 +51,7 @@ namespace PPTX XmlMacroReadAttributeBase(node, L"useTimings", useTimings); Browse = node.ReadNodeNoNS(L"browse"); - CustShow = node.ReadNodeNoNS(L"custShow"); + CustomShowId = node.ReadNodeNoNS(L"custShow"); Kiosk = node.ReadNodeNoNS(L"kiosk"); XmlUtils::CXmlNode node1 = node.ReadNodeNoNS(L"penClr"); PenClr.GetColorFrom(node1); @@ -73,7 +73,7 @@ namespace PPTX oValue.WriteNullable(Kiosk); oValue.WriteNullable(SldAll); oValue.WriteNullable(SldRg); - oValue.WriteNullable(CustShow); + oValue.WriteNullable(CustomShowId); oValue.Write(PenClr); return XmlUtils::CreateNode(L"p:ShowPr", oAttr, oValue); @@ -88,7 +88,7 @@ namespace PPTX pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteRecord2(0, Browse); - pWriter->WriteRecord2(1, CustShow); + pWriter->WriteRecord2(1, CustomShowId); pWriter->WriteRecord2(2, Kiosk); pWriter->WriteRecord1(3, PenClr); pWriter->WriteRecord2(4, Present); @@ -113,7 +113,7 @@ namespace PPTX pWriter->Write(Kiosk); pWriter->Write(SldAll); pWriter->Write(SldRg); - pWriter->Write(CustShow); + pWriter->Write(CustomShowId); if(PenClr.is_init()) { pWriter->WriteString(L""); @@ -154,19 +154,19 @@ namespace PPTX { case 0: { - Browse = new nsPresentationPr::Browse(); + Browse = new nsPresentation::Browse(); Browse->fromPPTY(pReader); break; } case 1: { - CustShow = new nsPresentationPr::CustShow(); - CustShow->fromPPTY(pReader); + CustomShowId = new nsPresentation::CustomShowId(); + CustomShowId->fromPPTY(pReader); break; } case 2: { - Kiosk = new nsPresentationPr::Kiosk(); + Kiosk = new nsPresentation::Kiosk(); Kiosk->fromPPTY(pReader); break; } @@ -177,19 +177,19 @@ namespace PPTX } case 4: { - Present = new nsPresentationPr::Present(); + Present = new nsPresentation::Present(); pReader->SkipRecord(); break; } case 5: { - SldAll = new nsPresentationPr::SldAll(); + SldAll = new nsPresentation::SldAll(); pReader->SkipRecord(); break; } case 6: { - SldRg = new nsPresentationPr::SldRg(); + SldRg = new nsPresentation::SldRg(); SldRg->fromPPTY(pReader); break; } @@ -292,5 +292,5 @@ namespace PPTX void PrintPr::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/PresentationPr.h b/OOXML/PPTXFormat/ShowPr/PresentationPr.h index ad05a4b93a..899f85fc45 100644 --- a/OOXML/PPTXFormat/ShowPr/PresentationPr.h +++ b/OOXML/PPTXFormat/ShowPr/PresentationPr.h @@ -35,10 +35,11 @@ #include "../Logic/UniColor.h" #include "../Limit/BWMode.h" #include "../Logic/ExtP.h" +#include "./CustomShowId.h" namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class Browse; class CustShow; @@ -59,13 +60,13 @@ namespace PPTX virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); - nullable Browse; - nullable CustShow; - nullable Kiosk; + nullable Browse; + nullable CustomShowId; + nullable Kiosk; Logic::UniColor PenClr; - nullable Present; - nullable SldAll; - nullable SldRg; + nullable Present; + nullable SldAll; + nullable SldRg; nullable_bool loop; nullable_bool showAnimation; @@ -99,6 +100,6 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/SldAll.cpp b/OOXML/PPTXFormat/ShowPr/SldAll.cpp index 35d849886c..2cf0e6021a 100644 --- a/OOXML/PPTXFormat/ShowPr/SldAll.cpp +++ b/OOXML/PPTXFormat/ShowPr/SldAll.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void SldAll::fromXML(XmlUtils::CXmlNode& node) { @@ -53,5 +53,5 @@ namespace PPTX void SldAll::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/SldAll.h b/OOXML/PPTXFormat/ShowPr/SldAll.h index d8a8b7e0a9..9ffeb471e6 100644 --- a/OOXML/PPTXFormat/ShowPr/SldAll.h +++ b/OOXML/PPTXFormat/ShowPr/SldAll.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class SldAll : public WrapperWritingElement { @@ -51,5 +51,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/SldRg.cpp b/OOXML/PPTXFormat/ShowPr/SldRg.cpp index a189c07db8..b4d66891f9 100644 --- a/OOXML/PPTXFormat/ShowPr/SldRg.cpp +++ b/OOXML/PPTXFormat/ShowPr/SldRg.cpp @@ -34,7 +34,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { void SldRg::fromXML(XmlUtils::CXmlNode& node) { @@ -94,5 +94,5 @@ namespace PPTX void SldRg::FillParentPointersForChilds() { } - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ShowPr/SldRg.h b/OOXML/PPTXFormat/ShowPr/SldRg.h index c3316cc6e2..96044c3fde 100644 --- a/OOXML/PPTXFormat/ShowPr/SldRg.h +++ b/OOXML/PPTXFormat/ShowPr/SldRg.h @@ -35,7 +35,7 @@ namespace PPTX { - namespace nsPresentationPr + namespace nsPresentation { class SldRg : public WrapperWritingElement { @@ -55,5 +55,5 @@ namespace PPTX protected: virtual void FillParentPointersForChilds(); }; - } // namespace nsPresentationPr + } // namespace nsPresentation } // namespace PPTX diff --git a/OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp b/OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp index 9ebb481790..4dcfb4ede1 100644 --- a/OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp +++ b/OOXML/PPTXFormat/ViewProps/OutlineViewPr.cpp @@ -36,6 +36,70 @@ namespace PPTX { namespace nsViewProps { + void Sld::fromXML(XmlUtils::CXmlNode& node) + { + XmlMacroReadAttributeBase(node, L"id", id); + XmlMacroReadAttributeBase(node, L"collapse", collapse); + } + std::wstring Sld::toXML() const + { + XmlUtils::CAttribute oAttr; + oAttr.Write(_T("id"), id); + oAttr.Write(_T("collapse"), collapse); + + return XmlUtils::CreateNode(_T("p:sld"), oAttr); + } + void Sld::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const + { + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); + + pWriter->WriteString2(0, id); + pWriter->WriteBool2(1, collapse); + + pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); + } + void Sld::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) + { + LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 4; + pReader->Skip(1); // start attributes + + while (true) + { + BYTE _at = pReader->GetUChar_TypeNode(); + if (_at == NSBinPptxRW::g_nodeAttributeEnd) + break; + + switch (_at) + { + case 0: + { + id = pReader->GetString2(); + }break; + case 1: + { + collapse = pReader->GetBool(); + }break; + default: + break; + } + } + pReader->Seek(_end_rec); + } + void Sld::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const + { + pWriter->StartNode(_T("p:sld")); + + pWriter->StartAttributes(); + pWriter->WriteAttribute(_T("id"), id); + pWriter->WriteAttribute(_T("collapse"), collapse); + pWriter->EndAttributes(); + + pWriter->EndNode(_T("p:sld")); + } + void Sld::FillParentPointersForChilds() + { + } +//----------------------------------------------------------------------------------------------------------------------------- OutlineViewPr& OutlineViewPr::operator=(const OutlineViewPr& oSrc) { parentFile = oSrc.parentFile; diff --git a/OOXML/PPTXFormat/ViewProps/OutlineViewPr.h b/OOXML/PPTXFormat/ViewProps/OutlineViewPr.h index e1f64dd487..12471e522a 100644 --- a/OOXML/PPTXFormat/ViewProps/OutlineViewPr.h +++ b/OOXML/PPTXFormat/ViewProps/OutlineViewPr.h @@ -33,12 +33,30 @@ #include "./../WrapperWritingElement.h" #include "CViewPr.h" -#include "Sld.h" namespace PPTX { namespace nsViewProps { + class Sld : public WrapperWritingElement + { + public: + PPTX_LOGIC_BASE(Sld) + + virtual void fromXML(XmlUtils::CXmlNode& node); + virtual std::wstring toXML() const; + + virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; + virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); + virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + nullable_string id; + nullable_bool collapse; + + protected: + virtual void FillParentPointersForChilds(); + }; + class OutlineViewPr : public WrapperWritingElement { public: diff --git a/OOXML/PPTXFormat/ViewProps/Sld.cpp b/OOXML/PPTXFormat/ViewProps/Sld.cpp deleted file mode 100644 index d0bdc18832..0000000000 --- a/OOXML/PPTXFormat/ViewProps/Sld.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "Sld.h" - -namespace PPTX -{ - namespace nsViewProps - { - void Sld::fromXML(XmlUtils::CXmlNode& node) - { - XmlMacroReadAttributeBase(node, L"id", id); - XmlMacroReadAttributeBase(node, L"collapse", collapse); - } - std::wstring Sld::toXML() const - { - XmlUtils::CAttribute oAttr; - oAttr.Write(_T("id"), id); - oAttr.Write(_T("collapse"), collapse); - - return XmlUtils::CreateNode(_T("p:sld"), oAttr); - } - void Sld::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const - { - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); - - pWriter->WriteString2(0, id); - pWriter->WriteBool2(1, collapse); - - pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); - } - void Sld::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) - { - LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 4; - pReader->Skip(1); // start attributes - - while (true) - { - BYTE _at = pReader->GetUChar_TypeNode(); - if (_at == NSBinPptxRW::g_nodeAttributeEnd) - break; - - switch (_at) - { - case 0: - { - id = pReader->GetString2(); - }break; - case 1: - { - collapse = pReader->GetBool(); - }break; - default: - break; - } - } - pReader->Seek(_end_rec); - } - void Sld::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const - { - pWriter->StartNode(_T("p:sld")); - - pWriter->StartAttributes(); - pWriter->WriteAttribute(_T("id"), id); - pWriter->WriteAttribute(_T("collapse"), collapse); - pWriter->EndAttributes(); - - pWriter->EndNode(_T("p:sld")); - } - void Sld::FillParentPointersForChilds() - { - } - } // namespace nsViewProps -} // namespace PPTX - diff --git a/OOXML/PPTXFormat/ViewProps/Sld.h b/OOXML/PPTXFormat/ViewProps/Sld.h deleted file mode 100644 index 0b0bc242fb..0000000000 --- a/OOXML/PPTXFormat/ViewProps/Sld.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ -#pragma once - -#include "./../WrapperWritingElement.h" -#include "./../Limit/Orient.h" - -namespace PPTX -{ - namespace nsViewProps - { - class Sld : public WrapperWritingElement - { - public: - PPTX_LOGIC_BASE(Sld) - - virtual void fromXML(XmlUtils::CXmlNode& node); - virtual std::wstring toXML() const; - - virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; - virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); - virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - - nullable_string id; - nullable_bool collapse; - - protected: - virtual void FillParentPointersForChilds(); - }; - } // namespace nsViewProps -} // namespace PPTX - diff --git a/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro b/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro index 182a0505f2..f339dd4034 100644 --- a/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro +++ b/OOXML/Projects/Linux/PPTXFormatLib/PPTXFormatLib.pro @@ -96,7 +96,6 @@ SOURCES += \ ../../../PPTXFormat/ViewProps/Ratio.cpp \ ../../../PPTXFormat/ViewProps/Restored.cpp \ ../../../PPTXFormat/ViewProps/Scale.cpp \ - ../../../PPTXFormat/ViewProps/Sld.cpp \ ../../../PPTXFormat/ViewProps/SlideViewPr.cpp \ ../../../PPTXFormat/ViewProps/SorterViewPr.cpp \ \ @@ -110,18 +109,12 @@ SOURCES += \ ../../../PPTXFormat/ShowPr/PresentationPr.cpp \ ../../../PPTXFormat/ShowPr/Present.cpp \ ../../../PPTXFormat/ShowPr/Kiosk.cpp \ - ../../../PPTXFormat/ShowPr/CustShow.cpp \ + ../../../PPTXFormat/ShowPr/CustomShowId.cpp \ ../../../PPTXFormat/ShowPr/Browse.cpp \ ../../../PPTXFormat/ShowPr/SldRg.cpp \ ../../../PPTXFormat/ShowPr/SldAll.cpp \ \ - ../../../PPTXFormat/Presentation/NotesSz.cpp \ - ../../../PPTXFormat/Presentation/PhotoAlbum.cpp \ - ../../../PPTXFormat/Presentation/EmbeddedFont.cpp \ - ../../../PPTXFormat/Presentation/EmbeddedFontDataId.cpp \ - ../../../PPTXFormat/Presentation/Kinsoku.cpp \ - ../../../PPTXFormat/Presentation/SectionLst.cpp \ - ../../../PPTXFormat/Presentation/SldSz.cpp + ../../../PPTXFormat/Presentation/PresentationChildElements.cpp HEADERS += \ pptx_format.h \ @@ -155,12 +148,7 @@ HEADERS += \ ../../../PPTXFormat/DrawingConverter/ASCOfficeDrawingConverter.h \ ../../../PPTXFormat/DrawingConverter/ASCOfficePPTXFile.h \ \ - ../../../PPTXFormat/Presentation/EmbeddedFont.h \ - ../../../PPTXFormat/Presentation/EmbeddedFontDataId.h \ - ../../../PPTXFormat/Presentation/Kinsoku.h \ - ../../../PPTXFormat/Presentation/NotesSz.h \ - ../../../PPTXFormat/Presentation/PhotoAlbum.h \ - ../../../PPTXFormat/Presentation/SldSz.h \ + ../../../PPTXFormat/Presentation/PresentationChildElements.h \ \ ../../../PPTXFormat/Theme/ClrScheme.h \ ../../../PPTXFormat/Theme/ExtraClrScheme.h \ @@ -181,7 +169,6 @@ HEADERS += \ ../../../PPTXFormat/ViewProps/Ratio.h \ ../../../PPTXFormat/ViewProps/Restored.h \ ../../../PPTXFormat/ViewProps/Scale.h \ - ../../../PPTXFormat/ViewProps/Sld.h \ ../../../PPTXFormat/ViewProps/SlideViewPr.h \ ../../../PPTXFormat/ViewProps/SorterViewPr.h \ \ @@ -199,7 +186,7 @@ HEADERS += \ ../../../Binary/Presentation/DefaultNotesTheme.h \ \ ../../../PPTXFormat/ShowPr/Browse.h \ - ../../../PPTXFormat/ShowPr/CustShow.h \ + ../../../PPTXFormat/ShowPr/CustomShowId.h \ ../../../PPTXFormat/ShowPr/Kiosk.h \ ../../../PPTXFormat/ShowPr/Present.h \ ../../../PPTXFormat/ShowPr/PresentationPr.h \ diff --git a/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj b/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj index bfed147632..6b50a09fd3 100644 --- a/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj +++ b/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj @@ -623,16 +623,10 @@ - - - - - - - + - + @@ -662,7 +656,6 @@ - @@ -1254,16 +1247,10 @@ - - - - - - - + - + @@ -1293,7 +1280,6 @@ - diff --git a/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj.filters b/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj.filters index 2e2a4ba88d..b82060a2bb 100644 --- a/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj.filters +++ b/OOXML/Projects/Windows/PPTXFormatLib/PPTXFormat.vcxproj.filters @@ -685,31 +685,13 @@ Logic\Transition - - Presentation - - - Presentation - - - Presentation - - - Presentation - - - Presentation - - - Presentation - - + Presentation PresentationPr - + PresentationPr @@ -778,9 +760,6 @@ ViewProps - - ViewProps - ViewProps @@ -2451,31 +2430,13 @@ Logic - - Presentation - - - Presentation - - - Presentation - - - Presentation - - - Presentation - - - Presentation - - + Presentation PresentationPr - + PresentationPr @@ -2514,9 +2475,6 @@ ViewProps - - ViewProps - ViewProps diff --git a/OdfFile/DataTypes/textposition.cpp b/OdfFile/DataTypes/textposition.cpp index 096960892a..c939813418 100644 --- a/OdfFile/DataTypes/textposition.cpp +++ b/OdfFile/DataTypes/textposition.cpp @@ -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 { diff --git a/OdfFile/Reader/Converter/docx_conversion_context.cpp b/OdfFile/Reader/Converter/docx_conversion_context.cpp index e325fba341..c5898d0343 100644 --- a/OdfFile/Reader/Converter/docx_conversion_context.cpp +++ b/OdfFile/Reader/Converter/docx_conversion_context.cpp @@ -166,12 +166,12 @@ docx_conversion_context::~docx_conversion_context() { } -void docx_conversion_context::set_implicit_end( bool _flag ) // сеттер для флага в одном файле ( где 5й параграф создается ) +void docx_conversion_context::set_implicit_end( bool _flag ) // fix bug with convert from docx to odt. Bug with break columns { flag_implicit_end = _flag; } -bool docx_conversion_context::get_implicit_end() const // геттер для флага в другом файле ( где после создания 5го параграфа _is_dump = true ) +bool docx_conversion_context::get_implicit_end() const // fix bug with convert from docx to odt. Bug with break columns { return flag_implicit_end; } diff --git a/OdfFile/Reader/Converter/oox_title.cpp b/OdfFile/Reader/Converter/oox_title.cpp index 90589c8ac8..4b9abead6b 100644 --- a/OdfFile/Reader/Converter/oox_title.cpp +++ b/OdfFile/Reader/Converter/oox_title.cpp @@ -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") { diff --git a/OdfFile/Reader/Format/style_text_properties.cpp b/OdfFile/Reader/Format/style_text_properties.cpp index 6ee05320c2..5200b2762a 100644 --- a/OdfFile/Reader/Format/style_text_properties.cpp +++ b/OdfFile/Reader/Format/style_text_properties.cpp @@ -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) diff --git a/OdfFile/Writer/Converter/DocxConverter.cpp b/OdfFile/Writer/Converter/DocxConverter.cpp index 13d936fcc6..2b03b941b0 100644 --- a/OdfFile/Writer/Converter/DocxConverter.cpp +++ b/OdfFile/Writer/Converter/DocxConverter.cpp @@ -309,7 +309,7 @@ void DocxConverter::convert_document() { current_section_properties = §ions[sect]; - for (size_t i = sections[sect].start_para; i < sections[sect].end_para; ++i) + for (size_t i = sections[sect].start_para; i < sections[sect].end_para; ++i) { convert(doc->m_arrItems[i]); } @@ -875,6 +875,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) } if(oox_paragraph->m_oParagraphProperty) + convert(oox_paragraph->m_oParagraphProperty->m_oRPr.GetPointer(), text_properties); } if (odt_context->in_drop_cap()) @@ -947,7 +948,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) } //--------------------------------------------------------------------------------------------------------------------- - for (size_t i = 0; i < oox_paragraph->m_arrItems.size(); ++i) + for (size_t i = 0; i < oox_paragraph->m_arrItems.size(); ++i) { //те элементы которые тока для Paragraph - здесь - остальные в общей куче switch(oox_paragraph->m_arrItems[i]->getType()) @@ -1046,12 +1047,18 @@ void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 OOX::Logic::CBr* pBr= dynamic_cast(oox_run->m_arrItems[i]); if (pBr) { - int type = pBr->m_oType.GetValue(); - - bool need_restart_para = odt_context->text_context()->set_type_break(type, pBr->m_oClear.GetValue()); + if( !odt_context->pendingBreakType ) // for bug when we have text and after conversion we have early break column (check bug 73365) + { + odt_context->pendingBreakType = true; + odt_context->m_pendingBreakType = pBr->m_oType.GetValue(); + } - if (need_restart_para) - odt_context->add_paragraph_break(type); + // int type = pBr->m_oType.GetValue(); + + // bool need_restart_para = odt_context->text_context()->set_type_break(type, pBr->m_oClear.GetValue()); + + // if (need_restart_para) + // odt_context->add_paragraph_break(type); } }break; case OOX::et_w_t: @@ -2241,8 +2248,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty* oox_section_pr, bool b { odt_context->add_section(continuous); } - - if (bSection && oox_section_pr->m_oCols.IsInit()) + if ( oox_section_pr->m_oCols.IsInit() ) { int num_columns = oox_section_pr->m_oCols->m_oNum.IsInit() ? oox_section_pr->m_oCols->m_oNum->GetValue() : 1; @@ -2254,10 +2260,21 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty* oox_section_pr, bool b bool separator = oox_section_pr->m_oCols->m_oSep.IsInit() && oox_section_pr->m_oCols->m_oSep->ToBool(); - odt_context->add_section_columns(num_columns, - oox_section_pr->m_oCols->m_arrColumns.size() > 0 ? -1 : default_space_pt , separator ); + bool flag; + if( oox_section_pr->m_oCols->m_oEqualWidth.IsInit() ) + { + flag = true; + } + else + { + flag = false; + } - if (num_columns > 1) // + odt_context->add_section_columns(num_columns, + oox_section_pr->m_oCols->m_arrColumns.size() > 0 ? -1 : default_space_pt , + separator, flag ); + + if (num_columns > 1) { std::vector> width_space; diff --git a/OdfFile/Writer/Converter/PptxConverter.cpp b/OdfFile/Writer/Converter/PptxConverter.cpp index 4bc2d877ef..778cee8345 100644 --- a/OdfFile/Writer/Converter/PptxConverter.cpp +++ b/OdfFile/Writer/Converter/PptxConverter.cpp @@ -74,8 +74,7 @@ #include "../../../OOXML/PPTXFormat/Logic/Transitions/SplitTransition.h" #include "../../../OOXML/PPTXFormat/Logic/Transitions/ZoomTransition.h" -#include "../../../OOXML/PPTXFormat/Presentation/SldSz.h" -#include "../../../OOXML/PPTXFormat/Presentation/NotesSz.h" +#include "../../../OOXML/PPTXFormat/Presentation/PresentationChildElements.h" #include "../../../OOXML/DocxFormat/Core.h" #include "../../../OOXML/DocxFormat/App.h" diff --git a/OdfFile/Writer/Format/odf_drawing_context.cpp b/OdfFile/Writer/Format/odf_drawing_context.cpp index 22a83329bf..2756edb15b 100644 --- a/OdfFile/Writer/Format/odf_drawing_context.cpp +++ b/OdfFile/Writer/Format/odf_drawing_context.cpp @@ -637,7 +637,8 @@ void odf_drawing_context::end_drawing() draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.drawooo_display_ = L"printer"; // L"none" ??? if (!impl_->current_drawing_state_.xml_id_.empty()) draw->xml_id_ = impl_->current_drawing_state_.xml_id_; - if (impl_->anchor_settings_.style_wrap_) + + if (impl_->anchor_settings_.style_wrap_ && impl_->current_graphic_properties) impl_->current_graphic_properties->style_wrap_ = *impl_->anchor_settings_.style_wrap_; std::wstring strTransform; diff --git a/OdfFile/Writer/Format/ods_table_state.cpp b/OdfFile/Writer/Format/ods_table_state.cpp index c294b3eb18..968d24da54 100644 --- a/OdfFile/Writer/Format/ods_table_state.cpp +++ b/OdfFile/Writer/Format/ods_table_state.cpp @@ -129,18 +129,26 @@ namespace utils//////////////////////////////////////////// ОБЩАЯ хрен } std::wstring convert_date_time(const std::wstring & oox_time, office_value_type::type & type) { - double dDateTime = 0; + double dDateTime = 0, dTime = 0; + int nDate = 0; - try + if (std::wstring::npos != oox_time.find(L".")) { - dDateTime = boost::lexical_cast(oox_time); + try + { + dDateTime = boost::lexical_cast(oox_time); + } + catch (...) + { + return oox_time; + } + nDate = (int)dDateTime; + dTime = (dDateTime - nDate); } - catch (...) + else { - return oox_time; + nDate = boost::lexical_cast(oox_time); } - int nDate = (int)dDateTime; - double dTime = (dDateTime - nDate); std::wstring sDate, sTime; if (dTime > 0) @@ -1345,21 +1353,11 @@ void ods_table_state::set_cell_value(const std::wstring & value, bool need_cash) cell->attlist_.common_value_and_type_attlist_->office_boolean_value_ = value; break; case office_value_type::Date: - { - std::wstring date = utils::convert_date(value); - cell->attlist_.common_value_and_type_attlist_->office_date_value_ = date; - //cell->attlist_.common_value_and_type_attlist_->office_value_ = date; - }break; case office_value_type::Time: - { - cell->attlist_.common_value_and_type_attlist_->office_time_value_ = utils::convert_time(value); - }break; - case office_value_type::DateTime: + case office_value_type::DateTime: { std::wstring sVal = utils::convert_date_time(value, type); - //cell->attlist_.common_value_and_type_attlist_->office_value_ = sVal; - if (type == office_value_type::Date) cell->attlist_.common_value_and_type_attlist_->office_date_value_ = sVal; else diff --git a/OdfFile/Writer/Format/odt_conversion_context.cpp b/OdfFile/Writer/Format/odt_conversion_context.cpp index 052bb5cb45..5a34752ab8 100644 --- a/OdfFile/Writer/Format/odt_conversion_context.cpp +++ b/OdfFile/Writer/Format/odt_conversion_context.cpp @@ -326,6 +326,13 @@ void odt_conversion_context::end_drawing_context() } void odt_conversion_context::start_paragraph(bool styled) { + if (pendingBreakType) // for bug when we have text and after conversion we have early break column (check bug 73365) + { + add_paragraph_break(m_pendingBreakType); + m_pendingBreakType = -1; + pendingBreakType = false; + } + if (false == current_fields.empty() && current_fields.back().status == 1 && false == current_fields.back().in_span) { current_fields.back().status = 2; @@ -1106,7 +1113,7 @@ void odt_conversion_context::add_section(bool continuous) sections_.push_back(state); } -void odt_conversion_context::add_section_columns(int count, double space_pt, bool separator) +void odt_conversion_context::add_section_columns(int count, double space_pt, bool separator, bool flag) { if (sections_.empty() || count < 1) return; @@ -1114,6 +1121,15 @@ void odt_conversion_context::add_section_columns(int count, double space_pt, boo if (!style_)return; style_section_properties* section_properties = style_->content_.add_get_style_section_properties(); + + if( flag ) // for bug when we have implicit break column (check bug 73365) + { + section_properties->text_dont_balance_text_columns_ = flag; + } + else if( !flag ) + { + section_properties->text_dont_balance_text_columns_ = flag; + } create_element(L"style", L"columns", section_properties->style_columns_,this); diff --git a/OdfFile/Writer/Format/odt_conversion_context.h b/OdfFile/Writer/Format/odt_conversion_context.h index 6f64ba5507..7a1f78adfd 100644 --- a/OdfFile/Writer/Format/odt_conversion_context.h +++ b/OdfFile/Writer/Format/odt_conversion_context.h @@ -142,7 +142,7 @@ public: void end_run (); void add_section (bool continuous); - void add_section_columns (int count, double space_pt, bool separator ); + void add_section_columns (int count, double space_pt, bool separator, bool flag ); void add_section_column (std::vector> width_space); int get_current_section_columns (); void flush_section (); @@ -202,6 +202,9 @@ public: bool empty() {return current_root_elements_.empty();} + int m_pendingBreakType = -1; + bool pendingBreakType = false; + private: void start_table_header_rows(); void end_table_header_rows (); diff --git a/PdfFile/lib/xpdf/XRef.cc b/PdfFile/lib/xpdf/XRef.cc index 1b2721be13..91014b9d7d 100644 --- a/PdfFile/lib/xpdf/XRef.cc +++ b/PdfFile/lib/xpdf/XRef.cc @@ -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) { diff --git a/RtfFile/Format/DestinationCommand.cpp b/RtfFile/Format/DestinationCommand.cpp index d283b381d2..de7a4ef770 100644 --- a/RtfFile/Format/DestinationCommand.cpp +++ b/RtfFile/Format/DestinationCommand.cpp @@ -1130,10 +1130,20 @@ bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRea COMMAND_RTF_BOOL( "b" , charProps->m_bBold, sCommand, hasParameter, parameter) COMMAND_RTF_BOOL( "caps" , charProps->m_bCaps, sCommand, hasParameter, parameter) COMMAND_RTF_INT ( "charscalex" , charProps->m_nScalex, sCommand, hasParameter, parameter) - COMMAND_RTF_INT ( "cs" , charProps->m_nCharStyle, sCommand, hasParameter, parameter) + //COMMAND_RTF_INT ( "cs" , charProps->m_nCharStyle, sCommand, hasParameter, parameter) COMMAND_RTF_INT ( "down" , charProps->m_nDown, sCommand, hasParameter, parameter) COMMAND_RTF_BOOL( "embo" , charProps->m_bEmbo, sCommand, hasParameter, parameter) COMMAND_RTF_INT ( "expndtw" , charProps->m_nCharacterSpacing, sCommand, hasParameter, parameter) + else if ("cs" == sCommand) + { + if (true == hasParameter) + charProps->m_nCharStyle = parameter; +#ifdef USE_STYLE_COLOR + if (charProps->m_nForeColor == PROP_DEF) + charProps->m_nForeColor = 0; +#endif + } + else if ( "expnd" == sCommand ) { if ( hasParameter ) @@ -1185,9 +1195,16 @@ bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRea else charProps->m_eUnderStyle = RtfCharProperty::uls_Single; } + else if ( "uld" == sCommand ) + { + if ( hasParameter && 0 == parameter) + charProps->m_eUnderStyle = RtfCharProperty::uls_none; + else + charProps->m_eUnderStyle = RtfCharProperty::uls_Dotted; + } //COMMAND_RTF_BOOL( "ul", charProps->m_bUnderline, sCommand, hasParameter, parameter) COMMAND_RTF_INT ( "ulc", charProps->m_nUnderlineColor, sCommand, hasParameter, parameter) - COMMAND_RTF_INT ( "uld", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dotted) + //COMMAND_RTF_INT ( "uld", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dotted) COMMAND_RTF_INT ( "uldash", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dashed) COMMAND_RTF_INT ( "uldashd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dotted) COMMAND_RTF_INT ( "uldashdd", charProps->m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dot_dotted) @@ -1237,6 +1254,12 @@ bool RtfCharPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRea { charProps->m_nCharacterSpacing = PROP_DEF; } +#ifdef USE_STYLE_COLOR + else if (("sbasedon" == sCommand) && (charProps->m_bBold == PROP_DEF)) + { + charProps->m_bBold = 0; + } +#endif else { if (RtfShadingCharCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, charProps->m_poShading)) @@ -5055,7 +5078,15 @@ bool RtfStyleTableReader::RtfStyleReader::ExecuteCommand(RtfDocument& oDocument, m_oCurStyle->m_nID = parameter; } } - COMMAND_RTF_INT( "sbasedon", m_oCurStyle->m_nBasedOn, sCommand, hasParameter, parameter ) +#ifdef USE_STYLE_COLOR + COMMAND_RTF_INT( "sbasedon", m_oCurStyle->m_nBasedOn, sCommand, hasParameter, parameter ); + if (m_oCurStyle->m_nBasedOn != PROP_DEF) + { + RtfCharPropsCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, &oReader.m_oState->m_oCharProp ); + } +#else + COMMAND_RTF_INT( "sbasedon", m_oCurStyle->m_nBasedOn, sCommand, hasParameter, parameter ) +#endif COMMAND_RTF_INT( "snext", m_oCurStyle->m_nNext, sCommand, hasParameter, parameter ) COMMAND_RTF_INT( "slink", m_oCurStyle->m_nLink, sCommand, hasParameter, parameter ) COMMAND_RTF_BOOL( "sqformat", m_oCurStyle->m_bQFormat, sCommand, hasParameter, parameter ) diff --git a/RtfFile/Format/RtfLex.cpp b/RtfFile/Format/RtfLex.cpp index a1ea4f44e5..94e524a9c3 100644 --- a/RtfFile/Format/RtfLex.cpp +++ b/RtfFile/Format/RtfLex.cpp @@ -176,8 +176,8 @@ RtfToken RtfLex::NextToken() c = m_oStream.getc( ); - while ( c >= 0 && c <= 0x1f ) - c = m_oStream.getc( ); + while ((c >= 0 && c <= 8) || (c >= 10 && c <= 0x1f)) + c = m_oStream.getc( ); if (c != EOF) { @@ -240,7 +240,7 @@ void RtfLex::parseKeyword(RtfToken& token) token.Type = RtfToken::Keyword; token.Key = std::string("tab"); } - else if( c == '\n' ) + else if( c == '\n'|| c == '\r' ) { token.Type = RtfToken::Keyword; token.Key = std::string("par"); diff --git a/RtfFile/Format/RtfProperty.cpp b/RtfFile/Format/RtfProperty.cpp index 1969079b65..243abd8b84 100644 --- a/RtfFile/Format/RtfProperty.cpp +++ b/RtfFile/Format/RtfProperty.cpp @@ -2432,7 +2432,15 @@ std::wstring RtfListOverrideProperty::ListOverrideLevels::RenderToOOX(RenderPara sResult += L""; if ( PROP_DEF != OverrideLevel.m_nStart ) sResult += L""; - sResult += OverrideLevel.m_oLevel.RenderToOOX2(oRenderParameter, OverrideLevel.m_nLevelIndex); + if ( PROP_DEF != OverrideLevel.m_nLevelIndex ) + { + sResult += OverrideLevel.m_oLevel.RenderToOOX2(oRenderParameter, OverrideLevel.m_nLevelIndex); + } + else + { + sResult += OverrideLevel.m_oLevel.RenderToOOX2(oRenderParameter, index); + } + //sResult += OverrideLevel.m_oLevel.RenderToOOX2(oRenderParameter, OverrideLevel.m_nLevelIndex); sResult += L""; index_prev = index; diff --git a/RtfFile/Format/RtfReader.cpp b/RtfFile/Format/RtfReader.cpp index db7a3a4440..8fc48372a2 100644 --- a/RtfFile/Format/RtfReader.cpp +++ b/RtfFile/Format/RtfReader.cpp @@ -236,6 +236,11 @@ bool RtfAbstractReader::RtfAbstractReader::Parse(RtfDocument& oDocument, RtfRead oReader.m_oState->m_sCurText += " "; oReader.m_oState->m_bControlPresent = true; } + if (m_oTok.Key == "par" && false == m_oTok.HasParameter) + { + oReader.m_oState->m_sCurText += "\n"; + oReader.m_oState->m_bControlPresent = true; + } }break; case RtfToken::Text: { diff --git a/RtfFile/Projects/Linux/RtfFormatLib.pro b/RtfFile/Projects/Linux/RtfFormatLib.pro index d9bf20f68c..38f016d883 100644 --- a/RtfFile/Projects/Linux/RtfFormatLib.pro +++ b/RtfFile/Projects/Linux/RtfFormatLib.pro @@ -23,6 +23,9 @@ DEFINES += UNICODE _UNICODE \ DONT_WRITE_EMBEDDED_FONTS \ AVS_USE_CONVERT_PPTX_TOCUSTOM_VML +# see bug 57050 +#DEFINES += USE_STYLE_COLOR + INCLUDEPATH += ../../../OdfFile/include core_release { diff --git a/UnicodeConverter/UnicodeConverter.cpp b/UnicodeConverter/UnicodeConverter.cpp index 18f312dff7..1a4ebeea40 100644 --- a/UnicodeConverter/UnicodeConverter.cpp +++ b/UnicodeConverter/UnicodeConverter.cpp @@ -37,8 +37,6 @@ #include "unicode/ucnv.h" /* C Converter API */ #include "unicode/usprep.h" -//#include "../DesktopEditor/common/File.h" - #if !defined (_WIN32) && !defined (_WIN64) #if defined (_LINUX) && !defined(__ANDROID__) && !defined(_IOS) && !defined(_MAC) #define USE_ICONV @@ -48,6 +46,14 @@ #include #endif +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + std::string g_overrideIcuDataPath = ""; namespace NSUnicodeConverter diff --git a/X2tConverter/test/qmake/main.cpp b/X2tConverter/test/qmake/main.cpp index c1ff84e987..68e2f3a639 100644 --- a/X2tConverter/test/qmake/main.cpp +++ b/X2tConverter/test/qmake/main.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) std::wstring wsep = FILE_SEPARATOR_STR; std::wstring filename_in = curr_dir + wsep + L"123.docx"; - std::wstring filename_out = curr_dir + wsep + L"123.pdf"; + std::wstring filename_out = curr_dir + wsep + L"123.odt"; std::wstring fonts_dir = curr_dir + wsep + L"fonts"; std::wstring xml = curr_dir + wsep + L"params.xml";