diff --git a/Common/Network/WebSocket/websocket.pri b/Common/Network/WebSocket/websocket.pri index ab15dbc670..d6a0a9ca46 100644 --- a/Common/Network/WebSocket/websocket.pri +++ b/Common/Network/WebSocket/websocket.pri @@ -1,11 +1,9 @@ core_mac:CONFIG += apple_platform core_ios:CONFIG += apple_platform -apple_platform { - CONFIG += socketrocket -} else { - CONFIG += ixwebsocket -} +# since 7.3: ONLY socketio +#apple_platform:CONFIG += socketrocket +#!apple_platform:CONFIG += ixwebsocket CONFIG += libsocketio diff --git a/DesktopEditor/Word_Api/Editor_Defines.h b/DesktopEditor/Word_Api/Editor_Defines.h index 1fc8537347..555e74a651 100644 --- a/DesktopEditor/Word_Api/Editor_Defines.h +++ b/DesktopEditor/Word_Api/Editor_Defines.h @@ -689,6 +689,12 @@ #define c_oAscContentControlSpecificTypeDateTime 5 #define c_oAscContentControlSpecificTypeTOC 10 +#define c_oAscEDocProtectComments 0 +#define c_oAscEDocProtectForms 1 +#define c_oAscEDocProtectNone 2 +#define c_oAscEDocProtectReadOnly 3 +#define c_oAscEDocProtectTrackedChanges 4 + #define INSERT_PAGE_NUM_PARAM(AlignV, AlignH) ((AlignV << 16) | AlignH) // MENU COMMANDS diff --git a/DesktopEditor/graphics/IRenderer.h b/DesktopEditor/graphics/IRenderer.h index f1cb19db54..c441bb54e9 100644 --- a/DesktopEditor/graphics/IRenderer.h +++ b/DesktopEditor/graphics/IRenderer.h @@ -324,6 +324,7 @@ public: virtual HRESULT AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip) {return S_OK;} virtual HRESULT AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage) {return S_OK;} virtual HRESULT AddFormField(IFormField* pField) {return S_OK;} + virtual HRESULT DocInfo(const std::wstring& wsTitle, const std::wstring& wsCreator, const std::wstring& wsSubject, const std::wstring& wsKeywords) {return S_OK;} }; #define PROPERTY_RENDERER(NameBase, Name, Type) \ diff --git a/DesktopEditor/graphics/MetafileToRenderer.cpp b/DesktopEditor/graphics/MetafileToRenderer.cpp index 9c8c83bbb5..64532225bb 100644 --- a/DesktopEditor/graphics/MetafileToRenderer.cpp +++ b/DesktopEditor/graphics/MetafileToRenderer.cpp @@ -1221,6 +1221,16 @@ namespace NSOnlineOfficeBinToPdf break; } + case ctDocInfo: + { + std::wstring wsTitle = ReadString(current, curindex); + std::wstring wsCreator = ReadString(current, curindex); + std::wstring wsSubject = ReadString(current, curindex); + std::wstring wsKeywords = ReadString(current, curindex); + + pRenderer->DocInfo(wsTitle, wsCreator, wsSubject, wsKeywords); + break; + } default: { break; diff --git a/DesktopEditor/graphics/MetafileToRenderer.h b/DesktopEditor/graphics/MetafileToRenderer.h index 09667a582b..7b298fbb07 100644 --- a/DesktopEditor/graphics/MetafileToRenderer.h +++ b/DesktopEditor/graphics/MetafileToRenderer.h @@ -178,6 +178,7 @@ namespace NSOnlineOfficeBinToPdf ctHyperlink = 160, ctLink = 161, ctFormField = 162, + ctDocInfo = 163, ctPageWidth = 200, ctPageHeight = 201, diff --git a/DesktopEditor/graphics/pro/js/drawingfile.json b/DesktopEditor/graphics/pro/js/drawingfile.json index 059921ba32..f53041d321 100644 --- a/DesktopEditor/graphics/pro/js/drawingfile.json +++ b/DesktopEditor/graphics/pro/js/drawingfile.json @@ -42,7 +42,7 @@ "wasm/src/lib", "../../../agg-2.4/include", "../../../cximage/jasper/include", "../../../cximage/jpeg", "../../../cximage/png", "freetype-2.10.4/include", "freetype-2.10.4/include/freetype", "../../../../OfficeUtils/src/zlib-1.2.11", "../../../../OfficeUtils/src", "../../../../Common/3dParty/icu/icu/source/common", "../../../xml/libxml2/include", "../../../xml/build/qt", "../../../../OfficeUtils/src/zlib-1.2.11/contrib/minizip", "../../../../PdfFile/lib/goo", "../../../../PdfFile/lib/fofi", "../../../../PdfFile/lib/splash", "../../../../PdfFile/lib", "../../../raster/Jp2/openjpeg", "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2" ], "define": [ - "__linux__", "_LINUX", "UNIX", "FT2_BUILD_LIBRARY", "HAVE_FCNTL_H", "FT_CONFIG_OPTION_SYSTEM_ZLIB", "BUILDING_WASM_MODULE", "CMAP_USE_MEMORY", "U_COMMON_IMPLEMENTATION", "errno=0", "THREADMODEL=0", "DEBUGLVL=0", "HAVE_MBSTATE_T", "HAVE_STDINCLUDES", "HAS_WCHAR", "HAVE_VA_COPY", "LIBXML_READER_ENABLED", "LIBXML_PUSH_ENABLED", "LIBXML_HTML_ENABLED", "LIBXML_XPATH_ENABLED", "LIBXML_OUTPUT_ENABLED", "LIBXML_C14N_ENABLED", "LIBXML_SAX1_ENABLED", "LIBXML_TREE_ENABLED", "LIBXML_XPTR_ENABLED", "IN_LIBXML", "LIBXML_STATIC", "BUILD_ZLIB_AS_SOURCES", "_ARM_ALIGN_", "_tcsnicmp=strncmp", "_lseek=lseek", "_getcwd=getcwd", "NO_CONSOLE_IO", "USE_EXTERNAL_JPEG2000", "USE_JPIP", "OPJ_STATIC" + "__linux__", "_LINUX", "UNIX", "FT2_BUILD_LIBRARY", "HAVE_FCNTL_H", "FT_CONFIG_OPTION_SYSTEM_ZLIB", "BUILDING_WASM_MODULE", "U_COMMON_IMPLEMENTATION", "errno=0", "THREADMODEL=0", "DEBUGLVL=0", "HAVE_MBSTATE_T", "HAVE_STDINCLUDES", "HAS_WCHAR", "HAVE_VA_COPY", "LIBXML_READER_ENABLED", "LIBXML_PUSH_ENABLED", "LIBXML_HTML_ENABLED", "LIBXML_XPATH_ENABLED", "LIBXML_OUTPUT_ENABLED", "LIBXML_C14N_ENABLED", "LIBXML_SAX1_ENABLED", "LIBXML_TREE_ENABLED", "LIBXML_XPTR_ENABLED", "IN_LIBXML", "LIBXML_STATIC", "BUILD_ZLIB_AS_SOURCES", "_ARM_ALIGN_", "_tcsnicmp=strncmp", "_lseek=lseek", "_getcwd=getcwd", "NO_CONSOLE_IO", "USE_EXTERNAL_JPEG2000", "USE_JPIP", "OPJ_STATIC" ], "compile_files_array": [ { diff --git a/DesktopEditor/graphics/pro/js/qt/nativegraphics.pro b/DesktopEditor/graphics/pro/js/qt/nativegraphics.pro index b70cab5222..6ca05b54e4 100644 --- a/DesktopEditor/graphics/pro/js/qt/nativegraphics.pro +++ b/DesktopEditor/graphics/pro/js/qt/nativegraphics.pro @@ -11,7 +11,6 @@ CONFIG -= app_bundle DEFINES += TEST_CPP_BINARY \ GRAPHICS_NO_USE_DYNAMIC_LIBRARY \ BUILDING_WASM_MODULE \ - CMAP_USE_MEMORY \ _QT CORE_ROOT_DIR = $$PWD/../../../../.. diff --git a/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h b/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h index 4badb20f1c..5650f86235 100644 --- a/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h +++ b/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h @@ -474,6 +474,11 @@ namespace MetaFile unsigned int ulVTextAlign = m_pFile->GetTextAlign() >> 8; + + if (ulTextAlign & TA_UPDATECP) + { + ulTextAlign -= TA_UPDATECP; + } if (ulTextAlign & TA_BASELINE) { ulTextAlign -= TA_BASELINE; diff --git a/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp b/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp index 5a49ebd228..1e7f4b63e4 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp +++ b/DesktopEditor/raster/Metafile/Emf/EmfInterpretator/CEmfInterpretatorSvg.cpp @@ -52,9 +52,6 @@ namespace MetaFile m_oViewport.dRight = oTEmfHeader.oFramePx.lRight; m_oViewport.dBottom = oTEmfHeader.oFramePx.lBottom; - m_oScale.x = (double)oTEmfHeader.oMillimeters.cx / (double)oTEmfHeader.oDevice.cx; - m_oScale.y = (double)oTEmfHeader.oMillimeters.cy / (double)oTEmfHeader.oDevice.cy; - m_oXmlWriter.WriteNodeBegin(L"svg", true); m_oXmlWriter.WriteAttribute(L"xmlns", L"http://www.w3.org/2000/svg"); m_oXmlWriter.WriteAttribute(L"xmlns:xlink", L"http://www.w3.org/1999/xlink"); diff --git a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfPlusParser.cpp b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfPlusParser.cpp index e81edcb28b..6e2ca1449a 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfPlusParser.cpp +++ b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfPlusParser.cpp @@ -1563,16 +1563,15 @@ namespace MetaFile oRect.dRight = arPoints[1].X - m_pDC->GetPixelWidth(); oRect.dBottom = arPoints[2].Y - m_pDC->GetPixelHeight(); - TRectD oTempSrcRect = oSrcRect.GetRectD(); + TRectD oTempSrcRect; - CEmfPlusImageAttributes *pImageAttributes = GetImageAttributes(unImageAttributeIndex); + TEmfRectL *pEmfBounds = oEmfParser.GetBounds(); - if (NULL != pImageAttributes && WrapModeTileFlipY != pImageAttributes->eWrapMode && WrapModeTileFlipXY != pImageAttributes->eWrapMode) - { - double dTempValue = oTempSrcRect.dBottom; - oTempSrcRect.dBottom = oTempSrcRect.dTop; - oTempSrcRect.dTop = dTempValue; - } + oTempSrcRect = oSrcRect.GetRectD(); + oTempSrcRect.dLeft -= pEmfBounds->lLeft; + oTempSrcRect.dRight -= pEmfBounds->lLeft + GetPixelWidth(); + oTempSrcRect.dTop -= pEmfBounds->lTop; + oTempSrcRect.dBottom -= pEmfBounds->lTop + GetPixelHeight(); TXForm oTransform; @@ -3189,6 +3188,8 @@ namespace MetaFile m_oStream >> oMatrix; + UpdateMatrix(oMatrix); + m_pDC->MultiplyTransform(oMatrix, MWT_SET); UpdateOutputDC(); @@ -3249,7 +3250,11 @@ namespace MetaFile { m_bBanEmfProcessing = true; - m_pDC->GetClip()->Reset(); + TEmfPlusXForm oMatrix(1, 0, 0, 1, 0, 0); + UpdateMatrix(oMatrix); + + m_pDC->MultiplyTransform(oMatrix, MWT_SET); + UpdateOutputDC(); if (NULL != m_pInterpretator) m_pInterpretator->HANDLE_EMFPLUS_RESETCLIP(); diff --git a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfxParser.h b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfxParser.h index a9c36d5eb3..2610b2318f 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfxParser.h +++ b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfxParser.h @@ -18,7 +18,7 @@ namespace MetaFile void PlayFile() override; void Scan() override; - EmfParserType GetType() override; + EmfParserType GetType() override; private: bool ReadImage(unsigned int offBmi, unsigned int cbBmi, unsigned int offBits, unsigned int cbBits, unsigned int ulSkip, BYTE **ppBgraBuffer, unsigned int *pulWidth, unsigned int *pulHeight) override; diff --git a/DesktopEditor/raster/Metafile/Emf/EmfPlusObjects.h b/DesktopEditor/raster/Metafile/Emf/EmfPlusObjects.h index 9d7b2f8ba2..c477f0c6d9 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfPlusObjects.h +++ b/DesktopEditor/raster/Metafile/Emf/EmfPlusObjects.h @@ -298,7 +298,6 @@ namespace MetaFile return Brush->Color.chAlpha; return 255; -// return (unsigned int)Color.chAlpha; } double GetMiterLimit() diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CInterpretatorSvgBase.cpp b/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CInterpretatorSvgBase.cpp index 14c275fb3d..5d0ad2e62a 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CInterpretatorSvgBase.cpp +++ b/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CInterpretatorSvgBase.cpp @@ -73,7 +73,7 @@ namespace MetaFile }; CInterpretatorSvgBase::CInterpretatorSvgBase(IMetaFileBase *pParser, double dWidth, double dHeight) - : m_oSizeWindow(dWidth, dHeight), m_oScale(1, 1), m_unNumberDefs(0), m_pParser(pParser) + : m_oSizeWindow(dWidth, dHeight), m_unNumberDefs(0), m_pParser(pParser) {} CInterpretatorSvgBase::~CInterpretatorSvgBase() @@ -202,6 +202,12 @@ namespace MetaFile double dXCoord = oCoord.x; double dYCoord = oCoord.y; + if (m_pParser->GetTextAlign() & TA_UPDATECP) + { + dXCoord = m_pParser->GetCurPos().x; + dYCoord = m_pParser->GetCurPos().y; + } + TXForm oTransform; oTransform.Copy(m_pParser->GetTransform()); @@ -376,18 +382,21 @@ namespace MetaFile if (NULL == pPen || PS_NULL == pPen->GetStyle()) return; + double dStrokeWidth = std::fabs(pPen->GetWidth()); + + if (0 == dStrokeWidth && 0 == pPen->GetColor() && (NULL != m_pParser->GetBrush() && BS_NULL == m_pParser->GetBrush()->GetStyle())) + return; + + if (0 == dStrokeWidth || (1.0 == dStrokeWidth && PS_COSMETIC == (pPen->GetStyle() & PS_TYPE_MASK))) + dStrokeWidth = (m_oViewport.GetWidth() / m_oSizeWindow.x) / std::fabs(m_pParser->GetTransform()->M11); + + arAttributes.push_back({L"stroke-width", ConvertToWString(dStrokeWidth)}); + if (pPen->GetAlpha() != 255) arAttributes.push_back({L"stroke-opacity" , ConvertToWString(pPen->GetAlpha() / 255., 3)}); arAttributes.push_back({L"stroke", L"rgb(" + INTCOLOR_TO_RGB(pPen->GetColor()) + L')'}); - double dStrokeWidth = std::fabs(pPen->GetWidth()); - - if (0.0 == dStrokeWidth || (1.0 == dStrokeWidth && PS_COSMETIC == (pPen->GetStyle() & PS_TYPE_MASK))) - dStrokeWidth = 1. / std::fabs(m_pParser->GetTransform()->M11); - - arAttributes.push_back({L"stroke-width", ConvertToWString(dStrokeWidth)}); - unsigned int unMetaPenStyle = pPen->GetStyle(); // unsigned int ulPenType = unMetaPenStyle & PS_TYPE_MASK; unsigned int ulPenStyle = unMetaPenStyle & PS_STYLE_MASK; @@ -666,19 +675,29 @@ namespace MetaFile if (NULL == m_pParser || NULL == pBrush) return std::wstring(); - BYTE* pBuffer = NULL; + CBgraFrame oFrame; unsigned int unWidth = 0, unHeight = 0; - pBrush->GetDibPattern(&pBuffer, unWidth, unHeight); + if (pBrush->GetDibPatterPath().empty()) + { + BYTE* pBuffer = NULL; - if (NULL == pBuffer || 0 == unWidth || 0 == unHeight) - return std::wstring(); + pBrush->GetDibPattern(&pBuffer, unWidth, unHeight); - CBgraFrame oFrame; - oFrame.put_Data(pBuffer); - oFrame.put_Width(unWidth); - oFrame.put_Height(unHeight); - oFrame.put_Stride(4 * unWidth); + if (NULL == pBuffer || 0 == unWidth || 0 == unHeight) + return std::wstring(); + + oFrame.put_Data(pBuffer); + oFrame.put_Width(unWidth); + oFrame.put_Height(unHeight); + oFrame.put_Stride(4 * unWidth); + } + else + { + oFrame.OpenFile(pBrush->GetDibPatterPath()); + unWidth = oFrame.get_Width(); + unHeight = oFrame.get_Height(); + } BYTE *pTempBuffer = NULL; int nTempSize; @@ -714,8 +733,8 @@ namespace MetaFile dStrokeWidth = 1. / m_pParser->GetTransform()->M11; } - std::wstring wsWidth = ConvertToWString(dStrokeWidth * 10 * unHeight / unWidth); - std::wstring wsHeight = ConvertToWString(dStrokeWidth * 10 * unWidth / unHeight); + std::wstring wsWidth = ConvertToWString(dStrokeWidth * unWidth); + std::wstring wsHeight = ConvertToWString(dStrokeWidth * unHeight); m_wsDefs += L"" + @@ -764,11 +783,11 @@ namespace MetaFile std::wstring wsImageDataW = NSFile::CUtf8Converter::GetUnicodeFromCharPtr(pImageData, (LONG)nImageSize); - std::wstring wsWidth = ConvertToWString(oFrame.get_Width() / m_pParser->GetTransform()->M11); - std::wstring wsHeight = ConvertToWString(oFrame.get_Height() / m_pParser->GetTransform()->M22); + std::wstring wsWidth = ConvertToWString(oFrame.get_Width()); + std::wstring wsHeight = ConvertToWString(oFrame.get_Height()); m_wsDefs += L"" + + L"width=\"" + wsWidth + L"\" height=\"" + wsHeight + L"\">" + L"" + L" "; diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CInterpretatorSvgBase.h b/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CInterpretatorSvgBase.h index 54d1e984c6..f41d2e6f57 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CInterpretatorSvgBase.h +++ b/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CInterpretatorSvgBase.h @@ -85,7 +85,6 @@ namespace MetaFile private: TSvgViewport m_oViewport; TPointD m_oSizeWindow; - TPointD m_oScale; std::wstring m_wsLastClipId; diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CWmfInterpretatorSvg.cpp b/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CWmfInterpretatorSvg.cpp index 0c4a626f7a..1d395c38e3 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CWmfInterpretatorSvg.cpp +++ b/DesktopEditor/raster/Metafile/Wmf/WmfInterpretator/CWmfInterpretatorSvg.cpp @@ -28,9 +28,6 @@ namespace MetaFile m_oXmlWriter.WriteAttribute(L"xmlns", L"http://www.w3.org/2000/svg"); m_oXmlWriter.WriteAttribute(L"xmlns:xlink", L"http://www.w3.org/1999/xlink"); - if (oPlaceable.Inch != 0) - m_oScale.x = m_oScale.y = 96.f / oPlaceable.Inch; - TRect *pBounds = m_pParser->GetDCBounds(); m_oViewport.dLeft = pBounds->nLeft; @@ -195,7 +192,9 @@ namespace MetaFile std::wstring wsText = NSStringExt::CConverter::GetUnicodeFromSingleByteString((const unsigned char*)pString, (long)shStringLength, eCharSet); - WriteText(wsText, TPointD(shX, shY), oRectangle); + TPointD oScale((m_pParser->IsWindowFlippedX()) ? -1 : 1, (m_pParser->IsWindowFlippedY()) ? -1 : 1); + + WriteText(wsText, TPointD(shX, shY), oRectangle, oScale); } void CWmfInterpretatorSvg::HANDLE_META_FILLREGION(unsigned short ushRegionIndex, unsigned short ushBrushIndex) diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.h b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.h index 79d3b55c91..f60df82b86 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.h +++ b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.h @@ -17,7 +17,7 @@ namespace MetaFile void PlayFile() override; void Scan() override; - WmfParserType GetType() override; + WmfParserType GetType() override; void SetStream(BYTE* pBuf, unsigned int unSize); private: diff --git a/OOXML/Common/ComplexTypes.cpp b/OOXML/Common/ComplexTypes.cpp index 2aeeac5975..793a194d05 100644 --- a/OOXML/Common/ComplexTypes.cpp +++ b/OOXML/Common/ComplexTypes.cpp @@ -301,7 +301,7 @@ namespace Word WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hAnsiTheme", m_oHAnsiTheme) WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hint", m_oHint) //2003 - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:h-ansi", m_oHint) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:h-ansi", m_sHAnsi) WritingElement_ReadAttributes_Read_else_if(oReader, L"w:fareast", m_sEastAsia) WritingElement_ReadAttributes_End(oReader) } diff --git a/OdfFile/Writer/Converter/DocxConverter.cpp b/OdfFile/Writer/Converter/DocxConverter.cpp index 4ed61b510d..3e3ec26eb8 100644 --- a/OdfFile/Writer/Converter/DocxConverter.cpp +++ b/OdfFile/Writer/Converter/DocxConverter.cpp @@ -4680,9 +4680,7 @@ void DocxConverter::convert(OOX::Logic::CTr *oox_table_row) if (styled && oox_table_row->m_pTableRowProperties->m_oTblHeader.IsInit() && oox_table_row->m_pTableRowProperties->m_oTblHeader->m_oVal.ToBool() )is_header = true; - if (is_header)odt_context->start_table_header_rows(); - - odt_context->start_table_row(styled); + odt_context->start_table_row(styled, is_header); convert(oox_table_row->m_pTableRowProperties); @@ -4700,8 +4698,6 @@ void DocxConverter::convert(OOX::Logic::CTr *oox_table_row) } odt_context->end_table_row(); - if (is_header)odt_context->end_table_header_rows(); - if (id_insert_row >= 0) odt_context->end_change(id_insert_row, 1); diff --git a/OdfFile/Writer/Format/odt_conversion_context.cpp b/OdfFile/Writer/Format/odt_conversion_context.cpp index 8a74d8648f..a373985f3c 100644 --- a/OdfFile/Writer/Format/odt_conversion_context.cpp +++ b/OdfFile/Writer/Format/odt_conversion_context.cpp @@ -1684,11 +1684,23 @@ void odt_conversion_context::end_table_header_rows() { text_context()->end_element(); } -void odt_conversion_context::start_table_row(bool styled) +void odt_conversion_context::start_table_row(bool styled, bool header) { office_element_ptr elm; create_element(L"table", L"table-row", elm, this); + if (header && !table_row_header_state_) + { + start_table_header_rows(); + table_row_header_state_ = true; + } + + if (!header && table_row_header_state_) + { + end_table_header_rows(); + table_row_header_state_ = false; + } + if (styled) { styles_context()->create_style(L"", odf_types::style_family::TableRow, true, false, -1); diff --git a/OdfFile/Writer/Format/odt_conversion_context.h b/OdfFile/Writer/Format/odt_conversion_context.h index 69eeac6936..d613080ba2 100644 --- a/OdfFile/Writer/Format/odt_conversion_context.h +++ b/OdfFile/Writer/Format/odt_conversion_context.h @@ -172,9 +172,7 @@ public: void start_table_columns (); void add_table_column (double width = -1); void end_table_columns (); - void start_table_header_rows(); - void end_table_header_rows (); - void start_table_row (bool styled = false); + void start_table_row (bool styled = false, bool header = false); void add_default_cell (); void start_table_cell (int col, bool covered, bool styled = false); void end_table_cell (); @@ -202,6 +200,9 @@ public: bool empty() {return current_root_elements_.empty();} private: + void start_table_header_rows(); + void end_table_header_rows (); + office_text* root_text_; office_element_ptr root_document_; @@ -265,6 +266,8 @@ private: std::vector current_types; }text_changes_state_; + bool table_row_header_state_ = false; + bool is_hyperlink_; struct _drop_cap_state diff --git a/PdfFile/PdfFile.cpp b/PdfFile/PdfFile.cpp index 6aa8a1da73..59b193fada 100644 --- a/PdfFile/PdfFile.cpp +++ b/PdfFile/PdfFile.cpp @@ -835,12 +835,6 @@ void CPdfFile::SetDocumentID(const std::wstring& wsDocumentID) return; m_pInternal->pWriter->SetDocumentID(wsDocumentID); } -void CPdfFile::SetCore(const std::wstring& wsCoreXml) -{ - if (!m_pInternal->pWriter) - return; - m_pInternal->pWriter->SetCore(wsCoreXml); -} HRESULT CPdfFile::OnlineWordToPdf(const std::wstring& wsSrcFile, const std::wstring& wsDstFile, CConvertFromBinParams* pParams) { #ifndef BUILDING_WASM_MODULE @@ -1469,5 +1463,12 @@ HRESULT CPdfFile::AddFormField(IFormField* pFieldInfo) { if (!m_pInternal->pWriter) return S_FALSE; - return m_pInternal->pWriter->AddFormField(m_pInternal->pAppFonts, pFieldInfo); + return m_pInternal->pWriter->AddFormField(m_pInternal->pAppFonts, pFieldInfo); +} +HRESULT CPdfFile::DocInfo(const std::wstring& wsTitle, const std::wstring& wsCreator, const std::wstring& wsSubject, const std::wstring& wsKeywords) +{ + if (!m_pInternal->pWriter) + return S_FALSE; + m_pInternal->pWriter->SetDocumentInfo(wsTitle, wsCreator, wsSubject, wsKeywords); + return S_OK; } diff --git a/PdfFile/PdfFile.h b/PdfFile/PdfFile.h index bd1f55671b..fa7faa6569 100644 --- a/PdfFile/PdfFile.h +++ b/PdfFile/PdfFile.h @@ -130,7 +130,6 @@ public: void RotatePage (int nRotate); void SetPassword (const std::wstring& wsPassword); void SetDocumentID(const std::wstring& wsDocumentID); - void SetCore (const std::wstring& wsCoreXml); void Sign(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsPicturePath, ICertificate* pCertificate); HRESULT OnlineWordToPdf (const std::wstring& wsSrcFile, const std::wstring& wsDstFile, CConvertFromBinParams* pParams = NULL); HRESULT OnlineWordToPdfFromBinary(const std::wstring& wsSrcFile, const std::wstring& wsDstFile, CConvertFromBinParams* pParams = NULL); @@ -273,7 +272,8 @@ public: virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand); virtual HRESULT AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip); virtual HRESULT AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage); - virtual HRESULT AddFormField(IFormField* pFieldInfo); + virtual HRESULT AddFormField(IFormField* pFieldInfo); + virtual HRESULT DocInfo(const std::wstring& wsTitle, const std::wstring& wsCreator, const std::wstring& wsSubject, const std::wstring& wsKeywords); private: CPdfFile_Private* m_pInternal; diff --git a/PdfFile/PdfFile.pro b/PdfFile/PdfFile.pro index a76775e570..d61b39ef46 100644 --- a/PdfFile/PdfFile.pro +++ b/PdfFile/PdfFile.pro @@ -78,9 +78,11 @@ HEADERS += \ Resources/Fontn022023l.h \ Resources/Fontn022024l.h \ Resources/Fonts050000l.h \ + Resources/CMapMemory/cmap_memory.h \ Resources/BaseFonts.h SOURCES += \ + Resources/CMapMemory/cmap_memory.cpp \ Resources/BaseFonts.cpp CONFIG += use_external_jpeg2000 diff --git a/PdfFile/PdfReader.cpp b/PdfFile/PdfReader.cpp index 01eb5ecac8..c50b135b98 100644 --- a/PdfFile/PdfReader.cpp +++ b/PdfFile/PdfReader.cpp @@ -75,10 +75,9 @@ CPdfReader::CPdfReader(NSFonts::IApplicationFonts* pAppFonts) ((GlobalParamsAdaptor*)globalParams)->SetFontManager(m_pFontManager); #ifndef BUILDING_WASM_MODULE globalParams->setupBaseFonts(NULL); -#endif - -#ifdef CMAP_USE_MEMORY - ((GlobalParamsAdaptor*)globalParams)->SetCMapMemory(NULL, 0); + SetCMapFile(NSFile::GetProcessDirectory() + L"/cmap.bin"); +#else + SetCMapMemory(NULL, 0); #endif m_eError = errNone; diff --git a/PdfFile/PdfWriter.cpp b/PdfFile/PdfWriter.cpp index 044df413cd..3c99dfecae 100644 --- a/PdfFile/PdfWriter.cpp +++ b/PdfFile/PdfWriter.cpp @@ -161,38 +161,20 @@ int CPdfWriter::SaveToFile(const std::wstring& wsPath) return 0; } -void CPdfWriter::SetCore(const std::wstring& wsCoreXml) +void CPdfWriter::SetDocumentInfo(const std::wstring& wsTitle, const std::wstring& wsCreator, const std::wstring& wsSubject, const std::wstring& wsKeywords) { if (!IsValid()) return; - XmlUtils::CXmlLiteReader oCoreReader; - oCoreReader.FromString(wsCoreXml); - oCoreReader.ReadNextNode(); + std::string sTitle = U_TO_UTF8(wsTitle); + std::string sAuthor = U_TO_UTF8(wsCreator); + std::string sSubject = U_TO_UTF8(wsSubject); + std::string sKeywords = U_TO_UTF8(wsKeywords); - std::string sAuthor, sAnnotation, sKeywords, sSubject, sTitle; - int nDeath = oCoreReader.GetDepth(); - while (oCoreReader.ReadNextSiblingNode(nDeath)) - { - std::wstring sName = oCoreReader.GetName(); - std::string sText = oCoreReader.GetText2A(); - if (!sText.empty()) - { - if (sName == L"dc:creator") - sAuthor = sText; - else if (sName == L"dc:title") - sTitle = sText; - else if (sName == L"dc:subject") - sSubject = sText; - else if (sName == L"cp:keywords") - sKeywords = sText; - } - } - - if (!sAuthor.empty()) - m_pDocument->SetAuthor(sAuthor); if (!sTitle.empty()) m_pDocument->SetTitle(sTitle); + if (!sAuthor.empty()) + m_pDocument->SetAuthor(sAuthor); if (!sSubject.empty()) m_pDocument->SetSubject(sSubject); if (!sKeywords.empty()) diff --git a/PdfFile/PdfWriter.h b/PdfFile/PdfWriter.h index bff972b8e4..2403411375 100644 --- a/PdfFile/PdfWriter.h +++ b/PdfFile/PdfWriter.h @@ -44,17 +44,17 @@ namespace PdfWriter { - class CDocument; - class CPage; + class CDocument; + class CPage; class CFontCidTrueType; - class CImageDict; - class CShading; + class CImageDict; + class CShading; class CExtGrState; } namespace Aggplus { - class CImage; + class CImage; } class CPdfWriter @@ -62,22 +62,22 @@ class CPdfWriter public: CPdfWriter(NSFonts::IApplicationFonts* pAppFonts, bool isPDFA = false); ~CPdfWriter(); - int SaveToFile(const std::wstring& wsPath); - void SetPassword(const std::wstring& wsPassword); - void SetDocumentID(const std::wstring& wsDocumentID); - void SetCore(const std::wstring& wsCoreXml); + int SaveToFile(const std::wstring& wsPath); + void SetPassword(const std::wstring& wsPassword); + void SetDocumentID(const std::wstring& wsDocumentID); + void SetDocumentInfo(const std::wstring& wsTitle, const std::wstring& wsCreator, const std::wstring& wsSubject, const std::wstring& wsKeywords); std::wstring GetTempFile(const std::wstring& wsDirectory); - //---------------------------------------------------------------------------------------- - // Функции для работы со страницей - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Функции для работы со страницей + //---------------------------------------------------------------------------------------- HRESULT NewPage(); HRESULT get_Height(double* dHeight); HRESULT put_Height(const double& dHeight); HRESULT get_Width(double* dWidth); HRESULT put_Width(const double& dWidth); - //---------------------------------------------------------------------------------------- - // Функции для работы с Pen - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Функции для работы с Pen + //---------------------------------------------------------------------------------------- HRESULT get_PenColor(LONG* lColor); HRESULT put_PenColor(const LONG& lColor); HRESULT get_PenAlpha(LONG* lAlpha); @@ -99,9 +99,9 @@ public: HRESULT get_PenMiterLimit(double* dMiter); HRESULT put_PenMiterLimit(const double& dMiter); HRESULT PenDashPattern(double* pPattern, LONG lCount); - //---------------------------------------------------------------------------------------- - // Функции для работы с Brush - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Функции для работы с Brush + //---------------------------------------------------------------------------------------- HRESULT get_BrushType(LONG* lType); HRESULT put_BrushType(const LONG& lType); HRESULT get_BrushColor1(LONG* lColor); @@ -122,9 +122,9 @@ public: HRESULT put_BrushLinearAngle(const double& dAngle); HRESULT BrushRect(const INT& nVal, const double& dLeft, const double& dTop, const double& dWidth, const double& dHeight); HRESULT put_BrushGradientColors(LONG* pColors, double* pPositions, LONG lCount); - //---------------------------------------------------------------------------------------- - // Функции для работы со шрифтами - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Функции для работы со шрифтами + //---------------------------------------------------------------------------------------- HRESULT get_FontName(std::wstring* wsName); HRESULT put_FontName(const std::wstring& wsName); HRESULT get_FontPath(std::wstring* wsPath); @@ -139,21 +139,21 @@ public: HRESULT put_FontCharSpace(const double& dSpace); HRESULT get_FontFaceIndex(int* lFaceIndex); HRESULT put_FontFaceIndex(const int& lFaceIndex); - //---------------------------------------------------------------------------------------- - // Функции для вывода текста - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Функции для вывода текста + //---------------------------------------------------------------------------------------- HRESULT CommandDrawTextCHAR (const LONG& lUnicode, const double& dX, const double& dY, const double& dW, const double& dH); HRESULT CommandDrawTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH); HRESULT CommandDrawText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH); HRESULT CommandDrawTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH); HRESULT CommandDrawTextCHAR2 (unsigned int* unUnicode, const unsigned int& unUnicodeCount, const unsigned int& unGid, const double& dX, const double& dY, const double& dW, const double& dH); - //---------------------------------------------------------------------------------------- - // Маркеры команд - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Маркеры команд + //---------------------------------------------------------------------------------------- HRESULT EndCommand(const DWORD& lType, const LONG& lClipMode); - //---------------------------------------------------------------------------------------- - // Функции для работы с патом - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Функции для работы с патом + //---------------------------------------------------------------------------------------- HRESULT PathCommandMoveTo(const double& dX, const double& dY); HRESULT PathCommandLineTo(const double& dX, const double& dY); HRESULT PathCommandLinesTo(double* pPoints, const int& nCount); @@ -169,31 +169,31 @@ public: HRESULT PathCommandTextExCHAR(const LONG& lUnicode, const LONG& lGid, const double& dX, const double& dY, const double& dW, const double& dH); HRESULT PathCommandText (const std::wstring& wsUnicodeText, const double& dX, const double& dY, const double& dW, const double& dH); HRESULT PathCommandTextEx (const std::wstring& wsUnicodeText, const unsigned int* pGids, const unsigned int nGidsCount, const double& dX, const double& dY, const double& dW, const double& dH); - //---------------------------------------------------------------------------------------- - // Функции для вывода изображений - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Функции для вывода изображений + //---------------------------------------------------------------------------------------- HRESULT DrawImage(IGrObject* pImage, const double& dX, const double& dY, const double& dW, const double& dH); HRESULT DrawImageFromFile(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory, const std::wstring& wsImagePath, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha = 255); - //---------------------------------------------------------------------------------------- - // Функции для выставления преобразования - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Функции для выставления преобразования + //---------------------------------------------------------------------------------------- HRESULT SetTransform(const double& dM11, const double& dM12, const double& dM21, const double& dM22, const double& dX, const double& dY); HRESULT GetTransform(double* dM11, double* dM12, double* dM21, double* dM22, double* dX, double* dY); HRESULT ResetTransform(); - //---------------------------------------------------------------------------------------- - // Дополнительные функции - //---------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------- + // Дополнительные функции + //---------------------------------------------------------------------------------------- HRESULT AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip); HRESULT AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage); - HRESULT AddFormField(NSFonts::IApplicationFonts* pAppFonts, IFormField* pFiledInfo); - //---------------------------------------------------------------------------------------- - // Дополнительные функции Pdf рендерера - //---------------------------------------------------------------------------------------- + HRESULT AddFormField(NSFonts::IApplicationFonts* pAppFonts, IFormField* pFiledInfo); + //---------------------------------------------------------------------------------------- + // Дополнительные функции Pdf рендерера + //---------------------------------------------------------------------------------------- HRESULT DrawImage1bpp(NSImages::CPixJbig2* pImageBuffer, const unsigned int& unWidth, const unsigned int& unHeight, const double& dX, const double& dY, const double& dW, const double& dH); - HRESULT EnableBrushRect(const LONG& lEnable); - HRESULT SetLinearGradient(const double& dX1, const double& dY1, const double& dX2, const double& dY2); + HRESULT EnableBrushRect(const LONG& lEnable); + HRESULT SetLinearGradient(const double& dX1, const double& dY1, const double& dX2, const double& dY2); HRESULT SetRadialGradient(const double& dX1, const double& dY1, const double& dR1, const double& dX2, const double& dY2, const double& dR2); - HRESULT DrawImageWith1bppMask(IGrObject* pImage, NSImages::CPixJbig2* pMaskBuffer, const unsigned int& unMaskWidth, const unsigned int& unMaskHeight, const double& dX, const double& dY, const double& dW, const double& dH); + HRESULT DrawImageWith1bppMask(IGrObject* pImage, NSImages::CPixJbig2* pMaskBuffer, const unsigned int& unMaskWidth, const unsigned int& unMaskHeight, const double& dX, const double& dY, const double& dW, const double& dH); //---------------------------------------------------------------------------------------- // Дополнительные функции для дозаписи Pdf @@ -209,22 +209,22 @@ public: PdfWriter::CPage* m_pPage; private: - PdfWriter::CImageDict* LoadImage(Aggplus::CImage* pImage, const BYTE& nAlpha); - bool DrawImage(Aggplus::CImage* pImage, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha); - bool DrawText(unsigned char* pCodes, const unsigned int& unLen, const double& dX, const double& dY); + PdfWriter::CImageDict* LoadImage(Aggplus::CImage* pImage, const BYTE& nAlpha); + bool DrawImage(Aggplus::CImage* pImage, const double& dX, const double& dY, const double& dW, const double& dH, const BYTE& nAlpha); + bool DrawText(unsigned char* pCodes, const unsigned int& unLen, const double& dX, const double& dY); bool PathCommandDrawText(unsigned int* pUnicodes, unsigned int unLen, const double& dX, const double& dY, const unsigned int* pGids = NULL); void UpdateFont(); void GetFontPath(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic, std::wstring& wsFontPath, LONG& lFaceIndex); PdfWriter::CFontCidTrueType* GetFont(const std::wstring& wsFontPath, const LONG& lFontIndex); PdfWriter::CFontCidTrueType* GetFont(const std::wstring& wsFontName, const bool& bBold, const bool& bItalic); - void UpdateTransform(); - void UpdatePen(); + void UpdateTransform(); + void UpdatePen(); void UpdateBrush(NSFonts::IApplicationFonts* pAppFonts, const std::wstring& wsTempDirectory); - void Reset(); - bool IsValid(); - bool IsPageValid(); - void SetError(); - void AddLink(PdfWriter::CPage* pPage, const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const unsigned int& unDestPage); + void Reset(); + bool IsValid(); + bool IsPageValid(); + void SetError(); + void AddLink(PdfWriter::CPage* pPage, const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const unsigned int& unDestPage); unsigned char* EncodeString(const unsigned int* pUnicodes, const unsigned int& unUnicodesCount, const unsigned int* pGIDs = NULL); unsigned char* EncodeGID(const unsigned int& unGID, const unsigned int* pUnicodes, const unsigned int& unUnicodesCount); std::wstring GetDownloadFile(const std::wstring& sUrl, const std::wstring& wsTempDirectory); @@ -232,31 +232,31 @@ private: private: NSFonts::IFontManager* m_pFontManager; - PdfWriter::CFontCidTrueType* m_pFont; - PdfWriter::CShading* m_pShading; - PdfWriter::CExtGrState* m_pShadingExtGrState; - - bool m_bNeedUpdateTextFont; - bool m_bNeedUpdateTextColor; - bool m_bNeedUpdateTextAlpha; - bool m_bNeedUpdateTextCharSpace; - bool m_bNeedUpdateTextSize; + PdfWriter::CFontCidTrueType* m_pFont; + PdfWriter::CShading* m_pShading; + PdfWriter::CExtGrState* m_pShadingExtGrState; - CCommandManager m_oCommandManager; + bool m_bNeedUpdateTextFont; + bool m_bNeedUpdateTextColor; + bool m_bNeedUpdateTextAlpha; + bool m_bNeedUpdateTextCharSpace; + bool m_bNeedUpdateTextSize; - CPenState m_oPen; - CBrushState m_oBrush; - CFontState m_oFont; - CPath m_oPath; - CTransform m_oTransform; - double m_dPageHeight; - double m_dPageWidth; - LONG m_lClipDepth; - std::vector m_vFonts; - std::vectorm_vDestinations; + CCommandManager m_oCommandManager; + + CPenState m_oPen; + CBrushState m_oBrush; + CFontState m_oFont; + CPath m_oPath; + CTransform m_oTransform; + double m_dPageHeight; + double m_dPageWidth; + LONG m_lClipDepth; + std::vector m_vFonts; + std::vectorm_vDestinations; unsigned int m_unFieldsCounter; - CMultiLineTextManager m_oLinesManager; - + CMultiLineTextManager m_oLinesManager; + bool m_bValid; }; diff --git a/PdfFile/Resources/BaseFonts.cpp b/PdfFile/Resources/BaseFonts.cpp index 34f231479b..344a8b86cd 100644 --- a/PdfFile/Resources/BaseFonts.cpp +++ b/PdfFile/Resources/BaseFonts.cpp @@ -46,6 +46,7 @@ #include "../Resources/Fontn021023l.h" #include "../Resources/Fontn021003l.h" #include "../Resources/Fontd050000l.h" +#include "CMapMemory/cmap_memory.h" #include @@ -87,15 +88,7 @@ bool PdfReader::GetBaseFont(const std::wstring& sName, const unsigned char*& pDa return false; } -#ifdef CMAP_USE_MEMORY -#include "./CMapMemory/cmap_memory.h" -#endif - bool PdfReader::GetBaseCidToUnicode(const char* sName, const unsigned int*& pData, unsigned int& nSize) { -#ifdef CMAP_USE_MEMORY return GetCidToUnicodeMemoryMap(sName, pData, nSize); -#else - return false; -#endif } diff --git a/PdfFile/Resources/CMapMemory/CMapData b/PdfFile/Resources/CMapMemory/CMapData deleted file mode 100644 index d14fccff7f..0000000000 Binary files a/PdfFile/Resources/CMapMemory/CMapData and /dev/null differ diff --git a/PdfFile/lib/xpdf/CharCodeToUnicode.cc b/PdfFile/lib/xpdf/CharCodeToUnicode.cc index 0c5555afb9..86f4b99df4 100644 --- a/PdfFile/lib/xpdf/CharCodeToUnicode.cc +++ b/PdfFile/lib/xpdf/CharCodeToUnicode.cc @@ -22,10 +22,7 @@ #include "GlobalParams.h" #include "PSTokenizer.h" #include "CharCodeToUnicode.h" - -#ifdef CMAP_USE_MEMORY #include "../../Resources/BaseFonts.h" -#endif //------------------------------------------------------------------------ @@ -108,16 +105,16 @@ CharCodeToUnicode *CharCodeToUnicode::parseCIDToUnicode(GString *fileName, Unicode u; CharCodeToUnicode *ctu; -#ifdef CMAP_USE_MEMORY + const unsigned int* pDataCid = NULL; unsigned int nSizeCid = 0; if (PdfReader::GetBaseCidToUnicode(collection->getCString(), pDataCid, nSizeCid)) { ctu = new CharCodeToUnicode(collection->copy(), (Unicode*)pDataCid, nSizeCid, gTrue, NULL, 0, 0); return ctu; - } else { - return NULL; } +#ifdef BUILDING_WASM_MODULE + return NULL; #endif if (!(f = openFile(fileName->getCString(), "r"))) {