From 1ce6307a563f8a9b6fbfeb271066b6c62962212d Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Thu, 10 Nov 2022 23:25:20 +0300 Subject: [PATCH] Compiled version --- .../DocDocxConverter/CommentsMapping.h | 2 +- ASCOfficeDocxFile2/BinReader/ChartWriter.h | 2 +- ASCOfficeDocxFile2/BinReader/CommentsWriter.h | 20 +- .../BinReader/HeaderFooterWriter.h | 1 + ASCOfficeDocxFile2/BinReader/MediaWriter.h | 2 + ASCOfficeDocxFile2/BinReader/ReaderClasses.h | 30 +-- ASCOfficeDocxFile2/BinReader/Readers.cpp | 12 +- ASCOfficeDocxFile2/BinReader/Readers.h | 6 +- .../BinWriter/BinEquationWriter.h | 1 + ASCOfficeDocxFile2/BinWriter/BinWriters.cpp | 16 +- .../formulasconvert/formulasconvert_odf.cpp | 2 +- .../formulasconvert/formulasconvert_oox.cpp | 3 +- ASCOfficeOdfFile/include/xml/attributes.h | 2 +- .../include/xml/simple_xml_writer.h | 2 +- .../src/docx/docx_conversion_context.cpp | 2 +- ASCOfficeOdfFile/src/docx/mediaitems.cpp | 2 +- ASCOfficeOdfFile/src/docx/mediaitems.h | 2 +- .../src/docx/oox_drawing_fills.cpp | 2 +- .../src/docx/xlsx_complex_number_format.cpp | 2 +- .../src/docx/xlsx_conditionalFormatting.cpp | 2 +- .../src/docx/xlsx_data_validation.cpp | 2 +- .../src/docx/xlsx_drawing_context.cpp | 2 +- ASCOfficeOdfFile/src/docx/xlsx_hyperlinks.cpp | 2 +- .../src/docx/xlsx_pivots_context.cpp | 2 +- .../src/docx/xlsx_tablecontext.cpp | 2 +- ASCOfficeOdfFile/src/docx/xlsx_utils.cpp | 2 +- ASCOfficeOdfFile/src/odf/datatypes/bool.cpp | 2 +- ASCOfficeOdfFile/src/odf/draw_common.cpp | 2 +- ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp | 2 +- ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp | 2 +- ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp | 2 +- ASCOfficeOdfFile/src/odf/office_elements.h | 2 +- ASCOfficeOdfFile/src/odf/table_xlsx.cpp | 4 +- ASCOfficeOdfFile/src/xml/utils.cpp | 2 +- .../OdfFormat/odf_number_styles_context.cpp | 2 +- .../source/OdfFormat/odp_page_state.h | 2 +- .../source/OdfFormat/ods_table_state.h | 2 +- .../source/OdfFormat/oox_shape_defines.cpp | 1 + .../Oox2OdfConverter/ConvertDrawing.cpp | 10 +- .../source/Oox2OdfConverter/ConvertVml.cpp | 10 +- .../source/Oox2OdfConverter/DocxConverter.cpp | 18 +- .../source/Oox2OdfConverter/MathConverter.cpp | 2 +- .../source/Oox2OdfConverter/XlsxConverter.cpp | 4 +- .../PPTFormatLib/PPTFormatLib.cpp | 1 + .../PPTFormatLib/PPTXWriter/Converter.cpp | 28 ++- .../PPTFormatLib/PPTXWriter/ShapeWriter.cpp | 8 +- .../Records/Drawing/ShapeContainer.cpp | 1 + .../ASCOfficeDrawingConverter.cpp | 12 +- .../ASCOfficePPTXFileRealization.cpp | 2 +- .../Editor/BinaryFileReaderWriter.cpp | 8 +- .../Editor/BinaryFileReaderWriter.h | 2 + ASCOfficePPTXFile/Editor/DefaultNotesMaster.h | 3 +- ASCOfficePPTXFile/Editor/DefaultNotesTheme.h | 3 +- ASCOfficePPTXFile/Editor/Drawing/Attributes.h | 2 +- .../Drawing/Shapes/BaseShape/GraphicsPath.h | 1 + .../Shapes/BaseShape/PPTShape/BinaryReader.h | 2 +- .../PPTShape/Ppt2PptxShapeConverter.h | 24 +- .../Shapes/BaseShape/PPTShape/PptFormula.h | 2 +- .../Shapes/BaseShape/PPTXShape/PptxFormula.h | 2 +- .../Editor/Drawing/TextStructures.h | 2 +- ASCOfficePPTXFile/Editor/PPTXWriter.h | 2 +- ASCOfficePPTXFile/Editor/XmlWriter.h | 200 +-------------- ASCOfficePPTXFile/Editor/imagemanager.cpp | 4 +- .../PPTXFormat/LegacyDiagramText.h | 2 +- .../PPTXFormat/Limit/BaseLimit.h | 1 + .../PPTXFormat/Logic/Colors/SrgbClr.h | 1 + .../PPTXFormat/Logic/Colors/SysClr.h | 2 +- .../PPTXFormat/Logic/Fills/BlipFill.cpp | 2 +- ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp | 6 +- ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.cpp | 2 +- .../PPTXFormat/Logic/SpTreeElem.cpp | 2 +- ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.cpp | 1 + .../PPTXFormat/Logic/UniFill.cpp | 2 +- .../source/DestinationCommand.cpp | 1 + .../RtfFormatLib/source/DestinationCommand.h | 4 +- .../source/Reader/OOXMathReader.cpp | 64 ++--- .../source/Reader/OOXShapeReader.cpp | 6 +- .../RtfFormatLib/source/RtfBookmark.cpp | 2 +- .../RtfFormatLib/source/RtfChar.cpp | 4 +- ASCOfficeRtfFile/RtfFormatLib/source/RtfLex.h | 2 +- .../RtfFormatLib/source/RtfParagraph.cpp | 2 +- .../RtfFormatLib/source/RtfPicture.h | 2 +- .../RtfFormatLib/source/RtfProperty.cpp | 2 +- .../RtfFormatLib/source/RtfProperty.h | 6 +- .../RtfFormatLib/source/RtfSection.cpp | 2 +- .../RtfFormatLib/source/RtfShape.cpp | 30 +-- .../RtfFormatLib/source/RtfWriter.cpp | 2 +- ASCOfficeRtfFile/RtfFormatLib/source/Utils.h | 14 +- .../source/Writer/OOXCommentsWriter.h | 2 +- .../source/Writer/OOXContentTypesWriter.h | 4 +- .../source/Writer/OOXFontTableWriter.h | 2 +- .../source/Writer/OOXFootnoteWriter.h | 6 +- .../source/Writer/OOXNumberingWriter.h | 2 +- .../source/Writer/OOXRelsWriter.h | 2 +- .../source/Writer/OOXSettingsWriter.h | 2 +- .../source/Writer/OOXStylesWriter.h | 20 +- ASCOfficeXlsFile2/source/Common/utils.cpp | 2 +- .../source/VbaFormat/VbaReader.cpp | 2 +- .../XlsFormat/Logic/Biff_records/DConRef.cpp | 2 +- .../Logic/Biff_records/DataLabExtContents.cpp | 2 +- .../XlsFormat/Logic/Biff_records/Format.cpp | 2 +- .../XlsFormat/Logic/Biff_records/Number.cpp | 4 +- .../XlsFormat/Logic/Biff_records/SIIndex.cpp | 4 +- .../XlsFormat/Logic/Biff_records/SXString.cpp | 2 +- .../Logic/Biff_structures/PtgArea3d.cpp | 2 +- .../Logic/Biff_structures/PtgList.cpp | 2 +- .../Logic/Biff_structures/SyntaxPtg.cpp | 2 +- .../source/XlsFormat/Logic/Biff_unions/AI.cpp | 2 +- .../Logic/Biff_unions/FORMULA_bu.cpp | 2 +- .../Logic/Biff_unions/QUERYTABLE.cpp | 2 +- .../XlsFormat/Logic/Biff_unions/STYLES.cpp | 2 +- .../Logic/Biff_unions/SUPBOOK_bu.cpp | 2 +- .../SummaryInformationStream/CodePageOle.h | 3 +- .../PropertySetStream.cpp | 2 +- .../ConvertShapes/CustomShapeConvert.h | 42 ++-- .../ConvertShapes/FormulaShape.h | 2 +- .../ConvertShapes/XmlWriter.h | 236 +----------------- .../source/XlsXlsxConverter/XlsConverter.cpp | 2 +- .../XlsXlsxConverter/external_items.cpp | 2 +- .../source/XlsXlsxConverter/xlsx_package.cpp | 2 +- .../DocxFormatLib/DocxFormatLib.pro | 1 - Common/DocxFormat/Source/Base/Base.h | 3 + Common/DocxFormat/Source/Base/Unit.cpp | 17 +- Common/DocxFormat/Source/Base/Unit.h | 7 +- .../Source/Common/SimpleTypes_Rtf.cpp | 59 +++++ .../Source/Common/SimpleTypes_Rtf.h | 52 ++++ .../Source/DocxFormat/Diagram/DiagramColors.h | 4 +- .../Source/DocxFormat/Diagram/DiagramData.h | 44 ++-- .../DocxFormat/Diagram/DiagramLayout.cpp | 30 +-- .../Source/DocxFormat/Diagram/DiagramLayout.h | 42 ++-- .../DocxFormat/Source/DocxFormat/DocxFlat.h | 1 + .../Source/DocxFormat/Logic/Paragraph.cpp | 12 +- .../Source/DocxFormat/Logic/Run.cpp | 2 +- .../Source/DocxFormat/Settings/WebSettings.h | 55 +--- .../Source/DocxFormat/VmlDrawing.cpp | 12 +- .../XlsxFormat/Chart/ChartSerializeEx.cpp | 6 +- .../NamedSheetViews/NamedSheetViews.h | 2 +- .../Source/XlsxFormat/SharedStrings/Text.cpp | 2 +- .../Source/XlsxFormat/Slicer/SlicerCache.h | 8 +- .../XlsxFormat/Worksheets/SheetData.cpp | 2 +- .../XlsxFormat/Worksheets/Worksheet.cpp | 2 +- .../Source/XlsxFormat/WritingElement.h | 2 +- Common/DocxFormat/Source/XlsxFormat/Xlsx.cpp | 2 +- .../DocxFormat/Source/XlsxFormat/XlsxFlat.h | 1 + Common/FileWriter.h | 4 +- .../src/FileTransporter_win.cpp | 19 +- DesktopEditor/common/File.cpp | 17 +- DesktopEditor/common/File.h | 3 + DesktopEditor/common/StringBuilder.cpp | 9 + DesktopEditor/common/StringBuilder.h | 191 +++++++------- HtmlRenderer/test/main.cpp | 62 ++++- OfficeCryptReader/source/CryptTransform.cpp | 5 +- X2tConverter/src/cextracttools.h | 2 +- XlsxSerializerCom/Common/Common.h | 1 + XlsxSerializerCom/Reader/BinaryWriter.cpp | 8 +- XlsxSerializerCom/Writer/BinaryReader.cpp | 4 +- 156 files changed, 757 insertions(+), 970 deletions(-) create mode 100644 Common/DocxFormat/Source/Common/SimpleTypes_Rtf.cpp create mode 100644 Common/DocxFormat/Source/Common/SimpleTypes_Rtf.h diff --git a/ASCOfficeDocFile/DocDocxConverter/CommentsMapping.h b/ASCOfficeDocFile/DocDocxConverter/CommentsMapping.h index e348ad2807..dc6dca1d99 100644 --- a/ASCOfficeDocFile/DocDocxConverter/CommentsMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/CommentsMapping.h @@ -127,7 +127,7 @@ namespace DocFileFormat { if ((m_document->AnnotationsReferencesEx) && (index < m_document->AnnotationsReferencesEx->m_ReferencesEx.size())) { - _paraId = XmlUtils::IntToString(x++, L"%08X"); + _paraId = XmlUtils::ToString(x++, L"%08X"); } cp = writeParagraph(cp, 0x7fffffff); } diff --git a/ASCOfficeDocxFile2/BinReader/ChartWriter.h b/ASCOfficeDocxFile2/BinReader/ChartWriter.h index 4a0ef61e18..5585196140 100644 --- a/ASCOfficeDocxFile2/BinReader/ChartWriter.h +++ b/ASCOfficeDocxFile2/BinReader/ChartWriter.h @@ -63,7 +63,7 @@ namespace Writers { if(IsEmpty()) return false; - OOX::CPath pathChartDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("charts"); + OOX::CPath pathChartDir = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"charts"; for(size_t i = 0; i < m_aCharts.size(); ++i) { diff --git a/ASCOfficeDocxFile2/BinReader/CommentsWriter.h b/ASCOfficeDocxFile2/BinReader/CommentsWriter.h index 63896c777b..a42cc597e7 100644 --- a/ASCOfficeDocxFile2/BinReader/CommentsWriter.h +++ b/ASCOfficeDocxFile2/BinReader/CommentsWriter.h @@ -36,16 +36,16 @@ namespace Writers { - static std::wstring g_string_comment_Start = _T(""); - static std::wstring g_string_comment_End = _T(""); - static std::wstring g_string_commentExt_Start = _T(""); - static std::wstring g_string_commentExt_End = _T(""); - static std::wstring g_string_commentExtensible_Start = _T(""); - static std::wstring g_string_commentExtensible_End = _T(""); - static std::wstring g_string_commentsIds_Start = _T(""); - static std::wstring g_string_commentsIds_End = _T(""); - static std::wstring g_string_people_Start = _T(""); - static std::wstring g_string_people_End = _T(""); + static std::wstring g_string_comment_Start = L""; + static std::wstring g_string_comment_End = L""; + static std::wstring g_string_commentExt_Start = L""; + static std::wstring g_string_commentExt_End = L""; + static std::wstring g_string_commentExtensible_Start = L""; + static std::wstring g_string_commentExtensible_End = L""; + static std::wstring g_string_commentsIds_Start = L""; + static std::wstring g_string_commentsIds_End = L""; + static std::wstring g_string_people_Start = L""; + static std::wstring g_string_people_End = L""; class CommentsWriter { diff --git a/ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h b/ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h index fa604d1e3b..60db14b485 100644 --- a/ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h +++ b/ASCOfficeDocxFile2/BinReader/HeaderFooterWriter.h @@ -33,6 +33,7 @@ #include "../../XlsxSerializerCom/Common/Common.h" #include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h" +#include "../../DesktopEditor/common/StringBuilder.h" namespace Writers { diff --git a/ASCOfficeDocxFile2/BinReader/MediaWriter.h b/ASCOfficeDocxFile2/BinReader/MediaWriter.h index 26ad1e00e2..87aade15f3 100644 --- a/ASCOfficeDocxFile2/BinReader/MediaWriter.h +++ b/ASCOfficeDocxFile2/BinReader/MediaWriter.h @@ -32,6 +32,8 @@ #pragma once #include "../../XlsxSerializerCom/Common/Common.h" +#include "../../XlsxSerializerCom/Common/Common.h" +#include "../../DesktopEditor/common/Directory.h" namespace Writers { diff --git a/ASCOfficeDocxFile2/BinReader/ReaderClasses.h b/ASCOfficeDocxFile2/BinReader/ReaderClasses.h index ba68905eac..375adabcdb 100644 --- a/ASCOfficeDocxFile2/BinReader/ReaderClasses.h +++ b/ASCOfficeDocxFile2/BinReader/ReaderClasses.h @@ -33,7 +33,7 @@ #include "HeaderFooterWriter.h" -#include "../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../Common/DocxFormat/Source/Base/Unit.h" #include "../../Common/DocxFormat/Source/DocxFormat/Logic/RunProperty.h" #include "../BinWriter/BinReaderWriterDefines.h" @@ -208,7 +208,7 @@ public: } std::wstring ToString() { - return XmlUtils::IntToString(R, L"%02X") + XmlUtils::IntToString(G, L"%02X") + XmlUtils::IntToString(B, L"%02X"); + return XmlUtils::ToString(R, L"%02X") + XmlUtils::ToString(G, L"%02X") + XmlUtils::ToString(B, L"%02X"); } }; class CThemeColor{ @@ -269,7 +269,7 @@ public: std::wstring sRes; if(bTint) { - sRes = XmlUtils::IntToString(Tint, L"%02X"); + sRes = XmlUtils::ToString(Tint, L"%02X"); } return sRes; } @@ -278,14 +278,14 @@ public: std::wstring sRes; if(bShade) { - sRes = XmlUtils::IntToString(Shade, L"%02X"); + sRes = XmlUtils::ToString(Shade, L"%02X"); } return sRes; } - void ToCThemeColor( nullable>& oColor, - nullable>& oThemeColor, - nullable>& oThemeTint, - nullable>& oThemeShade) + void ToCThemeColor( nullable& oColor, + nullable& oThemeColor, + nullable& oThemeTint, + nullable& oThemeShade) { if (Auto) { @@ -387,7 +387,7 @@ public: class Tab { public: - SimpleTypes::CTabJc<> Val; + SimpleTypes::CTabJc Val; long Pos; BYTE Leader; bool bLeader; @@ -1041,7 +1041,7 @@ public: if(bTplc) { oWriter.WriteString(L" w:tplc=\""); - oWriter.WriteString(XmlUtils::IntToString(Tplc, L"%08X")); + oWriter.WriteString(XmlUtils::ToString(Tplc, L"%08X")); oWriter.WriteString(L"\""); } oWriter.WriteString(L">"); @@ -1071,7 +1071,7 @@ public: Format -= 0x2008; if (Format >= 0) { - SimpleTypes::CNumberFormat<> numFormat; + SimpleTypes::CNumberFormat numFormat; numFormat.SetValue((SimpleTypes::ENumberFormat)Format); sFormat = numFormat.ToString(); @@ -1559,7 +1559,7 @@ public: int nId = pComment->m_oParaIdCounter.getNextId(); - pComment->sParaId = XmlUtils::IntToString(nId, L"%08X"); + pComment->sParaId = XmlUtils::ToString(nId, L"%08X"); sRes += L"sParaId + L"\" w14:textId=\"" + pComment->sParaId + L"\">"; sRes += L""; sRes += sPart; @@ -1646,7 +1646,7 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ std::wstring sRes; if(pComment->bDurableId && !pComment->DateUtc.empty()) { - sRes += L"DurableId, L"%08X") + L"\" w16cex:dateUtc=\"" + pComment->DateUtc + L"\"/>"; + sRes += L"DurableId, L"%08X") + L"\" w16cex:dateUtc=\"" + pComment->DateUtc + L"\"/>"; } return sRes; } @@ -1655,7 +1655,7 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ std::wstring sRes; if(pComment->bDurableId && !pComment->UserData.empty()) { - sRes += L"DurableId, L"%08X") + L"\">"; + sRes += L"DurableId, L"%08X") + L"\">"; sRes += L"UserData); sRes += L"\" providerId=\"AD\"/>"; @@ -1667,7 +1667,7 @@ w15:paraIdParent=\"" + pComment->sParaIdParent + L"\" w15:done=\"" + sDone + L"\ std::wstring sRes; if(!pComment->sParaId.empty() && pComment->bDurableId) { - sRes += L"sParaId + L"\" w16cid:durableId=\"" + XmlUtils::IntToString(pComment->DurableId, L"%08X") + L"\"/>"; + sRes += L"sParaId + L"\" w16cid:durableId=\"" + XmlUtils::ToString(pComment->DurableId, L"%08X") + L"\"/>"; } return sRes; } diff --git a/ASCOfficeDocxFile2/BinReader/Readers.cpp b/ASCOfficeDocxFile2/BinReader/Readers.cpp index 183a9685b9..5ee0ea3cb4 100644 --- a/ASCOfficeDocxFile2/BinReader/Readers.cpp +++ b/ASCOfficeDocxFile2/BinReader/Readers.cpp @@ -219,7 +219,7 @@ docRGB Binary_CommonReader2::ReadColor() oRGB.B = m_oBufferedStream.GetUChar(); return oRGB; } -void Binary_CommonReader2::ReadHexColor(SimpleTypes::CHexColor<> *pColor) +void Binary_CommonReader2::ReadHexColor(SimpleTypes::CHexColor *pColor) { if (!pColor) { @@ -2200,7 +2200,7 @@ int Binary_tblPrReader::Read_tblPr(BYTE type, long length, void* poResult) int nLR = (0 == (nLook & 0x0040)) ? 0 : 1; int nBH = (0 == (nLook & 0x0200)) ? 0 : 1; int nBV = (0 == (nLook & 0x0400)) ? 0 : 1; - pWiterTblPr->Look = L"Look = L""; @@ -2732,7 +2732,7 @@ int Binary_tblPrReader::Read_CellPr(BYTE type, long length, void* poResult) } else if( c_oSerProp_cellPrType::textDirection == type ) { - SimpleTypes::CTextDirection<> oTextDirection; + SimpleTypes::CTextDirection oTextDirection; oTextDirection.SetValue((SimpleTypes::ETextDirection)m_oBufferedStream.GetUChar()); pCStringWriter->WriteString(std::wstring(_T("WriteString(oTextDirection.ToString()); @@ -3767,7 +3767,7 @@ int Binary_CommentsTableReader::ReadCommentContent(BYTE type, long length, void* doc_reader->m_oDocumentWriter.m_oContent.Clear(); int nId = m_oFileWriter.m_pComments->m_oParaIdCounter.getCurrentId(); - pComment->sParaId = XmlUtils::IntToString(nId, L"%08X"); + pComment->sParaId = XmlUtils::ToString(nId, L"%08X"); } else if ( c_oSer_CommentsType::Replies == type ) @@ -4721,7 +4721,7 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void if (m_bUsedParaIdCounter && m_oFileWriter.m_pComments) { int nId = m_oFileWriter.m_pComments->m_oParaIdCounter.getNextId(); - std::wstring sParaId = XmlUtils::IntToString(nId, L"%08X"); + std::wstring sParaId = XmlUtils::ToString(nId, L"%08X"); m_oDocumentWriter.m_oContent.WriteString(L""); } @@ -8042,7 +8042,7 @@ int Binary_DocumentTableReader::ReadRunContent(BYTE type, long length, void* poR if (m_bUsedParaIdCounter && m_oFileWriter.m_pComments) { int nId = m_oFileWriter.m_pComments->m_oParaIdCounter.getNextId(); - std::wstring sParaId = XmlUtils::IntToString(nId, L"%08X"); + std::wstring sParaId = XmlUtils::ToString(nId, L"%08X"); m_oDocumentWriter.m_oContent.WriteString(L""); } diff --git a/ASCOfficeDocxFile2/BinReader/Readers.h b/ASCOfficeDocxFile2/BinReader/Readers.h index 53df19a648..b07625de88 100644 --- a/ASCOfficeDocxFile2/BinReader/Readers.h +++ b/ASCOfficeDocxFile2/BinReader/Readers.h @@ -56,7 +56,7 @@ class Binary_CommonReader2 : public Binary_CommonReader public: Binary_CommonReader2(NSBinPptxRW::CBinaryFileReader& poBufferedStream); docRGB ReadColor(); - void ReadHexColor(SimpleTypes::CHexColor<> *pColor); + void ReadHexColor(SimpleTypes::CHexColor *pColor); void ReadThemeColor(int length, CThemeColor& oCThemeColor); int ReadThemeColorContent(BYTE type, long length, void* poResult); template int ReadTrackRevision(long length, T* poResult); @@ -487,8 +487,8 @@ class Binary_NotesTableReader : public Binary_CommonReader { Writers::FileWriter& m_oFileWriter; bool m_bIsFootnote; - nullable> m_oId; - nullable> m_oType; + nullable m_oId; + nullable m_oType; public: Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, bool bIsFootnote); int Read(); diff --git a/ASCOfficeDocxFile2/BinWriter/BinEquationWriter.h b/ASCOfficeDocxFile2/BinWriter/BinEquationWriter.h index 68fe7bfd00..283596e7d1 100644 --- a/ASCOfficeDocxFile2/BinWriter/BinEquationWriter.h +++ b/ASCOfficeDocxFile2/BinWriter/BinEquationWriter.h @@ -36,6 +36,7 @@ #include "../../Common/DocxFormat/Source/MathEquation/OutputDev.h" #include "../../Common/DocxFormat/Source/Common/SimpleTypes_OMath.h" #include "../../Common/DocxFormat/Source/Common/SimpleTypes_Shared.h" +#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h" #include namespace MathEquation diff --git a/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp b/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp index 7e5404a131..9981bf8d9e 100644 --- a/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp +++ b/ASCOfficeDocxFile2/BinWriter/BinWriters.cpp @@ -250,7 +250,7 @@ void BinaryCommonWriter::WritePBorders(const OOX::Logic::CPBdr& Borders) WriteBorder(c_oSerBordersType::between, Borders.m_oBetween.get()); } } -void BinaryCommonWriter::WriteColor(BYTE type, const SimpleTypes::CHexColor<>& color) +void BinaryCommonWriter::WriteColor(BYTE type, const SimpleTypes::CHexColor& color) { if(SimpleTypes::hexcolorRGB == color.GetValue()) { @@ -261,8 +261,8 @@ void BinaryCommonWriter::WriteColor(BYTE type, const SimpleTypes::CHexColor<>& c m_oStream.WriteBYTE(color.Get_B()); } } -void BinaryCommonWriter::WriteThemeColor(BYTE type, const nullable>& oHexColor, const nullable>& oThemeColor, - const nullable>& oThemeTint, const nullable>& oThemeShade) +void BinaryCommonWriter::WriteThemeColor(BYTE type, const nullable& oHexColor, const nullable& oThemeColor, + const nullable& oThemeTint, const nullable& oThemeShade) { if((oHexColor.IsInit() && SimpleTypes::hexcolorAuto == oHexColor->GetValue()) || oThemeColor.IsInit() || oThemeTint.IsInit() || oThemeShade.IsInit()) { @@ -596,7 +596,7 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr) const ComplexTypes::Word::CHighlight& oHighlight = rPr->m_oHighlight.get(); if(oHighlight.m_oVal.IsInit()) { - const SimpleTypes::CHighlightColor<>& oHighlightVal = oHighlight.m_oVal.get(); + const SimpleTypes::CHighlightColor& oHighlightVal = oHighlight.m_oVal.get(); if(SimpleTypes::highlightcolorNone == oHighlightVal.GetValue()) { m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::HighLightTyped); @@ -605,7 +605,7 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr) } else { - SimpleTypes::CHexColor<> oHexColor(oHighlightVal.Get_R(), oHighlightVal.Get_G(), oHighlightVal.Get_B()); + SimpleTypes::CHexColor oHexColor(oHighlightVal.Get_R(), oHighlightVal.Get_G(), oHighlightVal.Get_B()); m_oBcw.WriteColor(c_oSerProp_rPrType::HighLight, oHexColor); } } @@ -1045,7 +1045,7 @@ void Binary_pPrWriter::Write_pPr(const OOX::Logic::CParagraphProperty& pPr) const ComplexTypes::Word::CJc& oJc = pPr.m_oJc.get(); if(oJc.m_oVal.IsInit()) { - const SimpleTypes::CJc<>& oEJc = oJc.m_oVal.get(); + const SimpleTypes::CJc& oEJc = oJc.m_oVal.get(); m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::Jc); m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte); switch(oEJc.GetValue()) @@ -3948,7 +3948,7 @@ template void BinaryDocumentTableWriter::WriteMoveRangeEnd(const T& m_oBcw.WriteItemWithLengthEnd(nCurPos); } } -void BinaryDocumentTableWriter::WriteComment(OOX::EElementType eType, nullable>& oId) +void BinaryDocumentTableWriter::WriteComment(OOX::EElementType eType, nullable& oId) { int nCurPos = 0; if(oId.IsInit() && (NULL == m_mapIgnoreComments || m_mapIgnoreComments->end() == m_mapIgnoreComments->find(oId->GetValue()))) @@ -6283,7 +6283,7 @@ void BinaryDocumentTableWriter::WriteRunContent(std::vector>& oCustomMarkFollows, const nullable>& oId) +void BinaryDocumentTableWriter::WriteNoteRef(const nullable& oCustomMarkFollows, const nullable& oId) { int nCurPos = 0; if (oCustomMarkFollows.IsInit()) diff --git a/ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp b/ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp index 598f5fbc7f..fabf493734 100644 --- a/ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp +++ b/ASCOfficeOdfFile/formulasconvert/formulasconvert_odf.cpp @@ -34,7 +34,7 @@ #include #include -#include"../../Common/DocxFormat/Source/XML/Utils.h" +#include"../../Common/DocxFormat/Source/Base/Unit.h" #include "../src/docx/xlsxconversioncontext.h" #include "../src/docx/xlsx_utils.h" diff --git a/ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp b/ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp index 80c8d9b0cb..81ac5db3dc 100644 --- a/ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp +++ b/ASCOfficeOdfFile/formulasconvert/formulasconvert_oox.cpp @@ -34,7 +34,8 @@ #include #include -#include"../../Common/DocxFormat/Source/XML/Utils.h" +#include"../../Common/DocxFormat/Source/Base/Unit.h" +#include "boost/lexical_cast.hpp" namespace cpdoccore { namespace formulasconvert { diff --git a/ASCOfficeOdfFile/include/xml/attributes.h b/ASCOfficeOdfFile/include/xml/attributes.h index 66db6192e4..2c757a59a1 100644 --- a/ASCOfficeOdfFile/include/xml/attributes.h +++ b/ASCOfficeOdfFile/include/xml/attributes.h @@ -43,7 +43,7 @@ #include #include -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { diff --git a/ASCOfficeOdfFile/include/xml/simple_xml_writer.h b/ASCOfficeOdfFile/include/xml/simple_xml_writer.h index 40b47c3ce8..31c0891195 100644 --- a/ASCOfficeOdfFile/include/xml/simple_xml_writer.h +++ b/ASCOfficeOdfFile/include/xml/simple_xml_writer.h @@ -37,7 +37,7 @@ #include #include -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { diff --git a/ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp b/ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp index 6348cdce6a..2ad294b293 100644 --- a/ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp +++ b/ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp @@ -53,7 +53,7 @@ #include "../../../DesktopEditor/common/SystemUtils.h" #include "../../../DesktopEditor/graphics/pro/Fonts.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" static int current_id_changes = 0; diff --git a/ASCOfficeOdfFile/src/docx/mediaitems.cpp b/ASCOfficeOdfFile/src/docx/mediaitems.cpp index 50f514f943..7d0b4b1954 100644 --- a/ASCOfficeOdfFile/src/docx/mediaitems.cpp +++ b/ASCOfficeOdfFile/src/docx/mediaitems.cpp @@ -172,7 +172,7 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, _rels_type t } std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName) { - CFile file; + NSFile::CFileBinary file; std::wstring sExt; if (file.OpenFile(fileName) == S_OK) diff --git a/ASCOfficeOdfFile/src/docx/mediaitems.h b/ASCOfficeOdfFile/src/docx/mediaitems.h index 6465bfb662..dfbc737413 100644 --- a/ASCOfficeOdfFile/src/docx/mediaitems.h +++ b/ASCOfficeOdfFile/src/docx/mediaitems.h @@ -33,7 +33,7 @@ #include "oox_rels.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace NSFonts { diff --git a/ASCOfficeOdfFile/src/docx/oox_drawing_fills.cpp b/ASCOfficeOdfFile/src/docx/oox_drawing_fills.cpp index 9ff284ed14..a8c29c20ae 100644 --- a/ASCOfficeOdfFile/src/docx/oox_drawing_fills.cpp +++ b/ASCOfficeOdfFile/src/docx/oox_drawing_fills.cpp @@ -285,7 +285,7 @@ void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val) double focus_x = ((val.gradient->rect[2] - val.gradient->rect[0]) /2. + val.gradient->rect[0]) / 100.; double focus_y = ((val.gradient->rect[3] - val.gradient->rect[1]) /2. + val.gradient->rect[1]) / 100.; - CP_XML_ATTR(L"focusposition", XmlUtils::DoubleToString(focus_x, L"%.2f") + L"," + XmlUtils::DoubleToString(focus_y, L"%.2f")); + CP_XML_ATTR(L"focusposition", XmlUtils::ToString(focus_x, L"%.2f") + L"," + XmlUtils::ToString(focus_y, L"%.2f")); } } } diff --git a/ASCOfficeOdfFile/src/docx/xlsx_complex_number_format.cpp b/ASCOfficeOdfFile/src/docx/xlsx_complex_number_format.cpp index a5fc6dcc85..6f8569fb55 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_complex_number_format.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_complex_number_format.cpp @@ -31,7 +31,7 @@ */ #include "xlsx_complex_number_format.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { namespace oox { diff --git a/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp b/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp index 25733314e5..ca3882f32a 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_conditionalFormatting.cpp @@ -36,7 +36,7 @@ #include #include #include "../../include/xml/simple_xml_writer.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" #include "../../formulasconvert/formulasconvert.h" diff --git a/ASCOfficeOdfFile/src/docx/xlsx_data_validation.cpp b/ASCOfficeOdfFile/src/docx/xlsx_data_validation.cpp index 12e6edc38a..9806142715 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_data_validation.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_data_validation.cpp @@ -43,7 +43,7 @@ #include #include "../../formulasconvert/formulasconvert.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { namespace oox { diff --git a/ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp b/ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp index 73316b6d3d..1f1563d7f8 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp @@ -45,7 +45,7 @@ #include "drawing_object_description.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { namespace oox { diff --git a/ASCOfficeOdfFile/src/docx/xlsx_hyperlinks.cpp b/ASCOfficeOdfFile/src/docx/xlsx_hyperlinks.cpp index dd948458aa..a4fda43563 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_hyperlinks.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_hyperlinks.cpp @@ -35,7 +35,7 @@ #include "xlsx_hyperlinks.h" #include "oox_rels.h" #include "../../formulasconvert/formulasconvert.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" #include "xlsx_utils.h" namespace cpdoccore { diff --git a/ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp b/ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp index cc2d9932ae..bd2f91f20f 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp @@ -37,7 +37,7 @@ #include #include "../../include/xml/simple_xml_writer.h" -#include"../../../Common/DocxFormat/Source/XML/Utils.h" +#include"../../../Common/DocxFormat/Source/Base/Unit.h" #include"../../../Common/DocxFormat/Source/Base/Base.h" #include diff --git a/ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp b/ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp index 8616e07cbb..3fea51642f 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp @@ -44,7 +44,7 @@ #include "../../include/odf/odf_document.h" #include "../../include/xml/simple_xml_writer.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { namespace oox { diff --git a/ASCOfficeOdfFile/src/docx/xlsx_utils.cpp b/ASCOfficeOdfFile/src/docx/xlsx_utils.cpp index 5b814931a2..dcbadc32f1 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_utils.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_utils.cpp @@ -38,7 +38,7 @@ #include #include -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { diff --git a/ASCOfficeOdfFile/src/odf/datatypes/bool.cpp b/ASCOfficeOdfFile/src/odf/datatypes/bool.cpp index 8d405c1b8b..cb5926ee72 100644 --- a/ASCOfficeOdfFile/src/odf/datatypes/bool.cpp +++ b/ASCOfficeOdfFile/src/odf/datatypes/bool.cpp @@ -35,7 +35,7 @@ #include #include -#include "../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { namespace odf_types { diff --git a/ASCOfficeOdfFile/src/odf/draw_common.cpp b/ASCOfficeOdfFile/src/odf/draw_common.cpp index e8dfe21a08..9af2a8b6b0 100644 --- a/ASCOfficeOdfFile/src/odf/draw_common.cpp +++ b/ASCOfficeOdfFile/src/odf/draw_common.cpp @@ -51,7 +51,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "../../../DesktopEditor/raster/BgraFrame.h" #include "../../../DesktopEditor/graphics/pro/Image.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace _image_file_ { diff --git a/ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp b/ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp index d0aec97257..52a772cc65 100644 --- a/ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp +++ b/ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp @@ -60,7 +60,7 @@ #include "datatypes/length.h" #include "datatypes/borderstyle.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" #include "../../../OfficeUtils/src/OfficeUtils.h" namespace cpdoccore { diff --git a/ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp b/ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp index 61702f02a9..9bfb062e58 100644 --- a/ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp +++ b/ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp @@ -60,7 +60,7 @@ #include "datatypes/borderstyle.h" #include "../../../OfficeUtils/src/OfficeUtils.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { diff --git a/ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp b/ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp index 973e19af57..29b6a00486 100644 --- a/ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp +++ b/ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp @@ -59,7 +59,7 @@ #include "datatypes/length.h" #include "datatypes/borderstyle.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { diff --git a/ASCOfficeOdfFile/src/odf/office_elements.h b/ASCOfficeOdfFile/src/odf/office_elements.h index bf6ea475e3..8d16ed43a7 100644 --- a/ASCOfficeOdfFile/src/odf/office_elements.h +++ b/ASCOfficeOdfFile/src/odf/office_elements.h @@ -48,7 +48,7 @@ #include "documentcontext.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { namespace odf_reader { diff --git a/ASCOfficeOdfFile/src/odf/table_xlsx.cpp b/ASCOfficeOdfFile/src/odf/table_xlsx.cpp index fe6976b24d..350417c072 100644 --- a/ASCOfficeOdfFile/src/odf/table_xlsx.cpp +++ b/ASCOfficeOdfFile/src/odf/table_xlsx.cpp @@ -821,7 +821,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context) { if (dTime) { - number_val = XmlUtils::DoubleToString(*dTime + intDate); + number_val = XmlUtils::ToString(*dTime + intDate); } else { @@ -1176,7 +1176,7 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte { if (dTime) { - number_val = XmlUtils::DoubleToString(*dTime + intDate); + number_val = XmlUtils::ToString(*dTime + intDate); } else { diff --git a/ASCOfficeOdfFile/src/xml/utils.cpp b/ASCOfficeOdfFile/src/xml/utils.cpp index 9809499ef4..4d5a451356 100644 --- a/ASCOfficeOdfFile/src/xml/utils.cpp +++ b/ASCOfficeOdfFile/src/xml/utils.cpp @@ -32,7 +32,7 @@ #include "../../include/xml/utils.h" #include -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { namespace xml { diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_number_styles_context.cpp b/ASCOfficeOdfFileW/source/OdfFormat/odf_number_styles_context.cpp index 314e97be47..cf75f00acc 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_number_styles_context.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_number_styles_context.cpp @@ -29,7 +29,7 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -#include"../../../Common/DocxFormat/Source/XML/Utils.h" +#include"../../../Common/DocxFormat/Source/Base/Unit.h" #include "logging.h" diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odp_page_state.h b/ASCOfficeOdfFileW/source/OdfFormat/odp_page_state.h index ef9f3a0109..73cb024f55 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odp_page_state.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/odp_page_state.h @@ -33,7 +33,7 @@ #include -#include"../../../Common/DocxFormat/Source/XML/Utils.h" +#include"../../../Common/DocxFormat/Source/Base/Unit.h" #include "odf_drawing_context.h" #include "odf_comment_context.h" diff --git a/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h b/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h index 38a654df18..f9a19f397b 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h @@ -37,7 +37,7 @@ #include #include -#include"../../../Common/DocxFormat/Source/XML/Utils.h" +#include"../../../Common/DocxFormat/Source/Base/Unit.h" #include "odf_drawing_context.h" #include "odf_controls_context.h" diff --git a/ASCOfficeOdfFileW/source/OdfFormat/oox_shape_defines.cpp b/ASCOfficeOdfFileW/source/OdfFormat/oox_shape_defines.cpp index 81d40eb221..90185e6026 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/oox_shape_defines.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/oox_shape_defines.cpp @@ -48,6 +48,7 @@ #include "Shapes/oox_shapeBents.h" #include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace cpdoccore { diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp index 91cc8dbd84..c19516c5e4 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp @@ -265,7 +265,7 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture) { const PPTX::Logic::PrstGeom& prstGeom = oox_picture->spPr.Geometry.as(); - SimpleTypes::CShapeType<> preset; + SimpleTypes::CShapeType preset; preset.FromString(prstGeom.prst.get()); type = preset.GetValue(); } @@ -733,7 +733,7 @@ void OoxConverter::convert(PPTX::Logic::CxnSp *oox_connect) { const PPTX::Logic::PrstGeom& prstGeom = oox_connect->spPr.Geometry.as(); - SimpleTypes::CShapeType<> preset; + SimpleTypes::CShapeType preset; preset.FromString(prstGeom.prst.get()); type = preset.GetValue(); } @@ -762,7 +762,7 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape) { const PPTX::Logic::PrstGeom& prstGeom = oox_shape->spPr.Geometry.as(); - SimpleTypes::CShapeType<> preset; + SimpleTypes::CShapeType preset; preset.FromString(prstGeom.prst.get()); type = preset.GetValue(); } @@ -1402,7 +1402,7 @@ void OoxConverter::convert(PPTX::Logic::UniColor * color, std::wstring & hexStri if (nARGB != 0) { - hexString = XmlUtils::IntToString(nARGB & 0x00FFFFFF, L"#%06X"); + hexString = XmlUtils::ToString(nARGB & 0x00FFFFFF, L"#%06X"); if ((nARGB >> 24) != 0xff) { @@ -2570,7 +2570,7 @@ void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type) if (style_ref->idx.IsInit() == false) { - std::wstring hexColor = XmlUtils::IntToString(nARGB & 0x00FFFFFF, L"#%06X"); + std::wstring hexColor = XmlUtils::ToString(nARGB & 0x00FFFFFF, L"#%06X"); _CP_OPT(double) opacity; if ((nARGB >> 24) != 0xff) diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp index 20094b0094..9c370871a7 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp @@ -499,7 +499,7 @@ namespace Oox2Odf | ((unsigned int)((BYTE)(vml_fill->m_oColor->Get_G())) << 8)) | (((unsigned int)(BYTE)(vml_fill->m_oColor->Get_R())) << 16))); - sRgbColor1 = XmlUtils::IntToString(*nRgbColor1, L"%06X"); + sRgbColor1 = XmlUtils::ToString(*nRgbColor1, L"%06X"); } if (vml_fill->m_oColor2.IsInit()) @@ -507,7 +507,7 @@ namespace Oox2Odf nRgbColor2 = ((unsigned int)(((BYTE)(vml_fill->m_oColor2->Get_B()) | ((unsigned int)((BYTE)(vml_fill->m_oColor2->Get_G())) << 8)) | (((unsigned int)(BYTE)(vml_fill->m_oColor2->Get_R())) << 16))); - sRgbColor2 = XmlUtils::IntToString(*nRgbColor2, L"%06X"); + sRgbColor2 = XmlUtils::ToString(*nRgbColor2, L"%06X"); } std::wstring sID; @@ -1044,7 +1044,7 @@ namespace Oox2Odf ucB = vml_common->m_oStrokeColor->Get_B(); ucG = vml_common->m_oStrokeColor->Get_G(); - SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR, ucG, ucB); + SimpleTypes::CHexColor *oRgbColor = new SimpleTypes::CHexColor(ucR, ucG, ucB); if (oRgbColor) { odf_context()->drawing_context()->set_solid_fill(oRgbColor->ToString().substr(2));//.Right(6)); @@ -1061,7 +1061,7 @@ namespace Oox2Odf ucB = vml_common->m_oFillColor->Get_B(); ucG = vml_common->m_oFillColor->Get_G(); - SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR, ucG, ucB); + SimpleTypes::CHexColor *oRgbColor = new SimpleTypes::CHexColor(ucR, ucG, ucB); if (oRgbColor) { @@ -1118,4 +1118,4 @@ namespace Oox2Odf } odf_context()->drawing_context()->end_group(); } -} \ No newline at end of file +} diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp index 00a8af6611..1557210ef0 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp @@ -1733,7 +1733,7 @@ void DocxConverter::convert( ComplexTypes::Word::CShading* shading, _CP_OPT(odf_ ucR = (BYTE)(ucR * (kf)); ucB = (BYTE)(ucB * (kf)); ucG = (BYTE)(ucG * (kf)); } - SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR, ucG, ucB); + SimpleTypes::CHexColor *oRgbColor = new SimpleTypes::CHexColor(ucR, ucG, ucB); if (oRgbColor) { @@ -2865,7 +2865,7 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st BYTE ucR = oox_run_pr->m_oHighlight->m_oVal->Get_R(); BYTE ucB = oox_run_pr->m_oHighlight->m_oVal->Get_B(); BYTE ucG = oox_run_pr->m_oHighlight->m_oVal->Get_G(); - SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR, ucG, ucB); + SimpleTypes::CHexColor *oRgbColor = new SimpleTypes::CHexColor(ucR, ucG, ucB); if (oRgbColor) { @@ -2906,7 +2906,7 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st } } -void DocxConverter::convert(SimpleTypes::CTheme<>* oox_font_theme, _CP_OPT(std::wstring) & odf_font_name) +void DocxConverter::convert(SimpleTypes::CTheme* oox_font_theme, _CP_OPT(std::wstring) & odf_font_name) { if (oox_font_theme == NULL) return; @@ -3274,10 +3274,10 @@ void DocxConverter::convert(OOX::Drawing::CInline *oox_inline) odf_context()->drawing_context()->end_drawing(); } -void DocxConverter::convert(SimpleTypes::CHexColor<> *color, - SimpleTypes::CThemeColor<> *theme_color, - SimpleTypes::CUcharHexNumber<> *theme_tint, - SimpleTypes::CUcharHexNumber<> *theme_shade, _CP_OPT(odf_types::color) & odf_color) +void DocxConverter::convert(SimpleTypes::CHexColor *color, + SimpleTypes::CThemeColor *theme_color, + SimpleTypes::CUcharHexNumber *theme_tint, + SimpleTypes::CUcharHexNumber *theme_shade, _CP_OPT(odf_types::color) & odf_color) { odf_color = boost::none; @@ -3297,7 +3297,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color, ucG = color->Get_G(); ucA = color->Get_A(); - SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR, ucG, ucB); + SimpleTypes::CHexColor *oRgbColor = new SimpleTypes::CHexColor(ucR, ucG, ucB); if ((oRgbColor) && (oRgbColor->GetValue() == SimpleTypes::hexcolorRGB)) { @@ -3352,7 +3352,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color, argb = HSL2RGB(dH, dS, dL); } - std::wstring strColor = XmlUtils::IntToString(argb & 0x00FFFFFF, L"#%06X"); + std::wstring strColor = XmlUtils::ToString(argb & 0x00FFFFFF, L"#%06X"); odf_color = odf_types::color(strColor); } } diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/MathConverter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/MathConverter.cpp index 93ab88d6de..4208b7eb07 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/MathConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/MathConverter.cpp @@ -1182,7 +1182,7 @@ namespace Oox2Odf void OoxConverter::convert(OOX::Logic::CNary *oox_nary) { if (!oox_nary) return; - nullable>* ref = NULL; + nullable* ref = NULL; if (oox_nary->m_oNaryPr->m_oCtrlPr.IsInit() && oox_nary->m_oNaryPr->m_oCtrlPr->m_oRPr.IsInit() && diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp index 5ce95c7d5a..2a85b2f5e6 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp @@ -2925,7 +2925,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::COleObjects *oox_objects, OOX::Spr { OOX::Vml::CClientData* pClientData = static_cast(pChildElemShape); - SimpleTypes::Spreadsheet::CCellAnchorType<> eAnchorType; + SimpleTypes::Spreadsheet::CCellAnchorType eAnchorType; eAnchorType.SetValue(SimpleTypes::Spreadsheet::cellanchorTwoCell); OOX::Spreadsheet::CCellAnchor *pCellAnchor = new OOX::Spreadsheet::CCellAnchor(eAnchorType); @@ -3048,7 +3048,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CControls *oox_controls, OOX::Spre smart_ptr oObjectElement = oox_sheet->FindVmlObject(sShapeId); smart_ptr oShape = oObjectElement.smart_dynamic_cast(); - SimpleTypes::Spreadsheet::CCellAnchorType<> eAnchorType; + SimpleTypes::Spreadsheet::CCellAnchorType eAnchorType; eAnchorType.SetValue(SimpleTypes::Spreadsheet::cellanchorTwoCell); if (pControl->m_oControlPr.IsInit() && pControl->m_oControlPr->m_oAnchor.IsInit()) diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp index 141358709d..563403d558 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp @@ -38,6 +38,7 @@ #include "../../Common/OfficeFileErrorDescription.h" #include "../../OfficeUtils/src/OfficeUtils.h" +#include "../../DesktopEditor/common/Directory.h" #ifndef READMODE #define READMODE 1 diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp index 48b235374c..0b1e830b01 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp @@ -70,6 +70,8 @@ #include #include +#include "../../../Common/DocxFormat/Source/SystemUtility/File.h" + typedef boost::uuids::detail::md5 MD5; namespace PPT_FORMAT @@ -721,7 +723,7 @@ bool CPPTXWriter::WriteRoundTripTheme(const CRecordSlide *pSlide, std::unordered // compare hash char* pointerToThemeElems = strstr((char*)utf8Data, ""); UINT hashShift = pointerToThemeElems ? pointerToThemeElems - (char*)utf8Data : 0; - auto strHash = CFile::md5(utf8Data+hashShift, utf8DataSize-hashShift); + auto strHash = StreamUtils::md5(utf8Data+hashShift, utf8DataSize-hashShift); needRels = (int)std::string(utf8Data, utf8Data + utf8DataSize).find("rId") != -1; @@ -1290,29 +1292,29 @@ void PPT_FORMAT::CPPTXWriter::WriteColorScheme(CStringWriter& oStringWriter, con oStringWriter.WriteStringXML(name); oStringWriter.WriteString(L"\">"); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); - oStringWriter.WriteString(L""); + oStringWriter.WriteString(L""); oStringWriter.WriteString(L""); if (extra) diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp index 9d0dbe1f62..1b6ac9f0e6 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp @@ -115,7 +115,7 @@ void CStylesWriter::ConvertStyleLevel(PPT_FORMAT::CTextStyleLevel& oLevel, PPT_F } else { - std::wstring strColor = XmlUtils::IntToString(pCF->Color->GetLONG_RGB(), L"%06x"); + std::wstring strColor = XmlUtils::ToString(pCF->Color->GetLONG_RGB(), L"%06x"); oWriter.WriteString(L""); } @@ -518,11 +518,11 @@ std::wstring PPT_FORMAT::CShapeWriter::ConvertColor(CColor & color, long alpha) { if (255 == alpha) { - color_writer.WriteString(L""); + color_writer.WriteString(L""); } else { - color_writer.WriteString(L"" + + color_writer.WriteString(L"" + L""); } } @@ -1305,7 +1305,7 @@ void PPT_FORMAT::CShapeWriter::WriteTextInfo(PPT_FORMAT::CTextCFRun* pLastCF) } else { - std::wstring strColor = XmlUtils::IntToString(pCF->Color->GetLONG_RGB(), L"%06x"); + std::wstring strColor = XmlUtils::ToString(pCF->Color->GetLONG_RGB(), L"%06x"); m_oWriter.WriteString(L""); } diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp index 6798cc39c6..ef7210b45c 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp @@ -36,6 +36,7 @@ #include "../../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/ElementSettings.h" #include "../../../../DesktopEditor/raster/BgraFrame.h" +#include "../../../../DesktopEditor/common/Directory.h" #include "../../../../Common/DocxFormat/Source/Base/Base.h" #include "../../../../OfficeUtils/src/OfficeUtils.h" diff --git a/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp b/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp index 089dee5a10..f5c858f1d2 100644 --- a/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp +++ b/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp @@ -2124,10 +2124,10 @@ void CDrawingConverter::ConvertShape(PPTX::Logic::SpTreeElem *elem, XmlUtils::CX y2 = tmp; } - strStyleAdvenced = L";left:" + XmlUtils::DoubleToString(x1, L"%.2lf") - + L";top:" + XmlUtils::DoubleToString(y1, L"%.2lf") - + L";width:" + XmlUtils::DoubleToString(x2-x1, L"%.2lf") - + L";height:" + XmlUtils::DoubleToString(y2-y1, L"%.2lf") + strStyleAdvenced = L";left:" + XmlUtils::ToString(x1, L"%.2lf") + + L";top:" + XmlUtils::ToString(y1, L"%.2lf") + + L";width:" + XmlUtils::ToString(x2-x1, L"%.2lf") + + L";height:" + XmlUtils::ToString(y2-y1, L"%.2lf") + L";"; } } @@ -2775,7 +2775,7 @@ void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUt case PPTShapes::ShapeType::sptCTextArchDownPour: eTextShapeType = SimpleTypes::ETextShapeType::textshapetypeTextArchDownPour; break; default: eTextShapeType = SimpleTypes::ETextShapeType::textshapetypeTextNoShape; break; } - SimpleTypes::CTextShapeType<> oTextShapeType; + SimpleTypes::CTextShapeType oTextShapeType; oTextShapeType.SetValue(eTextShapeType); std::wstring strPrstTxWarp = L""; @@ -4557,7 +4557,7 @@ void CDrawingConverter::CheckBorderShape(PPTX::Logic::SpTreeElem* oElem, XmlUtil nullable_string sTypeBorder; XmlMacroReadAttributeBase(oNodeBorder, L"type", sTypeBorder); - SimpleTypes::CBorderType<> borderType; + SimpleTypes::CBorderType borderType; if (sTypeBorder.IsInit()) { borderType.FromString(sTypeBorder.get()); diff --git a/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp b/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp index ddeda2ae4b..6b087a198d 100644 --- a/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp +++ b/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp @@ -268,7 +268,7 @@ _UINT32 CPPTXFile::ConvertPPTYToPPTX(std::wstring bsInput, std::wstring bsOutput NSBinPptxRW::CPPTXWriter oWriter; oWriter.Init(pathLocalTempDirectory.GetPath(), m_bIsMacro); - CFile oFileBinary; + NSFile::CFileBinary oFileBinary; oFileBinary.OpenFile((std::wstring)bsInput); LONG lFileSize = (LONG)oFileBinary.GetFileSize(); BYTE* pSrcBuffer = new BYTE[lFileSize]; diff --git a/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp b/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp index 599ec84df9..f09ca2362e 100644 --- a/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp +++ b/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.cpp @@ -1113,7 +1113,7 @@ namespace NSBinPptxRW void CBinaryFileWriter::GetBase64File(const std::wstring& sFile, std::string& strDst64) { - CFile oFile; + NSFile::CFileBinary oFile; HRESULT hr = oFile.OpenFile(sFile); if (S_OK != hr) @@ -1294,6 +1294,10 @@ namespace NSBinPptxRW m_lPosition = 0; m_pStreamCur = m_pStreamData; } + void CStreamBinaryWriter::WriteReserved(size_t lCount) + { + CBinaryFileWriter::WriteReserved(lCount); + } CXlsbBinaryWriter::CXlsbBinaryWriter(size_t bufferSize) : CStreamBinaryWriter(bufferSize) { @@ -1536,7 +1540,7 @@ namespace NSBinPptxRW } void CRelsGenerator::SaveRels(const std::wstring& strFile) { - CFile oFile; + NSFile::CFileBinary oFile; oFile.CreateFile(strFile); std::wstring strMem = m_pWriter->GetData(); oFile.WriteStringUTF8(strMem); diff --git a/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h b/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h index 5ff9764a9a..6d1b681e8a 100644 --- a/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h +++ b/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h @@ -452,6 +452,8 @@ namespace NSBinPptxRW _UINT32 GetPositionAbsolute(); void CloseFile(); virtual void Flush(); + + void WriteReserved(size_t lCount); }; class CXlsbBinaryWriter : public CStreamBinaryWriter { diff --git a/ASCOfficePPTXFile/Editor/DefaultNotesMaster.h b/ASCOfficePPTXFile/Editor/DefaultNotesMaster.h index c8e4c742a0..4d58682bc9 100644 --- a/ASCOfficePPTXFile/Editor/DefaultNotesMaster.h +++ b/ASCOfficePPTXFile/Editor/DefaultNotesMaster.h @@ -32,6 +32,7 @@ #pragma once #include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h" +#include "../../DesktopEditor/common/File.h" namespace Writers { @@ -232,7 +233,7 @@ namespace Writers OOX::CPath pathFile = fileName; - CFile oFile; + NSFile::CFileBinary oFile; oFile.CreateFile(pathFile.GetPath()); oFile.WriteStringUTF8(s_Common); oFile.CloseFile(); diff --git a/ASCOfficePPTXFile/Editor/DefaultNotesTheme.h b/ASCOfficePPTXFile/Editor/DefaultNotesTheme.h index 43977f466c..db28b58b11 100644 --- a/ASCOfficePPTXFile/Editor/DefaultNotesTheme.h +++ b/ASCOfficePPTXFile/Editor/DefaultNotesTheme.h @@ -32,6 +32,7 @@ #pragma once #include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h" +#include "../../DesktopEditor/common/File.h" namespace Writers { @@ -328,7 +329,7 @@ namespace Writers OOX::CPath pathFile= fileName; - CFile oFile; + NSFile::CFileBinary oFile; oFile.CreateFile(pathFile.GetPath()); oFile.WriteStringUTF8(s_Common); oFile.CloseFile(); diff --git a/ASCOfficePPTXFile/Editor/Drawing/Attributes.h b/ASCOfficePPTXFile/Editor/Drawing/Attributes.h index 25d745a0f7..ced7622c33 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Attributes.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Attributes.h @@ -41,7 +41,7 @@ #include "../../../DesktopEditor/graphics/IRenderer.h" #include "../../../DesktopEditor/graphics/structures.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" #include static void ReplaceAll(std::wstring & str, const std::wstring& from, const std::wstring& to) diff --git a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/GraphicsPath.h b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/GraphicsPath.h index 44429c38f0..bde68fa8d1 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/GraphicsPath.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/GraphicsPath.h @@ -34,6 +34,7 @@ #include #include "../../../../../DesktopEditor/graphics/GraphicsPath.h" +#include "../../../../../DesktopEditor/xml/include/xmlutils.h" #include "../../Metric.h" #include "../../Attributes.h" diff --git a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/BinaryReader.h b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/BinaryReader.h index 000dda6de9..b9e13a460b 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/BinaryReader.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/BinaryReader.h @@ -30,7 +30,7 @@ * */ #pragma once -#include "../../../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../../../DesktopEditor/common/Types.h" namespace ODRAW { diff --git a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/Ppt2PptxShapeConverter.h b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/Ppt2PptxShapeConverter.h index 96eda98192..306742258d 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/Ppt2PptxShapeConverter.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/Ppt2PptxShapeConverter.h @@ -1810,40 +1810,40 @@ static int g_guide_string_tag_len = __wstrlen(g_guide_string_tag); #define GUIDE_PARAM_1(name) \ { \ oWriter.m_oWriter.AddSize(g_guide_max_len); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string1, g_guide_string1_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string1, g_guide_string1_len); \ oWriter.m_oWriter.AddIntNoCheck(m_lIndexDst); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string_##name, g_guide_string_##name##_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string_##name, g_guide_string_##name##_len); \ GetValue(lParam1, eType1, bExtShape1, oWriter); \ ++m_lIndexDst; \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string2, g_guide_string2_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string2, g_guide_string2_len); \ } #define GUIDE_PARAM_2(name) \ { \ oWriter.m_oWriter.AddSize(g_guide_max_len); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string1, g_guide_string1_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string1, g_guide_string1_len); \ oWriter.m_oWriter.AddIntNoCheck(m_lIndexDst); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string_##name, g_guide_string_##name##_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string_##name, g_guide_string_##name##_len); \ GetValue(lParam1, eType1, bExtShape1, oWriter); \ oWriter.m_oWriter.AddSpaceNoCheck(); \ GetValue(lParam2, eType2, bExtShape2, oWriter); \ ++m_lIndexDst; \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string2, g_guide_string2_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string2, g_guide_string2_len); \ } #define GUIDE_PARAM_3(name) \ { \ oWriter.m_oWriter.AddSize(g_guide_max_len); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string1, g_guide_string1_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string1, g_guide_string1_len); \ oWriter.m_oWriter.AddIntNoCheck(m_lIndexDst); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string_##name, g_guide_string_##name##_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string_##name, g_guide_string_##name##_len); \ GetValue(lParam1, eType1, bExtShape1, oWriter); \ oWriter.m_oWriter.AddSpaceNoCheck(); \ GetValue(lParam2, eType2, bExtShape2, oWriter); \ oWriter.m_oWriter.AddSpaceNoCheck(); \ GetValue(lParam3, eType3, bExtShape3, oWriter); \ ++m_lIndexDst; \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string2, g_guide_string2_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string2, g_guide_string2_len); \ } struct CFormParam @@ -2675,9 +2675,9 @@ private: void ConvertProd(const std::wstring& strParam1, const std::wstring& strParam2, const LONG& lParam3, NSBinPptxRW::CXmlWriter& oWriter) { oWriter.m_oWriter.AddSize(g_guide_max_len); - oWriter.m_oWriter.AddStringNoCheck(g_guide_string1, g_guide_string1_len); + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string1, g_guide_string1_len); oWriter.m_oWriter.AddIntNoCheck(m_lIndexDst); - oWriter.m_oWriter.AddStringNoCheck(g_guide_string_prod, g_guide_string_prod_len); + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string_prod, g_guide_string_prod_len); oWriter.WriteString(strParam1); oWriter.m_oWriter.AddSpaceNoCheck(); @@ -2698,7 +2698,7 @@ private: GetValue(lParam3, ptValue, false, oWriter); ++m_lIndexDst; - oWriter.m_oWriter.AddStringNoCheck(g_guide_string2, g_guide_string2_len); + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string2, g_guide_string2_len); } //------------------------------------- diff --git a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/PptFormula.h b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/PptFormula.h index 634198f1f5..7a29f13a37 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/PptFormula.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/PptFormula.h @@ -43,7 +43,7 @@ #include "../../../../../../DesktopEditor/xml/include/xmlutils.h" #include "../../../../../../DesktopEditor/graphics/aggplustypes.h" -#include "../../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace NSGuidesVML { enum FormulaType diff --git a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTXShape/PptxFormula.h b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTXShape/PptxFormula.h index 095f7c228c..9375eb58da 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTXShape/PptxFormula.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTXShape/PptxFormula.h @@ -38,7 +38,7 @@ #include #include "../Common.h" #include "../../../../../../DesktopEditor/xml/include/xmlutils.h" -#include "../../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace NSGuidesOOXML { const double dNonDefResult = 27273042316900; diff --git a/ASCOfficePPTXFile/Editor/Drawing/TextStructures.h b/ASCOfficePPTXFile/Editor/Drawing/TextStructures.h index c0fb931e38..30eb7ce45a 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/TextStructures.h +++ b/ASCOfficePPTXFile/Editor/Drawing/TextStructures.h @@ -78,7 +78,7 @@ namespace PPT_FORMAT { if (!prop.is_init()) return L""; - return _T("<") + strName + _T(">") + XmlUtils::DoubleToString(prop.get()) + _T(""); + return _T("<") + strName + _T(">") + XmlUtils::ToString(prop.get()) + _T(""); } static std::wstring ToNode(const NSCommon::nullable_base& prop, const std::wstring& strName) { diff --git a/ASCOfficePPTXFile/Editor/PPTXWriter.h b/ASCOfficePPTXFile/Editor/PPTXWriter.h index 4b7a0f9e60..0832bbfa1a 100644 --- a/ASCOfficePPTXFile/Editor/PPTXWriter.h +++ b/ASCOfficePPTXFile/Editor/PPTXWriter.h @@ -1291,7 +1291,7 @@ namespace NSBinPptxRW std::wstring strVal = _T("\ \ "); - CFile oFileRels; + NSFile::CFileBinary oFileRels; oFileRels.CreateFile(pathNotesMasterRels.GetPath() + FILE_SEPARATOR_STR + _T("notesMaster1.xml.rels")); oFileRels.WriteStringUTF8(strVal); oFileRels.CloseFile(); diff --git a/ASCOfficePPTXFile/Editor/XmlWriter.h b/ASCOfficePPTXFile/Editor/XmlWriter.h index f175c0cb7a..09c7da52d9 100644 --- a/ASCOfficePPTXFile/Editor/XmlWriter.h +++ b/ASCOfficePPTXFile/Editor/XmlWriter.h @@ -38,6 +38,7 @@ #include "../../Common/DocxFormat/Source/Base/Nullable.h" #include "../../Common/DocxFormat/Source/SystemUtility/File.h" +#include "../../DesktopEditor/common/StringBuilder.h" namespace NSBinPptxRW { @@ -62,205 +63,10 @@ namespace NSBinPptxRW return (int)(dVal + 0.5); } - class CStringWriter - { - private: - wchar_t* m_pData; - size_t m_lSize; - - wchar_t* m_pDataCur; - size_t m_lSizeCur; - - public: - CStringWriter() - { - m_pData = NULL; - m_lSize = 0; - - m_pDataCur = m_pData; - m_lSizeCur = m_lSize; - } - ~CStringWriter() - { - RELEASEMEM(m_pData); - } - - AVSINLINE void AddSize(size_t nSize) - { - if (NULL == m_pData) - { - m_lSize = (std::max)(nSize, (size_t) 1024); - m_pData = (wchar_t*)malloc(m_lSize * sizeof(wchar_t)+64); - - m_lSizeCur = 0; - m_pDataCur = m_pData; - return; - } - - if ((m_lSizeCur + nSize) > m_lSize) - { - while ((m_lSizeCur + nSize) > m_lSize) - { - //m_lSize *= 2; - бесконтрольно .. - m_lSize += (std::max)(nSize, (size_t) 1024); - } - size_t size_alloc = m_lSize * sizeof(wchar_t); -#if defined(_WIN32) || defined (_WIN64) - wchar_t* pRealloc = (wchar_t*)realloc(m_pData, size_alloc ); - if (NULL != pRealloc) - { - // реаллок сработал - m_pData = pRealloc; - m_pDataCur = m_pData + m_lSizeCur; - } - else -#endif - { - wchar_t* pMalloc = (wchar_t*)malloc(size_alloc ); - if (pMalloc) - { - memcpy(pMalloc, m_pData, m_lSizeCur * sizeof(wchar_t)); - - free(m_pData); - m_pData = pMalloc; - m_pDataCur = m_pData + m_lSizeCur; - } - } - } - } - - public: - - AVSINLINE void WriteString(const wchar_t* pString, size_t& nLen) - { - AddSize(nLen); - - memcpy(m_pDataCur, pString, nLen * sizeof(wchar_t)); - - m_pDataCur += nLen; - m_lSizeCur += nLen; - } - AVSINLINE void WriteString(const std::wstring& wString) - { - size_t nLen = wString.length(); - WriteString(wString.c_str(), nLen); - } - AVSINLINE void WriteStringXML(const std::wstring& _strValue) - { - // можно ускорить (см. как сделано в шейпах) - std::wstring strValue = _strValue; - - XmlUtils::replace_all(strValue, L"&", L"&"); - XmlUtils::replace_all(strValue, L"'", L"'"); - XmlUtils::replace_all(strValue, L"<", L"<"); - XmlUtils::replace_all(strValue, L">", L">"); - XmlUtils::replace_all(strValue, L"\"", L"""); - - WriteString(strValue); - } - AVSINLINE size_t GetCurSize() - { - return m_lSizeCur; - } - - AVSINLINE void Write(CStringWriter& oWriter) - { - WriteString(oWriter.m_pData, oWriter.m_lSizeCur); - } - - AVSINLINE void WriteBefore(CStringWriter& oWriter) - { - size_t nNewS = oWriter.GetCurSize(); - AddSize(nNewS); - memmove(m_pData + nNewS, m_pData, m_lSizeCur * sizeof (wchar_t)); - memcpy(m_pData, oWriter.m_pData, nNewS * sizeof (wchar_t)); - m_pDataCur += nNewS; - m_lSizeCur += nNewS; - } - - inline void Clear() - { - RELEASEMEM(m_pData); - - m_pData = NULL; - m_lSize = 0; - - m_pDataCur = m_pData; - m_lSizeCur = 0; - } - inline void ClearNoAttack() - { - m_pDataCur = m_pData; - m_lSizeCur = 0; - } - - std::wstring GetData() - { - if (m_lSizeCur > 0) - return std::wstring(m_pData, m_lSizeCur); - else - return L""; - } - - AVSINLINE void AddCharNoCheck(const WCHAR& wc) - { - *m_pDataCur++ = wc; - ++m_lSizeCur; - } - AVSINLINE void AddIntNoCheck(int val) - { - if (0 == val) - { - *m_pDataCur++ = (WCHAR)'0'; - ++m_lSizeCur; - return; - } - if (val < 0) - { - val = -val; - *m_pDataCur++ = (WCHAR)'-'; - ++m_lSizeCur; - } - - int len = 0; - int oval = val; - while (oval > 0) - { - oval /= 10; - ++len; - } - - oval = 1; - while (val > 0) - { - m_pDataCur[len - oval] = (WCHAR)('0' + (val % 10)); - ++oval; - val /= 10; - } - - m_pDataCur += len; - m_lSizeCur += len; - } - - AVSINLINE void AddStringNoCheck(const wchar_t* pData, const int& len) - { - memcpy(m_pDataCur, pData, len *sizeof(wchar_t)); - - m_pDataCur += len; - m_lSizeCur += len; - } - AVSINLINE void AddSpaceNoCheck() - { - *m_pDataCur = WCHAR(' '); - ++m_pDataCur; - ++m_lSizeCur; - } - }; - class CXmlWriter { public: - CStringWriter m_oWriter; + NSStringUtils::CStringBuilder m_oWriter; //------------------------------ BYTE m_lDocType; @@ -447,7 +253,7 @@ namespace NSBinPptxRW m_oWriter.WriteString(strAttributeName); m_oWriter.WriteString(g_bstr_node_equal); m_oWriter.WriteString(g_bstr_node_quote); - m_oWriter.WriteStringXML(val); + m_oWriter.WriteEncodeXmlString(val); m_oWriter.WriteString(g_bstr_node_quote); } AVSINLINE void WriteAttribute(const std::wstring& strAttributeName, const double& val) diff --git a/ASCOfficePPTXFile/Editor/imagemanager.cpp b/ASCOfficePPTXFile/Editor/imagemanager.cpp index 1ccffd0f1a..d6b4b2c5c5 100644 --- a/ASCOfficePPTXFile/Editor/imagemanager.cpp +++ b/ASCOfficePPTXFile/Editor/imagemanager.cpp @@ -133,7 +133,7 @@ namespace NSShapeImageGen if (strAdditionalFile.empty()) { CMediaInfo info; - CFile oFile; + NSFile::CFileBinary oFile; if (S_OK != oFile.OpenFile(strFile) && std::wstring::npos == strFile.find(L"data:base64,")) { return info; @@ -419,7 +419,7 @@ namespace NSShapeImageGen strFileName = NSFile::CFileBinary::CreateTempFileWithUniqueName(tempFilePath, L"img") + _T(".") + sImageExtension; - CFile oTempFile; + NSFile::CFileBinary oTempFile; oTempFile.CreateFile(strFileName); oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen); oTempFile.CloseFile(); diff --git a/ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h b/ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h index 84a30af6b3..94a4cb88bb 100644 --- a/ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h +++ b/ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h @@ -71,7 +71,7 @@ namespace PPTX m_Data = NULL; m_DataSize =0; - CFile file; + NSFile::CFileBinary file; if (file.OpenFile(filename.GetPath()) == S_OK) { m_DataSize = (int)file.GetFileSize(); diff --git a/ASCOfficePPTXFile/PPTXFormat/Limit/BaseLimit.h b/ASCOfficePPTXFile/PPTXFormat/Limit/BaseLimit.h index 498326b5ba..a98773abc9 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Limit/BaseLimit.h +++ b/ASCOfficePPTXFile/PPTXFormat/Limit/BaseLimit.h @@ -32,6 +32,7 @@ #pragma once #include "../../../Common/DocxFormat/Source/Base/Base.h" +#include "../../../DesktopEditor/common/Types.h" #define _USE_STRING_OPERATOR \ virtual void operator=(const std::wstring& value) \ diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h b/ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h index b542d181d5..9339d0219d 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h @@ -33,6 +33,7 @@ #include "ColorBase.h" #include +#include "boost/format.hpp" namespace PPTX { diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SysClr.h b/ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SysClr.h index 62c8729d8c..c8a2f12b65 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SysClr.h +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SysClr.h @@ -33,7 +33,7 @@ #include "ColorBase.h" #include "./../../Limit/SysClrVal.h" -#include "../../../../Common/DocxFormat/Source/Base/ASCWinAPI.h" // GetSysColor +#include "../../../../Common/DocxFormat/Source/Base/WinColor.h" // GetSysColor namespace PPTX { diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.cpp index e9f1d7acf6..372684f75b 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.cpp @@ -332,7 +332,7 @@ namespace PPTX OOX::CPath pathTemp = NSFile::CFileBinary::CreateTempFileWithUniqueName(tempFilePath, _T("img")) + _T(".") + sImageExtension; - CFile oTempFile; + NSFile::CFileBinary oTempFile; oTempFile.CreateFile(pathTemp.GetPath()); oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen); oTempFile.CloseFile(); diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp index 744278466e..3c6d988a88 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Shape.cpp @@ -677,7 +677,7 @@ namespace PPTX { const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as(); - SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get()); + SimpleTypes::CShapeType ooxPrst = SimpleTypes::CShapeType(lpGeom.prst.get()); vmlPrst = OOX::PrstGeom2VmlShapeType(ooxPrst.GetValue()); if (nvSpPr.cNvSpPr.txBox.IsInit() && (*nvSpPr.cNvSpPr.txBox)) @@ -827,8 +827,8 @@ namespace PPTX } if (vmlPrst == SimpleTypes::Vml::sptLine) { - pWriter->WriteAttribute(L"from", XmlUtils::DoubleToString(pWriter->m_dX, L"%.1lf") + L"pt," + XmlUtils::DoubleToString(pWriter->m_dY, L"%.1lf") + L"pt"); - pWriter->WriteAttribute(L"to", XmlUtils::DoubleToString(pWriter->m_dX + pWriter->m_dWidth, L"%.1lf") + L"pt," + XmlUtils::DoubleToString(pWriter->m_dY + pWriter->m_dHeight, L"%.1lf") + L"pt"); + pWriter->WriteAttribute(L"from", XmlUtils::ToString(pWriter->m_dX, L"%.1lf") + L"pt," + XmlUtils::ToString(pWriter->m_dY, L"%.1lf") + L"pt"); + pWriter->WriteAttribute(L"to", XmlUtils::ToString(pWriter->m_dX + pWriter->m_dWidth, L"%.1lf") + L"pt," + XmlUtils::ToString(pWriter->m_dY + pWriter->m_dHeight, L"%.1lf") + L"pt"); } if (false == pWriter->m_strAttributesMain.empty()) diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.cpp index 499f05481b..f02bb9d222 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.cpp @@ -160,7 +160,7 @@ namespace PPTX pWriter->StartAttributes(); std::wstring strId = L"group " + std::to_wstring(pWriter->m_lObjectIdVML); - std::wstring strSpid = L"_x0000_s" + XmlUtils::IntToString(0xFFFF & (pWriter->m_lObjectIdVML >> 16), L"%04d"); + std::wstring strSpid = L"_x0000_s" + XmlUtils::ToString(0xFFFF & (pWriter->m_lObjectIdVML >> 16), L"%04d"); pWriter->m_lObjectIdVML++; diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.cpp index e09e93e244..6ca4bfe755 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/SpTreeElem.cpp @@ -215,7 +215,7 @@ namespace PPTX if (line.w.is_init()) { double dW = 72.0 * (*line.w) / (25.4 * 36000); - std::wstring s = L" strokeweight=\"" + XmlUtils::DoubleToString(dW, L"%.2lf") + L"pt\""; + std::wstring s = L" strokeweight=\"" + XmlUtils::ToString(dW, L"%.2lf") + L"pt\""; strAttr += s; } diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.cpp index a6114d8ab8..08999fba06 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/TxBody.cpp @@ -34,6 +34,7 @@ #include "TxBody.h" #include "ClrMap.h" #include "../Theme.h" +#include "boost/format.hpp" namespace PPTX { diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.cpp index b37b190622..d3459871f8 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/UniFill.cpp @@ -345,7 +345,7 @@ namespace PPTX OOX::CPath pathTemp = NSFile::CFileBinary::CreateTempFileWithUniqueName(tempFilePath, _T("img")) + _T(".") + sImageExtension; - CFile oTempFile; + NSFile::CFileBinary oTempFile; oTempFile.CreateFile(pathTemp.GetPath()); oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen); oTempFile.CloseFile(); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp index 383caf054b..cbf8039f7d 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp @@ -38,6 +38,7 @@ #include #include "../../../OfficeUtils/src/OfficeUtils.h" +#include "../../../DesktopEditor/xml/include/xmlutils.h" void ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name) { diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h index 3fefc3b7dc..b34ab796c6 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h @@ -701,7 +701,7 @@ class RtfPictureReader : public RtfAbstractReader for( int i = 0; i < nSize; i++ ) { BYTE byteVal = pbData[i]; - sResult += XmlUtils::IntToString(byteVal, L"%02X"); + sResult += XmlUtils::ToString(byteVal, L"%02X"); } } else @@ -709,7 +709,7 @@ class RtfPictureReader : public RtfAbstractReader for( int i = nSize - 1 ; i >= 0; i-- ) { BYTE byteVal = pbData[i]; - sResult += XmlUtils::IntToString(byteVal, L"%02X"); + sResult += XmlUtils::ToString(byteVal, L"%02X"); } } return sResult; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXMathReader.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXMathReader.cpp index 72e7dceba2..4ec749e134 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXMathReader.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXMathReader.cpp @@ -853,8 +853,8 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement * }break; case OOX::et_m_jc: { - OOX::Logic::CMathBottomNodes>* ooxElemMJc = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemMJc = + dynamic_cast*>(ooxMath); if ((ooxElemMJc) && (ooxElemMJc->m_val.IsInit())) { @@ -873,8 +873,8 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement * }break; default: { - OOX::Logic::CMathBottomNodes>* ooxElemBool = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemBool = + dynamic_cast*>(ooxMath); OOX::Logic::CMathBottomNodes* ooxElemChar = dynamic_cast*>(ooxMath); @@ -882,47 +882,47 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement * OOX::Logic::CMathBottomNodes* ooxElemMeasure = dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemInt255 = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemInt255 = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemLim = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemLim = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemUnSignInt = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemUnSignInt = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemTopBot = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemTopBot = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemFType = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemFType = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemStyle = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemStyle = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemShp = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemShp = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemScript = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemScript = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemSpacingRule = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemSpacingRule = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemXAlign = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemXAlign = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemInteger2 = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemInteger2 = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemYAlign = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemYAlign = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemBreakBin = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemBreakBin = + dynamic_cast*>(ooxMath); - OOX::Logic::CMathBottomNodes>* ooxElemBreakBinSub = - dynamic_cast>*>(ooxMath); + OOX::Logic::CMathBottomNodes* ooxElemBreakBinSub = + dynamic_cast*>(ooxMath); OOX::WritingElementWithChilds* ooxElemArray = dynamic_cast*>(ooxMath); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp index 0dadb45155..56b77bc7ce 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp @@ -1156,7 +1156,7 @@ bool OOXShapeReader::ParseShape( ReaderParameter oParam, RtfShapePtr& pOutput) { PPTX::Logic::PrstGeom& geometry = ooxShape->spPr.Geometry.as(); - SimpleTypes::CShapeType<> prst_type(geometry.prst.get()); + SimpleTypes::CShapeType prst_type(geometry.prst.get()); SimpleTypes::EShapeType type = prst_type.GetValue(); pOutput->m_nShapeType = OOX::PrstGeom2VmlShapeType(type); @@ -2163,8 +2163,8 @@ bool OOXShapeReader::WriteDataToPicture( std::wstring sPath, RtfPicture& pOutput else if( RtfPicture::dt_apm == pOutput.eDataType ) { //убираем заголовок apm (22 byte) - CFile file_inp; //mpa - CFile file_out;//wmf + NSFile::CFileBinary file_inp; //mpa + NSFile::CFileBinary file_out;//wmf std::wstring sTargetFile = NSDirectory::CreateTempFileWithUniqueName(ooxPath.GetDirectory(), L"img"); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfBookmark.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfBookmark.cpp index 4e7ed0c81f..a1456603c3 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfBookmark.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfBookmark.cpp @@ -232,7 +232,7 @@ std::wstring RtfAnnotation::RenderToOOX(RenderParameter oRenderParameter) std::wstring content = m_oContent->RenderToOOX(oNewParameter); - std::wstring sParaId = XmlUtils::IntToString(poOOXWriter->m_nextParaId, L"%08X");//last para id in comment + std::wstring sParaId = XmlUtils::ToString(poOOXWriter->m_nextParaId, L"%08X");//last para id in comment poCommentsWriter->AddCommentContent(m_oRef->m_sValue, sParaId, content); } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.cpp index 8c65797975..d77b170624 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.cpp @@ -249,7 +249,7 @@ std::wstring RtfChar::renderRtfText( std::wstring& sText, void* poDocument, int if (nCharCode == 0x5c || nCharCode == 0x7b || nCharCode == 0x7d || (0x00 <= nCharCode && nCharCode < 0x20) ) { - sResult += L"\\'" + XmlUtils::IntToString( nCharCode, L"%02x"); + sResult += L"\\'" + XmlUtils::ToString( nCharCode, L"%02x"); } else if ( 0x20 <= nCharCode && nCharCode < 0x80 ) { @@ -257,7 +257,7 @@ std::wstring RtfChar::renderRtfText( std::wstring& sText, void* poDocument, int } else { // 0x80 <= nUnicode <= 0xff - sResult += L"\\'" + XmlUtils::IntToString(nCharCode, L"%x" ); + sResult += L"\\'" + XmlUtils::ToString(nCharCode, L"%x" ); } } } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfLex.h b/ASCOfficeRtfFile/RtfFormatLib/source/RtfLex.h index e75b01b116..cbdbe9757e 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfLex.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfLex.h @@ -63,7 +63,7 @@ public: { Clear(); - CFile srcFile; + NSFile::CFileBinary srcFile; if (srcFile.OpenFile(sPath.c_str()) != S_OK) return false; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.cpp index c4620478a6..8595063221 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.cpp @@ -136,7 +136,7 @@ std::wstring RtfParagraph::RenderToOOX(RenderParameter oRenderParameter) sResult += L"m_nextParaId, L"%08X"); + std::wstring sParaId = XmlUtils::ToString(++pOOXWriter->m_nextParaId, L"%08X"); sResult += L" w14:paraId=\"" + sParaId + L"\" w14:textId=\"" + sParaId + L"\""; } sResult += L">"; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h b/ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h index be40dd9ce2..fbd4ef1cc0 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfPicture.h @@ -120,7 +120,7 @@ public: BYTE pBuffer[ 100 ]; DWORD dwBytesRead = 0; - CFile file; + NSFile::CFileBinary file; if (file.OpenFile(sFilename) != S_OK) return dt_none; file.ReadFile(pBuffer, 100); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp index 7a9a484c3c..5ac4ef569f 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp @@ -1283,7 +1283,7 @@ std::wstring RtfListProperty::RenderToOOX(RenderParameter oRenderParameter) // sResult += L""; if( PROP_DEF != m_nTemplateId ) - sResult += L""; + sResult += L""; RenderParameter oNewParam = oRenderParameter; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h index 09d0b60521..c671fa0a77 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.h @@ -331,9 +331,9 @@ public: { if (m_bAuto) return L"auto"; - std::wstring sRed = XmlUtils::IntToString(m_byteRed, L"%02X"); - std::wstring sGreen = XmlUtils::IntToString(m_byteGreen, L"%02X");; - std::wstring sBlue = XmlUtils::IntToString(m_byteBlue, L"%02X"); + std::wstring sRed = XmlUtils::ToString(m_byteRed, L"%02X"); + std::wstring sGreen = XmlUtils::ToString(m_byteGreen, L"%02X");; + std::wstring sBlue = XmlUtils::ToString(m_byteBlue, L"%02X"); if (bBGR) return sBlue + sGreen + sRed ; else return sRed + sGreen + sBlue ; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.cpp index 1d984dca05..e51986a13b 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfSection.cpp @@ -914,7 +914,7 @@ mc:Ignorable=\"w14 w15 w16se wp14\">"; std::wstring sFilePath = poOOXWriter->m_sTargetFolder + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename; - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(sFilePath) == S_OK) { diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp index a5ae401ba8..e3193f97f8 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfShape.cpp @@ -932,7 +932,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter) sResult += L" strokecolor=\"#" + color.ToHexColor(true) + L"\""; } if (PROP_DEF != m_nLineWidth) - sResult += L" strokeweight=\"" + XmlUtils::DoubleToString(RtfUtility::Emu2Pt(m_nLineWidth), L"%.2f") + L"pt\""; + sResult += L" strokeweight=\"" + XmlUtils::ToString(RtfUtility::Emu2Pt(m_nLineWidth), L"%.2f") + L"pt\""; //path switch (m_nConnectionType) { @@ -966,10 +966,10 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter) sStyle += L"position:absolute;"; if (oRenderParameter.nType != RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2) { - sStyle += L"margin-left:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(m_nLeft), L"%.2f") + L"pt;"; - sStyle += L"margin-top:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(m_nTop), L"%.2f") + L"pt;"; - sStyle += L"margin-bottom:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(m_nBottom), L"%.2f") + L"pt;"; - sStyle += L"margin-right:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(m_nRight), L"%.2f") + L"pt;"; + sStyle += L"margin-left:" + XmlUtils::ToString(RtfUtility::Twip2pt(m_nLeft), L"%.2f") + L"pt;"; + sStyle += L"margin-top:" + XmlUtils::ToString(RtfUtility::Twip2pt(m_nTop), L"%.2f") + L"pt;"; + sStyle += L"margin-bottom:" + XmlUtils::ToString(RtfUtility::Twip2pt(m_nBottom), L"%.2f") + L"pt;"; + sStyle += L"margin-right:" + XmlUtils::ToString(RtfUtility::Twip2pt(m_nRight), L"%.2f") + L"pt;"; } } @@ -977,9 +977,9 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter) int nHeight = m_nBottom - m_nTop; if (oRenderParameter.nType == RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2) - sStyle += L"width:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(nWidth), L"%.2f") + L";height:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(nHeight), L"%.2f"); + sStyle += L"width:" + XmlUtils::ToString(RtfUtility::Twip2pt(nWidth), L"%.2f") + L";height:" + XmlUtils::ToString(RtfUtility::Twip2pt(nHeight), L"%.2f"); else - sStyle += L"width:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(nWidth), L"%.2f") + L"pt;height:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(nHeight), L"%.2f") + L"pt;"; + sStyle += L"width:" + XmlUtils::ToString(RtfUtility::Twip2pt(nWidth), L"%.2f") + L"pt;height:" + XmlUtils::ToString(RtfUtility::Twip2pt(nHeight), L"%.2f") + L"pt;"; } else if( PROP_DEF != m_nRelLeft && PROP_DEF != m_nRelRight && PROP_DEF != m_nRelTop && PROP_DEF != m_nRelBottom ) { @@ -1011,9 +1011,9 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter) nHeight -= m_oPicture->m_nCropB; if (oRenderParameter.nType == RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2) - sStyle += L"width:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(nWidth), L"%.2f") + L";height:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(nHeight), L"%.2f") + L";"; + sStyle += L"width:" + XmlUtils::ToString(RtfUtility::Twip2pt(nWidth), L"%.2f") + L";height:" + XmlUtils::ToString(RtfUtility::Twip2pt(nHeight), L"%.2f") + L";"; else - sStyle += L"width:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(nWidth), L"%.2f") + L"pt;height:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(nHeight), L"%.2f") + L"pt;"; + sStyle += L"width:" + XmlUtils::ToString(RtfUtility::Twip2pt(nWidth), L"%.2f") + L"pt;height:" + XmlUtils::ToString(RtfUtility::Twip2pt(nHeight), L"%.2f") + L"pt;"; } else { @@ -1031,7 +1031,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter) } if (PROP_DEF != m_oPicture->m_nWidth && PROP_DEF != m_oPicture->m_nHeight) { - sStyle += L"width:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(m_oPicture->m_nWidth), L"%.2f") + L"pt;height:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt(m_oPicture->m_nHeight), L"%.2f") + L"pt;"; + sStyle += L"width:" + XmlUtils::ToString(RtfUtility::Twip2pt(m_oPicture->m_nWidth), L"%.2f") + L"pt;height:" + XmlUtils::ToString(RtfUtility::Twip2pt(m_oPicture->m_nHeight), L"%.2f") + L"pt;"; } } } @@ -1162,13 +1162,13 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter) sStyle += L"z-index:" + std::to_wstring(nZIndex) + L";"; if( PROP_DEF != m_nWrapDistLeft ) - sStyle += L"mso-wrap-distance-left:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt( m_nWrapDistLeft ), L"%.2f") + L"pt;"; + sStyle += L"mso-wrap-distance-left:" + XmlUtils::ToString(RtfUtility::Twip2pt( m_nWrapDistLeft ), L"%.2f") + L"pt;"; if( PROP_DEF != m_nWrapDistTop ) - sStyle += L"mso-wrap-distance-top:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt( m_nWrapDistTop ), L"%.2f") + L"pt;"; + sStyle += L"mso-wrap-distance-top:" + XmlUtils::ToString(RtfUtility::Twip2pt( m_nWrapDistTop ), L"%.2f") + L"pt;"; if( PROP_DEF != m_nWrapDistRight ) - sStyle += L"mso-wrap-distance-right:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt( m_nWrapDistRight ), L"%.2f") + L"pt;"; + sStyle += L"mso-wrap-distance-right:" + XmlUtils::ToString(RtfUtility::Twip2pt( m_nWrapDistRight ), L"%.2f") + L"pt;"; if( PROP_DEF != m_nWrapDistBottom ) - sStyle += L"mso-wrap-distance-bottom:" + XmlUtils::DoubleToString(RtfUtility::Twip2pt( m_nWrapDistBottom ), L"%.2f") + L"pt;"; + sStyle += L"mso-wrap-distance-bottom:" + XmlUtils::ToString(RtfUtility::Twip2pt( m_nWrapDistBottom ), L"%.2f") + L"pt;"; switch( m_nAnchorText) { @@ -1496,7 +1496,7 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter) std::wstring sColors; for (size_t i = 0; i < m_aFillShadeColors.size(); i++) { - sColors += std::to_wstring(m_aFillShadeColors[i].second) + L" #" + XmlUtils::IntToString(m_aFillShadeColors[i].first, L"%06X") + L";"; + sColors += std::to_wstring(m_aFillShadeColors[i].second) + L" #" + XmlUtils::ToString(m_aFillShadeColors[i].first, L"%06X") + L";"; } sResult += L" colors=\"" + sColors.substr(0, sColors.length() - 1) + L"\""; } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp index f8f9900ee6..504df824af 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp @@ -213,7 +213,7 @@ bool RtfWriter::SaveByItemEnd() { //свойства секции - CFile file; + NSFile::CFileBinary file; if (file.OpenFile(m_aTempFilesSectPr[i]) == S_OK) { DWORD dwBytesRead = 1; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h b/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h index b7345fbcf4..85adea47f2 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h @@ -40,7 +40,7 @@ #endif #include "../../../Common/FileWriter.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" #include "../../../UnicodeConverter/UnicodeConverter.h" @@ -148,7 +148,7 @@ public: } static std::wstring ToStringHex( int i, int nLen ) { - std::wstring result = XmlUtils::IntToString(i, L"%X"); + std::wstring result = XmlUtils::ToString(i, L"%X"); for(int i = (int)result.length(); i < nLen; i++ ) result.insert( result.begin() , '0' ); @@ -314,7 +314,7 @@ public: private: static void DecodeFromFile( std::wstring& sFilename, NFileWriter::CBufferedFileWriter& oFileWriter ) { - CFile file; + NSFile::CFileBinary file; if (file.OpenFile(sFilename) != S_OK) return; @@ -451,17 +451,17 @@ public: if( NULL == pbData ) return; - CFile file; - if (file.CreateFile(sFilename) != S_OK) return; + NSFile::CFileBinary file; + if (file.CreateFileW(sFilename) != S_OK) return; file.WriteFile(pbData, (DWORD)nLength); file.CloseFile(); } static void WriteDataToFile(std::wstring& sFilename, std::wstring& sData) { - CFile file; + NSFile::CFileBinary file; - if (file.CreateFile(sFilename) != S_OK) return; + if (file.CreateFileW(sFilename) != S_OK) return; wchar_t * buf = (wchar_t *)sData.c_str(); size_t nLengthText = sData.length(); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXCommentsWriter.h b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXCommentsWriter.h index acac32dc8a..1b9b7fdf25 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXCommentsWriter.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXCommentsWriter.h @@ -104,7 +104,7 @@ public: { if( m_mapComments.empty() ) return false; - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + _T("comments.xml"))) return false; m_oWriter.m_oDocRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"), _T("comments.xml") ); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXContentTypesWriter.h b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXContentTypesWriter.h index 0d920c2fac..7f6008c2a8 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXContentTypesWriter.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXContentTypesWriter.h @@ -56,7 +56,7 @@ public: } bool Save(std::wstring sFolder) { - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + _T("[Content_Types].xml")) != S_OK) return false; @@ -64,7 +64,7 @@ public: std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml); - file.WriteFile((void*)sXmlUTF.c_str(), (DWORD)sXmlUTF.length()); + file.WriteFile((const void*)sXmlUTF.c_str(), (DWORD)sXmlUTF.length()); file.CloseFile(); return true; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXFontTableWriter.h b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXFontTableWriter.h index 5377162c7b..c8ff3a3b09 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXFontTableWriter.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXFontTableWriter.h @@ -53,7 +53,7 @@ public: if( false == m_sFileXml.empty() ) { - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(pathWord + FILE_SEPARATOR_STR + _T("fontTable.xml"))) return false; m_oWriter.m_oDocRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"), _T("fontTable.xml") ); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXFootnoteWriter.h b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXFootnoteWriter.h index 1e963b22d3..e1fda834c2 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXFootnoteWriter.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXFootnoteWriter.h @@ -80,7 +80,7 @@ public: { if( m_sFootnotes.empty() ) return false; - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + _T("footnotes.xml"))) return false; m_oWriter.m_oDocRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"), _T("footnotes.xml") ); @@ -160,7 +160,7 @@ public: { if( m_sEndnotes.empty() ) return false; - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + _T("endnotes.xml"))) return false; m_oWriter.m_oDocRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"), _T("endnotes.xml") ); @@ -168,7 +168,7 @@ public: std::string sXml = CreateXml(); - file.WriteFile((void*)sXml.c_str(), (DWORD)sXml.length()); + file.WriteFile(sXml.c_str(), (DWORD)sXml.length()); file.CloseFile(); return true; } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXNumberingWriter.h b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXNumberingWriter.h index e6c58b99f3..3cb9b9e525 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXNumberingWriter.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXNumberingWriter.h @@ -52,7 +52,7 @@ public: { if( false == m_sFileXml.empty() ) { - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(sFolder + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("numbering.xml")) != S_OK) return false; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXRelsWriter.h b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXRelsWriter.h index d6594ded41..a0716d4164 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXRelsWriter.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXRelsWriter.h @@ -95,7 +95,7 @@ public: std::wstring pathRels = sFolder + FILE_SEPARATOR_STR + _T("_rels"); NSDirectory::CreateDirectory(pathRels) ; - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(pathRels + FILE_SEPARATOR_STR + m_sFileName + _T(".rels"))) return false; std::wstring sXml = CreateXml(); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXSettingsWriter.h b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXSettingsWriter.h index 8ffec47757..2b999ce737 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXSettingsWriter.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXSettingsWriter.h @@ -86,7 +86,7 @@ public: // } //} - CFile file; + NSFile::CFileBinary file; if (file.CreateFile(pathWord + FILE_SEPARATOR_STR + _T("settings.xml"))) return false; m_oWriter.m_oDocRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"), _T("settings.xml") ); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXStylesWriter.h b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXStylesWriter.h index 2a00cbdc6b..446c788985 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXStylesWriter.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXStylesWriter.h @@ -39,7 +39,7 @@ public: OOXRelsWriterPtr m_oRelsWriter; OOXStylesWriter(OOXWriter& oWriter,RtfDocument& oDocument ):m_oWriter(oWriter) { - m_oRelsWriter = OOXRelsWriterPtr( new OOXRelsWriter( _T("styles.xml"), oDocument ) ); + m_oRelsWriter = OOXRelsWriterPtr( new OOXRelsWriter( L"styles.xml", oDocument ) ); oWriter.m_oCustomRelsWriter.push_back( m_oRelsWriter ); } ~OOXStylesWriter() @@ -52,15 +52,15 @@ public: } bool Save( std::wstring sFolder ) { - std::wstring pathWord = sFolder + FILE_SEPARATOR_STR + _T("word"); + std::wstring pathWord = sFolder + FILE_SEPARATOR_STR + L"word"; //if( false == m_sFileXml.empty() ) { - CFile file; - if (file.CreateFile(pathWord + FILE_SEPARATOR_STR + _T("styles.xml"))) return false; + NSFile::CFileBinary file; + if (file.CreateFile(pathWord + FILE_SEPARATOR_STR + L"styles.xml")) return false; - m_oWriter.m_oDocRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"), _T("styles.xml") ); - m_oWriter.m_oContentTypes.AddContent( _T("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"), _T("/word/styles.xml") ); + m_oWriter.m_oDocRels.AddRelationship( L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", L"styles.xml" ); + m_oWriter.m_oContentTypes.AddContent( L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", L"/word/styles.xml" ); std::wstring sXml = CreateXml(); std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml); @@ -83,11 +83,11 @@ private: std::wstring CreateXml() { std::wstring sResult; - sResult.append( _T("") ); - sResult.append( _T("\n") ); - sResult.append( _T("") ); + sResult.append( L"" ); + sResult.append( L"\n" ); + sResult.append( L"" ); sResult.append( m_sFileXml ); - sResult.append( _T("") ); + sResult.append( L"" ); return sResult; } }; diff --git a/ASCOfficeXlsFile2/source/Common/utils.cpp b/ASCOfficeXlsFile2/source/Common/utils.cpp index dcb94622ae..ae74f34626 100644 --- a/ASCOfficeXlsFile2/source/Common/utils.cpp +++ b/ASCOfficeXlsFile2/source/Common/utils.cpp @@ -32,7 +32,7 @@ #include "utils.h" #include -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace xml { diff --git a/ASCOfficeXlsFile2/source/VbaFormat/VbaReader.cpp b/ASCOfficeXlsFile2/source/VbaFormat/VbaReader.cpp index 1cb53e46d0..d6a0ceb2d2 100644 --- a/ASCOfficeXlsFile2/source/VbaFormat/VbaReader.cpp +++ b/ASCOfficeXlsFile2/source/VbaFormat/VbaReader.cpp @@ -2,7 +2,7 @@ #include "StreamObjects.h" #include "../Common/simple_xml_writer.h" #include "../../../DesktopEditor/common/File.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" CVbaReader::CVbaReader(const std::wstring & vbaFileName, const std::wstring & vbaExtractFile) { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DConRef.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DConRef.cpp index 5e126b5094..7664ffe387 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DConRef.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DConRef.cpp @@ -31,7 +31,7 @@ */ #include "DConRef.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.cpp index 647dca5340..0f7c0cf688 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.cpp @@ -32,7 +32,7 @@ #include "DataLabExtContents.h" #include "../Biff_structures/FrtHeader.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Format.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Format.cpp index 6f601f84d5..b3614ec660 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Format.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Format.cpp @@ -31,7 +31,7 @@ */ #include "Format.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp index 51012046dd..fef5669dac 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp @@ -32,7 +32,7 @@ #include "Number.h" #include "../../Auxiliary/HelpFunc.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { @@ -87,7 +87,7 @@ int Number::serialize(std::wostream & stream) } CP_XML_NODE(L"v") { - CP_XML_STREAM() << XmlUtils::DoubleToString(num.data.value); + CP_XML_STREAM() << XmlUtils::ToString(num.data.value); } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SIIndex.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SIIndex.cpp index 0b2512bb7c..59da63f171 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SIIndex.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SIIndex.cpp @@ -36,7 +36,7 @@ #include "BoolErr.h" #include "Blank.h" #include "Label.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS @@ -82,7 +82,7 @@ int SIIndex::serialize(std::wostream & _stream, int idx, const CellRef & in_ref) CP_XML_NODE(L"c:pt") { CP_XML_ATTR(L"idx", idx++); - CP_XML_NODE(L"c:v") { CP_XML_STREAM() << XmlUtils::DoubleToString(number->num.data.value); } + CP_XML_NODE(L"c:v") { CP_XML_STREAM() << XmlUtils::ToString(number->num.data.value); } } res = 1; } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp index ed5e951543..79d99d06c4 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SXString.cpp @@ -31,7 +31,7 @@ */ #include "SXString.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgArea3d.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgArea3d.cpp index 47e9a7efb5..3dcc2d9a21 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgArea3d.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgArea3d.cpp @@ -34,7 +34,7 @@ #include "RevExtern.h" #include "CellRangeRef.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgList.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgList.cpp index da9104bec9..140534c931 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgList.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/PtgList.cpp @@ -31,7 +31,7 @@ */ #include "PtgList.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/SyntaxPtg.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/SyntaxPtg.cpp index d7ab7a0360..2006bf85b9 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/SyntaxPtg.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/SyntaxPtg.cpp @@ -35,7 +35,7 @@ #include "PtgParen.h" #include -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AI.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AI.cpp index 360372bddb..cce84fbf5a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AI.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AI.cpp @@ -33,7 +33,7 @@ #include "AI.h" #include "../Biff_records/BRAI.h" #include "../Biff_records/SeriesText.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMULA_bu.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMULA_bu.cpp index 0b3522d806..a7ce98e794 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMULA_bu.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMULA_bu.cpp @@ -41,7 +41,7 @@ #include "../Biff_records/Continue.h" #include "../../../../source/Common/utils.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/QUERYTABLE.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/QUERYTABLE.cpp index 147bd5bb9d..f929f48481 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/QUERYTABLE.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/QUERYTABLE.cpp @@ -42,7 +42,7 @@ #include "../Biff_records/DbOrParamQry.h" #include "../Biff_records/SXString.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp index efa1d83888..1d546d5298 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp @@ -34,7 +34,7 @@ #include "../Biff_records/Style.h" #include "../Biff_records/StyleExt.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SUPBOOK_bu.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SUPBOOK_bu.cpp index c20897e8e5..0470f0a046 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SUPBOOK_bu.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SUPBOOK_bu.cpp @@ -39,7 +39,7 @@ #include "../Biff_records/XCT.h" #include "../Biff_records/CRN.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.h index 600c658182..ed2850e129 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/CodePageOle.h @@ -35,7 +35,8 @@ #include #include #include -#include "../../../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../../DesktopEditor/common/Types.h" +#include "../../../../../Common/DocxFormat/Source/Base/Base.h" namespace OLEPS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.cpp index 1a4f420242..8841c4850c 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.cpp @@ -38,7 +38,7 @@ #include "../../../Common/simple_xml_writer.h" #include "../../../../../DesktopEditor/common/SystemUtils.h" #include "../../../../../Common/DocxFormat/Source/Base/Base.h" -#include "../../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../../Common/DocxFormat/Source/Base/Unit.h" namespace OLEPS { diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/CustomShapeConvert.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/CustomShapeConvert.h index ea37ac9bb7..3d65e28b42 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/CustomShapeConvert.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/CustomShapeConvert.h @@ -101,40 +101,40 @@ namespace NSCustomShapesConvert #define GUIDE_PARAM_1(name) \ { \ oWriter.m_oWriter.AddSize(g_guide_max_len); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string1, g_guide_string1_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string1, g_guide_string1_len); \ oWriter.m_oWriter.AddIntNoCheck(m_lIndexDst); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string_##name, g_guide_string_##name##_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string_##name, g_guide_string_##name##_len); \ GetValue(lParam1, eType1, bExtShape1, oWriter); \ ++m_lIndexDst; \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string2, g_guide_string2_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string2, g_guide_string2_len); \ } #define GUIDE_PARAM_2(name) \ { \ oWriter.m_oWriter.AddSize(g_guide_max_len); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string1, g_guide_string1_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string1, g_guide_string1_len); \ oWriter.m_oWriter.AddIntNoCheck(m_lIndexDst); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string_##name, g_guide_string_##name##_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string_##name, g_guide_string_##name##_len); \ GetValue(lParam1, eType1, bExtShape1, oWriter); \ oWriter.m_oWriter.AddSpaceNoCheck(); \ GetValue(lParam2, eType2, bExtShape2, oWriter); \ ++m_lIndexDst; \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string2, g_guide_string2_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string2, g_guide_string2_len); \ } #define GUIDE_PARAM_3(name) \ { \ oWriter.m_oWriter.AddSize(g_guide_max_len); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string1, g_guide_string1_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string1, g_guide_string1_len); \ oWriter.m_oWriter.AddIntNoCheck(m_lIndexDst); \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string_##name, g_guide_string_##name##_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string_##name, g_guide_string_##name##_len); \ GetValue(lParam1, eType1, bExtShape1, oWriter); \ oWriter.m_oWriter.AddSpaceNoCheck(); \ GetValue(lParam2, eType2, bExtShape2, oWriter); \ oWriter.m_oWriter.AddSpaceNoCheck(); \ GetValue(lParam3, eType3, bExtShape3, oWriter); \ ++m_lIndexDst; \ - oWriter.m_oWriter.AddStringNoCheck(g_guide_string2, g_guide_string2_len); \ + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string2, g_guide_string2_len); \ } struct CFormParam @@ -912,20 +912,20 @@ namespace NSCustomShapesConvert void ConvertProd(const std::wstring& strParam1, const std::wstring& strParam2, const LONG& lParam3, CXmlWriter& oWriter) { oWriter.m_oWriter.AddSize(g_guide_max_len); - oWriter.m_oWriter.AddStringNoCheck(g_guide_string1, g_guide_string1_len); + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string1, g_guide_string1_len); oWriter.m_oWriter.AddIntNoCheck(m_lIndexDst); - oWriter.m_oWriter.AddStringNoCheck(g_guide_string_prod, g_guide_string_prod_len); + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string_prod, g_guide_string_prod_len); oWriter.WriteString(strParam1); oWriter.m_oWriter.AddSpaceNoCheck(); if ('#' == strParam2[0]) { - LONG lRes = (LONG)NSCustomShapesConvert::GetInteger(strParam2.substr(1)); + LONG lRes = (LONG)XmlUtils::GetInteger(strParam2.substr(1)); GetValue(lRes, ptAdjust, false, oWriter); } else if ('@' == strParam2[0]) { - LONG lRes = (LONG)NSCustomShapesConvert::GetInteger(strParam2.substr(1)); + LONG lRes = (LONG)XmlUtils::GetInteger(strParam2.substr(1)); GetValue(lRes, ptFormula, false, oWriter); } else @@ -935,7 +935,7 @@ namespace NSCustomShapesConvert GetValue(lParam3, ptValue, false, oWriter); ++m_lIndexDst; - oWriter.m_oWriter.AddStringNoCheck(g_guide_string2, g_guide_string2_len); + oWriter.m_oWriter.WriteStringNoSafe(g_guide_string2, g_guide_string2_len); } //------------------------------------- @@ -1083,17 +1083,17 @@ namespace NSCustomShapesConvert if ('#' == strParam[0]) { - lRes = (LONG)NSCustomShapesConvert::GetInteger(strParam.substr(1)); + lRes = (LONG)XmlUtils::GetInteger(strParam.substr(1)); strFrmla = GetValue2(lRes, ptAdjust, false) + L" " + strSize; } else if ('&' == strParam[0]) { - lRes = (LONG)NSCustomShapesConvert::GetInteger(strParam.substr(1)); + lRes = (LONG)XmlUtils::GetInteger(strParam.substr(1)); strFrmla = GetValue2(lRes, ptFormula, true) + L" " + strSize; } else if ('@' == strParam[0]) { - lRes = (LONG)NSCustomShapesConvert::GetInteger(strParam.substr(1)); + lRes = (LONG)XmlUtils::GetInteger(strParam.substr(1)); strFrmla = GetValue2(lRes, ptFormula, false) + L" " + strSize; } else if (!NSStringUtils::IsNumber(strParam)) @@ -1107,7 +1107,7 @@ namespace NSCustomShapesConvert } else { - lRes = (LONG)NSCustomShapesConvert::GetInteger(strParam.c_str()); + lRes = (LONG)XmlUtils::GetInteger(strParam.c_str()); strFrmla = GetValue2(lRes, ptValue, false) + strSize; } @@ -1135,12 +1135,12 @@ namespace NSCustomShapesConvert if ('#' == strParam[0]) { ptType = ptAdjust; - return (LONG)NSCustomShapesConvert::GetInteger(strParam.substr(1).c_str()); + return (LONG)XmlUtils::GetInteger(strParam.substr(1).c_str()); } else if ('@' == strParam[0]) { ptType = ptFormula; - return (LONG)NSCustomShapesConvert::GetInteger(strParam.substr(1).c_str()); + return (LONG)XmlUtils::GetInteger(strParam.substr(1).c_str()); } else if (!NSStringUtils::IsNumber(strParam)) { @@ -1155,7 +1155,7 @@ namespace NSCustomShapesConvert else { ptType = ptValue; - return (LONG)NSCustomShapesConvert::GetInteger(strParam.c_str()); + return (LONG)XmlUtils::GetInteger(strParam.c_str()); } } void ConvertQuadrX(Aggplus::POINT pPoint, SPointType pPointType) diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/FormulaShape.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/FormulaShape.h index 133960fec1..d47e34b77b 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/FormulaShape.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/FormulaShape.h @@ -42,7 +42,7 @@ #include "../../../../DesktopEditor/xml/include/xmlutils.h" #include "../../../../DesktopEditor/graphics/aggplustypes.h" -#include "../../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../../Common/DocxFormat/Source/Base/Unit.h" namespace NSCustomShapesConvert { diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/XmlWriter.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/XmlWriter.h index 14e1baccaa..3c3db970b8 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/XmlWriter.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertShapes/XmlWriter.h @@ -33,30 +33,12 @@ //#include "../../../Common/DocxFormat/Source/Base/Nullable.h" #include "../../../DesktopEditor/common/File.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" +#include "../../../DesktopEditor/common/StringBuilder.h" +#include namespace NSCustomShapesConvert { - static int GetInteger (const std::wstring& string) - { - if (string.length() <1) return 0; - - try - { - return _ttoi(string.c_str()); - } - catch(...) - { - } - - try - { - return static_cast(_wtoi64(string.c_str())); - } - catch(...) - { - return 0; - } - } static std::wstring g_bstr_nodeopen = L"<"; static std::wstring g_bstr_nodeclose = L">"; static std::wstring g_bstr_nodeopen_slash = L"= 0) ? dVal : -dVal; } - class CStringWriter - { - private: - wchar_t* m_pData; - size_t m_lSize; - - wchar_t* m_pDataCur; - size_t m_lSizeCur; - - public: - CStringWriter() - { - m_pData = NULL; - m_lSize = 0; - - m_pDataCur = m_pData; - m_lSizeCur = m_lSize; - } - ~CStringWriter() - { - RELEASEMEM(m_pData); - } - void AddSize(size_t nSize) - { - if (NULL == m_pData) - { - m_lSize = (std::max)(nSize, (size_t) 1024); - m_pData = (wchar_t*)malloc(m_lSize * sizeof(wchar_t)+64); - - m_lSizeCur = 0; - m_pDataCur = m_pData; - return; - } - - if ((m_lSizeCur + nSize) > m_lSize) - { - while ((m_lSizeCur + nSize) > m_lSize) - { - //m_lSize *= 2; - бесконтрольно .. - m_lSize += (std::max)(nSize, (size_t) 1024); - } - int size_alloc = m_lSize * sizeof(wchar_t); - #if defined(_WIN32) || defined (_WIN64) - wchar_t* pRealloc = (wchar_t*)realloc(m_pData, size_alloc ); - if (NULL != pRealloc) - { - // реаллок сработал - m_pData = pRealloc; - m_pDataCur = m_pData + m_lSizeCur; - } - else -#endif - { - wchar_t* pMalloc = (wchar_t*)malloc(size_alloc ); - memcpy(pMalloc, m_pData, m_lSizeCur * sizeof(wchar_t)); - - free(m_pData); - m_pData = pMalloc; - m_pDataCur = m_pData + m_lSizeCur; - } - } - } - - public: - - void WriteString(const std::wstring & wString) - { - size_t nLen = wString.length(); - - AddSize(nLen); - - memcpy(m_pDataCur, wString.c_str(), nLen * sizeof(wchar_t)); - - m_pDataCur += nLen; - m_lSizeCur += nLen; - } - - void WriteStringXML(const std::wstring & wString) - { - std::wstring buffer; - buffer.reserve(wString.size()); - for(size_t pos = 0; pos != wString.size(); ++pos) - { - switch(wString[pos]) - { - case '&': buffer.append(_T("&")); break; - case '\"': buffer.append(_T(""")); break; - case '\'': buffer.append(_T("'")); break; - case '<': buffer.append(_T("<")); break; - case '>': buffer.append(_T(">")); break; - default: buffer.append(&wString[pos], 1); break; - } - } - WriteString(buffer); - } - size_t GetCurSize() - { - return m_lSizeCur; - } - - // void Write(CStringWriter& oWriter) - //{ - // WriteString(oWriter.m_pData, oWriter.m_lSizeCur); - //} - - void WriteBefore(CStringWriter& oWriter) - { - size_t nNewS = oWriter.GetCurSize(); - AddSize(nNewS); - memmove(m_pData + nNewS, m_pData, m_lSizeCur * sizeof (wchar_t)); - memcpy(m_pData, oWriter.m_pData, nNewS * sizeof (wchar_t)); - m_pDataCur += nNewS; - m_lSizeCur += nNewS; - } - - inline void Clear() - { - RELEASEMEM(m_pData); - - m_pData = NULL; - m_lSize = 0; - - m_pDataCur = m_pData; - m_lSizeCur = 0; - } - inline void ClearNoAttack() - { - m_pDataCur = m_pData; - m_lSizeCur = 0; - } - - std::wstring GetData() - { - if (m_lSizeCur < 1 || !m_pData) return L""; - - std::wstring str(m_pData, (int)m_lSizeCur); - return str; - } - - void AddCharNoCheck(const WCHAR& wc) - { - *m_pDataCur++ = wc; - ++m_lSizeCur; - } - void AddIntNoCheck(int val) - { - if (0 == val) - { - *m_pDataCur++ = (WCHAR)'0'; - ++m_lSizeCur; - return; - } - if (val < 0) - { - val = -val; - *m_pDataCur++ = (WCHAR)'-'; - ++m_lSizeCur; - } - - int len = 0; - int oval = val; - while (oval > 0) - { - oval /= 10; - ++len; - } - - oval = 1; - while (val > 0) - { - m_pDataCur[len - oval] = (WCHAR)('0' + (val % 10)); - ++oval; - val /= 10; - } - - m_pDataCur += len; - m_lSizeCur += len; - } - - void AddStringNoCheck(const wchar_t* pData, const int& len) - { - memcpy(m_pDataCur, pData, len *sizeof(wchar_t)); - - m_pDataCur += len; - m_lSizeCur += len; - } - void AddSpaceNoCheck() - { - *m_pDataCur = WCHAR(' '); - ++m_pDataCur; - ++m_lSizeCur; - } - }; - class CXmlWriter { public: - CStringWriter m_oWriter; + NSStringUtils::CStringBuilder m_oWriter; CXmlWriter() : m_oWriter() { @@ -300,35 +88,35 @@ namespace NSCustomShapesConvert } void WriteStringXML(std::wstring strValue) { - m_oWriter.WriteStringXML(strValue); + m_oWriter.WriteEncodeXmlString(strValue); } void WriteDouble(const double& val) { - m_oWriter.WriteString(boost::lexical_cast(val)); + m_oWriter.WriteString(XmlUtils::ToString(val)); } void WriteLONG(const long& val) { - m_oWriter.WriteString(boost::lexical_cast(val)); + m_oWriter.WriteString(XmlUtils::ToString(val)); } void WriteINT(const int& val) { - m_oWriter.WriteString(boost::lexical_cast(val)); + m_oWriter.WriteString(XmlUtils::ToString(val)); } void WriteDWORD(const DWORD& val) { - m_oWriter.WriteString(boost::lexical_cast(val)); + m_oWriter.WriteString(XmlUtils::ToString(val)); } void WriteDWORD_hex(const DWORD& val) { - m_oWriter.WriteString(boost::lexical_cast(val)); + m_oWriter.WriteString(XmlUtils::ToString(val)); } void WriteBool(const bool& val) { - m_oWriter.WriteString(boost::lexical_cast(val)); + m_oWriter.WriteString(XmlUtils::ToString(val)); } void WriteAttribute(const std::wstring& strAttributeName, const std::wstring& val) { @@ -345,7 +133,7 @@ namespace NSCustomShapesConvert m_oWriter.WriteString(strAttributeName); m_oWriter.WriteString(g_bstr_node_equal); m_oWriter.WriteString(g_bstr_node_quote); - m_oWriter.WriteStringXML(val); + m_oWriter.WriteEncodeXmlString(val); m_oWriter.WriteString(g_bstr_node_quote); } void WriteAttribute(const std::wstring& strAttributeName, const double& val) diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp index b0f28b5513..5abdc5d278 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp @@ -2480,7 +2480,7 @@ void XlsConverter::convert(XLS::Obj * obj) if (obj->pictFlags.fDde) object_stream = L"LNK"; else object_stream = L"MBD"; - object_stream += XmlUtils::IntToString(obj->pictFmla.lPosInCtlStm, L"%08X") + L"/"; + object_stream += XmlUtils::ToString(obj->pictFmla.lPosInCtlStm, L"%08X") + L"/"; if (xls_file->storage_->isDirectory(object_stream)) { xlsx_context->get_mediaitems().create_embeddings_path(xlsx_path); diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.cpp index 38bfe4d7aa..6ce9f8f375 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/external_items.cpp @@ -39,7 +39,7 @@ #include "mediaitems_utils.h" #include "../../../Common/DocxFormat/Source/Base/Base.h" -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" #include "../../../DesktopEditor/common/Directory.h" diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.cpp index 455ba8926f..b8c943850b 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_package.cpp @@ -35,7 +35,7 @@ #include #include -#include "../../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" namespace oox { diff --git a/Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro b/Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro index cc1ae61dc3..39e8a9366a 100644 --- a/Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro +++ b/Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro @@ -104,7 +104,6 @@ SOURCES += \ SOURCES += docxformatlib.cpp \ ../Source/Base/codecvt.cpp \ ../Source/Base/DateTime.cpp \ - ../Source/Utility/TxtFile.cpp \ ../Source/Base/unicode_util.cpp \ ../../3dParty/pole/pole.cpp \ diff --git a/Common/DocxFormat/Source/Base/Base.h b/Common/DocxFormat/Source/Base/Base.h index 96db161170..f7140550a5 100644 --- a/Common/DocxFormat/Source/Base/Base.h +++ b/Common/DocxFormat/Source/Base/Base.h @@ -38,6 +38,9 @@ #define VALUE_TO_STRING(x) #x #define VALUE2STR(x) VALUE_TO_STRING(x) +#define _T(x) __T(x) +#define __T(x) L##x + #if defined(_WIN32) || defined (_WIN64) #include // windows-stype separator for paths i.e. 'c:\home\documents\file.ext' diff --git a/Common/DocxFormat/Source/Base/Unit.cpp b/Common/DocxFormat/Source/Base/Unit.cpp index 3d3cc5e32e..798c1f9fe0 100644 --- a/Common/DocxFormat/Source/Base/Unit.cpp +++ b/Common/DocxFormat/Source/Base/Unit.cpp @@ -603,12 +603,23 @@ namespace XmlUtils } std::wstring ToString (const float & value) { - return boost::lexical_cast( value); + return boost::lexical_cast(value); + } + std::wstring ToString(const int& value) + { + return boost::lexical_cast(value); + } + std::wstring ToString(const long& value) + { + return boost::lexical_cast(value); + } + std::wstring ToString(const unsigned long& value) + { + return boost::lexical_cast(value); } - std::wstring ToString(const double& value) { - return boost::lexical_cast( value); + return boost::lexical_cast(value); } std::wstring ToString( int value, const wchar_t* format ) diff --git a/Common/DocxFormat/Source/Base/Unit.h b/Common/DocxFormat/Source/Base/Unit.h index 642c8d74b0..52ef1e11d9 100644 --- a/Common/DocxFormat/Source/Base/Unit.h +++ b/Common/DocxFormat/Source/Base/Unit.h @@ -143,9 +143,12 @@ namespace XmlUtils double GetDouble(const std::wstring& string); float GetFloat(const std::wstring& string); - std::wstring ToString(const bool & value); - std::wstring ToString(const float & value); + std::wstring ToString(const bool& value); + std::wstring ToString(const float& value); std::wstring ToString(const double& value); + std::wstring ToString(const int& value); + std::wstring ToString(const long& value); + std::wstring ToString(const unsigned long& value); std::wstring ToString(int value, const wchar_t* format); std::string ToString(int value, const char* format); diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.cpp b/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.cpp new file mode 100644 index 0000000000..c6291e7bb4 --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.cpp @@ -0,0 +1,59 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +#include "SimpleTypes_Rtf.h" + +namespace SimpleTypes +{ + EOptimizeForBrowserTarget COptimizeForBrowserTarget::FromString(const std::wstring &sValue) + { + if ( _T("W3C XHTML+CSS1") == sValue ) this->m_eValue = optforbrowserXhtmlCSS1; + else if ( _T("W3C HTML4+CSS1") == sValue ) this->m_eValue = optforbrowserHtml4CSS1; + else if ( _T("W3C XHTML+CSS2") == sValue ) this->m_eValue = optforbrowserXhtmlCSS2; + else if ( _T("W3C HTML4+CSS2") == sValue ) this->m_eValue = optforbrowserHtml4CSS2; + else this->m_eValue = optforbrowserHtml4CSS2; + + return this->m_eValue; + } + + std::wstring COptimizeForBrowserTarget::ToString() const + { + switch(this->m_eValue) + { + case optforbrowserXhtmlCSS1 : return _T("W3C XHTML+CSS1"); + case optforbrowserHtml4CSS1 : return _T("W3C HTML4+CSS1 "); + case optforbrowserXhtmlCSS2 : return _T("W3C XHTML+CSS2 "); + case optforbrowserHtml4CSS2 : return _T("W3C HTML4+CSS2 "); + default : return _T("W3C HTML4+CSS2 "); + } + } + +} // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.h b/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.h new file mode 100644 index 0000000000..b2121abc86 --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.h @@ -0,0 +1,52 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2019 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +#pragma once + +#include "SimpleTypes_Base.h" + +namespace SimpleTypes +{ + //-------------------------------------------------------------------------------- + // COptimizeForBrowserTarget + //-------------------------------------------------------------------------------- + + enum EOptimizeForBrowserTarget + { + optforbrowserXhtmlCSS1 = 0, + optforbrowserHtml4CSS1 = 1, + optforbrowserXhtmlCSS2 = 2, + optforbrowserHtml4CSS2 = 3 + }; + + DEFINE_SIMPLE_TYPE(COptimizeForBrowserTarget, EOptimizeForBrowserTarget, optforbrowserHtml4CSS2) + +} // SimpleTypes diff --git a/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramColors.h b/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramColors.h index b7badaa402..e67cb989a2 100644 --- a/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramColors.h +++ b/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramColors.h @@ -68,8 +68,8 @@ namespace OOX public: std::wstring node_name; - nullable> m_oHueDir; - nullable> m_oMeth; + nullable m_oHueDir; + nullable m_oMeth; }; class CColorStyleLbl : public WritingElement diff --git a/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h b/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h index e2042804f8..d5645c9155 100644 --- a/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h +++ b/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h @@ -86,7 +86,7 @@ namespace OOX public: nullable m_oVal; }; - class CAnimLvl : public Diagram::ComplexType> + class CAnimLvl : public Diagram::ComplexType { public: WritingElement_AdditionConstructors(CAnimLvl) @@ -98,11 +98,11 @@ namespace OOX } virtual std::wstring toXML() const { - return Diagram::ComplexType>::toXML(L"dgm:animLvl"); + return Diagram::ComplexType::toXML(L"dgm:animLvl"); } virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - return Diagram::ComplexType>::toXmlWriter(L"dgm:animLvl", pWriter); + return Diagram::ComplexType::toXmlWriter(L"dgm:animLvl", pWriter); } virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -114,7 +114,7 @@ namespace OOX WriteByteToPPTY(m_oVal.IsInit() ? (BYTE)m_oVal->GetValue() : 0, pWriter); } }; - class CAnimOne : public Diagram::ComplexType> + class CAnimOne : public Diagram::ComplexType { public: WritingElement_AdditionConstructors(CAnimOne) @@ -126,11 +126,11 @@ namespace OOX } virtual std::wstring toXML() const { - return Diagram::ComplexType>::toXML(L"dgm:animOne"); + return Diagram::ComplexType::toXML(L"dgm:animOne"); } virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - return Diagram::ComplexType>::toXmlWriter(L"dgm:animOne", pWriter); + return Diagram::ComplexType::toXmlWriter(L"dgm:animOne", pWriter); } virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -170,7 +170,7 @@ namespace OOX WriteByteToPPTY(m_oVal.IsInit() ? (BYTE)m_oVal->GetValue() : 0, pWriter); } }; - class CChMax : public Diagram::ComplexType> + class CChMax : public Diagram::ComplexType { public: WritingElement_AdditionConstructors(CChMax) @@ -182,11 +182,11 @@ namespace OOX } virtual std::wstring toXML() const { - return Diagram::ComplexType>::toXML(L"dgm:chMax"); + return Diagram::ComplexType::toXML(L"dgm:chMax"); } virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - return Diagram::ComplexType>::toXmlWriter(L"dgm:chMax", pWriter); + return Diagram::ComplexType::toXmlWriter(L"dgm:chMax", pWriter); } virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -198,7 +198,7 @@ namespace OOX WriteIntToPPTY(m_oVal.IsInit() ? m_oVal->GetValue() : 0, pWriter); } }; - class CChPref : public Diagram::ComplexType> + class CChPref : public Diagram::ComplexType { public: WritingElement_AdditionConstructors(CChPref) @@ -210,11 +210,11 @@ namespace OOX } virtual std::wstring toXML() const { - return Diagram::ComplexType>::toXML(L"dgm:chPref"); + return Diagram::ComplexType::toXML(L"dgm:chPref"); } virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - return Diagram::ComplexType>::toXmlWriter(L"dgm:chPref", pWriter); + return Diagram::ComplexType::toXmlWriter(L"dgm:chPref", pWriter); } virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -226,7 +226,7 @@ namespace OOX WriteIntToPPTY(m_oVal.IsInit() ? m_oVal->GetValue() : 0, pWriter); } }; - class CDirection : public Diagram::ComplexType> + class CDirection : public Diagram::ComplexType { public: WritingElement_AdditionConstructors(CDirection) @@ -238,11 +238,11 @@ namespace OOX } virtual std::wstring toXML() const { - return Diagram::ComplexType>::toXML(L"dgm:dir"); + return Diagram::ComplexType::toXML(L"dgm:dir"); } virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - return Diagram::ComplexType>::toXmlWriter(L"dgm:dir", pWriter); + return Diagram::ComplexType::toXmlWriter(L"dgm:dir", pWriter); } virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -254,7 +254,7 @@ namespace OOX WriteByteToPPTY(m_oVal.IsInit() ? (BYTE)m_oVal->GetValue() : 0, pWriter); } }; - class CHierBranch : public Diagram::ComplexType> + class CHierBranch : public Diagram::ComplexType { public: WritingElement_AdditionConstructors(CHierBranch) @@ -266,11 +266,11 @@ namespace OOX } virtual std::wstring toXML() const { - return Diagram::ComplexType>::toXML(L"dgm:hierBranch"); + return Diagram::ComplexType::toXML(L"dgm:hierBranch"); } virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - return Diagram::ComplexType>::toXmlWriter(L"dgm:hierBranch", pWriter); + return Diagram::ComplexType::toXmlWriter(L"dgm:hierBranch", pWriter); } virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -310,7 +310,7 @@ namespace OOX WriteByteToPPTY(m_oVal.IsInit() ? (BYTE)m_oVal->GetValue() : 0, pWriter); } }; - class CResizeHandles : public Diagram::ComplexType> + class CResizeHandles : public Diagram::ComplexType { public: WritingElement_AdditionConstructors(CResizeHandles) @@ -322,11 +322,11 @@ namespace OOX } virtual std::wstring toXML() const { - return Diagram::ComplexType>::toXML(L"dgm:resizeHandles"); + return Diagram::ComplexType::toXML(L"dgm:resizeHandles"); } virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const { - return Diagram::ComplexType>::toXmlWriter(L"dgm:resizeHandles", pWriter); + return Diagram::ComplexType::toXmlWriter(L"dgm:resizeHandles", pWriter); } virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) { @@ -472,7 +472,7 @@ namespace OOX nullable m_oPrSet; nullable_string m_sModelId; //guid - nullable> m_oType; + nullable m_oType; nullable_string m_sCxnId; //guid }; class CPtLst : public WritingElementWithChilds diff --git a/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramLayout.cpp b/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramLayout.cpp index 3bca9f3119..f26e2da4ea 100644 --- a/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramLayout.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramLayout.cpp @@ -473,12 +473,12 @@ namespace OOX else if (4 == _at) m_arCnt.push_back(pReader->GetLong()); else if (5 == _at) { - SimpleTypes::CAxisTypes<> axis; axis.SetValueFromByte(pReader->GetUChar()); + SimpleTypes::CAxisTypes axis; axis.SetValueFromByte(pReader->GetUChar()); m_arAxis.push_back(axis); } else if (6 == _at) { - SimpleTypes::CElementTypes<> ptType; ptType.SetValueFromByte(pReader->GetUChar()); + SimpleTypes::CElementTypes ptType; ptType.SetValueFromByte(pReader->GetUChar()); m_arPtType.push_back(ptType); } else if (7 == _at) m_sRef = pReader->GetString2(); @@ -580,14 +580,14 @@ namespace OOX std::vector arStr; boost::algorithm::split(arStr, *sAxis, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arAxis.push_back(SimpleTypes::CAxisTypes<>(arStr[i])); + m_arAxis.push_back(SimpleTypes::CAxisTypes(arStr[i])); } if (sPtTypes.IsInit()) { std::vector arStr; boost::algorithm::split(arStr, *sPtTypes, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arPtType.push_back(SimpleTypes::CElementTypes<>(arStr[i])); + m_arPtType.push_back(SimpleTypes::CElementTypes(arStr[i])); } if (sSt.IsInit()) { @@ -615,7 +615,7 @@ namespace OOX std::vector arStr; boost::algorithm::split(arStr, *sHideLastTrans, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arHideLastTrans.push_back(SimpleTypes::COnOff<>(arStr[i]).ToBool()); + m_arHideLastTrans.push_back(SimpleTypes::COnOff(arStr[i]).ToBool()); } } //------------------------------------------------------------------------------------------- @@ -641,12 +641,12 @@ namespace OOX else if (4 == _at) m_arCnt.push_back(pReader->GetLong()); else if (5 == _at) { - SimpleTypes::CAxisTypes<> axis; axis.SetValueFromByte(pReader->GetUChar()); + SimpleTypes::CAxisTypes axis; axis.SetValueFromByte(pReader->GetUChar()); m_arAxis.push_back(axis); } else if (6 == _at) { - SimpleTypes::CElementTypes<> ptType; ptType.SetValueFromByte(pReader->GetUChar()); + SimpleTypes::CElementTypes ptType; ptType.SetValueFromByte(pReader->GetUChar()); m_arPtType.push_back(ptType); } else if (7 == _at) m_sRef = pReader->GetString2(); @@ -771,14 +771,14 @@ namespace OOX std::vector arStr; boost::algorithm::split(arStr, *sAxis, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arAxis.push_back(SimpleTypes::CAxisTypes<>(arStr[i])); + m_arAxis.push_back(SimpleTypes::CAxisTypes(arStr[i])); } if (sPtTypes.IsInit()) { std::vector arStr; boost::algorithm::split(arStr, *sPtTypes, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arPtType.push_back(SimpleTypes::CElementTypes<>(arStr[i])); + m_arPtType.push_back(SimpleTypes::CElementTypes(arStr[i])); } if (sSt.IsInit()) { @@ -806,7 +806,7 @@ namespace OOX std::vector arStr; boost::algorithm::split(arStr, *sHideLastTrans, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arHideLastTrans.push_back(SimpleTypes::COnOff<>(arStr[i]).ToBool()); + m_arHideLastTrans.push_back(SimpleTypes::COnOff(arStr[i]).ToBool()); } } //------------------------------------------------------------------------------------------- @@ -1513,12 +1513,12 @@ namespace OOX else if (4 == _at) m_arCnt.push_back(pReader->GetLong()); else if (5 == _at) { - SimpleTypes::CAxisTypes<> axis; axis.SetValueFromByte(pReader->GetUChar()); + SimpleTypes::CAxisTypes axis; axis.SetValueFromByte(pReader->GetUChar()); m_arAxis.push_back(axis); } else if (6 == _at) { - SimpleTypes::CElementTypes<> ptType; ptType.SetValueFromByte(pReader->GetUChar()); + SimpleTypes::CElementTypes ptType; ptType.SetValueFromByte(pReader->GetUChar()); m_arPtType.push_back(ptType); } } @@ -1600,14 +1600,14 @@ namespace OOX std::vector arStr; boost::algorithm::split(arStr, *sAxis, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arAxis.push_back(SimpleTypes::CAxisTypes<>(arStr[i])); + m_arAxis.push_back(SimpleTypes::CAxisTypes(arStr[i])); } if (sPtTypes.IsInit()) { std::vector arStr; boost::algorithm::split(arStr, *sPtTypes, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arPtType.push_back(SimpleTypes::CElementTypes<>(arStr[i])); + m_arPtType.push_back(SimpleTypes::CElementTypes(arStr[i])); } if (sSt.IsInit()) { @@ -1635,7 +1635,7 @@ namespace OOX std::vector arStr; boost::algorithm::split(arStr, *sHideLastTrans, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on); for (size_t i = 0; i < arStr.size(); ++i) - m_arHideLastTrans.push_back(SimpleTypes::COnOff<>(arStr[i]).ToBool()); + m_arHideLastTrans.push_back(SimpleTypes::COnOff(arStr[i]).ToBool()); } } //------------------------------------------------------------------------------------------- diff --git a/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramLayout.h b/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramLayout.h index 3eb239a96c..a0769d9961 100644 --- a/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramLayout.h +++ b/Common/DocxFormat/Source/DocxFormat/Diagram/DiagramLayout.h @@ -101,7 +101,7 @@ namespace OOX nullable_string m_sName; nullable_string m_sStyleLbl; nullable_string m_sMoveWith; - nullable> m_oChOrder; + nullable m_oChOrder; }; class CForEach : public WritingElementWithChilds<> { @@ -131,8 +131,8 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - std::vector> m_arAxis; - std::vector> m_arPtType; + std::vector m_arAxis; + std::vector m_arPtType; std::vector m_arCnt; std::vector m_arSt; std::vector m_arStep; @@ -169,11 +169,11 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: nullable m_oFact; - nullable> m_oFor; + nullable m_oFor; nullable_string m_oForName; nullable m_oMax; - nullable> m_oPtType; - nullable> m_oType; + nullable m_oPtType; + nullable m_oType; nullable m_oVal; nullable m_oExtLst; @@ -231,16 +231,16 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oFor; + nullable m_oFor; nullable_string m_oForName; nullable_double m_oFact; - nullable> m_oOp; - nullable> m_oPtType; - nullable> m_oRefFor; + nullable m_oOp; + nullable m_oPtType; + nullable m_oRefFor; nullable_string m_oRefForName; - nullable> m_oRefPtType; - nullable> m_oRefType; - nullable> m_oType; + nullable m_oRefPtType; + nullable m_oRefType; + nullable m_oType; nullable m_oVal; nullable m_oExtLst; @@ -298,7 +298,7 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oType; + nullable m_oType; nullable_string m_oVal; //union of SimpleTypes ... todooo? }; class CAlg : public WritingElementWithChilds @@ -329,7 +329,7 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oType; + nullable m_oType; nullable_uint m_nRev; nullable m_oExtLst; @@ -363,10 +363,10 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: nullable_string m_sArg; //union of types - nullable> m_oFunc; - nullable> m_oOp; - std::vector> m_arAxis; - std::vector> m_arPtType; + nullable m_oFunc; + nullable m_oOp; + std::vector m_arAxis; + std::vector m_arPtType; std::vector m_arCnt; std::vector m_arSt; std::vector m_arStep; @@ -465,8 +465,8 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - std::vector> m_arAxis; - std::vector> m_arPtType; + std::vector m_arAxis; + std::vector m_arPtType; std::vector m_arCnt; std::vector m_arSt; std::vector m_arStep; diff --git a/Common/DocxFormat/Source/DocxFormat/DocxFlat.h b/Common/DocxFormat/Source/DocxFormat/DocxFlat.h index 701299b952..e6ec340848 100644 --- a/Common/DocxFormat/Source/DocxFormat/DocxFlat.h +++ b/Common/DocxFormat/Source/DocxFormat/DocxFlat.h @@ -35,6 +35,7 @@ #include "IFileContainer.h" #include "FileTypes.h" #include "../Common/SimpleTypes_Word.h" +#include "../../../../DesktopEditor/common/File.h" namespace OOX { diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.cpp b/Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.cpp index aca1c6078f..8537743246 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.cpp @@ -403,7 +403,7 @@ namespace OOX CText *pText = (CText*)pT; pText->m_sText = sText; - pText->m_oSpace = new SimpleTypes::CXmlSpace<>(); + pText->m_oSpace = new SimpleTypes::CXmlSpace(); pText->m_oSpace->SetValue( SimpleTypes::xmlspacePreserve ); @@ -426,7 +426,7 @@ namespace OOX CText *pText = (CText*)pT; pText->m_sText = sText; - pText->m_oSpace = new SimpleTypes::CXmlSpace<>(); + pText->m_oSpace = new SimpleTypes::CXmlSpace(); pText->m_oSpace->SetValue( SimpleTypes::xmlspacePreserve ); if ( pProperty ) @@ -521,7 +521,7 @@ namespace OOX std::string s(sString); pText->m_sText = std::wstring(s.begin(), s.end()); delete sString; - pText->m_oSpace = new SimpleTypes::CXmlSpace<>(); + pText->m_oSpace = new SimpleTypes::CXmlSpace(); pText->m_oSpace->SetValue( SimpleTypes::xmlspacePreserve ); ((CRun*)pR)->m_arrItems.push_back( pT ); @@ -548,7 +548,7 @@ namespace OOX std::string s(sString); pText->m_sText = std::wstring(s.begin(), s.end()); delete sString; - pText->m_oSpace = new SimpleTypes::CXmlSpace<>(); + pText->m_oSpace = new SimpleTypes::CXmlSpace(); pText->m_oSpace->SetValue( SimpleTypes::xmlspacePreserve ); if ( pProperty ) @@ -566,7 +566,7 @@ namespace OOX if ( !pBS ) return; - ((CBookmarkStart*)pBS)->m_oId = new SimpleTypes::CDecimalNumber<>(); + ((CBookmarkStart*)pBS)->m_oId = new SimpleTypes::CDecimalNumber(); ((CBookmarkStart*)pBS)->m_oId->SetValue( nId ); ((CBookmarkStart*)pBS)->m_sName = sName; @@ -578,7 +578,7 @@ namespace OOX if ( !pBE ) return; - ((CBookmarkEnd*)pBE)->m_oId = new SimpleTypes::CDecimalNumber<>(); + ((CBookmarkEnd*)pBE)->m_oId = new SimpleTypes::CDecimalNumber(); ((CBookmarkEnd*)pBE)->m_oId->SetValue( nId ); m_arrItems.push_back( pBE ); diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Run.cpp b/Common/DocxFormat/Source/DocxFormat/Logic/Run.cpp index 85045112ad..1077f86840 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Run.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Run.cpp @@ -390,7 +390,7 @@ namespace OOX CDocxFlat* docx_flat = dynamic_cast(WritingElement::m_pMainDocument); //for 66 - nullable> oSpace; + nullable oSpace; CText::ReadAttributes(oReader, oSpace); if ((docx) && (docx->m_oMain.document)) diff --git a/Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h b/Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h index 790854f394..6fdcb052fe 100644 --- a/Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h +++ b/Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h @@ -35,56 +35,7 @@ #include "../File.h" #include "../../Common/ComplexTypes.h" - -namespace SimpleTypes -{ - //-------------------------------------------------------------------------------- - // COptimizeForBrowserTarget - //-------------------------------------------------------------------------------- - - enum EOptimizeForBrowserTarget - { - optforbrowserXhtmlCSS1 = 0, - optforbrowserHtml4CSS1 = 1, - optforbrowserXhtmlCSS2 = 2, - optforbrowserHtml4CSS2 = 3 - }; - - template - class COptimizeForBrowserTarget : public CSimpleType - { - public: - - COptimizeForBrowserTarget() {} - - virtual EOptimizeForBrowserTarget FromString(std::wstring &sValue) - { - if ( _T("W3C XHTML+CSS1") == sValue ) this->m_eValue = optforbrowserXhtmlCSS1; - else if ( _T("W3C HTML4+CSS1") == sValue ) this->m_eValue = optforbrowserHtml4CSS1; - else if ( _T("W3C XHTML+CSS2") == sValue ) this->m_eValue = optforbrowserXhtmlCSS2; - else if ( _T("W3C HTML4+CSS2") == sValue ) this->m_eValue = optforbrowserHtml4CSS2; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case optforbrowserXhtmlCSS1 : return _T("W3C XHTML+CSS1"); - case optforbrowserHtml4CSS1 : return _T("W3C HTML4+CSS1 "); - case optforbrowserXhtmlCSS2 : return _T("W3C XHTML+CSS2 "); - case optforbrowserHtml4CSS2 : return _T("W3C HTML4+CSS2 "); - default : return _T("W3C HTML4+CSS2 "); - } - } - - SimpleType_FromString (EOptimizeForBrowserTarget) - SimpleType_Operator_Equal (COptimizeForBrowserTarget) - }; - -} // SimpleTypes +#include "../../Common/SimpleTypes_Rtf.h" namespace ComplexTypes { @@ -129,8 +80,8 @@ namespace ComplexTypes public: - nullable> m_oTarget; - nullable > m_oVal; + nullable m_oTarget; + nullable m_oVal; }; } // Word diff --git a/Common/DocxFormat/Source/DocxFormat/VmlDrawing.cpp b/Common/DocxFormat/Source/DocxFormat/VmlDrawing.cpp index 7affa4b304..278246b647 100644 --- a/Common/DocxFormat/Source/DocxFormat/VmlDrawing.cpp +++ b/Common/DocxFormat/Source/DocxFormat/VmlDrawing.cpp @@ -30,6 +30,8 @@ * */ #include "VmlDrawing.h" +#include +#include "../../../../DesktopEditor/common/StringBuilder.h" namespace OOX { @@ -290,7 +292,7 @@ namespace OOX //for Comment SpreadsheetML & others vml (hf, objects, ...) !! - XmlUtils::CStringWriter sXml; + NSStringUtils::CStringBuilder sXml; sXml.WriteString(L""); if(comment->m_dLeftMM.IsInit()) { SimpleTypes::CPoint oPoint; oPoint.FromMm(comment->m_dLeftMM.get()); - sStyle += L"margin-left:" + XmlUtils::DoubleToString(oPoint.ToPoints()) + L"pt;"; + sStyle += L"margin-left:" + XmlUtils::ToString(oPoint.ToPoints()) + L"pt;"; } if(comment->m_dTopMM.IsInit()) { SimpleTypes::CPoint oPoint; oPoint.FromMm(comment->m_dTopMM.get()); - sStyle += L"margin-top:" + XmlUtils::DoubleToString(oPoint.ToPoints()) + L"pt;"; + sStyle += L"margin-top:" + XmlUtils::ToString(oPoint.ToPoints()) + L"pt;"; } if(comment->m_dWidthMM.IsInit()) { SimpleTypes::CPoint oPoint; oPoint.FromMm(comment->m_dWidthMM.get()); - sStyle += L"width:" + XmlUtils::DoubleToString(oPoint.ToPoints()) + L"pt;"; + sStyle += L"width:" + XmlUtils::ToString(oPoint.ToPoints()) + L"pt;"; } if(comment->m_dHeightMM.IsInit()) { SimpleTypes::CPoint oPoint; oPoint.FromMm(comment->m_dHeightMM.get()); - sStyle += L"height:" + XmlUtils::DoubleToString(oPoint.ToPoints()) + L"pt;"; + sStyle += L"height:" + XmlUtils::ToString(oPoint.ToPoints()) + L"pt;"; } std::wstring sClientData = L""; diff --git a/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerializeEx.cpp b/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerializeEx.cpp index f4d2eaa02f..dd0b71c361 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerializeEx.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerializeEx.cpp @@ -1239,7 +1239,7 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"" if (m_content.IsInit()) { - writer.WriteString(XmlUtils::DoubleToString(*m_content)); + writer.WriteString(XmlUtils::ToString(*m_content)); } writer.WriteString(L""); @@ -1413,7 +1413,7 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"" if (m_binCount.IsInit()) { writer.WriteString(L""); - writer.WriteString(XmlUtils::DoubleToString(*m_binCount)); + writer.WriteString(XmlUtils::ToString(*m_binCount)); writer.WriteString(L""); } else if (m_binSize.IsInit()) @@ -1938,4 +1938,4 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"" } } -} \ No newline at end of file +} diff --git a/Common/DocxFormat/Source/XlsxFormat/NamedSheetViews/NamedSheetViews.h b/Common/DocxFormat/Source/XlsxFormat/NamedSheetViews/NamedSheetViews.h index 54d1506093..d2b784e8ef 100644 --- a/Common/DocxFormat/Source/XlsxFormat/NamedSheetViews/NamedSheetViews.h +++ b/Common/DocxFormat/Source/XlsxFormat/NamedSheetViews/NamedSheetViews.h @@ -100,7 +100,7 @@ namespace OOX return et_x_SortRules; } //Attributes - nullable> m_oSortMethod;//none + nullable m_oSortMethod;//none nullable_bool m_oCaseSensitive;//False //Members nullable m_oExtLst; diff --git a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/Text.cpp b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/Text.cpp index 07aeb8e61e..79c06f5820 100644 --- a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/Text.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/Text.cpp @@ -169,7 +169,7 @@ namespace OOX } else if(SimpleTypes::Spreadsheet::celltypeBool == eType) { - SimpleTypes::COnOff<> oOnOff; + SimpleTypes::COnOff oOnOff; oOnOff.FromStringA(pVal); m_nValue = oOnOff.ToBool() ? 1 : 0; } diff --git a/Common/DocxFormat/Source/XlsxFormat/Slicer/SlicerCache.h b/Common/DocxFormat/Source/XlsxFormat/Slicer/SlicerCache.h index 8dbea8b5b6..a925352bb5 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Slicer/SlicerCache.h +++ b/Common/DocxFormat/Source/XlsxFormat/Slicer/SlicerCache.h @@ -184,8 +184,8 @@ namespace OOX nullable_string m_oUniqueName; nullable_string m_oSourceCaption; nullable_uint m_oCount; - nullable> m_oSortOrder;//natural - nullable> m_oCrossFilter;//showItemsWithDataAtTop + nullable m_oSortOrder;//natural + nullable m_oCrossFilter;//showItemsWithDataAtTop //Members std::vector m_oRanges; }; @@ -287,10 +287,10 @@ namespace OOX } //Attributes nullable_uint m_oPivotCacheId; - nullable> m_oSortOrder;//ascending + nullable m_oSortOrder;//ascending nullable_bool m_oCustomListSort;//True nullable_bool m_oShowMissing;//True - nullable> m_oCrossFilter;//showItemsWithDataAtTop + nullable m_oCrossFilter;//showItemsWithDataAtTop //Members nullable m_oItems; nullable m_oExtLst; diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.cpp b/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.cpp index ee88c9bbb0..68c6a288bd 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.cpp @@ -1647,7 +1647,7 @@ namespace OOX //обычно пишется 1/0, но встречается, что пишут true/false if (m_oValue.IsInit()) { - SimpleTypes::COnOff<> oOnOff; + SimpleTypes::COnOff oOnOff; std::wstring sVal = m_oValue->ToString(); oOnOff.FromString(sVal.c_str()); m_oValue.Init(); diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.cpp b/Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.cpp index 4fe17f5ccf..022a919b4b 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.cpp @@ -432,7 +432,7 @@ namespace OOX CSheet* pSheet = new CSheet( WritingElement::m_pMainDocument ); xlsx_flat->m_pWorkbook->m_oSheets->m_arrItems.push_back(pSheet); - pSheet->m_oState = new SimpleTypes::Spreadsheet::CVisibleType<>(SimpleTypes::Spreadsheet::visibleVisible); + pSheet->m_oState = new SimpleTypes::Spreadsheet::CVisibleType(SimpleTypes::Spreadsheet::visibleVisible); if (sName.IsInit()) { pSheet->m_oName = sName; diff --git a/Common/DocxFormat/Source/XlsxFormat/WritingElement.h b/Common/DocxFormat/Source/XlsxFormat/WritingElement.h index 3e5a1c120b..5302d732b2 100644 --- a/Common/DocxFormat/Source/XlsxFormat/WritingElement.h +++ b/Common/DocxFormat/Source/XlsxFormat/WritingElement.h @@ -49,7 +49,7 @@ namespace Spreadsheet // writer.WriteString(end); #define WritingStringCommonDouble(start, val, end) \ writer.WriteString(start); \ - writer.WriteString(XmlUtils::DoubleToString(val)); \ + writer.WriteString(XmlUtils::ToString(val)); \ writer.WriteString(end); #define WritingValNode(ns, name, val) \ diff --git a/Common/DocxFormat/Source/XlsxFormat/Xlsx.cpp b/Common/DocxFormat/Source/XlsxFormat/Xlsx.cpp index 90febc09ae..12329d95b4 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Xlsx.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Xlsx.cpp @@ -465,7 +465,7 @@ void OOX::Spreadsheet::CXlsx::PrepareWorksheet(CWorksheet* pWorksheet) //обычно пишется 1/0, но встречается, что пишут true/false if(pCell->m_oValue.IsInit()) { - SimpleTypes::COnOff<> oOnOff; + SimpleTypes::COnOff oOnOff; std::wstring sVal = pCell->m_oValue->ToString(); oOnOff.FromString(sVal.c_str()); pCell->m_oValue.Init(); diff --git a/Common/DocxFormat/Source/XlsxFormat/XlsxFlat.h b/Common/DocxFormat/Source/XlsxFormat/XlsxFlat.h index ec01272e00..829323bc98 100644 --- a/Common/DocxFormat/Source/XlsxFormat/XlsxFlat.h +++ b/Common/DocxFormat/Source/XlsxFormat/XlsxFlat.h @@ -34,6 +34,7 @@ #include "../DocxFormat/IFileContainer.h" #include "FileTypes_Spreadsheet.h" #include "WritingElement.h" +#include "../../../../DesktopEditor/common/File.h" namespace OOX { diff --git a/Common/FileWriter.h b/Common/FileWriter.h index c657aba4be..dae5278da6 100644 --- a/Common/FileWriter.h +++ b/Common/FileWriter.h @@ -78,7 +78,7 @@ namespace NFileWriter { private : - CFile m_oFile; + NSFile::CFileBinary m_oFile; //HANDLE m_hFile; // Хендл на файл, в который идет запись LONG64 m_lBufferSize; // Размер буффера @@ -92,7 +92,7 @@ namespace NFileWriter // Конструктор ( от имени файла, сам контрол открывает файл ) CBufferedFileWriter ( std::wstring & sFileName, LONG64 lBufferSize = 10 * 1024 * 1024 ) : CFileWriter () { - if (m_oFile.CreateFile(sFileName) != S_OK) + if (m_oFile.CreateFileW(sFileName) != S_OK) // Если не получилось открыть файл { // Выдаем исключение diff --git a/Common/Network/FileTransporter/src/FileTransporter_win.cpp b/Common/Network/FileTransporter/src/FileTransporter_win.cpp index 8261c929da..798b67d350 100644 --- a/Common/Network/FileTransporter/src/FileTransporter_win.cpp +++ b/Common/Network/FileTransporter/src/FileTransporter_win.cpp @@ -87,6 +87,9 @@ namespace NSNetwork virtual int DownloadFile() override { + m_bComplete = true; + return (true == DownloadFilePS(m_sDownloadFileUrl, m_sDownloadFilePath)) ? S_OK : S_FALSE; + CoInitialize ( NULL ); if ( /*S_OK != _DownloadFile ( m_sFileUrl )*/TRUE ) { @@ -97,14 +100,7 @@ namespace NSNetwork NSFile::CFileBinary::Remove(m_sDownloadFilePath); } - HRESULT hrResultAll = DownloadFileAll(m_sDownloadFileUrl, m_sDownloadFilePath); - - if(E_ABORT == hrResultAll /*&& m_bIsExit->load()*/) - { - //DeleteUrlCacheEntry(m_sDownloadFileUrl.c_str()); - CoUninitialize (); - return hrResultAll; - } + HRESULT hrResultAll = S_FALSE; if (S_OK != hrResultAll) { hrResultAll = (true == DownloadFilePS(m_sDownloadFileUrl, m_sDownloadFilePath)) ? S_OK : S_FALSE; @@ -457,6 +453,13 @@ namespace NSNetwork } std::wstring sApp = L"powershell.exe –c \"(new-object System.Net.WebClient).DownloadFile('" + sFileURL + L"','" + sFileDst + L"')\""; + + std::string sss = U_TO_UTF8(sApp); + FILE* f = fopen("D://777.txt", "a+"); + fprintf(f, sss.c_str()); + fprintf(f, "\n"); + fclose(f); + wchar_t* pCommandLine = new wchar_t[sApp.length() + 1]; memcpy(pCommandLine, sApp.c_str(), sApp.length() * sizeof(wchar_t)); pCommandLine[sApp.length()] = (wchar_t)'\0'; diff --git a/DesktopEditor/common/File.cpp b/DesktopEditor/common/File.cpp index c097ac4fe7..c2f58cd798 100644 --- a/DesktopEditor/common/File.cpp +++ b/DesktopEditor/common/File.cpp @@ -949,6 +949,10 @@ namespace NSFile long CFileBinary::GetFilePosition() { return m_lFilePosition; + } + unsigned long CFileBinary::GetPosition() + { + return (unsigned long)m_lFilePosition; } #ifdef _IOS @@ -1067,6 +1071,11 @@ namespace NSFile return true; } + bool CFileBinary::CreateFile(const std::wstring& sFileName) + { + return CreateFileW(sFileName); + } + #endif bool CFileBinary::CreateTempFile() @@ -1110,14 +1119,18 @@ namespace NSFile dwSizeRead = (DWORD)fread((void*)pData, 1, nBytesToRead, m_pFile); return true; } - bool CFileBinary::WriteFile(const BYTE* pData, DWORD nBytesCount) + bool CFileBinary::WriteFile(const void* pData, DWORD nBytesCount) { if (!m_pFile) return false; - size_t nCountWrite = fwrite((const void*)pData, 1, nBytesCount, m_pFile); + size_t nCountWrite = fwrite(pData, 1, nBytesCount, m_pFile); return true; } + bool CFileBinary::WriteFile(const BYTE* pData, DWORD nBytesCount) + { + return WriteFile((const void*)pData, nBytesCount); + } bool CFileBinary::WriteFile2(const BYTE* pData, DWORD nBytesToWrite) { if (!m_pFile) diff --git a/DesktopEditor/common/File.h b/DesktopEditor/common/File.h index 1b59b443ff..f7fc427151 100644 --- a/DesktopEditor/common/File.h +++ b/DesktopEditor/common/File.h @@ -150,15 +150,18 @@ namespace NSFile FILE* GetFileNative(); long GetFileSize(); long GetFilePosition(); + unsigned long GetPosition(); bool OpenFile(const std::wstring& sFileName, bool bRewrite = false); bool CreateFileW(const std::wstring& sFileName); + bool CreateFile(const std::wstring& sFileName); bool CreateTempFile(); bool SetPosition(int lFilePosition); bool SeekFile(int lFilePosition, int nSeekMode = 0); bool ReadFile(BYTE* pData, DWORD nBytesToRead); bool ReadFile(BYTE* pData, DWORD nBytesToRead, DWORD& dwSizeRead); + bool WriteFile(const void* pData, DWORD nBytesCount); bool WriteFile(const BYTE* pData, DWORD nBytesCount); bool WriteFile2(const BYTE* pData, DWORD nBytesCount); long TellFile(); diff --git a/DesktopEditor/common/StringBuilder.cpp b/DesktopEditor/common/StringBuilder.cpp index 00f34737a8..6b819fb28f 100644 --- a/DesktopEditor/common/StringBuilder.cpp +++ b/DesktopEditor/common/StringBuilder.cpp @@ -571,6 +571,15 @@ namespace NSStringUtils { WriteString(oWriter.m_pData + offset, oWriter.m_lSizeCur - offset); } + void CStringBuilder::WriteBefore(CStringBuilder& oWriter) + { + size_t nNewS = oWriter.GetCurSize(); + AddSize(nNewS); + memmove(m_pData + nNewS, m_pData, m_lSizeCur * sizeof (wchar_t)); + memcpy(m_pData, oWriter.m_pData, nNewS * sizeof (wchar_t)); + m_pDataCur += nNewS; + m_lSizeCur += nNewS; + } void CStringBuilder::Clear() { diff --git a/DesktopEditor/common/StringBuilder.h b/DesktopEditor/common/StringBuilder.h index 4631139ed9..b5b1b2272a 100644 --- a/DesktopEditor/common/StringBuilder.h +++ b/DesktopEditor/common/StringBuilder.h @@ -40,7 +40,7 @@ namespace NSStringUtils { - class KERNEL_DECL CStringBuilderA + class KERNEL_DECL CStringBuilderA { private: char* m_pData; @@ -50,32 +50,32 @@ namespace NSStringUtils size_t m_lSizeCur; public: - CStringBuilderA(); - ~CStringBuilderA(); - void AddSize(size_t nSize); + CStringBuilderA(); + ~CStringBuilderA(); + void AddSize(size_t nSize); public: - void SetText(const std::string& sText); - void WriteString(const std::string& str); + void SetText(const std::string& sText); + void WriteString(const std::string& str); - void WriteStringNoSafe(const char* pString, size_t nLen); - void WriteString(const char* pString, size_t nLen); + void WriteStringNoSafe(const char* pString, size_t nLen); + void WriteString(const char* pString, size_t nLen); - void AddCharNoSafe(const char& _c); - void AddCharSafe(const char& _c); + void AddCharNoSafe(const char& _c); + void AddCharSafe(const char& _c); - size_t GetCurSize(); - void SetCurSize(size_t lCurSize); - size_t GetSize(); + size_t GetCurSize(); + void SetCurSize(size_t lCurSize); + size_t GetSize(); - void Clear(); - void ClearNoAttack(); + void Clear(); + void ClearNoAttack(); - std::string GetData(); - char* GetBuffer(); + std::string GetData(); + char* GetBuffer(); }; - class KERNEL_DECL CStringBuilder + class KERNEL_DECL CStringBuilder { protected: wchar_t* m_pData; @@ -85,109 +85,110 @@ namespace NSStringUtils size_t m_lSizeCur; public: - CStringBuilder(); - virtual ~CStringBuilder(); + CStringBuilder(); + virtual ~CStringBuilder(); - virtual void AddSize(size_t nSize); + virtual void AddSize(size_t nSize); public: - void SetText(const std::wstring& bsText); + void SetText(const std::wstring& bsText); - void operator+=(const std::wstring& oTemp); + void operator+=(const std::wstring& oTemp); - void WriteStringNoSafe(const wchar_t* pString, size_t nLen); - void WriteString(const wchar_t* pString, size_t nLen = -1); + void WriteStringNoSafe(const wchar_t* pString, size_t nLen); + void WriteString(const wchar_t* pString, size_t nLen = -1); - void WriteString(const std::wstring& sString); + void WriteString(const std::wstring& sString); - void AddCharNoSafe(const wchar_t& _c); - void AddCharNoCheck(const wchar_t& _c); - void AddSpaceNoCheck(); - void AddCharSafe(const wchar_t& _c); - void AddChar2Safe(const wchar_t _c1, const wchar_t& _c2); + void AddCharNoSafe(const wchar_t& _c); + void AddCharNoCheck(const wchar_t& _c); + void AddSpaceNoCheck(); + void AddCharSafe(const wchar_t& _c); + void AddChar2Safe(const wchar_t _c1, const wchar_t& _c2); - void WriteEncodeXmlString(const std::wstring& sString); - void WriteEncodeXmlString(const wchar_t* pString, int nCount = -1); + void WriteEncodeXmlString(const std::wstring& sString); + void WriteEncodeXmlString(const wchar_t* pString, int nCount = -1); - void WriteEncodeXmlStringHHHH(const std::wstring& sString); - void WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount = -1); + void WriteEncodeXmlStringHHHH(const std::wstring& sString); + void WriteEncodeXmlStringHHHH(const wchar_t* pString, int nCount = -1); - size_t GetCurSize(); - void SetCurSize(size_t lCurSize); - size_t GetSize(); + size_t GetCurSize(); + void SetCurSize(size_t lCurSize); + size_t GetSize(); - void Write(CStringBuilder& oWriter, const size_t& offset = 0); + void Write(CStringBuilder& oWriter, const size_t& offset = 0); + void WriteBefore(CStringBuilder& oWriter); - void Clear(); - void ClearNoAttack(); + void Clear(); + void ClearNoAttack(); - std::wstring GetData(); - std::wstring GetSubData(const size_t& start = 0, const size_t& count = std::wstring::npos); - wchar_t* GetBuffer(); + std::wstring GetData(); + std::wstring GetSubData(const size_t& start = 0, const size_t& count = std::wstring::npos); + wchar_t* GetBuffer(); - void RemoveLastSpaces(); - bool IsSpace(); + void RemoveLastSpaces(); + bool IsSpace(); void AddBool2(bool val); - void AddInt(int val); + void AddInt(int val); void AddUInt(unsigned int val); - void AddIntDel10(int val); - void AddIntDel100(int val); - void AddInt64(__int64 val); + void AddIntDel10(int val); + void AddIntDel100(int val); + void AddInt64(__int64 val); - void AddIntNoCheck(int val); + void AddIntNoCheck(int val); - void AddIntNoCheckDel10(int val); - void AddIntNoCheckDel100(int val); - void AddDouble(double val, int count); + void AddIntNoCheckDel10(int val); + void AddIntNoCheckDel100(int val); + void AddDouble(double val, int count); - void WriteHexByteNoSafe(const unsigned char& value); - void WriteHexByte(const unsigned char& value); - void WriteHexInt3(const unsigned int& value); - void WriteHexInt4(const unsigned int& value); - void WriteHexColor3(const unsigned char& r, const unsigned char& g, const unsigned char& b); - void WriteHexColor3(const unsigned int& value); + void WriteHexByteNoSafe(const unsigned char& value); + void WriteHexByte(const unsigned char& value); + void WriteHexInt3(const unsigned int& value); + void WriteHexInt4(const unsigned int& value); + void WriteHexColor3(const unsigned char& r, const unsigned char& g, const unsigned char& b); + void WriteHexColor3(const unsigned int& value); - void Skip(int nSkip); + void Skip(int nSkip); - void StartNode(const std::wstring& name); - void StartNodeWithNS(const std::wstring& ns, const std::wstring& name); - void StartAttributes(); - void EndAttributes(); - void EndAttributesAndNode(); - void EndNode(const std::wstring& name); - void EndNodeWithNS(const std::wstring& ns, const std::wstring& name); - void WriteNodeBegin(std::wstring strNodeName, bool bAttributed = false); - void WriteNodeEnd(std::wstring strNodeName, bool bEmptyNode = false, bool bEndNode = true); + void StartNode(const std::wstring& name); + void StartNodeWithNS(const std::wstring& ns, const std::wstring& name); + void StartAttributes(); + void EndAttributes(); + void EndAttributesAndNode(); + void EndNode(const std::wstring& name); + void EndNodeWithNS(const std::wstring& ns, const std::wstring& name); + void WriteNodeBegin(std::wstring strNodeName, bool bAttributed = false); + void WriteNodeEnd(std::wstring strNodeName, bool bEmptyNode = false, bool bEndNode = true); - void WriteAttribute(const std::wstring& strName, bool value); - void WriteAttribute(const std::wstring& strName, int value); - void WriteAttribute(const std::wstring& strName, unsigned int value); - void WriteAttribute(const std::wstring& strName, double value); - void WriteAttribute(const std::wstring& strName, const std::wstring& value); - void WriteAttribute(const std::wstring& strName, const wchar_t* value); - void WriteAttributeEncodeXml(const std::wstring& strName, const std::wstring& value); - void WriteAttributeEncodeXml(const std::wstring& strName, const wchar_t* value); + void WriteAttribute(const std::wstring& strName, bool value); + void WriteAttribute(const std::wstring& strName, int value); + void WriteAttribute(const std::wstring& strName, unsigned int value); + void WriteAttribute(const std::wstring& strName, double value); + void WriteAttribute(const std::wstring& strName, const std::wstring& value); + void WriteAttribute(const std::wstring& strName, const wchar_t* value); + void WriteAttributeEncodeXml(const std::wstring& strName, const std::wstring& value); + void WriteAttributeEncodeXml(const std::wstring& strName, const wchar_t* value); - void WriteNodeValue(const std::wstring& strName, bool value); - void WriteNodeValue(const std::wstring& strName, int value); - void WriteNodeValue(const std::wstring& strName, unsigned int value); - void WriteNodeValue(const std::wstring& strName, double value); - void WriteNodeValue(const std::wstring& strName, const std::wstring& value); - void WriteNodeValue(const std::wstring& strName, const wchar_t* value); - void WriteNodeValueEncodeXml(const std::wstring& strName, const std::wstring& value); - void WriteNodeValueEncodeXml(const std::wstring& strName, const wchar_t* value); + void WriteNodeValue(const std::wstring& strName, bool value); + void WriteNodeValue(const std::wstring& strName, int value); + void WriteNodeValue(const std::wstring& strName, unsigned int value); + void WriteNodeValue(const std::wstring& strName, double value); + void WriteNodeValue(const std::wstring& strName, const std::wstring& value); + void WriteNodeValue(const std::wstring& strName, const wchar_t* value); + void WriteNodeValueEncodeXml(const std::wstring& strName, const std::wstring& value); + void WriteNodeValueEncodeXml(const std::wstring& strName, const wchar_t* value); protected: - inline void WriteEncodeXmlString_4bytes(const wchar_t* pString, int nCount); - inline void WriteEncodeXmlString_2bytes(const wchar_t* pString, int nCount); - inline void WriteEncodeXmlStringHHHH_4bytes(const wchar_t* pString, int nCount); - inline void WriteEncodeXmlStringHHHH_2bytes(const wchar_t* pString, int nCount); - inline void WriteEncodeXmlChar(wchar_t code, unsigned char type); - inline unsigned char CheckXmlCode(unsigned int c); - inline unsigned char CheckXmlCodeHHHH(unsigned int c, const wchar_t* pData); + inline void WriteEncodeXmlString_4bytes(const wchar_t* pString, int nCount); + inline void WriteEncodeXmlString_2bytes(const wchar_t* pString, int nCount); + inline void WriteEncodeXmlStringHHHH_4bytes(const wchar_t* pString, int nCount); + inline void WriteEncodeXmlStringHHHH_2bytes(const wchar_t* pString, int nCount); + inline void WriteEncodeXmlChar(wchar_t code, unsigned char type); + inline unsigned char CheckXmlCode(unsigned int c); + inline unsigned char CheckXmlCodeHHHH(unsigned int c, const wchar_t* pData); }; - KERNEL_DECL void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo); - KERNEL_DECL void string_replaceA(std::string& text, const std::string& replaceFrom, const std::string& replaceTo); + KERNEL_DECL void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo); + KERNEL_DECL void string_replaceA(std::string& text, const std::string& replaceFrom, const std::string& replaceTo); } diff --git a/HtmlRenderer/test/main.cpp b/HtmlRenderer/test/main.cpp index ad4bb3f7ca..ddb05e5a2c 100644 --- a/HtmlRenderer/test/main.cpp +++ b/HtmlRenderer/test/main.cpp @@ -48,6 +48,7 @@ #include "../../Common/Network/FileTransporter/include/FileTransporter.h" + void Download_OnComplete(int error) { int y = error; @@ -62,12 +63,69 @@ void Download_OnComplete(int error) //#define TO_PDF //#define TO_HTML_RENDERER //#define ONLY_TEXT -//#define DOWNLOADER_TEST +#define DOWNLOADER_TEST + +#include "Windows.h" +#include +#undef CreateDirectory + +bool DownloadFilePS(const std::wstring& sFileURL, const std::wstring& strFileOutput) +{ + STARTUPINFO sturtupinfo; + ZeroMemory(&sturtupinfo,sizeof(STARTUPINFO)); + sturtupinfo.cb = sizeof(STARTUPINFO); + + std::wstring sFileDst = strFileOutput; + size_t posn = 0; + while (std::wstring::npos != (posn = sFileDst.find('\\', posn))) + { + sFileDst.replace(posn, 1, L"/"); + posn += 1; + } + + std::wstring sApp = L"powershell.exe –c \"(new-object System.Net.WebClient).DownloadFile('" + sFileURL + L"','" + sFileDst + L"')\""; + + wchar_t* pCommandLine = new wchar_t[sApp.length() + 1]; + memcpy(pCommandLine, sApp.c_str(), sApp.length() * sizeof(wchar_t)); + pCommandLine[sApp.length()] = (wchar_t)'\0'; + + HANDLE ghJob = CreateJobObject(NULL, NULL); + + if (ghJob) + { + JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 }; + + // Configure all child processes associated with the job to terminate when the + jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + if ( 0 == SetInformationJobObject( ghJob, JobObjectExtendedLimitInformation, &jeli, sizeof(jeli))) + { + CloseHandle(ghJob); + ghJob = NULL; + } + } + + PROCESS_INFORMATION processinfo; + ZeroMemory(&processinfo,sizeof(PROCESS_INFORMATION)); + BOOL bResult = CreateProcessW(NULL, pCommandLine, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &sturtupinfo, &processinfo); + + if (bResult && ghJob) + { + AssignProcessToJobObject(ghJob, processinfo.hProcess); + } + + ::WaitForSingleObject(processinfo.hProcess, INFINITE); + + RELEASEARRAYOBJECTS(pCommandLine); + + return NSFile::CFileBinary::Exists(sFileDst); +} int main(int argc, char *argv[]) { + DownloadFilePS(L"https://natworld.info/wp-content/uploads/2018/02/vodosvinka-ili-kapibara.jpg", L"D:/222.jpg"); + #ifdef DOWNLOADER_TEST - CFileDownloader oDownloader(L"https://download.onlyoffice.com/assets/fb/fb_icon_325x325.jpg", false); + NSNetwork::NSFileTransport::CFileDownloader oDownloader(L"https://natworld.info/wp-content/uploads/2018/02/vodosvinka-ili-kapibara.jpg", false); oDownloader.SetFilePath(L"D:\\111.jpg"); oDownloader.SetEvent_OnComplete(Download_OnComplete); oDownloader.DownloadSync(); diff --git a/OfficeCryptReader/source/CryptTransform.cpp b/OfficeCryptReader/source/CryptTransform.cpp index 7cdc18d9b4..bfc2334b83 100644 --- a/OfficeCryptReader/source/CryptTransform.cpp +++ b/OfficeCryptReader/source/CryptTransform.cpp @@ -52,8 +52,7 @@ #include "../../Common/3dParty/cryptopp/zdeflate.h" #include "../../Common/DocxFormat/Source/Base/unicode_util.h" -#include "../../Common/DocxFormat/Source/Base/Base.h" -#include "../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../Common/DocxFormat/Source/Base/Unit.h" #include "../../DesktopEditor/common/File.h" static const unsigned char encrVerifierHashInputBlockKey[8] = { 0xfe, 0xa7, 0xd2, 0x76, 0x3b, 0x4b, 0x9e, 0x79 }; @@ -900,7 +899,7 @@ bool ECMAWriteProtect::VerifyWrike() wPasswordHash ^= (0x8000 | ('N' << 8) | 'K'); wPasswordHash ^= p.length(); - std::string sPasswordHash = XmlUtils::IntToString(wPasswordHash, "%4.4X"); + std::string sPasswordHash = XmlUtils::ToString(wPasswordHash, "%4.4X"); return data.hashValue == sPasswordHash; } diff --git a/X2tConverter/src/cextracttools.h b/X2tConverter/src/cextracttools.h index 6fcd6e2ec7..18ebf70863 100644 --- a/X2tConverter/src/cextracttools.h +++ b/X2tConverter/src/cextracttools.h @@ -35,7 +35,7 @@ #include "../../Common/OfficeFileErrorDescription.h" #include "../../Common/OfficeFileFormatChecker.h" #include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h" -#include "../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../Common/DocxFormat/Source/Base/Unit.h" #include "../../DesktopEditor/common/Directory.h" #include "../../DesktopEditor/xml/include/xmlutils.h" diff --git a/XlsxSerializerCom/Common/Common.h b/XlsxSerializerCom/Common/Common.h index 05e96e4031..7c1f0cb786 100644 --- a/XlsxSerializerCom/Common/Common.h +++ b/XlsxSerializerCom/Common/Common.h @@ -33,6 +33,7 @@ #include "../../Common/DocxFormat/Source/Base/Unit.h" #include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h" +#include "../../DesktopEditor/common/File.h" #include #include diff --git a/XlsxSerializerCom/Reader/BinaryWriter.cpp b/XlsxSerializerCom/Reader/BinaryWriter.cpp index 8d42de39df..3a2693a775 100644 --- a/XlsxSerializerCom/Reader/BinaryWriter.cpp +++ b/XlsxSerializerCom/Reader/BinaryWriter.cpp @@ -2758,7 +2758,7 @@ void BinaryWorkbookTableWriter::WriteConnectionWebPr(const OOX::Spreadsheet::CWe nullable_bool m_oTextDates; nullable_bool m_oXl2000; nullable_bool m_oHtmlTables; - nullable> m_oHtmlFormat; + nullable m_oHtmlFormat; } void BinaryWorkbookTableWriter::WriteExternalReferences(const OOX::Spreadsheet::CExternalReferences& externalReferences, OOX::Spreadsheet::CWorkbook& workbook) { @@ -4697,7 +4697,7 @@ void BinaryWorksheetTableWriter::WriteOleObjects(const OOX::Spreadsheet::CWorksh pShapeElem = pFind->second.pElement; } } - SimpleTypes::Spreadsheet::CCellAnchorType<> eAnchorType; + SimpleTypes::Spreadsheet::CCellAnchorType eAnchorType; eAnchorType.SetValue(SimpleTypes::Spreadsheet::cellanchorTwoCell); bool bSetAnchor = false; if (pOleObject->m_oObjectPr.IsInit() && pOleObject->m_oObjectPr->m_oAnchor.IsInit() && pOleObject->m_oObjectPr->m_oRid.IsInit()) @@ -4893,7 +4893,7 @@ void BinaryWorksheetTableWriter::WriteControls(const OOX::Spreadsheet::CWorkshee pShape = dynamic_cast(pFind->second.pElement); } } - SimpleTypes::Spreadsheet::CCellAnchorType<> eAnchorType; + SimpleTypes::Spreadsheet::CCellAnchorType eAnchorType; eAnchorType.SetValue(SimpleTypes::Spreadsheet::cellanchorTwoCell); if (pControl->m_oControlPr.IsInit() && pControl->m_oControlPr->m_oAnchor.IsInit()) @@ -5292,7 +5292,7 @@ void BinaryWorksheetTableWriter::WriteDrawings(const OOX::Spreadsheet::CWorkshee //преобразуем ClientData в CellAnchor OOX::Vml::CClientData* pClientData = static_cast(pElemShape); - SimpleTypes::Spreadsheet::CCellAnchorType<> eAnchorType; + SimpleTypes::Spreadsheet::CCellAnchorType eAnchorType; eAnchorType.SetValue(SimpleTypes::Spreadsheet::cellanchorTwoCell); OOX::Spreadsheet::CCellAnchor *pCellAnchor = new OOX::Spreadsheet::CCellAnchor(eAnchorType); diff --git a/XlsxSerializerCom/Writer/BinaryReader.cpp b/XlsxSerializerCom/Writer/BinaryReader.cpp index b13f23955b..0272335be1 100644 --- a/XlsxSerializerCom/Writer/BinaryReader.cpp +++ b/XlsxSerializerCom/Writer/BinaryReader.cpp @@ -5237,7 +5237,7 @@ int BinaryWorksheetsTableReader::ReadDrawings(BYTE type, long length, void* poRe if(c_oSerWorksheetsTypes::Drawing == type) { - OOX::Spreadsheet::CCellAnchor* pCellAnchor = new OOX::Spreadsheet::CCellAnchor(SimpleTypes::Spreadsheet::CCellAnchorType<>()); + OOX::Spreadsheet::CCellAnchor* pCellAnchor = new OOX::Spreadsheet::CCellAnchor(SimpleTypes::Spreadsheet::CCellAnchorType()); READ1_DEF(length, res, this->ReadDrawing, pCellAnchor); pCellAnchor->m_bShapeOle = false; @@ -5980,7 +5980,7 @@ int BinaryWorksheetsTableReader::ReadControl(BYTE type, long length, void* poRes if (c_oSerControlTypes::ControlAnchor == type) { - OOX::Spreadsheet::CCellAnchor *pCellAnchor = new OOX::Spreadsheet::CCellAnchor(SimpleTypes::Spreadsheet::CCellAnchorType<>()); + OOX::Spreadsheet::CCellAnchor *pCellAnchor = new OOX::Spreadsheet::CCellAnchor(SimpleTypes::Spreadsheet::CCellAnchorType()); READ1_DEF(length, res, this->ReadCellAnchor, pCellAnchor); pControl->m_oControlPr->m_oAnchor.Init();