diff --git a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp index 046bc58a36..014a5267fb 100755 --- a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp @@ -52,9 +52,9 @@ namespace DocFileFormat m_bInternalXmlWriter = false; _writeWebHidden = false; - _isSectionPageBreak = 0; _isTextBoxContent = false; + m_context->_docx->_isSectionPageBreak = 0; //-------------------------------------------- _embeddedObject = false; } @@ -68,11 +68,12 @@ namespace DocFileFormat m_bInternalXmlWriter = false; _writeWebHidden = false; - _isSectionPageBreak = 0; _isTextBoxContent = false; _embeddedObject = false; _cacheListNum = -1; + + m_context->_docx->_isSectionPageBreak = 0; } DocumentMapping::~DocumentMapping() @@ -233,7 +234,7 @@ namespace DocFileFormat } //----------------------------------------------------------- //_cacheListNum = getListNumCache(fc, fcEnd); - _isSectionPageBreak = 0; + m_context->_docx->_isSectionPageBreak = 0; if (sectionEnd) { // this is the last paragraph of this section @@ -244,7 +245,7 @@ namespace DocFileFormat ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, isBidi, findValidSepx(cpEnd), _sectionNr); papx->Convert(&oMapping); - _isSectionPageBreak = oMapping.get_section_page_break(); + m_context->_docx->_isSectionPageBreak = oMapping.get_section_page_break(); } ++_sectionNr; @@ -360,8 +361,10 @@ namespace DocFileFormat RELEASEOBJECT(chpxFcs); RELEASEOBJECT(chpxs); + + return cpEnd; - return cpEnd++; + return (std::max)(cp, cpEnd); //ralph_scovile.doc } void DocumentMapping::writeParagraphRsid (const ParagraphPropertyExceptions* papx) @@ -823,9 +826,9 @@ namespace DocFileFormat } else if (TextMark::PageBreakOrSectionMark == code) { - if (_isSectionPageBreak == 0 || _isSectionPageBreak == 2) + if (m_context->_docx->_isSectionPageBreak == 0 || m_context->_docx->_isSectionPageBreak == 2) { - _isSectionPageBreak = -1; + m_context->_docx->_isSectionPageBreak = -1; writeTextElement(text, textType); @@ -914,10 +917,14 @@ namespace DocFileFormat // - m_pXmlWriter->WriteNodeBegin(L"w:sym", true); - m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName)); - m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue)); - m_pXmlWriter->WriteNodeEnd(L"", true); + if (false == s.HexValue.empty()) //09FluGuide.doc - поврежденный + { + m_pXmlWriter->WriteNodeBegin(L"w:sym", true); + if (false == s.FontName.empty()) // ??? default + m_pXmlWriter->WriteAttribute(L"w:font", FormatUtils::XmlEncode(s.FontName)); + m_pXmlWriter->WriteAttribute(L"w:char", FormatUtils::XmlEncode(s.HexValue)); + m_pXmlWriter->WriteNodeEnd(L"", true); + } } else if ((TextMark::DrawnObject == code) && fSpec) { diff --git a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h index 58d93f2001..cb775cebc4 100644 --- a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h @@ -154,7 +154,7 @@ namespace DocFileFormat int _endnoteNr; int _commentNr; bool _isTextBoxContent; - int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues, -1 - already +// int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues, -1 - already bool _writeWebHidden; std::wstring _writeAfterRun; std::wstring _lastOLEObject; diff --git a/ASCOfficeDocFile/DocDocxConverter/PieceTable.cpp b/ASCOfficeDocFile/DocDocxConverter/PieceTable.cpp index b08f61ead3..31a45d12ae 100644 --- a/ASCOfficeDocFile/DocDocxConverter/PieceTable.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/PieceTable.cpp @@ -393,8 +393,14 @@ namespace DocFileFormat //read from pcd.fc to fcEnd int cb = fcEnd - (int)pcd.fc; - if (cb <= 0) - break; + if (cb == 0) //ralph_scovile.doc + { + cb = pcdFcEnd - (int)pcd.fc; + if (cb <= 0) + break; + } + else if (cb < 0) + break; if (!ReadSymbolsBuffer((int)pcd.fc, cb, pcd.code_page, word, encodingChars)) break; diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp index 399c1a1a90..ef12028f8f 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp @@ -427,7 +427,8 @@ namespace DocFileFormat }break; case ODRAW::posrelh: { - appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op)); + if (false == m_inGroup) + appendStyleProperty(strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op)); }break; case ODRAW::posv: { @@ -435,6 +436,7 @@ namespace DocFileFormat }break; case ODRAW::posrelv: { + if (false == m_inGroup) appendStyleProperty(strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op)); }break; case ODRAW::groupShapeBooleanProperties: diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp index fb2aecc025..e7664a9bf6 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp @@ -1771,7 +1771,7 @@ namespace DocFileFormat //за текстом (The shape is behind the text, so the z-index must be negative.) m_isInlineShape = false; - if (false == bZIndex && false == m_inGroup) + if (false == bZIndex/* && false == m_inGroup*/) // Пример.doc { appendStyleProperty(oStyle, L"z-index", FormatUtils::IntToWideString(-zIndex - 0x7ffff)); bZIndex = true; @@ -1826,7 +1826,7 @@ namespace DocFileFormat } } - if (nRelH < 0 && m_pSpa) + if (nRelH < 0 && m_pSpa && false == m_inGroup) { //if (m_pSpa->bx == TEXT && bZIndex) //{ @@ -1839,7 +1839,7 @@ namespace DocFileFormat else if (m_pSpa->bx == TEXT) appendStyleProperty(oStyle, L"mso-position-horizontal-relative", mapHorizontalPositionRelative(msoprhText)); } - if (nRelV < 0 && m_pSpa) + if (nRelV < 0 && m_pSpa && false == m_inGroup) { //if (m_pSpa->by == TEXT && bZIndex) //{ diff --git a/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp b/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp index 32a28d50df..9987261ac0 100644 --- a/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp @@ -49,6 +49,7 @@ namespace DocFileFormat WordprocessingDocument::~WordprocessingDocument() { + _isSectionPageBreak = 0; } _UINT32 WordprocessingDocument::SaveDocument(bool &bMacros) diff --git a/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.h b/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.h index 3d912e1cc6..bb54407239 100644 --- a/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.h +++ b/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.h @@ -76,6 +76,8 @@ namespace DocFileFormat std::list FooterXMLList; public: + int _isSectionPageBreak; //0 - not set, 1 -page break, 2 - continues, -1 - already + WordprocessingDocument(const std::wstring & _docxDirectory, const WordDocument* _docFile); virtual ~WordprocessingDocument(); diff --git a/ASCOfficeDocxFile2/BinReader/CustomXmlWriter.cpp b/ASCOfficeDocxFile2/BinReader/CustomXmlWriter.cpp index 57aaeaf832..01fe5182b5 100644 --- a/ASCOfficeDocxFile2/BinReader/CustomXmlWriter.cpp +++ b/ASCOfficeDocxFile2/BinReader/CustomXmlWriter.cpp @@ -45,7 +45,7 @@ namespace Writers m_nCount++; std::wstring sCustomXmlDir = m_sDir + FILE_SEPARATOR_STR; - sCustomXmlDir += OOX::FileTypes::CustomXmlProps.DefaultDirectory().GetPath(); + sCustomXmlDir += OOX::FileTypes::CustomXml.DefaultDirectory().GetPath(); std::wstring sCustomXmlRelsDir = sCustomXmlDir + FILE_SEPARATOR_STR + L"_rels"; @@ -54,7 +54,7 @@ namespace Writers NSFile::CFileBinary::SaveToFile(sCustomXmlDir + FILE_SEPARATOR_STR + sCustomXMLPropsFilename, sCustomXmlPropertiesContent); OOX::CContentTypes& oContentTypes = *m_pDrawingConverter->GetContentTypes(); - oContentTypes.Registration( OOX::FileTypes::CustomXmlProps.OverrideType(), OOX::FileTypes::CustomXmlProps.DefaultDirectory(), sCustomXMLPropsFilename ); + oContentTypes.Registration( OOX::FileTypes::CustomXmlProps.OverrideType(), OOX::FileTypes::CustomXml.DefaultDirectory(), sCustomXMLPropsFilename ); std::wstring sCustomXmlFilename; sCustomXmlFilename = OOX::FileTypes::CustomXml.DefaultFileName().GetBasename() + std::to_wstring(m_nCount); @@ -81,7 +81,7 @@ namespace Writers oCustomXMLProps.m_oShemaRefs->m_arrItems.push_back(pShemaRef); std::wstring sCustomXmlPropsDir = m_sDir + FILE_SEPARATOR_STR; - sCustomXmlPropsDir += OOX::FileTypes::CustomXmlProps.DefaultDirectory().GetPath(); + sCustomXmlPropsDir += OOX::FileTypes::CustomXml.DefaultDirectory().GetPath(); NSDirectory::CreateDirectories(sCustomXmlPropsDir); std::wstring sCustomXMLPropsFilename = OOX::FileTypes::CustomXmlProps.DefaultFileName().GetBasename(); sCustomXMLPropsFilename += std::to_wstring(m_nCount) + OOX::FileTypes::CustomXmlProps.DefaultFileName().GetExtention(); diff --git a/ASCOfficeDocxFile2/BinReader/Readers.cpp b/ASCOfficeDocxFile2/BinReader/Readers.cpp index 0d52b6f9a9..54a5955ea3 100644 --- a/ASCOfficeDocxFile2/BinReader/Readers.cpp +++ b/ASCOfficeDocxFile2/BinReader/Readers.cpp @@ -3484,8 +3484,6 @@ Binary_CustomsTableReader::Binary_CustomsTableReader(NSBinPptxRW::CBinaryFileRea } int Binary_CustomsTableReader::Read() { - OOX::CCustomXMLProps oCustomXmlProps(NULL); - int res = c_oSerConstants::ReadOk; READ_TABLE_DEF(res, this->ReadCustom, NULL); diff --git a/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp b/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp index 5cec90cd87..3a41d1307a 100644 --- a/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp +++ b/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp @@ -9026,7 +9026,7 @@ void BinaryCustomsTableWriter::Write(OOX::CDocument* pDocument) if (OOX::FileTypes::CustomXml == container[i]->type()) { OOX::CCustomXML* pCustomXml = dynamic_cast(container[i].GetPointer()); - if (pCustomXml->bUsed) continue; + if (pCustomXml->m_bUsed) continue; int nCurPos = m_oBcw.WriteItemStart(BinDocxRW::c_oSerCustoms::Custom); @@ -9054,11 +9054,14 @@ void BinaryCustomsTableWriter::Write(OOX::CDocument* pDocument) } int nCurPos2 = m_oBcw.WriteItemStart(c_oSerCustoms::Content); - m_oBcw.m_oStream.WriteStringW3(pCustomXml->m_sXml); + + std::wstring sXml = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)pCustomXml->m_sXmlA.c_str(), pCustomXml->m_sXmlA.length()); + m_oBcw.m_oStream.WriteStringW3(sXml); + m_oBcw.WriteItemEnd(nCurPos2); m_oBcw.WriteItemEnd(nCurPos); - pCustomXml->bUsed = true; + pCustomXml->m_bUsed = true; } } m_oBcw.WriteItemWithLengthEnd(nStart); diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp index 83d6fd05ce..5ea30c88a7 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp @@ -245,9 +245,9 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group) case SimpleTypes::Vml::cssptRotation: { if (group) - odf_context()->drawing_context()->set_group_rotate(180 + vml_style->m_arrProperties[i]->get_Value().dValue); + odf_context()->drawing_context()->set_group_rotate(180 + vml_style->m_arrProperties[i]->get_Value().oValue.dValue); else - odf_context()->drawing_context()->set_rotate(360 - vml_style->m_arrProperties[i]->get_Value().dValue); + odf_context()->drawing_context()->set_rotate(360 - vml_style->m_arrProperties[i]->get_Value().oValue.dValue); }break; case SimpleTypes::Vml::cssptFlip: { @@ -779,7 +779,8 @@ void OoxConverter::convert(OOX::Vml::CTextPath *vml_textpath) //height = vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().oValue.dValue; break; case SimpleTypes::Vml::cssptFontSize: - text_properties->content_.fo_font_size_ = odf_types::length(vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().dValue, odf_types::length::pt); + //todooo проверять на размерность + text_properties->content_.fo_font_size_ = odf_types::length(vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().oValue.dValue, odf_types::length::pt); break; case SimpleTypes::Vml::cssptFontStyle: //width = vml_textpath->m_oStyle->m_arrProperties[i]->get_Value().oValue.dValue; diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/RunProperties.h b/ASCOfficePPTXFile/PPTXFormat/Logic/RunProperties.h index fdc0e2614a..5b99284f9f 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/RunProperties.h +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/RunProperties.h @@ -490,7 +490,10 @@ namespace PPTX pWriter->Write(ln); Fill.toXmlWriter(pWriter); - EffectList.toXmlWriter(pWriter); + EffectList.toXmlWriter(pWriter); + pWriter->Write(highlight); + pWriter->Write(uFill); + pWriter->Write(uFillTx); pWriter->Write(latin); pWriter->Write(ea); pWriter->Write(cs); @@ -498,9 +501,6 @@ namespace PPTX pWriter->Write(hlinkClick); pWriter->Write(hlinkMouseOver); pWriter->Write(rtl); - pWriter->Write(uFill); - pWriter->Write(uFillTx); - pWriter->Write(highlight); pWriter->EndNode(m_name); } @@ -523,7 +523,6 @@ namespace PPTX highlight->Merge(props->highlight); // EffectProperties EffectList; - //highlight (Highlight Color) §21.1.2.3.4 //uLn (Underline Stroke) §21.1.2.3.14 //uLnTx (Underline Follows Text) §21.1.2.3.15 diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp index ff65f09bc0..3e4edff0a8 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp @@ -158,19 +158,23 @@ bool OOXShapeReader::ParseVmlStyle(RtfShapePtr pShape, SimpleTypes::Vml::CCssPro }break; case SimpleTypes::Vml::cssptMsoWrapDistanceBottom: { - pShape->m_nWrapDistBottom = (int)(20 * prop->get_Value().dValue ); + //todooo проверять на размерность + pShape->m_nWrapDistBottom = (int)(20 * prop->get_Value().oValue.dValue ); }break; case SimpleTypes::Vml::cssptMsoWrapDistanceLeft : { - pShape->m_nWrapDistLeft = (int)(20 * prop->get_Value().dValue ); + //todooo проверять на размерность + pShape->m_nWrapDistLeft = (int)(20 * prop->get_Value().oValue.dValue ); }break; case SimpleTypes::Vml::cssptMsoWrapDistanceRight: { - pShape->m_nWrapDistRight = (int)(20 * prop->get_Value().dValue ); + //todooo проверять на размерность + pShape->m_nWrapDistRight = (int)(20 * prop->get_Value().oValue.dValue ); }break; case SimpleTypes::Vml::cssptMsoWrapDistanceTop : { - pShape->m_nWrapDistTop = (int)(20 * prop->get_Value().dValue ); + //todooo проверять на размерность + pShape->m_nWrapDistTop = (int)(20 * prop->get_Value().oValue.dValue ); }break; case SimpleTypes::Vml::cssptMsoWrapEdited: break; @@ -184,7 +188,7 @@ bool OOXShapeReader::ParseVmlStyle(RtfShapePtr pShape, SimpleTypes::Vml::CCssPro break; case SimpleTypes::Vml::cssptRotation: { - pShape->m_nRotation = (int)(65536 * prop->get_Value().dValue); + pShape->m_nRotation = (int)(65536 * prop->get_Value().oValue.dValue); if( PROP_DEF != pShape->m_nRelRight || PROP_DEF != pShape->m_nRelLeft || PROP_DEF != pShape->m_nRelTop @@ -228,11 +232,11 @@ bool OOXShapeReader::ParseVmlStyle(RtfShapePtr pShape, SimpleTypes::Vml::CCssPro }break; case SimpleTypes::Vml::csspctMsoWidthPercent: { - pShape->m_nPctWidth = (int)prop->get_Value().dValue; + pShape->m_nPctWidth = (int)prop->get_Value().oValue.dValue; }break; case SimpleTypes::Vml::csspctMsoHeightPercent: { - pShape->m_nPctHeight = (int)prop->get_Value().dValue; + pShape->m_nPctHeight = (int)prop->get_Value().oValue.dValue; }break; case SimpleTypes::Vml::cssptVRotateLetters: { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.cpp index 9d9d409119..82d0e30996 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.cpp @@ -468,20 +468,20 @@ int SS::serialize2(std::wostream & _stream, int series_type) } } - //if (m_isAutoLine == false && ( series_type == CHART_TYPE_Line || - // series_type == CHART_TYPE_Radar/* || - // series_type == CHART_TYPE_Scatter*/)) - //{ - // if (series_format) - // { - // CP_XML_NODE(L"c:smooth") - // { - // CP_XML_ATTR(L"val", series_format->fSmoothedLine); - // } - // } - // else - // CP_XML_NODE(L"c:smooth") { CP_XML_ATTR(L"val", 0); } - //} + if (m_isAutoLine == false && ( series_type == CHART_TYPE_Line || + series_type == CHART_TYPE_Radar/* || + series_type == CHART_TYPE_Scatter*/)) + { + if (series_format) + { + CP_XML_NODE(L"c:smooth") + { + CP_XML_ATTR(L"val", series_format->fSmoothedLine); + } + } + else + CP_XML_NODE(L"c:smooth") { CP_XML_ATTR(L"val", 0); } + } } return 0; } diff --git a/Common/3dParty/curl/build-android-common.sh b/Common/3dParty/curl/build-android-common.sh index a1ed528c4a..d1b069c047 100755 --- a/Common/3dParty/curl/build-android-common.sh +++ b/Common/3dParty/curl/build-android-common.sh @@ -32,11 +32,6 @@ if [[ -z ${ANDROID_NDK_ROOT} ]]; then exit 1 fi -if [[ -z ${ANDROID_HOME} ]]; then - echo "ANDROID_HOME not defined" - exit 1 -fi - function get_toolchain() { HOST_OS=$(uname -s) case ${HOST_OS} in diff --git a/Common/3dParty/curl/build-android-curl.sh b/Common/3dParty/curl/build-android-curl.sh index 0177e5ff41..697e8845b9 100755 --- a/Common/3dParty/curl/build-android-curl.sh +++ b/Common/3dParty/curl/build-android-curl.sh @@ -45,7 +45,8 @@ echo "https://github.com/curl/curl/releases/download/${LIB_VERSION}/${LIB_NAME}. # https://github.com/curl/curl/releases/download/curl-7_69_0/curl-7.69.0.tar.gz # https://github.com/curl/curl/releases/download/curl-7_68_0/curl-7.68.0.tar.gz rm -rf "${LIB_DEST_DIR}" "${LIB_NAME}" -[ -f "${LIB_NAME}.tar.gz" ] || curl -LO https://github.com/curl/curl/releases/download/${LIB_VERSION}/${LIB_NAME}.tar.gz >${LIB_NAME}.tar.gz +[ -f "${LIB_NAME}.tar.gz" ] || curl -L -o ${LIB_NAME}.tar.gz https://github.com/curl/curl/releases/download/${LIB_VERSION}/${LIB_NAME}.tar.gz -s +[ -f "${LIB_NAME}.tar.gz" ] || log_error "curl download error!" set_android_toolchain_bin diff --git a/Common/3dParty/curl/build-common.sh b/Common/3dParty/curl/build-common.sh index 9205607bc6..1179a643b4 100755 --- a/Common/3dParty/curl/build-common.sh +++ b/Common/3dParty/curl/build-common.sh @@ -31,6 +31,10 @@ function get_cpu_count() { } function init_log_color() { + bold_color= + warn_color= + error_color= + reset_color= if test -t 1 && which tput >/dev/null 2>&1; then ncolors=$(tput colors) if test -n "$ncolors" && test $ncolors -ge 8; then diff --git a/Common/3dParty/curl/build-ios-curl.sh b/Common/3dParty/curl/build-ios-curl.sh index 0fe56ca61c..8823afc890 100755 --- a/Common/3dParty/curl/build-ios-curl.sh +++ b/Common/3dParty/curl/build-ios-curl.sh @@ -47,7 +47,8 @@ echo "https://github.com/curl/curl/releases/download/${LIB_VERSION}/${LIB_NAME}. DEVELOPER=$(xcode-select -print-path) SDK_VERSION=$(xcrun -sdk iphoneos --show-sdk-version) rm -rf "${LIB_DEST_DIR}" "${LIB_NAME}" -[ -f "${LIB_NAME}.tar.gz" ] || curl -LO https://github.com/curl/curl/releases/download/${LIB_VERSION}/${LIB_NAME}.tar.gz >${LIB_NAME}.tar.gz +[ -f "${LIB_NAME}.tar.gz" ] || curl -L -o ${LIB_NAME}.tar.gz https://github.com/curl/curl/releases/download/${LIB_VERSION}/${LIB_NAME}.tar.gz -s +[ -f "${LIB_NAME}.tar.gz" ] || log_error "curl download error!" function configure_make() { diff --git a/Common/3dParty/ixwebsocket/ixwebsocket.pri b/Common/3dParty/ixwebsocket/ixwebsocket.pri index d6bcd40e46..f4657c7656 100644 --- a/Common/3dParty/ixwebsocket/ixwebsocket.pri +++ b/Common/3dParty/ixwebsocket/ixwebsocket.pri @@ -10,30 +10,35 @@ core_android { ABI_PATH = $$replace(ABI_PATH, "arm64_v8a", "arm64-v8a") } - INCLUDEPATH += $$PWD/../ixwebsocket/IXWebSocket/build/android/$$ABI_PATH/usr/include - LIBS += $$PWD/../ixwebsocket/IXWebSocket/build/android/$$ABI_PATH/usr/lib/libixwebsocket.a + INSTALL_FOLDER = $$PWD/IXWebSocket/build/android/$$ABI_PATH + exists($$INSTALL_FOLDER/usr):INSTALL_FOLDER=$$INSTALL_FOLDER/usr + + INCLUDEPATH += $$INSTALL_FOLDER/include + LIBS += $$INSTALL_FOLDER/lib/libixwebsocket.a OPENSSL_LIBS_DIRECTORY = $$PWD/../openssl/build/android/$$ABI_PATH/lib } core_ios { - INCLUDEPATH += $$PWD/../ixwebsocket/IXWebSocket/build/ios/openssl-universal/include - LIBS += $$PWD/../ixwebsocket/IXWebSocket/build/ios/ixwebsocket-universal/lib/libixwebsocket.a + INCLUDEPATH += $$PWD/IXWebSocket/build/ios/ixwebsocket-universal/include + LIBS += $$PWD/IXWebSocket/build/ios/ixwebsocket-universal/lib/libixwebsocket.a + + OPENSSL_LIBS_DIRECTORY = $$PWD/../openssl/build/ios/openssl-universal/lib } core_linux { - INCLUDEPATH += $$PWD/../ixwebsocket/IXWebSocket/build/linux/$$CORE_BUILDS_PLATFORM_PREFIX/include - LIBS += $$PWD/../ixwebsocket/IXWebSocket/build/linux/$$CORE_BUILDS_PLATFORM_PREFIX/lib/libixwebsocket.a + INCLUDEPATH += $$PWD/IXWebSocket/build/linux/$$CORE_BUILDS_PLATFORM_PREFIX/include + LIBS += $$PWD/IXWebSocket/build/linux/$$CORE_BUILDS_PLATFORM_PREFIX/lib/libixwebsocket.a } core_mac { - INCLUDEPATH += $$PWD/../ixwebsocket/IXWebSocket/build/mac/$$CORE_BUILDS_PLATFORM_PREFIX/include - LIBS += $$PWD/../ixwebsocket/IXWebSocket/build/mac/$$CORE_BUILDS_PLATFORM_PREFIX/lib/libixwebsocket.a \ + INCLUDEPATH += $$PWD/IXWebSocket/build/mac/$$CORE_BUILDS_PLATFORM_PREFIX/include + LIBS += $$PWD/IXWebSocket/build/mac/$$CORE_BUILDS_PLATFORM_PREFIX/lib/libixwebsocket.a \ } core_windows { diff --git a/Common/3dParty/openssl/build-android-common.sh b/Common/3dParty/openssl/build-android-common.sh index a1ed528c4a..d1b069c047 100755 --- a/Common/3dParty/openssl/build-android-common.sh +++ b/Common/3dParty/openssl/build-android-common.sh @@ -32,11 +32,6 @@ if [[ -z ${ANDROID_NDK_ROOT} ]]; then exit 1 fi -if [[ -z ${ANDROID_HOME} ]]; then - echo "ANDROID_HOME not defined" - exit 1 -fi - function get_toolchain() { HOST_OS=$(uname -s) case ${HOST_OS} in diff --git a/Common/3dParty/openssl/build-android-openssl.sh b/Common/3dParty/openssl/build-android-openssl.sh index f9ee5b8e77..d0832be708 100755 --- a/Common/3dParty/openssl/build-android-openssl.sh +++ b/Common/3dParty/openssl/build-android-openssl.sh @@ -44,7 +44,8 @@ echo "https://www.openssl.org/source/${LIB_NAME}.tar.gz" # https://github.com/openssl/openssl/archive/OpenSSL_1_1_1d.tar.gz # https://github.com/openssl/openssl/archive/OpenSSL_1_1_1f.tar.gz -[ -f "${LIB_NAME}.tar.gz" ] || curl https://www.openssl.org/source/${LIB_NAME}.tar.gz >${LIB_NAME}.tar.gz +[ -f "${LIB_NAME}.tar.gz" ] || curl -L -o ${LIB_NAME}.tar.gz https://www.openssl.org/source/${LIB_NAME}.tar.gz -s +[ -f "${LIB_NAME}.tar.gz" ] || log_error "openssl download error!" set_android_toolchain_bin diff --git a/Common/3dParty/openssl/build-common.sh b/Common/3dParty/openssl/build-common.sh index 9205607bc6..1179a643b4 100755 --- a/Common/3dParty/openssl/build-common.sh +++ b/Common/3dParty/openssl/build-common.sh @@ -31,6 +31,10 @@ function get_cpu_count() { } function init_log_color() { + bold_color= + warn_color= + error_color= + reset_color= if test -t 1 && which tput >/dev/null 2>&1; then ncolors=$(tput colors) if test -n "$ncolors" && test $ncolors -ge 8; then diff --git a/Common/3dParty/openssl/build-ios-openssl.sh b/Common/3dParty/openssl/build-ios-openssl.sh index b266b3adaa..70f4f8de19 100755 --- a/Common/3dParty/openssl/build-ios-openssl.sh +++ b/Common/3dParty/openssl/build-ios-openssl.sh @@ -48,7 +48,8 @@ echo "https://www.openssl.org/source/${LIB_NAME}.tar.gz" DEVELOPER=$(xcode-select -print-path) SDK_VERSION=$(xcrun -sdk iphoneos --show-sdk-version) rm -rf "${LIB_DEST_DIR}" "${LIB_NAME}" -[ -f "${LIB_NAME}.tar.gz" ] || curl https://www.openssl.org/source/${LIB_NAME}.tar.gz >${LIB_NAME}.tar.gz +[ -f "${LIB_NAME}.tar.gz" ] || curl -L -o ${LIB_NAME}.tar.gz https://www.openssl.org/source/${LIB_NAME}.tar.gz -s +[ -f "${LIB_NAME}.tar.gz" ] || log_error "openssl download error!" function configure_make() { @@ -93,6 +94,7 @@ function configure_make() { # openssl1.1.1d can be set normally, 1.1.0f does not take effect ./Configure darwin64-x86_64-cc no-shared --prefix="${PREFIX_DIR}" + sed -i -e 's/-mtune=intel//g' "Makefile" elif [[ "${ARCH}" == "armv7" ]]; then @@ -111,6 +113,7 @@ function configure_make() { # openssl1.1.1d can be set normally, 1.1.0f does not take effect ./Configure darwin-i386-cc no-shared --prefix="${PREFIX_DIR}" enable-ssl3 enable-ssl3-method sed -ie "s!-fno-common!-fno-common -fembed-bitcode !" "Makefile" + sed -i -e 's/-mtune=intel//g' "Makefile" else log_error "not support" && exit 1 diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h b/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h index 458ecedf13..e75d66e2bd 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h @@ -3654,7 +3654,6 @@ namespace SimpleTypes ECssMsoPosHorRel eMsoPosHorRel; ECssMsoPosVer eMsoPosVer; ECssMsoPosVerRel eMsoPosVerRel; - double dValue; bool bValue; ECssMsoWrapStyle eMsoWrapStyle; ECssPosition ePosition; @@ -3909,10 +3908,10 @@ namespace SimpleTypes case cssptMsoPositionHorizontalRelative : ReadValue_MsoPosHorRel( sValue ); break; case cssptMsoPositionVertical : ReadValue_MsoPosVer( sValue ); break; case cssptMsoPositionVerticalRelative : ReadValue_MsoPosVerRel( sValue ); break; - case cssptMsoWrapDistanceBottom : ReadValue_Double( sValue ); break; - case cssptMsoWrapDistanceLeft : ReadValue_Double( sValue ); break; - case cssptMsoWrapDistanceRight : ReadValue_Double( sValue ); break; - case cssptMsoWrapDistanceTop : ReadValue_Double( sValue ); break; + case cssptMsoWrapDistanceBottom : ReadValue_Units( sValue ); break; + case cssptMsoWrapDistanceLeft : ReadValue_Units( sValue ); break; + case cssptMsoWrapDistanceRight : ReadValue_Units( sValue ); break; + case cssptMsoWrapDistanceTop : ReadValue_Units( sValue ); break; case cssptMsoWrapEdited : ReadValue_Boolean( sValue ); break; case cssptMsoWrapStyle : ReadValue_MsoWrapStyle( sValue ); break; case cssptPosition : ReadValue_Position( sValue ); break; @@ -3930,12 +3929,12 @@ namespace SimpleTypes case cssptMsoLayoutFlowAlt : ReadValue_LayoutFlowAlt( sValue ); break; case cssptMsoNextTextbox : ReadValue_String( sValue ); break; case cssptMsoRotate : ReadValue_MsoRotate( sValue ); break; - case cssptMsoTextScale : ReadValue_Double( sValue ); break; + case cssptMsoTextScale : ReadValue_Units( sValue ); break; case cssptVTextAnchor : ReadValue_VTextAnchor( sValue ); break; case cssptFont : ReadValue_String( sValue ); break; case cssptFontFamily : ReadValue_String( sValue ); break; - case cssptFontSize : ReadValue_Double( sValue ); break; + case cssptFontSize : ReadValue_Units( sValue ); break; case cssptFontStyle : ReadValue_FontStyle( sValue ); break; case cssptFontVariant : ReadValue_FontVariant( sValue ); break; case cssptFontWeight : ReadValue_FontWeight( sValue ); break; @@ -3947,9 +3946,9 @@ namespace SimpleTypes case cssptVTextKern : ReadValue_Boolean( sValue ); break; case cssptVTextReverse : ReadValue_Boolean( sValue ); break; case cssptVTextSpacingMode : ReadValue_VTextSpacingMode( sValue ); break; - case cssptVTextSpacing : ReadValue_Double( sValue ); break; - case csspctMsoWidthPercent : ReadValue_Double( sValue ); break; - case csspctMsoHeightPercent : ReadValue_Double( sValue ); break; + case cssptVTextSpacing : ReadValue_Units( sValue ); break; + case csspctMsoWidthPercent : ReadValue_Units( sValue ); break; + case csspctMsoHeightPercent : ReadValue_Units( sValue ); break; case cssptHTextAlign : ReadValue_VTextAlign( sValue ); break; }; } @@ -3981,7 +3980,7 @@ namespace SimpleTypes m_oValue.oValue.eType = cssunitstypeUnits; std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = strValue.empty() ? 0 : _wtof(strValue.c_str() ); + double dValue = XmlUtils::GetDouble(sValue); m_oValue.oValue.dValue = Inch_To_Pt(dValue); } @@ -3990,7 +3989,7 @@ namespace SimpleTypes m_oValue.oValue.eType = cssunitstypeUnits; std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = strValue.empty() ? 0 : _wtof(strValue.c_str() ); + double dValue = XmlUtils::GetDouble(sValue); m_oValue.oValue.dValue = Cm_To_Pt(dValue); } @@ -3999,7 +3998,7 @@ namespace SimpleTypes m_oValue.oValue.eType = cssunitstypeUnits; std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = strValue.empty() ? 0 : _wtof(strValue.c_str() ); + double dValue = XmlUtils::GetDouble(sValue); m_oValue.oValue.dValue = Mm_To_Pt(dValue); } @@ -4016,7 +4015,7 @@ namespace SimpleTypes m_oValue.oValue.eType = cssunitstypeUnits; std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = strValue.empty() ? 0 : _wtof(strValue.c_str() ); + double dValue = XmlUtils::GetDouble(sValue); m_oValue.oValue.dValue = dValue; } @@ -4025,7 +4024,7 @@ namespace SimpleTypes m_oValue.oValue.eType = cssunitstypeUnits; std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = strValue.empty() ? 0 : _wtof(strValue.c_str() ); + double dValue = XmlUtils::GetDouble(sValue); m_oValue.oValue.dValue = dValue * 12; } @@ -4041,7 +4040,7 @@ namespace SimpleTypes m_oValue.oValue.eType = cssunitstypeUnits; std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = strValue.empty() ? 0 : _wtof(strValue.c_str() ); + double dValue = XmlUtils::GetDouble(sValue); m_oValue.oValue.dValue = Px_To_Pt(dValue); } @@ -4050,7 +4049,7 @@ namespace SimpleTypes m_oValue.oValue.eType = cssunitstypeAbsolute; try { - m_oValue.oValue.dValue = sValue.empty() ? 0 : _wtof(sValue.c_str() ); + m_oValue.oValue.dValue = XmlUtils::GetDouble(sValue); } catch(...) { @@ -4106,23 +4105,18 @@ namespace SimpleTypes void ReadValue_Rotation(std::wstring& sValue) { - m_oValue.dValue = sValue.empty() ? 0 : _wtof(sValue.c_str() ); + m_oValue.oValue.eType = cssunitstypeAbsolute; + m_oValue.oValue.dValue = sValue.empty() ? 0 : _wtof(sValue.c_str() ); if (sValue.find(_T("fd")) != std::wstring::npos) { - m_oValue.dValue /= 6000.; + m_oValue.oValue.dValue /= 6000.; } else if (sValue.find(_T("f")) == sValue.length() - 1) { - m_oValue.dValue /= 65536.; + m_oValue.oValue.dValue /= 65536.; } } - - void ReadValue_Double(std::wstring& sValue) - { - m_oValue.dValue = sValue.empty() ? 0 : _wtof(sValue.c_str() ); - } - void ReadValue_Boolean(std::wstring& sValue) { if ( _T("true") == sValue || _T("t") == sValue || _T("1") == sValue ) @@ -4130,7 +4124,6 @@ namespace SimpleTypes else m_oValue.bValue = false; } - void ReadValue_MsoWrapStyle(std::wstring& sValue) { if ( _T("square") == sValue ) m_oValue.eMsoWrapStyle = cssmsowrapstyleSqaure; diff --git a/Common/DocxFormat/Source/DocxFormat/CustomXml.h b/Common/DocxFormat/Source/DocxFormat/CustomXml.h index 48f3ca7e52..466ef6f982 100644 --- a/Common/DocxFormat/Source/DocxFormat/CustomXml.h +++ b/Common/DocxFormat/Source/DocxFormat/CustomXml.h @@ -42,7 +42,7 @@ namespace OOX //-------------------------------------------------------------------------------- // CCustomXML 22.5 //-------------------------------------------------------------------------------- - class CCustomXMLProps : public OOX::File, public WritingElement + class CCustomXMLProps : public OOX::FileGlobalEnumerated, public WritingElement { public: @@ -132,10 +132,10 @@ namespace OOX } }; //---------------------------------------------------------------------- - CCustomXMLProps(OOX::Document *pMain): OOX::File(pMain) + CCustomXMLProps(OOX::Document *pMain) : OOX::FileGlobalEnumerated(pMain) { } - CCustomXMLProps(OOX::Document *pMain, const OOX::CPath& oFilePath): OOX::File(pMain) + CCustomXMLProps(OOX::Document *pMain, const OOX::CPath& oFilePath): OOX::FileGlobalEnumerated(pMain) { read( oFilePath ); } @@ -182,7 +182,7 @@ namespace OOX { NSFile::CFileBinary::SaveToFile(oFilePath.GetPath(), toXML()); - oContent.Registration( type().OverrideType(), type().DefaultDirectory(), oFilePath.GetFilename() ); + oContent.Registration( type().OverrideType(), OOX::CPath(L"customXml"), oFilePath.GetFilename() ); } virtual EElementType getType() const { @@ -206,18 +206,21 @@ namespace OOX // Childs nullable m_oShemaRefs; -//------------- +//------------- for write from binary std::wstring m_oCustomXmlContent; + std::string m_oCustomXmlContentA; }; - class CCustomXML : public OOX::File, public OOX::IFileContainer + class CCustomXML : public OOX::FileGlobalEnumerated, public OOX::IFileContainer { public: - CCustomXML(OOX::Document *pMain): OOX::File(pMain), OOX::IFileContainer(pMain) + CCustomXML(OOX::Document *pMain, bool bDocument = true) : OOX::FileGlobalEnumerated(pMain), OOX::IFileContainer(pMain) { + m_bDocument = bDocument; } - CCustomXML(OOX::Document *pMain, const CPath& oRootPath, const CPath& oPath): OOX::File(pMain), OOX::IFileContainer(pMain) + CCustomXML(OOX::Document *pMain, const CPath& oRootPath, const CPath& oPath) : OOX::FileGlobalEnumerated(pMain), OOX::IFileContainer(pMain) { + m_bDocument = false; read( oRootPath, oPath ); } virtual ~CCustomXML() @@ -232,13 +235,19 @@ namespace OOX { IFileContainer::Read( oRootPath, oFilePath ); - NSFile::CFileBinary::ReadAllTextUtf8(oFilePath.GetPath(), m_sXml); + NSFile::CFileBinary::ReadAllTextUtf8A(oFilePath.GetPath(), m_sXmlA); } virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const { - NSFile::CFileBinary::SaveToFile( oFilePath.GetPath(), m_sXml ); - - oContent.Registration( type().OverrideType(), oDirectory, oFilePath.GetFilename() ); + NSFile::CFileBinary oFile; + if (true == oFile.CreateFileW(oFilePath.GetPath())) + { + if (false == m_sXmlA.empty()) + oFile.WriteFile((BYTE*)m_sXmlA.c_str(), m_sXmlA.length()); + oFile.CloseFile(); + } + + IFileContainer::Write(oFilePath, oDirectory, oContent); } virtual const OOX::FileType type() const { @@ -246,7 +255,9 @@ namespace OOX } virtual const CPath DefaultDirectory() const { - return type().DefaultDirectory(); + //if (m_bDocument) return type().DefaultDirectory(); + //else + return L"../" + type().DefaultDirectory(); } virtual const CPath DefaultFileName() const { @@ -273,9 +284,10 @@ namespace OOX return L""; } - std::wstring m_sXml; - - bool bUsed = false; + std::string m_sXmlA; + + bool m_bUsed = false; + bool m_bDocument = false; }; } // namespace OOX diff --git a/Common/DocxFormat/Source/DocxFormat/Docx.cpp b/Common/DocxFormat/Source/DocxFormat/Docx.cpp index 9af0024ca7..10dc07f1f4 100644 --- a/Common/DocxFormat/Source/DocxFormat/Docx.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Docx.cpp @@ -127,8 +127,8 @@ namespace OOX { OOX::CCustomXML* pCustomXml = dynamic_cast(container[i].GetPointer()); if(OOX::CSettingsCustom::GetSchemaUrl() == pCustomXml->GetSchemaUrl()) { - pCustomXml->bUsed = true; - return pCustomXml->m_sXml; + pCustomXml->m_bUsed = true; + return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)pCustomXml->m_sXmlA.c_str(), pCustomXml->m_sXmlA.length()); } } } diff --git a/Common/DocxFormat/Source/DocxFormat/FileTypes.h b/Common/DocxFormat/Source/DocxFormat/FileTypes.h index 26ad4f2ce5..807df1fc96 100644 --- a/Common/DocxFormat/Source/DocxFormat/FileTypes.h +++ b/Common/DocxFormat/Source/DocxFormat/FileTypes.h @@ -158,11 +158,13 @@ namespace OOX const FileType CustomXml (L"customXml", L"item.xml", L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"); + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", + L"customXml/item", true, true); - const FileType CustomXmlProps (L"customXml", L"itemProps.xml", + const FileType CustomXmlProps (L"", L"itemProps.xml", L"application/vnd.openxmlformats-officedocument.customXmlProperties+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"); + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", + L"customXml/itemProps", true, true); const FileType HyperLink (L"", L"", L"", diff --git a/Common/DocxFormat/Source/DocxFormat/Styles.h b/Common/DocxFormat/Source/DocxFormat/Styles.h index 55b7bd76a9..591811a067 100644 --- a/Common/DocxFormat/Source/DocxFormat/Styles.h +++ b/Common/DocxFormat/Source/DocxFormat/Styles.h @@ -97,7 +97,6 @@ namespace ComplexTypes void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { - // Читаем атрибуты WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Read_if ( oReader, L"w:locked", m_oLocked ) WritingElement_ReadAttributes_Read_else_if( oReader, L"w:name", m_sName ) @@ -653,23 +652,27 @@ namespace OOX sResult += L">"; - WritingElement_WriteNode_1( L"toXML(); } - WritingElement_WriteNode_2( m_oTcPr ); - WritingElement_WriteNode_2( m_oTrPr ); - WritingElement_WriteNode_1( L""; diff --git a/Common/DocxFormat/Source/DocxFormat/VmlDrawing.cpp b/Common/DocxFormat/Source/DocxFormat/VmlDrawing.cpp index 2b5f70e6b9..f4e3c8356b 100644 --- a/Common/DocxFormat/Source/DocxFormat/VmlDrawing.cpp +++ b/Common/DocxFormat/Source/DocxFormat/VmlDrawing.cpp @@ -252,7 +252,7 @@ namespace OOX } - if (fileContent.length() > 0) + if (false == fileContent.empty()) { // элементы вида
без
// test_vml4.xlsx diff --git a/Common/Network/FileTransporter/filetransporter.pri b/Common/Network/FileTransporter/filetransporter.pri index f38753dce2..228f705fa6 100644 --- a/Common/Network/FileTransporter/filetransporter.pri +++ b/Common/Network/FileTransporter/filetransporter.pri @@ -30,8 +30,7 @@ core_mac { core_ios { OBJECTIVE_SOURCES += \ - $$PWD/src/FileTransporter_mac.mm \ - $$PWD/../../../DesktopEditor/common/File_ios.mm + $$PWD/src/FileTransporter_mac.mm LIBS += -framework Foundation } diff --git a/Common/Network/WebSocket/websocket.pri b/Common/Network/WebSocket/websocket.pri index 6a33864521..b3b67daa05 100644 --- a/Common/Network/WebSocket/websocket.pri +++ b/Common/Network/WebSocket/websocket.pri @@ -1,6 +1,11 @@ -CONFIG += ixwebsocket -core_mac:CONFIG += socketrocket -core_ios:CONFIG += socketrocket +core_mac:CONFIG += apple_platform +core_ios:CONFIG += apple_platform + +apple_platform { + CONFIG += socketrocket +} else { + CONFIG += ixwebsocket +} HEADERS += \ $$PWD/include/websocket.h \ diff --git a/Common/Network/network.pro b/Common/Network/network.pro index d8677e34c9..fc077f8f6c 100644 --- a/Common/Network/network.pro +++ b/Common/Network/network.pro @@ -3,6 +3,8 @@ TEMPLATE = lib CONFIG -= qt QT -= core gui + +CONFIG += shared CONFIG += plugin CORE_ROOT_DIR = $$PWD/../.. diff --git a/Common/kernel.pro b/Common/kernel.pro index ee6ad7c6e6..167cdf00ae 100644 --- a/Common/kernel.pro +++ b/Common/kernel.pro @@ -37,7 +37,7 @@ SOURCES += \ ./../DesktopEditor/graphics/TemporaryCS.cpp # THREAD -core_android:DEFINES += NOT_USE_PTHREAD_CANCEL +core_android:DEFINES += NOT_USE_PTHREAD_CANCEL USE_FILE32API HEADERS += \ ./../DesktopEditor/graphics/BaseThread.h @@ -92,3 +92,8 @@ core_windows { LIBS += -lRpcrt4 LIBS += -lShell32 } + +core_ios { + OBJECTIVE_SOURCES += ./../DesktopEditor/common/File_ios.mm + LIBS += -framework Foundation +} diff --git a/OfficeCryptReader/source/ECMACryptFile.cpp b/OfficeCryptReader/source/ECMACryptFile.cpp index a730c51066..0e1fdd792a 100644 --- a/OfficeCryptReader/source/ECMACryptFile.cpp +++ b/OfficeCryptReader/source/ECMACryptFile.cpp @@ -45,6 +45,8 @@ //CRYPT::_ecmaCryptData cryptDataGlobal; for Test +#define USE_MSSTORAGE + using namespace CRYPT; #define GETBIT(from, num) ((from & (1 << num)) != 0) @@ -741,7 +743,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s //------------------------------------------------------------------- -#if defined(_WIN32) || defined(_WIN64) +#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE) IStorage *winStorage = NULL; StgCreateDocfile(file_name_out.c_str(), STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &winStorage); @@ -759,7 +761,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s POLE::Stream *pStream = NULL; #endif //------------------------------------------------------------------- -#if defined(_WIN32) || defined(_WIN64) +#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE) ULONG nWritten; winStorage->CreateStream(L"EncryptedPackage", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &winStream); winStream->Write(data_out, lengthData, &nWritten); @@ -782,7 +784,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s cryptor.GetCryptData(cryptData); -#if defined(_WIN32) || defined(_WIN64) +#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE) winStorage->CreateStream(L"EncryptionInfo", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &winStream); if (cryptData.bAgile) { @@ -876,7 +878,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s if (false == documentID.empty()) { std::string utfDocumentID = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(documentID); -#if defined(_WIN32) || defined(_WIN64) +#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE) winStorage->CreateStream(L"DocumentID", STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &winStream); winStream->Write((BYTE*)utfDocumentID.c_str(), utfDocumentID.length(), &nWritten); winStream->Release(); @@ -890,7 +892,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s #endif } //------------------------------------------------------------------- -#if defined(_WIN32) || defined(_WIN64) +#if (defined(_WIN32) || defined(_WIN64)) && defined(USE_MSSTORAGE) if (winStorage) winStorage->Release(); #else diff --git a/X2tConverter/build/Android/libx2t/build.gradle.kts b/X2tConverter/build/Android/libx2t/build.gradle.kts index 4a85199169..7dd65d6e02 100644 --- a/X2tConverter/build/Android/libx2t/build.gradle.kts +++ b/X2tConverter/build/Android/libx2t/build.gradle.kts @@ -79,6 +79,7 @@ android { jniLibs.pickFirsts.add("lib/$abi/${it.name}") } jniLibs.pickFirsts.add("lib/$abi/lib${extra.get("NAME_LIB")}.so") + jniLibs.pickFirsts.add("lib/$abi/lib${extra.get("NAME_LIB_KERNEL_NETWORK")}.so") } } } diff --git a/X2tConverter/build/Android/libx2t/gradle.properties b/X2tConverter/build/Android/libx2t/gradle.properties index b77e0b85fe..ad06b7dbd5 100644 --- a/X2tConverter/build/Android/libx2t/gradle.properties +++ b/X2tConverter/build/Android/libx2t/gradle.properties @@ -4,4 +4,5 @@ PATH_LIB_DST = ../extras/libs/x2t PATH_SRC_CORE = ../../../.. PATH_SRC_ICU_DAT_FILE = ../../../../../build_tools/out/android/onlyoffice/mobile/lib/arm64-v8a/icudt58l.dat PATH_SRC_ICU_V8_DAT_FILE = ../../../../Common/3dParty/v8/android/build/arm64-v8a/icudtl.dat -NAME_LIB = x2tConverter \ No newline at end of file +NAME_LIB = x2tConverter +NAME_LIB_KERNEL_NETWORK = kernel_network \ No newline at end of file diff --git a/X2tConverter/src/cextracttools.cpp b/X2tConverter/src/cextracttools.cpp index 4b5e92c493..ea70512e5b 100644 --- a/X2tConverter/src/cextracttools.cpp +++ b/X2tConverter/src/cextracttools.cpp @@ -293,7 +293,7 @@ namespace NExtractTools else if (0 == sExt2.compare(_T(".bin"))) res = TCD_TXT2DOCT_BIN; }break; case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: - { + {//pot,pps - by extension - potx(potm), ppsx(ppsm) if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPT2PPTX; else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPT2PPTM; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPT2PPTT_BIN; diff --git a/XlsxSerializerCom/Common/BinReaderWriterDefines.h b/XlsxSerializerCom/Common/BinReaderWriterDefines.h index 8f73ea58ce..0b3cd80e3f 100755 --- a/XlsxSerializerCom/Common/BinReaderWriterDefines.h +++ b/XlsxSerializerCom/Common/BinReaderWriterDefines.h @@ -83,7 +83,8 @@ namespace BinXlsxRW App = 6, Core = 7, PersonList = 8, - CustomProperties = 9 + CustomProperties = 9, + Customs = 10 };} namespace c_oSerStylesTypes{enum c_oSerStylesTypes @@ -624,6 +625,13 @@ namespace BinXlsxRW ChildChain = 5, NewThread = 6 };} + namespace c_oSerCustoms {enum c_oSerCustoms + { + Custom = 0, + ItemId = 1, + Uri = 2, + Content = 3 + };} namespace c_oSer_ChartType{enum c_oSer_ChartType { Legend = 0, diff --git a/XlsxSerializerCom/Reader/BinaryWriter.cpp b/XlsxSerializerCom/Reader/BinaryWriter.cpp index e1059fc314..d0abc13d7d 100644 --- a/XlsxSerializerCom/Reader/BinaryWriter.cpp +++ b/XlsxSerializerCom/Reader/BinaryWriter.cpp @@ -52,6 +52,7 @@ #include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h" #include "../../Common/DocxFormat/Source/DocxFormat/App.h" #include "../../Common/DocxFormat/Source/DocxFormat/Core.h" +#include "../../Common/DocxFormat/Source/DocxFormat/CustomXml.h" #include "../../Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h" #include "../../Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinkPath.h" #include "../../Common/DocxFormat/Source/XlsxFormat/Comments/ThreadedComments.h" @@ -6943,7 +6944,7 @@ void BinaryWorksheetTableWriter::WriteSlicers(OOX::Spreadsheet::CWorksheet& oWor } } } - +//--------------------------------------------------------------------------------------------------------------------- BinaryCalcChainTableWriter::BinaryCalcChainTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream) : m_oBcw(oCBufferedStream) { } @@ -7009,7 +7010,60 @@ void BinaryCalcChainTableWriter::WriteCalcChain(OOX::Spreadsheet::CCalcCell& oCa m_oBcw.m_oStream.WriteBOOL(oCalcCell.m_oNewThread->ToBool()); } } +//----------------------------------------------------------------------------------------------------- +BinaryCustomsTableWriter::BinaryCustomsTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream) : m_oBcw(oCBufferedStream) +{ +} +void BinaryCustomsTableWriter::Write(OOX::IFileContainer *pContainer) +{ + if (!pContainer) return; + int nStart = m_oBcw.WriteItemWithLengthStart(); + + std::vector>& container = pContainer->GetContainer(); + for (size_t i = 0; i < container.size(); ++i) + { + if (OOX::FileTypes::CustomXml == container[i]->type()) + { + OOX::CCustomXML* pCustomXml = dynamic_cast(container[i].GetPointer()); + if (pCustomXml->m_bUsed) continue; + + int nCurPos = m_oBcw.WriteItemStart(c_oSerCustoms::Custom); + + std::vector>& containerCustom = pCustomXml->GetContainer(); + for (size_t i = 0; i < containerCustom.size(); ++i) + { + if (OOX::FileTypes::CustomXmlProps == containerCustom[i]->type()) + { + OOX::CCustomXMLProps* pCustomXmlProps = dynamic_cast(containerCustom[i].GetPointer()); + + int nCurPos1 = m_oBcw.WriteItemStart(c_oSerCustoms::ItemId); + m_oBcw.m_oStream.WriteStringW3(pCustomXmlProps->m_oItemID.ToString()); + m_oBcw.WriteItemEnd(nCurPos1); + + if (pCustomXmlProps->m_oShemaRefs.IsInit()) + { + for (size_t j = 0; j < pCustomXmlProps->m_oShemaRefs->m_arrItems.size(); ++j) + { + nCurPos1 = m_oBcw.WriteItemStart(c_oSerCustoms::Uri); + m_oBcw.m_oStream.WriteStringW3(pCustomXmlProps->m_oShemaRefs->m_arrItems[j]->m_sUri); + m_oBcw.WriteItemEnd(nCurPos1); + } + } + } + } + + int nCurPos2 = m_oBcw.WriteItemStart(c_oSerCustoms::Content); + m_oBcw.m_oStream.WriteStringA(pCustomXml->m_sXmlA); + m_oBcw.WriteItemEnd(nCurPos2); + + m_oBcw.WriteItemEnd(nCurPos); + pCustomXml->m_bUsed = true; + } + } + m_oBcw.WriteItemWithLengthEnd(nStart); +} +//------------------------------------------------------------------------------------------------------ BinaryOtherTableWriter::BinaryOtherTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, PPTX::Theme* pTheme, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter) : m_oBcw (oCBufferedStream), m_pEmbeddedFontsManager (pEmbeddedFontsManager), @@ -7320,6 +7374,12 @@ void BinaryFileWriter::intoBindoc(OOX::Document *pDocument, NSBinPptxRW::CBinary BinaryOtherTableWriter oBinaryOtherTableWriter(oBufferedStream, pEmbeddedFontsManager, pXlsx->GetTheme(), pOfficeDrawingConverter); oBinaryOtherTableWriter.Write(); WriteTableEnd(nCurPos); + + //Customs from Workbook (todooo - другие) + nCurPos = WriteTableStart(c_oSerTableTypes::Customs); + BinaryCustomsTableWriter oBinaryCustomsTableWriter(oBufferedStream); + oBinaryCustomsTableWriter.Write(pXlsx->m_pWorkbook); + WriteTableEnd(nCurPos); } else if (pXlsxFlat) { diff --git a/XlsxSerializerCom/Reader/BinaryWriter.h b/XlsxSerializerCom/Reader/BinaryWriter.h index f4974be22a..744ceb6e37 100755 --- a/XlsxSerializerCom/Reader/BinaryWriter.h +++ b/XlsxSerializerCom/Reader/BinaryWriter.h @@ -289,6 +289,13 @@ namespace BinXlsxRW void WriteDataValidation(const OOX::Spreadsheet::CDataValidation& oDataValidation); void WriteSlicers(OOX::Spreadsheet::CWorksheet& oWorksheet, const OOX::Spreadsheet::CSlicerRefs& oSlicers); }; + class BinaryCustomsTableWriter + { + BinaryCommonWriter m_oBcw; + public: + BinaryCustomsTableWriter(NSBinPptxRW::CBinaryFileWriter &oCBufferedStream); + void Write(OOX::IFileContainer *pContainer); + }; class BinaryCalcChainTableWriter { BinaryCommonWriter m_oBcw; diff --git a/XlsxSerializerCom/Writer/BinaryCommonReader.h b/XlsxSerializerCom/Writer/BinaryCommonReader.h index af54961274..74d55bcb48 100644 --- a/XlsxSerializerCom/Writer/BinaryCommonReader.h +++ b/XlsxSerializerCom/Writer/BinaryCommonReader.h @@ -117,7 +117,7 @@ namespace BinXlsxRW { protected: NSBinPptxRW::CBinaryFileReader& m_oBufferedStream; public: - Binary_CommonReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream):m_oBufferedStream(poBufferedStream) + Binary_CommonReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream) : m_oBufferedStream(poBufferedStream) { } }; diff --git a/XlsxSerializerCom/Writer/BinaryReader.cpp b/XlsxSerializerCom/Writer/BinaryReader.cpp index 5328d01027..865869709d 100644 --- a/XlsxSerializerCom/Writer/BinaryReader.cpp +++ b/XlsxSerializerCom/Writer/BinaryReader.cpp @@ -67,6 +67,7 @@ #include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h" #include "../../Common/DocxFormat/Source/DocxFormat/App.h" #include "../../Common/DocxFormat/Source/DocxFormat/Core.h" +#include "../../Common/DocxFormat/Source/DocxFormat/CustomXml.h" #include "../../Common/DocxFormat/Source/XlsxFormat/Comments/ThreadedComments.h" #include "../../Common/DocxFormat/Source/XlsxFormat/Slicer/SlicerCache.h" @@ -7141,7 +7142,65 @@ int BinaryPersonReader::ReadPerson(BYTE type, long length, void* poResult) res = c_oSerConstants::ReadUnknown; return res; } +//------------------------------------------------------------------------------------------------------------------------------------ +BinaryCustomsReader::BinaryCustomsReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorkbook* pWorkbook) : Binary_CommonReader(oBufferedStream), m_pWorkbook(pWorkbook) +{ +} +int BinaryCustomsReader::Read() +{ + int res = c_oSerConstants::ReadOk; + READ_TABLE_DEF(res, this->ReadCustom, NULL); + return res; +} +int BinaryCustomsReader::ReadCustom(BYTE type, long length, void* poResult) +{ + int res = c_oSerConstants::ReadOk; + if (c_oSerCustoms::Custom == type) + { + OOX::CCustomXMLProps *pCustomXmlProps = new OOX::CCustomXMLProps(NULL); + + int res = c_oSerConstants::ReadOk; + READ1_DEF(length, res, this->ReadCustomContent, pCustomXmlProps); + + OOX::CCustomXML *pCustomXml = new OOX::CCustomXML(NULL, false); + pCustomXml->m_sXmlA = pCustomXmlProps->m_oCustomXmlContentA; + + smart_ptr oCustomXmlPropsFile(pCustomXmlProps); + smart_ptr oCustomXmlFile(pCustomXml); + + pCustomXml->Add(oCustomXmlPropsFile); + m_pWorkbook->Add(oCustomXmlFile); + } + else + res = c_oSerConstants::ReadUnknown; + return res; +} +int BinaryCustomsReader::ReadCustomContent(BYTE type, long length, void* poResult) +{ + int res = c_oSerConstants::ReadOk; + OOX::CCustomXMLProps* pCustomXMLProps = static_cast(poResult); + + if (c_oSerCustoms::Uri == type) + { + if (false == pCustomXMLProps->m_oShemaRefs.IsInit()) + pCustomXMLProps->m_oShemaRefs.Init(); + + pCustomXMLProps->m_oShemaRefs->m_arrItems.push_back(new OOX::CCustomXMLProps::CShemaRef()); + pCustomXMLProps->m_oShemaRefs->m_arrItems.back()->m_sUri = m_oBufferedStream.GetString3(length); + } + else if (c_oSerCustoms::ItemId == type) + { + pCustomXMLProps->m_oItemID.FromString(m_oBufferedStream.GetString3(length)); + } + else if (c_oSerCustoms::Content == type) + { + pCustomXMLProps->m_oCustomXmlContentA = m_oBufferedStream.GetString2A(); + } + else + res = c_oSerConstants::ReadUnknown; + return res; +} //------------------------------------------------------------------------------------------------------------------------------------ BinaryFileReader::BinaryFileReader() { @@ -7496,7 +7555,7 @@ int BinaryFileReader::ReadMainTable(OOX::Spreadsheet::CXlsx& oXlsx, NSBinPptxRW: return res; } - for(size_t i = 0, length = aTypes.size(); i < length; ++i) + for (size_t i = 0, length = aTypes.size(); i < length; ++i) { BYTE mtiType = aTypes[i]; long mtiOffBits = aOffBits[i]; @@ -7504,51 +7563,52 @@ int BinaryFileReader::ReadMainTable(OOX::Spreadsheet::CXlsx& oXlsx, NSBinPptxRW: oBufferedStream.Seek(mtiOffBits); switch(mtiType) { - case c_oSerTableTypes::App: + case c_oSerTableTypes::App: { PPTX::App oApp(NULL); oApp.fromPPTY(&oBufferedStream); + OOX::CApp* pApp = new OOX::CApp(NULL); pApp->FromPptxApp(&oApp); pApp->SetRequiredDefaults(); oXlsx.m_pApp = pApp; smart_ptr oCurFile(pApp); oXlsx.Add(oCurFile); - } - break; - case c_oSerTableTypes::Core: + }break; + case c_oSerTableTypes::Core: { PPTX::Core oCore(NULL); oCore.fromPPTY(&oBufferedStream); + OOX::CCore* pCore = new OOX::CCore(NULL); pCore->FromPptxCore(&oCore); pCore->SetRequiredDefaults(); oXlsx.m_pCore = pCore; smart_ptr oCurFile(pCore); oXlsx.Add(oCurFile); - } - break; - case c_oSerTableTypes::CustomProperties: + }break; + case c_oSerTableTypes::CustomProperties: { PPTX::CustomProperties* oCustomProperties = new PPTX::CustomProperties(NULL); oCustomProperties->fromPPTY(&oBufferedStream); smart_ptr oCurFile(oCustomProperties); oXlsx.Add(oCurFile); - } - break; - case c_oSerTableTypes::Styles: + }break; + case c_oSerTableTypes::Styles: { oXlsx.CreateStyles(); res = BinaryStyleTableReader(oBufferedStream, *oXlsx.m_pStyles).Read(); - } - break; - case c_oSerTableTypes::Worksheets: + }break; + case c_oSerTableTypes::Worksheets: { res = BinaryWorksheetsTableReader(oBufferedStream, *oXlsx.m_pWorkbook, oXlsx.m_pSharedStrings, oXlsx.m_arWorksheets, oXlsx.m_mapWorksheets, mapMedia, sOutDir, sMediaDir, oSaveParams, pOfficeDrawingConverter, m_mapPivotCacheDefinitions).Read(); - } - break; - } - if(c_oSerConstants::ReadOk != res) + }break; + case c_oSerTableTypes::Customs: + { + res = BinaryCustomsReader(oBufferedStream, oXlsx.m_pWorkbook).Read(); + }break; + } + if (c_oSerConstants::ReadOk != res) return res; } for (boost::unordered_map::const_iterator pPair = mapMedia.begin(); pPair != mapMedia.end(); ++pPair) diff --git a/XlsxSerializerCom/Writer/BinaryReader.h b/XlsxSerializerCom/Writer/BinaryReader.h index 1c0b365f50..024775fb8e 100644 --- a/XlsxSerializerCom/Writer/BinaryReader.h +++ b/XlsxSerializerCom/Writer/BinaryReader.h @@ -387,6 +387,15 @@ namespace BinXlsxRW int ReadPersonList(BYTE type, long length, void* poResult); int ReadPerson(BYTE type, long length, void* poResult); }; + class BinaryCustomsReader : public Binary_CommonReader + { + OOX::Spreadsheet::CWorkbook* m_pWorkbook; + public: + BinaryCustomsReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorkbook* pWorkbook); + int Read(); + int ReadCustom(BYTE type, long length, void* poResult); + int ReadCustomContent(BYTE type, long length, void* poResult); + }; class BinaryFileReader { public: