diff --git a/ASCOfficeDocFile/Common/FormatUtils.h b/ASCOfficeDocFile/Common/FormatUtils.h index 2151e890ac..5d4f3da2e7 100644 --- a/ASCOfficeDocFile/Common/FormatUtils.h +++ b/ASCOfficeDocFile/Common/FormatUtils.h @@ -52,10 +52,9 @@ #include #endif -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include "../../DesktopEditor/common/Types.h" #include "../../Common/DocxFormat/Source/Base/unicode_util.h" -#include "../../Common/DocxFormat/Source/Base/Types_32.h" #include "../../UnicodeConverter/UnicodeConverter.h" #include 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/ASCOfficeDocFile/DocDocxConverter/Converter.h b/ASCOfficeDocFile/DocDocxConverter/Converter.h index d0400b18a0..22921f912b 100644 --- a/ASCOfficeDocFile/DocDocxConverter/Converter.h +++ b/ASCOfficeDocFile/DocDocxConverter/Converter.h @@ -32,7 +32,7 @@ #pragma once #include -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" namespace DocFileFormat { diff --git a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h index 093b2c7314..9678f71b87 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h +++ b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h @@ -33,7 +33,7 @@ #include "Record.h" #include "../../../OfficeUtils/src/OfficeUtils.h" -#include "../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../Common/DocxFormat/Source/Base/Base.h" namespace DocFileFormat diff --git a/ASCOfficeDocFile/DocDocxConverter/RGBColor.h b/ASCOfficeDocFile/DocDocxConverter/RGBColor.h index d2a47db98a..9d93d91b81 100644 --- a/ASCOfficeDocFile/DocDocxConverter/RGBColor.h +++ b/ASCOfficeDocFile/DocDocxConverter/RGBColor.h @@ -31,7 +31,7 @@ */ #pragma once -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include namespace DocFileFormat diff --git a/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h b/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h index 4c4a0ded0e..45510aec49 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h +++ b/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h @@ -34,7 +34,7 @@ #include "IBinaryReader.h" #include "../Common/FormatUtils.h" #include "../../Common/3dParty/pole/pole.h" -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" class VirtualStreamReader : public IBinaryReader { 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/BinReader/fontTableWriter.h b/ASCOfficeDocxFile2/BinReader/fontTableWriter.h index 99156c1bee..13249f4086 100644 --- a/ASCOfficeDocxFile2/BinReader/fontTableWriter.h +++ b/ASCOfficeDocxFile2/BinReader/fontTableWriter.h @@ -122,7 +122,7 @@ namespace Writers BYTE cElem = pFontInfo->m_aPanose[i]; if(0 != cElem) bUsePanose = true; - sPanose += XmlUtils::IntToString(cElem, L"%02X"); + sPanose += XmlUtils::ToString(cElem, L"%02X"); } } 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/ASCOfficeDocxFile2/BinWriter/BinWriters.h b/ASCOfficeDocxFile2/BinWriter/BinWriters.h index a45936eb64..af6bc4c30d 100644 --- a/ASCOfficeDocxFile2/BinWriter/BinWriters.h +++ b/ASCOfficeDocxFile2/BinWriter/BinWriters.h @@ -136,9 +136,9 @@ namespace BinDocxRW void WriteTblBorders(const OOX::Logic::CTblBorders& Borders); void WriteTcBorders(const OOX::Logic::CTcBorders& Borders); void WritePBorders(const OOX::Logic::CPBdr& Borders); - void WriteColor(BYTE type, const SimpleTypes::CHexColor<>& color); - void WriteThemeColor(BYTE type, const nullable>& oHexColor, const nullable>& oThemeColor, - const nullable>& oThemeTint, const nullable>& oThemeShade); + void WriteColor(BYTE type, const SimpleTypes::CHexColor& color); + void WriteThemeColor(BYTE type, const nullable& oHexColor, const nullable& oThemeColor, + const nullable& oThemeTint, const nullable& oThemeShade); void WriteShd(const ComplexTypes::Word::CShading& Shd); void WritePaddings(const nullable& left, const nullable& top, const nullable& right, const nullable& bottom); @@ -348,7 +348,7 @@ namespace BinDocxRW void WriteMoveTo(const OOX::Logic::CMoveTo& oMoveTo); template void WriteMoveRangeStart(const T& elem); template void WriteMoveRangeEnd(const T& elem); - void WriteComment(OOX::EElementType eType, nullable>& oId); + void WriteComment(OOX::EElementType eType, nullable& oId); void WriteFldChar(OOX::Logic::CFldChar* pFldChar); void WriteFldSimple(OOX::Logic::CFldSimple* pFldSimple); void WriteFldSimpleContent(OOX::Logic::CFldSimple* pFldSimple); @@ -461,7 +461,7 @@ namespace BinDocxRW void WriteMathZeroWid(const OOX::Logic::CZeroWid &pZeroWid); void WritePreparedRun(OOX::Logic::CRun *pRun, bool bHyperlink, std::vector::iterator &start, std::vector::iterator &end); void WriteRunContent(std::vector::iterator &start, std::vector::iterator &end, bool bHyperlink = false); - void WriteNoteRef(const nullable>& oCustomMarkFollows, const nullable>& oId); + void WriteNoteRef(const nullable& oCustomMarkFollows, const nullable& oId); void WriteText(const std::wstring& text, BYTE type); bool WriteDrawingPptx(OOX::WritingElement* item); void WriteDrawing(std::wstring* pXml, OOX::Logic::CDrawing* pDrawing, PPTX::Logic::GraphicFrame *pGraphic); @@ -524,7 +524,7 @@ namespace BinDocxRW nullable bDone; nullable sUserId; nullable sProviderId; - nullable > nDurableId; + nullable nDurableId; nullable sDateUtc; nullable sUserData; std::vector aReplies; diff --git a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h index 279735bf0f..611527b167 100644 --- a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h +++ b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h @@ -32,7 +32,7 @@ #pragma once #include -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include "../../Common/DocxFormat/Source/Base/SmartPtr.h" namespace OOX 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/ConvertOO2OOX.h b/ASCOfficeOdfFile/src/ConvertOO2OOX.h index 284b054e08..d121db56da 100644 --- a/ASCOfficeOdfFile/src/ConvertOO2OOX.h +++ b/ASCOfficeOdfFile/src/ConvertOO2OOX.h @@ -31,7 +31,7 @@ */ #include "../../DesktopEditor/common/Types.h" -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include struct ProgressCallback; 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_chart_axis.h b/ASCOfficeOdfFile/src/docx/oox_chart_axis.h index fd1e845968..ad926e4bc9 100644 --- a/ASCOfficeOdfFile/src/docx/oox_chart_axis.h +++ b/ASCOfficeOdfFile/src/docx/oox_chart_axis.h @@ -37,7 +37,7 @@ #include "oox_chart_shape.h" -#include "../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../Common/DocxFormat/Source/Base/Base.h" namespace cpdoccore { namespace oox { diff --git a/ASCOfficeOdfFile/src/docx/oox_drawing.h b/ASCOfficeOdfFile/src/docx/oox_drawing.h index 9923a074f5..5334785442 100644 --- a/ASCOfficeOdfFile/src/docx/oox_drawing.h +++ b/ASCOfficeOdfFile/src/docx/oox_drawing.h @@ -39,7 +39,7 @@ #include "../odf/svg_parser.h" -#include "../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../Common/DocxFormat/Source/Base/Base.h" namespace cpdoccore { namespace oox { 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 25eeff4bcc..bd2f91f20f 100644 --- a/ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp +++ b/ASCOfficeOdfFile/src/docx/xlsx_pivots_context.cpp @@ -37,8 +37,8 @@ #include #include "../../include/xml/simple_xml_writer.h" -#include"../../../Common/DocxFormat/Source/XML/Utils.h" -#include"../../../Common/DocxFormat/Source/Base/Types_32.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/datatypes/length.cpp b/ASCOfficeOdfFile/src/odf/datatypes/length.cpp index 21046893a0..c485022e26 100644 --- a/ASCOfficeOdfFile/src/odf/datatypes/length.cpp +++ b/ASCOfficeOdfFile/src/odf/datatypes/length.cpp @@ -31,7 +31,7 @@ */ #include "length.h" -#include "../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../Common/DocxFormat/Source/Base/Base.h" #include #include 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 207c6425fd..90e802822c 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDrawing.cpp @@ -289,7 +289,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(); } @@ -740,7 +740,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(); } @@ -769,7 +769,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(); } @@ -1409,7 +1409,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) { @@ -2577,7 +2577,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 18baf96f3b..1d33b1761c 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp @@ -1751,7 +1751,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) { @@ -1995,7 +1995,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b convert(docx_flat_document->m_pBgPict.GetPointer(), 1); } //nullable m_oTextDirection; - //nullable > m_oRtlGutter; + //nullable m_oRtlGutter; //nullable m_oVAlign; if (oox_section_pr->m_oPgNumType.IsInit()) @@ -2131,13 +2131,13 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b //------------------------------------------------------------------------------------------------------------------------------------------ // то что относится собственно к секциям-разделам - //nullable > m_oBidi; + //nullable m_oBidi; //nullable m_oDocGrid; //nullable m_oEndnotePr; //nullable m_oFootnotePr; - //nullable > m_oFormProt; + //nullable m_oFormProt; - //nullable > m_oNoEndnote; + //nullable m_oNoEndnote; //nullable m_oPaperSrc; //nullable m_oPrinterSettings; @@ -2883,7 +2883,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) { @@ -2924,7 +2924,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; @@ -3329,10 +3329,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; @@ -3352,7 +3352,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)) { @@ -3407,7 +3407,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); } } @@ -3738,7 +3738,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl *oox_num_lvl, OOX::Numbering::C //nullable > m_oTentative; //nullable > m_oTplc; - //nullable> m_oIsLgl; + //nullable m_oIsLgl; //nullable m_oLegacy; double size_bullet_number_marker = 0; @@ -4118,7 +4118,7 @@ void DocxConverter::convert(OOX::CStyle *oox_style) if (oox_style->m_oBasedOn.IsInit() && oox_style->m_oBasedOn->m_sVal.IsInit()) odt_context->styles_context()->last_state()->set_parent_style_name(*oox_style->m_oBasedOn->m_sVal); - //nullable> m_oQFormat; + //nullable m_oQFormat; //nullable m_oAliases; //------------------------------------------------------------------------------------------------------------------------- if (style_name == L"Hyperlink") @@ -4850,7 +4850,7 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer default: break; } } - //nullable > m_oBidiVisual; + //nullable m_oBidiVisual; //nullable m_oShade; //nullable m_oTblCaption; //nullable m_oTblCellMar; @@ -4968,13 +4968,13 @@ void DocxConverter::convert(OOX::Logic::CTableRowProperties *oox_table_row_pr) convert(oox_table_row_pr, table_row_properties); - //nullable > m_oCantSplit; + //nullable m_oCantSplit; //nullable m_oCnfStyle; //nullable m_oDel; //nullable m_oDivId; //nullable m_oGridAfter; //nullable m_oGridBefore; - //nullable > m_oHidden; + //nullable m_oHidden; //nullable m_oIns; //nullable m_oJc; //nullable m_oTblCellSpacing; @@ -5075,7 +5075,7 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, //nullable m_oHeaders; - //nullable > m_oHideMark; + //nullable m_oHideMark; return true; } bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, int col) diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.h b/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.h index 872af588dc..c39631d590 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.h +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.h @@ -229,7 +229,7 @@ namespace Oox2Odf void convert(OOX::Drawing::CAnchor *oox_anchor); void convert(OOX::Drawing::CInline *oox_inline); - void convert(SimpleTypes::CTheme<> *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name); + void convert(SimpleTypes::CTheme *oox_font_theme,_CP_OPT(std::wstring) & odf_font_name); void convert(ComplexTypes::Word::CShading *shading, _CP_OPT(odf_types::color) & odf_color); void convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types::color) & odf_color); void convert(SimpleTypes::CUniversalMeasure *oox_size, _CP_OPT(odf_types::length) & odf_size); @@ -244,9 +244,9 @@ namespace Oox2Odf void convert(OOX::Logic::CTblBorders *oox_border, odf_writer::style_table_cell_properties *table_cell_properties); //void convert(OOX::Logic::CTblBorders *oox_border, odf_writer::style_table_properties *table_properties); - void convert(SimpleTypes::CHexColor<> *color, SimpleTypes::CThemeColor<> *theme_color, - SimpleTypes::CUcharHexNumber<>* theme_tint, - SimpleTypes::CUcharHexNumber<>* theme_shade, _CP_OPT(odf_types::color) & odf_color); + void convert(SimpleTypes::CHexColor *color, SimpleTypes::CThemeColor *theme_color, + SimpleTypes::CUcharHexNumber* theme_tint, + SimpleTypes::CUcharHexNumber* theme_shade, _CP_OPT(odf_types::color) & odf_color); void convert(OOX::CDocDefaults *def_style, OOX::CStyles *styles); void convert(OOX::CStyle *style); void convert_table_style(OOX::CStyle *oox_style); 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..837379d7b2 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp @@ -1307,7 +1307,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CCell *oox_cell) { if (value_type == SimpleTypes::Spreadsheet::celltypeSharedString) { - convert_sharing_string(_wtoi(oox_cell->m_oValue->m_sText.c_str())); + convert_sharing_string(XmlUtils::GetInteger(oox_cell->m_oValue->m_sText)); } else @@ -1535,10 +1535,10 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr) } //nullable m_oCharset; - //nullable > m_oCondense; - //nullable > m_oExtend; - //nullable > m_oOutline; - //nullable > m_oShadow; + //nullable m_oCondense; + //nullable m_oExtend; + //nullable m_oOutline; + //nullable m_oShadow; } void XlsxConverter::convert(OOX::Spreadsheet::CText *oox_text) @@ -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 93a9ca3651..302273af39 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp @@ -59,6 +59,8 @@ #include #include +#include "../../../Common/DocxFormat/Source/SystemUtility/File.h" + typedef boost::uuids::detail::md5 MD5; namespace PPT_FORMAT @@ -716,7 +718,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; @@ -1285,29 +1287,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/Records/Drawing/ShapeContainer.cpp b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp index 9cffaa5039..ef7210b45c 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.cpp @@ -36,7 +36,8 @@ #include "../../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/ElementSettings.h" #include "../../../../DesktopEditor/raster/BgraFrame.h" -#include "../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../DesktopEditor/common/Directory.h" +#include "../../../../Common/DocxFormat/Source/Base/Base.h" #include "../../../../OfficeUtils/src/OfficeUtils.h" #include diff --git a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h index a49f5cbdac..7f3443777f 100755 --- a/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h +++ b/ASCOfficePPTFile/PPTFormatLib/Records/Drawing/ShapeContainer.h @@ -53,7 +53,7 @@ #include "../../../../ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/ElementSettings.h" #include "../../../../DesktopEditor/raster/BgraFrame.h" -#include "../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../Common/DocxFormat/Source/Base/Base.h" #define FIXED_POINT_unsigned(val) (double)((WORD)(val >> 16) + ((WORD)(val) / 65536.0)) diff --git a/ASCOfficePPTFile/PPTFormatLib/Structures/IStruct.h b/ASCOfficePPTFile/PPTFormatLib/Structures/IStruct.h index 8f74f97fc0..94226f9c51 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Structures/IStruct.h +++ b/ASCOfficePPTFile/PPTFormatLib/Structures/IStruct.h @@ -31,7 +31,7 @@ */ #pragma once -#include "../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../Common/DocxFormat/Source/Base/Base.h" #include "../../../DesktopEditor/common/File.h" namespace PPT_FORMAT { diff --git a/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp b/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp index 089dee5a10..ba5cafef63 100644 --- a/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp +++ b/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp @@ -110,7 +110,7 @@ static void GetColorWithEffect(const std::wstring& sColor, const int& R, const i return; std::wstring s = sColor.substr(pos1 + 1, pos2 - pos1 - 1); - param = _wtoi(s.c_str()); + param = XmlUtils::GetInteger(s); bool isEffect = false; if (0 == sColor.find(L"darken")) @@ -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""; @@ -2967,7 +2967,7 @@ void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUt if (sFocus.is_init()) { - nFocus = _wtoi(sFocus->c_str()) / 100.0; + nFocus = XmlUtils::GetInteger(*sFocus) / 100.0; } if (sOpacity.is_init()) @@ -3077,7 +3077,7 @@ void CDrawingConverter::ConvertWordArtShape(PPTX::Logic::SpTreeElem* elem, XmlUt } if (sAngle.is_init()) { - nAngle = _wtoi(sAngle->c_str()); + nAngle = XmlUtils::GetInteger(*sAngle); nAngle = (-1) * nAngle + 90; } if (sColors.is_init()) @@ -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()); @@ -5723,7 +5723,7 @@ void CDrawingConverter::ConvertTextVML(XmlUtils::CXmlNode &nodeTextBox, PPTX::Lo } else if (attNames[r] == L"size") { - run->rPr->sz = _wtoi(attValues[r].c_str()) * 5; + run->rPr->sz = XmlUtils::GetInteger(attValues[r]) * 5; } else if (attNames[r] == L"face") { 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 82f7654735..6d1b681e8a 100644 --- a/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h +++ b/ASCOfficePPTXFile/Editor/BinaryFileReaderWriter.h @@ -37,7 +37,7 @@ #include "../../DesktopEditor/common/Types.h" #include "../../DesktopEditor/common/File.h" -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include #include @@ -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/PPTShape/PptShape.h b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/PptShape.h index 2d6da61a53..a89d7bde32 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/PptShape.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/PptShape.h @@ -500,8 +500,7 @@ protected: if (!NSStringUtils::IsNumber(str)) return false; - lValue = 0; - lValue = _ttoi(str.c_str()); + lValue = XmlUtils::GetInteger(str); if (bFormula) { 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/WMFToImageConverter.h b/ASCOfficePPTXFile/Editor/WMFToImageConverter.h index 3da5f40446..c796b8bae0 100644 --- a/ASCOfficePPTXFile/Editor/WMFToImageConverter.h +++ b/ASCOfficePPTXFile/Editor/WMFToImageConverter.h @@ -45,7 +45,7 @@ namespace NSWMFToImageConverter public: LONG GetImageType(std::wstring strFile) { - CFile oFile; + NSFile::CFileBinary oFile; if (S_OK != oFile.OpenFile(strFile)) { oFile.CloseFile(); diff --git a/ASCOfficePPTXFile/Editor/XmlWriter.h b/ASCOfficePPTXFile/Editor/XmlWriter.h index 0e7db36d08..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; @@ -358,7 +164,7 @@ namespace NSBinPptxRW } AVSINLINE void WriteDWORD_hex(const DWORD& val) { - m_oWriter.WriteString(XmlUtils::IntToString(val, L"%x")); + m_oWriter.WriteString(XmlUtils::ToString(val, L"%x")); } AVSINLINE void WriteBool(const bool& val) { @@ -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) @@ -606,17 +412,15 @@ namespace NSBinPptxRW std::wstring strData = m_oWriter.GetData(); if (!bEncodingToUTF8) { - CFile oFile; - oFile.CreateFile(strFilePath); - oFile.WriteFile((void*)strData.c_str(), (DWORD)strData.length()); + NSFile::CFileBinary oFile; + oFile.CreateFileW(strFilePath); + oFile.WriteFile((BYTE*)strData.c_str(), (DWORD)(strData.length() * sizeof(wchar_t))); oFile.CloseFile(); } else { - CDirectory::SaveToFile(strFilePath, strData); - - CFile oFile; - oFile.CreateFile(strFilePath); + NSFile::CFileBinary oFile; + oFile.CreateFileW(strFilePath); std::wstring strHead = _T(""); oFile.WriteStringUTF8(strHead); oFile.WriteStringUTF8(strData); 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/Editor/imagemanager.h b/ASCOfficePPTXFile/Editor/imagemanager.h index 9a03354f8e..55e23e9ba3 100644 --- a/ASCOfficePPTXFile/Editor/imagemanager.h +++ b/ASCOfficePPTXFile/Editor/imagemanager.h @@ -49,7 +49,7 @@ namespace NSShapeImageGen { static bool _CopyFile(std::wstring strExists, std::wstring strNew, LPVOID lpFunc, LPVOID lpData) { - return CDirectory::CopyFile (strExists, strNew); + return NSFile::CFileBinary::Copy(strExists, strNew); } enum MediaType diff --git a/ASCOfficePPTXFile/PPTXFormat/Comments.h b/ASCOfficePPTXFile/PPTXFormat/Comments.h index 03c83902fe..5136e3363c 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Comments.h +++ b/ASCOfficePPTXFile/PPTXFormat/Comments.h @@ -35,7 +35,7 @@ #include "WrapperFile.h" #include "FileContainer.h" -#include "../../Common/DocxFormat/Source/XML/Utils.h" +#include "../../Common/DocxFormat/Source/Base/Unit.h" namespace PPTX { diff --git a/ASCOfficePPTXFile/PPTXFormat/FileTypes.cpp b/ASCOfficePPTXFile/PPTXFormat/FileTypes.cpp new file mode 100644 index 0000000000..6a28e27476 --- /dev/null +++ b/ASCOfficePPTXFile/PPTXFormat/FileTypes.cpp @@ -0,0 +1,93 @@ +/* + * (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 "FileTypes.h" + +namespace OOX +{ +namespace Presentation +{ + namespace FileTypes + { + const FileType Presentation (L"ppt", L"presentation.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + + const FileType PresentationMacro(L"ppt", L"presentation.xml", + L"application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + + const FileType Slide (L"slides", L"slide.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.slide+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"); + + const FileType SlideLayout (L"slideLayouts", L"slideLayout.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"); + + const FileType SlideComments (L"comments", L"comment.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.comment+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"); + + const FileType CommentAuthors (L"", L"commentAuthors.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.commentAuthors.main+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"); + + const FileType SlideMaster (L"slideMasters", L"slideMaster.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"); + + const FileType NotesSlide (L"notesSlides", L"notesSlide.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"); + + const FileType NotesMaster (L"notesMasters", L"notesMaster.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"); + + const FileType HandoutMaster (L"handoutMasters", L"handoutMaster.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster"); + + const FileType PresProps (L"", L"presProps.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"); + + const FileType TableStyles (L"", L"tableStyles.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles"); + + const FileType ViewProps (L"", L"viewProps.xml", + L"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps"); + } // namespace FileTypes + } //Presentation +} // namespace OOX diff --git a/ASCOfficePPTXFile/PPTXFormat/FileTypes.h b/ASCOfficePPTXFile/PPTXFormat/FileTypes.h index 84b885413a..b90732b78c 100644 --- a/ASCOfficePPTXFile/PPTXFormat/FileTypes.h +++ b/ASCOfficePPTXFile/PPTXFormat/FileTypes.h @@ -39,57 +39,31 @@ namespace Presentation { namespace FileTypes { - const FileType Presentation (L"ppt", L"presentation.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + extern const FileType Presentation; - const FileType PresentationMacro(L"ppt", L"presentation.xml", - L"application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + extern const FileType PresentationMacro; - const FileType Slide (L"slides", L"slide.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.slide+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"); + extern const FileType Slide; - const FileType SlideLayout (L"slideLayouts", L"slideLayout.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"); + extern const FileType SlideLayout; - const FileType SlideComments (L"comments", L"comment.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.comment+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"); + extern const FileType SlideComments; - const FileType CommentAuthors (L"", L"commentAuthors.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.commentAuthors.main+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"); + extern const FileType CommentAuthors; - const FileType SlideMaster (L"slideMasters", L"slideMaster.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"); + extern const FileType SlideMaster; - const FileType NotesSlide (L"notesSlides", L"notesSlide.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"); + extern const FileType NotesSlide; - const FileType NotesMaster (L"notesMasters", L"notesMaster.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"); + extern const FileType NotesMaster; - const FileType HandoutMaster (L"handoutMasters", L"handoutMaster.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster"); + extern const FileType HandoutMaster; - const FileType PresProps (L"", L"presProps.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"); + extern const FileType PresProps; - const FileType TableStyles (L"", L"tableStyles.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles"); + extern const FileType TableStyles; - const FileType ViewProps (L"", L"viewProps.xml", - L"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps"); + extern const FileType ViewProps; } // namespace FileTypes } //Presentation } // namespace OOX diff --git a/ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h b/ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h index b63db04152..94a4cb88bb 100644 --- a/ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h +++ b/ASCOfficePPTXFile/PPTXFormat/LegacyDiagramText.h @@ -32,7 +32,7 @@ #pragma once #include "../../Common/DocxFormat/Source/DocxFormat/File.h" -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include "Logic/TextParagraphPr.h" #include "Logic/Colors/SrgbClr.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/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/PPTXFormatLib.pro b/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/PPTXFormatLib.pro index f0a863ac3a..c56448f6a0 100644 --- a/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/PPTXFormatLib.pro +++ b/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/PPTXFormatLib.pro @@ -81,6 +81,7 @@ SOURCES += \ ../../../PPTXFormat/Logic/Controls.cpp \ ../../../PPTXFormat/Presentation.cpp \ ../../../PPTXFormat/FileContainer.cpp \ + ../../../PPTXFormat/FileTypes.cpp \ ../../../PPTXFormat/FileFactory.cpp \ ../../../PPTXFormat/FileMap.cpp \ ../../../PPTXFormat/Folder.cpp diff --git a/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/pptxformatlib_logic.cpp b/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/pptxformatlib_logic.cpp index a4e6edea16..5144dd6bac 100644 --- a/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/pptxformatlib_logic.cpp +++ b/ASCOfficePPTXFile/PPTXLib/Linux/PPTXFormatLib/pptxformatlib_logic.cpp @@ -65,6 +65,7 @@ #include "../../../PPTXFormat/Logic/Runs/MathParaWrapper.cpp" #include "../../../PPTXFormat/Logic/Controls.cpp" #include "../../../PPTXFormat/FileContainer.cpp" +#include "../../../PPTXFormat/FileTypes.cpp" #include "../../../PPTXFormat/FileFactory.cpp" #include "../../../PPTXFormat/FileMap.cpp" #include "../../../PPTXFormat/Folder.cpp" diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.h b/ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.h index c2c205f717..d4c0bdcbbc 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/ConvertationManager.h @@ -32,7 +32,7 @@ #pragma once #include -#include "../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../Common/DocxFormat/Source/Base/Base.h" class OOXWriter; class OOXReader; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp index 383caf054b..11e6ebeb84 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) { @@ -2084,12 +2085,12 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt int x = 0, y = 0; try { - x = _wtoi(splitted[i].substr(0, pos).c_str()); + x = XmlUtils::GetInteger(splitted[i].substr(0, pos)); } catch(...){} try { - y = _wtoi(splitted[i].substr(pos + 1, splitted[i].length() - 1).c_str()); + y = XmlUtils::GetInteger(splitted[i].substr(pos + 1, splitted[i].length() - 1)); } catch(...){} @@ -2112,12 +2113,12 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt int x = 0, y = 0; try { - x = _wtoi(splitted[i].substr(0, pos).c_str()); + x = XmlUtils::GetInteger(splitted[i].substr(0, pos)); } catch(...){} try { - y = _wtoi(splitted[i].substr(pos + 1, splitted[i].length() - 1).c_str()); + y = XmlUtils::GetInteger(splitted[i].substr(pos + 1, splitted[i].length() - 1)); } catch(...){} @@ -2135,7 +2136,7 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt int val = 0; try { - val = _wtoi(splitted[i].c_str()); + val = XmlUtils::GetInteger(splitted[i]); }catch(...){} m_oShape.m_aPSegmentInfo.push_back( val ); @@ -2220,12 +2221,12 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt int col = 0, pos_col = 0; try { - col = _wtoi(splitted[i].substr(0, pos).c_str()); + col = XmlUtils::GetInteger(splitted[i].substr(0, pos)); } catch(...){} try { - pos_col = _wtoi(splitted[i].substr(pos + 1, splitted[i].length() - 1).c_str()) * 100 / 65536; + pos_col = XmlUtils::GetInteger(splitted[i].substr(pos + 1, splitted[i].length() - 1)) * 100 / 65536; } catch(...){} 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 e8a9ea7702..bdae6bec19 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp @@ -1160,7 +1160,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); @@ -1664,7 +1664,7 @@ bool OOXShapeReader::ParseVml(ReaderParameter oParam, RtfShapePtr& pOutput, bool int pos = (int)shape->m_sType->find(L"#_x0000_t"); if (pos >= 0) { - pOutput->m_nShapeType = _wtoi(shape->m_sType->substr(pos + 9, shape->m_sType->length() - pos - 9).c_str()); + pOutput->m_nShapeType = XmlUtils::GetInteger(shape->m_sType->substr(pos + 9, shape->m_sType->length() - pos - 9)); } } } @@ -2049,7 +2049,7 @@ void OOXShapeReader::ParseAdjustment (RtfShape& oShape, std::wstring sAdjustment { try { - oShape.m_nAdjustValue[i] = _wtoi(splitted[i].c_str()); + oShape.m_nAdjustValue[i] = XmlUtils::GetInteger(splitted[i]); } catch(...) { @@ -2176,8 +2176,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..b511fe8977 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; @@ -337,13 +337,13 @@ private: } try { - parametroInt = _wtoi(parametroStr.c_str()); + parametroInt = XmlUtils::GetInteger(parametroStr); } catch (...) { try { - parametroInt = (int)_wtoi64(parametroStr.c_str()); + parametroInt = (int)XmlUtils::GetInteger64(parametroStr); } catch (...) { 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..574db10083 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" @@ -124,17 +124,11 @@ namespace Strings } static int ToInteger(const std::wstring& strValue) { - return _ttoi(strValue.c_str()); + return XmlUtils::GetInteger(strValue); } static double ToDouble(const std::wstring& strValue) { - double d = 0; -#if defined (_WIN32) || defined(_WIN64) - _stscanf_s(strValue.c_str(), L" %lf", &d); -#else - _stscanf(strValue.c_str(), L" %lf", &d); -#endif - return d; + return XmlUtils::GetDouble(strValue); } } @@ -148,7 +142,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' ); @@ -166,11 +160,11 @@ public: _stscanf_s(str.c_str(), L"%d", &nResult); #else if(16 == base) - _stscanf(str.c_str(), L"%X", &nResult); + swscanf(str.c_str(), L"%X", &nResult); else if(8 == base) - _stscanf(str.c_str(), L"%o", &nResult); + swscanf(str.c_str(), L"%o", &nResult); else - _stscanf(str.c_str(), L"%d", &nResult); + swscanf(str.c_str(), L"%d", &nResult); #endif return nResult; } @@ -314,7 +308,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 +445,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/ASCOfficeTxtFile/TxtXmlFormatLib/Linux/TxtXmlFormatLib.pro b/ASCOfficeTxtFile/TxtXmlFormatLib/Linux/TxtXmlFormatLib.pro index 8d638c5dcc..2de3e6a664 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Linux/TxtXmlFormatLib.pro +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Linux/TxtXmlFormatLib.pro @@ -24,21 +24,13 @@ DEFINES += UNICODE \ include($$PWD/../../../Common/3dParty/boost/boost.pri) HEADERS += \ - ../Source/TxtXmlFile.h \ - ../Source/Common/Encoding.h \ - ../Source/Common/precompiled_utility.h \ - ../Source/Common/StlUtils.h \ - ../Source/Common/ToString.h \ - ../Source/Common/Utility.h \ ../Source/TxtFormat/File.h \ ../Source/TxtFormat/TxtFile.h \ - ../Source/TxtFormat/TxtFormat.h \ + ../Source/TxtXmlFile.h \ ../Source/ConvertDocx2Txt.h \ ../Source/ConvertTxt2Docx.h SOURCES += \ - ../Source/Common/Encoding.cpp \ - ../Source/Common/ToString.cpp \ ../Source/TxtFormat/File.cpp \ ../Source/TxtFormat/TxtFile.cpp \ ../Source/TxtXmlFile.cpp \ diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/project.pbxproj b/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/project.pbxproj deleted file mode 100644 index e0a1756106..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/project.pbxproj +++ /dev/null @@ -1,382 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 6967AFD41E2798DB00A129E2 /* ConvertDocx2Txt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFCC1E2798DB00A129E2 /* ConvertDocx2Txt.cpp */; }; - 6967AFD51E2798DB00A129E2 /* ConvertTxt2Docx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFCE1E2798DB00A129E2 /* ConvertTxt2Docx.cpp */; }; - 6967AFD61E2798DB00A129E2 /* TxtXmlFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFD21E2798DB00A129E2 /* TxtXmlFile.cpp */; }; - 6967AFE81E279C6F00A129E2 /* Encoding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFE11E279C6F00A129E2 /* Encoding.cpp */; }; - 6967AFE91E279C6F00A129E2 /* ToString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFE51E279C6F00A129E2 /* ToString.cpp */; }; - 6967AFF01E279C7700A129E2 /* File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFEB1E279C7700A129E2 /* File.cpp */; }; - 6967AFF11E279C7700A129E2 /* TxtFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6967AFED1E279C7700A129E2 /* TxtFile.cpp */; }; - 8AB24C012130055700E80DDD /* SystemUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AB24C002130055700E80DDD /* SystemUtils.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 6967AFBD1E2798B900A129E2 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 6967AFBF1E2798B900A129E2 /* libTxtXmlFormatLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTxtXmlFormatLib.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 6967AFCC1E2798DB00A129E2 /* ConvertDocx2Txt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConvertDocx2Txt.cpp; path = ../../../Source/ConvertDocx2Txt.cpp; sourceTree = ""; }; - 6967AFCD1E2798DB00A129E2 /* ConvertDocx2Txt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ConvertDocx2Txt.h; path = ../../../Source/ConvertDocx2Txt.h; sourceTree = ""; }; - 6967AFCE1E2798DB00A129E2 /* ConvertTxt2Docx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConvertTxt2Docx.cpp; path = ../../../Source/ConvertTxt2Docx.cpp; sourceTree = ""; }; - 6967AFCF1E2798DB00A129E2 /* ConvertTxt2Docx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ConvertTxt2Docx.h; path = ../../../Source/ConvertTxt2Docx.h; sourceTree = ""; }; - 6967AFD11E2798DB00A129E2 /* TxtXmlEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TxtXmlEvent.h; path = ../../../Source/TxtXmlEvent.h; sourceTree = ""; }; - 6967AFD21E2798DB00A129E2 /* TxtXmlFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TxtXmlFile.cpp; path = ../../../Source/TxtXmlFile.cpp; sourceTree = ""; }; - 6967AFD31E2798DB00A129E2 /* TxtXmlFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TxtXmlFile.h; path = ../../../Source/TxtXmlFile.h; sourceTree = ""; }; - 6967AFE11E279C6F00A129E2 /* Encoding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Encoding.cpp; sourceTree = ""; }; - 6967AFE21E279C6F00A129E2 /* Encoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Encoding.h; sourceTree = ""; }; - 6967AFE31E279C6F00A129E2 /* precompiled_utility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = precompiled_utility.h; sourceTree = ""; }; - 6967AFE41E279C6F00A129E2 /* StlUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StlUtils.h; sourceTree = ""; }; - 6967AFE51E279C6F00A129E2 /* ToString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToString.cpp; sourceTree = ""; }; - 6967AFE61E279C6F00A129E2 /* ToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToString.h; sourceTree = ""; }; - 6967AFE71E279C6F00A129E2 /* Utility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utility.h; sourceTree = ""; }; - 6967AFEB1E279C7700A129E2 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = File.cpp; sourceTree = ""; }; - 6967AFEC1E279C7700A129E2 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = File.h; sourceTree = ""; }; - 6967AFED1E279C7700A129E2 /* TxtFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TxtFile.cpp; sourceTree = ""; }; - 6967AFEE1E279C7700A129E2 /* TxtFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TxtFile.h; sourceTree = ""; }; - 6967AFEF1E279C7700A129E2 /* TxtFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TxtFormat.h; sourceTree = ""; }; - 8AB24BFF2130055700E80DDD /* SystemUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SystemUtils.h; path = ../../../../DesktopEditor/common/SystemUtils.h; sourceTree = ""; }; - 8AB24C002130055700E80DDD /* SystemUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemUtils.cpp; path = ../../../../DesktopEditor/common/SystemUtils.cpp; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 6967AFBC1E2798B900A129E2 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 6967AFB61E2798B900A129E2 = { - isa = PBXGroup; - children = ( - 6967AFC11E2798B900A129E2 /* TxtXmlFormatLib */, - 6967AFC01E2798B900A129E2 /* Products */, - ); - sourceTree = ""; - }; - 6967AFC01E2798B900A129E2 /* Products */ = { - isa = PBXGroup; - children = ( - 6967AFBF1E2798B900A129E2 /* libTxtXmlFormatLib.a */, - ); - name = Products; - sourceTree = ""; - }; - 6967AFC11E2798B900A129E2 /* TxtXmlFormatLib */ = { - isa = PBXGroup; - children = ( - 6967AFEA1E279C7700A129E2 /* TxtFormat */, - 6967AFE01E279C6F00A129E2 /* Common */, - 6967AFCC1E2798DB00A129E2 /* ConvertDocx2Txt.cpp */, - 6967AFCD1E2798DB00A129E2 /* ConvertDocx2Txt.h */, - 6967AFCE1E2798DB00A129E2 /* ConvertTxt2Docx.cpp */, - 6967AFCF1E2798DB00A129E2 /* ConvertTxt2Docx.h */, - 6967AFD11E2798DB00A129E2 /* TxtXmlEvent.h */, - 6967AFD21E2798DB00A129E2 /* TxtXmlFile.cpp */, - 6967AFD31E2798DB00A129E2 /* TxtXmlFile.h */, - ); - path = TxtXmlFormatLib; - sourceTree = ""; - }; - 6967AFE01E279C6F00A129E2 /* Common */ = { - isa = PBXGroup; - children = ( - 6967AFE11E279C6F00A129E2 /* Encoding.cpp */, - 6967AFE21E279C6F00A129E2 /* Encoding.h */, - 6967AFE31E279C6F00A129E2 /* precompiled_utility.h */, - 6967AFE41E279C6F00A129E2 /* StlUtils.h */, - 6967AFE51E279C6F00A129E2 /* ToString.cpp */, - 6967AFE61E279C6F00A129E2 /* ToString.h */, - 6967AFE71E279C6F00A129E2 /* Utility.h */, - 8AB24C002130055700E80DDD /* SystemUtils.cpp */, - 8AB24BFF2130055700E80DDD /* SystemUtils.h */, - ); - name = Common; - path = ../../../Source/Common; - sourceTree = ""; - }; - 6967AFEA1E279C7700A129E2 /* TxtFormat */ = { - isa = PBXGroup; - children = ( - 6967AFEB1E279C7700A129E2 /* File.cpp */, - 6967AFEC1E279C7700A129E2 /* File.h */, - 6967AFED1E279C7700A129E2 /* TxtFile.cpp */, - 6967AFEE1E279C7700A129E2 /* TxtFile.h */, - 6967AFEF1E279C7700A129E2 /* TxtFormat.h */, - ); - name = TxtFormat; - path = ../../../Source/TxtFormat; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 6967AFBE1E2798B900A129E2 /* TxtXmlFormatLib */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6967AFC81E2798B900A129E2 /* Build configuration list for PBXNativeTarget "TxtXmlFormatLib" */; - buildPhases = ( - 6967AFBB1E2798B900A129E2 /* Sources */, - 6967AFBC1E2798B900A129E2 /* Frameworks */, - 6967AFBD1E2798B900A129E2 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = TxtXmlFormatLib; - productName = TxtXmlFormatLib; - productReference = 6967AFBF1E2798B900A129E2 /* libTxtXmlFormatLib.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 6967AFB71E2798B900A129E2 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0930; - ORGANIZATIONNAME = OnlyOffce; - TargetAttributes = { - 6967AFBE1E2798B900A129E2 = { - CreatedOnToolsVersion = 8.2; - DevelopmentTeam = 2WH24U26GJ; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = 6967AFBA1E2798B900A129E2 /* Build configuration list for PBXProject "TxtXmlFormatLib" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 6967AFB61E2798B900A129E2; - productRefGroup = 6967AFC01E2798B900A129E2 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 6967AFBE1E2798B900A129E2 /* TxtXmlFormatLib */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 6967AFBB1E2798B900A129E2 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6967AFE91E279C6F00A129E2 /* ToString.cpp in Sources */, - 6967AFE81E279C6F00A129E2 /* Encoding.cpp in Sources */, - 6967AFF11E279C7700A129E2 /* TxtFile.cpp in Sources */, - 6967AFD61E2798DB00A129E2 /* TxtXmlFile.cpp in Sources */, - 6967AFF01E279C7700A129E2 /* File.cpp in Sources */, - 6967AFD51E2798DB00A129E2 /* ConvertTxt2Docx.cpp in Sources */, - 8AB24C012130055700E80DDD /* SystemUtils.cpp in Sources */, - 6967AFD41E2798DB00A129E2 /* ConvertDocx2Txt.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 6967AFC61E2798B900A129E2 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 6967AFC71E2798B900A129E2 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 6967AFC91E2798B900A129E2 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = 2WH24U26GJ; - GCC_PREPROCESSOR_DEFINITIONS = ( - UNICODE, - _UNICODE, - MAC, - unix, - _IOS, - DONT_WRITE_EMBEDDED_FONTS, - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - /usr/include/libxml2, - "$(PROJECT_DIR)/../../../../Common/3dParty/boost/boost_1_58_0", - "$(PROJECT_DIR)/../../../../DesktopEditor/xml/libxml2/include", - "$(PROJECT_DIR)/../../../../DesktopEditor/freetype-2.5.2/include", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 6967AFCA1E2798B900A129E2 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEVELOPMENT_TEAM = 2WH24U26GJ; - GCC_PREPROCESSOR_DEFINITIONS = ( - UNICODE, - _UNICODE, - MAC, - unix, - _IOS, - DONT_WRITE_EMBEDDED_FONTS, - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - /usr/include/libxml2, - "$(PROJECT_DIR)/../../../../Common/3dParty/boost/boost_1_58_0", - "$(PROJECT_DIR)/../../../../DesktopEditor/xml/libxml2/include", - "$(PROJECT_DIR)/../../../../DesktopEditor/freetype-2.5.2/include", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 6967AFBA1E2798B900A129E2 /* Build configuration list for PBXProject "TxtXmlFormatLib" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6967AFC61E2798B900A129E2 /* Debug */, - 6967AFC71E2798B900A129E2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6967AFC81E2798B900A129E2 /* Build configuration list for PBXNativeTarget "TxtXmlFormatLib" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6967AFC91E2798B900A129E2 /* Debug */, - 6967AFCA1E2798B900A129E2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 6967AFB71E2798B900A129E2 /* Project object */; -} diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 177f414abe..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/xcshareddata/xcschemes/TxtXmlFormatLib.xcscheme b/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/xcshareddata/xcschemes/TxtXmlFormatLib.xcscheme deleted file mode 100644 index 2feed84d62..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib.xcodeproj/xcshareddata/xcschemes/TxtXmlFormatLib.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib/NOTE.txt b/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib/NOTE.txt deleted file mode 100644 index 70fa9cd654..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Mac/TxtXmlFormatLib/TxtXmlFormatLib/NOTE.txt +++ /dev/null @@ -1 +0,0 @@ -DO NOT REMOVE FOLDER FOR XCODE \ No newline at end of file diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.cpp b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.cpp deleted file mode 100644 index deaf20cf0f..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * (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 "precompiled_utility.h" - -#include "Encoding.h" -#include "Utility.h" - -#include "../../../../Common/DocxFormat/Source/Base/unicode_util.h" -#include "../../../../UnicodeConverter/UnicodeConverter.h" -#include "../../../../UnicodeConverter/UnicodeConverter_Encodings.h" - -#if !defined(_WIN32) && !defined(_WIN64) - #include -#endif - -#include - -const std::wstring Encoding::ansi2unicode(const std::string& line) -{ - if (line.empty()) - return std::wstring(); - - std::locale loc(""); - std::ctype const &facet = std::use_facet >(loc); - - std::wstring result; - result.resize(line.size()); - - facet.widen(line.c_str(), line.c_str() + line.size(), &result[0]); - return result; -} - -const std::wstring Encoding::cp2unicode(const std::string& sline, const unsigned int nCodepage) -{ - const NSUnicodeConverter::EncodindId& oEncodindId = NSUnicodeConverter::Encodings[nCodepage]; - NSUnicodeConverter::CUnicodeConverter oUnicodeConverter; - return oUnicodeConverter.toUnicode(sline, oEncodindId.Name); -} - - -const std::wstring Encoding::utf82unicode(const std::string& line) -{ - if (sizeof(wchar_t) == 2)//utf8 -> utf16 - { - unsigned int nLength = line.length(); - - UTF16 *pStrUtf16 = new UTF16 [nLength+1]; - memset ((void *) pStrUtf16, 0, sizeof (UTF16) * (nLength+1)); - - UTF8 *pStrUtf8 = (UTF8 *) &line[0]; - - // this values will be modificated - const UTF8 *pStrUtf8_Conv = pStrUtf8; - UTF16 *pStrUtf16_Conv = pStrUtf16; - - ConversionResult eUnicodeConversionResult = ConvertUTF8toUTF16 (&pStrUtf8_Conv, &pStrUtf8[nLength] - , &pStrUtf16_Conv, &pStrUtf16 [nLength] - , strictConversion); - - if (conversionOK != eUnicodeConversionResult) - { - delete [] pStrUtf16; - return std::wstring(); - } - std::wstring utf16Str ((wchar_t *) pStrUtf16); - - delete [] pStrUtf16; - return utf16Str; - } - else //utf8 -> utf32 - { - unsigned int nLength = line.length(); - - UTF32 *pStrUtf32 = new UTF32 [nLength+1]; - memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength+1)); - - - UTF8 *pStrUtf8 = (UTF8 *) &line[0]; - - // this values will be modificated - const UTF8 *pStrUtf8_Conv = pStrUtf8; - UTF32 *pStrUtf32_Conv = pStrUtf32; - - ConversionResult eUnicodeConversionResult = ConvertUTF8toUTF32 (&pStrUtf8_Conv, &pStrUtf8[nLength] - , &pStrUtf32_Conv, &pStrUtf32 [nLength] - , strictConversion); - - if (conversionOK != eUnicodeConversionResult) - { - delete [] pStrUtf32; - return ansi2unicode(line); - } - std::wstring utf32Str ((wchar_t *) pStrUtf32); - - delete [] pStrUtf32; - return utf32Str; - } -} - -const std::string Encoding::unicode2ansi(const std::wstring& line) -{ - if (line.empty()) - return std::string(); - - std::locale loc(""); - std::ctype const &facet = std::use_facet >(loc); - - std::string result; - result.resize(line.size()); - - facet.narrow(line.c_str(), line.c_str() + line.size(), '?', &result[0]); - return result; -} - -const std::string Encoding::unicode2utf8(const std::wstring& line) -{ - if (sizeof(wchar_t) == 2) - { - UTF16 *pStrUtf16 = (UTF16 *) &line[0]; - - unsigned int nLength = line.length(); - unsigned int nDstLength = 4*nLength + 1; - - UTF8 *pStrUtf8 = new UTF8 [nDstLength]; - memset ((void *) pStrUtf8, 0, sizeof (UTF8) * (nDstLength)); - - // this values will be modificated - const UTF16 *pStrUtf16_Conv = pStrUtf16; - UTF8 *pStrUtf8_Conv = pStrUtf8; - - ConversionResult eUnicodeConversionResult = ConvertUTF16toUTF8 (&pStrUtf16_Conv, &pStrUtf16[nLength] - , &pStrUtf8_Conv , &pStrUtf8 [nDstLength] - , strictConversion); - - if (conversionOK != eUnicodeConversionResult) - { - delete [] pStrUtf8; - return std::string(); - } - - std::string utf8Str ((char *) pStrUtf8); - - delete [] pStrUtf8; - return utf8Str; - } - else //utf32 -> utf8 - { - UTF32 *pStrUtf32 = (UTF32 *) &line[0]; - - unsigned int nLength = line.length(); - unsigned int nDstLength = 4*nLength + 1; - - UTF8 *pStrUtf8 = new UTF8 [nDstLength]; - memset ((void *) pStrUtf8, 0, sizeof (UTF8) * (nDstLength)); - - // this values will be modificated - const UTF32 *pStrUtf32_Conv = pStrUtf32; - UTF8 *pStrUtf8_Conv = pStrUtf8; - - ConversionResult eUnicodeConversionResult = ConvertUTF32toUTF8 (&pStrUtf32_Conv, &pStrUtf32[nLength] - , &pStrUtf8_Conv , &pStrUtf8 [nDstLength] - , strictConversion); - - if (conversionOK != eUnicodeConversionResult) - { - delete [] pStrUtf8; - return std::string(); - } - - std::string utf8Str ((char *) pStrUtf8); - - delete [] pStrUtf8; - return utf8Str; - } -} - -const std::string Encoding::unicode2cp(const std::wstring& sLine, const unsigned int nCodepage) -{ - const NSUnicodeConverter::EncodindId& oEncodindId = NSUnicodeConverter::Encodings[nCodepage]; - NSUnicodeConverter::CUnicodeConverter oUnicodeConverter; - return oUnicodeConverter.fromUnicode(sLine, oEncodindId.Name); -} diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.h deleted file mode 100644 index 7f1ae3808c..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (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 -#ifndef UTILITY_ENCODING_INCLUDE_H_ -#define UTILITY_ENCODING_INCLUDE_H_ - -#include - -class Encoding -{ -public: - static const std::wstring ansi2unicode (const std::string& line); - static const std::wstring cp2unicode (const std::string& line, const unsigned int codePage); - static const std::wstring utf82unicode (const std::string& line); - - static const std::string unicode2ansi (const std::wstring& line); - static const std::string unicode2utf8 (const std::wstring& line); - static const std::string unicode2cp (const std::wstring& line, const unsigned int codePage); -}; -#endif // UTILITY_ENCODING_INCLUDE_H_ \ No newline at end of file diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/StlUtils.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/StlUtils.h deleted file mode 100644 index 13cf25bf89..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/StlUtils.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * (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 - -#ifndef ASC_STL_UTILS_INCLUDE_H_ -#define ASC_STL_UTILS_INCLUDE_H_ - -#include - -namespace StlUtils -{ - static inline std::wstring DoubleToWideString(double value) - { -#if defined(_WIN32) || defined(_WIN64) - wchar_t strValue[256]; - swprintf_s(strValue, 256, L"%f", value); - return std::wstring(strValue); -#else - return std::to_wstring(value); -#endif - } - - static inline std::string DoubleToString(double value) - { -#if defined(_WIN32) || defined(_WIN64) - char strValue[256]; - sprintf_s(strValue, 256, "%f", value); - return std::string(strValue); -#else - return std::to_string(value); -#endif - } - - static int ToInteger(const std::string& strValue) - { -#if defined(_WIN32) || defined(_WIN64) - return atoi(strValue.c_str()); -#else - return std::stoi(strValue); -#endif - } - - static int ToInteger(const std::wstring& strValue) - { -#if defined(_WIN32) || defined(_WIN64) - return _wtoi(strValue.c_str()); -#else - return std::stoi(strValue); -#endif - } - - static double ToDouble(const std::string& strValue) - { -#if defined(_WIN32) || defined(_WIN64) - return atof(strValue.c_str()); -#else - return std::stod(strValue.c_str()); -#endif - } - - static double ToDouble(const std::wstring& strValue) - { -#if defined(_WIN32) || defined(_WIN64) - return _wtof(strValue.c_str()); -#else - return std::stod(strValue); -#endif - } -} - -#endif // ASC_STL_UTILS_INCLUDE_H_ diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/ToString.cpp b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/ToString.cpp deleted file mode 100644 index cd55f84de2..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/ToString.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * (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 "precompiled_utility.h" - -#include "ToString.h" -#include "Encoding.h" -#include "StlUtils.h" - -const std::string ToString(const bool value) -{ - if (value) - return "true"; - return "false"; -} - -const std::wstring ToWString(const bool value) -{ - if (value) - return L"true"; - return L"false"; -} - -const std::string ToString(const int value) -{ - return std::to_string(value); -} - -const std::wstring ToWString(const int value) -{ - return std::to_wstring(value); -} - -const std::string ToString(const size_t value) -{ - return std::to_string(value); -} - -const std::string ToString(const std::wstring& value) -{ - return Encoding::unicode2utf8(value); -} - -const std::string ToString(const wchar_t* value) -{ - return Encoding::unicode2utf8(value); -} - -const std::wstring ToWString(const size_t value) -{ - return std::to_wstring(value); -} - -const std::string ToString(const double value) -{ - return StlUtils::DoubleToString(value); -} - -const std::wstring ToWString(const double value) -{ - return StlUtils::DoubleToWideString(value); -} - -const std::string ToString(const std::string& value) -{ - return value; -} - -const std::wstring ToWString(const std::wstring& value) -{ - return value; -} - -const std::wstring ToWString(const std::string& value) -{ - return Encoding::utf82unicode(value); -} - -const std::wstring ToWString(const char* value) -{ - return Encoding::utf82unicode(value); -} - -const std::string ToString(const char* value) -{ - return value; -} - -const std::wstring ToWString(const wchar_t* value) -{ - return value; -} diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/ToString.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/ToString.h deleted file mode 100644 index 5c4f89f26f..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/ToString.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (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 -#ifndef UTILITY_TO_STRING_INCLUDE_H_ -#define UTILITY_TO_STRING_INCLUDE_H_ - -#include -#include - -const std::string ToString(const bool value); -const std::string ToString(const int value); -const std::string ToString(const size_t value); -const std::string ToString(const double value); -const std::string ToString(const std::string& value); -const std::string ToString(const char* value); -const std::string ToString(const std::wstring& value); -const std::string ToString(const wchar_t* value); - -const std::wstring ToWString(const bool value); -const std::wstring ToWString(const int value); -const std::wstring ToWString(const size_t value); -const std::wstring ToWString(const double value); -const std::wstring ToWString(const std::string& value); -const std::wstring ToWString(const char* value); -const std::wstring ToWString(const std::wstring& value); -const std::wstring ToWString(const wchar_t* value); - -template const std::string ToString(const T& value) {return value.ToString();} -template const std::wstring ToWString(const T& value) {return value.ToWString();} - -#endif // UTILITY_TO_STRING_INCLUDE_H_ \ No newline at end of file diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertDocx2Txt.cpp b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertDocx2Txt.cpp index 35223cbf02..bd61290f84 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertDocx2Txt.cpp +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertDocx2Txt.cpp @@ -32,11 +32,8 @@ #include "ConvertDocx2Txt.h" -#include "Common/Encoding.h" +#include "TxtFormat/File.h" -#include "TxtFormat/TxtFormat.h" - -#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h" #include "../../../Common/DocxFormat/Source/DocxFormat/Document.h" #include "../../../Common/DocxFormat/Source/DocxFormat/Numbering.h" //#include "../../../Common/DocxFormat/Source/DocxFormat/Comments.h" @@ -45,115 +42,101 @@ #include "../../../Common/DocxFormat/Source/DocxFormat/Endnote.h" #include "../../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h" -#include "Common/ToString.h" #include namespace Docx2Txt { - static bool IsUnicodeSymbol( const wchar_t & symbol ) + class Converter_Impl { - bool result = false; - - if ( ( 0x0009 == symbol ) || ( 0x000A == symbol ) || ( 0x000D == symbol ) || - ( ( 0x0020 <= symbol ) && ( 0xD7FF >= symbol ) ) || ( ( 0xE000 <= symbol ) && ( symbol <= 0xFFFD ) ) || - ( ( 0x10000 <= symbol ) && symbol ) ) - { - result = true; - } - - return result; - } - class Converter_Impl - { - public: - Converter_Impl(); - ~Converter_Impl(); + public: + Converter_Impl(); + ~Converter_Impl(); void convert(); - void writeUtf8 (const std::wstring& path) const; - void writeUnicode (const std::wstring& path) const; - void writeBigEndian (const std::wstring& path) const; - void writeAnsi (const std::wstring& path) const; + void writeUtf8 (const std::wstring& path) const; + void writeUnicode (const std::wstring& path) const; + void writeBigEndian (const std::wstring& path) const; + void writeAnsi (const std::wstring& path) const; Txt::File m_outputFile; OOX::CDocx m_inputFile; - private: - void convert(std::vector & items, std::vector& textOut, bool bEnter, - OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles); - + private: + void convert(std::vector & items, std::vector& textOut, bool bEnter, + OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles); + void convert(OOX::WritingElement *pItem, std::vector& textOut, bool bEnter, - OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles); + OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles); void convert(OOX::Logic::CParagraph *pParagraph, std::vector& textOut, bool bEnter, - OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles); + OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles); std::wstring convert( OOX::Logic::CRun *pRun, OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles* pStyles); std::vector m_Field; - int ListCount; - std::vector Lists; + int ListCount; + std::vector Lists; std::vector levelPrev; int listNumPrev; - size_t NoteCount; - std::map> Notes; + size_t NoteCount; + std::map> Notes; - static std::wstring IntToLowerLetter (int number); - static std::wstring IntToUpperLetter (int number); - static std::wstring IntToLowerRoman (int number); - static std::wstring IntToUpperRoman (int number); + static std::wstring IntToLowerLetter (int number); + static std::wstring IntToUpperLetter (int number); + static std::wstring IntToLowerRoman (int number); + static std::wstring IntToUpperRoman (int number); - static const std::wstring m_letters; - }; + static const std::wstring m_letters; + }; - Converter::Converter() : converter_(new Converter_Impl) - {} + Converter::Converter() : converter_(new Converter_Impl) + {} Converter::~Converter() - { - delete converter_; - } + { + delete converter_; + } - void Converter::convert() - { - return converter_->convert(); - } + void Converter::convert() + { + return converter_->convert(); + } - void Converter::read(const std::wstring & path) - { - bool res = converter_->m_inputFile.Read(path); + void Converter::read(const std::wstring & path) + { + bool res = converter_->m_inputFile.Read(path); return; - } + } - void Converter::write(const std::wstring & path) - { - return converter_->m_outputFile.write(path); - } + void Converter::write(const std::wstring & path) + { + return converter_->m_outputFile.write(path); + } - void Converter::writeUtf8(const std::wstring & path) const - { - return converter_->writeUtf8(path); - } + void Converter::writeUtf8(const std::wstring & path) const + { + return converter_->writeUtf8(path); + } - void Converter::writeUnicode(const std::wstring & path) const - { - return converter_->writeUnicode(path); - } + void Converter::writeUnicode(const std::wstring & path) const + { + return converter_->writeUnicode(path); + } - void Converter::writeBigEndian(const std::wstring & path) const - { - return converter_->writeBigEndian(path); - } + void Converter::writeBigEndian(const std::wstring & path) const + { + return converter_->writeBigEndian(path); + } - void Converter::writeAnsi(const std::wstring & path) const - { - return converter_->writeAnsi(path); - } + void Converter::writeAnsi(const std::wstring & path) const + { + return converter_->writeAnsi(path); + } const std::wstring Converter_Impl::m_letters = _T("abcdefghijklmnopqrstuvwxyz"); @@ -170,10 +153,10 @@ namespace Docx2Txt void Converter_Impl::convert() { - OOX::CDocument *pDocument = m_inputFile.m_oMain.document; + OOX::CDocument *pDocument = m_inputFile.m_oMain.document; OOX::CStyles *pStyles = m_inputFile.m_oMain.styles; OOX::CNumbering *pNumbering = m_inputFile.m_oMain.numbering; - + if (pNumbering) { ListCount = (int)pNumbering->m_arrNum.size(); @@ -197,11 +180,11 @@ namespace Docx2Txt m_outputFile.m_listContent.push_back(L""); m_outputFile.m_listContent.push_back(L"---------------------------"); - for(std::map>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++) + for(std::map>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++) { bool bFirst = true; - for(std::vector::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++) + for(std::vector::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++) { if (bFirst) m_outputFile.m_listContent.push_back(iter_map->first + L" " + *iter); else m_outputFile.m_listContent.push_back(*iter); @@ -213,35 +196,93 @@ namespace Docx2Txt } - void Converter_Impl::writeUtf8(const std::wstring& path) const + void Converter_Impl::writeUtf8(const std::wstring& path) const { m_outputFile.writeUtf8(path); } - void Converter_Impl::writeUnicode(const std::wstring& path) const + void Converter_Impl::writeUnicode(const std::wstring& path) const { m_outputFile.writeUnicode(path); } - void Converter_Impl::writeBigEndian(const std::wstring& path) const + void Converter_Impl::writeBigEndian(const std::wstring& path) const { m_outputFile.writeBigEndian(path); } - void Converter_Impl::writeAnsi(const std::wstring& path) const + void Converter_Impl::writeAnsi(const std::wstring& path) const { m_outputFile.writeAnsi(path); } void Converter_Impl::convert(OOX::WritingElement* item, std::vector& textOut, bool bEnter, - OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles) + OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles) { if (!item) return; switch (item->getType()) { + case OOX::et_w_p: + { + convert(dynamic_cast(item), textOut, bEnter, pDocument, pNumbering, pStyles); + }break; + case OOX::et_w_r: + { + textOut.push_back(convert((dynamic_cast(item)), pDocument, pNumbering, pStyles)); + }break; + case OOX::et_w_sdt: + { + OOX::Logic::CSdt *sdt = dynamic_cast(item); + if (sdt) + convert(sdt->m_oSdtContent.GetPointer(), textOut, bEnter, pDocument, pNumbering, pStyles); + }break; + default: + { + OOX::WritingElementWithChilds *item_with_items = dynamic_cast*>(item); + + if (item_with_items) + { + convert(item_with_items->m_arrItems, textOut, bEnter, pDocument, pNumbering, pStyles); + } + }break; + } + } + + void Converter_Impl::convert(std::vector & items, std::vector& textOut, bool bEnter, + OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles) + { + if (items.empty()) return; + + for (size_t i = 0; i < items.size(); ++i) + { + OOX::WritingElement* item = items[i]; + + if (!item)continue; + + switch (item->getType()) + { + case OOX::et_w_tc: + { + OOX::Logic::CTc *cell = dynamic_cast(item); + for (size_t j = 0; cell && j < cell->m_arrItems.size(); ++j) + { + convert(cell->m_arrItems[j], textOut, false, pDocument, pNumbering, pStyles); + if (textOut.empty()) textOut.push_back(L""); + + textOut.back() += L" |"; + } + }break; + case OOX::et_w_tr: + { + textOut.push_back(L"---------------------------------------------"); + textOut.push_back(L"|"); + + OOX::Logic::CTr *row = dynamic_cast(item); + convert(row->m_arrItems, textOut, false, pDocument, pNumbering, pStyles); + }break; case OOX::et_w_p: { convert(dynamic_cast(item), textOut, bEnter, pDocument, pNumbering, pStyles); @@ -264,74 +305,16 @@ namespace Docx2Txt { convert(item_with_items->m_arrItems, textOut, bEnter, pDocument, pNumbering, pStyles); } + else + { + convert(item, textOut, bEnter, pDocument, pNumbering, pStyles); + } }break; - } - } - - void Converter_Impl::convert(std::vector & items, std::vector& textOut, bool bEnter, - OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles *pStyles) - { - if (items.empty()) return; - - for (size_t i = 0; i < items.size(); ++i) - { - OOX::WritingElement* item = items[i]; - - if (!item)continue; - - switch (item->getType()) - { - case OOX::et_w_tc: - { - OOX::Logic::CTc *cell = dynamic_cast(item); - for (size_t j = 0; cell && j < cell->m_arrItems.size(); ++j) - { - convert(cell->m_arrItems[j], textOut, false, pDocument, pNumbering, pStyles); - if (textOut.empty()) textOut.push_back(L""); - - textOut.back() += L" |"; - } - }break; - case OOX::et_w_tr: - { - textOut.push_back(L"---------------------------------------------"); - textOut.push_back(L"|"); - - OOX::Logic::CTr *row = dynamic_cast(item); - convert(row->m_arrItems, textOut, false, pDocument, pNumbering, pStyles); - }break; - case OOX::et_w_p: - { - convert(dynamic_cast(item), textOut, bEnter, pDocument, pNumbering, pStyles); - }break; - case OOX::et_w_r: - { - textOut.push_back(convert((dynamic_cast(item)), pDocument, pNumbering, pStyles)); - }break; - case OOX::et_w_sdt: - { - OOX::Logic::CSdt *sdt = dynamic_cast(item); - if (sdt) - convert(sdt->m_oSdtContent.GetPointer(), textOut, bEnter, pDocument, pNumbering, pStyles); - }break; - default: - { - OOX::WritingElementWithChilds *item_with_items = dynamic_cast*>(item); - - if (item_with_items) - { - convert(item_with_items->m_arrItems, textOut, bEnter, pDocument, pNumbering, pStyles); - } - else - { - convert(item, textOut, bEnter, pDocument, pNumbering, pStyles); - } - }break; } } } std::wstring Converter_Impl::convert(OOX::Logic::CRun* pRun, - OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles* pStyles) + OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles* pStyles) { if (pRun == NULL) return L""; @@ -356,67 +339,67 @@ namespace Docx2Txt { bool caps = false; // - //if ((pRun->m_oRunProperty) && (pRun->m_oRunProperty->m_oCaps.Init()) && (pRun->m_oRunProperty->m_oCaps->m_oVal.ToBool())) + //if ((pRun->m_oRunProperty) && (pRun->m_oRunProperty->m_oCaps.Init()) && (pRun->m_oRunProperty->m_oCaps->m_oVal.ToBool())) // caps = true; std::wstring wstr; switch (pRun->m_arrItems[j]->getType()) { - case OOX::et_w_tab: + case OOX::et_w_tab: + { + wstr = L"\x09"; + }break; + case OOX::et_w_br: + { + wstr = L"\x0A"; + }break; + case OOX::et_w_t: + { + OOX::Logic::CText* text = dynamic_cast(pRun->m_arrItems[j]); + wstr = text->m_sText; + if (caps) { - wstr = L"\x09"; - }break; - case OOX::et_w_br: - { - wstr = L"\x0A"; - }break; - case OOX::et_w_t: - { - OOX::Logic::CText* text = dynamic_cast(pRun->m_arrItems[j]); - wstr = text->m_sText; - if (caps) - { - wstr = XmlUtils::GetUpper(wstr); - } - }break; - case OOX::et_w_footnoteReference: - case OOX::et_w_endnoteReference: - { - OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast(pRun->m_arrItems[j]); - OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast(pRun->m_arrItems[j]); - - std::vector notes_content; - - if (footnote_ref && m_inputFile.m_oMain.footnotes) - { - for (size_t r = 0; r < m_inputFile.m_oMain.footnotes->m_arrFootnote.size(); r++) - { - OOX::CFtnEdn* note = dynamic_cast(m_inputFile.m_oMain.footnotes->m_arrFootnote[r]); - - if (note && note->m_oId == footnote_ref->m_oId) - { - convert(m_inputFile.m_oMain.footnotes->m_arrFootnote[r]->m_arrItems, notes_content, true, pDocument, pNumbering, pStyles); - } - } - Notes.insert(std::make_pair(ToWString(++NoteCount), notes_content)); - wstr += L"[" + ToWString(NoteCount) + L"]"; - } - if (endnote_ref && m_inputFile.m_oMain.endnotes) - { - for (size_t r = 0; r < m_inputFile.m_oMain.endnotes->m_arrEndnote.size(); r++) - { - OOX::CFtnEdn* note = dynamic_cast(m_inputFile.m_oMain.endnotes->m_arrEndnote[r]); - - if (note && note->m_oId == endnote_ref->m_oId) - { - convert(m_inputFile.m_oMain.endnotes->m_arrEndnote[r]->m_arrItems, notes_content, true, pDocument, pNumbering, pStyles); - } - } - Notes.insert(std::make_pair(ToWString(++NoteCount), notes_content)); - wstr += L"[" + ToWString(NoteCount) + L"]"; - }break; + wstr = XmlUtils::GetUpper(wstr); } + }break; + case OOX::et_w_footnoteReference: + case OOX::et_w_endnoteReference: + { + OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast(pRun->m_arrItems[j]); + OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast(pRun->m_arrItems[j]); + + std::vector notes_content; + + if (footnote_ref && m_inputFile.m_oMain.footnotes) + { + for (size_t r = 0; r < m_inputFile.m_oMain.footnotes->m_arrFootnote.size(); r++) + { + OOX::CFtnEdn* note = dynamic_cast(m_inputFile.m_oMain.footnotes->m_arrFootnote[r]); + + if (note && note->m_oId == footnote_ref->m_oId) + { + convert(m_inputFile.m_oMain.footnotes->m_arrFootnote[r]->m_arrItems, notes_content, true, pDocument, pNumbering, pStyles); + } + } + Notes.insert(std::make_pair(std::to_wstring(++NoteCount), notes_content)); + wstr += L"[" + std::to_wstring(NoteCount) + L"]"; + } + if (endnote_ref && m_inputFile.m_oMain.endnotes) + { + for (size_t r = 0; r < m_inputFile.m_oMain.endnotes->m_arrEndnote.size(); r++) + { + OOX::CFtnEdn* note = dynamic_cast(m_inputFile.m_oMain.endnotes->m_arrEndnote[r]); + + if (note && note->m_oId == endnote_ref->m_oId) + { + convert(m_inputFile.m_oMain.endnotes->m_arrEndnote[r]->m_arrItems, notes_content, true, pDocument, pNumbering, pStyles); + } + } + Notes.insert(std::make_pair(std::to_wstring(++NoteCount), notes_content)); + wstr += L"[" + std::to_wstring(NoteCount) + L"]"; + }break; + } } line += wstr; } @@ -425,7 +408,7 @@ namespace Docx2Txt } void Converter_Impl::convert(OOX::Logic::CParagraph* pParagraph, std::vector& textOut, bool bEnter, - OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles* pStyles) + OOX::CDocument *pDocument, OOX::CNumbering* pNumbering, OOX::CStyles* pStyles) { if (pParagraph == NULL) return; @@ -443,12 +426,12 @@ namespace Docx2Txt } if (false == styleName.empty() && pStyles) { - std::map::iterator pFind = pStyles->m_mapStyleNames.find(styleName); + std::map::iterator pFind = pStyles->m_mapStyleNames.find(styleName); if (pFind != pStyles->m_mapStyleNames.end()) { OOX::CStyle* style = pStyles->m_arrStyle[pFind->second]; - + if ((style) && (style->m_oParPr.IsInit()) && (style->m_oParPr->m_oNumPr.IsInit())) { if (false == pParagraph->m_oParagraphProperty->m_oNumPr.IsInit()) @@ -466,20 +449,20 @@ namespace Docx2Txt { if (true == pParagraph->m_oParagraphProperty->m_oNumPr->m_oIlvl.IsInit()) { - level = pParagraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal.IsInit() ? - *pParagraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal + 1 : 0; + level = pParagraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal.IsInit() ? + *pParagraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal + 1 : 0; } if (true == pParagraph->m_oParagraphProperty->m_oNumPr->m_oNumID.IsInit()) { - listNum = pParagraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal.IsInit() ? - *pParagraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal : 1; + listNum = pParagraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal.IsInit() ? + *pParagraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal : 1; listNumPrev = listNum; } else listNum = listNumPrev; } } - + if (listNum > 0 && pNumbering) { std::map>::iterator pFindNum = pNumbering->m_mapNum.find(listNum); @@ -521,7 +504,7 @@ namespace Docx2Txt OOX::Numbering::CAbstractNum* abstractNum = NULL; std::map::iterator pFindAbstract = pNumbering->m_mapAbstractNum.find(abstractNumId); - + if (pFindAbstract != pNumbering->m_mapAbstractNum.end()) abstractNum = pNumbering->m_arrAbstractNum[pFindAbstract->second]; @@ -568,13 +551,10 @@ namespace Docx2Txt if ((abstractNum->m_arrLvl[ind_level]->m_oLvlText.IsInit()) && (abstractNum->m_arrLvl[ind_level]->m_oLvlText->m_sVal.IsInit())) { strLevelText = abstractNum->m_arrLvl[ind_level]->m_oLvlText->m_sVal.get(); - } + } if (abstractNum->m_arrLvl[ind_level]->m_oNumFmt->m_oVal->GetValue() == SimpleTypes::numberformatBullet) { - ////всли символ более-менее корректный - //if ((strLevelText.length() > 0) && (IsUnicodeSymbol(strLevelText[0]))) line += strLevelText + L" "; - //else line += L"* "; } else @@ -598,7 +578,7 @@ namespace Docx2Txt Lists[start + i] = startLvl.IsInit() ? *startLvl : 1; } - std::wstring num = L"%" + ToWString(i + 1); + std::wstring num = L"%" + std::to_wstring(i + 1); while(example.find(num) != example.npos) { switch(abstractNum->m_arrLvl[ind_level]->m_oNumFmt->m_oVal->GetValue()) @@ -616,7 +596,7 @@ namespace Docx2Txt example.replace(example.find(num), 2, IntToUpperRoman(Lists[start + i])); break; default: - example.replace(example.find(num), 2, ToWString(Lists[start + i])); + example.replace(example.find(num), 2, std::to_wstring(Lists[start + i])); break; } } @@ -629,59 +609,59 @@ namespace Docx2Txt } } - for (size_t i = 0; i < pParagraph->m_arrItems.size(); ++i) + for (size_t i = 0; i < pParagraph->m_arrItems.size(); ++i) { if (pParagraph->m_arrItems[i] == NULL) continue; switch (pParagraph->m_arrItems[i]->getType()) { - case OOX::et_w_r: + case OOX::et_w_r: + { + OOX::Logic::CRun *pRun = dynamic_cast(pParagraph->m_arrItems[i]); + line += convert(pRun, pDocument, pNumbering, pStyles); + }break; + case OOX::et_w_sdt: + { + convert(pParagraph->m_arrItems[i], textOut, bEnter, pDocument, pNumbering, pStyles); + }break; + case OOX::et_w_hyperlink: + { + OOX::Logic::CHyperlink *pHyperlink = dynamic_cast(pParagraph->m_arrItems[i]); + if (pHyperlink) { - OOX::Logic::CRun *pRun = dynamic_cast(pParagraph->m_arrItems[i]); - line += convert(pRun, pDocument, pNumbering, pStyles); - }break; - case OOX::et_w_sdt: - { - convert(pParagraph->m_arrItems[i], textOut, bEnter, pDocument, pNumbering, pStyles); - }break; - case OOX::et_w_hyperlink: - { - OOX::Logic::CHyperlink *pHyperlink = dynamic_cast(pParagraph->m_arrItems[i]); - if (pHyperlink) - { - std::wstring sTarget; - std::vector arDisplay; + std::wstring sTarget; + std::vector arDisplay; - if ((pHyperlink) && (pHyperlink->m_oId.IsInit())) + if ((pHyperlink) && (pHyperlink->m_oId.IsInit())) + { + if (pDocument) //todooo - >+headers/footers ->container { - if (pDocument) //todooo - >+headers/footers ->container + smart_ptr oFile = pDocument->Find(pHyperlink->m_oId->GetValue()); + if ((oFile.IsInit()) && (OOX::FileTypes::HyperLink == oFile->type())) { - smart_ptr oFile = pDocument->Find(pHyperlink->m_oId->GetValue()); - if ((oFile.IsInit()) && (OOX::FileTypes::HyperLink == oFile->type())) - { - OOX::HyperLink* pH = (OOX::HyperLink*)oFile.GetPointer(); - sTarget = pH->Uri().GetPath(); - } + OOX::HyperLink* pH = (OOX::HyperLink*)oFile.GetPointer(); + sTarget = pH->Uri().GetPath(); } } - if (pHyperlink->m_sAnchor.IsInit()) - { - sTarget += L"#" + *pHyperlink->m_sAnchor; - } - - for (size_t j = 0; j < pHyperlink->m_arrItems.size(); ++j) - { - convert(pHyperlink->m_arrItems, arDisplay, true, pDocument, pNumbering, pStyles); - } - for (size_t j = 0; j < arDisplay.size(); ++j) - line += arDisplay[j]; - - if (false == sTarget.empty()) - { - line += L"(" + sTarget + L")"; - } } - }break; + if (pHyperlink->m_sAnchor.IsInit()) + { + sTarget += L"#" + *pHyperlink->m_sAnchor; + } + + for (size_t j = 0; j < pHyperlink->m_arrItems.size(); ++j) + { + convert(pHyperlink->m_arrItems, arDisplay, true, pDocument, pNumbering, pStyles); + } + for (size_t j = 0; j < arDisplay.size(); ++j) + line += arDisplay[j]; + + if (false == sTarget.empty()) + { + line += L"(" + sTarget + L")"; + } + } + }break; } } if (bEnter || textOut.empty()) @@ -699,14 +679,14 @@ namespace Docx2Txt number--; if (number < 0) return L""; - static const size_t r = (L'z' - L'a' + 1); + static const size_t r = (L'z' - L'a' + 1); std::wstring res; size_t r0 = number / r; if (r0 > 0) { std::wstring rest = IntToLowerLetter(number - r * r0 + 1); - std::wstring res = IntToLowerLetter(r0 - 1 + 1) + rest; + std::wstring res = IntToLowerLetter(r0 - 1 + 1) + rest; return res; } else @@ -727,7 +707,7 @@ namespace Docx2Txt if (r0 > 0) { std::wstring rest = IntToUpperLetter(number - r * r0 + 1); - std::wstring res = IntToUpperLetter(r0 - 1 + 1) + rest; + std::wstring res = IntToUpperLetter(r0 - 1 + 1) + rest; return res; } else @@ -743,7 +723,7 @@ namespace Docx2Txt const std::wstring vxlcdm = _T("vxlcdm"); const std::wstring vld = _T("vld"); - std::wstring str_num = ToWString(number); + std::wstring str_num = std::to_wstring(number); size_t len = str_num.size(); int digit; for(size_t i = 0; i < len; i++) diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertDocx2Txt.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertDocx2Txt.h index 7d4d49215e..06701e75d1 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertDocx2Txt.h +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertDocx2Txt.h @@ -36,27 +36,27 @@ namespace Docx2Txt { - class Converter_Impl; - class Converter - { + class Converter_Impl; + class Converter + { public: Converter(); ~Converter(); void convert(); - - void read (const std::wstring& path); - void write (const std::wstring& path); - void writeUtf8 (const std::wstring& path) const; - void writeUnicode (const std::wstring& path) const; - void writeBigEndian (const std::wstring& path) const; - void writeAnsi (const std::wstring& path) const; + void read (const std::wstring& path); + void write (const std::wstring& path); - private: - Converter_Impl * converter_; - - }; + void writeUtf8 (const std::wstring& path) const; + void writeUnicode (const std::wstring& path) const; + void writeBigEndian (const std::wstring& path) const; + void writeAnsi (const std::wstring& path) const; + + private: + Converter_Impl * converter_; + + }; } // namespace Docx2Txt diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertTxt2Docx.cpp b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertTxt2Docx.cpp index 8e1ea5c822..7459bd9f39 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertTxt2Docx.cpp +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertTxt2Docx.cpp @@ -30,8 +30,7 @@ * */ #include "ConvertTxt2Docx.h" - -#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h" +#include "TxtFormat/File.h" #include "../../../Common/DocxFormat/Source/DocxFormat/Document.h" //#include "../../../Common/DocxFormat/Source/DocxFormat/Numbering.h" @@ -41,8 +40,6 @@ #include "../../../Common/DocxFormat/Source/DocxFormat/Endnote.h" #include "../../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h" -#include "TxtFormat/TxtFormat.h" - namespace Txt2Docx { class Converter_Impl @@ -56,35 +53,35 @@ namespace Txt2Docx OOX::CDocument m_outputFile; }; - Converter::Converter(int encoding) : converter_( new Converter_Impl(encoding) ) - { - } - - Converter::~Converter() - { - delete converter_; - } - - void Converter::convert() - { - return converter_->convert(); - } + Converter::Converter(int encoding) : converter_( new Converter_Impl(encoding) ) + { + } - void Converter::read(const std::wstring& path) - { - return converter_->m_inputFile.read(path); - } + Converter::~Converter() + { + delete converter_; + } - void Converter::write(/*const std::wstring& path*/NSStringUtils::CStringBuilder & stringWriter) - { - for (size_t i = 0; i < converter_->m_outputFile.m_arrItems.size(); ++i) + void Converter::convert() + { + return converter_->convert(); + } + + void Converter::read(const std::wstring& path) + { + return converter_->m_inputFile.read(path); + } + + void Converter::write(/*const std::wstring& path*/NSStringUtils::CStringBuilder & stringWriter) + { + for (size_t i = 0; i < converter_->m_outputFile.m_arrItems.size(); ++i) { if ( converter_->m_outputFile.m_arrItems[i] ) stringWriter.WriteString(converter_->m_outputFile.m_arrItems[i]->toXML()); } //BOOL res = converter_->m_outputFile.Write(std_string2string(path.string())); return; - } + } Converter_Impl::Converter_Impl(int encoding) : m_outputFile(NULL) { @@ -104,14 +101,14 @@ namespace Txt2Docx ComplexTypes::Word::CFonts font; space.m_oAfter.Init(); space.m_oAfter->FromString(L"0"); - space.m_oLine.Init(); space.m_oLine->FromString(L"240"); - space.m_oLineRule.Init(); space.m_oLineRule->SetValue(SimpleTypes::linespacingruleAuto); + space.m_oLine.Init(); space.m_oLine->FromString(L"240"); + space.m_oLineRule.Init(); space.m_oLineRule->SetValue(SimpleTypes::linespacingruleAuto); - font.m_sAscii.Init(); *font.m_sAscii = L"Courier New"; - font.m_sHAnsi.Init(); *font.m_sHAnsi = L"Courier New"; - font.m_sCs.Init(); *font.m_sCs = L"Courier New"; + font.m_sAscii.Init(); *font.m_sAscii = L"Courier New"; + font.m_sHAnsi.Init(); *font.m_sHAnsi = L"Courier New"; + font.m_sCs.Init(); *font.m_sCs = L"Courier New"; - for (size_t i = 0; i < m_inputFile.m_listContent.size(); ++i) + for (size_t i = 0; i < m_inputFile.m_listContent.size(); ++i) { std::wstring & line = m_inputFile.m_listContent[i]; @@ -131,7 +128,7 @@ namespace Txt2Docx line.erase(line.find(_T("\x08")), 1);//, ""); } while(line.find(_T("\x09")) != line.npos) - { + { int pos = line.find(_T("\x09")); if (pos > 0) @@ -141,18 +138,18 @@ namespace Txt2Docx { OOX::Logic::CRunProperty *rPr_ = new OOX::Logic::CRunProperty(); rPr_->m_oRFonts = font; - std::wstring s_ = XmlUtils::EncodeXmlString(s); - paragraph->AddText(s_, rPr_); + std::wstring s_ = XmlUtils::EncodeXmlString(s); + paragraph->AddText(s_, rPr_); } } paragraph->AddTab(); line.erase(0, pos + 1); - } - + } + if (!line.empty()) { - std::wstring s_ = XmlUtils::EncodeXmlString(line); - paragraph->AddText(s_, rPr); + std::wstring s_ = XmlUtils::EncodeXmlString(line); + paragraph->AddText(s_, rPr); } pDocument->m_arrItems.push_back(paragraph); } diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertTxt2Docx.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertTxt2Docx.h index ce7c000c0e..0300573604 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertTxt2Docx.h +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/ConvertTxt2Docx.h @@ -32,24 +32,23 @@ #pragma once #include "../../../DesktopEditor/common/StringBuilder.h" -#include namespace Txt2Docx { - class Converter_Impl; + class Converter_Impl; class Converter { public: Converter (int encoding); - ~Converter (); + ~Converter (); void convert(); - void read (const std::wstring& path); - void write (NSStringUtils::CStringBuilder & stringWriter/*const std::wstring& path*/); + void read (const std::wstring& path); + void write (NSStringUtils::CStringBuilder & stringWriter/*const std::wstring& path*/); - private: - Converter_Impl * converter_; + private: + Converter_Impl * converter_; }; } // namespace Txt2Docx diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/File.cpp b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/File.cpp index e6c1de9b12..be76007b06 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/File.cpp +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/File.cpp @@ -30,11 +30,93 @@ * */ #include "File.h" -#include "../Common/Utility.h" #include "TxtFile.h" #include "../../../../DesktopEditor/common/File.h" +#include +#include "../../../../UnicodeConverter/UnicodeConverter.h" +#include "../../../../UnicodeConverter/UnicodeConverter_Encodings.h" + +namespace NSEncoding +{ + std::wstring ansi2unicode(const std::string& line) + { + if (line.empty()) + return std::wstring(); + + std::locale loc(""); + std::ctype const &facet = std::use_facet >(loc); + + std::wstring result; + result.resize(line.size()); + + facet.widen(line.c_str(), line.c_str() + line.size(), &result[0]); + return result; + } + + std::string unicode2ansi(const std::wstring& line) + { + if (line.empty()) + return std::string(); + + std::locale loc(""); + std::ctype const &facet = std::use_facet >(loc); + + std::string result; + result.resize(line.size()); + + facet.narrow(line.c_str(), line.c_str() + line.size(), '?', &result[0]); + return result; + } + + std::vector transformToUnicode(const std::vector& lines, int code_page) + { + std::vector result; + + if (-1 == code_page) + { + for (std::vector::const_iterator iter = lines.begin(); iter != lines.end(); iter++) + { + result.push_back(ansi2unicode(*iter)); + } + } + else + { + const NSUnicodeConverter::EncodindId& oEncodindId = NSUnicodeConverter::Encodings[code_page]; + NSUnicodeConverter::CUnicodeConverter oUnicodeConverter; + + for (std::vector::const_iterator iter = lines.begin(); iter != lines.end(); iter++) + { + result.push_back(oUnicodeConverter.toUnicode(*iter, oEncodindId.Name)); + } + } + return result; + } + std::vector transformFromUnicode(const std::vector& lines, int code_page) + { + std::vector result; + + if (-1 == code_page) + { + for (std::vector::const_iterator iter = lines.begin(); iter != lines.end(); iter++) + { + result.push_back(unicode2ansi(*iter)); + } + } + else + { + const NSUnicodeConverter::EncodindId& oEncodindId = NSUnicodeConverter::Encodings[code_page]; + NSUnicodeConverter::CUnicodeConverter oUnicodeConverter; + + for (std::vector::const_iterator iter = lines.begin(); iter != lines.end(); iter++) + { + result.push_back(oUnicodeConverter.fromUnicode(*iter, oEncodindId.Name)); + } + } + return result; + } +} namespace Txt { @@ -44,40 +126,43 @@ namespace Txt } File::~File() { - m_listContent.clear(); + m_listContent.clear(); } - void File::read(const std::wstring& filename, int code_page) // насильственное чтение в кодировке + void File::read(const std::wstring& filename, int code_page) // насильственное чтение в кодировке { m_listContent.clear(); if (filename.empty()) return; - TxtFile file(filename); + TxtFile file(filename); - std::vector codePageContent = file.readAnsiOrCodePage(); - m_listContentSize = file.getLinesCount(); + std::vector codePageContent = file.readAnsiOrCodePage(); + m_listContentSize = file.getLinesCount(); - for (std::vector::const_iterator iter = codePageContent.begin(); iter != codePageContent.end(); ++iter) + const NSUnicodeConverter::EncodindId& oEncodindId = NSUnicodeConverter::Encodings[code_page]; + NSUnicodeConverter::CUnicodeConverter oUnicodeConverter; + + for (std::vector::const_iterator iter = codePageContent.begin(); iter != codePageContent.end(); ++iter) { - m_listContent.push_back(Encoding::cp2unicode(*iter, code_page)); + m_listContent.push_back(oUnicodeConverter.toUnicode(*iter, oEncodindId.Name)); } codePageContent.clear(); } - void File::read(const std::wstring& filename) + void File::read(const std::wstring& filename) { m_listContent.clear(); if (filename.empty()) return; - TxtFile file(filename); + TxtFile file(filename); //читаем юникод чтобы можно было выкинуть невалидные символы if (file.isUtf8()) { - m_listContent = _transform(file.readUtf8(), Encoding::utf82unicode); + m_listContent = NSEncoding::transformToUnicode(file.readUtf8(), 65001); } else if (file.isUnicode()) { @@ -94,101 +179,56 @@ namespace Txt // listContentUnicode = file.readUnicodeWithOutBOM(); else { - if (-1 == m_nEncoding) - m_listContent = _transform(file.readAnsiOrCodePage(), Encoding::utf82unicode); - else if (1000 == m_nEncoding) - m_listContent = _transform(file.readAnsiOrCodePage(), Encoding::ansi2unicode); - else - m_listContent = _transform2(file.readAnsiOrCodePage(), m_nEncoding, Encoding::cp2unicode); + int nCodePage = m_nEncoding; + if (-1 == nCodePage) nCodePage = 65001; + else if (1000 == nCodePage) nCodePage = -1; + + m_listContent = NSEncoding::transformToUnicode(file.readAnsiOrCodePage(), nCodePage); } m_listContentSize = file.getLinesCount(); - - //correctUnicode(listContentUnicode); - ВЫТИРАЕТ ПРОБЕЛЫ в конце строки ( } - - void File::write(const std::wstring& filename) const + void File::write(const std::wstring& filename) const { - TxtFile file(filename); - file.writeUtf8(_transform(m_listContent, Encoding::unicode2utf8)); + TxtFile file(filename); + file.writeUtf8(NSEncoding::transformFromUnicode(m_listContent, 65001)); } - void File::writeCodePage(const std::wstring& filename, int code_page) const + void File::writeCodePage(const std::wstring& filename, int code_page) const { - TxtFile file(filename); - - std::vector result; - for (std::vector::const_iterator iter = m_listContent.begin(); iter != m_listContent.end(); ++iter) - { - result.push_back(Encoding::unicode2cp(*iter,code_page)); - } - - file.writeAnsiOrCodePage(result); - } - - void File::writeUtf8(const std::wstring& filename) const - { - TxtFile file(filename); - file.writeUtf8(_transform(m_listContent, Encoding::unicode2utf8)); + TxtFile file(filename); + file.writeAnsiOrCodePage(NSEncoding::transformFromUnicode(m_listContent, code_page)); } - - void File::writeUnicode(const std::wstring& filename) const + void File::writeUtf8(const std::wstring& filename) const { - TxtFile file(filename); + TxtFile file(filename); + file.writeUtf8(NSEncoding::transformFromUnicode(m_listContent, 65001)); + } + + void File::writeUnicode(const std::wstring& filename) const + { + TxtFile file(filename); file.writeUnicode(m_listContent); } - - void File::writeBigEndian(const std::wstring& filename) const + void File::writeBigEndian(const std::wstring& filename) const { - TxtFile file(filename); + TxtFile file(filename); file.writeBigEndian(m_listContent); } - - void File::writeAnsi(const std::wstring& filename) const + void File::writeAnsi(const std::wstring& filename) const { - TxtFile file(filename); - file.writeAnsiOrCodePage(_transform(m_listContent, Encoding::unicode2ansi)); + TxtFile file(filename); + file.writeAnsiOrCodePage(NSEncoding::transformFromUnicode(m_listContent, -1)); } - - const bool File::isValid(const std::wstring& filename) const + const bool File::isValid(const std::wstring& filename) const { if (filename.empty()) return true; - return NSFile::CFileBinary::Exists(filename); - } - void File::correctUnicode(std::vector& input) - { - for(std::vector::iterator iter = input.begin(); iter != input.end(); iter++) - { - const std::wstring& inputStr = *iter; - std::wstring outputStr; - outputStr.reserve(inputStr.length()); - - for(int i = 0, length = inputStr.length(); i < length; ++i) - { - wchar_t inputChr = inputStr[i]; - if(IsUnicodeSymbol(inputChr)) - outputStr.push_back(inputChr); - } - *iter = outputStr; - } - } - bool File::IsUnicodeSymbol( wchar_t symbol ) - { - bool result = false; - - if ( ( 0x0009 == symbol ) || ( 0x000A == symbol ) || ( 0x000D == symbol ) || - ( ( 0x0020 <= symbol ) && ( 0xD7FF >= symbol ) ) || ( ( 0xE000 <= symbol ) && ( symbol <= 0xFFFD ) ) || - ( ( 0x10000 <= symbol ) && symbol ) ) - { - result = true; - } - - return result; + return NSFile::CFileBinary::Exists(filename); } } // namespace Txt diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/File.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/File.h index a7ac12be0a..764ceeb158 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/File.h +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/File.h @@ -42,24 +42,21 @@ namespace Txt File(); ~File(); - void read (const std::wstring& filename); - void read (const std::wstring& filename, int code_page); + void read (const std::wstring& filename); + void read (const std::wstring& filename, int code_page); - void write (const std::wstring& filename) const; + void write (const std::wstring& filename) const; - void writeCodePage (const std::wstring& filename, int code_page) const; - void writeUtf8 (const std::wstring& filename) const; - void writeUnicode (const std::wstring& filename) const; - void writeBigEndian (const std::wstring& filename) const; - void writeAnsi (const std::wstring& filename) const; + void writeCodePage (const std::wstring& filename, int code_page) const; + void writeUtf8 (const std::wstring& filename) const; + void writeUnicode (const std::wstring& filename) const; + void writeBigEndian (const std::wstring& filename) const; + void writeAnsi (const std::wstring& filename) const; - const bool isValid (const std::wstring& filename) const; + const bool isValid (const std::wstring& filename) const; - std::vector m_listContent; //unicode (ранее было utf8) + std::vector m_listContent; //unicode (ранее было utf8) int m_listContentSize; //для вывода процентов конвертации int m_nEncoding; - private: - void correctUnicode(std::vector& oList); - bool IsUnicodeSymbol( wchar_t symbol ); }; } // namespace Txt diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFile.cpp b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFile.cpp index 9c32a9c16f..4f852bcf6f 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFile.cpp +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFile.cpp @@ -31,11 +31,7 @@ */ #include "TxtFile.h" - -#include "../Common/Encoding.h" #include "../../../../Common/DocxFormat/Source/SystemUtility/File.h" -#include "../../../../DesktopEditor/common/File.h" - static const std::string BadSymbols = "\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"; diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFormat.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFormat.h deleted file mode 100644 index 073af29cda..0000000000 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtFormat/TxtFormat.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * (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 "File.h" diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.cpp b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.cpp index b0b02d5ccb..5c248fd63e 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.cpp +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.cpp @@ -34,29 +34,23 @@ #include "ConvertDocx2Txt.h" #include "ConvertTxt2Docx.h" -#include "Common/StlUtils.h" +#include "../../../Common/DocxFormat/Source/Base/Unit.h" -#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h" - -#include "../../../Common/DocxFormat/Source/DocxFormat/App.h" -#include "../../../Common/DocxFormat/Source/DocxFormat/Core.h" #include "../../../DesktopEditor/common/SystemUtils.h" #include "../../../Common/OfficeFileErrorDescription.h" + +#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h" +#include "../../../Common/DocxFormat/Source/DocxFormat/App.h" +#include "../../../Common/DocxFormat/Source/DocxFormat/Core.h" + namespace NSBinPptxRW { class CDrawingConverter; } -#include "../../../OfficeUtils/src/OfficeUtils.h" #include "../../../Common/OfficeDefines.h" - -#include "../../../Common/DocxFormat/Source/SystemUtility/File.h" - -#include "../../../ASCOfficeDocxFile2/DocWrapper/FontProcessor.h" - #include "../../../ASCOfficeDocxFile2/BinReader/FileWriter.h" - CTxtXmlFile::CTxtXmlFile() { } @@ -74,18 +68,18 @@ static int ParseTxtOptions(const std::wstring & sXmlOptions) int nCurDepth = xmlReader.GetDepth(); while ( xmlReader.ReadNextSiblingNode( nCurDepth ) ) { - std::wstring sName = xmlReader.GetName(); + std::wstring sName = xmlReader.GetName(); if (sName == _T("TXTOptions")) { int nCurDepth1 = xmlReader.GetDepth(); while ( xmlReader.ReadNextSiblingNode( nCurDepth1 ) ) { - std::wstring sName1 = xmlReader.GetName(); + std::wstring sName1 = xmlReader.GetName(); if (sName1 == _T("Encoding")) { - std::wstring strValue = xmlReader.GetText2(); - encoding = StlUtils::ToInteger(strValue); + std::wstring strValue = xmlReader.GetText2(); + encoding = XmlUtils::GetInteger(strValue); } } } @@ -97,17 +91,17 @@ static int ParseTxtOptions(const std::wstring & sXmlOptions) _UINT32 CTxtXmlFile::txt_LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstPath, const std::wstring & sXMLOptions) { - Writers::FileWriter *pDocxWriter = new Writers::FileWriter(sDstPath, L"", true, 1, NULL, L""); + Writers::FileWriter *pDocxWriter = new Writers::FileWriter(sDstPath, L"", true, 1, NULL, L""); if (pDocxWriter == NULL) return AVS_FILEUTILS_ERROR_CONVERT; - CreateDocxEmpty(sDstPath, pDocxWriter); + CreateDocxEmpty(sDstPath, pDocxWriter); try { int encoding = ParseTxtOptions(sXMLOptions); Txt2Docx::Converter converter( encoding); - converter.read(sSrcFileName); + converter.read(sSrcFileName); converter.convert(); converter.write(pDocxWriter->get_document_writer().m_oContent); } @@ -130,73 +124,73 @@ _UINT32 CTxtXmlFile::txt_SaveToFile(const std::wstring & sDstFileName, const std try { Docx2Txt::Converter converter; - converter.read(sSrcPath); + converter.read(sSrcPath); converter.convert(); int encoding = ParseTxtOptions(sXMLOptions); if (encoding == EncodingType::Utf8) - converter.writeUtf8(sDstFileName); + converter.writeUtf8(sDstFileName); else if (encoding == EncodingType::Unicode) - converter.writeUnicode(sDstFileName); + converter.writeUnicode(sDstFileName); else if (encoding == EncodingType::Ansi) - converter.writeAnsi(sDstFileName); + converter.writeAnsi(sDstFileName); else if (encoding == EncodingType::BigEndian) - converter.writeBigEndian(sDstFileName); + converter.writeBigEndian(sDstFileName); else if (encoding > 0) //code page { - converter.write(sDstFileName); + converter.write(sDstFileName); } else //auto define - converter.write(sDstFileName); + converter.write(sDstFileName); } catch(...) { return AVS_FILEUTILS_ERROR_CONVERT; } - return 0; + return 0; } void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::FileWriter * pDocxWriter) { - std::wstring strDirectory = _strDirectory; + std::wstring strDirectory = _strDirectory; // rels - OOX::CPath pathRels = strDirectory + FILE_SEPARATOR_STR +L"_rels"; - NSDirectory::CreateDirectory(pathRels.GetPath()); + OOX::CPath pathRels = strDirectory + FILE_SEPARATOR_STR +L"_rels"; + NSDirectory::CreateDirectory(pathRels.GetPath()); // word - OOX::CPath pathWord = strDirectory + FILE_SEPARATOR_STR + L"word"; - NSDirectory::CreateDirectory(pathWord.GetPath()); + OOX::CPath pathWord = strDirectory + FILE_SEPARATOR_STR + L"word"; + NSDirectory::CreateDirectory(pathWord.GetPath()); // documentRels - OOX::CPath pathWordRels = pathWord + FILE_SEPARATOR_STR + _T("_rels"); - NSDirectory::CreateDirectory(pathWordRels.GetPath()); + OOX::CPath pathWordRels = pathWord + FILE_SEPARATOR_STR + _T("_rels"); + NSDirectory::CreateDirectory(pathWordRels.GetPath()); //media - OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + _T("media"); - std::wstring sMediaPath = pathMedia.GetPath(); + OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + _T("media"); + std::wstring sMediaPath = pathMedia.GetPath(); // theme - OOX::CPath pathTheme = pathWord + FILE_SEPARATOR_STR + _T("theme"); - NSDirectory::CreateDirectory(pathTheme.GetPath()); + OOX::CPath pathTheme = pathWord + FILE_SEPARATOR_STR + _T("theme"); + NSDirectory::CreateDirectory(pathTheme.GetPath()); - OOX::CPath pathThemeRels = pathTheme + FILE_SEPARATOR_STR + _T("_rels"); - NSDirectory::CreateDirectory(pathThemeRels.GetPath()); + OOX::CPath pathThemeRels = pathTheme + FILE_SEPARATOR_STR + _T("_rels"); + NSDirectory::CreateDirectory(pathThemeRels.GetPath()); - pathTheme = pathTheme + FILE_SEPARATOR_STR + _T("theme1.xml"); + pathTheme = pathTheme + FILE_SEPARATOR_STR + _T("theme1.xml"); -//default files + //default files pDocxWriter->m_oTheme.Write(pathTheme.GetPath()); OOX::CContentTypes oContentTypes; //docProps - OOX::CPath pathDocProps = strDirectory + FILE_SEPARATOR_STR + _T("docProps"); - NSDirectory::CreateDirectory(pathDocProps.GetPath()); + OOX::CPath pathDocProps = strDirectory + FILE_SEPARATOR_STR + _T("docProps"); + NSDirectory::CreateDirectory(pathDocProps.GetPath()); - OOX::CPath DocProps = std::wstring(_T("docProps")); + OOX::CPath DocProps = std::wstring(_T("docProps")); OOX::CApp* pApp = new OOX::CApp(NULL); if (pApp) @@ -213,7 +207,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes); delete pApp; - } + } OOX::CCore* pCore = new OOX::CCore(NULL); if (pCore) { @@ -221,8 +215,8 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F pCore->SetLastModifiedBy(_T("")); pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes); delete pCore; - } -///////////////////////////////////////////////////////////////////////////////////// + } + ///////////////////////////////////////////////////////////////////////////////////// pDocxWriter->m_oTheme.Write(strDirectory); pDocxWriter->get_style_writers().Write(); pDocxWriter->get_font_table_writer().Write(); @@ -243,4 +237,3 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F oContentTypes.Write(strDirectory); } - diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.h index 38fbdb0359..c9921c6b17 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.h +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.h @@ -32,7 +32,6 @@ #pragma once #include - #include "../../../DesktopEditor/common/ASCVariant.h" namespace Writers 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/Crypt/Crypt.h b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/Crypt.h index cae711e3c2..cd5f0fa671 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/Crypt.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/Crypt.h @@ -33,7 +33,7 @@ #include #include -#include "../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../Common/DocxFormat/Source/Base/Base.h" namespace CRYPT { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h index 4596634e47..856a9258ff 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/cipher.h @@ -37,7 +37,7 @@ #include #endif -#include "../../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../../Common/DocxFormat/Source/Base/Base.h" class CipherARCFOUR { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/digest.h b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/digest.h index 191d21f683..de6be53745 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/digest.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Crypt/rtl/digest.h @@ -35,7 +35,7 @@ #include #endif -#include "../../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../../Common/DocxFormat/Source/Base/Base.h" class DigestMD5 { 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/BitMarkedStructs.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h index 83bd41d9e9..6484310700 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h @@ -35,7 +35,7 @@ #include #endif -#include "../../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../../Common/DocxFormat/Source/Base/Base.h" #include "BiffStructure.h" #include "BiffAttribute.h" #include "../../Auxiliary/HelpFunc.h" diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h index 21f0e77cbc..225a8fd9a1 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h @@ -32,7 +32,7 @@ #pragma once #include -#include "../../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../../Common/DocxFormat/Source/Base/Base.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/EncryptionStream.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/EncryptionStream.cpp index 3f3d39a551..17b0d6ad44 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/EncryptionStream.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/EncryptionStream.cpp @@ -34,7 +34,7 @@ #include "../Crypt/Decryptor.h" #include "../Binary/CFStream.h" -#include "../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../Common/DocxFormat/Source/Base/Base.h" #include "../../../../DesktopEditor/common/Types.h" #include "../../../../DesktopEditor/common/File.h" 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/ConvertXls2Xlsx.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.h index 6dee64fe4d..a52b5cd25a 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.h @@ -30,7 +30,7 @@ * */ #include -#include "../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../Common/DocxFormat/Source/Base/Base.h" struct ProgressCallback; 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 0fc20aaa54..d886071809 100644 --- a/Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro +++ b/Common/DocxFormat/DocxFormatLib/DocxFormatLib.pro @@ -65,6 +65,7 @@ SOURCES += \ ../Source/XlsxFormat/Common.cpp \ ../Source/XlsxFormat/Xlsx.cpp \ ../Source/XlsxFormat/XlsxFlat.cpp \ + ../Source/XlsxFormat/FileTypes_Spreadsheet.cpp \ ../Source/XlsxFormat/Worksheets/Worksheet.cpp \ ../Source/XlsxFormat/Worksheets/SheetData.cpp \ ../Source/XlsxFormat/Worksheets/ConditionalFormatting.cpp \ @@ -75,6 +76,7 @@ SOURCES += \ ../Source/DocxFormat/App.cpp \ ../Source/DocxFormat/Core.cpp \ ../Source/DocxFormat/FileFactory.cpp \ + ../Source/DocxFormat/FileTypes.cpp \ ../Source/DocxFormat/IFileContainer.cpp \ ../Source/DocxFormat/Document.cpp \ ../Source/XlsxFormat/FileFactory_Spreadsheet.cpp \ @@ -85,8 +87,18 @@ SOURCES += \ ../Source/DocxFormat/Diagram/DiagramLayout.cpp \ ../Source/DocxFormat/Diagram/DiagramQuickStyle.cpp \ ../Source/DocxFormat/WritingElement.cpp \ - ../Source/Common/SimpleTypes_Word.cpp \ - ../Source/SystemUtility/SystemUtility.cpp \ + ../Source/Common/SimpleTypes_Base.cpp \ + ../Source/Common/SimpleTypes_Word.cpp \ + ../Source/Common/SimpleTypes_Drawing.cpp \ + ../Source/Common/SimpleTypes_OMath.cpp \ + ../Source/Common/SimpleTypes_Rtf.cpp \ + ../Source/Common/SimpleTypes_Shared.cpp \ + ../Source/Common/SimpleTypes_Spreadsheet.cpp \ + ../Source/Common/SimpleTypes_Vml.cpp \ + ../Source/Common/ComplexTypes.cpp \ + ../Source/SystemUtility/SystemUtility.cpp \ + ../Source/SystemUtility/File.cpp \ + ../Source/XML/XmlSimple.cpp \ ../Source/XlsxFormat/Styles/Styles.cpp \ ../Source/XlsxFormat/Styles/rPr.cpp \ ../Source/XlsxFormat/SharedStrings/Si.cpp \ @@ -102,11 +114,13 @@ SOURCES += \ SOURCES += docxformatlib.cpp \ - ../Source/Utility/codecvt.cpp \ - ../Source/Utility/DateTime.cpp \ - ../Source/Utility/TxtFile.cpp \ + ../Source/Base/codecvt.cpp \ + ../Source/Base/DateTime.cpp \ ../Source/Base/unicode_util.cpp \ - ../../3dParty/pole/pole.cpp \ + ../Source/Base/Unit.cpp \ + ../Source/Base/WinColor.cpp \ + ../../3dParty/pole/pole.cpp + HEADERS += docxformatlib.h \ ../Source/Base/Base.h \ @@ -195,10 +209,10 @@ HEADERS += docxformatlib.h \ ../Source/DocxFormat/UnknowTypeFile.h \ ../Source/DocxFormat/WritingElement.h \ ../Source/SystemUtility/SystemUtility.h \ - ../Source/Utility/codecvt.h \ - ../Source/Utility/DateTime.h \ + ../Source/Base/codecvt.h \ + ../Source/Base/DateTime.h \ ../Source/Utility/TxtFile.h \ - ../Source/Utility/Unit.h \ + ../Source/Base/Unit.h \ ../Source/Utility/Utility.h \ ../Source/XlsxFormat/CalcChain/CalcChain.h \ ../Source/XlsxFormat/Chart/Chart.h \ diff --git a/Common/DocxFormat/DocxFormatLib/common_formatlib.cpp b/Common/DocxFormat/DocxFormatLib/common_formatlib.cpp index b5dfcc82fe..b948920811 100644 --- a/Common/DocxFormat/DocxFormatLib/common_formatlib.cpp +++ b/Common/DocxFormat/DocxFormatLib/common_formatlib.cpp @@ -37,5 +37,18 @@ //#include "../Source/Common/Position.cpp" //#include "../Source/Common/Wrap.cpp" //#include "../Source/Common/ZIndex.cpp" +//#include "../Source/Common/SimpleTypes_Word.cpp" + +#include "../Source/Common/SimpleTypes_Base.cpp" #include "../Source/Common/SimpleTypes_Word.cpp" +#include "../Source/Common/SimpleTypes_Drawing.cpp" +#include "../Source/Common/SimpleTypes_OMath.cpp" +#include "../Source/Common/SimpleTypes_Rtf.cpp" +#include "../Source/Common/SimpleTypes_Shared.cpp" +#include "../Source/Common/SimpleTypes_Spreadsheet.cpp" +#include "../Source/Common/SimpleTypes_Vml.cpp" +#include "../Source/Common/ComplexTypes.cpp" + #include "../Source/SystemUtility/SystemUtility.cpp" +#include "../Source/SystemUtility/File.cpp" +#include "../Source/XML/XmlSimple.cpp" diff --git a/Common/DocxFormat/DocxFormatLib/docxformatlib_logic.cpp b/Common/DocxFormat/DocxFormatLib/docxformatlib_logic.cpp index 02f119c438..9f896f99cb 100644 --- a/Common/DocxFormat/DocxFormatLib/docxformatlib_logic.cpp +++ b/Common/DocxFormat/DocxFormatLib/docxformatlib_logic.cpp @@ -65,6 +65,7 @@ #include "../Source/DocxFormat/Core.cpp" #include "../Source/DocxFormat/Settings/Settings.cpp" #include "../Source/DocxFormat/FileFactory.cpp" +#include "../Source/DocxFormat/FileTypes.cpp" #include "../Source/DocxFormat/IFileContainer.cpp" #include "../Source/DocxFormat/Document.cpp" #include "../Source/DocxFormat/Drawing/DrawingExt.cpp" diff --git a/Common/DocxFormat/DocxFormatLib/xlsxformatlib_logic.cpp b/Common/DocxFormat/DocxFormatLib/xlsxformatlib_logic.cpp index fefa4c0730..e8b445b2d6 100644 --- a/Common/DocxFormat/DocxFormatLib/xlsxformatlib_logic.cpp +++ b/Common/DocxFormat/DocxFormatLib/xlsxformatlib_logic.cpp @@ -36,6 +36,7 @@ #include "../Source/XlsxFormat/FileFactory_Spreadsheet.cpp" #include "../Source/XlsxFormat/Xlsx.cpp" #include "../Source/XlsxFormat/XlsxFlat.cpp" +#include "../Source/XlsxFormat/FileTypes_Spreadsheet.cpp" #include "../Source/XlsxFormat/Worksheets/SheetData.cpp" #include "../Source/XlsxFormat/Worksheets/Worksheet.cpp" #include "../Source/XlsxFormat/Worksheets/ConditionalFormatting.cpp" diff --git a/Common/DocxFormat/Source/Base/Base.h b/Common/DocxFormat/Source/Base/Base.h index 4464c1ad95..f7140550a5 100644 --- a/Common/DocxFormat/Source/Base/Base.h +++ b/Common/DocxFormat/Source/Base/Base.h @@ -35,69 +35,31 @@ #include #include -#include "unicode_util.h" - -#include "../../../../DesktopEditor/common/File.h" +#define VALUE_TO_STRING(x) #x +#define VALUE2STR(x) VALUE_TO_STRING(x) #define _T(x) __T(x) #define __T(x) L##x -#define VALUE_TO_STRING(x) #x -#define VALUE2STR(x) VALUE_TO_STRING(x) - #if defined(_WIN32) || defined (_WIN64) - #include - // windows-stype separator for paths i.e. 'c:\home\documents\file.ext' +#include +// windows-stype separator for paths i.e. 'c:\home\documents\file.ext' - #ifndef FILE_SEPARATOR - #define FILE_SEPARATOR - #define FILE_SEPARATOR_CHAR '\\' - #define FILE_SEPARATOR_STR _T("\\") +#ifndef FILE_SEPARATOR +#define FILE_SEPARATOR +#define FILE_SEPARATOR_CHAR '\\' +#define FILE_SEPARATOR_STR L"\\" #endif - #else - #include "stdint.h" +#include "stdint.h" - // linux-stype separator for paths i.e. '/home/documents/file.ext' - #ifndef FILE_SEPARATOR - #define FILE_SEPARATOR - #define FILE_SEPARATOR_CHAR '/' - #define FILE_SEPARATOR_STR _T("/") +// linux-stype separator for paths i.e. '/home/documents/file.ext' +#ifndef FILE_SEPARATOR +#define FILE_SEPARATOR +#define FILE_SEPARATOR_CHAR '/' +#define FILE_SEPARATOR_STR L"/" +#endif #endif - -#ifndef _wtof - #define _wtof std::stod - #define _wtoi64(p) std::wcstoll((p),NULL,10) - - static int _wtoi(std::wstring sVal) - { - int iVal = 0; - try - { - iVal = std::stod(sVal.c_str()); - }catch(...) - { - try - { - iVal = std::wcstoll(sVal.c_str(), NULL, 10); - }catch(...) - { - } - } - return iVal; - } - #ifdef UNICODE - #define _ttoi _wtoi - #define _tstof _wtof - #define _stscanf swscanf - #else - #define _ttoi atoi - #define _tstof atof - #define _stscanf scanf - #endif // #ifdef UNICODE -#endif // #ifndef _wtof - -#endif // #if defined(_WIN32) || defined (_WIN64) #ifndef AVSINLINE #if defined(_MSC_VER) @@ -107,3 +69,18 @@ #endif #endif +#if defined(_WIN32) || defined (_WIN64) +typedef __int16 _INT16; +typedef __int32 _INT32; +typedef __int64 _INT64; +typedef unsigned __int16 _UINT16; +typedef unsigned __int32 _UINT32; +typedef unsigned __int64 _UINT64; +#else +typedef int16_t _INT16; +typedef int32_t _INT32; +typedef int64_t _INT64; +typedef uint16_t _UINT16; +typedef uint32_t _UINT32; +typedef uint64_t _UINT64; +#endif diff --git a/Common/DocxFormat/Source/Utility/DateTime.cpp b/Common/DocxFormat/Source/Base/DateTime.cpp similarity index 61% rename from Common/DocxFormat/Source/Utility/DateTime.cpp rename to Common/DocxFormat/Source/Base/DateTime.cpp index 74505345ed..8f45354a32 100644 --- a/Common/DocxFormat/Source/Utility/DateTime.cpp +++ b/Common/DocxFormat/Source/Base/DateTime.cpp @@ -1,114 +1,114 @@ -/* - * (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 "DateTime.h" -#include "time.h" -#include "../XML/Utils.h" - -//---------------------------------------------------------------------------------------------- -// DateTime -//---------------------------------------------------------------------------------------------- -DateTime::DateTime() -{ - time_t oNow; - tm oLocal; - time( &oNow ); - -#ifdef _WIN32 - localtime_s( &oLocal, &oNow ); -#else - localtime_r( &oNow, &oLocal ); -#endif - - m_nYear = oLocal.tm_year + 1900; - m_nMonth = oLocal.tm_mon + 1; - m_nDay = oLocal.tm_mday; - m_nHour = oLocal.tm_hour; - m_nMinute = oLocal.tm_min; - m_nSecond = oLocal.tm_sec; - m_nMillisecond = 0; -} - - -DateTime::DateTime(const std::wstring &sValue, const std::wstring &sPattern) - : - m_nYear ( ParseValue( sValue, sPattern, _T("%YYYY")) ), - m_nMonth ( ParseValue( sValue, sPattern, _T("%MM") ) ), - m_nDay ( ParseValue( sValue, sPattern, _T("%DD") ) ), - m_nHour ( ParseValue( sValue, sPattern, _T("%hh") ) ), - m_nMinute ( ParseValue( sValue, sPattern, _T("%mm") ) ), - m_nSecond ( ParseValue( sValue, sPattern, _T("%ss") ) ), - m_nMillisecond ( ParseValue( sValue, sPattern, _T("%ms") ) ) -{ -} - - -const std::wstring DateTime::ToString (const std::wstring &sPattern) const -{ - std::wstring sResult = sPattern, sTemp; - - sTemp = XmlUtils::IntToString(m_nYear, _T("%04d") ); XmlUtils::replace_all(sResult, _T("%YYYY"), sTemp ); - sTemp = XmlUtils::IntToString(m_nMonth, _T("%02d") ); XmlUtils::replace_all(sResult, _T("%MM"), sTemp ); - sTemp = XmlUtils::IntToString(m_nDay, _T("%02d") ); XmlUtils::replace_all(sResult, _T("%DD"), sTemp ); - sTemp = XmlUtils::IntToString(m_nHour, _T("%02d") ); XmlUtils::replace_all(sResult, _T("%hh"), sTemp ); - sTemp = XmlUtils::IntToString(m_nMinute, _T("%02d") ); XmlUtils::replace_all(sResult, _T("%mm"), sTemp ); - sTemp = XmlUtils::IntToString(m_nSecond, _T("%02d") ); XmlUtils::replace_all(sResult, _T("%ss"), sTemp ); - sTemp = XmlUtils::IntToString(m_nMillisecond, _T("%02d") ); XmlUtils::replace_all(sResult, _T("%ms"), sTemp ); - - return sResult; -} - - -const DateTime DateTime::Parse (const std::wstring &sValue, const std::wstring &sPattern) -{ - return DateTime( sValue, sPattern ); -} - - -const int DateTime::ParseValue(const std::wstring &sValue, const std::wstring &sPattern, const std::wstring &sElement) -{ - const int nPos = sPattern.find( sElement ); - - if ( -1 != nPos ) - { - int nSepCount = 0; - for ( int nIndex = 0; nIndex < nPos; nIndex++ ) - { - if ( '%' == sPattern[nIndex] ) - nSepCount++; - } - - const std::wstring sNumeric = sValue.substr( nPos - nSepCount , sElement.length() - 1 ); - - return _wtoi( sNumeric.c_str() ); - } - return 0; -} +/* + * (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 "time.h" +#include "DateTime.h" +#include "Unit.h" + +//---------------------------------------------------------------------------------------------- +// DateTime +//---------------------------------------------------------------------------------------------- +DateTime::DateTime() +{ + time_t oNow; + tm oLocal; + time( &oNow ); + +#ifdef _WIN32 + localtime_s( &oLocal, &oNow ); +#else + localtime_r( &oNow, &oLocal ); +#endif + + m_nYear = oLocal.tm_year + 1900; + m_nMonth = oLocal.tm_mon + 1; + m_nDay = oLocal.tm_mday; + m_nHour = oLocal.tm_hour; + m_nMinute = oLocal.tm_min; + m_nSecond = oLocal.tm_sec; + m_nMillisecond = 0; +} + + +DateTime::DateTime(const std::wstring &sValue, const std::wstring &sPattern) + : + m_nYear ( ParseValue( sValue, sPattern, L"%YYYY" )), + m_nMonth ( ParseValue( sValue, sPattern, L"%MM" )), + m_nDay ( ParseValue( sValue, sPattern, L"%DD" )), + m_nHour ( ParseValue( sValue, sPattern, L"%hh" )), + m_nMinute ( ParseValue( sValue, sPattern, L"%mm" )), + m_nSecond ( ParseValue( sValue, sPattern, L"%ss" )), + m_nMillisecond ( ParseValue( sValue, sPattern, L"%ms" )) +{ +} + + +const std::wstring DateTime::ToString (const std::wstring &sPattern) const +{ + std::wstring sResult = sPattern, sTemp; + + sTemp = XmlUtils::ToString(m_nYear, L"%04d" ); XmlUtils::replace_all(sResult, L"%YYYY", sTemp ); + sTemp = XmlUtils::ToString(m_nMonth, L"%02d" ); XmlUtils::replace_all(sResult, L"%MM", sTemp ); + sTemp = XmlUtils::ToString(m_nDay, L"%02d" ); XmlUtils::replace_all(sResult, L"%DD", sTemp ); + sTemp = XmlUtils::ToString(m_nHour, L"%02d" ); XmlUtils::replace_all(sResult, L"%hh", sTemp ); + sTemp = XmlUtils::ToString(m_nMinute, L"%02d" ); XmlUtils::replace_all(sResult, L"%mm", sTemp ); + sTemp = XmlUtils::ToString(m_nSecond, L"%02d" ); XmlUtils::replace_all(sResult, L"%ss", sTemp ); + sTemp = XmlUtils::ToString(m_nMillisecond, L"%02d" ); XmlUtils::replace_all(sResult, L"%ms", sTemp ); + + return sResult; +} + + +const DateTime DateTime::Parse (const std::wstring &sValue, const std::wstring &sPattern) +{ + return DateTime( sValue, sPattern ); +} + + +const int DateTime::ParseValue(const std::wstring &sValue, const std::wstring &sPattern, const std::wstring &sElement) +{ + const std::wstring::size_type nPos = sPattern.find( sElement ); + + if ( std::wstring::npos != nPos ) + { + int nSepCount = 0; + for ( std::wstring::size_type nIndex = 0; nIndex < nPos; nIndex++ ) + { + if ( '%' == sPattern[nIndex] ) + nSepCount++; + } + + const std::wstring sNumeric = sValue.substr( nPos - nSepCount , sElement.length() - 1 ); + + return XmlUtils::GetInteger( sNumeric ); + } + return 0; +} diff --git a/Common/DocxFormat/Source/Utility/DateTime.h b/Common/DocxFormat/Source/Base/DateTime.h similarity index 81% rename from Common/DocxFormat/Source/Utility/DateTime.h rename to Common/DocxFormat/Source/Base/DateTime.h index 747d074146..a63b9b8380 100644 --- a/Common/DocxFormat/Source/Utility/DateTime.h +++ b/Common/DocxFormat/Source/Base/DateTime.h @@ -1,66 +1,66 @@ -/* - * (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 -#ifndef UTILITY_DATE_TIME_INCLUDE_H_ -#define UTILITY_DATE_TIME_INCLUDE_H_ - -#include "../Base/Base.h" - -//---------------------------------------------------------------------------------------------- -// DateTime -//---------------------------------------------------------------------------------------------- - -class DateTime -{ -public: - DateTime(); - DateTime(const std::wstring& sValue, const std::wstring &sPattern); - -public: - - const std::wstring ToString(const std::wstring &sPattern) const; - - static const DateTime Parse (const std::wstring &sValue, const std::wstring &sPattern); - static const int ParseValue(const std::wstring &sValue, const std::wstring &sPattern, const std::wstring &sElement); - -private: - - int m_nYear; - int m_nMonth; - int m_nDay; - int m_nHour; - int m_nMinute; - int m_nSecond; - int m_nMillisecond; -}; - -#endif // UTILITY_DATE_TIME_INCLUDE_H_ +/* + * (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 +#ifndef UTILITY_DATE_TIME_INCLUDE_H_ +#define UTILITY_DATE_TIME_INCLUDE_H_ + +#include "./Base.h" + +//---------------------------------------------------------------------------------------------- +// DateTime +//---------------------------------------------------------------------------------------------- + +class DateTime +{ +public: + DateTime(); + DateTime(const std::wstring& sValue, const std::wstring &sPattern); + +public: + + const std::wstring ToString(const std::wstring &sPattern) const; + + static const DateTime Parse (const std::wstring &sValue, const std::wstring &sPattern); + static const int ParseValue(const std::wstring &sValue, const std::wstring &sPattern, const std::wstring &sElement); + +private: + + int m_nYear; + int m_nMonth; + int m_nDay; + int m_nHour; + int m_nMinute; + int m_nSecond; + int m_nMillisecond; +}; + +#endif // UTILITY_DATE_TIME_INCLUDE_H_ diff --git a/Common/DocxFormat/Source/Base/Nullable.h b/Common/DocxFormat/Source/Base/Nullable.h index f4bdb1feee..c227e009c9 100644 --- a/Common/DocxFormat/Source/Base/Nullable.h +++ b/Common/DocxFormat/Source/Base/Nullable.h @@ -31,19 +31,15 @@ */ #pragma once +#include "Base.h" +#include "Unit.h" #include "SmartPtr.h" #include "../../../../DesktopEditor/xml/include/xmlutils.h" - -#include "../XML/Utils.h" - -#include "../Base/Base.h" -#include "../../../Base64.h" - #include "../../../../ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObject.h" namespace NSCommon { - template + template class nullable_base { protected: @@ -64,14 +60,14 @@ namespace NSCommon { RELEASEOBJECT(m_pPointer); } - Type& operator*() { return *m_pPointer; } - Type* operator->() { return m_pPointer; } + Type& operator*() { return *m_pPointer; } + Type* operator->() { return m_pPointer; } - Type& operator*() const { return *m_pPointer; } - Type* operator->() const { return m_pPointer; } + Type& operator*() const { return *m_pPointer; } + Type* operator->() const { return m_pPointer; } - const Type& get()const { return *m_pPointer; } - Type& get() { return *m_pPointer; } + const Type& get()const { return *m_pPointer; } + Type& get() { return *m_pPointer; } nullable_base& operator=(const nullable_base &oOther) { @@ -94,23 +90,23 @@ namespace NSCommon m_pPointer = new Type(oSrc); return *this; } - bool IsInit() const - { - return (NULL != m_pPointer); + bool IsInit() const + { + return (NULL != m_pPointer); } - bool is_init() const + bool is_init() const { return IsInit(); } - void reset(Type* pType = NULL) + void reset(Type* pType = NULL) { RELEASEOBJECT(m_pPointer); m_pPointer = pType; } }; - template + template class nullable : public nullable_base { public: @@ -120,183 +116,183 @@ namespace NSCommon nullable(const nullable& oOther) { if ( NULL == oOther.m_pPointer ) - this->m_pPointer = NULL; + this->m_pPointer = NULL; else - this->m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) ); + this->m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) ); } - nullable(const XmlUtils::CXmlNode& oNode) // const modifier is important for gcc compiler in our case - { - if (oNode.IsValid()) - this->m_pPointer = new Type(const_cast (oNode)); - else - this->m_pPointer = NULL; - } - - nullable(XmlUtils::CXmlNode& oNode) - { - if (oNode.IsValid()) - this->m_pPointer = new Type(oNode); - else - this->m_pPointer = NULL; - } - - nullable(XmlUtils::CXmlLiteReader& oReader) - { + nullable(const XmlUtils::CXmlNode& oNode) // const modifier is important for gcc compiler in our case + { + if (oNode.IsValid()) + this->m_pPointer = new Type(const_cast (oNode)); + else + this->m_pPointer = NULL; + } + + nullable(XmlUtils::CXmlNode& oNode) + { + if (oNode.IsValid()) + this->m_pPointer = new Type(oNode); + else + this->m_pPointer = NULL; + } + + nullable(XmlUtils::CXmlLiteReader& oReader) + { if (oReader.IsValid()) - this->m_pPointer = new Type(oReader); - else - this->m_pPointer = NULL; - } + this->m_pPointer = new Type(oReader); + else + this->m_pPointer = NULL; + } - nullable(XLS::BaseObjectPtr& obj) - { - if (obj != nullptr) - this->m_pPointer = new Type(obj); - else - this->m_pPointer = NULL; - } + nullable(XLS::BaseObjectPtr& obj) + { + if (obj != nullptr) + this->m_pPointer = new Type(obj); + else + this->m_pPointer = NULL; + } - nullable(std::vector& obj) - { - if (!obj.empty()) - this->m_pPointer = new Type(obj); - else - this->m_pPointer = NULL; - } + nullable(std::vector& obj) + { + if (!obj.empty()) + this->m_pPointer = new Type(obj); + else + this->m_pPointer = NULL; + } - nullable& operator=(XLS::BaseObjectPtr& obj) - { - RELEASEOBJECT(this->m_pPointer); - if (obj != nullptr) - this->m_pPointer = new Type(obj); - return *this; - } + nullable& operator=(XLS::BaseObjectPtr& obj) + { + RELEASEOBJECT(this->m_pPointer); + if (obj != nullptr) + this->m_pPointer = new Type(obj); + return *this; + } - nullable& operator=(std::vector& obj) - { - RELEASEOBJECT(this->m_pPointer); - if (!obj.empty()) - this->m_pPointer = new Type(obj); - return *this; - } + nullable& operator=(std::vector& obj) + { + RELEASEOBJECT(this->m_pPointer); + if (!obj.empty()) + this->m_pPointer = new Type(obj); + return *this; + } nullable& operator=(XmlUtils::CXmlNode& oNode) { - RELEASEOBJECT(this->m_pPointer); + RELEASEOBJECT(this->m_pPointer); if (oNode.IsValid()) - this->m_pPointer = new Type(oNode); + this->m_pPointer = new Type(oNode); return *this; } nullable& operator=(XmlUtils::CXmlLiteReader& oReader) { - RELEASEOBJECT(this->m_pPointer); + RELEASEOBJECT(this->m_pPointer); if (oReader.IsValid()) - this->m_pPointer = new Type(oReader); + this->m_pPointer = new Type(oReader); return *this; } nullable& operator=(const wchar_t* cwsValue) { - RELEASEOBJECT(this->m_pPointer); + RELEASEOBJECT(this->m_pPointer); if (NULL != cwsValue) - this->m_pPointer = new Type( cwsValue ); + this->m_pPointer = new Type( cwsValue ); return *this; } nullable& operator=(const nullable &oOther) { - RELEASEOBJECT(this->m_pPointer); + RELEASEOBJECT(this->m_pPointer); if ( NULL != oOther.m_pPointer ) - this->m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) ); + this->m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) ); return *this; } nullable& operator=(Type* pType) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = pType; + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = pType; return *this; } nullable& operator=(Type& oSrc) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new Type(oSrc); + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = new Type(oSrc); return *this; } nullable& operator=(const Type& oSrc) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new Type(oSrc); + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = new Type(oSrc); return *this; } const bool operator==(const nullable& oOther) const { - if ( !this->m_pPointer && !oOther.m_pPointer ) + if ( !this->m_pPointer && !oOther.m_pPointer ) return true; - else if ( !this->m_pPointer || !oOther.m_pPointer ) + else if ( !this->m_pPointer || !oOther.m_pPointer ) return false; - return (*this->m_pPointer) == (*(oOther.m_pPointer)); + return (*this->m_pPointer) == (*(oOther.m_pPointer)); } const bool operator==(const Type& oOther) const { - if ( !this->m_pPointer ) + if ( !this->m_pPointer ) return false; - return (*this->m_pPointer) == oOther; + return (*this->m_pPointer) == oOther; } - Type& operator*() { return *this->m_pPointer; } - Type* operator->() { return this->m_pPointer; } + Type& operator*() { return *this->m_pPointer; } + Type* operator->() { return this->m_pPointer; } - Type& operator*() const { return *this->m_pPointer; } - Type* operator->() const { return this->m_pPointer; } + Type& operator*() const { return *this->m_pPointer; } + Type* operator->() const { return this->m_pPointer; } - const Type& get()const { return *this->m_pPointer; } - Type& get2()const { return *this->m_pPointer; } + const Type& get()const { return *this->m_pPointer; } + Type& get2()const { return *this->m_pPointer; } template const bool is()const { - if (NULL == this->m_pPointer) + if (NULL == this->m_pPointer) return false; - T* pResult = dynamic_cast(const_cast(this->m_pPointer)); + T* pResult = dynamic_cast(const_cast(this->m_pPointer)); return (NULL != pResult); } template const T& as()const { - T* pResult = dynamic_cast(const_cast(this->m_pPointer)); + T* pResult = dynamic_cast(const_cast(this->m_pPointer)); return *pResult; } template T& as() { - T* pResult = dynamic_cast(const_cast(this->m_pPointer)); + T* pResult = dynamic_cast(const_cast(this->m_pPointer)); return *pResult; } - bool Init() + bool Init() { - RELEASEOBJECT(this->m_pPointer); + RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new Type; + this->m_pPointer = new Type; - return this->IsInit(); + return this->IsInit(); } Type* GetPointer() const { - return this->m_pPointer; + return this->m_pPointer; } //GetPointerEmptyNullable - небезопасная операция, использовать при крайней необходимости //Передает указатель и очищает nullable, в дальнейшем память надо удалять самостоятельно Type* GetPointerEmptyNullable() { - Type* pOldPointer = this->m_pPointer; - this->m_pPointer = NULL; - return pOldPointer; + Type* pOldPointer = this->m_pPointer; + this->m_pPointer = NULL; + return pOldPointer; } }; - template + template class nullable_limit : public nullable_base { public: @@ -304,60 +300,60 @@ namespace NSCommon { } - void operator=(const std::wstring& value) + void operator=(const std::wstring& value) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new Type(); - this->m_pPointer->_set(value); + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = new Type(); + this->m_pPointer->_set(value); } - void operator=(Type* pType) + void operator=(Type* pType) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = pType; + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = pType; } - void operator=(const BYTE& value) + void operator=(const BYTE& value) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new Type(); - this->m_pPointer->SetBYTECode(value); + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = new Type(); + this->m_pPointer->SetBYTECode(value); } - void operator=(const Type& value) + void operator=(const Type& value) { *this = value.get(); } nullable_limit& operator=(const nullable_limit& oSrc) { - RELEASEOBJECT(this->m_pPointer); + RELEASEOBJECT(this->m_pPointer); if ( NULL != oSrc.m_pPointer ) { - this->m_pPointer = new Type(); - this->m_pPointer->set(oSrc->get()); + this->m_pPointer = new Type(); + this->m_pPointer->set(oSrc->get()); } return *this; } - const std::wstring& get_value_or(const std::wstring& value) const + const std::wstring& get_value_or(const std::wstring& value) const { - if (NULL == this->m_pPointer) + if (NULL == this->m_pPointer) return value; - return this->m_pPointer->get(); + return this->m_pPointer->get(); } - const std::wstring& get_value() const + const std::wstring& get_value() const { - return this->m_pPointer->get(); + return this->m_pPointer->get(); } - Type& operator*() { return *this->m_pPointer; } - Type* operator->() { return this->m_pPointer; } + Type& operator*() { return *this->m_pPointer; } + Type* operator->() { return this->m_pPointer; } - Type& operator*() const { return *this->m_pPointer; } - Type* operator->() const { return this->m_pPointer; } + Type& operator*() const { return *this->m_pPointer; } + Type* operator->() const { return this->m_pPointer; } - const Type& get()const { return *this->m_pPointer; } + const Type& get()const { return *this->m_pPointer; } }; class nullable_int : public nullable_base @@ -366,7 +362,7 @@ namespace NSCommon nullable_int() : nullable_base() { } - void normalize(const int& min, const int& max) + void normalize(const int& min, const int& max) { if (IsInit()) { @@ -376,7 +372,7 @@ namespace NSCommon *m_pPointer = max; } } - void normalize_positive() + void normalize_positive() { if (IsInit()) { @@ -393,15 +389,15 @@ namespace NSCommon return *this; } - void operator=(const std::wstring& value) + void operator=(const std::wstring& value) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new int(XmlUtils::GetInteger(value)); + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = new int(XmlUtils::GetInteger(value)); } - void operator=(const int& value) + void operator=(const int& value) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new int(value); + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = new int(value); } std::wstring ToString() const { @@ -417,19 +413,19 @@ namespace NSCommon } const bool operator==(const nullable_int& oOther) const { - if ( !this->m_pPointer ) + if ( !this->m_pPointer ) return false; - return (*this->m_pPointer) == *oOther; + return (*this->m_pPointer) == *oOther; } const bool operator==(const int& oOther) const { - if ( !this->m_pPointer ) + if ( !this->m_pPointer ) return false; - return (*this->m_pPointer) == oOther; + return (*this->m_pPointer) == oOther; } - int get_value_or(const int& value) const + int get_value_or(const int& value) const { if (NULL == m_pPointer) { @@ -447,12 +443,12 @@ namespace NSCommon return L""; } int& operator*() { return *m_pPointer; } - int* operator->() { return m_pPointer; } + int* operator->() { return m_pPointer; } - int& operator*() const { return *m_pPointer; } - int* operator->() const { return m_pPointer; } + int& operator*() const { return *m_pPointer; } + int* operator->() const { return m_pPointer; } - const int& get()const { return *m_pPointer; } + const int& get()const { return *m_pPointer; } }; class nullable_uint : public nullable_base { @@ -525,13 +521,13 @@ namespace NSCommon const unsigned int& get()const { return *m_pPointer; } }; - class nullable_int64 : public nullable_base<_INT64> + class nullable_int64 : public nullable_base<_INT64> { public: - nullable_int64() : nullable_base<_INT64>() + nullable_int64() : nullable_base<_INT64>() { } - void normalize(const _INT64& min, const _INT64& max) + void normalize(const _INT64& min, const _INT64& max) { if (IsInit()) { @@ -541,7 +537,7 @@ namespace NSCommon *m_pPointer = max; } } - void normalize_positive() + void normalize_positive() { if (IsInit()) { @@ -549,32 +545,32 @@ namespace NSCommon *m_pPointer = 0; } } - nullable_int64& operator=(const wchar_t* cwsValue) + nullable_int64& operator=(const wchar_t* cwsValue) { RELEASEOBJECT(m_pPointer); if ( NULL != cwsValue ) - m_pPointer = new _INT64(XmlUtils::GetInteger64(cwsValue)); + m_pPointer = new _INT64(XmlUtils::GetInteger64(cwsValue)); return *this; } - void operator=(const std::wstring& value) + void operator=(const std::wstring& value) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new _INT64(XmlUtils::GetInteger64(value)); + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = new _INT64(XmlUtils::GetInteger64(value)); } - void operator=(const _INT64& value) + void operator=(const _INT64& value) { - RELEASEOBJECT(this->m_pPointer); - this->m_pPointer = new _INT64(value); + RELEASEOBJECT(this->m_pPointer); + this->m_pPointer = new _INT64(value); } - nullable_int64& operator=(const nullable_int64& oSrc) + nullable_int64& operator=(const nullable_int64& oSrc) { RELEASEOBJECT(m_pPointer); if (NULL != oSrc.m_pPointer ) - m_pPointer = new _INT64(*oSrc); + m_pPointer = new _INT64(*oSrc); return *this; } std::wstring ToAttribute(const std::wstring & name) const @@ -585,7 +581,7 @@ namespace NSCommon } return L""; } - _INT64 get_value_or(const _INT64& value) const + _INT64 get_value_or(const _INT64& value) const { if (NULL == m_pPointer) { @@ -594,13 +590,13 @@ namespace NSCommon } return *m_pPointer; } - _INT64& operator*() { return *m_pPointer; } - _INT64* operator->() { return m_pPointer; } + _INT64& operator*() { return *m_pPointer; } + _INT64* operator->() { return m_pPointer; } - _INT64& operator*() const { return *m_pPointer; } - _INT64* operator->() const { return m_pPointer; } + _INT64& operator*() const { return *m_pPointer; } + _INT64* operator->() const { return m_pPointer; } - const _INT64& get()const { return *m_pPointer; } + const _INT64& get()const { return *m_pPointer; } }; class nullable_sizet : public nullable_base { @@ -609,7 +605,7 @@ namespace NSCommon { } - void normalize(const size_t& max) + void normalize(const size_t& max) { if (IsInit()) { @@ -626,7 +622,7 @@ namespace NSCommon return *this; } - void operator=(const size_t& value) + void operator=(const size_t& value) { RELEASEOBJECT(m_pPointer); m_pPointer = new size_t(value); @@ -640,7 +636,7 @@ namespace NSCommon return *this; } - size_t get_value_or(const size_t& value) const + size_t get_value_or(const size_t& value) const { if (NULL == m_pPointer) { @@ -658,12 +654,12 @@ namespace NSCommon return L""; } size_t& operator*() { return *m_pPointer; } - size_t* operator->() { return m_pPointer; } + size_t* operator->() { return m_pPointer; } - size_t& operator*() const { return *m_pPointer; } - size_t* operator->() const { return m_pPointer; } + size_t& operator*() const { return *m_pPointer; } + size_t* operator->() const { return m_pPointer; } - const size_t& get()const { return *m_pPointer; } + const size_t& get()const { return *m_pPointer; } }; class nullable_double : public nullable_base { @@ -671,7 +667,7 @@ namespace NSCommon nullable_double() : nullable_base() { } - void normalize(const double& min, const double& max) + void normalize(const double& min, const double& max) { if (IsInit()) { @@ -681,16 +677,16 @@ namespace NSCommon *m_pPointer = max; } } - nullable_double& operator=(const std::wstring & sValue) + nullable_double& operator=(const std::wstring & sValue) { RELEASEOBJECT(m_pPointer); - if ( !sValue.empty() ) - m_pPointer = new double(XmlUtils::GetDouble(sValue)); + if ( !sValue.empty() ) + m_pPointer = new double(XmlUtils::GetDouble(sValue)); return *this; } - void operator=(const double& value) + void operator=(const double& value) { RELEASEOBJECT(m_pPointer); m_pPointer = new double(value); @@ -712,7 +708,7 @@ namespace NSCommon return *this; } - double get_value_or(const double& value) const + double get_value_or(const double& value) const { if (NULL == m_pPointer) { @@ -721,13 +717,13 @@ namespace NSCommon } return *m_pPointer; } - double& operator*() { return *m_pPointer; } - double* operator->() { return m_pPointer; } + double& operator*() { return *m_pPointer; } + double* operator->() { return m_pPointer; } - double& operator*() const { return *m_pPointer; } - double* operator->() const { return m_pPointer; } + double& operator*() const { return *m_pPointer; } + double* operator->() const { return m_pPointer; } - const double& get()const { return *m_pPointer; } + const double& get()const { return *m_pPointer; } }; class nullable_bool : public nullable_base { @@ -736,14 +732,14 @@ namespace NSCommon { } protected: - bool set(const std::wstring& value) + bool set(const std::wstring& value) { - if ((L"true" == value) || (L"1" == value)) + if ((L"true" == value) || (L"1" == value)) return true; return false; } public: - nullable_bool& operator=(const std::wstring &sValue) + nullable_bool& operator=(const std::wstring &sValue) { RELEASEOBJECT(m_pPointer); @@ -761,7 +757,7 @@ namespace NSCommon return *this; } - void operator=(const bool& value) + void operator=(const bool& value) { RELEASEOBJECT(m_pPointer); m_pPointer = new bool(value); @@ -784,7 +780,7 @@ namespace NSCommon } return L""; } - bool get_value_or(const bool& value) const + bool get_value_or(const bool& value) const { if (NULL == m_pPointer) { @@ -794,13 +790,13 @@ namespace NSCommon return *m_pPointer; } - bool& operator*() { return *m_pPointer; } - bool* operator->() { return m_pPointer; } + bool& operator*() { return *m_pPointer; } + bool* operator->() { return m_pPointer; } - bool& operator*() const { return *m_pPointer; } - bool* operator->() const { return m_pPointer; } + bool& operator*() const { return *m_pPointer; } + bool* operator->() const { return m_pPointer; } - const bool& get()const { return *m_pPointer; } + const bool& get()const { return *m_pPointer; } }; class nullable_string : public nullable_base @@ -809,7 +805,7 @@ namespace NSCommon nullable_string() : nullable_base() { } - nullable_string(const nullable_string& oOther) + nullable_string(const nullable_string& oOther) { if (NULL == oOther.m_pPointer) m_pPointer = NULL; @@ -866,12 +862,12 @@ namespace NSCommon } return L""; } - std::wstring& operator*() { return *m_pPointer; } - std::wstring* operator->() { return m_pPointer; } + std::wstring& operator*() { return *m_pPointer; } + std::wstring* operator->() { return m_pPointer; } - std::wstring& operator*() const { return *m_pPointer; } - std::wstring* operator->() const { return m_pPointer; } + std::wstring& operator*() const { return *m_pPointer; } + std::wstring* operator->() const { return m_pPointer; } - std::wstring& get()const { return *m_pPointer; } + std::wstring& get()const { return *m_pPointer; } }; } diff --git a/Common/DocxFormat/Source/Base/SmartPtr.h b/Common/DocxFormat/Source/Base/SmartPtr.h index 26eebebc06..75f3210da3 100644 --- a/Common/DocxFormat/Source/Base/SmartPtr.h +++ b/Common/DocxFormat/Source/Base/SmartPtr.h @@ -198,3 +198,7 @@ namespace NSCommon value = max; } } + +#ifndef _USE_NULLABLE_PROPERTY_ +using namespace NSCommon; +#endif diff --git a/Common/DocxFormat/Source/Base/Unit.cpp b/Common/DocxFormat/Source/Base/Unit.cpp new file mode 100644 index 0000000000..798c1f9fe0 --- /dev/null +++ b/Common/DocxFormat/Source/Base/Unit.cpp @@ -0,0 +1,936 @@ +/* + * (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 "Unit.h" +#include + + +double Cm_To_Mm (const double &dValue) +{ + return dValue * 10; +} + +double Cm_To_Pt (const double &dValue) +{ + return dValue * 72 / 2.54; +} + +double Cm_To_Px (const double &dValue) +{ + return dValue * 72 * 4 / 3 / 2.54; +} + +double Cm_To_Inch (const double &dValue) +{ + return dValue / 2.54; +} + +double Cm_To_Dx (const double &dValue) +{ + return dValue * 72 * 20 / 2.54; +} + +double Cm_To_Sx (const double &dValue) +{ + return dValue * 72 * 100 * 1000 / 20; +} + +double Cm_To_Multi (const double &dValue) +{ + return dValue * 72 * 20 / 2.54; +} +double Cm_To_Emu (const double &dValue) +{ + return dValue * 360000; +} + +double Mm_To_Cm (const double &dValue) +{ + return dValue / 10; +} + +double Mm_To_Pt (const double &dValue) +{ + return dValue * 72 / 10 / 2.54; +} + +double Mm_To_Px (const double &dValue) +{ + return dValue * 72 * 4 / 3 / 10 / 2.54; +} + +double Mm_To_Inch (const double &dValue) +{ + return dValue / 2.54 / 10; +} + +double Mm_To_Dx (const double &dValue) +{ + return dValue * 72 * 20 / 10 / 2.54; +} + +double Mm_To_Sx (const double &dValue) +{ + return dValue * 72 * 100 * 1000 / 10 / 20; +} + +double Mm_To_Multi (const double &dValue) +{ + return dValue * 72 * 20 / 10 / 2.54; +} + +double Mm_To_Emu (const double &dValue) +{ + return dValue * 36000; +} + +double Pt_To_Cm (const double &dValue) +{ + return dValue * 2.54 / 72; +} + +double Pt_To_Mm (const double &dValue) +{ + return dValue * 2.54 * 10 / 72; +} + +double Pt_To_Px (const double &dValue) +{ + return dValue * 4 / 3; +} + +double Pt_To_Inch (const double &dValue) +{ + return dValue / 72; +} + +double Pt_To_Dx (const double &dValue) +{ + return dValue * 20; +} + +double Pt_To_Sx (const double &dValue) +{ + return dValue * 2.54 * 100 * 1000 / 20; +} + +double Pt_To_Multi (const double &dValue) +{ + return dValue * 20; +} + +double Pt_To_Emu (const double &dValue) +{ + return dValue * 12700; +} + +double Px_To_Cm (const double &dValue) +{ + return dValue * 2.54 * 3/ 72 / 4; +} + +double Px_To_Mm (const double &dValue) +{ + return dValue * 2.54 * 10 * 3/ 72 /4; +} + +double Px_To_Pt (const double &dValue) +{ + return dValue * 3 / 4; +} + +double Px_To_Inch (const double &dValue) +{ + return dValue * 3 / 72 / 4; +} + +double Px_To_Dx (const double &dValue) +{ + return dValue * 20 * 3 / 4; +} +double Px_To_Sx (const double &dValue) +{ + return dValue * 2.54 * 100 * 1000 * 3/ 20 / 4; +} + +double Px_To_Multi (const double &dValue) +{ + return dValue * 20 * 3 / 4; +} + +double Px_To_Emu (const double &dValue) +{ + return dValue * 9525; +} + +double Inch_To_Cm (const double &dValue) +{ + return dValue * 2.54; +} + +double Inch_To_Mm (const double &dValue) +{ + return dValue * 2.54 * 10; +} + +double Inch_To_Pt (const double &dValue) +{ + return dValue * 72; +} + +double Inch_To_Px (const double &dValue) +{ + return dValue * 72 * 4 / 3; +} + +double Inch_To_Dx (const double &dValue) +{ + return dValue * 72 * 20; +} + +double Inch_To_Sx (const double &dValue) +{ + return dValue * 1000 * 100 * 2.54 * 72 / 20; +} + +double Inch_To_Multi(const double &dValue) +{ + return dValue * 72 * 20; +} +double Inch_To_Emu (const double &dValue) +{ + return dValue * 914400; +} + +double Dx_To_Cm (const double &dValue) +{ + return dValue * 2.54 / 72 / 20; +} + +double Dx_To_Mm (const double &dValue) +{ + return dValue * 2.54 * 10 / 72 / 20; +} + +double Dx_To_Pt (const double &dValue) +{ + return dValue / 20; +} + + +double Dx_To_Px (const double &dValue) +{ + return dValue * 4 / 3 / 20; +} + +double Dx_To_Inch (const double &dValue) +{ + return dValue / 20 / 72; +} + +double Dx_To_Sx (const double &dValue) +{ + return dValue * 635; +} + +double Dx_To_Multi (const double &dValue) +{ + return dValue; +} + +double Dx_To_Emu (const double &dValue) +{ + return dValue * 635; +} + +double Sx_To_Cm (const double &dValue) +{ + return dValue * 20 / 72 / 100 / 1000; +} + +double Sx_To_Mm (const double &dValue) +{ + return dValue * 20 / 72 / 100 / 1000 * 10; +} + +double Sx_To_Pt (const double &dValue) +{ + return dValue * 20 / 100 / 1000 / 2.54; +} + +double Sx_To_Px (const double &dValue) +{ + return dValue * 20 * 4 / 3 / 100 / 1000 / 2.54; +} + +double Sx_To_Inch (const double &dValue) +{ + return dValue * 20 / 2.54 / 72 / 100 / 1000; +} + +double Sx_To_Dx (const double &dValue) +{ + return dValue * 20 * 20 / 2.54 / 100 / 1000; +} + +double Sx_To_Multi (const double &dValue) +{ + return dValue * 20 * 20 / 2.54 / 100 / 1000; +} + +double Sx_To_Emu (const double &dValue) +{ + return dValue; +} + +double Multi_To_Cm (const double &dValue) +{ + return dValue * 2.54 / 72 / 20; +} + +double Multi_To_Mm (const double &dValue) +{ + return dValue * 2.54 * 10 / 72 / 20; +} + +double Multi_To_Pt (const double &dValue) +{ + return dValue / 20; +} + +double Multi_To_Px (const double &dValue) +{ + return dValue * 4 / 3 / 20; +} + +double Multi_To_Inch(const double &dValue) +{ + return dValue / 20 / 72; +} + +double Multi_To_Sx (const double &dValue) +{ + return dValue * 635; +} + +double Multi_To_Dx (const double &dValue) +{ + return dValue; +} + +double Multi_To_Emu (const double &dValue) +{ + return dValue * 635; +} + +double Emu_To_Cm (const double &dValue) +{ + return dValue / 360000; +} +double Emu_To_Mm (const double &dValue) +{ + return dValue / 36000; +} + +double Emu_To_Pt (const double &dValue) +{ + return dValue / 12700; +} + +double Emu_To_Twips (const double &dValue) +{ + return dValue / 635; +} + +double Emu_To_Px (const double &dValue) +{ + return dValue / 9525; +} + +double Emu_To_Inch (const double &dValue) +{ + return dValue / 914400; +} + +double Emu_To_Sx (const double &dValue) +{ + return dValue; +} + +double Emu_To_Dx (const double &dValue) +{ + return dValue / 635; +} + +double Emu_To_Multi (const double &dValue) +{ + return dValue / 635; +} + +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning (disable: 4100 4189) +#endif + +#include +#include + +namespace XmlUtils +{ + // common + int GetDigit(wchar_t c) + { + if (c >= '0' && c <= '9') + return (int)(c - '0'); + if (c >= 'a' && c <= 'f') + return 10 + (int)(c - 'a'); + if (c >= 'A' && c <= 'F') + return 10 + (int)(c - 'A'); + + return 0; + } + int GetDigit(char c) + { + if (c >= '0' && c <= '9') + return (int)(c - '0'); + if (c >= 'a' && c <= 'f') + return 10 + (int)(c - 'a'); + if (c >= 'A' && c <= 'F') + return 10 + (int)(c - 'A'); + + return 0; + } + bool IsDigit(wchar_t c) + { + if (c >= '0' && c <= '9') + return true; + return false; + } + + _INT64 GetHex(const std::wstring& string) + { + _INT64 nResult = 0; + size_t nLen = string.length(); + for (size_t nIndex = 0; nIndex < nLen; ++nIndex ) + { + nResult += GetDigit( string[nIndex] ) << ( 4 * ( nLen - 1 - nIndex ) ); + } + + return nResult; + } + _INT64 GetHex(const std::string& string) + { + _INT64 nResult = 0; + size_t nLen = string.length(); + for (size_t nIndex = 0; nIndex < nLen; ++nIndex ) + { + nResult += GetDigit( string[nIndex] ) << ( 4 * ( nLen - 1 - nIndex ) ); + } + + return nResult; + } + int GetColorBGR(const std::wstring& string) + { + // variables + int blue = 0; + int green = 0; + int red = 0; + + std::wstring color = string; //boost::algorithm::trim(color); + + if (color.find(L"0x") != -1) color.erase(0, 2); + if (color.find(L"#") != -1) color.erase(0, 1); + + while (color.length() < 6) + color = L"0" + color; + + red = 16*GetDigit(color[0]) + GetDigit(color[1]); + green = 16*GetDigit(color[2]) + GetDigit(color[3]); + blue = 16*GetDigit(color[4]) + GetDigit(color[5]); + + return ((int)(((BYTE)(red)|((WORD)((BYTE)(green))<<8))|(((DWORD)(BYTE)(blue))<<16))); //RGB(red, green, blue); + } + + std::wstring GetLower(const std::wstring& string) + { + std::wstring sResult; + + for( size_t nIndex = 0; nIndex < string.length(); nIndex++) + sResult += wchar_t( towlower(string[nIndex]) ); + + return sResult; + } + std::wstring GetUpper(const std::wstring& string) + { + std::wstring sResult; + + for( size_t nIndex = 0; nIndex < string.length(); nIndex++) + sResult += wchar_t( towupper(string[nIndex]) ); + + return sResult; + } + + void replace_all(std::wstring& subject, const std::wstring& search, const std::wstring& replace) + { + size_t pos = 0; + while ((pos = subject.find(search, pos)) != std::wstring::npos) + { + subject.replace(pos, search.length(), replace); + pos += replace.length(); + } + } + void replace_all(std::string& subject, const std::string& search, const std::string& replace) + { + size_t pos = 0; + while ((pos = subject.find(search, pos)) != std::string::npos) + { + subject.replace(pos, search.length(), replace); + pos += replace.length(); + } + } + + bool GetBoolean (const std::wstring& string) + { + std::wstring s = XmlUtils::GetLower(string); + + return (s == L"true"); + } + bool GetBoolean2(const std::wstring& string) + { + std::wstring sTemp = XmlUtils::GetLower(string); + + return ( L"true" == sTemp || L"1" == sTemp || L"t" == sTemp || L"on" == sTemp ); + } + _INT64 GetInteger64(const std::wstring& string) + { + if (string.empty()) return 0; + + try + { + return std::wcstoll(string.c_str(), NULL, 10); + } + catch(...) + { + return 0; + } + } + int GetInteger(const std::wstring& string) + { + if (string.empty()) return 0; + + int iVal = 0; + try + { + iVal = std::stod(string); + } + catch(...) + { + try + { + iVal = std::wcstoll(string.c_str(), NULL, 10); + } + catch(...) + { + return 0; + } + } + + return iVal; + } + unsigned int GetUInteger(const std::wstring& string) + { + return (unsigned int)GetInteger(string); + } + double GetDouble(const std::wstring& string) + { + if (string.empty()) return 0; + + double d = 0; +#if defined (_WIN32) || defined (_WIN64) + swscanf_s(string.c_str(), L"%lf", &d); +#else + swscanf(string.c_str(), L"%lf", &d); +#endif + return d; + } + float GetFloat(const std::wstring& string) + { + if (string.empty()) return 0; + + float f = 0; +#if defined (_WIN32) || defined (_WIN64) + swscanf_s(string.c_str(), L"%f", &f); +#else + swscanf(string.c_str(), L"%f", &f); +#endif + return f; + } + + std::wstring ToString (const bool & value) + { + return ( value ? L"true" : L"false" ); + } + std::wstring ToString (const float & 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); + } + + std::wstring ToString( int value, const wchar_t* format ) + { + if ( format == NULL ) return L""; + std::wstringstream sstream; + sstream << boost::wformat(format) % value; + return sstream.str(); + } + std::string ToString( int value, const char* format ) + { + if ( format == NULL ) return ""; + std::stringstream sstream; + sstream << boost::format(format) % value; + return sstream.str(); + } + + int Rand() + { + //rand returns integral value range between 0 and RAND_MAX.(RAND_MAX at least 32767.) + static bool init = false; /* ensure different random header each time */ + if (!init) + { + init = true; + srand((unsigned int) time(NULL)); + } + return std::rand(); + } + int GenerateInt() + { + //todo c++11 + return ((Rand() & 0x7FFF) | ((Rand() & 0x7FFF) << 15) | ((Rand() & 0x3) << 30)); + } + + std::wstring GenerateGuid() + { + std::wstring result; + //#if defined (_WIN32) || defined(_WIN64) + // GUID guid; + // CoCreateGuid(&guid); + // + // OLECHAR* guidString; + // StringFromCLSID(guid, &guidString); + // + // result = std::wstring(guidString); + // + // CoTaskMemFree(guidString); + //#else + std::wstringstream sstream; + sstream << boost::wformat(L"%04X%04X-%04X-%04X-%04X-%04X%04X%04X") % (Rand() & 0xff) % (Rand() & 0xff) % (Rand() & 0xff) % ((Rand() & 0x0fff) | 0x4000) % ((Rand() % 0x3fff) + 0x8000) % (Rand() & 0xff) % (Rand() & 0xff) % (Rand() & 0xff); + result = sstream.str(); + //#endif + return result; + } + std::wstring DoubleToString( double value, wchar_t* format ) + { + if ( format == NULL ) return L""; + + std::wstringstream sstream; + sstream << boost::wformat(format) % value; + return sstream.str(); + } + + bool IsUnicodeSymbol( unsigned int symbol ) + { + bool result = false; + + if ( ( 0x0009 == symbol ) || ( 0x000A == symbol ) || ( 0x000D == symbol ) || + ( ( 0x0020 <= symbol ) && ( 0xD7FF >= symbol ) ) || ( ( 0xE000 <= symbol ) && ( symbol <= 0xFFFD ) ) || + ( ( 0x10000 <= symbol ) && symbol ) ) + { + result = true; + } + + return result; + } + + std::string EncodeXmlString(const std::string& data, bool bDeleteNoUnicode) + { + std::string buffer; + buffer.reserve(data.size()); + + if(bDeleteNoUnicode) + { + for(size_t pos = 0; pos < data.size(); ++pos) + { + switch(data[pos]) + { + case '&': buffer.append("&"); break; + case '\"': buffer.append("""); break; + case '\'': buffer.append("'"); break; + case '<': buffer.append("<"); break; + case '>': buffer.append(">"); break; + default: + { + if ( false == IsUnicodeSymbol( data[pos] ) ) + { + wchar_t symbol1 = data[pos]; + if(0xD800 <= symbol1 && symbol1 <= 0xDFFF && pos + 1 < data.size()) + { + pos++; + wchar_t symbol2 = data[pos]; + if (symbol1 < 0xDC00 && symbol2 >= 0xDC00 && symbol2 <= 0xDFFF) + { + buffer.append(&data[pos-1], 2); + } + else + { + buffer.append(" "); + } + } + else + { + buffer.append(" "); + } + } + else + buffer.append(&data[pos], 1); + }break; + } + } + } + else + { + for(size_t pos = 0; pos < data.size(); ++pos) + { + switch(data[pos]) + { + case '&': buffer.append("&"); break; + case '\"': buffer.append("""); break; + case '\'': buffer.append("'"); break; + case '<': buffer.append("<"); break; + case '>': buffer.append(">"); break; + case '\0': + return buffer; + default: buffer.append(&data[pos], 1); break; + } + } + } + + return buffer; + } + std::wstring EncodeXmlString(const std::wstring& data, bool bDeleteNoUnicode) + { + std::wstring buffer; + buffer.reserve(data.size()); + + if(bDeleteNoUnicode) + { + for(size_t pos = 0; pos < data.size(); ++pos) + { + switch(data[pos]) + { + case '&': buffer.append(L"&"); break; + case '\"': buffer.append(L"""); break; + case '\'': buffer.append(L"'"); break; + case '<': buffer.append(L"<"); break; + case '>': buffer.append(L">"); break; + default: + { + if ( false == IsUnicodeSymbol( data[pos] ) ) + { + wchar_t symbol1 = data[pos]; + if(0xD800 <= symbol1 && symbol1 <= 0xDFFF && pos + 1 < data.size()) + { + pos++; + wchar_t symbol2 = data[pos]; + if (symbol1 < 0xDC00 && symbol2 >= 0xDC00 && symbol2 <= 0xDFFF) + { + buffer.append(&data[pos-1], 2); + } + else + { + buffer.append(L" "); + } + } + else + { + buffer.append(L" "); + } + } + else + buffer.append(&data[pos], 1); + }break; + } + } + } + else + { + for(size_t pos = 0; pos < data.size(); ++pos) + { + switch(data[pos]) + { + case '&': buffer.append(L"&"); break; + case '\"': buffer.append(L"""); break; + case '\'': buffer.append(L"'"); break; + case '<': buffer.append(L"<"); break; + case '>': buffer.append(L">"); break; + case '\0': + return buffer; + default: buffer.append(&data[pos], 1); break; + } + } + } + + return buffer; + } + std::wstring DeleteNonUnicode(const std::wstring& data) + { + std::wstring buffer; + buffer.reserve(data.size()); + + for (size_t pos = 0; pos < data.size(); ++pos) + { + if (false == IsUnicodeSymbol(data[pos])) + { + wchar_t symbol1 = data[pos]; + if (0xD800 <= symbol1 && symbol1 <= 0xDFFF && pos + 1 < data.size()) + { + pos++; + wchar_t symbol2 = data[pos]; + if (symbol1 < 0xDC00 && symbol2 >= 0xDC00 && symbol2 <= 0xDFFF) + { + buffer.append(&data[pos - 1], 2); + } + else + { + buffer.append(L" "); + } + } + else + { + buffer.append(L" "); + } + } + else + { + buffer.append(&data[pos], 1); + } + } + return buffer; + } + std::wstring EncodeXmlStringExtend(const std::wstring& data, bool bDeleteNoUnicode) + { + std::wstring buffer; + buffer.reserve(data.size()); + + if(bDeleteNoUnicode) + { + for(size_t pos = 0; pos < data.size(); ++pos) + { + switch(data[pos]) + { + case '&': buffer.append(L"&"); break; + case '\"': buffer.append(L"""); break; + case '\'': buffer.append(L"'"); break; + case '<': buffer.append(L"<"); break; + case '>': buffer.append(L">"); break; + case '\n': buffer.append(L" "); break; + case '\r': buffer.append(L" "); break; + case '\t': buffer.append(L" "); break; + default: + { + if ( false == IsUnicodeSymbol( data[pos] ) ) + { + wchar_t symbol1 = data[pos]; + if(0xD800 <= symbol1 && symbol1 <= 0xDFFF && pos + 1 < data.size()) + { + pos++; + wchar_t symbol2 = data[pos]; + if (symbol1 < 0xDC00 && symbol2 >= 0xDC00 && symbol2 <= 0xDFFF) + { + buffer.append(&data[pos-1], 2); + } + else + { + buffer.append(L" "); + } + } + else + { + buffer.append(L" "); + } + } + else + buffer.append(&data[pos], 1); + }break; + } + } + } + else + { + for(size_t pos = 0; pos < data.size(); ++pos) + { + switch(data[pos]) + { + case '&': buffer.append(L"&"); break; + case '\"': buffer.append(L"""); break; + case '\'': buffer.append(L"'"); break; + case '<': buffer.append(L"<"); break; + case '>': buffer.append(L">"); break; + case '\n': buffer.append(L" "); break; + case '\r': buffer.append(L" "); break; + case '\t': buffer.append(L" "); break; + case '\0': + return buffer; + default: buffer.append(&data[pos], 1); break; + } + } + } + + return buffer; + } +} diff --git a/Common/DocxFormat/Source/Base/Unit.h b/Common/DocxFormat/Source/Base/Unit.h new file mode 100644 index 0000000000..52ef1e11d9 --- /dev/null +++ b/Common/DocxFormat/Source/Base/Unit.h @@ -0,0 +1,166 @@ +/* + * (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 +#ifndef _UNIT_INCLUDE_H_ +#define _UNIT_INCLUDE_H_ + +#include "Base.h" +#include "../../../../DesktopEditor/common/Types.h" + +double Cm_To_Mm(const double &dValue); +double Cm_To_Pt(const double &dValue); +double Cm_To_Px(const double &dValue); +double Cm_To_Inch(const double &dValue); +double Cm_To_Dx(const double &dValue); +double Cm_To_Sx(const double &dValue); +double Cm_To_Multi(const double &dValue); +double Cm_To_Emu(const double &dValue); + +double Mm_To_Cm(const double &dValue); +double Mm_To_Pt(const double &dValue); +double Mm_To_Px(const double &dValue); +double Mm_To_Inch(const double &dValue); +double Mm_To_Dx(const double &dValue); +double Mm_To_Sx(const double &dValue); +double Mm_To_Multi(const double &dValue); +double Mm_To_Emu(const double &dValue); + +double Pt_To_Cm(const double &dValue); +double Pt_To_Mm(const double &dValue); +double Pt_To_Px(const double &dValue); +double Pt_To_Inch(const double &dValue); +double Pt_To_Dx(const double &dValue); +double Pt_To_Sx(const double &dValue); +double Pt_To_Multi(const double &dValue); +double Pt_To_Emu(const double &dValue); + +double Px_To_Cm(const double &dValue); +double Px_To_Mm(const double &dValue); +double Px_To_Pt(const double &dValue); +double Px_To_Inch(const double &dValue); +double Px_To_Dx(const double &dValue); +double Px_To_Sx(const double &dValue); +double Px_To_Multi(const double &dValue); +double Px_To_Emu(const double &dValue); + +double Inch_To_Cm(const double &dValue); +double Inch_To_Mm(const double &dValue); +double Inch_To_Pt(const double &dValue); +double Inch_To_Px(const double &dValue); +double Inch_To_Dx(const double &dValue); +double Inch_To_Sx(const double &dValue); +double Inch_To_Multi(const double &dValue); +double Inch_To_Emu(const double &dValue); + +double Dx_To_Cm(const double &dValue); +double Dx_To_Mm(const double &dValue); +double Dx_To_Pt(const double &dValue); +double Dx_To_Px(const double &dValue); +double Dx_To_Inch(const double &dValue); +double Dx_To_Sx(const double &dValue); +double Dx_To_Multi(const double &dValue); +double Dx_To_Emu(const double &dValue); + +double Sx_To_Cm(const double &dValue); +double Sx_To_Mm(const double &dValue); +double Sx_To_Pt(const double &dValue); +double Sx_To_Px(const double &dValue); +double Sx_To_Inch(const double &dValue); +double Sx_To_Dx(const double &dValue); +double Sx_To_Multi(const double &dValue); +double Sx_To_Emu(const double &dValue); + +double Multi_To_Cm(const double &dValue); +double Multi_To_Mm(const double &dValue); +double Multi_To_Pt(const double &dValue); +double Multi_To_Px(const double &dValue); +double Multi_To_Inch(const double &dValue); +double Multi_To_Sx(const double &dValue); +double Multi_To_Dx(const double &dValue); +double Multi_To_Emu(const double &dValue); + +double Emu_To_Cm(const double &dValue); +double Emu_To_Mm(const double &dValue); +double Emu_To_Pt(const double &dValue); +double Emu_To_Twips(const double &dValue); +double Emu_To_Px(const double &dValue); +double Emu_To_Inch(const double &dValue); +double Emu_To_Sx(const double &dValue); +double Emu_To_Dx(const double &dValue); +double Emu_To_Multi(const double &dValue); + +namespace XmlUtils +{ + int GetDigit(wchar_t c); + int GetDigit(char c); + bool IsDigit(wchar_t c); + + _INT64 GetHex(const std::wstring& string); + _INT64 GetHex (const std::string& string); + int GetColorBGR(const std::wstring& string); + + std::wstring GetLower(const std::wstring& string); + std::wstring GetUpper(const std::wstring& string); + + void replace_all(std::wstring& subject, const std::wstring& search, const std::wstring& replace); + void replace_all(std::string& subject, const std::string& search, const std::string& replace); + + bool GetBoolean(const std::wstring& string); + bool GetBoolean2(const std::wstring& string); + + _INT64 GetInteger64(const std::wstring& string); + int GetInteger(const std::wstring& string); + unsigned int GetUInteger(const std::wstring& string); + 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 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); + + int Rand(); + int GenerateInt(); + + std::wstring GenerateGuid(); + std::wstring DoubleToString(double value, wchar_t* format); + std::string EncodeXmlString(const std::string& data, bool bDeleteNoUnicode = true); + std::wstring EncodeXmlString(const std::wstring& data, bool bDeleteNoUnicode = true); + std::wstring DeleteNonUnicode(const std::wstring& data); + std::wstring EncodeXmlStringExtend(const std::wstring& data, bool bDeleteNoUnicode = true); +} + +#endif // _UNIT_INCLUDE_H_ diff --git a/Common/DocxFormat/Source/Base/WinColor.cpp b/Common/DocxFormat/Source/Base/WinColor.cpp new file mode 100644 index 0000000000..ac6ebb6a1a --- /dev/null +++ b/Common/DocxFormat/Source/Base/WinColor.cpp @@ -0,0 +1,86 @@ +/* + * (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 + * + */ +#ifndef _WIN32 +#include "WinColor.h" + +unsigned int GetSysColor(const int nIndex) +{ + // get color values from any windows theme + // http://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx + // generated by test from: \TeamlabOffice\trunk\ServerComponents\Test\Applications\Tokenize_Test + //***************** GetSysColor values begin (Win7 x64) ***************** + unsigned int nValue = 0x0; + //***************** GetSysColor values begin (Win7 x64) ***************** + switch (nIndex) { + case COLOR_3DDKSHADOW: nValue = 0x696969; break; + case COLOR_3DFACE: nValue = 0xf0f0f0; break; + case COLOR_3DHIGHLIGHT: nValue = 0xffffff; break; + // case COLOR_3DHILIGHT: nValue = 0xffffff; break; // is COLOR_3DHIGHLIGHT + case COLOR_3DLIGHT: nValue = 0xe3e3e3; break; + case COLOR_3DSHADOW: nValue = 0xa0a0a0; break; + case COLOR_ACTIVEBORDER: nValue = 0xb4b4b4; break; + case COLOR_ACTIVECAPTION: nValue = 0xd1b499; break; + case COLOR_APPWORKSPACE: nValue = 0xababab; break; + case COLOR_BACKGROUND: nValue = 0x0; break; + // case COLOR_BTNFACE: nValue = 0xf0f0f0; break; // is COLOR_3DFACE + // case COLOR_BTNHIGHLIGHT: nValue = 0xffffff; break; // is COLOR_3DHIGHLIGHT + // case COLOR_BTNHILIGHT: nValue = 0xffffff; break; // is COLOR_3DHIGHLIGHT + // case COLOR_BTNSHADOW: nValue = 0xa0a0a0; break; // is COLOR_3DSHADOW + case COLOR_BTNTEXT: nValue = 0x0; break; + case COLOR_CAPTIONTEXT: nValue = 0x0; break; + // case COLOR_DESKTOP: nValue = 0x0; break; // is COLOR_BACKGROUND + case COLOR_GRADIENTACTIVECAPTION: nValue = 0xead1b9; break; + case COLOR_GRADIENTINACTIVECAPTION: nValue = 0xf2e4d7; break; + case COLOR_GRAYTEXT: nValue = 0x6d6d6d; break; + case COLOR_HIGHLIGHT: nValue = 0xff9933; break; + case COLOR_HIGHLIGHTTEXT: nValue = 0xffffff; break; + case COLOR_HOTLIGHT: nValue = 0xcc6600; break; + case COLOR_INACTIVEBORDER: nValue = 0xfcf7f4; break; + case COLOR_INACTIVECAPTION: nValue = 0xdbcdbf; break; + case COLOR_INACTIVECAPTIONTEXT: nValue = 0x544e43; break; + case COLOR_INFOBK: nValue = 0xe1ffff; break; + case COLOR_INFOTEXT: nValue = 0x0; break; + case COLOR_MENU: nValue = 0xf0f0f0; break; + case COLOR_MENUHILIGHT: nValue = 0xff9933; break; + case COLOR_MENUBAR: nValue = 0xf0f0f0; break; + case COLOR_MENUTEXT: nValue = 0x0; break; + case COLOR_SCROLLBAR: nValue = 0xc8c8c8; break; + case COLOR_WINDOW: nValue = 0xffffff; break; + case COLOR_WINDOWFRAME: nValue = 0x646464; break; + case COLOR_WINDOWTEXT: nValue = 0x0; break; + default: nValue = 0x0; break; + } // switch (nIndex) + //***************** GetSysColor values end ***************** + return nValue; +} + +#endif diff --git a/Common/DocxFormat/Source/Base/ASCWinAPI.h b/Common/DocxFormat/Source/Base/WinColor.h similarity index 56% rename from Common/DocxFormat/Source/Base/ASCWinAPI.h rename to Common/DocxFormat/Source/Base/WinColor.h index 2cd2572610..cf79d2b528 100644 --- a/Common/DocxFormat/Source/Base/ASCWinAPI.h +++ b/Common/DocxFormat/Source/Base/WinColor.h @@ -1,259 +1,211 @@ -/* - * (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 - * - */ -#ifndef _ASC_WIN_API -#define _ASC_WIN_API - -#ifndef _WIN32 - -// from winuser.h ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx ) -#ifndef COLOR_3DDKSHADOW -#define COLOR_3DDKSHADOW 21 -#endif - -#ifndef COLOR_3DFACE -#define COLOR_3DFACE 15 -#endif - -#ifndef COLOR_3DHIGHLIGHT -#define COLOR_3DHIGHLIGHT 20 -#endif - -#ifndef COLOR_3DHILIGHT -#define COLOR_3DHILIGHT 20 -#endif - -#ifndef COLOR_3DLIGHT -#define COLOR_3DLIGHT 22 -#endif - -#ifndef COLOR_3DSHADOW -#define COLOR_3DSHADOW 16 -#endif - -#ifndef COLOR_ACTIVEBORDER -#define COLOR_ACTIVEBORDER 10 -#endif - -#ifndef COLOR_ACTIVECAPTION -#define COLOR_ACTIVECAPTION 2 -#endif - -#ifndef COLOR_APPWORKSPACE -#define COLOR_APPWORKSPACE 12 -#endif - -#ifndef COLOR_BACKGROUND -#define COLOR_BACKGROUND 1 -#endif - -#ifndef COLOR_BTNFACE -#define COLOR_BTNFACE 15 -#endif - -#ifndef COLOR_BTNHIGHLIGHT -#define COLOR_BTNHIGHLIGHT 20 -#endif - -#ifndef COLOR_BTNHILIGHT -#define COLOR_BTNHILIGHT 20 -#endif - -#ifndef COLOR_BTNSHADOW -#define COLOR_BTNSHADOW 16 -#endif - -#ifndef COLOR_BTNTEXT -#define COLOR_BTNTEXT 18 -#endif - -#ifndef COLOR_CAPTIONTEXT -#define COLOR_CAPTIONTEXT 9 -#endif - -#ifndef COLOR_DESKTOP -#define COLOR_DESKTOP 1 -#endif - -#ifndef COLOR_GRAYTEXT -#define COLOR_GRAYTEXT 17 -#endif - -#ifndef COLOR_HIGHLIGHT -#define COLOR_HIGHLIGHT 13 -#endif - -#ifndef COLOR_HIGHLIGHTTEXT -#define COLOR_HIGHLIGHTTEXT 14 -#endif - -#ifndef COLOR_HOTLIGHT -#define COLOR_HOTLIGHT 26 -#endif - -#ifndef COLOR_INACTIVEBORDER -#define COLOR_INACTIVEBORDER 11 -#endif - -#ifndef COLOR_INACTIVECAPTION -#define COLOR_INACTIVECAPTION 3 -#endif - - -#ifndef COLOR_INACTIVECAPTIONTEXT -#define COLOR_INACTIVECAPTIONTEXT 19 -#endif - -#ifndef COLOR_INFOBK -#define COLOR_INFOBK 24 -#endif - -#ifndef COLOR_INFOTEXT -#define COLOR_INFOTEXT 23 -#endif - -#ifndef COLOR_MENU -#define COLOR_MENU 4 -#endif - -#ifndef COLOR_GRADIENTACTIVECAPTION -#define COLOR_GRADIENTACTIVECAPTION 27 -#endif - -#ifndef COLOR_GRADIENTINACTIVECAPTION -#define COLOR_GRADIENTINACTIVECAPTION 28 -#endif - -#ifndef COLOR_MENUHILIGHT -#define COLOR_MENUHILIGHT 29 -#endif - -#ifndef COLOR_MENUBAR -#define COLOR_MENUBAR 30 -#endif - - -#ifndef COLOR_MENUTEXT -#define COLOR_MENUTEXT 7 -#endif - -#ifndef COLOR_SCROLLBAR -#define COLOR_SCROLLBAR 0 -#endif - -#ifndef COLOR_WINDOW -#define COLOR_WINDOW 5 -#endif - -#ifndef COLOR_WINDOWFRAME -#define COLOR_WINDOWFRAME 6 -#endif - -#ifndef COLOR_WINDOWTEXT -#define COLOR_WINDOWTEXT 8 -#endif - -static DWORD GetSysColor(const int nIndex) -{ - // get color values from any windows theme - // http://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx - // generated by test from: \TeamlabOffice\trunk\ServerComponents\Test\Applications\Tokenize_Test - //***************** GetSysColor values begin (Win7 x64) ***************** - DWORD nValue = 0x0; - //***************** GetSysColor values begin (Win7 x64) ***************** - switch (nIndex) { - case COLOR_3DDKSHADOW: nValue = 0x696969; break; - case COLOR_3DFACE: nValue = 0xf0f0f0; break; - case COLOR_3DHIGHLIGHT: nValue = 0xffffff; break; - // case COLOR_3DHILIGHT: nValue = 0xffffff; break; // is COLOR_3DHIGHLIGHT - case COLOR_3DLIGHT: nValue = 0xe3e3e3; break; - case COLOR_3DSHADOW: nValue = 0xa0a0a0; break; - case COLOR_ACTIVEBORDER: nValue = 0xb4b4b4; break; - case COLOR_ACTIVECAPTION: nValue = 0xd1b499; break; - case COLOR_APPWORKSPACE: nValue = 0xababab; break; - case COLOR_BACKGROUND: nValue = 0x0; break; - // case COLOR_BTNFACE: nValue = 0xf0f0f0; break; // is COLOR_3DFACE - // case COLOR_BTNHIGHLIGHT: nValue = 0xffffff; break; // is COLOR_3DHIGHLIGHT - // case COLOR_BTNHILIGHT: nValue = 0xffffff; break; // is COLOR_3DHIGHLIGHT - // case COLOR_BTNSHADOW: nValue = 0xa0a0a0; break; // is COLOR_3DSHADOW - case COLOR_BTNTEXT: nValue = 0x0; break; - case COLOR_CAPTIONTEXT: nValue = 0x0; break; - // case COLOR_DESKTOP: nValue = 0x0; break; // is COLOR_BACKGROUND - case COLOR_GRADIENTACTIVECAPTION: nValue = 0xead1b9; break; - case COLOR_GRADIENTINACTIVECAPTION: nValue = 0xf2e4d7; break; - case COLOR_GRAYTEXT: nValue = 0x6d6d6d; break; - case COLOR_HIGHLIGHT: nValue = 0xff9933; break; - case COLOR_HIGHLIGHTTEXT: nValue = 0xffffff; break; - case COLOR_HOTLIGHT: nValue = 0xcc6600; break; - case COLOR_INACTIVEBORDER: nValue = 0xfcf7f4; break; - case COLOR_INACTIVECAPTION: nValue = 0xdbcdbf; break; - case COLOR_INACTIVECAPTIONTEXT: nValue = 0x544e43; break; - case COLOR_INFOBK: nValue = 0xe1ffff; break; - case COLOR_INFOTEXT: nValue = 0x0; break; - case COLOR_MENU: nValue = 0xf0f0f0; break; - case COLOR_MENUHILIGHT: nValue = 0xff9933; break; - case COLOR_MENUBAR: nValue = 0xf0f0f0; break; - case COLOR_MENUTEXT: nValue = 0x0; break; - case COLOR_SCROLLBAR: nValue = 0xc8c8c8; break; - case COLOR_WINDOW: nValue = 0xffffff; break; - case COLOR_WINDOWFRAME: nValue = 0x646464; break; - case COLOR_WINDOWTEXT: nValue = 0x0; break; - default: nValue = 0x0; break; - } // switch (nIndex) - //***************** GetSysColor values end ***************** - return nValue; -} - - -#else - #include - - #ifndef COLOR_HOTLIGHT - #define COLOR_HOTLIGHT 26 - #endif - - #ifndef COLOR_GRADIENTACTIVECAPTION - #define COLOR_GRADIENTACTIVECAPTION 27 - #endif - - #ifndef COLOR_GRADIENTINACTIVECAPTION - #define COLOR_GRADIENTINACTIVECAPTION 28 - #endif - - #ifndef COLOR_MENUHILIGHT - #define COLOR_MENUHILIGHT 29 - #endif - - #ifndef COLOR_MENUBAR - #define COLOR_MENUBAR 30 - #endif -#endif //#ifndef _WIN32 -#endif // #ifndef _ASC_WIN_API +/* + * (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 + * + */ +#ifndef _ASC_WIN_API +#define _ASC_WIN_API + +#ifndef _WIN32 + +// from winuser.h ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx ) +#ifndef COLOR_3DDKSHADOW +#define COLOR_3DDKSHADOW 21 +#endif + +#ifndef COLOR_3DFACE +#define COLOR_3DFACE 15 +#endif + +#ifndef COLOR_3DHIGHLIGHT +#define COLOR_3DHIGHLIGHT 20 +#endif + +#ifndef COLOR_3DHILIGHT +#define COLOR_3DHILIGHT 20 +#endif + +#ifndef COLOR_3DLIGHT +#define COLOR_3DLIGHT 22 +#endif + +#ifndef COLOR_3DSHADOW +#define COLOR_3DSHADOW 16 +#endif + +#ifndef COLOR_ACTIVEBORDER +#define COLOR_ACTIVEBORDER 10 +#endif + +#ifndef COLOR_ACTIVECAPTION +#define COLOR_ACTIVECAPTION 2 +#endif + +#ifndef COLOR_APPWORKSPACE +#define COLOR_APPWORKSPACE 12 +#endif + +#ifndef COLOR_BACKGROUND +#define COLOR_BACKGROUND 1 +#endif + +#ifndef COLOR_BTNFACE +#define COLOR_BTNFACE 15 +#endif + +#ifndef COLOR_BTNHIGHLIGHT +#define COLOR_BTNHIGHLIGHT 20 +#endif + +#ifndef COLOR_BTNHILIGHT +#define COLOR_BTNHILIGHT 20 +#endif + +#ifndef COLOR_BTNSHADOW +#define COLOR_BTNSHADOW 16 +#endif + +#ifndef COLOR_BTNTEXT +#define COLOR_BTNTEXT 18 +#endif + +#ifndef COLOR_CAPTIONTEXT +#define COLOR_CAPTIONTEXT 9 +#endif + +#ifndef COLOR_DESKTOP +#define COLOR_DESKTOP 1 +#endif + +#ifndef COLOR_GRAYTEXT +#define COLOR_GRAYTEXT 17 +#endif + +#ifndef COLOR_HIGHLIGHT +#define COLOR_HIGHLIGHT 13 +#endif + +#ifndef COLOR_HIGHLIGHTTEXT +#define COLOR_HIGHLIGHTTEXT 14 +#endif + +#ifndef COLOR_HOTLIGHT +#define COLOR_HOTLIGHT 26 +#endif + +#ifndef COLOR_INACTIVEBORDER +#define COLOR_INACTIVEBORDER 11 +#endif + +#ifndef COLOR_INACTIVECAPTION +#define COLOR_INACTIVECAPTION 3 +#endif + + +#ifndef COLOR_INACTIVECAPTIONTEXT +#define COLOR_INACTIVECAPTIONTEXT 19 +#endif + +#ifndef COLOR_INFOBK +#define COLOR_INFOBK 24 +#endif + +#ifndef COLOR_INFOTEXT +#define COLOR_INFOTEXT 23 +#endif + +#ifndef COLOR_MENU +#define COLOR_MENU 4 +#endif + +#ifndef COLOR_GRADIENTACTIVECAPTION +#define COLOR_GRADIENTACTIVECAPTION 27 +#endif + +#ifndef COLOR_GRADIENTINACTIVECAPTION +#define COLOR_GRADIENTINACTIVECAPTION 28 +#endif + +#ifndef COLOR_MENUHILIGHT +#define COLOR_MENUHILIGHT 29 +#endif + +#ifndef COLOR_MENUBAR +#define COLOR_MENUBAR 30 +#endif + + +#ifndef COLOR_MENUTEXT +#define COLOR_MENUTEXT 7 +#endif + +#ifndef COLOR_SCROLLBAR +#define COLOR_SCROLLBAR 0 +#endif + +#ifndef COLOR_WINDOW +#define COLOR_WINDOW 5 +#endif + +#ifndef COLOR_WINDOWFRAME +#define COLOR_WINDOWFRAME 6 +#endif + +#ifndef COLOR_WINDOWTEXT +#define COLOR_WINDOWTEXT 8 +#endif + +unsigned int GetSysColor(const int nIndex); + +#else +#include +#include + +#ifndef COLOR_HOTLIGHT +#define COLOR_HOTLIGHT 26 +#endif + +#ifndef COLOR_GRADIENTACTIVECAPTION +#define COLOR_GRADIENTACTIVECAPTION 27 +#endif + +#ifndef COLOR_GRADIENTINACTIVECAPTION +#define COLOR_GRADIENTINACTIVECAPTION 28 +#endif + +#ifndef COLOR_MENUHILIGHT +#define COLOR_MENUHILIGHT 29 +#endif + +#ifndef COLOR_MENUBAR +#define COLOR_MENUBAR 30 +#endif + +#endif //#ifndef _WIN32 +#endif // #ifndef _ASC_WIN_API diff --git a/Common/DocxFormat/Source/Utility/codecvt.cpp b/Common/DocxFormat/Source/Base/codecvt.cpp similarity index 72% rename from Common/DocxFormat/Source/Utility/codecvt.cpp rename to Common/DocxFormat/Source/Base/codecvt.cpp index cdccb9776d..3b79e68f50 100644 --- a/Common/DocxFormat/Source/Utility/codecvt.cpp +++ b/Common/DocxFormat/Source/Base/codecvt.cpp @@ -1,226 +1,226 @@ -/* - * (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 "codecvt.h" -#include - -using namespace std; - - -ucs2_conversion::result -ucs2_conversion::do_in(mbstate_t&, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const -{ - const int max_input = (from_end - from) & ~1; - const int max_output = (to_limit - to); - int count = std::min(max_input / 2, max_output); // TODO попробовать оптимизировать, заменив деление на сдвиг - - from_next = from; - to_next = to; - - for (;count--; from_next += 2, ++to_next) - { - unsigned char c1 = *from_next; - unsigned char c2 = *(from_next + 1); - *to_next = c1 | c2 << 8; - } - - if (to_next == to && from_next == from_end - 1) - return partial; - return ok; -} - - -ucs2_conversion::result -ucs2_conversion::do_out(mbstate_t&, - const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, - char* to, char* to_limit, char*& to_next) const -{ - const int max_input = (from_end - from); - const int max_output = (to_limit - to) & ~1; - int count = std::min(max_input, max_output / 2); // TODO попробовать оптимизировать, заменив деление на сдвиг - - from_next = from; - to_next = to; - - for (;count--; ++from_next, to_next += 2) - { - *(to_next + 0) = *from_next & 0xFF; - *(to_next + 1) = *from_next >> 8 & 0xFF; - } - return ok; -} - - - -ube_conversion::result -ube_conversion::do_in(mbstate_t&, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const -{ - const int max_input = (from_end - from) & ~1; - const int max_output = (to_limit - to); - int count = std::min(max_input / 2, max_output); // TODO попробовать оптимизировать, заменив деление на сдвиг - - from_next = from; - to_next = to; - - for (;count--; from_next += 2, ++to_next) - { - unsigned char c1 = *from_next; - unsigned char c2 = *(from_next + 1); - *to_next = c2 | c1 << 8; - } - - if (to_next == to && from_next == from_end - 1) - return partial; - return ok; -} - -ube_conversion::result -ube_conversion::do_out(mbstate_t&, - const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, - char* to, char* to_limit, char*& to_next) const -{ - const int max_input = (from_end - from); - const int max_output = (to_limit - to) & ~1; - int count = std::min(max_input, max_output / 2); // TODO попробовать оптимизировать, заменив деление на сдвиг - - from_next = from; - to_next = to; - - for (;count--; ++from_next, to_next += 2) - { - *(to_next + 1) = *from_next & 0xFF; - *(to_next + 0) = *from_next >> 8 & 0xFF; - } - return ok; -} - - -utf8_conversion::result -utf8_conversion::do_in(mbstate_t&, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const -{ - from_next = from; - to_next = to; - - for(; to_next < to_limit && from_next < from_end; ++to_next) - { - if (static_cast(*from_next) < 0x80) - { - *to_next = static_cast(*from_next++); - } - else - { - const int zero_bit_pos = most_signifant_bit_position(~*from_next); - int extra_bytes = 7 - zero_bit_pos; - - if (from_end - from_next < extra_bytes + 1) - return partial; - - *to_next = static_cast(*from_next++) & ((1 << zero_bit_pos - 1) - 1); - for (;extra_bytes--; ++from_next) - { - *to_next = *to_next << 6 | static_cast(*from_next) & 63; - } - } - } - return ok; -} - - -// TODO можно оптимизировать, считая что в utf8 максимальное значение байт на символ 4. -// И после заменив деление и умножение на сдвиги -utf8_conversion::result -utf8_conversion::do_out(mbstate_t&, - const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, - char* to, char* to_limit, char*& to_next) const -{ - from_next = from; - to_next = to; - - for (;from_next < from_end; ++from_next) - { - const unsigned symbol = *from_next; - - if (symbol < 0x7F) - { - if (to_next < to_limit) - *to_next++ = static_cast(symbol); - else - return ok; - } - else - { - const size_t msb_pos = most_signifant_bit_position(symbol); - int extra_bytes = msb_pos / 6; - - if (to_limit - to_next >= extra_bytes + 1) - { - *to_next = static_cast(0xFF80 >> extra_bytes); - *to_next++ |= take_6_bits(symbol, extra_bytes * 6); - - for(;extra_bytes--;) - *to_next++ = 0x80 | take_6_bits(symbol, extra_bytes * 6); - } - else - { - return ok; - } - } - } - return ok; -} - - -const unsigned char -utf8_conversion::take_6_bits(const int unsigned value, const size_t right_position) const -{ - return (value >> right_position) & 63; -} - - -const size_t -utf8_conversion::most_signifant_bit_position(const unsigned int value) const -{ - size_t result = 0; - size_t half = 16; - - for(; half > 0; half >>= 1) - { - if (1u << (result + half) <= value ) - result += half; - } - return result + 1; -} +/* + * (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 "codecvt.h" +#include + +using namespace std; + + +ucs2_conversion::result +ucs2_conversion::do_in(mbstate_t&, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const +{ + const int max_input = (from_end - from) & ~1; + const int max_output = (to_limit - to); + int count = std::min(max_input / 2, max_output); // TODO попробовать оптимизировать, заменив деление на сдвиг + + from_next = from; + to_next = to; + + for (;count--; from_next += 2, ++to_next) + { + unsigned char c1 = *from_next; + unsigned char c2 = *(from_next + 1); + *to_next = c1 | c2 << 8; + } + + if (to_next == to && from_next == from_end - 1) + return partial; + return ok; +} + + +ucs2_conversion::result +ucs2_conversion::do_out(mbstate_t&, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_limit, char*& to_next) const +{ + const int max_input = (from_end - from); + const int max_output = (to_limit - to) & ~1; + int count = std::min(max_input, max_output / 2); // TODO попробовать оптимизировать, заменив деление на сдвиг + + from_next = from; + to_next = to; + + for (;count--; ++from_next, to_next += 2) + { + *(to_next + 0) = *from_next & 0xFF; + *(to_next + 1) = *from_next >> 8 & 0xFF; + } + return ok; +} + + + +ube_conversion::result +ube_conversion::do_in(mbstate_t&, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const +{ + const int max_input = (from_end - from) & ~1; + const int max_output = (to_limit - to); + int count = std::min(max_input / 2, max_output); // TODO попробовать оптимизировать, заменив деление на сдвиг + + from_next = from; + to_next = to; + + for (;count--; from_next += 2, ++to_next) + { + unsigned char c1 = *from_next; + unsigned char c2 = *(from_next + 1); + *to_next = c2 | c1 << 8; + } + + if (to_next == to && from_next == from_end - 1) + return partial; + return ok; +} + +ube_conversion::result +ube_conversion::do_out(mbstate_t&, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_limit, char*& to_next) const +{ + const int max_input = (from_end - from); + const int max_output = (to_limit - to) & ~1; + int count = std::min(max_input, max_output / 2); // TODO попробовать оптимизировать, заменив деление на сдвиг + + from_next = from; + to_next = to; + + for (;count--; ++from_next, to_next += 2) + { + *(to_next + 1) = *from_next & 0xFF; + *(to_next + 0) = *from_next >> 8 & 0xFF; + } + return ok; +} + + +utf8_conversion::result +utf8_conversion::do_in(mbstate_t&, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const +{ + from_next = from; + to_next = to; + + for(; to_next < to_limit && from_next < from_end; ++to_next) + { + if (static_cast(*from_next) < 0x80) + { + *to_next = static_cast(*from_next++); + } + else + { + const int zero_bit_pos = most_signifant_bit_position(~*from_next); + int extra_bytes = 7 - zero_bit_pos; + + if (from_end - from_next < extra_bytes + 1) + return partial; + + *to_next = static_cast(*from_next++) & ((1 << zero_bit_pos - 1) - 1); + for (;extra_bytes--; ++from_next) + { + *to_next = *to_next << 6 | static_cast(*from_next) & 63; + } + } + } + return ok; +} + + +// TODO можно оптимизировать, считая что в utf8 максимальное значение байт на символ 4. +// И после заменив деление и умножение на сдвиги +utf8_conversion::result +utf8_conversion::do_out(mbstate_t&, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_limit, char*& to_next) const +{ + from_next = from; + to_next = to; + + for (;from_next < from_end; ++from_next) + { + const unsigned symbol = *from_next; + + if (symbol < 0x7F) + { + if (to_next < to_limit) + *to_next++ = static_cast(symbol); + else + return ok; + } + else + { + const size_t msb_pos = most_signifant_bit_position(symbol); + int extra_bytes = msb_pos / 6; + + if (to_limit - to_next >= extra_bytes + 1) + { + *to_next = static_cast(0xFF80 >> extra_bytes); + *to_next++ |= take_6_bits(symbol, extra_bytes * 6); + + for(;extra_bytes--;) + *to_next++ = 0x80 | take_6_bits(symbol, extra_bytes * 6); + } + else + { + return ok; + } + } + } + return ok; +} + + +const unsigned char +utf8_conversion::take_6_bits(const int unsigned value, const size_t right_position) const +{ + return (value >> right_position) & 63; +} + + +const size_t +utf8_conversion::most_signifant_bit_position(const unsigned int value) const +{ + size_t result = 0; + size_t half = 16; + + for(; half > 0; half >>= 1) + { + if (1u << (result + half) <= value ) + result += half; + } + return result + 1; +} diff --git a/Common/DocxFormat/Source/Utility/codecvt.h b/Common/DocxFormat/Source/Base/codecvt.h similarity index 97% rename from Common/DocxFormat/Source/Utility/codecvt.h rename to Common/DocxFormat/Source/Base/codecvt.h index ac78dcb5b9..bf9b5557fe 100644 --- a/Common/DocxFormat/Source/Utility/codecvt.h +++ b/Common/DocxFormat/Source/Base/codecvt.h @@ -1,117 +1,117 @@ -/* - * (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 -#ifndef UTILITY_CODECVT_INCLUDE_H_ -#define UTILITY_CODECVT_INCLUDE_H_ - -/** Several code conversions facets. - - E.g. this is how to convert UCS-2 to UTF-8 - - @code - wifstream ifs("input", ios_base::binary); - wofstream ofs("output", ios_base::binary); - - ifs.rdbuf()->pubimbue(locale(locale(), new ucs2_conversion())); - ofs.rbbuf()->pubimbue(locale(locale(), new utf8_conversion())); - ofs << ifs.rdbuf(); - @endcode - - @author Vladimir Prus - - @file -*/ -#include - - -/** Conversion facet that allows to use Unicode files in UCS-2 encoding */ -class ucs2_conversion : public std::codecvt -{ -protected: - result do_in(std::mbstate_t& state, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const; - - result do_out(std::mbstate_t& state, - const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, - char* to, char* to_limit, char*& to_next) const; - - bool do_always_noconv() const throw() { return false; } - int do_encoding() const throw() { return 2; } -}; - - -class ube_conversion : public std::codecvt -{ -protected: - result do_in(std::mbstate_t& state, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const; - - result do_out(std::mbstate_t& state, - const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, - char* to, char* to_limit, char*& to_next) const; - - bool do_always_noconv() const throw() { return false; } - int do_encoding() const throw() { return 2; } -}; - - -/** Conversion facet that allows to read Unicode files in UTF-8 encoding */ -class utf8_conversion : public std::codecvt -{ -protected: - result do_in(std::mbstate_t& state, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const; - - result in(std::mbstate_t& state, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const; - - result do_out(std::mbstate_t& state, - const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, - char* to, char* to_limit, char*& to_next) const; - - result out(std::mbstate_t& state, - const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, - char* to, char* to_limit, char*& to_next) const; - - bool do_always_noconv() const throw() { return false; } - int do_encoding() const throw() { return 2; } - -private: - const unsigned char take_6_bits(const unsigned int value, const size_t right_position) const; - const size_t most_signifant_bit_position(const unsigned int value) const; -}; - +/* + * (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 +#ifndef UTILITY_CODECVT_INCLUDE_H_ +#define UTILITY_CODECVT_INCLUDE_H_ + +/** Several code conversions facets. + + E.g. this is how to convert UCS-2 to UTF-8 + + @code + wifstream ifs("input", ios_base::binary); + wofstream ofs("output", ios_base::binary); + + ifs.rdbuf()->pubimbue(locale(locale(), new ucs2_conversion())); + ofs.rbbuf()->pubimbue(locale(locale(), new utf8_conversion())); + ofs << ifs.rdbuf(); + @endcode + + @author Vladimir Prus + + @file +*/ +#include + + +/** Conversion facet that allows to use Unicode files in UCS-2 encoding */ +class ucs2_conversion : public std::codecvt +{ +protected: + result do_in(std::mbstate_t& state, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const; + + result do_out(std::mbstate_t& state, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_limit, char*& to_next) const; + + bool do_always_noconv() const throw() { return false; } + int do_encoding() const throw() { return 2; } +}; + + +class ube_conversion : public std::codecvt +{ +protected: + result do_in(std::mbstate_t& state, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const; + + result do_out(std::mbstate_t& state, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_limit, char*& to_next) const; + + bool do_always_noconv() const throw() { return false; } + int do_encoding() const throw() { return 2; } +}; + + +/** Conversion facet that allows to read Unicode files in UTF-8 encoding */ +class utf8_conversion : public std::codecvt +{ +protected: + result do_in(std::mbstate_t& state, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const; + + result in(std::mbstate_t& state, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_limit, wchar_t*& to_next) const; + + result do_out(std::mbstate_t& state, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_limit, char*& to_next) const; + + result out(std::mbstate_t& state, + const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next, + char* to, char* to_limit, char*& to_next) const; + + bool do_always_noconv() const throw() { return false; } + int do_encoding() const throw() { return 2; } + +private: + const unsigned char take_6_bits(const unsigned int value, const size_t right_position) const; + const size_t most_signifant_bit_position(const unsigned int value) const; +}; + #endif // UTILITY_CODECVT_INCLUDE_H_ \ No newline at end of file diff --git a/Common/DocxFormat/Source/Base/pro/ooxml_base.pri b/Common/DocxFormat/Source/Base/pro/ooxml_base.pri new file mode 100644 index 0000000000..a40353823c --- /dev/null +++ b/Common/DocxFormat/Source/Base/pro/ooxml_base.pri @@ -0,0 +1,58 @@ +BASE_DIR = $$PWD/../.. + +HEADERS += \ + $$BASE_DIR/Base/Base.h \ + $$BASE_DIR/Base/codecvt.h \ + $$BASE_DIR/Base/DateTime.h \ + $$BASE_DIR/Base/SmartPrt.h \ # TODO: std::shared_ptr + $$BASE_DIR/Base/Nullable.h \ + $$BASE_DIR/Base/strings_hack_printf.h \ + $$BASE_DIR/Base/unicode_util.h \ + $$BASE_DIR/Base/Unit.h \ + $$BASE_DIR/Base/WinColor.h \ + \ + $$BASE_DIR/XML/XmlSimple.h \ + \ + $$BASE_DIR/SystemUtility/File.h \ + $$BASE_DIR/SystemUtility/SystemUtility.h + +SOURCES += \ + $$BASE_DIR/Base/codecvt.cpp \ + $$BASE_DIR/Base/DateTime.cpp \ + $$BASE_DIR/Base/unicode_util.cpp \ + $$BASE_DIR/Base/Unit.cpp \ + $$BASE_DIR/Base/WinColor.cpp \ + \ + $$BASE_DIR/XML/XmlSimple.cpp \ + \ + $$BASE_DIR/SystemUtility/File.cpp \ + $$BASE_DIR/SystemUtility/SystemUtility.cpp + +SOURCES += \ + $$BASE_DIR/../../3dParty/pole/pole.cpp + +HEADERS += \ + $$BASE_DIR/Common/ComplexTypes.h \ + $$BASE_DIR/Common/SimpleTypes_Base.h \ + $$BASE_DIR/Common/SimpleTypes_OMath.h \ + $$BASE_DIR/Common/SimpleTypes_Drawing.h \ + $$BASE_DIR/Common/SimpleTypes_Vml.h \ + $$BASE_DIR/Common/SimpleTypes_Shared.h \ + $$BASE_DIR/Common/SimpleTypes_Word.h \ + $$BASE_DIR/Common/SimpleTypes_Spreadsheet.h + +SOURCES += \ + $$BASE_DIR/Common/ComplexTypes.cpp \ + $$BASE_DIR/Common/SimpleTypes_Base.cpp \ + $$BASE_DIR/Common/SimpleTypes_OMath.cpp \ + $$BASE_DIR/Common/SimpleTypes_Drawing.cpp \ + $$BASE_DIR/Common/SimpleTypes_Vml.cpp \ + $$BASE_DIR/Common/SimpleTypes_Shared.cpp \ + $$BASE_DIR/Common/SimpleTypes_Word.cpp \ + $$BASE_DIR/Common/SimpleTypes_Spreadsheet.cpp + +HEADERS += \ + $$BASE_DIR/DocxFormat/FileTypes.h + +SOURCES += \ + $$BASE_DIR/DocxFormat/FileTypes.cpp diff --git a/Common/DocxFormat/Source/Base/pro/ooxml_base.pro b/Common/DocxFormat/Source/Base/pro/ooxml_base.pro new file mode 100644 index 0000000000..fe48073642 --- /dev/null +++ b/Common/DocxFormat/Source/Base/pro/ooxml_base.pro @@ -0,0 +1,24 @@ +QT -= core +QT -= gui + +VERSION = 1.0.0.3 +TARGET = ooxml_base +TEMPLATE = lib + +CONFIG += shared +CONFIG += plugin + +CONFIG += core_static_link_libstd + +CORE_ROOT_DIR = $$PWD/../../../../.. +PWD_ROOT_DIR = $$PWD +include($$CORE_ROOT_DIR/Common/base.pri) + +include($$CORE_ROOT_DIR/Common/3dParty/boost/boost.pri) +include($$PWD/ooxml_base.pri) + +ADD_DEPENDENCY(UnicodeConverter, kernel) + +core_windows { + LIBS += -lUser32 +} diff --git a/Common/DocxFormat/Source/Base/strings_hack_printf.h b/Common/DocxFormat/Source/Base/strings_hack_printf.h index 6e7a33bb5b..d08f28bca2 100644 --- a/Common/DocxFormat/Source/Base/strings_hack_printf.h +++ b/Common/DocxFormat/Source/Base/strings_hack_printf.h @@ -43,253 +43,253 @@ static int strings_hack_printf_internal(wchar_t* _buffer, size_t _size_alloc, wchar_t* _format, va_list va) { - size_t write_size = 0; + size_t write_size = 0; - wchar_t* tmp_format = _format; - wchar_t* tmp_buffer = _buffer; - do - { - wchar_t* buffer_cur = tmp_format; - int nSkip = 0; - while (*buffer_cur) - { - if (buffer_cur[0] == '%') - { - if (buffer_cur[1] == 's') // not crash (last symbol - 0) - { - nSkip = 2; - break; - } - else if (buffer_cur[1] == 'l' && buffer_cur[2] == 's') // not crash (last symbol - 0) - { - nSkip = 3; - break; - } - } - ++buffer_cur; - } + wchar_t* tmp_format = _format; + wchar_t* tmp_buffer = _buffer; + do + { + wchar_t* buffer_cur = tmp_format; + int nSkip = 0; + while (*buffer_cur) + { + if (buffer_cur[0] == '%') + { + if (buffer_cur[1] == 's') // not crash (last symbol - 0) + { + nSkip = 2; + break; + } + else if (buffer_cur[1] == 'l' && buffer_cur[2] == 's') // not crash (last symbol - 0) + { + nSkip = 3; + break; + } + } + ++buffer_cur; + } - if (nSkip > 0) - { - buffer_cur[0] = '\0'; - } + if (nSkip > 0) + { + buffer_cur[0] = '\0'; + } - if (write_size >= _size_alloc) - return -1; + if (write_size >= _size_alloc) + return -1; - if (*tmp_format) - { + if (*tmp_format) + { #ifndef _IOS - // crash on ios. - int fmt_size = vswprintf(tmp_buffer, _size_alloc - write_size, tmp_format, va); + // crash on ios. + int fmt_size = vswprintf(tmp_buffer, _size_alloc - write_size, tmp_format, va); #else - va_list arg_copy; - va_copy(arg_copy, va); - - for (wchar_t* tmp = tmp_format; *tmp != '\0'; ++tmp) - { - if ('%' == *tmp) - { - if ('%' == tmp[1]) - ++tmp; - else - void* p = va_arg(va, void*); - } - } - - int fmt_size = vswprintf(tmp_buffer, _size_alloc - write_size, tmp_format, arg_copy); + va_list arg_copy; + va_copy(arg_copy, va); + + for (wchar_t* tmp = tmp_format; *tmp != '\0'; ++tmp) + { + if ('%' == *tmp) + { + if ('%' == tmp[1]) + ++tmp; + else + void* p = va_arg(va, void*); + } + } + + int fmt_size = vswprintf(tmp_buffer, _size_alloc - write_size, tmp_format, arg_copy); #endif - if (fmt_size < 0) - return -1; + if (fmt_size < 0) + return -1; - tmp_buffer += fmt_size; - write_size += fmt_size; - } + tmp_buffer += fmt_size; + write_size += fmt_size; + } - if (nSkip) - { - wchar_t* _string_param = va_arg(va, wchar_t*); - size_t _len = wcslen(_string_param); + if (nSkip) + { + wchar_t* _string_param = va_arg(va, wchar_t*); + size_t _len = wcslen(_string_param); - if (_size_alloc > (_len + write_size)) - memcpy(tmp_buffer, _string_param, _len * sizeof(wchar_t)); + if (_size_alloc > (_len + write_size)) + memcpy(tmp_buffer, _string_param, _len * sizeof(wchar_t)); - write_size += _len; - tmp_buffer += _len; - } + write_size += _len; + tmp_buffer += _len; + } - tmp_format = buffer_cur + nSkip; - } while (*tmp_format); + tmp_format = buffer_cur + nSkip; + } while (*tmp_format); - if (write_size >= _size_alloc) - return -1; + if (write_size >= _size_alloc) + return -1; - tmp_buffer[0] = '\0'; - return (int)write_size; + tmp_buffer[0] = '\0'; + return (int)write_size; } static int strings_hack_printf_internal_a(char* _buffer, size_t _size_alloc, char* _format, va_list va) { - size_t write_size = 0; + size_t write_size = 0; - char* tmp_format = _format; - char* tmp_buffer = _buffer; - do - { - char* buffer_cur = tmp_format; - int nSkip = 0; - while (*buffer_cur) - { - if (buffer_cur[0] == '%') - { - if (buffer_cur[1] == 's') // not crash (last symbol - 0) - { - nSkip = 2; - break; - } - else if (buffer_cur[1] == 'l' && buffer_cur[2] == 's') // not crash (last symbol - 0) - { - nSkip = 3; - break; - } - } - ++buffer_cur; - } + char* tmp_format = _format; + char* tmp_buffer = _buffer; + do + { + char* buffer_cur = tmp_format; + int nSkip = 0; + while (*buffer_cur) + { + if (buffer_cur[0] == '%') + { + if (buffer_cur[1] == 's') // not crash (last symbol - 0) + { + nSkip = 2; + break; + } + else if (buffer_cur[1] == 'l' && buffer_cur[2] == 's') // not crash (last symbol - 0) + { + nSkip = 3; + break; + } + } + ++buffer_cur; + } - if (nSkip > 0) - { - buffer_cur[0] = '\0'; - } + if (nSkip > 0) + { + buffer_cur[0] = '\0'; + } - if (write_size >= _size_alloc) - return -1; + if (write_size >= _size_alloc) + return -1; - if (*tmp_format) - { + if (*tmp_format) + { #ifndef _IOS - // crash on ios. - int fmt_size = vsnprintf(tmp_buffer, _size_alloc - write_size, tmp_format, va); + // crash on ios. + int fmt_size = vsnprintf(tmp_buffer, _size_alloc - write_size, tmp_format, va); #else - va_list arg_copy; - va_copy(arg_copy, va); - - for (char* tmp = tmp_format; *tmp != '\0'; ++tmp) - { - if ('%' == *tmp) - { - if ('%' == tmp[1]) - ++tmp; - else - void* p = va_arg(va, void*); - } - } - - int fmt_size = vsnprintf(tmp_buffer, _size_alloc - write_size, tmp_format, arg_copy); + va_list arg_copy; + va_copy(arg_copy, va); + + for (char* tmp = tmp_format; *tmp != '\0'; ++tmp) + { + if ('%' == *tmp) + { + if ('%' == tmp[1]) + ++tmp; + else + void* p = va_arg(va, void*); + } + } + + int fmt_size = vsnprintf(tmp_buffer, _size_alloc - write_size, tmp_format, arg_copy); #endif - if (fmt_size < 0) - return -1; + if (fmt_size < 0) + return -1; - tmp_buffer += fmt_size; - write_size += fmt_size; - } + tmp_buffer += fmt_size; + write_size += fmt_size; + } - if (nSkip) - { - char* _string_param = va_arg(va, char*); - size_t _len = strlen(_string_param); + if (nSkip) + { + char* _string_param = va_arg(va, char*); + size_t _len = strlen(_string_param); - if (_size_alloc > (_len + write_size)) - memcpy(tmp_buffer, _string_param, _len * sizeof(char)); + if (_size_alloc > (_len + write_size)) + memcpy(tmp_buffer, _string_param, _len * sizeof(char)); - write_size += _len; - tmp_buffer += _len; - } + write_size += _len; + tmp_buffer += _len; + } - tmp_format = buffer_cur + nSkip; - } while (*tmp_format); + tmp_format = buffer_cur + nSkip; + } while (*tmp_format); - if (write_size >= _size_alloc) - return -1; + if (write_size >= _size_alloc) + return -1; - tmp_buffer[0] = '\0'; - return (int)write_size; + tmp_buffer[0] = '\0'; + return (int)write_size; } template static int strings_hack_printf(T& str, const wchar_t *format, va_list argptr) { - int buf_size = STD_BUF_SIZE; + int buf_size = STD_BUF_SIZE; - size_t nFormatLen = wcslen(format); - if (0 == nFormatLen) - return -1; + size_t nFormatLen = wcslen(format); + if (0 == nFormatLen) + return -1; - wchar_t* tmp_format = new wchar_t[nFormatLen + 1]; - memcpy(tmp_format, format, nFormatLen * sizeof(wchar_t)); - tmp_format[nFormatLen] = '\0'; + wchar_t* tmp_format = new wchar_t[nFormatLen + 1]; + memcpy(tmp_format, format, nFormatLen * sizeof(wchar_t)); + tmp_format[nFormatLen] = '\0'; - while (buf_size < STD_BUF_SIZE * STD_BUF_SIZE) - { - va_list args; - va_copy(args, argptr); - wchar_t buffer[buf_size]; + while (buf_size < STD_BUF_SIZE * STD_BUF_SIZE) + { + va_list args; + va_copy(args, argptr); + wchar_t buffer[buf_size]; - int fmt_size = strings_hack_printf_internal(buffer, sizeof(buffer)/sizeof(buffer[0]), tmp_format, args); - if (fmt_size >= 0) - { - str = T(buffer); - return fmt_size; - } + int fmt_size = strings_hack_printf_internal(buffer, sizeof(buffer)/sizeof(buffer[0]), tmp_format, args); + if (fmt_size >= 0) + { + str = T(buffer); + return fmt_size; + } - buf_size *= 2; - } + buf_size *= 2; + } - delete [] tmp_format; + delete [] tmp_format; - return -1; + return -1; } template static int strings_hack_printf(T& str, const char* format, va_list argptr) { - int buf_size = STD_BUF_SIZE; + int buf_size = STD_BUF_SIZE; - size_t nFormatLen = strlen(format); - if (0 == nFormatLen) - return -1; + size_t nFormatLen = strlen(format); + if (0 == nFormatLen) + return -1; - char* tmp_format = new char[nFormatLen + 1]; - memcpy(tmp_format, format, nFormatLen * sizeof(char)); - tmp_format[nFormatLen] = '\0'; + char* tmp_format = new char[nFormatLen + 1]; + memcpy(tmp_format, format, nFormatLen * sizeof(char)); + tmp_format[nFormatLen] = '\0'; - while (buf_size < STD_BUF_SIZE * STD_BUF_SIZE) - { - va_list args; - va_copy(args, argptr); - char buffer[buf_size]; + while (buf_size < STD_BUF_SIZE * STD_BUF_SIZE) + { + va_list args; + va_copy(args, argptr); + char buffer[buf_size]; - int fmt_size = strings_hack_printf_internal_a(buffer, sizeof(buffer)/sizeof(buffer[0]), tmp_format, args); - if (fmt_size >= 0) - { - str = T(buffer); - return fmt_size; - } + int fmt_size = strings_hack_printf_internal_a(buffer, sizeof(buffer)/sizeof(buffer[0]), tmp_format, args); + if (fmt_size >= 0) + { + str = T(buffer); + return fmt_size; + } - buf_size *= 2; - } + buf_size *= 2; + } - delete [] tmp_format; + delete [] tmp_format; - return -1; + return -1; } template static void strings_hack_printf_exec(T& sRes, const CHAR_TYPE* szFmt, ...) { - va_list argList; + va_list argList; - va_start(argList, szFmt); - strings_hack_printf(sRes, szFmt, argList); - va_end(argList); + va_start(argList, szFmt); + strings_hack_printf(sRes, szFmt, argList); + va_end(argList); } #endif // STRINGS_HACK_PRINTF_H diff --git a/Common/DocxFormat/Source/Common/ComplexTypes.cpp b/Common/DocxFormat/Source/Common/ComplexTypes.cpp new file mode 100644 index 0000000000..0d24ad50fd --- /dev/null +++ b/Common/DocxFormat/Source/Common/ComplexTypes.cpp @@ -0,0 +1,3005 @@ +/* + * (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 "ComplexTypes.h" + +namespace ComplexTypes +{ + + ComplexType::ComplexType() {}; + ComplexType::~ComplexType() {}; + + std::wstring ComplexType::ValNode(const std::wstring &node_name) + { + return L"<" + node_name + L" " + ToString() + L"/>"; + } + +//-------------------------------------------------------------------------------- +// DecimalNumber 17.3.1.10 (Part 1) +//-------------------------------------------------------------------------------- + + CDecimalNumber::CDecimalNumber() + { + } + CDecimalNumber::~CDecimalNumber() + { + } + + void CDecimalNumber::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"val", m_oVal ); + } + void CDecimalNumber::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CDecimalNumber::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"val=\"" + std::to_wstring(*m_oVal) + L"\"" ; + } + return sResult; + } + void CDecimalNumber::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start_No_NS( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"val", m_oVal ) + WritingElement_ReadAttributes_End_No_NS( oReader ) + } + +namespace Word +{ +//-------------------------------------------------------------------------------- +// Border 17.3.4 (Part 1) +//-------------------------------------------------------------------------------- + + CBorder::CBorder() + { + } + CBorder::~CBorder() + { + } + + void CBorder::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:color", m_oColor ); + XmlMacroReadAttributeBase(oNode, L"w:frame", m_oFrame ); + XmlMacroReadAttributeBase(oNode, L"w:shadow", m_oShadow ); + XmlMacroReadAttributeBase(oNode, L"w:space", m_oSpace ); + XmlMacroReadAttributeBase(oNode, L"w:sz", m_oSz ); + XmlMacroReadAttributeBase(oNode, L"w:themeColor", m_oThemeColor ); + XmlMacroReadAttributeBase(oNode, L"w:themeShade", m_oThemeShade ); + XmlMacroReadAttributeBase(oNode, L"w:themeTint", m_oThemeTint ); + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); + } + void CBorder::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CBorder::ToString() const + { + std::wstring sResult; + + if ( m_oColor.IsInit() ) + { + sResult += L"w:color=\""; + sResult += m_oColor->ToStringNoAlpha(); + sResult += L"\" "; + } + if ( m_oFrame.IsInit() ) + { + sResult += L"w:frame=\""; + sResult += m_oFrame->ToString(); + sResult += L"\" "; + } + if ( m_oShadow.IsInit() ) + { + sResult += L"w:shadow=\""; + sResult += m_oShadow->ToString(); + sResult += L"\" "; + } + if ( m_oSpace.IsInit() ) + { + sResult += L"w:space=\""; + sResult += m_oSpace->ToString(); + sResult += L"\" "; + } + if ( m_oSz.IsInit() ) + { + sResult += L"w:sz=\""; + sResult += m_oSz->ToString(); + sResult += L"\" "; + } + if ( m_oThemeColor.IsInit() ) + { + sResult += L"w:themeColor=\""; + sResult += m_oThemeColor->ToString(); + sResult += L"\" "; + } + if ( m_oThemeShade.IsInit() ) + { + sResult += L"w:themeShade=\""; + sResult += m_oThemeShade->ToString(); + sResult += L"\" "; + } + if ( m_oThemeTint.IsInit() ) + { + sResult += L"w:themeTint=\""; + sResult += m_oThemeTint->ToString(); + sResult += L"\" "; + } + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CBorder::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + nullable m_oWidth; + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:color", m_oColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:frame", m_oFrame ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:shadow", m_oShadow ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:space", m_oSpace ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:sz", m_oSz ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeColor", m_oThemeColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeShade", m_oThemeShade ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeTint", m_oThemeTint ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_Read_else_if(oReader, L"wx:bdrwidth", m_oWidth) + WritingElement_ReadAttributes_End( oReader ) + + if (m_oWidth.IsInit()) + { + m_oSz.Init(); m_oSz->SetValue((int)(m_oWidth->GetValue() * 8)); + } + } + +//-------------------------------------------------------------------------------- +// rFonts (Fonts) 17.3.2.20 (Part 1) +//-------------------------------------------------------------------------------- + + CFonts::CFonts() + { + } + CFonts::~CFonts() + { + } + + void CFonts::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:ascii", m_sAscii); + XmlMacroReadAttributeBase(oNode, L"w:asciiTheme", m_oAsciiTheme); + XmlMacroReadAttributeBase(oNode, L"w:cs", m_sCs); + XmlMacroReadAttributeBase(oNode, L"w:cstheme", m_oCsTheme); + XmlMacroReadAttributeBase(oNode, L"w:eastAsia", m_sEastAsia); + XmlMacroReadAttributeBase(oNode, L"w:eastAsiaTheme", m_oEastAsiaTheme); + XmlMacroReadAttributeBase(oNode, L"w:hAnsi", m_sHAnsi); + XmlMacroReadAttributeBase(oNode, L"w:hAnsiTheme", m_oHAnsiTheme); + XmlMacroReadAttributeBase(oNode, L"w:hint", m_oHint); + } + void CFonts::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CFonts::ToString() const + { + std::wstring sResult; + + if (m_oHint.IsInit()) + { + sResult += L"w:hint=\""; + sResult += m_oHint->ToString(); + sResult += L"\" "; + } + if (m_sAscii.IsInit()) + { + sResult += L"w:ascii=\""; + sResult += m_sAscii.get2(); + sResult += L"\" "; + } + if (m_sHAnsi.IsInit()) + { + sResult += L"w:hAnsi=\""; + sResult += m_sHAnsi.get2(); + sResult += L"\" "; + } + if (m_sEastAsia.IsInit()) + { + sResult += L"w:eastAsia=\""; + sResult += m_sEastAsia.get2(); + sResult += L"\" "; + } + if (m_sCs.IsInit()) + { + sResult += L"w:cs=\""; + sResult += m_sCs.get2(); + sResult += L"\" "; + } + if (m_oAsciiTheme.IsInit()) + { + sResult += L"w:asciiTheme=\""; + sResult += m_oAsciiTheme->ToString(); + sResult += L"\" "; + } + if (m_oHAnsiTheme.IsInit()) + { + sResult += L"w:hAnsiTheme=\""; + sResult += m_oHAnsiTheme->ToString(); + sResult += L"\" "; + } + if (m_oEastAsiaTheme.IsInit()) + { + sResult += L"w:eastAsiaTheme=\""; + sResult += m_oEastAsiaTheme->ToString(); + sResult += L"\" "; + } + if (m_oCsTheme.IsInit()) + { + sResult += L"w:cstheme=\""; + sResult += m_oCsTheme->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CFonts::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w:ascii", m_sAscii) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:asciiTheme", m_oAsciiTheme) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:cs", m_sCs) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:cstheme", m_oCsTheme) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:eastAsia", m_sEastAsia) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:eastAsiaTheme", m_oEastAsiaTheme) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hAnsi", m_sHAnsi) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hAnsiTheme", m_oHAnsiTheme) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hint", m_oHint) + //2003 + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:h-ansi", m_oHint) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:fareast", m_sEastAsia) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// Lang (Language) 17.3.2.20 (Part 1) +//-------------------------------------------------------------------------------- + + CLanguage::CLanguage() + { + } + CLanguage::~CLanguage() + { + } + + void CLanguage::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:bidi", m_oBidi ); + XmlMacroReadAttributeBase(oNode, L"w:eastAsia", m_oEastAsia ); + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); + } + void CLanguage::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CLanguage::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += *m_oVal; + sResult += L"\" "; + } + if (m_oEastAsia.IsInit()) + { + sResult += L"w:eastAsia=\""; + sResult += *m_oEastAsia; + sResult += L"\" "; + } + if ( m_oBidi.IsInit() ) + { + sResult += L"w:bidi=\""; + sResult += *m_oBidi; + sResult += L"\" "; + } + + return sResult; + } + void CLanguage::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:bidi", m_oBidi ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:eastAsia", m_oEastAsia ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// Lang (Language) 17.3.3.14 (Part 1) +//-------------------------------------------------------------------------------- + + CLang::CLang() + { + } + CLang::~CLang() + { + } + + void CLang::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CLang::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CLang::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += *m_oVal; + sResult += L"\" "; + } + return sResult; + } + + void CLang::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// Shading 17.3.5 (Part 1) +//-------------------------------------------------------------------------------- + + CShading::CShading() + { + } + CShading::~CShading() + { + } + + void CShading::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:color", m_oColor ); + XmlMacroReadAttributeBase(oNode, L"w:fill", m_oFill ); + XmlMacroReadAttributeBase(oNode, L"w:themeColor", m_oThemeColor ); + XmlMacroReadAttributeBase(oNode, L"w:themeFill", m_oThemeFill ); + XmlMacroReadAttributeBase(oNode, L"w:themeFillShade", m_oThemeFillShade ); + XmlMacroReadAttributeBase(oNode, L"w:themeFillTint", m_oThemeFillTint ); + XmlMacroReadAttributeBase(oNode, L"w:themeShade", m_oThemeShade ); + XmlMacroReadAttributeBase(oNode, L"w:themeTint", m_oThemeTint ); + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); + } + void CShading::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CShading::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + if ( m_oColor.IsInit() ) + { + sResult += L"w:color=\""; + sResult += m_oColor->ToStringNoAlpha(); + sResult += L"\" "; + } + if ( m_oThemeColor.IsInit() ) + { + sResult += L"w:themeColor=\""; + sResult += m_oThemeColor->ToString(); + sResult += L"\" "; + } + if (m_oThemeTint.IsInit()) + { + sResult += L"w:themeTint=\""; + sResult += m_oThemeTint->ToString(); + sResult += L"\" "; + } + if (m_oThemeShade.IsInit()) + { + sResult += L"w:themeShade=\""; + sResult += m_oThemeShade->ToString(); + sResult += L"\" "; + } + if (m_oFill.IsInit()) + { + sResult += L"w:fill=\""; + sResult += m_oFill->ToStringNoAlpha(); + sResult += L"\" "; + } + if (m_oThemeFill.IsInit()) + { + sResult += L"w:themeFill=\""; + sResult += m_oThemeFill->ToString(); + sResult += L"\" "; + } + if (m_oThemeFillTint.IsInit()) + { + sResult += L"w:themeFillTint=\""; + sResult += m_oThemeFillTint->ToString(); + sResult += L"\" "; + } + if (m_oThemeFillShade.IsInit()) + { + sResult += L"w:themeFillShade=\""; + sResult += m_oThemeFillShade->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CShading::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:color", m_oColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:fill", m_oFill ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeColor", m_oThemeColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeFill", m_oThemeFill ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeFillShade", m_oThemeFillShade ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeFillTint", m_oThemeFillTint ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeShade", m_oThemeShade ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeTint", m_oThemeTint ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// TblWidth 17.4.88 (Part 1) +//-------------------------------------------------------------------------------- + + CTblWidth::CTblWidth() + { + } + CTblWidth::~CTblWidth() + { + } + + void CTblWidth::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:type", m_oType ); + XmlMacroReadAttributeBase( oNode, L"w:w", m_oW ); + } + void CTblWidth::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTblWidth::ToString() const + { + std::wstring sResult; + + if ( m_oType.IsInit() ) + { + sResult += L"w:type=\""; + sResult += m_oType->ToString(); + sResult += L"\" "; + } + + if ( m_oW.IsInit() ) + { + sResult += L"w:w=\""; + sResult += m_oW->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CTblWidth::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:type", m_oType ) + else if ( L"w:w" == wsName ) + { + //bug 42023 w:w="460.60pt" (EP_C2crapportd_aptitudeprofessionnelle.docx) + SimpleTypes::CUniversalMeasureOrPercent oUniversalMeasure; + std::wstring sValue = oReader.GetText(); + oUniversalMeasure.FromString(sValue); + m_oW.Init(); + if(oUniversalMeasure.IsUnits()) + { + m_oType.Init(); + m_oType->SetValue(SimpleTypes::tblwidthDxa); + m_oW->SetValue(oUniversalMeasure.ToTwips()); + //ignore type attribute + break; + } + else if(oUniversalMeasure.IsPercent()) + { + m_oType.Init(); + m_oType->SetValue(SimpleTypes::tblwidthPct); + m_oW->SetPercent(true); + m_oW->SetValue(oUniversalMeasure.GetValue()); + //ignore type attribute + break; + } + else + { + m_oW->SetValue(oUniversalMeasure.GetValue()); + } + } + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// OnOff 17.17.4 (Part 1) +//-------------------------------------------------------------------------------- + + COnOff::COnOff() + { + } + COnOff::~COnOff() + { + } + void COnOff::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void COnOff::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring COnOff::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + + void COnOff::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// COnOff2 +//-------------------------------------------------------------------------------- + + COnOff2::COnOff2() + { + } + + COnOff2::~COnOff2() + { + } + + void COnOff2::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + + void COnOff2::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + + std::wstring COnOff2::ToString() const + { + std::wstring sResult; + + sResult += L"w:val=\"" + m_oVal.ToString() + L"\" "; + + return sResult; + } + + void COnOff2::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start_No_NS( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"val", m_oVal ) + WritingElement_ReadAttributes_End_No_NS( oReader ) + } + + std::wstring COnOff2::ValNode(const std::wstring &node_name) + { + if (m_oVal.ToBool()) + return L"<" + node_name + L"/>"; + else + return L"<" + node_name + L" w:val=\"0\"/>"; + return L""; + } + +//-------------------------------------------------------------------------------- +// String 17.3.1.27 (Part 1) +//-------------------------------------------------------------------------------- + + String::String() + { + } + String::~String() + { + } + + void String::FromXML(XmlUtils::CXmlNode& oNode) + { + std::vector attNames, attValues; + oNode.GetAllAttributes(attNames,attValues); + for(size_t i = 0; i < attNames.size(); ++i) + { + if(XmlUtils::GetNameNoNS(attNames[i]) == L"val") + { + m_sVal = attValues[i]; + } + } + } + void String::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring String::ToString() const + { + return ToStringWithNS(L"w:"); + } + std::wstring String::ToStringWithNS(const std::wstring& ns) const + { + std::wstring sResult; + + if ( m_sVal.IsInit() ) + { + sResult += ns; + sResult += L"val=\""; + sResult += XmlUtils::EncodeXmlString(*m_sVal, false); + sResult += L"\" "; + } + return sResult; + } + std::wstring String::ToString2() const + { + std::wstring sResult; + + if ( m_sVal.IsInit() ) + sResult += *m_sVal; + + return sResult; + } + + void String::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start_No_NS( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"val", m_sVal ) + WritingElement_ReadAttributes_End_No_NS( oReader ) + } + +//-------------------------------------------------------------------------------- +// Spacing (SignedTwipsMeasure) 17.3.2.19 (Part 1) +//-------------------------------------------------------------------------------- + + CSignedTwipsMeasure::CSignedTwipsMeasure() + { + } + CSignedTwipsMeasure::~CSignedTwipsMeasure() + { + } + + void CSignedTwipsMeasure::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CSignedTwipsMeasure::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CSignedTwipsMeasure::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CSignedTwipsMeasure::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// Kern (HpsMeasure) 17.3.2.19 (Part 1) +//-------------------------------------------------------------------------------- + + CHpsMeasure::CHpsMeasure() + { + } + CHpsMeasure::~CHpsMeasure() + { + } + + void CHpsMeasure::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CHpsMeasure::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CHpsMeasure::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += std::to_wstring(m_oVal->ToHps()); + sResult += L"\" "; + } + + return sResult; + } + + void CHpsMeasure::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// Border 17.3.2.6 (Part 1) +//-------------------------------------------------------------------------------- + + CColor::CColor() + { + } + CColor::~CColor() + { + } + void CColor::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:themeColor", m_oThemeColor ); + XmlMacroReadAttributeBase( oNode, L"w:themeShade", m_oThemeShade ); + XmlMacroReadAttributeBase( oNode, L"w:themeTint", m_oThemeTint ); + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CColor::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CColor::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToStringNoAlpha(); + sResult += L"\" "; + } + if ( m_oThemeColor.IsInit() ) + { + sResult += L"w:themeColor=\""; + sResult += m_oThemeColor->ToString(); + sResult += L"\" "; + } + if (m_oThemeTint.IsInit()) + { + sResult += L"w:themeTint=\""; + sResult += m_oThemeTint->ToString(); + sResult += L"\" "; + } + if ( m_oThemeShade.IsInit() ) + { + sResult += L"w:themeShade=\""; + sResult += m_oThemeShade->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CColor::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:themeColor", m_oThemeColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeShade", m_oThemeShade ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeTint", m_oThemeTint ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// Position (HpsMeasure) 17.3.2.19 (Part 1) +//-------------------------------------------------------------------------------- + + CSignedHpsMeasure::CSignedHpsMeasure() + { + } + CSignedHpsMeasure::~CSignedHpsMeasure() + { + } + + void CSignedHpsMeasure::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CSignedHpsMeasure::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CSignedHpsMeasure::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CSignedHpsMeasure::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// NumFmt 17.11.17 (Part 1) +//-------------------------------------------------------------------------------- + + CNumFmt::CNumFmt() + { + } + CNumFmt::~CNumFmt() + { + } + + void CNumFmt::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:format", m_sFormat ); + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); + } + void CNumFmt::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CNumFmt::ToString() const + { + std::wstring sResult; + + if ( m_sFormat.IsInit() ) + { + sResult += L"w:format=\""; + sResult += m_sFormat.get2(); + sResult += L"\" "; + } + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CNumFmt::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:format", m_sFormat ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// NumFmt 17.11.19 (Part 1) +//-------------------------------------------------------------------------------- + + CNumRestart::CNumRestart() + { + } + CNumRestart::~CNumRestart() + { + } + void CNumRestart::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); + } + void CNumRestart::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CNumRestart::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CNumRestart::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// DecimalNumber 17.3.1.10 (Part 1) +//-------------------------------------------------------------------------------- + + CDecimalNumber::CDecimalNumber() + { + } + CDecimalNumber::~CDecimalNumber() + { + } + void CDecimalNumber::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ComplexTypes::CDecimalNumber::FromXML(oReader); + } + void CDecimalNumber::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + std::wstring CDecimalNumber::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\"" + std::to_wstring(*m_oVal) + L"\" "; + } + + return sResult; + } + +//-------------------------------------------------------------------------------- +// DecimalNumberOrPrecent 17.3.1.10 (Part 1) +//-------------------------------------------------------------------------------- + + CDecimalNumberOrPrecent::CDecimalNumberOrPrecent() + { + } + CDecimalNumberOrPrecent::~CDecimalNumberOrPrecent() + { + } + + void CDecimalNumberOrPrecent::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CDecimalNumberOrPrecent::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CDecimalNumberOrPrecent::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CDecimalNumberOrPrecent::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// Rel 17.6.14 (Part 1) +//-------------------------------------------------------------------------------- + + CRel::CRel() + { + } + CRel::~CRel() + { + } + + void CRel::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"r:id", m_oId ); + if (false == m_oId.IsInit()) + { + XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); + } + } + void CRel::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CRel::ToString() const + { + std::wstring sResult; + + if ( m_oId.IsInit() ) + { + sResult += L"r:id=\""; + sResult += m_oId->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CRel::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start_No_NS( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"id", m_oId ) //r:id or relationships:id + WritingElement_ReadAttributes_End_No_NS( oReader ) + } + +//-------------------------------------------------------------------------------- +// TextDirection 17.6.14 (Part 1) +//-------------------------------------------------------------------------------- + + CTextDirection::CTextDirection() + { + } + CTextDirection::~CTextDirection() + { + } + + void CTextDirection::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CTextDirection::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTextDirection::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CTextDirection::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// VerticalJc 17.6.23 (Part 1) +//-------------------------------------------------------------------------------- + + CVerticalJc::CVerticalJc() + { + } + CVerticalJc::~CVerticalJc() + { + } + + void CVerticalJc::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CVerticalJc::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CVerticalJc::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CVerticalJc::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// cnfStyle (Cnf) 17.3.1.8 (Part 1) + 9.2.1.1 (Part 4) +//-------------------------------------------------------------------------------- + + CCnf::CCnf() + { + } + CCnf::~CCnf() + { + } + + void CCnf::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:evenHBand", m_oEvenHBand ); + XmlMacroReadAttributeBase( oNode, L"w:evenVBand", m_oEvenVBand ); + XmlMacroReadAttributeBase( oNode, L"w:firstColumn", m_oFirstColumn ); + XmlMacroReadAttributeBase( oNode, L"w:firstRow", m_oFirstRow ); + XmlMacroReadAttributeBase( oNode, L"w:firstRowFirstColumn", m_oFirstRowFirstColumn ); + XmlMacroReadAttributeBase( oNode, L"w:firstRowLastColumn", m_oFirstRowLastColumn ); + XmlMacroReadAttributeBase( oNode, L"w:lastColumn", m_oLastColumn ); + XmlMacroReadAttributeBase( oNode, L"w:lastRow", m_oLastRow ); + XmlMacroReadAttributeBase( oNode, L"w:lastRowFirstColumn", m_oLastRowFirstColumn ); + XmlMacroReadAttributeBase( oNode, L"w:lastRowLastColumn", m_oLastRowLastColumn ); + XmlMacroReadAttributeBase( oNode, L"w:oddHBand", m_oOddHBand ); + XmlMacroReadAttributeBase( oNode, L"w:oddVBand", m_oOddVBand ); + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CCnf::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CCnf::ToString() const + { + std::wstring sResult; + + if ( m_oEvenHBand.IsInit() ) + { + sResult += L"w:evenHBand=\""; + sResult += m_oEvenHBand->ToString(); + sResult += L"\" "; + } + if ( m_oEvenVBand.IsInit() ) + { + sResult += L"w:evenVBand=\""; + sResult += m_oEvenVBand->ToString(); + sResult += L"\" "; + } + if ( m_oFirstColumn.IsInit() ) + { + sResult += L"w:firstColumn=\""; + sResult += m_oFirstColumn->ToString(); + sResult += L"\" "; + } + if ( m_oFirstRow.IsInit() ) + { + sResult += L"w:firstRow=\""; + sResult += m_oFirstRow->ToString(); + sResult += L"\" "; + } + if ( m_oFirstRowFirstColumn.IsInit() ) + { + sResult += L"w:firstRowFirstColumn=\""; + sResult += m_oFirstRowFirstColumn->ToString(); + sResult += L"\" "; + } + if ( m_oFirstRowLastColumn.IsInit() ) + { + sResult += L"w:firstRowLastColumn=\""; + sResult += m_oFirstRowLastColumn->ToString(); + sResult += L"\" "; + } + if ( m_oLastColumn.IsInit() ) + { + sResult += L"w:lastColumn=\""; + sResult += m_oLastColumn->ToString(); + sResult += L"\" "; + } + if ( m_oLastRow.IsInit() ) + { + sResult += L"w:lastRow=\""; + sResult += m_oLastRow->ToString(); + sResult += L"\" "; + } + if ( m_oLastRowFirstColumn.IsInit() ) + { + sResult += L"w:lastRowFirstColumn=\""; + sResult += m_oLastRowFirstColumn->ToString(); + sResult += L"\" "; + } + if ( m_oLastRowLastColumn.IsInit() ) + { + sResult += L"w:lastRowLastColumn=\""; + sResult += m_oLastRowLastColumn->ToString(); + sResult += L"\" "; + } + if ( m_oOddHBand.IsInit() ) + { + sResult += L"w:oddHBand=\""; + sResult += m_oOddHBand->ToString(); + sResult += L"\" "; + } + if ( m_oOddVBand.IsInit() ) + { + sResult += L"w:oddVBand=\""; + sResult += m_oOddVBand->ToString(); + sResult += L"\" "; + } + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CCnf::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:evenHBand", m_oEvenHBand ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:evenVBand", m_oEvenVBand ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstColumn", m_oFirstColumn ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstRow", m_oFirstRow ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstRowFirstColumn", m_oFirstRowFirstColumn ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstRowLastColumn", m_oFirstRowLastColumn ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastColumn", m_oLastColumn ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastRow", m_oLastRow ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastRowFirstColumn", m_oLastRowFirstColumn ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastRowLastColumn", m_oLastRowLastColumn ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:oddHBand", m_oOddHBand ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:oddVBand", m_oOddVBand ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// jc (Jc) 17.3.1.13 (Part 1) +//-------------------------------------------------------------------------------- + + CJc::CJc() + { + } + CJc::~CJc() + { + } + void CJc::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CJc::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CJc::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CJc::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// TrackChange 17.13.5.19 (Part 1) +//-------------------------------------------------------------------------------- + + CTrackChange::CTrackChange() + { + } + CTrackChange::~CTrackChange() + { + } + + void CTrackChange::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:author", m_sAuthor ); + XmlMacroReadAttributeBase( oNode, L"w:date", m_oDate ); + XmlMacroReadAttributeBase( oNode, L"w:id", m_oId ); + XmlMacroReadAttributeBase( oNode, L"oouserid", m_sUserId ); + } + void CTrackChange::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTrackChange::ToString() const + { + std::wstring sResult; + + if ( m_oId.IsInit() ) + { + sResult += L"w:id=\""; + sResult += m_oId->ToString(); + sResult += L"\" "; + } + if ( m_sAuthor.IsInit() ) + { + sResult += L"w:author=\""; + sResult += m_sAuthor.get2(); + sResult += L"\" "; + } + if ( m_oDate.IsInit() ) + { + sResult += L"w:date=\""; + sResult += m_oDate->ToString(); + sResult += L"\" "; + } + if ( m_sUserId.IsInit() ) + { + sResult += L"oouserid=\""; + sResult += m_sUserId.get2(); + sResult += L"\" "; + } + return sResult; + } + + void CTrackChange::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:author", m_sAuthor ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:date", m_oDate ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:id", m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"oouserid", m_sUserId ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// LongHexNumber 17.9.30 (Part 1) +//-------------------------------------------------------------------------------- + + CLongHexNumber::CLongHexNumber() + { + } + CLongHexNumber::~CLongHexNumber() + { + } + + void CLongHexNumber::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CLongHexNumber::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CLongHexNumber::ToString() const + { + std::wstring sResult; + + ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); + + return sResult; + } + + void CLongHexNumber::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// UnsignedDecimalNumber 17.16.32 (Part 1) +//-------------------------------------------------------------------------------- + + CUnsignedDecimalNumber::CUnsignedDecimalNumber() + { + } + CUnsignedDecimalNumber::~CUnsignedDecimalNumber() + { + } + + void CUnsignedDecimalNumber::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CUnsignedDecimalNumber::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CUnsignedDecimalNumber::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CUnsignedDecimalNumber::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// TwipsMeasure 17.15.1.25 (Part 1) +//-------------------------------------------------------------------------------- + + CTwipsMeasure::CTwipsMeasure() + { + } + CTwipsMeasure::~CTwipsMeasure() + { + } + + void CTwipsMeasure::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CTwipsMeasure::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTwipsMeasure::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CTwipsMeasure::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + +//-------------------------------------------------------------------------------- +// Empty 17.15.1.48 (Part 1) +//-------------------------------------------------------------------------------- + + CEmpty::CEmpty() + { + } + CEmpty::~CEmpty() + { + } + + void CEmpty::FromXML(XmlUtils::CXmlNode& oNode) + { + } + void CEmpty::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + } + std::wstring CEmpty::ToString() const + { + return L""; + } + +//-------------------------------------------------------------------------------- +// MatchSrc 17.17.2.3 (Part 1) +//-------------------------------------------------------------------------------- + + CMatchSrc::CMatchSrc() + { + } + CMatchSrc::~CMatchSrc() + { + } + + void CMatchSrc::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CMatchSrc::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CMatchSrc::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CMatchSrc::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// EdnPos 17.11.22 (Part 1) +//-------------------------------------------------------------------------------- + + CEdnPos::CEdnPos() + { + } + CEdnPos::~CEdnPos() + { + } + + void CEdnPos::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CEdnPos::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CEdnPos::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CEdnPos::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// FtnPos 17.11.21 (Part 1) +//-------------------------------------------------------------------------------- + + CFtnPos::CFtnPos() + { + } + CFtnPos::~CFtnPos() + { + } + + void CFtnPos::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CFtnPos::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CFtnPos::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CFtnPos::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + +//-------------------------------------------------------------------------------- +// +//-------------------------------------------------------------------------------- + + CDocPartGallery::CDocPartGallery() + { + } + CDocPartGallery::~CDocPartGallery() + { + } + + void CDocPartGallery::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CDocPartGallery::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CDocPartGallery::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\"" + m_oVal->ToString() + L"\" "; + } + + return sResult; + } + + void CDocPartGallery::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// +//-------------------------------------------------------------------------------- + + CDocPartBehavior::CDocPartBehavior() {} + CDocPartBehavior::~CDocPartBehavior() {} + + void CDocPartBehavior::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CDocPartBehavior::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CDocPartBehavior::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\"" + m_oVal->ToString() + L"\" "; + } + return sResult; + } + + void CDocPartBehavior::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// EastAsianLayout 17.3.2.10 (Part 1) +//-------------------------------------------------------------------------------- + + CEastAsianLayout::CEastAsianLayout() + { + } + CEastAsianLayout::~CEastAsianLayout() + { + } + + void CEastAsianLayout::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:combine", m_oCombine); + XmlMacroReadAttributeBase(oNode, L"w:combineBrackets", m_oCombineBrackets); + XmlMacroReadAttributeBase(oNode, L"w:id", m_oID); + XmlMacroReadAttributeBase(oNode, L"w:vert", m_oVert); + XmlMacroReadAttributeBase(oNode, L"w:vertCompress", m_oVertCompress); + } + void CEastAsianLayout::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CEastAsianLayout::ToString() const + { + std::wstring sResult; + + if (m_oCombine.IsInit()) + { + sResult += L"w:combine=\""; + sResult += m_oCombine->ToString(); + sResult += L"\" "; + } + if (m_oCombineBrackets.IsInit()) + { + sResult += L"w:combineBrackets=\""; + sResult += m_oCombineBrackets->ToString(); + sResult += L"\" "; + } + if (m_oID.IsInit()) + { + sResult += L"w:themeTint=\""; + sResult += m_oID->ToString(); + sResult += L"\" "; + } + if (m_oVert.IsInit()) + { + sResult += L"w:vert=\""; + sResult += m_oVert->ToString(); + sResult += L"\" "; + } + if (m_oVertCompress.IsInit()) + { + sResult += L"w:vertCompress=\""; + sResult += m_oVert->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CEastAsianLayout::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w:combine", m_oCombine) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:combineBrackets", m_oCombineBrackets) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:id", m_oID) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:vert", m_oVert) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:vertCompress", m_oVertCompress) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// Effect 17.3.2.11 (Part 1) +//-------------------------------------------------------------------------------- + + CTextEffect::CTextEffect() + { + } + CTextEffect::~CTextEffect() + { + } + + void CTextEffect::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CTextEffect::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CTextEffect::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CTextEffect::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// Em 17.3.2.12 (Part 1) +//-------------------------------------------------------------------------------- + + CEm::CEm() + { + } + CEm::~CEm() + { + } + + void CEm::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CEm::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CEm::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CEm::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// FitText 17.3.2.14 (Part 1) +//-------------------------------------------------------------------------------- + + CFitText::CFitText() + { + } + CFitText::~CFitText() + { + } + + void CFitText::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:id", m_oID); + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CFitText::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CFitText::ToString() const + { + std::wstring sResult; + + if (m_oID.IsInit()) + { + sResult += L"w:id=\""; + sResult += m_oID->ToString(); + sResult += L"\" "; + } + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CFitText::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w:id", m_oID) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// Highlight 17.3.2.14 (Part 1) +//-------------------------------------------------------------------------------- + + CHighlight::CHighlight() + { + } + CHighlight::~CHighlight() + { + } + + void CHighlight::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CHighlight::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CHighlight::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CHighlight::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// u (Underline) 17.3.2.40 (Part 1) +//-------------------------------------------------------------------------------- + + CUnderline::CUnderline() + { + } + CUnderline::~CUnderline() + { + } + void CUnderline::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:color", m_oColor); + XmlMacroReadAttributeBase(oNode, L"w:themeColor", m_oThemeColor); + XmlMacroReadAttributeBase(oNode, L"w:themeShade", m_oThemeShade); + XmlMacroReadAttributeBase(oNode, L"w:themeTint", m_oThemeTint); + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CUnderline::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CUnderline::ToString() const + { + std::wstring sResult; + + if (m_oColor.IsInit()) + { + sResult += L"w:color=\""; + sResult += m_oColor->ToString(); + sResult += L"\" "; + } + if (m_oThemeColor.IsInit()) + { + sResult += L"w:themeColor=\""; + sResult += m_oThemeColor->ToString(); + sResult += L"\" "; + } + if (m_oThemeShade.IsInit()) + { + sResult += L"w:themeShade=\""; + sResult += m_oThemeShade->ToString(); + sResult += L"\" "; + } + if (m_oThemeTint.IsInit()) + { + sResult += L"w:themeTint=\""; + sResult += m_oThemeTint->ToString(); + sResult += L"\" "; + } + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CUnderline::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w:color", m_oColor) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:themeColor", m_oThemeColor) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:themeShade", m_oThemeShade) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:themeTint", m_oThemeTint) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// vertAlign (VerticalAlignRun) 17.3.2.40 (Part 1) +//-------------------------------------------------------------------------------- + + CVerticalAlignRun::CVerticalAlignRun() + { + } + CVerticalAlignRun::~CVerticalAlignRun() + { + } + void CVerticalAlignRun::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CVerticalAlignRun::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CVerticalAlignRun::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CVerticalAlignRun::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// w (TextScale) 17.3.2.40 (Part 1) +//-------------------------------------------------------------------------------- + + CTextScale::CTextScale() + { + } + CTextScale::~CTextScale() + { + } + void CTextScale::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CTextScale::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CTextScale::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CTextScale::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// framePr (FramePr) 17.3.1.11 (Part 1) +//-------------------------------------------------------------------------------- + + CFramePr::CFramePr() + { + } + CFramePr::~CFramePr() + { + } + + void CFramePr::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:anchorLock", m_oAnchorLock); + XmlMacroReadAttributeBase(oNode, L"w:dropCap", m_oDropCap); + XmlMacroReadAttributeBase(oNode, L"w:h", m_oH); + XmlMacroReadAttributeBase(oNode, L"w:hAnchor", m_oHAnchor); + XmlMacroReadAttributeBase(oNode, L"w:hRule", m_oHRule); + XmlMacroReadAttributeBase(oNode, L"w:hSpace", m_oHSpace); + XmlMacroReadAttributeBase(oNode, L"w:lines", m_oLines); + XmlMacroReadAttributeBase(oNode, L"w:vAnchor", m_oVAnchor); + XmlMacroReadAttributeBase(oNode, L"w:vSpace", m_oVSpace); + XmlMacroReadAttributeBase(oNode, L"w:w", m_oW); + XmlMacroReadAttributeBase(oNode, L"w:wrap", m_oWrap); + XmlMacroReadAttributeBase(oNode, L"w:x", m_oX); + XmlMacroReadAttributeBase(oNode, L"w:xAlign", m_oXAlign); + XmlMacroReadAttributeBase(oNode, L"w:y", m_oY); + XmlMacroReadAttributeBase(oNode, L"w:yAlign", m_oYAlign); + } + void CFramePr::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CFramePr::ToString() const + { + std::wstring sResult; + + if (m_oAnchorLock.IsInit()) + { + sResult += L"w:anchorLock=\""; + sResult += m_oAnchorLock->ToString(); + sResult += L"\" "; + } + if (m_oDropCap.IsInit()) + { + sResult += L"w:dropCap=\""; + sResult += m_oDropCap->ToString(); + sResult += L"\" "; + } + if (m_oH.IsInit()) + { + sResult += L"w:h=\""; + sResult += m_oH->ToString(); + sResult += L"\" "; + } + if (m_oHAnchor.IsInit()) + { + sResult += L"w:hAnchor=\""; + sResult += m_oHAnchor->ToString(); + sResult += L"\" "; + } + if (m_oHRule.IsInit()) + { + sResult += L"w:hRule=\""; + sResult += m_oHRule->ToString(); + sResult += L"\" "; + } + if (m_oHSpace.IsInit()) + { + sResult += L"w:hSpace=\""; + sResult += m_oHSpace->ToString(); + sResult += L"\" "; + } + if (m_oLines.IsInit()) + { + sResult += L"w:lines=\""; + sResult += m_oLines->ToString(); + sResult += L"\" "; + } + if (m_oVAnchor.IsInit()) + { + sResult += L"w:vAnchor=\""; + sResult += m_oVAnchor->ToString(); + sResult += L"\" "; + } + if (m_oVSpace.IsInit()) + { + sResult += L"w:vSpace=\""; + sResult += m_oVSpace->ToString(); + sResult += L"\" "; + } + if (m_oW.IsInit()) + { + sResult += L"w:w=\""; + sResult += m_oW->ToString(); + sResult += L"\" "; + } + if (m_oWrap.IsInit()) + { + sResult += L"w:wrap=\""; + sResult += m_oWrap->ToString(); + sResult += L"\" "; + } + if (m_oX.IsInit()) + { + sResult += L"w:x=\""; + sResult += m_oX->ToString(); + sResult += L"\" "; + } + if (m_oXAlign.IsInit()) + { + sResult += L"w:xAlign=\""; + sResult += m_oXAlign->ToString(); + sResult += L"\" "; + } + if (m_oY.IsInit()) + { + sResult += L"w:y=\""; + sResult += m_oY->ToString(); + sResult += L"\" "; + } + if (m_oYAlign.IsInit()) + { + sResult += L"w:yAlign=\""; + sResult += m_oYAlign->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CFramePr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w:anchorLock", m_oAnchorLock) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:dropCap", m_oDropCap) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:h", m_oH) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hAnchor", m_oHAnchor) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hRule", m_oHRule) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hSpace", m_oHSpace) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:lines", m_oLines) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:vAnchor", m_oVAnchor) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:vSpace", m_oVSpace) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:w", m_oW) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:wrap", m_oWrap) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:x", m_oX) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:xAlign", m_oXAlign) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:y", m_oY) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:yAlign", m_oYAlign) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// ind (Ind) 17.3.1.12 (Part 1) + 9.2.1.2 (Part 4) +//-------------------------------------------------------------------------------- + + CInd::CInd() + { + } + CInd::~CInd() + { + } + void CInd::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:end", m_oEnd); + XmlMacroReadAttributeBase(oNode, L"w:endChars", m_oEndChars); + XmlMacroReadAttributeBase(oNode, L"w:firstLine", m_oFirstLine); + XmlMacroReadAttributeBase(oNode, L"w:firstLineChars", m_oFirstLineChars); + XmlMacroReadAttributeBase(oNode, L"w:hanging", m_oHanging); + XmlMacroReadAttributeBase(oNode, L"w:hangingChars", m_oHangingChars); + XmlMacroReadAttributeBase(oNode, L"w:start", m_oStart); + XmlMacroReadAttributeBase(oNode, L"w:startChars", m_oStartChars); + + // См. 9.2.1.2 Part4 + if (!m_oStart.IsInit()) + XmlMacroReadAttributeBase(oNode, L"w:left", m_oStart); + if (!m_oStartChars.IsInit()) + XmlMacroReadAttributeBase(oNode, L"w:leftChars", m_oStartChars); + if (!m_oEnd.IsInit()) + XmlMacroReadAttributeBase(oNode, L"w:right", m_oEnd); + if (!m_oEndChars.IsInit()) + XmlMacroReadAttributeBase(oNode, L"w:rightChars", m_oEndChars); + } + void CInd::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CInd::ToString() const + { + std::wstring sResult; + + if (m_oEnd.IsInit()) + { + sResult += L"w:end=\""; + sResult += m_oEnd->ToString(); + sResult += L"\" "; + } + + if (m_oEndChars.IsInit()) + { + sResult += L"w:endChars=\""; + sResult += m_oEndChars->ToString(); + sResult += L"\" "; + } + + if (m_oFirstLine.IsInit()) + { + sResult += L"w:firstLine=\""; + sResult += m_oFirstLine->ToString(); + sResult += L"\" "; + } + + if (m_oFirstLineChars.IsInit()) + { + sResult += L"w:firstLineChars=\""; + sResult += m_oFirstLineChars->ToString(); + sResult += L"\" "; + } + + if (m_oHanging.IsInit()) + { + sResult += L"w:hanging=\""; + sResult += m_oHanging->ToString(); + sResult += L"\" "; + } + + if (m_oHangingChars.IsInit()) + { + sResult += L"w:hangingChars=\""; + sResult += m_oHangingChars->ToString(); + sResult += L"\" "; + } + + if (m_oStart.IsInit()) + { + sResult += L"w:start=\""; + sResult += m_oStart->ToString(); + sResult += L"\" "; + } + + if (m_oStartChars.IsInit()) + { + sResult += L"w:startChars=\""; + sResult += m_oStartChars->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CInd::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w:end", m_oEnd) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:endChars", m_oEndChars) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:firstLine", m_oFirstLine) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:firstLineChars", m_oFirstLineChars) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hanging", m_oHanging) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hangingChars", m_oHangingChars) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:start", m_oStart) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:startChars", m_oStartChars) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:left", m_oStart) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:leftChars", m_oStartChars) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:right", m_oEnd) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:rightChars", m_oEndChars) + //2003 + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:first-line", m_oFirstLine) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:first-line-chars", m_oFirstLineChars) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hanging-chars", m_oHangingChars) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:left-chars", m_oStartChars) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:right-charss", m_oEndChars) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// Spacing 17.3.1.33 (Part 1) +//-------------------------------------------------------------------------------- + + CSpacing::CSpacing() + { + } + CSpacing::~CSpacing() + { + } + + void CSpacing::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:after", m_oAfter); + XmlMacroReadAttributeBase(oNode, L"w:afterAutospacing", m_oAfterAutospacing); + XmlMacroReadAttributeBase(oNode, L"w:afterLines", m_oAfterLines); + XmlMacroReadAttributeBase(oNode, L"w:before", m_oBefore); + XmlMacroReadAttributeBase(oNode, L"w:beforeAutospacing", m_oBeforeAutospacing); + XmlMacroReadAttributeBase(oNode, L"w:beforeLines", m_oBeforeLines); + XmlMacroReadAttributeBase(oNode, L"w:line", m_oLine); + XmlMacroReadAttributeBase(oNode, L"w:lineRule", m_oLineRule); + } + void CSpacing::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CSpacing::ToString() const + { + std::wstring sResult; + + if (m_oAfter.IsInit()) + { + sResult += L"w:after=\""; + sResult += m_oAfter->ToString(); + sResult += L"\" "; + } + + if (m_oAfterAutospacing.IsInit()) + { + sResult += L"w:afterAutospacing=\"" + std::wstring(m_oAfterAutospacing->ToBool() ? L"1" : L"0") + L"\" "; + } + + if (m_oAfterLines.IsInit()) + { + sResult += L"w:afterLines=\""; + sResult += m_oAfterLines->ToString(); + sResult += L"\" "; + } + + if (m_oBefore.IsInit()) + { + sResult += L"w:before=\""; + sResult += m_oBefore->ToString(); + sResult += L"\" "; + } + + if (m_oBeforeAutospacing.IsInit()) + { + sResult += L"w:beforeAutospacing=\"" + std::wstring(m_oBeforeAutospacing->ToBool() ? L"1" : L"0") + L"\" "; + } + + if (m_oBeforeLines.IsInit()) + { + sResult += L"w:beforeLines=\""; + sResult += m_oBeforeLines->ToString(); + sResult += L"\" "; + } + + if (m_oLine.IsInit()) + { + sResult += L"w:line=\""; + sResult += m_oLine->ToString(); + sResult += L"\" "; + } + + if (m_oLineRule.IsInit()) + { + sResult += L"w:lineRule=\""; + sResult += m_oLineRule->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + void CSpacing::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w:after", m_oAfter) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:afterAutospacing", m_oAfterAutospacing) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:afterLines", m_oAfterLines) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:before", m_oBefore) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:beforeAutospacing", m_oBeforeAutospacing) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:beforeLines", m_oBeforeLines) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:line", m_oLine) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:lineRule", m_oLineRule) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:before-autospacing", m_oBeforeAutospacing) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:after-autospacing", m_oAfterAutospacing) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// TabStop 17.3.1.37 (Part 1) +//-------------------------------------------------------------------------------- + + CTabStop::CTabStop() + { + } + CTabStop::~CTabStop() + { + } + + void CTabStop::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:leader", m_oLeader); + XmlMacroReadAttributeBase(oNode, L"w:pos", m_oPos); + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CTabStop::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CTabStop::ToString() const + { + std::wstring sResult; + + if (m_oLeader.IsInit()) + { + sResult += L"w:leader=\""; + sResult += m_oLeader->ToString(); + sResult += L"\" "; + } + if (m_oPos.IsInit()) + { + sResult += L"w:pos=\""; + sResult += m_oPos->ToString(); + sResult += L"\" "; + } + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CTabStop::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w:leader", m_oLeader) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:pos", m_oPos) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// TextAlignment 17.3.1.39 (Part 1) +//-------------------------------------------------------------------------------- + + CTextAlignment::CTextAlignment() + { + } + CTextAlignment::~CTextAlignment() + { + } + void CTextAlignment::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CTextAlignment::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CTextAlignment::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CTextAlignment::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// TextboxTightWrap 17.3.1.40 (Part 1) +//-------------------------------------------------------------------------------- + + CTextboxTightWrap::CTextboxTightWrap() {} + CTextboxTightWrap::~CTextboxTightWrap() {} + void CTextboxTightWrap::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); + } + void CTextboxTightWrap::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CTextboxTightWrap::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\""; + } + + return sResult; + } + + void CTextboxTightWrap::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// +//-------------------------------------------------------------------------------- + + CLigatures::CLigatures() {} + CLigatures::~CLigatures() {} + + void CLigatures::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w14:val", m_oVal); + } + void CLigatures::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CLigatures::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w14:val=\"" + m_oVal->ToString() + L"\""; + } + return sResult; + } + + void CLigatures::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w14:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// +//-------------------------------------------------------------------------------- + + CNumSpacing::CNumSpacing() {} + CNumSpacing::~CNumSpacing() {} + + void CNumSpacing::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w14:val", m_oVal); + } + void CNumSpacing::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CNumSpacing::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w14:val=\"" + m_oVal->ToString() + L"\""; + } + return sResult; + } + + void CNumSpacing::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w14:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// +//-------------------------------------------------------------------------------- + + CNumForm::CNumForm() {} + CNumForm::~CNumForm() {} + + void CNumForm::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w14:val", m_oVal); + } + void CNumForm::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CNumForm::ToString() const + { + std::wstring sResult; + + if (m_oVal.IsInit()) + { + sResult += L"w14:val=\"" + m_oVal->ToString() + L"\""; + } + return sResult; + } + + void CNumForm::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_ReadSingle(oReader, L"w14:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +//-------------------------------------------------------------------------------- +// +//-------------------------------------------------------------------------------- + + CStylisticSet::CStylisticSet() {} + CStylisticSet::~CStylisticSet(){} + + void CStylisticSet::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"w14:id", m_oId); + XmlMacroReadAttributeBase(oNode, L"w14:val", m_oVal); + } + void CStylisticSet::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if (!oReader.IsEmptyNode()) + oReader.ReadTillEnd(); + } + std::wstring CStylisticSet::ToString() const + { + std::wstring sResult; + + if (m_oId.IsInit()) + { + sResult += L"w14:id=\""; + sResult += m_oId->ToString(); + sResult += L"\" "; + } + if (m_oVal.IsInit()) + { + sResult += L"w14:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + return sResult; + } + + void CStylisticSet::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start(oReader) + WritingElement_ReadAttributes_Read_if(oReader, L"w14:id", m_oId) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w14:val", m_oVal) + WritingElement_ReadAttributes_End(oReader) + } + +} // Word +//------------------------------------------------------------------------------------------------------------------------- + +namespace Drawing +{ +// --------------------------------------------------------------------------- +// Offset (Point2D) 20.1.7.4 +// --------------------------------------------------------------------------- + + CPoint2D::CPoint2D() + { + } + CPoint2D::~CPoint2D() + { + } + void CPoint2D::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"x", m_oX ); + XmlMacroReadAttributeBase( oNode, L"y", m_oY ); + } + void CPoint2D::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CPoint2D::ToString() const + { + std::wstring sResult; + + sResult += L"x=\"" + m_oX.ToString() + L"\" "; + sResult += L"y=\"" + m_oY.ToString() + L"\" "; + + return sResult; + } + + void CPoint2D::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"x", m_oX ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"y", m_oY ) + WritingElement_ReadAttributes_End( oReader ) + } + +// ----------------------------------------------------------------------- +// Extent (PositiveSize2D) 20.4.2.7 +// ----------------------------------------------------------------------- + + CPositiveSize2D::CPositiveSize2D() + { + } + CPositiveSize2D::~CPositiveSize2D() + { + } + void CPositiveSize2D::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"cx", m_oCx ); + XmlMacroReadAttributeBase( oNode, L"cy", m_oCy ); + } + void CPositiveSize2D::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + + std::wstring CPositiveSize2D::ToString() const + { + std::wstring sResult; + + sResult += L"cx=\"" + m_oCx.ToString() + L"\" "; + sResult += L"cy=\"" + m_oCy.ToString() + L"\" "; + + return sResult; + } + + void CPositiveSize2D::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"cx", m_oCx ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"cy", m_oCy ) + WritingElement_ReadAttributes_End( oReader ) + } + +} // Drawing +} // ComplexTypes diff --git a/Common/DocxFormat/Source/Common/ComplexTypes.h b/Common/DocxFormat/Source/Common/ComplexTypes.h index 79eaf214b6..658d38c71b 100644 --- a/Common/DocxFormat/Source/Common/ComplexTypes.h +++ b/Common/DocxFormat/Source/Common/ComplexTypes.h @@ -94,62 +94,40 @@ namespace ComplexTypes sResult += L"\" ";\ } + //-------------------------------------------------------------------------------- + // ComplexType + //-------------------------------------------------------------------------------- + class ComplexType { public: - ComplexType(){}; - virtual ~ComplexType() {}; + ComplexType(); + virtual ~ComplexType(); virtual void FromXML(XmlUtils::CXmlNode& oNode) = 0; virtual std::wstring ToString() const = 0; - virtual inline std::wstring ValNode(const std::wstring &node_name) - { - return L"<" + node_name + L" " + ToString() + L"/>"; - } + virtual inline std::wstring ValNode(const std::wstring &node_name); }; + //-------------------------------------------------------------------------------- // DecimalNumber 17.3.1.10 (Part 1) //-------------------------------------------------------------------------------- + class CDecimalNumber : public ComplexType { public: ComplexTypes_AdditionConstructors(CDecimalNumber) - CDecimalNumber() - { - } - virtual ~CDecimalNumber() - { - } + CDecimalNumber(); + virtual ~CDecimalNumber(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"val=\"" + std::to_wstring(*m_oVal) + L"\"" ; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start_No_NS( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"val", m_oVal ) - WritingElement_ReadAttributes_End_No_NS( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable_int m_oVal; }; @@ -159,316 +137,79 @@ namespace ComplexTypes //-------------------------------------------------------------------------------- // Border 17.3.4 (Part 1) //-------------------------------------------------------------------------------- + class CBorder : public ComplexType { public: ComplexTypes_AdditionConstructors(CBorder) - CBorder() - { - } - virtual ~CBorder() - { - } + CBorder(); + virtual ~CBorder(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:color", m_oColor ); - XmlMacroReadAttributeBase(oNode, L"w:frame", m_oFrame ); - XmlMacroReadAttributeBase(oNode, L"w:shadow", m_oShadow ); - XmlMacroReadAttributeBase(oNode, L"w:space", m_oSpace ); - XmlMacroReadAttributeBase(oNode, L"w:sz", m_oSz ); - XmlMacroReadAttributeBase(oNode, L"w:themeColor", m_oThemeColor ); - XmlMacroReadAttributeBase(oNode, L"w:themeShade", m_oThemeShade ); - XmlMacroReadAttributeBase(oNode, L"w:themeTint", m_oThemeTint ); - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oColor.IsInit() ) - { - sResult += L"w:color=\""; - sResult += m_oColor->ToStringNoAlpha(); - sResult += L"\" "; - } - if ( m_oFrame.IsInit() ) - { - sResult += L"w:frame=\""; - sResult += m_oFrame->ToString(); - sResult += L"\" "; - } - if ( m_oShadow.IsInit() ) - { - sResult += L"w:shadow=\""; - sResult += m_oShadow->ToString(); - sResult += L"\" "; - } - if ( m_oSpace.IsInit() ) - { - sResult += L"w:space=\""; - sResult += m_oSpace->ToString(); - sResult += L"\" "; - } - if ( m_oSz.IsInit() ) - { - sResult += L"w:sz=\""; - sResult += m_oSz->ToString(); - sResult += L"\" "; - } - if ( m_oThemeColor.IsInit() ) - { - sResult += L"w:themeColor=\""; - sResult += m_oThemeColor->ToString(); - sResult += L"\" "; - } - if ( m_oThemeShade.IsInit() ) - { - sResult += L"w:themeShade=\""; - sResult += m_oThemeShade->ToString(); - sResult += L"\" "; - } - if ( m_oThemeTint.IsInit() ) - { - sResult += L"w:themeTint=\""; - sResult += m_oThemeTint->ToString(); - sResult += L"\" "; - } - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - nullable m_oWidth; - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:color", m_oColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:frame", m_oFrame ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:shadow", m_oShadow ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:space", m_oSpace ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:sz", m_oSz ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeColor", m_oThemeColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeShade", m_oThemeShade ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeTint", m_oThemeTint ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_Read_else_if(oReader, L"wx:bdrwidth", m_oWidth) - WritingElement_ReadAttributes_End( oReader ) + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - if (m_oWidth.IsInit()) - { - m_oSz.Init(); m_oSz->SetValue((int)(m_oWidth->GetValue() * 8)); - } - } public: - nullable> m_oColor; - nullable> m_oFrame; - nullable> m_oShadow; - nullable> m_oSpace; - nullable> m_oSz; - nullable> m_oThemeColor; - nullable> m_oThemeShade; - nullable> m_oThemeTint; - nullable> m_oVal; + nullable m_oColor; + nullable m_oFrame; + nullable m_oShadow; + nullable m_oSpace; + nullable m_oSz; + nullable m_oThemeColor; + nullable m_oThemeShade; + nullable m_oThemeTint; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // rFonts (Fonts) 17.3.2.20 (Part 1) //-------------------------------------------------------------------------------- + class CFonts : public ComplexType { public: ComplexTypes_AdditionConstructors(CFonts) - CFonts() - { - } - virtual ~CFonts() - { - } + CFonts(); + virtual ~CFonts(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:ascii", m_sAscii); - XmlMacroReadAttributeBase(oNode, L"w:asciiTheme", m_oAsciiTheme); - XmlMacroReadAttributeBase(oNode, L"w:cs", m_sCs); - XmlMacroReadAttributeBase(oNode, L"w:cstheme", m_oCsTheme); - XmlMacroReadAttributeBase(oNode, L"w:eastAsia", m_sEastAsia); - XmlMacroReadAttributeBase(oNode, L"w:eastAsiaTheme", m_oEastAsiaTheme); - XmlMacroReadAttributeBase(oNode, L"w:hAnsi", m_sHAnsi); - XmlMacroReadAttributeBase(oNode, L"w:hAnsiTheme", m_oHAnsiTheme); - XmlMacroReadAttributeBase(oNode, L"w:hint", m_oHint); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oHint.IsInit()) - { - sResult += L"w:hint=\""; - sResult += m_oHint->ToString(); - sResult += L"\" "; - } - if (m_sAscii.IsInit()) - { - sResult += L"w:ascii=\""; - sResult += m_sAscii.get2(); - sResult += L"\" "; - } - if (m_sHAnsi.IsInit()) - { - sResult += L"w:hAnsi=\""; - sResult += m_sHAnsi.get2(); - sResult += L"\" "; - } - if (m_sEastAsia.IsInit()) - { - sResult += L"w:eastAsia=\""; - sResult += m_sEastAsia.get2(); - sResult += L"\" "; - } - if (m_sCs.IsInit()) - { - sResult += L"w:cs=\""; - sResult += m_sCs.get2(); - sResult += L"\" "; - } - if (m_oAsciiTheme.IsInit()) - { - sResult += L"w:asciiTheme=\""; - sResult += m_oAsciiTheme->ToString(); - sResult += L"\" "; - } - if (m_oHAnsiTheme.IsInit()) - { - sResult += L"w:hAnsiTheme=\""; - sResult += m_oHAnsiTheme->ToString(); - sResult += L"\" "; - } - if (m_oEastAsiaTheme.IsInit()) - { - sResult += L"w:eastAsiaTheme=\""; - sResult += m_oEastAsiaTheme->ToString(); - sResult += L"\" "; - } - if (m_oCsTheme.IsInit()) - { - sResult += L"w:cstheme=\""; - sResult += m_oCsTheme->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w:ascii", m_sAscii) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:asciiTheme", m_oAsciiTheme) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:cs", m_sCs) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:cstheme", m_oCsTheme) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:eastAsia", m_sEastAsia) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:eastAsiaTheme", m_oEastAsiaTheme) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hAnsi", m_sHAnsi) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hAnsiTheme", m_oHAnsiTheme) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hint", m_oHint) - //2003 - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:h-ansi", m_oHint) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:fareast", m_sEastAsia) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_sAscii; - nullable> m_oAsciiTheme; + nullable m_oAsciiTheme; nullable m_sCs; - nullable> m_oCsTheme; + nullable m_oCsTheme; nullable m_sEastAsia; - nullable> m_oEastAsiaTheme; + nullable m_oEastAsiaTheme; nullable m_sHAnsi; - nullable> m_oHAnsiTheme; - nullable > m_oHint; + nullable m_oHAnsiTheme; + nullable m_oHint; }; //-------------------------------------------------------------------------------- // Lang (Language) 17.3.2.20 (Part 1) //-------------------------------------------------------------------------------- + class CLanguage : public ComplexType { public: ComplexTypes_AdditionConstructors(CLanguage) - CLanguage() - { - } - virtual ~CLanguage() - { - } + CLanguage(); + virtual ~CLanguage(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:bidi", m_oBidi ); - XmlMacroReadAttributeBase(oNode, L"w:eastAsia", m_oEastAsia ); - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += *m_oVal; - sResult += L"\" "; - } - if (m_oEastAsia.IsInit()) - { - sResult += L"w:eastAsia=\""; - sResult += *m_oEastAsia; - sResult += L"\" "; - } - if ( m_oBidi.IsInit() ) - { - sResult += L"w:bidi=\""; - sResult += *m_oBidi; - sResult += L"\" "; - } - - return sResult; - } - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:bidi", m_oBidi ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:eastAsia", m_oEastAsia ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } public: // TO DO: сделать парсер языка по спецификации RFC 4646/BCP 47 - CLang nullable_string m_oBidi; @@ -479,48 +220,21 @@ namespace ComplexTypes //-------------------------------------------------------------------------------- // Lang (Language) 17.3.3.14 (Part 1) //-------------------------------------------------------------------------------- + class CLang : public ComplexType { public: ComplexTypes_AdditionConstructors(CLang) - CLang() - { - } - virtual ~CLang() - { - } + CLang(); + virtual ~CLang(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += *m_oVal; - sResult += L"\" "; - } - return sResult; - } private: + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } public: nullable_string m_oVal; }; @@ -528,423 +242,143 @@ namespace ComplexTypes //-------------------------------------------------------------------------------- // Shading 17.3.5 (Part 1) //-------------------------------------------------------------------------------- + class CShading : public ComplexType { public: ComplexTypes_AdditionConstructors(CShading) - CShading() - { - } - virtual ~CShading() - { - } + CShading(); + virtual ~CShading(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:color", m_oColor ); - XmlMacroReadAttributeBase(oNode, L"w:fill", m_oFill ); - XmlMacroReadAttributeBase(oNode, L"w:themeColor", m_oThemeColor ); - XmlMacroReadAttributeBase(oNode, L"w:themeFill", m_oThemeFill ); - XmlMacroReadAttributeBase(oNode, L"w:themeFillShade", m_oThemeFillShade ); - XmlMacroReadAttributeBase(oNode, L"w:themeFillTint", m_oThemeFillTint ); - XmlMacroReadAttributeBase(oNode, L"w:themeShade", m_oThemeShade ); - XmlMacroReadAttributeBase(oNode, L"w:themeTint", m_oThemeTint ); - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - if ( m_oColor.IsInit() ) - { - sResult += L"w:color=\""; - sResult += m_oColor->ToStringNoAlpha(); - sResult += L"\" "; - } - if ( m_oThemeColor.IsInit() ) - { - sResult += L"w:themeColor=\""; - sResult += m_oThemeColor->ToString(); - sResult += L"\" "; - } - if (m_oThemeTint.IsInit()) - { - sResult += L"w:themeTint=\""; - sResult += m_oThemeTint->ToString(); - sResult += L"\" "; - } - if (m_oThemeShade.IsInit()) - { - sResult += L"w:themeShade=\""; - sResult += m_oThemeShade->ToString(); - sResult += L"\" "; - } - if (m_oFill.IsInit()) - { - sResult += L"w:fill=\""; - sResult += m_oFill->ToStringNoAlpha(); - sResult += L"\" "; - } - if (m_oThemeFill.IsInit()) - { - sResult += L"w:themeFill=\""; - sResult += m_oThemeFill->ToString(); - sResult += L"\" "; - } - if (m_oThemeFillTint.IsInit()) - { - sResult += L"w:themeFillTint=\""; - sResult += m_oThemeFillTint->ToString(); - sResult += L"\" "; - } - if (m_oThemeFillShade.IsInit()) - { - sResult += L"w:themeFillShade=\""; - sResult += m_oThemeFillShade->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:color", m_oColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:fill", m_oFill ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeColor", m_oThemeColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeFill", m_oThemeFill ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeFillShade", m_oThemeFillShade ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeFillTint", m_oThemeFillTint ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeShade", m_oThemeShade ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeTint", m_oThemeTint ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } - public: - nullable > m_oColor; - nullable > m_oFill; - nullable > m_oThemeColor; - nullable > m_oThemeFill; - nullable > m_oThemeFillShade; - nullable > m_oThemeFillTint; - nullable > m_oThemeShade; - nullable > m_oThemeTint; - nullable > m_oVal; - }; + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: + nullable m_oColor; + nullable m_oFill; + nullable m_oThemeColor; + nullable m_oThemeFill; + nullable m_oThemeFillShade; + nullable m_oThemeFillTint; + nullable m_oThemeShade; + nullable m_oThemeTint; + nullable m_oVal; + }; //-------------------------------------------------------------------------------- // TblWidth 17.4.88 (Part 1) //-------------------------------------------------------------------------------- + class CTblWidth : public ComplexType { public: ComplexTypes_AdditionConstructors(CTblWidth) - CTblWidth() - { - } - virtual ~CTblWidth() - { - } + CTblWidth(); + virtual ~CTblWidth(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:type", m_oType ); - XmlMacroReadAttributeBase( oNode, L"w:w", m_oW ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oType.IsInit() ) - { - sResult += L"w:type=\""; - sResult += m_oType->ToString(); - sResult += L"\" "; - } - - if ( m_oW.IsInit() ) - { - sResult += L"w:w=\""; - sResult += m_oW->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:type", m_oType ) - else if ( L"w:w" == wsName ) - { - //bug 42023 w:w="460.60pt" (EP_C2crapportd_aptitudeprofessionnelle.docx) - SimpleTypes::CUniversalMeasureOrPercent oUniversalMeasure; - std::wstring sValue = oReader.GetText(); - oUniversalMeasure.FromString(sValue); - m_oW.Init(); - if(oUniversalMeasure.IsUnits()) - { - m_oType.Init(); - m_oType->SetValue(SimpleTypes::tblwidthDxa); - m_oW->SetValue(oUniversalMeasure.ToTwips()); - //ignore type attribute - break; - } - else if(oUniversalMeasure.IsPercent()) - { - m_oType.Init(); - m_oType->SetValue(SimpleTypes::tblwidthPct); - m_oW->SetPercent(true); - m_oW->SetValue(oUniversalMeasure.GetValue()); - //ignore type attribute - break; - } - else - { - m_oW->SetValue(oUniversalMeasure.GetValue()); - } - } - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oType; - nullable m_oW; + nullable m_oType; + nullable m_oW; }; - //-------------------------------------------------------------------------------- // OnOff 17.17.4 (Part 1) //-------------------------------------------------------------------------------- + class COnOff : public ComplexType { public: ComplexTypes_AdditionConstructors(COnOff) - COnOff() - { - } - virtual ~COnOff() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + COnOff(); + virtual ~COnOff(); + + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oVal; + nullable m_oVal; }; - template + //-------------------------------------------------------------------------------- + // OnOff2 + //-------------------------------------------------------------------------------- + class COnOff2 : public ComplexType { public: ComplexTypes_AdditionConstructors(COnOff2) - COnOff2() - { - } - virtual ~COnOff2() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + COnOff2(); + virtual ~COnOff2(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - sResult += L"w:val=\"" + m_oVal.ToString() + L"\" "; + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + virtual inline std::wstring ValNode(const std::wstring &node_name); - return sResult; - } - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start_No_NS( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"val", m_oVal ) - WritingElement_ReadAttributes_End_No_NS( oReader ) - } - virtual inline std::wstring ValNode(const std::wstring &node_name) - { - if (m_oVal.ToBool()) - return L"<" + node_name + L"/>"; - else - return L"<" + node_name + L" w:val=\"0\"/>"; - return L""; - } public: - SimpleTypes::COnOff m_oVal; + SimpleTypes::COnOff m_oVal = SimpleTypes::onoffTrue; }; //-------------------------------------------------------------------------------- // String 17.3.1.27 (Part 1) //-------------------------------------------------------------------------------- + class String : public ComplexType { public: ComplexTypes_AdditionConstructors(String) - String() - { - } - virtual ~String() - { - } + String(); + virtual ~String(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - std::vector attNames, attValues; - oNode.GetAllAttributes(attNames,attValues); - for(size_t i = 0; i < attNames.size(); ++i) - { - if(XmlUtils::GetNameNoNS(attNames[i]) == L"val") - { - m_sVal = attValues[i]; - } - } - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; + virtual std::wstring ToStringWithNS(const std::wstring& ns) const; + std::wstring ToString2() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - return ToStringWithNS(L"w:"); - } - virtual std::wstring ToStringWithNS(const std::wstring& ns) const - { - std::wstring sResult; - - if ( m_sVal.IsInit() ) - { - sResult += ns; - sResult += L"val=\""; - sResult += XmlUtils::EncodeXmlString(*m_sVal, false); - sResult += L"\" "; - } - return sResult; - } - std::wstring ToString2() const - { - std::wstring sResult; - - if ( m_sVal.IsInit() ) - sResult += *m_sVal; - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start_No_NS( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"val", m_sVal ) - WritingElement_ReadAttributes_End_No_NS( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable_string m_sVal; }; + //-------------------------------------------------------------------------------- // Spacing (SignedTwipsMeasure) 17.3.2.19 (Part 1) //-------------------------------------------------------------------------------- + class CSignedTwipsMeasure : public ComplexType { public: ComplexTypes_AdditionConstructors(CSignedTwipsMeasure) - CSignedTwipsMeasure() - { - } - virtual ~CSignedTwipsMeasure() - { - } + CSignedTwipsMeasure(); + virtual ~CSignedTwipsMeasure(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_oVal; }; @@ -952,412 +386,174 @@ namespace ComplexTypes //-------------------------------------------------------------------------------- // Kern (HpsMeasure) 17.3.2.19 (Part 1) //-------------------------------------------------------------------------------- + class CHpsMeasure : public ComplexType { public: ComplexTypes_AdditionConstructors(CHpsMeasure) - CHpsMeasure() - { - } - virtual ~CHpsMeasure() - { - } + CHpsMeasure(); + virtual ~CHpsMeasure(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += std::to_wstring(m_oVal->ToHps()); - sResult += L"\" "; - } - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_oVal; }; + //-------------------------------------------------------------------------------- // Border 17.3.2.6 (Part 1) //-------------------------------------------------------------------------------- + class CColor : public ComplexType { public: ComplexTypes_AdditionConstructors(CColor) - CColor() - { - } - virtual ~CColor() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:themeColor", m_oThemeColor ); - XmlMacroReadAttributeBase( oNode, L"w:themeShade", m_oThemeShade ); - XmlMacroReadAttributeBase( oNode, L"w:themeTint", m_oThemeTint ); - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CColor(); + virtual ~CColor(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToStringNoAlpha(); - sResult += L"\" "; - } - if ( m_oThemeColor.IsInit() ) - { - sResult += L"w:themeColor=\""; - sResult += m_oThemeColor->ToString(); - sResult += L"\" "; - } - if (m_oThemeTint.IsInit()) - { - sResult += L"w:themeTint=\""; - sResult += m_oThemeTint->ToString(); - sResult += L"\" "; - } - if ( m_oThemeShade.IsInit() ) - { - sResult += L"w:themeShade=\""; - sResult += m_oThemeShade->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:themeColor", m_oThemeColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeShade", m_oThemeShade ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:themeTint", m_oThemeTint ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oThemeColor; - nullable > m_oThemeShade; - nullable > m_oThemeTint; - nullable > m_oVal; + nullable m_oThemeColor; + nullable m_oThemeShade; + nullable m_oThemeTint; + nullable m_oVal; }; + //-------------------------------------------------------------------------------- // Position (HpsMeasure) 17.3.2.19 (Part 1) //-------------------------------------------------------------------------------- + class CSignedHpsMeasure : public ComplexType { public: ComplexTypes_AdditionConstructors(CSignedHpsMeasure) - CSignedHpsMeasure() - { - } - virtual ~CSignedHpsMeasure() - { - } + CSignedHpsMeasure(); + virtual ~CSignedHpsMeasure(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: nullable m_oVal; }; + //-------------------------------------------------------------------------------- // NumFmt 17.11.17 (Part 1) //-------------------------------------------------------------------------------- + class CNumFmt : public ComplexType { public: ComplexTypes_AdditionConstructors(CNumFmt) - CNumFmt() - { - } - virtual ~CNumFmt() - { - } + CNumFmt(); + virtual ~CNumFmt(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:format", m_sFormat ); - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_sFormat.IsInit() ) - { - sResult += L"w:format=\""; - sResult += m_sFormat.get2(); - sResult += L"\" "; - } - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:format", m_sFormat ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_sFormat; - nullable> m_oVal; + nullable m_oVal; }; - //-------------------------------------------------------------------------------- // NumFmt 17.11.19 (Part 1) //-------------------------------------------------------------------------------- + class CNumRestart : public ComplexType { public: ComplexTypes_AdditionConstructors(CNumRestart) - CNumRestart() - { - } - virtual ~CNumRestart() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CNumRestart(); + virtual ~CNumRestart(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } - public: - nullable > m_oVal; - }; + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: + nullable m_oVal; + }; //-------------------------------------------------------------------------------- // DecimalNumber 17.3.1.10 (Part 1) //-------------------------------------------------------------------------------- + class CDecimalNumber : public ComplexTypes::CDecimalNumber { public: ComplexTypes_AdditionConstructors(CDecimalNumber) - CDecimalNumber() - { - } - virtual ~CDecimalNumber() - { - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ComplexTypes::CDecimalNumber::FromXML(oReader); - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + CDecimalNumber(); + virtual ~CDecimalNumber(); - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\"" + std::to_wstring(*m_oVal) + L"\" "; - } - - return sResult; - } + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual std::wstring ToString() const; }; + //-------------------------------------------------------------------------------- // DecimalNumberOrPrecent 17.3.1.10 (Part 1) //-------------------------------------------------------------------------------- + class CDecimalNumberOrPrecent : public ComplexType { public: ComplexTypes_AdditionConstructors(CDecimalNumberOrPrecent) - CDecimalNumberOrPrecent() - { - } - virtual ~CDecimalNumberOrPrecent() - { - } + CDecimalNumberOrPrecent(); + virtual ~CDecimalNumberOrPrecent(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_oVal; }; + //-------------------------------------------------------------------------------- // Rel 17.6.14 (Part 1) //-------------------------------------------------------------------------------- + class CRel : public ComplexType { public: ComplexTypes_AdditionConstructors(CRel) - CRel() - { - } - virtual ~CRel() - { - } + CRel(); + virtual ~CRel(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"r:id", m_oId ); - if (false == m_oId.IsInit()) - { - XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); - } - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oId.IsInit() ) - { - sResult += L"r:id=\""; - sResult += m_oId->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start_No_NS( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"id", m_oId ) //r:id or relationships:id - WritingElement_ReadAttributes_End_No_NS( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_oId; }; @@ -1365,1528 +561,557 @@ namespace ComplexTypes //-------------------------------------------------------------------------------- // TextDirection 17.6.14 (Part 1) //-------------------------------------------------------------------------------- + class CTextDirection : public ComplexType { public: ComplexTypes_AdditionConstructors(CTextDirection) - CTextDirection() - { - } - virtual ~CTextDirection() - { - } + CTextDirection(); + virtual ~CTextDirection(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } - public: - nullable > m_oVal; - }; + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: + nullable m_oVal; + }; //-------------------------------------------------------------------------------- // VerticalJc 17.6.23 (Part 1) //-------------------------------------------------------------------------------- + class CVerticalJc : public ComplexType { public: ComplexTypes_AdditionConstructors(CVerticalJc) - CVerticalJc() - { - } - virtual ~CVerticalJc() - { - } + CVerticalJc(); + virtual ~CVerticalJc(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // cnfStyle (Cnf) 17.3.1.8 (Part 1) + 9.2.1.1 (Part 4) //-------------------------------------------------------------------------------- + class CCnf : public ComplexType { public: ComplexTypes_AdditionConstructors(CCnf) - CCnf() - { - } - virtual ~CCnf() - { - } + CCnf(); + virtual ~CCnf(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:evenHBand", m_oEvenHBand ); - XmlMacroReadAttributeBase( oNode, L"w:evenVBand", m_oEvenVBand ); - XmlMacroReadAttributeBase( oNode, L"w:firstColumn", m_oFirstColumn ); - XmlMacroReadAttributeBase( oNode, L"w:firstRow", m_oFirstRow ); - XmlMacroReadAttributeBase( oNode, L"w:firstRowFirstColumn", m_oFirstRowFirstColumn ); - XmlMacroReadAttributeBase( oNode, L"w:firstRowLastColumn", m_oFirstRowLastColumn ); - XmlMacroReadAttributeBase( oNode, L"w:lastColumn", m_oLastColumn ); - XmlMacroReadAttributeBase( oNode, L"w:lastRow", m_oLastRow ); - XmlMacroReadAttributeBase( oNode, L"w:lastRowFirstColumn", m_oLastRowFirstColumn ); - XmlMacroReadAttributeBase( oNode, L"w:lastRowLastColumn", m_oLastRowLastColumn ); - XmlMacroReadAttributeBase( oNode, L"w:oddHBand", m_oOddHBand ); - XmlMacroReadAttributeBase( oNode, L"w:oddVBand", m_oOddVBand ); - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oEvenHBand.IsInit() ) - { - sResult += L"w:evenHBand=\""; - sResult += m_oEvenHBand->ToString(); - sResult += L"\" "; - } - if ( m_oEvenVBand.IsInit() ) - { - sResult += L"w:evenVBand=\""; - sResult += m_oEvenVBand->ToString(); - sResult += L"\" "; - } - if ( m_oFirstColumn.IsInit() ) - { - sResult += L"w:firstColumn=\""; - sResult += m_oFirstColumn->ToString(); - sResult += L"\" "; - } - if ( m_oFirstRow.IsInit() ) - { - sResult += L"w:firstRow=\""; - sResult += m_oFirstRow->ToString(); - sResult += L"\" "; - } - if ( m_oFirstRowFirstColumn.IsInit() ) - { - sResult += L"w:firstRowFirstColumn=\""; - sResult += m_oFirstRowFirstColumn->ToString(); - sResult += L"\" "; - } - if ( m_oFirstRowLastColumn.IsInit() ) - { - sResult += L"w:firstRowLastColumn=\""; - sResult += m_oFirstRowLastColumn->ToString(); - sResult += L"\" "; - } - if ( m_oLastColumn.IsInit() ) - { - sResult += L"w:lastColumn=\""; - sResult += m_oLastColumn->ToString(); - sResult += L"\" "; - } - if ( m_oLastRow.IsInit() ) - { - sResult += L"w:lastRow=\""; - sResult += m_oLastRow->ToString(); - sResult += L"\" "; - } - if ( m_oLastRowFirstColumn.IsInit() ) - { - sResult += L"w:lastRowFirstColumn=\""; - sResult += m_oLastRowFirstColumn->ToString(); - sResult += L"\" "; - } - if ( m_oLastRowLastColumn.IsInit() ) - { - sResult += L"w:lastRowLastColumn=\""; - sResult += m_oLastRowLastColumn->ToString(); - sResult += L"\" "; - } - if ( m_oOddHBand.IsInit() ) - { - sResult += L"w:oddHBand=\""; - sResult += m_oOddHBand->ToString(); - sResult += L"\" "; - } - if ( m_oOddVBand.IsInit() ) - { - sResult += L"w:oddVBand=\""; - sResult += m_oOddVBand->ToString(); - sResult += L"\" "; - } - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:evenHBand", m_oEvenHBand ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:evenVBand", m_oEvenVBand ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstColumn", m_oFirstColumn ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstRow", m_oFirstRow ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstRowFirstColumn", m_oFirstRowFirstColumn ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstRowLastColumn", m_oFirstRowLastColumn ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastColumn", m_oLastColumn ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastRow", m_oLastRow ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastRowFirstColumn", m_oLastRowFirstColumn ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastRowLastColumn", m_oLastRowLastColumn ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:oddHBand", m_oOddHBand ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:oddVBand", m_oOddVBand ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oEvenHBand; - nullable > m_oEvenVBand; - nullable > m_oFirstColumn; - nullable > m_oFirstRow; - nullable > m_oFirstRowFirstColumn; - nullable > m_oFirstRowLastColumn; - nullable > m_oLastColumn; - nullable > m_oLastRow; - nullable > m_oLastRowFirstColumn; - nullable > m_oLastRowLastColumn; - nullable > m_oOddHBand; - nullable > m_oOddVBand; - nullable > m_oVal; + nullable m_oEvenHBand; + nullable m_oEvenVBand; + nullable m_oFirstColumn; + nullable m_oFirstRow; + nullable m_oFirstRowFirstColumn; + nullable m_oFirstRowLastColumn; + nullable m_oLastColumn; + nullable m_oLastRow; + nullable m_oLastRowFirstColumn; + nullable m_oLastRowLastColumn; + nullable m_oOddHBand; + nullable m_oOddVBand; + nullable m_oVal; }; + //-------------------------------------------------------------------------------- // jc (Jc) 17.3.1.13 (Part 1) //-------------------------------------------------------------------------------- + class CJc : public ComplexType { public: ComplexTypes_AdditionConstructors(CJc) - CJc() - { - } - virtual ~CJc() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CJc(); + virtual ~CJc(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oVal; + nullable m_oVal; }; + //-------------------------------------------------------------------------------- // TrackChange 17.13.5.19 (Part 1) //-------------------------------------------------------------------------------- + class CTrackChange : public ComplexType { public: ComplexTypes_AdditionConstructors(CTrackChange) - CTrackChange() - { - } - virtual ~CTrackChange() - { - } + CTrackChange(); + virtual ~CTrackChange(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:author", m_sAuthor ); - XmlMacroReadAttributeBase( oNode, L"w:date", m_oDate ); - XmlMacroReadAttributeBase( oNode, L"w:id", m_oId ); - XmlMacroReadAttributeBase( oNode, L"oouserid", m_sUserId ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oId.IsInit() ) - { - sResult += L"w:id=\""; - sResult += m_oId->ToString(); - sResult += L"\" "; - } - if ( m_sAuthor.IsInit() ) - { - sResult += L"w:author=\""; - sResult += m_sAuthor.get2(); - sResult += L"\" "; - } - if ( m_oDate.IsInit() ) - { - sResult += L"w:date=\""; - sResult += m_oDate->ToString(); - sResult += L"\" "; - } - if ( m_sUserId.IsInit() ) - { - sResult += L"oouserid=\""; - sResult += m_sUserId.get2(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:author", m_sAuthor ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:date", m_oDate ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:id", m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"oouserid", m_sUserId ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_sAuthor; nullable m_oDate; - nullable> m_oId; + nullable m_oId; nullable m_sUserId; }; + //-------------------------------------------------------------------------------- // LongHexNumber 17.9.30 (Part 1) //-------------------------------------------------------------------------------- + class CLongHexNumber : public ComplexType { public: ComplexTypes_AdditionConstructors(CLongHexNumber) - CLongHexNumber() - { - } - virtual ~CLongHexNumber() - { - } + CLongHexNumber(); + virtual ~CLongHexNumber(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - - nullable> m_oVal; + nullable m_oVal; }; + //-------------------------------------------------------------------------------- // UnsignedDecimalNumber 17.16.32 (Part 1) //-------------------------------------------------------------------------------- + class CUnsignedDecimalNumber : public ComplexType { public: ComplexTypes_AdditionConstructors(CUnsignedDecimalNumber) - CUnsignedDecimalNumber() - { - } - virtual ~CUnsignedDecimalNumber() - { - } + CUnsignedDecimalNumber(); + virtual ~CUnsignedDecimalNumber(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - - nullable > m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // TwipsMeasure 17.15.1.25 (Part 1) //-------------------------------------------------------------------------------- + class CTwipsMeasure : public ComplexType { public: ComplexTypes_AdditionConstructors(CTwipsMeasure) - CTwipsMeasure() - { - } - virtual ~CTwipsMeasure() - { - } + CTwipsMeasure(); + virtual ~CTwipsMeasure(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oVal; }; //-------------------------------------------------------------------------------- // Empty 17.15.1.48 (Part 1) //-------------------------------------------------------------------------------- + class CEmpty : public ComplexType { public: ComplexTypes_AdditionConstructors(CEmpty) - CEmpty() - { - } - virtual ~CEmpty() - { - } + CEmpty(); + virtual ~CEmpty(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - } - virtual std::wstring ToString() const - { - return L""; - } + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; }; + //-------------------------------------------------------------------------------- // MatchSrc 17.17.2.3 (Part 1) //-------------------------------------------------------------------------------- + class CMatchSrc : public ComplexType { public: ComplexTypes_AdditionConstructors(CMatchSrc) - CMatchSrc() - { - } - virtual ~CMatchSrc() - { - } + CMatchSrc(); + virtual ~CMatchSrc(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - - nullable> m_oVal; + nullable m_oVal; }; + //-------------------------------------------------------------------------------- // EdnPos 17.11.22 (Part 1) //-------------------------------------------------------------------------------- + class CEdnPos : public ComplexType { public: ComplexTypes_AdditionConstructors(CEdnPos) - CEdnPos() - { - } - virtual ~CEdnPos() - { - } + CEdnPos(); + virtual ~CEdnPos(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - - nullable > m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // FtnPos 17.11.21 (Part 1) //-------------------------------------------------------------------------------- + class CFtnPos : public ComplexType { public: ComplexTypes_AdditionConstructors(CFtnPos) - CFtnPos() - { - } - virtual ~CFtnPos() - { - } + CFtnPos(); + virtual ~CFtnPos(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - - nullable > m_oVal; + nullable m_oVal; }; + + //-------------------------------------------------------------------------------- + // DocPartGallery + //-------------------------------------------------------------------------------- + class CDocPartGallery : public ComplexType { public: ComplexTypes_AdditionConstructors(CDocPartGallery) - CDocPartGallery() - { - } - virtual ~CDocPartGallery() - { - } + CDocPartGallery(); + virtual ~CDocPartGallery(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w:val=\"" + m_oVal->ToString() + L"\" "; - } - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; + + //-------------------------------------------------------------------------------- + // DocPartBehavior + //-------------------------------------------------------------------------------- + class CDocPartBehavior : public ComplexType { public: ComplexTypes_AdditionConstructors(CDocPartBehavior) - CDocPartBehavior() {} - virtual ~CDocPartBehavior() {} + CDocPartBehavior(); + virtual ~CDocPartBehavior(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w:val=\"" + m_oVal->ToString() + L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; + //-------------------------------------------------------------------------------- // EastAsianLayout 17.3.2.10 (Part 1) //-------------------------------------------------------------------------------- + class CEastAsianLayout : public ComplexType { public: ComplexTypes_AdditionConstructors(CEastAsianLayout) - CEastAsianLayout() - { - } - virtual ~CEastAsianLayout() - { - } + CEastAsianLayout(); + virtual ~CEastAsianLayout(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:combine", m_oCombine); - XmlMacroReadAttributeBase(oNode, L"w:combineBrackets", m_oCombineBrackets); - XmlMacroReadAttributeBase(oNode, L"w:id", m_oID); - XmlMacroReadAttributeBase(oNode, L"w:vert", m_oVert); - XmlMacroReadAttributeBase(oNode, L"w:vertCompress", m_oVertCompress); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oCombine.IsInit()) - { - sResult += L"w:combine=\""; - sResult += m_oCombine->ToString(); - sResult += L"\" "; - } - if (m_oCombineBrackets.IsInit()) - { - sResult += L"w:combineBrackets=\""; - sResult += m_oCombineBrackets->ToString(); - sResult += L"\" "; - } - if (m_oID.IsInit()) - { - sResult += L"w:themeTint=\""; - sResult += m_oID->ToString(); - sResult += L"\" "; - } - if (m_oVert.IsInit()) - { - sResult += L"w:vert=\""; - sResult += m_oVert->ToString(); - sResult += L"\" "; - } - if (m_oVertCompress.IsInit()) - { - sResult += L"w:vertCompress=\""; - sResult += m_oVert->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w:combine", m_oCombine) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:combineBrackets", m_oCombineBrackets) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:id", m_oID) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:vert", m_oVert) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:vertCompress", m_oVertCompress) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oCombine; - nullable > m_oCombineBrackets; - nullable > m_oID; - nullable > m_oVert; - nullable > m_oVertCompress; + nullable m_oCombine; + nullable m_oCombineBrackets; + nullable m_oID; + nullable m_oVert; + nullable m_oVertCompress; }; //-------------------------------------------------------------------------------- // Effect 17.3.2.11 (Part 1) //-------------------------------------------------------------------------------- + class CTextEffect : public ComplexType { public: ComplexTypes_AdditionConstructors(CTextEffect) - CTextEffect() - { - } - virtual ~CTextEffect() - { - } + CTextEffect(); + virtual ~CTextEffect(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } - public: - nullable> m_oVal; - }; + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: + nullable m_oVal; + }; //-------------------------------------------------------------------------------- // Em 17.3.2.12 (Part 1) //-------------------------------------------------------------------------------- + class CEm : public ComplexType { public: ComplexTypes_AdditionConstructors(CEm) - CEm() - { - } - virtual ~CEm() - { - } + CEm(); + virtual ~CEm(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oVal; + nullable m_oVal; }; - //-------------------------------------------------------------------------------- // FitText 17.3.2.14 (Part 1) //-------------------------------------------------------------------------------- + class CFitText : public ComplexType { public: ComplexTypes_AdditionConstructors(CFitText) - CFitText() - { - } - virtual ~CFitText() - { - } + CFitText(); + virtual ~CFitText(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:id", m_oID); - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oID.IsInit()) - { - sResult += L"w:id=\""; - sResult += m_oID->ToString(); - sResult += L"\" "; - } - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w:id", m_oID) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oID; + nullable m_oID; nullable m_oVal; }; //-------------------------------------------------------------------------------- // Highlight 17.3.2.14 (Part 1) //-------------------------------------------------------------------------------- + class CHighlight : public ComplexType { public: ComplexTypes_AdditionConstructors(CHighlight) - CHighlight() - { - } - virtual ~CHighlight() - { - } + CHighlight(); + virtual ~CHighlight(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // u (Underline) 17.3.2.40 (Part 1) //-------------------------------------------------------------------------------- + class CUnderline : public ComplexType { public: ComplexTypes_AdditionConstructors(CUnderline) - CUnderline() - { - } - virtual ~CUnderline() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:color", m_oColor); - XmlMacroReadAttributeBase(oNode, L"w:themeColor", m_oThemeColor); - XmlMacroReadAttributeBase(oNode, L"w:themeShade", m_oThemeShade); - XmlMacroReadAttributeBase(oNode, L"w:themeTint", m_oThemeTint); - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CUnderline(); + virtual ~CUnderline(); - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (m_oColor.IsInit()) - { - sResult += L"w:color=\""; - sResult += m_oColor->ToString(); - sResult += L"\" "; - } - if (m_oThemeColor.IsInit()) - { - sResult += L"w:themeColor=\""; - sResult += m_oThemeColor->ToString(); - sResult += L"\" "; - } - if (m_oThemeShade.IsInit()) - { - sResult += L"w:themeShade=\""; - sResult += m_oThemeShade->ToString(); - sResult += L"\" "; - } - if (m_oThemeTint.IsInit()) - { - sResult += L"w:themeTint=\""; - sResult += m_oThemeTint->ToString(); - sResult += L"\" "; - } - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w:color", m_oColor) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:themeColor", m_oThemeColor) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:themeShade", m_oThemeShade) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:themeTint", m_oThemeTint) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oColor; - nullable > m_oThemeColor; - nullable > m_oThemeShade; - nullable > m_oThemeTint; - nullable > m_oVal; + nullable m_oColor; + nullable m_oThemeColor; + nullable m_oThemeShade; + nullable m_oThemeTint; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // vertAlign (VerticalAlignRun) 17.3.2.40 (Part 1) //-------------------------------------------------------------------------------- + class CVerticalAlignRun : public ComplexType { public: ComplexTypes_AdditionConstructors(CVerticalAlignRun) - CVerticalAlignRun() - { - } - virtual ~CVerticalAlignRun() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CVerticalAlignRun(); + virtual ~CVerticalAlignRun(); - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // w (TextScale) 17.3.2.40 (Part 1) //-------------------------------------------------------------------------------- + class CTextScale : public ComplexType { public: ComplexTypes_AdditionConstructors(CTextScale) - CTextScale() - { - } - virtual ~CTextScale() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CTextScale(); + virtual ~CTextScale(); - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oVal; + nullable m_oVal; }; + //-------------------------------------------------------------------------------- // framePr (FramePr) 17.3.1.11 (Part 1) //-------------------------------------------------------------------------------- + class CFramePr : public ComplexType { public: ComplexTypes_AdditionConstructors(CFramePr) - CFramePr() - { - } - virtual ~CFramePr() - { - } + CFramePr(); + virtual ~CFramePr(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:anchorLock", m_oAnchorLock); - XmlMacroReadAttributeBase(oNode, L"w:dropCap", m_oDropCap); - XmlMacroReadAttributeBase(oNode, L"w:h", m_oH); - XmlMacroReadAttributeBase(oNode, L"w:hAnchor", m_oHAnchor); - XmlMacroReadAttributeBase(oNode, L"w:hRule", m_oHRule); - XmlMacroReadAttributeBase(oNode, L"w:hSpace", m_oHSpace); - XmlMacroReadAttributeBase(oNode, L"w:lines", m_oLines); - XmlMacroReadAttributeBase(oNode, L"w:vAnchor", m_oVAnchor); - XmlMacroReadAttributeBase(oNode, L"w:vSpace", m_oVSpace); - XmlMacroReadAttributeBase(oNode, L"w:w", m_oW); - XmlMacroReadAttributeBase(oNode, L"w:wrap", m_oWrap); - XmlMacroReadAttributeBase(oNode, L"w:x", m_oX); - XmlMacroReadAttributeBase(oNode, L"w:xAlign", m_oXAlign); - XmlMacroReadAttributeBase(oNode, L"w:y", m_oY); - XmlMacroReadAttributeBase(oNode, L"w:yAlign", m_oYAlign); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oAnchorLock.IsInit()) - { - sResult += L"w:anchorLock=\""; - sResult += m_oAnchorLock->ToString(); - sResult += L"\" "; - } - if (m_oDropCap.IsInit()) - { - sResult += L"w:dropCap=\""; - sResult += m_oDropCap->ToString(); - sResult += L"\" "; - } - if (m_oH.IsInit()) - { - sResult += L"w:h=\""; - sResult += m_oH->ToString(); - sResult += L"\" "; - } - if (m_oHAnchor.IsInit()) - { - sResult += L"w:hAnchor=\""; - sResult += m_oHAnchor->ToString(); - sResult += L"\" "; - } - if (m_oHRule.IsInit()) - { - sResult += L"w:hRule=\""; - sResult += m_oHRule->ToString(); - sResult += L"\" "; - } - if (m_oHSpace.IsInit()) - { - sResult += L"w:hSpace=\""; - sResult += m_oHSpace->ToString(); - sResult += L"\" "; - } - if (m_oLines.IsInit()) - { - sResult += L"w:lines=\""; - sResult += m_oLines->ToString(); - sResult += L"\" "; - } - if (m_oVAnchor.IsInit()) - { - sResult += L"w:vAnchor=\""; - sResult += m_oVAnchor->ToString(); - sResult += L"\" "; - } - if (m_oVSpace.IsInit()) - { - sResult += L"w:vSpace=\""; - sResult += m_oVSpace->ToString(); - sResult += L"\" "; - } - if (m_oW.IsInit()) - { - sResult += L"w:w=\""; - sResult += m_oW->ToString(); - sResult += L"\" "; - } - if (m_oWrap.IsInit()) - { - sResult += L"w:wrap=\""; - sResult += m_oWrap->ToString(); - sResult += L"\" "; - } - if (m_oX.IsInit()) - { - sResult += L"w:x=\""; - sResult += m_oX->ToString(); - sResult += L"\" "; - } - if (m_oXAlign.IsInit()) - { - sResult += L"w:xAlign=\""; - sResult += m_oXAlign->ToString(); - sResult += L"\" "; - } - if (m_oY.IsInit()) - { - sResult += L"w:y=\""; - sResult += m_oY->ToString(); - sResult += L"\" "; - } - if (m_oYAlign.IsInit()) - { - sResult += L"w:yAlign=\""; - sResult += m_oYAlign->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w:anchorLock", m_oAnchorLock) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:dropCap", m_oDropCap) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:h", m_oH) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hAnchor", m_oHAnchor) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hRule", m_oHRule) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hSpace", m_oHSpace) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:lines", m_oLines) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:vAnchor", m_oVAnchor) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:vSpace", m_oVSpace) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:w", m_oW) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:wrap", m_oWrap) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:x", m_oX) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:xAlign", m_oXAlign) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:y", m_oY) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:yAlign", m_oYAlign) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oAnchorLock; - nullable > m_oDropCap; + nullable m_oAnchorLock; + nullable m_oDropCap; nullable m_oH; - nullable > m_oHAnchor; - nullable > m_oHRule; + nullable m_oHAnchor; + nullable m_oHRule; nullable m_oHSpace; - nullable > m_oLines; - nullable > m_oVAnchor; + nullable m_oLines; + nullable m_oVAnchor; nullable m_oVSpace; nullable m_oW; - nullable > m_oWrap; + nullable m_oWrap; nullable m_oX; - nullable > m_oXAlign; + nullable m_oXAlign; nullable m_oY; - nullable > m_oYAlign; + nullable m_oYAlign; }; + //-------------------------------------------------------------------------------- // ind (Ind) 17.3.1.12 (Part 1) + 9.2.1.2 (Part 4) //-------------------------------------------------------------------------------- + class CInd : public ComplexType { public: ComplexTypes_AdditionConstructors(CInd) - CInd() - { - } - virtual ~CInd() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:end", m_oEnd); - XmlMacroReadAttributeBase(oNode, L"w:endChars", m_oEndChars); - XmlMacroReadAttributeBase(oNode, L"w:firstLine", m_oFirstLine); - XmlMacroReadAttributeBase(oNode, L"w:firstLineChars", m_oFirstLineChars); - XmlMacroReadAttributeBase(oNode, L"w:hanging", m_oHanging); - XmlMacroReadAttributeBase(oNode, L"w:hangingChars", m_oHangingChars); - XmlMacroReadAttributeBase(oNode, L"w:start", m_oStart); - XmlMacroReadAttributeBase(oNode, L"w:startChars", m_oStartChars); + CInd(); + virtual ~CInd(); - // См. 9.2.1.2 Part4 - if (!m_oStart.IsInit()) - XmlMacroReadAttributeBase(oNode, L"w:left", m_oStart); - if (!m_oStartChars.IsInit()) - XmlMacroReadAttributeBase(oNode, L"w:leftChars", m_oStartChars); - if (!m_oEnd.IsInit()) - XmlMacroReadAttributeBase(oNode, L"w:right", m_oEnd); - if (!m_oEndChars.IsInit()) - XmlMacroReadAttributeBase(oNode, L"w:rightChars", m_oEndChars); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); - - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oEnd.IsInit()) - { - sResult += L"w:end=\""; - sResult += m_oEnd->ToString(); - sResult += L"\" "; - } - - if (m_oEndChars.IsInit()) - { - sResult += L"w:endChars=\""; - sResult += m_oEndChars->ToString(); - sResult += L"\" "; - } - - if (m_oFirstLine.IsInit()) - { - sResult += L"w:firstLine=\""; - sResult += m_oFirstLine->ToString(); - sResult += L"\" "; - } - - if (m_oFirstLineChars.IsInit()) - { - sResult += L"w:firstLineChars=\""; - sResult += m_oFirstLineChars->ToString(); - sResult += L"\" "; - } - - if (m_oHanging.IsInit()) - { - sResult += L"w:hanging=\""; - sResult += m_oHanging->ToString(); - sResult += L"\" "; - } - - if (m_oHangingChars.IsInit()) - { - sResult += L"w:hangingChars=\""; - sResult += m_oHangingChars->ToString(); - sResult += L"\" "; - } - - if (m_oStart.IsInit()) - { - sResult += L"w:start=\""; - sResult += m_oStart->ToString(); - sResult += L"\" "; - } - - if (m_oStartChars.IsInit()) - { - sResult += L"w:startChars=\""; - sResult += m_oStartChars->ToString(); - sResult += L"\" "; - } - - return sResult; - } + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; static const CInd Merge(const CInd& oPrev, const CInd& oCurrent) { @@ -2901,6 +1126,7 @@ namespace ComplexTypes oProperties.m_oStartChars = Merge(oPrev.m_oStartChars, oCurrent.m_oStartChars); return oProperties; } + template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -2913,132 +1139,35 @@ namespace ComplexTypes return oResult; } - private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w:end", m_oEnd) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:endChars", m_oEndChars) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:firstLine", m_oFirstLine) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:firstLineChars", m_oFirstLineChars) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hanging", m_oHanging) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hangingChars", m_oHangingChars) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:start", m_oStart) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:startChars", m_oStartChars) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:left", m_oStart) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:leftChars", m_oStartChars) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:right", m_oEnd) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:rightChars", m_oEndChars) - //2003 - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:first-line", m_oFirstLine) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:first-line-chars", m_oFirstLineChars) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:hanging-chars", m_oHangingChars) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:left-chars", m_oStartChars) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:right-charss", m_oEndChars) - WritingElement_ReadAttributes_End(oReader) - } - public: + private: + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + + public: nullable m_oEnd; - nullable > m_oEndChars; + nullable m_oEndChars; nullable m_oFirstLine; - nullable > m_oFirstLineChars; + nullable m_oFirstLineChars; nullable m_oHanging; - nullable > m_oHangingChars; + nullable m_oHangingChars; nullable m_oStart; - nullable > m_oStartChars; + nullable m_oStartChars; }; //-------------------------------------------------------------------------------- // Spacing 17.3.1.33 (Part 1) //-------------------------------------------------------------------------------- + class CSpacing : public ComplexType { public: ComplexTypes_AdditionConstructors(CSpacing) - CSpacing() - { - } - virtual ~CSpacing() - { - } + CSpacing(); + virtual ~CSpacing(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:after", m_oAfter); - XmlMacroReadAttributeBase(oNode, L"w:afterAutospacing", m_oAfterAutospacing); - XmlMacroReadAttributeBase(oNode, L"w:afterLines", m_oAfterLines); - XmlMacroReadAttributeBase(oNode, L"w:before", m_oBefore); - XmlMacroReadAttributeBase(oNode, L"w:beforeAutospacing", m_oBeforeAutospacing); - XmlMacroReadAttributeBase(oNode, L"w:beforeLines", m_oBeforeLines); - XmlMacroReadAttributeBase(oNode, L"w:line", m_oLine); - XmlMacroReadAttributeBase(oNode, L"w:lineRule", m_oLineRule); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); - - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oAfter.IsInit()) - { - sResult += L"w:after=\""; - sResult += m_oAfter->ToString(); - sResult += L"\" "; - } - - if (m_oAfterAutospacing.IsInit()) - { - sResult += L"w:afterAutospacing=\"" + std::wstring(m_oAfterAutospacing->ToBool() ? L"1" : L"0") + L"\" "; - } - - if (m_oAfterLines.IsInit()) - { - sResult += L"w:afterLines=\""; - sResult += m_oAfterLines->ToString(); - sResult += L"\" "; - } - - if (m_oBefore.IsInit()) - { - sResult += L"w:before=\""; - sResult += m_oBefore->ToString(); - sResult += L"\" "; - } - - if (m_oBeforeAutospacing.IsInit()) - { - sResult += L"w:beforeAutospacing=\"" + std::wstring(m_oBeforeAutospacing->ToBool() ? L"1" : L"0") + L"\" "; - } - - if (m_oBeforeLines.IsInit()) - { - sResult += L"w:beforeLines=\""; - sResult += m_oBeforeLines->ToString(); - sResult += L"\" "; - } - - if (m_oLine.IsInit()) - { - sResult += L"w:line=\""; - sResult += m_oLine->ToString(); - sResult += L"\" "; - } - - if (m_oLineRule.IsInit()) - { - sResult += L"w:lineRule=\""; - sResult += m_oLineRule->ToString(); - sResult += L"\" "; - } - - return sResult; - } + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; static const CSpacing Merge(const CSpacing& oPrev, const CSpacing& oCurrent) { @@ -3053,6 +1182,7 @@ namespace ComplexTypes oProperties.m_oLineRule = Merge(oPrev.m_oLineRule, oCurrent.m_oLineRule); return oProperties; } + template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -3065,453 +1195,232 @@ namespace ComplexTypes return oResult; } + private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w:after", m_oAfter) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:afterAutospacing", m_oAfterAutospacing) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:afterLines", m_oAfterLines) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:before", m_oBefore) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:beforeAutospacing", m_oBeforeAutospacing) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:beforeLines", m_oBeforeLines) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:line", m_oLine) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:lineRule", m_oLineRule) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:before-autospacing", m_oBeforeAutospacing) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:after-autospacing", m_oAfterAutospacing) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_oAfter; - nullable > m_oAfterAutospacing; - nullable > m_oAfterLines; + nullable m_oAfterAutospacing; + nullable m_oAfterLines; nullable m_oBefore; - nullable > m_oBeforeAutospacing; - nullable > m_oBeforeLines; + nullable m_oBeforeAutospacing; + nullable m_oBeforeLines; nullable m_oLine; - nullable > m_oLineRule; + nullable m_oLineRule; }; //-------------------------------------------------------------------------------- // TabStop 17.3.1.37 (Part 1) //-------------------------------------------------------------------------------- + class CTabStop : public ComplexType { public: ComplexTypes_AdditionConstructors(CTabStop) - CTabStop() - { - } - virtual ~CTabStop() - { - } + CTabStop(); + virtual ~CTabStop(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:leader", m_oLeader); - XmlMacroReadAttributeBase(oNode, L"w:pos", m_oPos); - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oLeader.IsInit()) - { - sResult += L"w:leader=\""; - sResult += m_oLeader->ToString(); - sResult += L"\" "; - } - if (m_oPos.IsInit()) - { - sResult += L"w:pos=\""; - sResult += m_oPos->ToString(); - sResult += L"\" "; - } - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w:leader", m_oLeader) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:pos", m_oPos) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable > m_oLeader; + nullable m_oLeader; nullable m_oPos; - nullable > m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // TextAlignment 17.3.1.39 (Part 1) //-------------------------------------------------------------------------------- + class CTextAlignment : public ComplexType { public: ComplexTypes_AdditionConstructors(CTextAlignment) - CTextAlignment() - { - } - virtual ~CTextAlignment() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CTextAlignment(); + virtual ~CTextAlignment(); - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // TextboxTightWrap 17.3.1.40 (Part 1) //-------------------------------------------------------------------------------- + class CTextboxTightWrap : public ComplexType { public: ComplexTypes_AdditionConstructors(CTextboxTightWrap) - CTextboxTightWrap() {} - virtual ~CTextboxTightWrap() {} - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CTextboxTightWrap(); + virtual ~CTextboxTightWrap(); - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (m_oVal.IsInit()) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\""; - } - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; + //-------------------------------------------------------------------------------- + // Ligatures + //-------------------------------------------------------------------------------- + class CLigatures : public ComplexType { public: ComplexTypes_AdditionConstructors(CLigatures) - CLigatures() {} - virtual ~CLigatures() {} + CLigatures(); + virtual ~CLigatures(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w14:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w14:val=\"" + m_oVal->ToString() + L"\""; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w14:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; + + //-------------------------------------------------------------------------------- + // NumSpacing + //-------------------------------------------------------------------------------- + class CNumSpacing : public ComplexType { public: ComplexTypes_AdditionConstructors(CNumSpacing) - CNumSpacing() {} - virtual ~CNumSpacing() {} + CNumSpacing(); + virtual ~CNumSpacing(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w14:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w14:val=\"" + m_oVal->ToString() + L"\""; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w14:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; + + //-------------------------------------------------------------------------------- + // NumForm + //-------------------------------------------------------------------------------- + class CNumForm : public ComplexType { public: ComplexTypes_AdditionConstructors(CNumForm) - CNumForm() {} - virtual ~CNumForm() {} + CNumForm(); + virtual ~CNumForm(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w14:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if (m_oVal.IsInit()) - { - sResult += L"w14:val=\"" + m_oVal->ToString() + L"\""; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_ReadSingle(oReader, L"w14:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oVal; + nullable m_oVal; }; + + //-------------------------------------------------------------------------------- + // StylisticSet + //-------------------------------------------------------------------------------- + class CStylisticSet : public ComplexType { public: ComplexTypes_AdditionConstructors(CStylisticSet) - CStylisticSet() {} - virtual ~CStylisticSet(){} - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"w14:id", m_oId); - XmlMacroReadAttributeBase(oNode, L"w14:val", m_oVal); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CStylisticSet(); + virtual ~CStylisticSet(); - if (!oReader.IsEmptyNode()) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if (m_oId.IsInit()) - { - sResult += L"w14:id=\""; - sResult += m_oId->ToString(); - sResult += L"\" "; - } - if (m_oVal.IsInit()) - { - sResult += L"w14:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, L"w14:id", m_oId) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w14:val", m_oVal) - WritingElement_ReadAttributes_End(oReader) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oId; - nullable> m_oVal; + nullable m_oId; + nullable m_oVal; }; + } // Word //------------------------------------------------------------------------------------------------------------------------- - namespace Drawing + + namespace Drawing { // --------------------------------------------------------------------------- // Offset (Point2D) 20.1.7.4 // --------------------------------------------------------------------------- + class CPoint2D : public ComplexType { public: ComplexTypes_AdditionConstructors(CPoint2D) - CPoint2D() - { - } - virtual ~CPoint2D() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"x", m_oX ); - XmlMacroReadAttributeBase( oNode, L"y", m_oY ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CPoint2D(); + virtual ~CPoint2D(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - sResult += L"x=\"" + m_oX.ToString() + L"\" "; - sResult += L"y=\"" + m_oY.ToString() + L"\" "; - - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"x", m_oX ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"y", m_oY ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: SimpleTypes::CCoordinate m_oX; SimpleTypes::CCoordinate m_oY; }; + // ----------------------------------------------------------------------- // Extent (PositiveSize2D) 20.4.2.7 // ----------------------------------------------------------------------- + class CPositiveSize2D : public ComplexType { public: ComplexTypes_AdditionConstructors(CPositiveSize2D) - CPositiveSize2D() - { - } - virtual ~CPositiveSize2D() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"cx", m_oCx ); - XmlMacroReadAttributeBase( oNode, L"cy", m_oCy ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CPositiveSize2D(); + virtual ~CPositiveSize2D(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - virtual std::wstring ToString() const - { - std::wstring sResult; - - sResult += L"cx=\"" + m_oCx.ToString() + L"\" "; - sResult += L"cy=\"" + m_oCy.ToString() + L"\" "; - - return sResult; - } private: + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"cx", m_oCx ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"cy", m_oCy ) - WritingElement_ReadAttributes_End( oReader ) - } public: - SimpleTypes::CPositiveCoordinate<> m_oCx; - SimpleTypes::CPositiveCoordinate<> m_oCy; + SimpleTypes::CPositiveCoordinate m_oCx; + SimpleTypes::CPositiveCoordinate m_oCy; }; + } // Drawing } // ComplexTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Base.cpp b/Common/DocxFormat/Source/Common/SimpleTypes_Base.cpp new file mode 100644 index 0000000000..838bf9c1fc --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Base.cpp @@ -0,0 +1,385 @@ +/* + * (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 "math.h" +#include "../Base/Unit.h" +#include "./SimpleTypes_Base.h" +#include + +namespace SimpleTypes +{ + CUniversalMeasure::CUniversalMeasure() {} + CUniversalMeasure::~CUniversalMeasure() {} + + double CUniversalMeasure::GetValue() const + { + return m_dValue; + } + double CUniversalMeasure::ToPoints() const + { + return m_dValue; + } + double CUniversalMeasure::ToInches() const + { + return m_dValue / 72.0; + } + double CUniversalMeasure::ToMm() const + { + return m_dValue * 25.4 / 72; + } + long CUniversalMeasure::ToTwips() const + { + return (long)Pt_To_Dx(m_dValue); + } + long CUniversalMeasure::ToHps() const + { + return (long)(m_dValue * 2); + } + unsigned long CUniversalMeasure::ToUnsignedTwips() const + { + return (unsigned long)Pt_To_Dx(m_dValue); + } + double CUniversalMeasure::FromHps(double dValue) + { + m_dValue = (dValue / 2); + return m_dValue; + } + double CUniversalMeasure::FromPoints(double dValue) + { + m_dValue = dValue; + return m_dValue; + } + double CUniversalMeasure::FromTwips(double dValue) + { + m_dValue = Dx_To_Pt(dValue); + return m_dValue; + } + double CUniversalMeasure::FromMm(double dValue) + { + m_dValue = Mm_To_Pt(dValue); + return m_dValue; + } + double CUniversalMeasure::FromInches(double dValue) + { + m_dValue = Inch_To_Pt( dValue ); + return m_dValue; + } + double CUniversalMeasure::FromEmu (double dValue) + { + m_dValue = Emu_To_Pt( dValue ); + return m_dValue; + } + + bool CUniversalMeasure::IsUnits() const + { + return m_bUnit; + } + + void CUniversalMeasure::Parse(const std::wstring &sValue, double dKoef) + { + m_bUnit = false; + m_dValue = 0; + + if (sValue.empty()) return; + + if ( sValue.length() <= 2 ) + { + m_dValue = XmlUtils::GetDouble( sValue.c_str() ) / dKoef; + + return; + } + + // Проверим последние два символа + std::wstring sUnit = sValue.substr( sValue.length() - 2, 2 ); + m_bUnit = true; + + if ( L"cm" == sUnit ) + { + double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); + m_dValue = Cm_To_Pt( dValue ); + } + else if ( L"mm" == sUnit ) + { + double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); + m_dValue = Mm_To_Pt( dValue ); + } + else if ( L"in" == sUnit ) + { + double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); + m_dValue = Inch_To_Pt( dValue ); + } + else if ( L"pt" == sUnit ) + { + m_dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); + } + else if ( L"pc" == sUnit ) + { + double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); + m_dValue = dValue * 12.0; + } + else if ( L"pi" == sUnit ) + { + double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); + m_dValue = dValue * 12.0; + } + else + { + m_bUnit = false; + m_dValue = XmlUtils::GetDouble( sValue.c_str() ) / dKoef; + + return; + } + } + + CUniversalMeasureOrPercent::CUniversalMeasureOrPercent() {} + CUniversalMeasureOrPercent::~CUniversalMeasureOrPercent() {} + + void CUniversalMeasureOrPercent::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = dValue; + } + double CUniversalMeasureOrPercent::FromString(const std::wstring &sValue) + { + m_bUnit = false; + m_bTrailingPercentSign = false; + if ( sValue.empty() ) + { + m_dValue = 0; + return m_dValue; + } + if('%' == sValue[sValue.length() - 1]) + { + m_bTrailingPercentSign = true; + m_dValue = XmlUtils::GetDouble( sValue.substr(0, sValue.length() - 1).c_str() ); + } + else + { + Parse(sValue, 1); + } + return m_dValue; + } + std::wstring CUniversalMeasureOrPercent::ToString() const + { + std::wstring sResult; + + if ( m_bUnit ) + sResult = boost::lexical_cast(m_dValue) + L"pt"; + else if ( m_bTrailingPercentSign ) + sResult = boost::lexical_cast(m_dValue) + L"%"; + else + sResult = std::to_wstring( (int)(m_dValue) ); + + return sResult; + } + bool CUniversalMeasureOrPercent::IsPercent() const + { + return m_bTrailingPercentSign; + } + + //-------------------------------------------------------------------------------- + // Класс наследуемый от CUniversalMeasure, для которого обычные значения - пункты. + //-------------------------------------------------------------------------------- + CPoint::CPoint() {} + + double CPoint::FromString(const std::wstring &sValue) + { + Parse(sValue, 1); + return m_dValue; + } + void CPoint::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = dValue; + } + std::wstring CPoint::ToString() const + { + return boost::lexical_cast(m_dValue) + L"pt"; + } + + double CPoint::FromPoints(double dValue) + { + m_dValue = dValue; + return m_dValue; + } + double CPoint::FromInches(double dValue) + { + m_dValue = dValue * 72; + return m_dValue; + } + + //-------------------------------------------------------------------------------- + // Класс наследуемый от CUniversalMeasure, для которого обычные значения - emu. + //-------------------------------------------------------------------------------- + CInch::CInch() {} + + double CInch::FromString(const std::wstring &sValue) + { + Parse(sValue, 1.0 / 72); + return m_dValue; + } + void CInch::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = FromInches(dValue); + } + std::wstring CInch::ToString() const + { + return boost::lexical_cast(ToInches()) + L"in"; + } + + CEmu::CEmu() {} + + double CEmu::FromString(const std::wstring &sValue) + { + Parse(sValue, 12700); + return m_dValue; + } + void CEmu::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = FromEmu(dValue); + } + std::wstring CEmu::ToString () const + { + return boost::lexical_cast(m_dValue) + L"pt"; + } + + double CEmu::FromPoints(double dValue) + { + m_dValue = dValue; + return m_dValue; + } + double CEmu::FromInches(double dValue) + { + m_dValue = dValue * 72; + return m_dValue; + } + + double CEmu::FromEmu(double dValue) + { + m_dValue = Emu_To_Pt(dValue); + return m_dValue; + } + double CEmu::FromPx(double dValue) + { + m_dValue = Px_To_Pt(dValue); + return m_dValue; + } + double CEmu::ToMm() + { + return Pt_To_Mm(m_dValue); + } + __int64 CEmu::ToEmu() + { + return (__int64)Pt_To_Emu(m_dValue); + } + long CEmu::ToPx() + { + return (long)Pt_To_Px(m_dValue); + } + + double CEmu::GetValue () const + { + return m_dValue; + } + + //-------------------------------------------------------------------------------- + // Класс читающий double + //-------------------------------------------------------------------------------- + CDouble::CDouble() {} + CDouble::~CDouble() {} + + CDouble::CDouble(const double& val) + { + this->m_dValue = (double)val; + } + + double CDouble::FromString(const std::wstring &sValue) + { + m_dValue = XmlUtils::GetDouble( sValue ); + return m_dValue; + } + + std::wstring CDouble::ToString () const + { + if (std::isnan(m_dValue)) return L"NaN"; + else if (std::isinf(m_dValue)) return L"INF"; + else return boost::lexical_cast(m_dValue); + } + std::wstring CDouble::ToString2() const + { + return boost::lexical_cast(m_dValue); + } + + void CDouble::SetValue(double dValue) + { + m_dValue = dValue; + } + double CDouble::GetValue () const + { + return m_dValue; + } + + //-------------------------------------------------------------------------------- + // DecimalNumber 17.18.10 (Part 1) + //-------------------------------------------------------------------------------- + + int CDecimalNumber::FromString(const std::wstring &sValue) + { + try + { + this->m_eValue = XmlUtils::GetInteger(sValue); + return this->m_eValue; + } + catch (...) + { + } + + try + { + this->m_eValue = static_cast(XmlUtils::GetInteger64(sValue)); + } + catch (...) + { + this->m_eValue = 0; + } + + return this->m_eValue; + } + + std::wstring CDecimalNumber::ToString() const + { + return std::to_wstring(this->m_eValue); + } + +} // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Base.h b/Common/DocxFormat/Source/Common/SimpleTypes_Base.h index e775f37cb3..07660a11e4 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Base.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Base.h @@ -31,536 +31,259 @@ */ #pragma once -#include "math.h" - -#include "../../../../DesktopEditor/xml/include/xmlutils.h" -#include "../../../../DesktopEditor/common/Types.h" -#include "../XML/Utils.h" -#include "../Common/Unit.h" +#include +#include "../Base/Base.h" namespace SimpleTypes { - // TO DO: В будущем надо улучшить функции FromString. Надо отказаться от сравнения - // строк, вместо этого высчитываем хэш и сравниваем по его значению. +#define SimpleTypes_DefaultString(Class) \ + Class(const std::wstring &sValue) { FromString(sValue); } \ + Class& operator=(const std::wstring& sValue) { FromString(sValue); return *this; } -#define SimpleType_FromString(Enum) \ - virtual Enum FromString(const wchar_t* cwsStr)\ - {\ - std::wstring wsTemp(cwsStr);\ - return FromString( wsTemp );\ - }\ - virtual Enum FromString(const std::wstring& wsStr)\ - {\ - std::wstring wsTemp (wsStr.c_str());\ - return FromString( wsTemp );\ - } +#define SimpleTypes_Default(Class) \ + bool operator==(const Class& oOther) const { return (this->m_eValue == oOther.m_eValue) ? true : false; } \ + SimpleTypes_DefaultString(Class) -#define SimpleType_FromString2(Enum) \ - Enum FromString(const wchar_t* cwsStr)\ - {\ - std::wstring wsTemp (cwsStr);\ - return FromString( wsTemp );\ - }\ - Enum FromString(const std::wstring& wsStr)\ - {\ - std::wstring wsTemp (wsStr.c_str());\ - return FromString( wsTemp );\ - } +#define SimpleTypes_DefaultD(Class) \ + bool operator==(const Class& oOther) const { return (this->m_dValue == oOther.m_dValue) ? true : false; } \ + SimpleTypes_DefaultString(Class) -#define SimpleTypes_AdditionalOpearators(Class) \ - const bool operator==(const Class& oOther) const\ - {\ - if ( this->m_eValue == oOther.m_eValue )\ - return true;\ - return false;\ - } +#define SimpleTypes_DefaultS(Class) \ + bool operator==(const Class& oOther) const { return (this->m_sValue == oOther.m_sValue) ? true : false; } \ + SimpleTypes_DefaultString(Class) -#define UniversalMeasure_AdditionalOpearators(Class) \ - const bool operator==(const Class& oOther) const\ - {\ - if ( m_dValue == oOther.m_dValue )\ - return true;\ - return false;\ - } + #define DEFINE_SIMPLE_TYPE_BASE(Class, Type, Default) \ + class Class \ + { \ + public: \ + Class(const std::wstring& sValue) { m_eValue = Default; FromString(sValue); } \ + Class& operator=(const std::wstring& sValue) { FromString(sValue); return *this; } \ + Class(const Type& sValue) { m_eValue = sValue; } \ + Class& operator=(const Type& sValue) { m_eValue = sValue; return *this; } \ + bool operator==(const Class& oOther) const { return (m_eValue == oOther.m_eValue) ? true : false; } \ + Type GetValue() const { return m_eValue; } \ + void SetValueFromByte(const unsigned char& value) { m_eValue = (Type)value; } \ + Type FromString(const std::wstring &sValue); \ + Type FromStringA(const char* pValue); \ + std::wstring ToString() const; \ + public: \ + Type m_eValue; -#define SimpleType_Operator_Equal(Class) \ - Class(std::wstring &sValue)\ - {\ - FromString( sValue );\ - }\ - Class(const wchar_t* cwsValue)\ - {\ - FromString( cwsValue );\ - }\ - Class(const std::wstring& wsStr)\ - {\ - FromString( wsStr.c_str() );\ - }\ - const Class &operator =(std::wstring &sValue)\ - {\ - FromString( sValue );\ - return *this;\ - }\ - const Class &operator =(const wchar_t* cwsString)\ - {\ - FromString( cwsString );\ - return *this;\ - }\ - const Class &operator =(const std::wstring& wsStr)\ - {\ - FromString( wsStr.c_str() );\ - return *this;\ - } + #define DEFINE_SIMPLE_TYPE_START(Class, Type, Default) \ + DEFINE_SIMPLE_TYPE_BASE(Class, Type, Default) \ + public: \ + Class() { m_eValue = Default; } \ + void SetValue(const Type& value) { m_eValue = value; } + + #define DEFINE_SIMPLE_TYPE_START_NSV(Class, Type, Default) \ + DEFINE_SIMPLE_TYPE_BASE(Class, Type, Default) \ + public: \ + Class() { m_eValue = Default; } \ + void SetValue(const Type value); + + #define DEFINE_SIMPLE_TYPE_START_NC(Class, Type, Default) \ + DEFINE_SIMPLE_TYPE_BASE(Class, Type, Default) \ + public: \ + void SetValue(const Type& value) { m_eValue = value; } + + #define DEFINE_SIMPLE_TYPE(Class, Type, Default) \ + DEFINE_SIMPLE_TYPE_START(Class, Type, Default) \ + }; + + #define DEFINE_SIMPLE_TYPE_NSV(Class, Type, Default) \ + DEFINE_SIMPLE_TYPE_START_NSV(Class, Type, Default) \ + }; + + #define DEFINE_SIMPLE_TYPE_NC(Class, Type, Default) \ + DEFINE_SIMPLE_TYPE_START_NC(Class, Type, Default) \ + }; + + //-------------------------------------------------------------------------------- + // SimpleType + //-------------------------------------------------------------------------------- template class CSimpleType { public: - CSimpleType() { m_eValue = DefValue; } - virtual ~CSimpleType() {} + virtual ~CSimpleType() {} virtual E GetValue () const { return m_eValue; } - void SetValueFromByte(BYTE value) + void SetValueFromByte(unsigned char value) { m_eValue = (E)value; } - virtual void SetValue (E eValue) + virtual void SetValue(E eValue) { m_eValue = eValue; } - virtual E FromString(std::wstring &sValue) = 0; - virtual std::wstring ToString () const = 0; + virtual E FromString(const std::wstring &sValue) = 0; + virtual std::wstring ToString () const = 0; - protected: + protected: E m_eValue; }; + //-------------------------------------------------------------------------------- + // UniversalMeasure + //-------------------------------------------------------------------------------- + class CUniversalMeasure { public: + CUniversalMeasure(); + virtual ~CUniversalMeasure(); - CUniversalMeasure() {} - virtual ~CUniversalMeasure() {} + virtual double FromString(const std::wstring &sValue) = 0; + virtual std::wstring ToString() const = 0; - virtual double FromString(std::wstring &sValue) = 0; - virtual std::wstring ToString () const = 0; - virtual void SetValue(double val) = 0; + virtual void SetValue(double val) = 0; + double GetValue() const; - double GetValue() const - { - return m_dValue; - } - double ToPoints() const - { - return m_dValue; - } - double ToInches() const - { - return m_dValue / 72.0; - } - double ToMm() const - { - return m_dValue * 25.4 / 72; - } - long ToTwips() const - { - return (long)Pt_To_Dx(m_dValue); - } - long ToHps() const - { - return (long)(m_dValue * 2); - } - unsigned long ToUnsignedTwips() const - { - return (unsigned long)Pt_To_Dx(m_dValue); - } - virtual double FromHps(double dValue) - { - m_dValue = (dValue / 2); - return m_dValue; - } - virtual double FromPoints(double dValue) - { - m_dValue = dValue; - return m_dValue; - } - virtual double FromTwips(double dValue) - { - m_dValue = Dx_To_Pt(dValue); - return m_dValue; - } - virtual double FromMm(double dValue) - { - m_dValue = Mm_To_Pt(dValue); - return m_dValue; - } - virtual double FromInches(double dValue) - { - m_dValue = Inch_To_Pt( dValue ); - return m_dValue; - } - virtual double FromEmu (double dValue) - { - m_dValue = Emu_To_Pt( dValue ); - return m_dValue; - } + double ToPoints() const; + double ToInches() const; + double ToMm() const; + long ToTwips() const; + long ToHps() const; + unsigned long ToUnsignedTwips() const; - bool IsUnits() const - { - return m_bUnit; - } - protected: - - void Parse(std::wstring &sValue, double dKoef) - { - m_bUnit = false; - m_dValue = 0; - - if (sValue.empty()) return; - - if ( sValue.length() <= 2 ) - { - m_dValue = XmlUtils::GetDouble( sValue.c_str() ) / dKoef; - - return; - } - - // Проверим последние два символа - std::wstring sUnit = sValue.substr( sValue.length() - 2, 2 ); - m_bUnit = true; - - if ( _T("cm") == sUnit ) - { - double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); - m_dValue = Cm_To_Pt( dValue ); - } - else if ( _T("mm") == sUnit ) - { - double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); - m_dValue = Mm_To_Pt( dValue ); - } - else if ( _T("in") == sUnit ) - { - double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); - m_dValue = Inch_To_Pt( dValue ); - } - else if ( _T("pt") == sUnit ) - { - m_dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); - } - else if ( _T("pc") == sUnit ) - { - double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); - m_dValue = dValue * 12.0; - } - else if ( _T("pi") == sUnit ) - { - double dValue = XmlUtils::GetDouble( sValue.substr( 0, sValue.length() - 2 ).c_str() ); - m_dValue = dValue * 12.0; - } - else - { - m_bUnit = false; - m_dValue = XmlUtils::GetDouble( sValue.c_str() ) / dKoef; - - return; - } - } + virtual double FromHps(double dValue); + virtual double FromPoints(double dValue); + virtual double FromTwips(double dValue); + virtual double FromMm(double dValue); + virtual double FromInches(double dValue); + virtual double FromEmu(double dValue); + bool IsUnits() const; protected: + void Parse(const std::wstring &sValue, double dKoef); - bool m_bUnit = false;; + protected: + bool m_bUnit = false; double m_dValue = 0; // Значение в пунктах }; + //-------------------------------------------------------------------------------- + // UniversalMeasureOrPercent + //-------------------------------------------------------------------------------- + class CUniversalMeasureOrPercent : public CUniversalMeasure { public: - - CUniversalMeasureOrPercent() {} - virtual ~CUniversalMeasureOrPercent() {} + CUniversalMeasureOrPercent(); + virtual ~CUniversalMeasureOrPercent(); - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = dValue; - } - virtual double FromString(std::wstring &sValue) - { - m_bUnit = false; - m_bTrailingPercentSign = false; - if ( sValue.empty() ) - { - m_dValue = 0; - return m_dValue; - } - if('%' == sValue[sValue.length() - 1]) - { - m_bTrailingPercentSign = true; - m_dValue = XmlUtils::GetDouble( sValue.substr(0, sValue.length() - 1).c_str() ); - } - else - { - Parse(sValue, 1); - } - return m_dValue; - } - virtual std::wstring ToString () const - { - std::wstring sResult; + virtual void SetValue(double dValue); + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - if ( m_bUnit ) - sResult = boost::lexical_cast(m_dValue) + L"pt"; - else if ( m_bTrailingPercentSign ) - sResult = boost::lexical_cast(m_dValue) + L"%"; - else - sResult = std::to_wstring( (int)(m_dValue) ); + bool IsPercent() const; - return sResult; - } - bool IsPercent() const - { - return m_bTrailingPercentSign; - } protected: - bool m_bTrailingPercentSign; + bool m_bTrailingPercentSign; }; //-------------------------------------------------------------------------------- // Класс наследуемый от CUniversalMeasure, для которого обычные значения - пункты. - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CPoint : public CUniversalMeasure { public: - CPoint() {} + CPoint(); - virtual double FromString(std::wstring &sValue) - { - Parse(sValue, 1); - return m_dValue; - } - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = dValue; - } - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dValue) + L"pt"; - } + virtual double FromString(const std::wstring &sValue); + virtual void SetValue(double dValue); + virtual std::wstring ToString () const; - virtual double FromPoints(double dValue) - { - m_dValue = dValue; - return m_dValue; - } - virtual double FromInches(double dValue) - { - m_dValue = dValue * 72; - return m_dValue; - } - double GetValue () const - { - return m_dValue; - } - SimpleType_FromString (double) - SimpleType_Operator_Equal (CPoint) - UniversalMeasure_AdditionalOpearators(CPoint) + virtual double FromPoints(double dValue); + virtual double FromInches(double dValue); + + SimpleTypes_DefaultD(CPoint) }; + //-------------------------------------------------------------------------------- + // Inch + //-------------------------------------------------------------------------------- + class CInch : public CUniversalMeasure { public: - CInch() {} + CInch(); - virtual double FromString(std::wstring &sValue) - { - Parse(sValue, 1.0 / 72); - return m_dValue; - } - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = FromInches(dValue); - } - virtual std::wstring ToString () const - { - return boost::lexical_cast(ToInches()) + L"in"; - } + virtual double FromString(const std::wstring &sValue); + virtual void SetValue(double dValue); + virtual std::wstring ToString() const; - SimpleType_FromString (double) - SimpleType_Operator_Equal (CInch) - UniversalMeasure_AdditionalOpearators(CInch) + SimpleTypes_DefaultD(CInch) }; - //-------------------------------------------------------------------------------- // Класс наследуемый от CUniversalMeasure, для которого обычные значения - emu. - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CEmu : public CUniversalMeasure { public: - CEmu() {} + CEmu(); - virtual double FromString(std::wstring &sValue) - { - Parse(sValue, 12700); - return m_dValue; - } - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = FromEmu(dValue); - } - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dValue) + L"pt"; - } + virtual double FromString(const std::wstring &sValue); + virtual void SetValue(double dValue); + virtual std::wstring ToString() const; - virtual double FromPoints(double dValue) - { - m_dValue = dValue; - return m_dValue; - } - virtual double FromInches(double dValue) - { - m_dValue = dValue * 72; - return m_dValue; - } + virtual double FromPoints(double dValue); + virtual double FromInches(double dValue); - virtual double FromEmu(double dValue) - { - m_dValue = Emu_To_Pt(dValue); - return m_dValue; - } - virtual double FromPx(double dValue) - { - m_dValue = Px_To_Pt(dValue); - return m_dValue; - } - virtual double ToMm() - { - return Pt_To_Mm(m_dValue); - } - virtual __int64 ToEmu() - { - return (__int64)Pt_To_Emu(m_dValue); - } - virtual long ToPx() - { - return (long)Pt_To_Px(m_dValue); - } - double GetValue () const - { - return m_dValue; - } - SimpleType_FromString (double) - SimpleType_Operator_Equal (CEmu) - UniversalMeasure_AdditionalOpearators(CEmu) + virtual double FromEmu(double dValue); + virtual double FromPx(double dValue); + virtual double ToMm(); + virtual _INT64 ToEmu(); + virtual long ToPx(); + double GetValue () const; + + SimpleTypes_DefaultD(CEmu) }; - //-------------------------------------------------------------------------------- // Класс читающий double - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CDouble { public: - CDouble() {} - virtual ~CDouble() {} + CDouble(); + virtual ~CDouble(); - CDouble(const double& val) - { - this->m_dValue = (double)val; - } + CDouble(const double& val); - virtual double FromString(std::wstring &sValue) - { - m_dValue = XmlUtils::GetDouble( sValue ); - return m_dValue; - } + virtual double FromString(const std::wstring &sValue); - virtual std::wstring ToString () const - { - if (std::isnan(m_dValue)) return L"NaN"; - else if (std::isinf(m_dValue)) return L"INF"; - else return boost::lexical_cast(m_dValue); - } - virtual std::wstring ToString2() const - { - return boost::lexical_cast(m_dValue); - } + virtual std::wstring ToString () const; + virtual std::wstring ToString2() const; - void SetValue(double dValue) - { - m_dValue = dValue; - } - double GetValue () const - { - return m_dValue; - } - SimpleType_FromString (double) - SimpleType_Operator_Equal (CDouble) + void SetValue(double dValue); + double GetValue () const; + + SimpleTypes_DefaultD(CDouble) private: - double m_dValue; }; //-------------------------------------------------------------------------------- // DecimalNumber 17.18.10 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - template - class CDecimalNumber : public CSimpleType - { - public: - CDecimalNumber() {} + DEFINE_SIMPLE_TYPE(CDecimalNumber, int, 0) - CDecimalNumber(const _UINT32& val) - { - this->m_eValue = (int)val; - } - - virtual int FromString(std::wstring &sValue) - { - try - { - this->m_eValue = _wtoi(sValue.c_str()); - return this->m_eValue; - } - catch (...) - { - } - - try - { - this->m_eValue = static_cast(_wtoi64(sValue.c_str())); - } - catch (...) - { - this->m_eValue = 0; - } - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - return std::to_wstring(this->m_eValue); - } - SimpleType_FromString(int) - SimpleType_Operator_Equal(CDecimalNumber) - SimpleTypes_AdditionalOpearators(CDecimalNumber) - }; } // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Drawing.cpp b/Common/DocxFormat/Source/Common/SimpleTypes_Drawing.cpp new file mode 100644 index 0000000000..761d903ce4 --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Drawing.cpp @@ -0,0 +1,5398 @@ +/* + * (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_Drawing.h" +#include "../Base/WinColor.h" // GetSysColor +#include "../../../../DesktopEditor/common/StringExt.h" +#include "../Base/Unit.h" +#include + +namespace SimpleTypes +{ + //-------------------------------------------------------------------------------- + // AdjAngle 20.1.10.1 (Part 1) + //-------------------------------------------------------------------------------- + + void CAdjAngle::Parse(const std::wstring &sValue) + { + bool bAngleValue = true; + + for ( size_t nIndex = 0; nIndex < sValue.length(); nIndex++ ) + { + if ( !iswdigit( sValue[nIndex] ) ) + { + bAngleValue = false; + break; + } + } + + if ( bAngleValue ) + { + this->m_eValue = adjangleAngle; + m_nAngle = XmlUtils::GetInteger( sValue ); + } + else + { + this->m_eValue = adjangleGuide; + m_sGuide = sValue; + } + } + + EAdjAngle CAdjAngle::FromString(const std::wstring &sValue) + { + m_nAngle = 0; + m_sGuide.clear(); + + Parse( sValue ); + + return this->m_eValue; + } + + std::wstring CAdjAngle::ToString() const + { + if ( adjangleAngle == this->m_eValue ) + { + return std::to_wstring( m_nAngle ); + } + else + { + return m_sGuide; + } + } + + double CAdjAngle::GetAngle() const + { + return m_nAngle / 60000.0; + } + + std::wstring CAdjAngle::GetGuide() const + { + return m_sGuide; + } + + + //-------------------------------------------------------------------------------- + // AdjCoordinate 20.1.10.2 (Part 1) + //-------------------------------------------------------------------------------- + + template<> + CAdjCoordinate::CAdjCoordinate() + { + this->m_eValue = adjcoordinateCoord; + } + template<> + void CAdjCoordinate::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = FromEmu(dValue); + } + + template<> + void CAdjCoordinate::Parse2(const std::wstring &sValue) + { + Parse( sValue, 12700 ); + + bool bGuide = false; + if ( !m_bUnit ) + { + for ( size_t nIndex = 0; nIndex < sValue.length(); nIndex++ ) + { + if ( !iswdigit( sValue[nIndex] ) ) + { + bGuide = true; + break; + } + } + } + else + { + // Последние два символа не проверяем + for ( size_t nIndex = 0; nIndex < sValue.length() - 2; nIndex++ ) + { + if ( !iswdigit( sValue[nIndex] ) && sValue[nIndex] != '.' && sValue[nIndex] != '-' ) + { + bGuide = true; + break; + } + } + } + + + if ( bGuide ) + { + this->m_eValue = adjcoordinateGuide; + m_sGuide = sValue; + } + else + { + this->m_eValue = adjcoordinateCoord; + // Значение хранится в m_dValue + } + } + + template<> + double CAdjCoordinate::FromString(const std::wstring &sValue) + { + m_sGuide.clear(); + + Parse2( sValue ); + + return m_dValue; + } + + template<> + std::wstring CAdjCoordinate::ToString() const + { + if ( adjcoordinateCoord == this->m_eValue ) + { + if ( m_bUnit ) + { + return XmlUtils::DoubleToString(m_dValue, L"%.2f") + L"pt"; + } + else + { + return std::to_wstring( (int)Pt_To_Emu( m_dValue ) ); + } + } + else + { + return m_sGuide; + } + } + + template<> + std::wstring CAdjCoordinate::GetGuide() const + { + return m_sGuide; + } + + template<> + double CAdjCoordinate::GetValue() const + { + return m_dValue; + } + + //-------------------------------------------------------------------------------- + // Angle 20.1.10.3 (Part 1) + //-------------------------------------------------------------------------------- + + int CAngle::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger(sValue); + + return this->m_eValue; + } + + std::wstring CAngle::ToString() const + { + return std::to_wstring( this->m_eValue ); + } + + double CAngle::GetAngle() const + { + return this->m_eValue / 60000.0; + } + + //-------------------------------------------------------------------------------- + // AnimationBuildType 20.1.10.4 (Part 1) + //-------------------------------------------------------------------------------- + + EAnimationBuildType CAnimationBuildType::FromString(const std::wstring &sValue) + { + if ( (L"allAtOnce") == sValue ) this->m_eValue = animationbuildtypeAllAtOnce; + else this->m_eValue = animationbuildtypeAllAtOnce; + + return this->m_eValue; + } + + std::wstring CAnimationBuildType::ToString () const + { + switch(this->m_eValue) + { + case animationbuildtypeAllAtOnce : return (L"allAtOnce"); + default : return (L"allAtOnce"); + } + } + + //-------------------------------------------------------------------------------- + // AnimationChartBuildType 20.1.10.5 (Part 1) + //-------------------------------------------------------------------------------- + + EAnimationChartBuildType CAnimationChartBuildType::FromString(const std::wstring &sValue) + { + if ( (L"allAtOnce") == sValue ) this->m_eValue = animationchartbuildtypeAllAtOnce; + else if ( (L"category") == sValue ) this->m_eValue = animationchartbuildtypeCategory; + else if ( (L"categoryEl") == sValue ) this->m_eValue = animationchartbuildtypeCategoryEl; + else if ( (L"series") == sValue ) this->m_eValue = animationchartbuildtypeSeries; + else if ( (L"seriesEl") == sValue ) this->m_eValue = animationchartbuildtypeSeriesEl; + else this->m_eValue = animationchartbuildtypeAllAtOnce; + + return this->m_eValue; + } + + std::wstring CAnimationChartBuildType::ToString () const + { + switch(this->m_eValue) + { + case animationchartbuildtypeAllAtOnce : return (L"allAtOnce"); + case animationchartbuildtypeCategory : return (L"category"); + case animationchartbuildtypeCategoryEl : return (L"categoryEl"); + case animationchartbuildtypeSeries : return (L"series"); + case animationchartbuildtypeSeriesEl : return (L"seriesEl"); + default : return (L"allAtOnce"); + } + } + + //-------------------------------------------------------------------------------- + // AnimationChartOnlyBuildType 20.1.10.6 (Part 1) + //-------------------------------------------------------------------------------- + + EAnimationChartOnlyBuildType CAnimationChartOnlyBuildType::FromString(const std::wstring &sValue) + { + if ( (L"category") == sValue ) this->m_eValue = animationchartonlybuildtypeCategory; + else if ( (L"categoryEl") == sValue ) this->m_eValue = animationchartonlybuildtypeCategoryEl; + else if ( (L"series") == sValue ) this->m_eValue = animationchartonlybuildtypeSeries; + else if ( (L"seriesEl") == sValue ) this->m_eValue = animationchartonlybuildtypeSeriesEl; + else this->m_eValue = animationchartonlybuildtypeCategory; + + return this->m_eValue; + } + + std::wstring CAnimationChartOnlyBuildType::ToString () const + { + switch(this->m_eValue) + { + case animationchartonlybuildtypeCategory : return (L"category"); + case animationchartonlybuildtypeCategoryEl : return (L"categoryEl"); + case animationchartonlybuildtypeSeries : return (L"series"); + case animationchartonlybuildtypeSeriesEl : return (L"seriesEl"); + default : return (L"category"); + } + } + + //-------------------------------------------------------------------------------- + // AnimationDgmBuildType 20.1.10.7 (Part 1) + //-------------------------------------------------------------------------------- + + EAnimationDgmBuildType CAnimationDgmBuildType::FromString(const std::wstring &sValue) + { + if ( (L"allAtOnce") == sValue ) this->m_eValue = animationdgmbuildtypeAllAtOnce; + else if ( (L"lvlAtOnce") == sValue ) this->m_eValue = animationdgmbuildtypeLvlAtOnce; + else if ( (L"lvlOne") == sValue ) this->m_eValue = animationdgmbuildtypeLvlOne; + else if ( (L"one") == sValue ) this->m_eValue = animationdgmbuildtypeOne; + else this->m_eValue = animationdgmbuildtypeAllAtOnce; + + return this->m_eValue; + } + + std::wstring CAnimationDgmBuildType::ToString () const + { + switch(this->m_eValue) + { + case animationdgmbuildtypeAllAtOnce : return (L"allAtOnce"); + case animationdgmbuildtypeLvlAtOnce : return (L"lvlAtOnce"); + case animationdgmbuildtypeLvlOne : return (L"lvlOne"); + case animationdgmbuildtypeOne : return (L"one"); + default : return (L"allAtOnce"); + } + } + + + //-------------------------------------------------------------------------------- + // AnimationDgmOnlyBuildType 20.1.10.8 (Part 1) + //-------------------------------------------------------------------------------- + + EAnimationDgmOnlyBuildType CAnimationDgmOnlyBuildType::FromString(const std::wstring &sValue) + { + if ( (L"lvlAtOnce") == sValue ) this->m_eValue = animationdgmonlybuildtypeLvlAtOnce; + else if ( (L"lvlOne") == sValue ) this->m_eValue = animationdgmonlybuildtypeLvlOne; + else if ( (L"one") == sValue ) this->m_eValue = animationdgmonlybuildtypeOne; + else this->m_eValue = animationdgmonlybuildtypeOne; + + return this->m_eValue; + } + + std::wstring CAnimationDgmOnlyBuildType::ToString() const + { + switch(this->m_eValue) + { + case animationdgmonlybuildtypeLvlAtOnce : return (L"lvlAtOnce"); + case animationdgmonlybuildtypeLvlOne : return (L"lvlOne"); + case animationdgmonlybuildtypeOne : return (L"one"); + default : return (L"lvlAtOnce"); + } + } + + //-------------------------------------------------------------------------------- + // BevelPresetType 20.1.10.9 (Part 1) + //-------------------------------------------------------------------------------- + + EBevelPresetType CBevelPresetType::FromString(const std::wstring &sValue) + { + if ( (L"angle") == sValue ) this->m_eValue = bevelpresettypeAngle; + else if ( (L"artDeco") == sValue ) this->m_eValue = bevelpresettypeArtDeco; + else if ( (L"circle") == sValue ) this->m_eValue = bevelpresettypeCircle; + else if ( (L"convex") == sValue ) this->m_eValue = bevelpresettypeConvex; + else if ( (L"coolSlant") == sValue ) this->m_eValue = bevelpresettypeCoolSlant; + else if ( (L"cross") == sValue ) this->m_eValue = bevelpresettypeCross; + else if ( (L"divot") == sValue ) this->m_eValue = bevelpresettypeDivot; + else if ( (L"hardEdge") == sValue ) this->m_eValue = bevelpresettypeHardEdge; + else if ( (L"relaxedInset") == sValue ) this->m_eValue = bevelpresettypeRelaxedInset; + else if ( (L"riblet") == sValue ) this->m_eValue = bevelpresettypeRiblet; + else if ( (L"slope") == sValue ) this->m_eValue = bevelpresettypeSlope; + else if ( (L"softRound") == sValue ) this->m_eValue = bevelpresettypeSoftRound; + else this->m_eValue = bevelpresettypeAngle; + + return this->m_eValue; + } + + std::wstring CBevelPresetType::ToString () const + { + switch(this->m_eValue) + { + case bevelpresettypeAngle : return (L"angle"); + case bevelpresettypeArtDeco : return (L"artDeco"); + case bevelpresettypeCircle : return (L"circle"); + case bevelpresettypeConvex : return (L"convex"); + case bevelpresettypeCoolSlant : return (L"coolSlant"); + case bevelpresettypeCross : return (L"cross"); + case bevelpresettypeDivot : return (L"divot"); + case bevelpresettypeHardEdge : return (L"hardEdge"); + case bevelpresettypeRelaxedInset : return (L"relaxedInset"); + case bevelpresettypeRiblet : return (L"riblet"); + case bevelpresettypeSlope : return (L"slope"); + case bevelpresettypeSoftRound : return (L"softRound"); + default : return (L"angle"); + } + } + + //-------------------------------------------------------------------------------- + // BlackWhiteMode 20.1.10.10 (Part 1) + //-------------------------------------------------------------------------------- + + EBlackWhiteMode CBlackWhiteMode::FromString(const std::wstring &sValue) + { + if ( (L"auto") == sValue ) this->m_eValue = blackwhitemodeAuto; + else if ( (L"black") == sValue ) this->m_eValue = blackwhitemodeBlack; + else if ( (L"blackGray") == sValue ) this->m_eValue = blackwhitemodeBlackGray; + else if ( (L"blackWhite") == sValue ) this->m_eValue = blackwhitemodeBlackWhite; + else if ( (L"clr") == sValue ) this->m_eValue = blackwhitemodeClr; + else if ( (L"gray") == sValue ) this->m_eValue = blackwhitemodeGray; + else if ( (L"grayWhite") == sValue ) this->m_eValue = blackwhitemodeGrayWhite; + else if ( (L"hidden") == sValue ) this->m_eValue = blackwhitemodeHidden; + else if ( (L"invGray") == sValue ) this->m_eValue = blackwhitemodeInvGray; + else if ( (L"ltGray") == sValue ) this->m_eValue = blackwhitemodeLtGray; + else if ( (L"white") == sValue ) this->m_eValue = blackwhitemodeWhite; + else this->m_eValue = blackwhitemodeAuto; + + return this->m_eValue; + } + + std::wstring CBlackWhiteMode::ToString () const + { + switch(this->m_eValue) + { + case blackwhitemodeAuto : return (L"auto"); + case blackwhitemodeBlack : return (L"black"); + case blackwhitemodeBlackGray : return (L"blackGray"); + case blackwhitemodeBlackWhite : return (L"blackWhite"); + case blackwhitemodeClr : return (L"clr"); + case blackwhitemodeGray : return (L"gray"); + case blackwhitemodeGrayWhite : return (L"grayWhite"); + case blackwhitemodeHidden : return (L"hidden"); + case blackwhitemodeInvGray : return (L"invGray"); + case blackwhitemodeLtGray : return (L"ltGray"); + case blackwhitemodeWhite : return (L"white"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // BlendMode 20.1.10.11 (Part 1) + //-------------------------------------------------------------------------------- + + EBlendMode CBlendMode::FromString(const std::wstring &sValue) + { + if ( (L"darken") == sValue ) this->m_eValue = blendmodeDarken; + else if ( (L"lighten") == sValue ) this->m_eValue = blendmodeLighten; + else if ( (L"mult") == sValue ) this->m_eValue = blendmodeMult; + else if ( (L"over") == sValue ) this->m_eValue = blendmodeOver; + else if ( (L"screen") == sValue ) this->m_eValue = blendmodeScreen; + else this->m_eValue = blendmodeMult; + + return this->m_eValue; + } + + std::wstring CBlendMode::ToString () const + { + switch(this->m_eValue) + { + case blendmodeDarken : return (L"darken"); + case blendmodeLighten : return (L"lighten"); + case blendmodeMult : return (L"mult"); + case blendmodeOver : return (L"over"); + case blendmodeScreen : return (L"screen"); + default : return (L"mult"); + } + } + + //-------------------------------------------------------------------------------- + // BlipCompression 20.1.10.12 (Part 1) + //-------------------------------------------------------------------------------- + + EBlipCompression CBlipCompression::FromString(const std::wstring &sValue) + { + if ( (L"email") == sValue ) this->m_eValue = blipcompressionEmail; + else if ( (L"hqprint") == sValue ) this->m_eValue = blipcompressionHQPrint; + else if ( (L"none") == sValue ) this->m_eValue = blipcompressionNone; + else if ( (L"print") == sValue ) this->m_eValue = blipcompressionPrint; + else if ( (L"screen") == sValue ) this->m_eValue = blipcompressionScreen; + else this->m_eValue = blipcompressionNone; + + return this->m_eValue; + } + + std::wstring CBlipCompression::ToString () const + { + switch(this->m_eValue) + { + case blipcompressionEmail : return (L"email"); + case blipcompressionHQPrint : return (L"hqprint"); + case blipcompressionNone : return (L"none"); + case blipcompressionPrint : return (L"print"); + case blipcompressionScreen : return (L"screen"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // ColorSchemeIndex 20.1.10.14 (Part 1) + //-------------------------------------------------------------------------------- + + EColorSchemeIndex CColorSchemeIndex::FromString(const std::wstring &sValue) + { + this->m_eValue = colorschemeindexAccent1; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( (L"accent1") == sValue ) this->m_eValue = colorschemeindexAccent1; + else if ( (L"accent2") == sValue ) this->m_eValue = colorschemeindexAccent2; + else if ( (L"accent3") == sValue ) this->m_eValue = colorschemeindexAccent3; + else if ( (L"accent4") == sValue ) this->m_eValue = colorschemeindexAccent4; + else if ( (L"accent5") == sValue ) this->m_eValue = colorschemeindexAccent5; + else if ( (L"accent6") == sValue ) this->m_eValue = colorschemeindexAccent6; + break; + case 'd': + if ( (L"dk1") == sValue ) this->m_eValue = colorschemeindexDk1; + else if ( (L"dk2") == sValue ) this->m_eValue = colorschemeindexDk2; + break; + case 'f': + if ( (L"folHlink") == sValue ) this->m_eValue = colorschemeindexFolHlink; + break; + case 'h': + if ( (L"hlink") == sValue ) this->m_eValue = colorschemeindexHlink; + break; + case 'l': + if ( (L"lt1") == sValue ) this->m_eValue = colorschemeindexLt1; + else if ( (L"lt2") == sValue ) this->m_eValue = colorschemeindexLt2; + break; + } + + return this->m_eValue; + } + + std::wstring CColorSchemeIndex::ToString () const + { + switch(this->m_eValue) + { + case colorschemeindexAccent1 : return (L"accent1"); + case colorschemeindexAccent2 : return (L"accent2"); + case colorschemeindexAccent3 : return (L"accent3"); + case colorschemeindexAccent4 : return (L"accent4"); + case colorschemeindexAccent5 : return (L"accent5"); + case colorschemeindexAccent6 : return (L"accent6"); + case colorschemeindexDk1 : return (L"dk1"); + case colorschemeindexDk2 : return (L"dk2"); + case colorschemeindexFolHlink: return (L"folHlink"); + case colorschemeindexHlink : return (L"hlink"); + case colorschemeindexLt1 : return (L"lt1"); + case colorschemeindexLt2 : return (L"lt2"); + default : return (L"accent1"); + } + } + + //-------------------------------------------------------------------------------- + // CompoundLine 20.1.10.15 (Part 1) + //-------------------------------------------------------------------------------- + + ECompoundLine CCompoundLine::FromString(const std::wstring &sValue) + { + this->m_eValue = compoundlineSng; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'd': + if ( (L"dbl") == sValue ) this->m_eValue = compoundlineDbl; + break; + case 's': + if ( (L"sng") == sValue ) this->m_eValue = compoundlineSng; + break; + case 't': + if ( (L"thickThin") == sValue ) this->m_eValue = compoundlineThickThin; + else if ( (L"thinThick") == sValue ) this->m_eValue = compoundlineThinThick; + else if ( (L"tri") == sValue ) this->m_eValue = compoundlineTri; + break; + } + + return this->m_eValue; + } + + std::wstring CCompoundLine::ToString () const + { + switch(this->m_eValue) + { + case compoundlineDbl: return (L"dbl"); + case compoundlineSng: return (L"sng"); + case compoundlineThickThin: return (L"thickThin"); + case compoundlineThinThick: return (L"thinThick"); + case compoundlineTri: return (L"tri"); + default : return (L"sng"); + } + } + + //-------------------------------------------------------------------------------- + // Coordinate 20.1.10.16 (Part 1) + //-------------------------------------------------------------------------------- + + CCoordinate::CCoordinate() {} + + double CCoordinate::GetValue() const + { + return m_dValue; + } + void CCoordinate::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = dValue; + } + double CCoordinate::FromString(const std::wstring &sValue) + { + Parse(sValue, 12700); + + return m_dValue; + } + + std::wstring CCoordinate::ToString () const + { + std::wstring sResult; + + if ( m_bUnit ) + sResult = boost::lexical_cast(m_dValue) + L"pt"; + else + sResult = std::to_wstring( (__int64)m_dValue ); + + return sResult; + } + + __int64 CCoordinate::ToEmu() const + { + return (__int64)Pt_To_Emu( m_dValue ); + } + double CCoordinate::ToCm() const + { + return Pt_To_Cm( m_dValue ); + } + + //-------------------------------------------------------------------------------- + // Coordinate32 20.1.10.17 (Part 1) + //-------------------------------------------------------------------------------- + + //-------------------------------------------------------------------------------- + // DrawingElementId 20.1.10.21 (Part 1) + //-------------------------------------------------------------------------------- + + int CDrawingElementId::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger(sValue); + + return this->m_eValue; + } + + std::wstring CDrawingElementId::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // EffectContainerType 20.1.10.22 (Part 1) + //-------------------------------------------------------------------------------- + + EEffectContainerType CEffectContainerType::FromString(const std::wstring &sValue) + { + this->m_eValue = effectcontainertypeSib; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 's': + if ( (L"sib") == sValue ) this->m_eValue = effectcontainertypeSib; + break; + case 't': + if ( (L"tree") == sValue ) this->m_eValue = effectcontainertypeTree; + break; + } + + return this->m_eValue; + } + + std::wstring CEffectContainerType::ToString () const + { + switch(this->m_eValue) + { + case effectcontainertypeSib: return (L"sib"); + case effectcontainertypeTree: return (L"tree"); + default : return (L"sib"); + } + } + + //-------------------------------------------------------------------------------- + // FixedAngle 20.1.10.23 (Part 1) + //-------------------------------------------------------------------------------- + + void CFixedAngle::SetValue(int nValue) + { + this->m_eValue = (std::min)( 5400000, (std::max)( -5400000, nValue ) ); + } + + int CFixedAngle::FromString(const std::wstring &sValue) + { + this->m_eValue = (std::min)( 5400000, (std::max)( -5400000, XmlUtils::GetInteger(sValue) ) ); + + return this->m_eValue; + } + + std::wstring CFixedAngle::ToString() const + { + std::wstring sResult = std::to_wstring( this->m_eValue ); + return sResult; + } + + double CFixedAngle::GetAngle() const + { + return this->m_eValue / 60000.0; + } + + //-------------------------------------------------------------------------------- + // FixedPercentage 20.1.10.24 (Part 1) + 12.1.2.1 (Part4) + //-------------------------------------------------------------------------------- + + CFixedPercentage::CFixedPercentage() + { + m_dValue = 0; + } + + double CFixedPercentage::GetValue() const + { + return m_dValue; + } + + void CFixedPercentage::SetValue(double dValue) + { + m_dValue = (std::min)( 100.0, (std::max)( -100.0, dValue ) ); + } + + double CFixedPercentage::FromString(const std::wstring &sValue) + { + int nPos = (int)sValue.find( '%' ); + int nLen = (int)sValue.length(); + if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) + { + if ( -1 == nPos && nLen > 0) + { + // Поправка 12.1.2.1 Part4 + int nValue = (std::min)( 100000, (std::max)( -100000, XmlUtils::GetInteger(sValue)) ); + m_dValue = nValue / 1000.0; + } + else + m_dValue = 0; + } + else + m_dValue = (std::min)( 100.0, (std::max)( -100.0, XmlUtils::GetDouble( sValue.substr( 0, nLen - 1 ) ) ) ); + + return m_dValue; + } + + std::wstring CFixedPercentage::ToString () const + { + return boost::lexical_cast(m_dValue) + L"%"; + } + + //-------------------------------------------------------------------------------- + // FontCollectionIndex 20.1.10.25 (Part 1) + //-------------------------------------------------------------------------------- + + EFontCollectionIndex CFontCollectionIndex::FromString(const std::wstring &sValue) + { + this->m_eValue = fontcollectionindexNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'm': + if ( (L"major") == sValue ) this->m_eValue = fontcollectionindexMajor; + else if ( (L"minor") == sValue ) this->m_eValue = fontcollectionindexMinor; + break; + case 'n': + if ( (L"none") == sValue ) this->m_eValue = fontcollectionindexNone; + break; + } + + return this->m_eValue; + } + + std::wstring CFontCollectionIndex::ToString () const + { + switch(this->m_eValue) + { + case fontcollectionindexMajor: return (L"major"); + case fontcollectionindexMinor: return (L"minor"); + case fontcollectionindexNone : return (L"none"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // FOVAngle 20.1.10.26 (Part 1) + //-------------------------------------------------------------------------------- + + void CFOVAngle::SetValue(int nValue) + { + this->m_eValue = (std::min)( 10800000, (std::max)( 0, nValue ) ); + } + + int CFOVAngle::FromString(const std::wstring &sValue) + { + this->m_eValue = (std::min)( 10800000, (std::max)( 0, XmlUtils::GetInteger(sValue) ) ); + + return this->m_eValue; + } + + std::wstring CFOVAngle::ToString() const + { + std::wstring sResult = std::to_wstring( this->m_eValue ); + return sResult; + } + + double CFOVAngle::GetAngle() const + { + return this->m_eValue / 60000.0; + } + + //-------------------------------------------------------------------------------- + // GeomGuideFormula 20.1.10.27 (Part 1) + //-------------------------------------------------------------------------------- + + CGeomGuideFormula::CGeomGuideFormula() {} + + std::wstring CGeomGuideFormula::GetValue() const + { + return m_sValue; + } + + void CGeomGuideFormula::SetValue(std::wstring &sValue) + { + m_sValue = sValue; + } + + + std::wstring CGeomGuideFormula::FromString(const std::wstring &sValue) + { + m_sValue = sValue; + + return m_sValue; + } + + std::wstring CGeomGuideFormula::ToString () const + { + return m_sValue; + } + + void CGeomGuideFormula::Parse() + { + // TO DO: Сделать разбор формул. См. стр.3244 Part1. + } + + //-------------------------------------------------------------------------------- + // GeomGuideName 20.1.10.28 (Part 1) + //-------------------------------------------------------------------------------- + + CGeomGuideName::CGeomGuideName() {} + + std::wstring CGeomGuideName::GetValue() const + { + return m_sValue; + } + + void CGeomGuideName::SetValue(std::wstring &sValue) + { + m_sValue = sValue; + } + + + std::wstring CGeomGuideName::FromString(const std::wstring &sValue) + { + m_sValue = sValue; + + return m_sValue; + } + + std::wstring CGeomGuideName::ToString () const + { + return m_sValue; + } + + //-------------------------------------------------------------------------------- + // LightRigDirection 20.1.10.29 (Part 1) + //-------------------------------------------------------------------------------- + + ELightRigDirection CLightRigDirection::FromString(const std::wstring &sValue) + { + this->m_eValue = lightrigdirectionTR; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( (L"b") == sValue ) this->m_eValue = lightrigdirectionB; + else if ( (L"bl") == sValue ) this->m_eValue = lightrigdirectionBL; + else if ( (L"br") == sValue ) this->m_eValue = lightrigdirectionBR; + break; + case 'l': + if ( (L"l") == sValue ) this->m_eValue = lightrigdirectionL; + break; + case 'r': + if ( (L"r") == sValue ) this->m_eValue = lightrigdirectionR; + break; + case 't': + if ( (L"t") == sValue ) this->m_eValue = lightrigdirectionT; + else if ( (L"tl") == sValue ) this->m_eValue = lightrigdirectionTL; + else if ( (L"tr") == sValue ) this->m_eValue = lightrigdirectionTR; + break; + } + + return this->m_eValue; + } + + std::wstring CLightRigDirection::ToString () const + { + switch(this->m_eValue) + { + case lightrigdirectionB: return (L"b"); + case lightrigdirectionBL: return (L"bl"); + case lightrigdirectionBR: return (L"br"); + case lightrigdirectionL: return (L"l"); + case lightrigdirectionR: return (L"r"); + case lightrigdirectionT: return (L"t"); + case lightrigdirectionTL: return (L"tl"); + case lightrigdirectionTR: return (L"tr"); + default : return (L"tr"); + } + } + + //-------------------------------------------------------------------------------- + // LightRigType 20.1.10.30 (Part 1) + //-------------------------------------------------------------------------------- + + ELightRigType CLightRigType::FromString(const std::wstring &sValue) + { + this->m_eValue = lightrigtypeBalanced; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( (L"balanced") == sValue ) this->m_eValue = lightrigtypeBalanced; + else if ( (L"brightRoom") == sValue ) this->m_eValue = lightrigtypeBrightRoom; + break; + case 'c': + if ( (L"chilly") == sValue ) this->m_eValue = lightrigtypeChilly; + else if ( (L"contrasting") == sValue ) this->m_eValue = lightrigtypeContrasting; + break; + case 'f': + if ( (L"flat") == sValue ) this->m_eValue = lightrigtypeFlat; + else if ( (L"flood") == sValue ) this->m_eValue = lightrigtypeFlood; + else if ( (L"freezing") == sValue ) this->m_eValue = lightrigtypeFreezing; + break; + case 'g': + if ( (L"glow") == sValue ) this->m_eValue = lightrigtypeGlow; + break; + case 'h': + if ( (L"harsh") == sValue ) this->m_eValue = lightrigtypeHarsh; + break; + case 'l': + if ( (L"legacyFlat1") == sValue ) this->m_eValue = lightrigtypeLegacyFlat1; + else if ( (L"legacyFlat2") == sValue ) this->m_eValue = lightrigtypeLegacyFlat2; + else if ( (L"legacyFlat3") == sValue ) this->m_eValue = lightrigtypeLegacyFlat3; + else if ( (L"legacyFlat4") == sValue ) this->m_eValue = lightrigtypeLegacyFlat4; + else if ( (L"legacyHarsh1") == sValue ) this->m_eValue = lightrigtypeLegacyHarsh1; + else if ( (L"legacyHarsh2") == sValue ) this->m_eValue = lightrigtypeLegacyHarsh2; + else if ( (L"legacyHarsh3") == sValue ) this->m_eValue = lightrigtypeLegacyHarsh3; + else if ( (L"legacyHarsh4") == sValue ) this->m_eValue = lightrigtypeLegacyHarsh4; + else if ( (L"legacyNormal1") == sValue ) this->m_eValue = lightrigtypeLegacyNormal1; + else if ( (L"legacyNormal2") == sValue ) this->m_eValue = lightrigtypeLegacyNormal2; + else if ( (L"legacyNormal3") == sValue ) this->m_eValue = lightrigtypeLegacyNormal3; + else if ( (L"legacyNormal4") == sValue ) this->m_eValue = lightrigtypeLegacyNormal4; + break; + case 'm': + if ( (L"morning") == sValue ) this->m_eValue = lightrigtypeMorning; + break; + case 's': + if ( (L"soft") == sValue ) this->m_eValue = lightrigtypeSoft; + else if ( (L"sunrise") == sValue ) this->m_eValue = lightrigtypeSunrise; + else if ( (L"sunset") == sValue ) this->m_eValue = lightrigtypeSunset; + break; + case 't': + if ( (L"threePt") == sValue ) this->m_eValue = lightrigtypeThreePt; + else if ( (L"twoPt") == sValue ) this->m_eValue = lightrigtypeTwoPt; + break; + } + + return this->m_eValue; + } + + std::wstring CLightRigType::ToString () const + { + switch(this->m_eValue) + { + case lightrigtypeBalanced : return (L"balanced"); + case lightrigtypeBrightRoom : return (L"brightRoom"); + case lightrigtypeChilly : return (L"chilly"); + case lightrigtypeContrasting : return (L"contrasting"); + case lightrigtypeFlat : return (L"flat"); + case lightrigtypeFlood : return (L"flood"); + case lightrigtypeFreezing : return (L"freezing"); + case lightrigtypeGlow : return (L"glow"); + case lightrigtypeHarsh : return (L"harsh"); + case lightrigtypeLegacyFlat1 : return (L"legacyFlat1"); + case lightrigtypeLegacyFlat2 : return (L"legacyFlat2"); + case lightrigtypeLegacyFlat3 : return (L"legacyFlat3"); + case lightrigtypeLegacyFlat4 : return (L"legacyFlat4"); + case lightrigtypeLegacyHarsh1 : return (L"legacyHarsh1"); + case lightrigtypeLegacyHarsh2 : return (L"legacyHarsh2"); + case lightrigtypeLegacyHarsh3 : return (L"legacyHarsh3"); + case lightrigtypeLegacyHarsh4 : return (L"legacyHarsh4"); + case lightrigtypeLegacyNormal1 : return (L"legacyNormal1"); + case lightrigtypeLegacyNormal2 : return (L"legacyNormal2"); + case lightrigtypeLegacyNormal3 : return (L"legacyNormal3"); + case lightrigtypeLegacyNormal4 : return (L"legacyNormal4"); + case lightrigtypeMorning : return (L"morning"); + case lightrigtypeSoft : return (L"soft"); + case lightrigtypeSunrise : return (L"sunrise"); + case lightrigtypeSunset : return (L"sunset"); + case lightrigtypeThreePt : return (L"threePt"); + case lightrigtypeTwoPt : return (L"twoPt"); + default : return (L"balanced"); + } + } + + //-------------------------------------------------------------------------------- + // LineCap 20.1.10.31 (Part 1) + //-------------------------------------------------------------------------------- + + ELineCap CLineCap::FromString(const std::wstring &sValue) + { + this->m_eValue = linecapRnd; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'f': + if ( (L"flat") == sValue ) this->m_eValue = linecapFlat; + break; + case 'r': + if ( (L"rnd") == sValue ) this->m_eValue = linecapRnd; + break; + case 's': + if ( (L"sq") == sValue ) this->m_eValue = linecapSq; + break; + } + + return this->m_eValue; + } + + std::wstring CLineCap::ToString () const + { + switch(this->m_eValue) + { + case linecapFlat: return (L"flat"); + case linecapRnd: return (L"rnd"); + case linecapSq: return (L"sq"); + default : return (L"rnd"); + } + } + + //-------------------------------------------------------------------------------- + // LineEndLength 20.1.10.32 (Part 1) + //-------------------------------------------------------------------------------- + + ELineEndLength CLineEndLength::FromString(const std::wstring &sValue) + { + this->m_eValue = lineendlengthMedium; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'l': + if ( (L"lg") == sValue ) this->m_eValue = lineendlengthLarge; + break; + case 'm': + if ( (L"med") == sValue ) this->m_eValue = lineendlengthMedium; + break; + case 's': + if ( (L"sm") == sValue ) this->m_eValue = lineendlengthSmall; + break; + } + + return this->m_eValue; + } + + std::wstring CLineEndLength::ToString () const + { + switch(this->m_eValue) + { + case lineendlengthLarge: return (L"lg"); + case lineendlengthMedium: return (L"med"); + case lineendlengthSmall: return (L"sm"); + default : return (L"med"); + } + } + + //-------------------------------------------------------------------------------- + // LineEndType 20.1.10.33 (Part 1) + //-------------------------------------------------------------------------------- + + ELineEndType CLineEndType::FromString(const std::wstring &sValue) + { + this->m_eValue = lineendtypeNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( (L"arrow") == sValue ) this->m_eValue = lineendtypeArrow; + break; + case 'd': + if ( (L"diamond") == sValue ) this->m_eValue = lineendtypeDiamond; + break; + case 'n': + if ( (L"none") == sValue ) this->m_eValue = lineendtypeNone; + break; + case 'o': + if ( (L"oval") == sValue ) this->m_eValue = lineendtypeOval; + break; + case 's': + if ( (L"stealth") == sValue ) this->m_eValue = lineendtypeStealth; + break; + case 't': + if ( (L"triangle") == sValue ) this->m_eValue = lineendtypeTriangle; + break; + } + + return this->m_eValue; + } + + std::wstring CLineEndType::ToString () const + { + switch(this->m_eValue) + { + case lineendtypeArrow: return (L"arrow"); + case lineendtypeDiamond: return (L"diamond"); + case lineendtypeNone: return (L"none"); + case lineendtypeOval: return (L"oval"); + case lineendtypeStealth: return (L"stealth"); + case lineendtypeTriangle: return (L"triangle"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // LineEndWidth 20.1.10.34 (Part 1) + //-------------------------------------------------------------------------------- + + ELineEndWidth CLineEndWidth::FromString(const std::wstring &sValue) + { + this->m_eValue = lineendwidthMedium; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'l': + if ( (L"lg") == sValue ) this->m_eValue = lineendwidthLarge; + break; + case 'm': + if ( (L"med") == sValue ) this->m_eValue = lineendwidthMedium; + break; + case 's': + if ( (L"sm") == sValue ) this->m_eValue = lineendwidthSmall; + break; + } + + return this->m_eValue; + } + + std::wstring CLineEndWidth::ToString () const + { + switch(this->m_eValue) + { + case lineendwidthLarge: return (L"lg"); + case lineendwidthMedium: return (L"med"); + case lineendwidthSmall: return (L"sm"); + default : return (L"med"); + } + } + + //-------------------------------------------------------------------------------- + // LineWidth 20.1.10.35 (Part 1) + //-------------------------------------------------------------------------------- + + __int64 CLineWidth::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger64( sValue ); + if (this->m_eValue < 0) + this->m_eValue = 0; + if (this->m_eValue > 20116800) + this->m_eValue = 20116800; + + return this->m_eValue; + } + + std::wstring CLineWidth::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + double CLineWidth::ToPoints() + { + return Emu_To_Pt( (double)this->m_eValue ); + } + + double CLineWidth::ToInches() + { + return Emu_To_Inch( (double)this->m_eValue ); + } + + double CLineWidth::FromEmu(const __int64 nEmu) + { + this->m_eValue = nEmu; + return Emu_To_Pt( (double)this->m_eValue ); + } + + //-------------------------------------------------------------------------------- + // PathFillMode 20.1.10.37 (Part 1) + //-------------------------------------------------------------------------------- + + EPathFillMode CPathFillMode::FromString(const std::wstring &sValue) + { + this->m_eValue = pathfillmodeNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'd': + if ( (L"darken") == sValue ) this->m_eValue = pathfillmodeDarken; + else if ( (L"darkenLess") == sValue ) this->m_eValue = pathfillmodeDarkenLess; + break; + case 'l': + if ( (L"lighten") == sValue ) this->m_eValue = pathfillmodeLighten; + else if ( (L"darkenLess") == sValue ) this->m_eValue = pathfillmodeLightenLess; + break; + case 'n': + if ( (L"none") == sValue ) this->m_eValue = pathfillmodeNone; + else if ( (L"norm") == sValue ) this->m_eValue = pathfillmodeNorm; + break; + } + + return this->m_eValue; + } + + std::wstring CPathFillMode::ToString () const + { + switch(this->m_eValue) + { + case pathfillmodeDarken: return (L"darken"); + case pathfillmodeDarkenLess: return (L"darkenLess"); + case pathfillmodeLighten: return (L"lighten"); + case pathfillmodeLightenLess: return (L"lightenLess"); + case pathfillmodeNone: return (L"none"); + case pathfillmodeNorm: return (L"norm"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // PathShadeType 20.1.10.38 (Part 1) + //-------------------------------------------------------------------------------- + + EPathShadeType CPathShadeType::FromString(const std::wstring &sValue) + { + this->m_eValue = pathshadetypeRect; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( (L"circle") == sValue ) this->m_eValue = pathshadetypeCircle; + break; + case 'r': + if ( (L"rect") == sValue ) this->m_eValue = pathshadetypeRect; + break; + case 's': + if ( (L"shape") == sValue ) this->m_eValue = pathshadetypeShape; + break; + } + + return this->m_eValue; + } + + std::wstring CPathShadeType::ToString () const + { + switch(this->m_eValue) + { + case pathshadetypeCircle: return (L"circle"); + case pathshadetypeRect: return (L"rect"); + case pathshadetypeShape: return (L"shape"); + default : return (L"rect"); + } + } + + //-------------------------------------------------------------------------------- + // PenAlignment 20.1.10.39 (Part 1) + //-------------------------------------------------------------------------------- + + EPenAlignment CPenAlignment::FromString(const std::wstring &sValue) + { + this->m_eValue = penalignmentCtr; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( (L"ctr") == sValue ) this->m_eValue = penalignmentCtr; + break; + case 'i': + if ( (L"in") == sValue ) this->m_eValue = penalignmentIn; + break; + } + + return this->m_eValue; + } + + std::wstring CPenAlignment::ToString () const + { + switch(this->m_eValue) + { + case penalignmentCtr: return (L"ctr"); + case penalignmentIn: return (L"in"); + default : return (L"ctr"); + } + } + + //-------------------------------------------------------------------------------- + // Percentage 20.1.10.40 (Part 1) + 12.1.2.2 (Part4) + //-------------------------------------------------------------------------------- + + CPercentage::CPercentage() + { + m_dValue = 0; + } + + double CPercentage::GetValue() const + { + return m_dValue; + } + + void CPercentage::SetValue(double dValue) + { + m_dValue = dValue; + } + + double CPercentage::FromString(const std::wstring &sValue) + { + //todo странно что если пришло значение от 0 до 1, то m_dValue от 0 до 1. В других случаях от 0 до 100 + int nPos = (int)sValue.find( '%' ); + int nLen = (int)sValue.length(); + if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) + { + if ( -1 == nPos ) + { + //test + double dValue = XmlUtils::GetDouble(sValue); + if (fabs(dValue) >= 0 && fabs(dValue) <=1 ) + { + m_dValue = dValue; + } + else + { + // Поправка 12.1.2.2 (Part4) + m_dValue = dValue / 1000.0; + } + } + else + m_dValue = 0; + } + else + { + std::wstring strValue = sValue.substr( 0, nLen - 1 ); + m_dValue = XmlUtils::GetDouble( strValue ); + } + + return m_dValue; + } + + std::wstring CPercentage::ToString () const + { + return boost::lexical_cast(m_dValue) + L"%"; + } + std::wstring CPercentage::ToStringDecimalNumber () const + { + std::wstring sResult = std::to_wstring( int(m_dValue * 1000.0) ); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // PositiveCoordinate 20.1.10.42 (Part 1) + //-------------------------------------------------------------------------------- + + __int64 CPositiveCoordinate::FromString(const std::wstring &sValue) + { + this->m_eValue = sValue.empty() ? 0 : XmlUtils::GetInteger64( sValue ); + + if (this->m_eValue < 0) + this->m_eValue = 0; + if (this->m_eValue > 27273042316900) + this->m_eValue = 27273042316900; + + return this->m_eValue; + } + + std::wstring CPositiveCoordinate::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + double CPositiveCoordinate::ToPoints() const + { + return Emu_To_Pt( (double)this->m_eValue ); + } + + double CPositiveCoordinate::ToMM() const + { + return Emu_To_Mm( (double)this->m_eValue ); + } + + double CPositiveCoordinate::ToInches() + { + return Emu_To_Inch( (double)this->m_eValue ); + } + + double CPositiveCoordinate::ToTwips() + { + return Emu_To_Twips( (double)this->m_eValue ); + } + + double CPositiveCoordinate::FromEmu(const __int64& nEmu) + { + this->m_eValue = nEmu; + return Emu_To_Pt( (double)this->m_eValue ); + } + + //-------------------------------------------------------------------------------- + // PositiveCoordinate32 20.1.10.43 (Part 1) + //-------------------------------------------------------------------------------- + + //-------------------------------------------------------------------------------- + // PositiveFixedAngle 20.1.10.44 (Part 1) + //-------------------------------------------------------------------------------- + + void CPositiveFixedAngle::SetValue(int nValue) + { + this->m_eValue = (std::min)( 21600000, (std::max)( 0, nValue ) ); + } + + int CPositiveFixedAngle::FromString(const std::wstring &sValue) + { + this->m_eValue = (std::min)( 21600000, (std::max)( 0, XmlUtils::GetInteger(sValue) ) ); + + return this->m_eValue; + } + + std::wstring CPositiveFixedAngle::ToString() const + { + std::wstring sResult = std::to_wstring( this->m_eValue ); + return sResult; + } + + double CPositiveFixedAngle::GetAngle() const + { + return this->m_eValue / 60000.0; + } + + //-------------------------------------------------------------------------------- + // PositiveFixedPercentage 20.1.10.45 (Part 1) + 12.1.2.3 (Part4) + //-------------------------------------------------------------------------------- + + CPositiveFixedPercentage::CPositiveFixedPercentage() {} + + double CPositiveFixedPercentage::GetValue() const + { + return m_dValue; + } + + void CPositiveFixedPercentage::SetValue(double dValue) + { + m_dValue = (std::min)( 100.0, (std::max)( 0.0, dValue ) ); + } + + double CPositiveFixedPercentage::FromString(const std::wstring &sValue) + { + int nPos = (int)sValue.find( '%' ); + int nLen = (int)sValue.length(); + if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) + { + if ( -1 == nPos && nLen > 0) + { + // Поправка 12.1.2.3 (Part4) + int nValue = (std::max)( 0, (std::min)( 100000, XmlUtils::GetInteger(sValue) ) ); + m_dValue = nValue / 1000.0; + } + else + m_dValue = 0; + } + else + m_dValue = (std::min)( 100.0, (std::max)( 0.0, XmlUtils::GetDouble( sValue.substr( 0, nLen - 1 )) ) ); + + return m_dValue; + } + + std::wstring CPositiveFixedPercentage::ToString () const + { + return boost::lexical_cast(m_dValue) + L"%"; + } + + //-------------------------------------------------------------------------------- + // PositivePercentage 20.1.10.46 (Part 1) + 12.1.2.4 (Part4) + //-------------------------------------------------------------------------------- + + CPositivePercentage::CPositivePercentage() {} + + double CPositivePercentage::GetValue() const + { + return m_dValue; + } + + void CPositivePercentage::SetValue(double dValue) + { + m_dValue = (std::max)( 0.0, dValue ); + } + + double CPositivePercentage::FromString(const std::wstring &sValue) + { + int nPos = (int)sValue.find( '%' ); + int nLen = (int)sValue.length(); + if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) + { + if ( -1 == nPos && nLen > 0) + { + // Поправка 12.1.2.4 (Part4) + int nValue = (std::max)( 0, XmlUtils::GetInteger(sValue) ); + m_dValue = nValue / 1000.0; + } + return + m_dValue; + } + else + m_dValue = (std::max)( 0.0, XmlUtils::GetDouble( sValue.substr( 0, nLen - 1 ) ) ); + + return m_dValue; + } + + std::wstring CPositivePercentage::ToString () const + { + return boost::lexical_cast(m_dValue) + L"%"; + } + + //-------------------------------------------------------------------------------- + // PresetCameraType 20.1.10.47 (Part 1) + //-------------------------------------------------------------------------------- + + EPresetCameraType CPresetCameraType::FromString(const std::wstring &sValue) + { + this->m_eValue = presetcameratypePerspectiveFront; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'i': + if ( (L"isometricBottomDown") == sValue ) this->m_eValue = presetcameratypeIsometricBottomDown; + else if ( (L"isometricBottomUp") == sValue ) this->m_eValue = presetcameratypeIsometricBottomUp; + else if ( (L"isometricLeftDown") == sValue ) this->m_eValue = presetcameratypeIsometricLeftDown; + else if ( (L"isometricLeftUp") == sValue ) this->m_eValue = presetcameratypeIsometricLeftUp; + else if ( (L"isometricOffAxis1Left") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis1Left; + else if ( (L"isometricOffAxis1Right") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis1Right; + else if ( (L"isometricOffAxis1Top") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis1Top; + else if ( (L"isometricOffAxis2Left") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis2Left; + else if ( (L"isometricOffAxis2Right") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis2Right; + else if ( (L"isometricOffAxis2Top") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis2Top; + else if ( (L"isometricOffAxis3Bottom") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis3Bottom ; + else if ( (L"isometricOffAxis3Left") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis3Left; + else if ( (L"isometricOffAxis3Right") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis3Right; + else if ( (L"isometricOffAxis4Bottom") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis4Bottom; + else if ( (L"isometricOffAxis4Left") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis4Left; + else if ( (L"isometricOffAxis4Right") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis4Right; + else if ( (L"isometricRightDown") == sValue ) this->m_eValue = presetcameratypeIsometricRightDown; + else if ( (L"isometricRightUp") == sValue ) this->m_eValue = presetcameratypeIsometricRightUp; + else if ( (L"isometricTopDown") == sValue ) this->m_eValue = presetcameratypeIsometricTopDown; + else if ( (L"isometricTopUp") == sValue ) this->m_eValue = presetcameratypeIsometricTopUp; + break; + case 'l': + if ( (L"legacyObliqueBottom") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueBottom; + else if ( (L"legacyObliqueBottomLeft") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueBottomLeft; + else if ( (L"legacyObliqueBottomRight") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueBottomRight; + else if ( (L"legacyObliqueFront") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueFront; + else if ( (L"legacyObliqueLeft") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueLeft; + else if ( (L"legacyObliqueRight") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueRight; + else if ( (L"legacyObliqueTop") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueTop; + else if ( (L"legacyObliqueTopLeft") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueTopLeft; + else if ( (L"legacyObliqueTopRight") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueTopRight; + else if ( (L"legacyPerspectiveBottom") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveBottom; + else if ( (L"legacyPerspectiveBottomLeft") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveBottomLeft; + else if ( (L"legacyPerspectiveBottomRight") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveBottomRight; + else if ( (L"legacyPerspectiveFront") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveFront; + else if ( (L"legacyPerspectiveLeft") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveLeft; + else if ( (L"legacyPerspectiveRight") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveRight; + else if ( (L"legacyPerspectiveTop") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveTop; + else if ( (L"legacyPerspectiveTopLeft") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveTopLeft; + else if ( (L"legacyPerspectiveTopRight") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveTopRight; + break; + case 'o': + if ( (L"obliqueBottom") == sValue ) this->m_eValue = presetcameratypeObliqueBottom; + else if ( (L"obliqueBottomLeft") == sValue ) this->m_eValue = presetcameratypeObliqueBottomLeft; + else if ( (L"obliqueBottomRight") == sValue ) this->m_eValue = presetcameratypeObliqueBottomRight; + else if ( (L"obliqueLeft") == sValue ) this->m_eValue = presetcameratypeObliqueLeft; + else if ( (L"obliqueRight") == sValue ) this->m_eValue = presetcameratypeObliqueRight; + else if ( (L"obliqueTop") == sValue ) this->m_eValue = presetcameratypeObliqueTop; + else if ( (L"obliqueTopLeft") == sValue ) this->m_eValue = presetcameratypeObliqueTopLeft; + else if ( (L"obliqueTopRight") == sValue ) this->m_eValue = presetcameratypeObliqueTopRight; + else if ( (L"orthographicFront") == sValue ) this->m_eValue = presetcameratypeOrthographicFront; + break; + case 'p': + if ( (L"perspectiveAbove") == sValue ) this->m_eValue = presetcameratypePerspectiveAbove; + else if ( (L"perspectiveAboveLeftFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveAboveLeftFacing; + else if ( (L"perspectiveAboveRightFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveAboveRightFacing; + else if ( (L"perspectiveBelow") == sValue ) this->m_eValue = presetcameratypePerspectiveBelow; + else if ( (L"perspectiveContrastingLeftFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveContrastingLeftFacing; + else if ( (L"perspectiveContrastingRightFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveContrastingRightFacing; + else if ( (L"perspectiveFront") == sValue ) this->m_eValue = presetcameratypePerspectiveFront; + else if ( (L"perspectiveHeroicExtremeLeftFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveHeroicExtremeLeftFacing; + else if ( (L"perspectiveHeroicExtremeRightFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveHeroicExtremeRightFacing; + else if ( (L"perspectiveHeroicLeftFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveHeroicLeftFacing; + else if ( (L"perspectiveHeroicRightFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveHeroicRightFacing; + else if ( (L"perspectiveLeft") == sValue ) this->m_eValue = presetcameratypePerspectiveLeft; + else if ( (L"perspectiveRelaxed") == sValue ) this->m_eValue = presetcameratypePerspectiveRelaxed; + else if ( (L"perspectiveRelaxedModerately") == sValue ) this->m_eValue = presetcameratypePerspectiveRelaxedModerately; + else if ( (L"perspectiveRight") == sValue ) this->m_eValue = presetcameratypePerspectiveRight; + break; + } + + return this->m_eValue; + } + + std::wstring CPresetCameraType::ToString () const + { + switch(this->m_eValue) + { + case presetcameratypeIsometricBottomDown: return (L"isometricBottomDown"); // (Isometric Bottom Down) + case presetcameratypeIsometricBottomUp: return (L"isometricBottomUp"); // (Isometric Bottom Up) + case presetcameratypeIsometricLeftDown: return (L"isometricLeftDown"); // (Isometric Left Down) + case presetcameratypeIsometricLeftUp: return (L"isometricLeftUp"); // (Isometric Left Up) + case presetcameratypeIsometricOffAxis1Left: return (L"isometricOffAxis1Left"); // (Isometric Off Axis 1 Left) + case presetcameratypeIsometricOffAxis1Right: return (L"isometricOffAxis1Right"); // (Isometric Off Axis 1 Right) + case presetcameratypeIsometricOffAxis1Top: return (L"isometricOffAxis1Top"); // (Isometric Off Axis 1 Top) + case presetcameratypeIsometricOffAxis2Left: return (L"isometricOffAxis2Left"); // (Isometric Off Axis 2 Left) + case presetcameratypeIsometricOffAxis2Right: return (L"isometricOffAxis2Right"); // (Isometric Off Axis 2 Right + case presetcameratypeIsometricOffAxis2Top: return (L"isometricOffAxis2Top"); // (Isometric Off Axis 2 Top) + case presetcameratypeIsometricOffAxis3Bottom: return (L"isometricOffAxis3Bottom"); // (Isometric Off Axis 3 Bottom) + case presetcameratypeIsometricOffAxis3Left: return (L"isometricOffAxis3Left"); // (Isometric Off Axis 3 Left) + case presetcameratypeIsometricOffAxis3Right: return (L"isometricOffAxis3Right"); // (Isometric Off Axis 3 Right) + case presetcameratypeIsometricOffAxis4Bottom: return (L"isometricOffAxis4Bottom"); // (Isometric Off Axis 4 Bottom) + case presetcameratypeIsometricOffAxis4Left: return (L"isometricOffAxis4Left"); // (Isometric Off Axis 4 Left) + case presetcameratypeIsometricOffAxis4Right: return (L"isometricOffAxis4Right"); // (Isometric Off Axis 4 Right) + case presetcameratypeIsometricRightDown: return (L"isometricRightDown"); // (Isometric Right Down) + case presetcameratypeIsometricRightUp: return (L"isometricRightUp"); // (Isometric Right Up) + case presetcameratypeIsometricTopDown: return (L"isometricTopDown"); // (Isometric Top Down) + case presetcameratypeIsometricTopUp: return (L"isometricTopUp"); // (Isometric Top Up) + case presetcameratypeLegacyObliqueBottom: return (L"legacyObliqueBottom"); // (Legacy Oblique Bottom) + case presetcameratypeLegacyObliqueBottomLeft: return (L"legacyObliqueBottomLeft"); // (Legacy Oblique Bottom Left) + case presetcameratypeLegacyObliqueBottomRight: return (L"legacyObliqueBottomRight"); // (Legacy Oblique Bottom Right) + case presetcameratypeLegacyObliqueFront: return (L"legacyObliqueFront"); // (Legacy Oblique Front) + case presetcameratypeLegacyObliqueLeft: return (L"legacyObliqueLeft"); // (Legacy Oblique Left) + case presetcameratypeLegacyObliqueRight: return (L"legacyObliqueRight"); // (Legacy Oblique Right) + case presetcameratypeLegacyObliqueTop: return (L"legacyObliqueTop"); // (Legacy Oblique Top) + case presetcameratypeLegacyObliqueTopLeft: return (L"legacyObliqueTopLeft"); // (Legacy Oblique Top Left) + case presetcameratypeLegacyObliqueTopRight: return (L"legacyObliqueTopRight"); // (Legacy Oblique Top Right) + case presetcameratypeLegacyPerspectiveBottom: return (L"legacyPerspectiveBottom"); // (Legacy Perspective Bottom) + case presetcameratypeLegacyPerspectiveBottomLeft: return (L"legacyPerspectiveBottomLeft"); // (Legacy Perspective Bottom Left) + case presetcameratypeLegacyPerspectiveBottomRight: return (L"legacyPerspectiveBottomRight"); // (Legacy Perspective Bottom Right) + case presetcameratypeLegacyPerspectiveFront: return (L"legacyPerspectiveFront"); // (Legacy Perspective Front) + case presetcameratypeLegacyPerspectiveLeft: return (L"legacyPerspectiveLeft"); // (Legacy Perspective Left) + case presetcameratypeLegacyPerspectiveRight: return (L"legacyPerspectiveRight"); // (Legacy Perspective Right) + case presetcameratypeLegacyPerspectiveTop: return (L"legacyPerspectiveTop"); // (Legacy Perspective Top) + case presetcameratypeLegacyPerspectiveTopLeft: return (L"legacyPerspectiveTopLeft"); // (Legacy Perspective Top Left) + case presetcameratypeLegacyPerspectiveTopRight: return (L"legacyPerspectiveTopRight"); // (Legacy Perspective Top Right) + case presetcameratypeObliqueBottom: return (L"obliqueBottom"); // (Oblique Bottom) + case presetcameratypeObliqueBottomLeft: return (L"obliqueBottomLeft"); // (Oblique Bottom Left) + case presetcameratypeObliqueBottomRight: return (L"obliqueBottomRight"); // (Oblique Bottom Right) + case presetcameratypeObliqueLeft: return (L"obliqueLeft"); // (Oblique Left) + case presetcameratypeObliqueRight: return (L"obliqueRight"); // (Oblique Right) + case presetcameratypeObliqueTop: return (L"obliqueTop"); // (Oblique Top) + case presetcameratypeObliqueTopLeft: return (L"obliqueTopLeft"); // (Oblique Top Left) + case presetcameratypeObliqueTopRight: return (L"obliqueTopRight"); // (Oblique Top Right) + case presetcameratypeOrthographicFront: return (L"orthographicFront"); // (Orthographic Front) + case presetcameratypePerspectiveAbove: return (L"perspectiveAbove"); // (Orthographic Above) + case presetcameratypePerspectiveAboveLeftFacing: return (L"perspectiveAboveLeftFacing"); // (Perspective Above Left Facing) + case presetcameratypePerspectiveAboveRightFacing: return (L"perspectiveAboveRightFacing"); // (Perspective Above Right Facing) + case presetcameratypePerspectiveBelow: return (L"perspectiveBelow"); // (Perspective Below) + case presetcameratypePerspectiveContrastingLeftFacing: return (L"perspectiveContrastingLeftFacing"); // (Perspective Contrasting Left Facing) + case presetcameratypePerspectiveContrastingRightFacing: return (L"perspectiveContrastingRightFacing"); // (Perspective Contrasting Right Facing) + case presetcameratypePerspectiveFront: return (L"perspectiveFront"); // (Perspective Front) + case presetcameratypePerspectiveHeroicExtremeLeftFacing: return (L"perspectiveHeroicExtremeLeftFacing"); // (Perspective Heroic Extreme Left Facing) + case presetcameratypePerspectiveHeroicExtremeRightFacing: return (L"perspectiveHeroicExtremeRightFacing"); // (Perspective Heroic Extreme Right Facing) + case presetcameratypePerspectiveHeroicLeftFacing: return (L"perspectiveHeroicLeftFacing"); // (Perspective Heroic Left Facing) + case presetcameratypePerspectiveHeroicRightFacing: return (L"perspectiveHeroicRightFacing"); // (Perspective Heroic Right Facing) + case presetcameratypePerspectiveLeft: return (L"perspectiveLeft"); // (Perspective Left) + case presetcameratypePerspectiveRelaxed: return (L"perspectiveRelaxed"); // (Perspective Relaxed) + case presetcameratypePerspectiveRelaxedModerately: return (L"perspectiveRelaxedModerately"); // (Perspective Relaxed Moderately) + case presetcameratypePerspectiveRight: return (L"perspectiveRight"); // (Perspective Right) + default : return (L"orthographicFront"); + } + } + + //-------------------------------------------------------------------------------- + // PresetColorVal 20.1.10.48 (Part 1) + //-------------------------------------------------------------------------------- + + void CPresetColorVal::SetRGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA) + { + m_unR = unR; + m_unG = unG; + m_unB = unB; + m_unA = unA; + } + + EPresetColorVal CPresetColorVal::FromString(const std::wstring &sValue) + { + this->m_eValue = presetcolorvalBlack; + SetRGBA( 0, 0, 0, 255 ); + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( (L"aliceBlue") == sValue ) { this->m_eValue = presetcolorvalAliceBlue; SetRGBA(240,248,255); } + else if ( (L"antiqueWhite") == sValue ) { this->m_eValue = presetcolorvalAntiqueWhite; SetRGBA(250,235,215); } + else if ( (L"aqua") == sValue ) { this->m_eValue = presetcolorvalAqua; SetRGBA(0,255,255); } + else if ( (L"aquamarine") == sValue ) { this->m_eValue = presetcolorvalAquamarine; SetRGBA(127,255,212); } + else if ( (L"azure") == sValue ) { this->m_eValue = presetcolorvalAzure; SetRGBA(240,255,255); } + break; + case 'b': + if ( (L"beige") == sValue ) { this->m_eValue = presetcolorvalBeige; SetRGBA(245,245,220); } + else if ( (L"bisque") == sValue ) { this->m_eValue = presetcolorvalBisque ; SetRGBA(255,228,196); } + else if ( (L"black") == sValue ) { this->m_eValue = presetcolorvalBlack ; SetRGBA(0,0,0); } + else if ( (L"blanchedAlmond") == sValue ) { this->m_eValue = presetcolorvalBlanchedAlmond ; SetRGBA(255,235,205); } + else if ( (L"blue") == sValue ) { this->m_eValue = presetcolorvalBlue ; SetRGBA(0,0,255); } + else if ( (L"blueViolet") == sValue ) { this->m_eValue = presetcolorvalBlueViolet ; SetRGBA(138,43,226); } + else if ( (L"brown") == sValue ) { this->m_eValue = presetcolorvalBrown ; SetRGBA(165,42,42); } + else if ( (L"burlyWood") == sValue ) { this->m_eValue = presetcolorvalBurlyWood ; SetRGBA(222,184,135); } + break; + case 'c': + if ( (L"cadetBlue") == sValue ) { this->m_eValue = presetcolorvalCadetBlue ; SetRGBA(95,158,160); } + else if ( (L"chartreuse") == sValue ) { this->m_eValue = presetcolorvalChartreuse ; SetRGBA(127,255,0); } + else if ( (L"chocolate") == sValue ) { this->m_eValue = presetcolorvalChocolate ; SetRGBA(210,105,30); } + else if ( (L"coral") == sValue ) { this->m_eValue = presetcolorvalCoral ; SetRGBA(255,127,80); } + else if ( (L"cornflowerBlue") == sValue ) { this->m_eValue = presetcolorvalCornflowerBlue ; SetRGBA(100,149,237); } + else if ( (L"cornsilk") == sValue ) { this->m_eValue = presetcolorvalCornsilk ; SetRGBA(255,248,220); } + else if ( (L"crimson") == sValue ) { this->m_eValue = presetcolorvalCrimson ; SetRGBA(220,20,60); } + else if ( (L"cyan") == sValue ) { this->m_eValue = presetcolorvalCyan ; SetRGBA(0,255,255); } + break; + case 'd': + if ( (L"darkBlue") == sValue ) { this->m_eValue = presetcolorvalDarkBlue ; SetRGBA(0,0,139); } + else if ( (L"darkCyan") == sValue ) { this->m_eValue = presetcolorvalDarkCyan ; SetRGBA(0,139,139); } + else if ( (L"darkGoldenrod") == sValue ) { this->m_eValue = presetcolorvalDarkGoldenrod ; SetRGBA(184,134,11); } + else if ( (L"darkGray") == sValue ) { this->m_eValue = presetcolorvalDarkGray ; SetRGBA(169,169,169); } + else if ( (L"darkGreen") == sValue ) { this->m_eValue = presetcolorvalDarkGreen ; SetRGBA(0,100,0); } + else if ( (L"darkGrey") == sValue ) { this->m_eValue = presetcolorvalDarkGrey ; SetRGBA(169,169,169); } + else if ( (L"darkKhaki") == sValue ) { this->m_eValue = presetcolorvalDarkKhaki ; SetRGBA(189,183,107); } + else if ( (L"darkMagenta") == sValue ) { this->m_eValue = presetcolorvalDarkMagenta ; SetRGBA(139,0,139); } + else if ( (L"darkOliveGreen") == sValue ) { this->m_eValue = presetcolorvalDarkOliveGreen ; SetRGBA(85,107,47); } + else if ( (L"darkOrange") == sValue ) { this->m_eValue = presetcolorvalDarkOrange ; SetRGBA(255,140,0); } + else if ( (L"darkOrchid") == sValue ) { this->m_eValue = presetcolorvalDarkOrchid ; SetRGBA(153,50,204); } + else if ( (L"darkRed") == sValue ) { this->m_eValue = presetcolorvalDarkRed ; SetRGBA(139,0,0); } + else if ( (L"darkSalmon") == sValue ) { this->m_eValue = presetcolorvalDarkSalmon ; SetRGBA(233,150,122); } + else if ( (L"darkSeaGreen") == sValue ) { this->m_eValue = presetcolorvalDarkSeaGreen ; SetRGBA(143,188,143); } + else if ( (L"darkSlateBlue") == sValue ) { this->m_eValue = presetcolorvalDarkSlateBlue ; SetRGBA(72,61,139); } + else if ( (L"darkSlateGray") == sValue ) { this->m_eValue = presetcolorvalDarkSlateGray ; SetRGBA(47,79,79); } + else if ( (L"darkSlateGrey") == sValue ) { this->m_eValue = presetcolorvalDarkSlateGrey ; SetRGBA(47,79,79); } + else if ( (L"darkTurquoise") == sValue ) { this->m_eValue = presetcolorvalDarkTurquoise ; SetRGBA(0,206,209); } + else if ( (L"darkViolet") == sValue ) { this->m_eValue = presetcolorvalDarkViolet ; SetRGBA(148,0,211); } + else if ( (L"deepPink") == sValue ) { this->m_eValue = presetcolorvalDeepPink ; SetRGBA(255,20,147); } + else if ( (L"deepSkyBlue") == sValue ) { this->m_eValue = presetcolorvalDeepSkyBlue ; SetRGBA(0,191,255); } + else if ( (L"dimGray") == sValue ) { this->m_eValue = presetcolorvalDimGray ; SetRGBA(105,105,105); } + else if ( (L"dimGrey") == sValue ) { this->m_eValue = presetcolorvalDimGrey ; SetRGBA(105,105,105); } + else if ( (L"dkBlue") == sValue ) { this->m_eValue = presetcolorvalDkBlue ; SetRGBA(0,0,139); } + else if ( (L"dkCyan") == sValue ) { this->m_eValue = presetcolorvalDkCyan ; SetRGBA(0,139,139); } + else if ( (L"dkGoldenrod") == sValue ) { this->m_eValue = presetcolorvalDkGoldenrod ; SetRGBA(184,134,11); } + else if ( (L"dkGray") == sValue ) { this->m_eValue = presetcolorvalDkGray ; SetRGBA(169,169,169); } + else if ( (L"dkGreen") == sValue ) { this->m_eValue = presetcolorvalDkGreen ; SetRGBA(0,100,0); } + else if ( (L"dkGrey") == sValue ) { this->m_eValue = presetcolorvalDkGrey ; SetRGBA(169,169,169); } + else if ( (L"dkKhaki") == sValue ) { this->m_eValue = presetcolorvalDkKhaki ; SetRGBA(189,183,107); } + else if ( (L"dkMagenta") == sValue ) { this->m_eValue = presetcolorvalDkMagenta ; SetRGBA(139,0,139); } + else if ( (L"dkOliveGreen") == sValue ) { this->m_eValue = presetcolorvalDkOliveGreen ; SetRGBA(85,107,47); } + else if ( (L"dkOrange") == sValue ) { this->m_eValue = presetcolorvalDkOrange ; SetRGBA(255,140,0); } + else if ( (L"dkOrchid") == sValue ) { this->m_eValue = presetcolorvalDkOrchid ; SetRGBA(153,50,204); } + else if ( (L"dkRed") == sValue ) { this->m_eValue = presetcolorvalDkRed ; SetRGBA(139,0,0); } + else if ( (L"dkSalmon") == sValue ) { this->m_eValue = presetcolorvalDkSalmon ; SetRGBA(233,150,122); } + else if ( (L"dkSeaGreen") == sValue ) { this->m_eValue = presetcolorvalDkSeaGreen ; SetRGBA(143,188,139); } + else if ( (L"dkSlateBlue") == sValue ) { this->m_eValue = presetcolorvalDkSlateBlue ; SetRGBA(72,61,139); } + else if ( (L"dkSlateGray") == sValue ) { this->m_eValue = presetcolorvalDkSlateGray ; SetRGBA(47,79,79); } + else if ( (L"dkSlateGrey") == sValue ) { this->m_eValue = presetcolorvalDkSlateGrey ; SetRGBA(47,79,79); } + else if ( (L"dkTurquoise") == sValue ) { this->m_eValue = presetcolorvalDkTurquoise ; SetRGBA(0,206,209); } + else if ( (L"dkViolet") == sValue ) { this->m_eValue = presetcolorvalDkViolet ; SetRGBA(148,0,211); } + else if ( (L"dodgerBlue") == sValue ) { this->m_eValue = presetcolorvalDodgerBlue ; SetRGBA(30,144,255); } + break; + case 'f': + if ( (L"firebrick") == sValue ) { this->m_eValue = presetcolorvalFirebrick ; SetRGBA(178,34,34); } + else if ( (L"floralWhite") == sValue ) { this->m_eValue = presetcolorvalFloralWhite ; SetRGBA(255,250,240); } + else if ( (L"forestGreen") == sValue ) { this->m_eValue = presetcolorvalForestGreen ; SetRGBA(34,139,34); } + else if ( (L"fuchsia") == sValue ) { this->m_eValue = presetcolorvalFuchsia ; SetRGBA(255,0,255); } + break; + case 'g': + if ( (L"gainsboro") == sValue ) { this->m_eValue = presetcolorvalGainsboro ; SetRGBA(220,220,220); } + else if ( (L"ghostWhite") == sValue ) { this->m_eValue = presetcolorvalGhostWhite ; SetRGBA(248,248,255); } + else if ( (L"gold") == sValue ) { this->m_eValue = presetcolorvalGold ; SetRGBA(255,215,0); } + else if ( (L"goldenrod") == sValue ) { this->m_eValue = presetcolorvalGoldenrod ; SetRGBA(218,165,32); } + else if ( (L"gray") == sValue ) { this->m_eValue = presetcolorvalGray ; SetRGBA(128,128,128); } + else if ( (L"green") == sValue ) { this->m_eValue = presetcolorvalGreen ; SetRGBA(0,128,0); } + else if ( (L"greenYellow") == sValue ) { this->m_eValue = presetcolorvalGreenYellow ; SetRGBA(173,255,47); } + else if ( (L"grey") == sValue ) { this->m_eValue = presetcolorvalGrey ; SetRGBA(128,128,128); } + break; + case 'h': + if ( (L"honeydew") == sValue ) { this->m_eValue = presetcolorvalHoneydew ; SetRGBA(240,255,240); } + else if ( (L"hotPink") == sValue ) { this->m_eValue = presetcolorvalHotPink ; SetRGBA(255,105,180); } + break; + case 'i': + if ( (L"indianRed") == sValue ) { this->m_eValue = presetcolorvalIndianRed ; SetRGBA(205,92,92); } + else if ( (L"indigo") == sValue ) { this->m_eValue = presetcolorvalIndigo ; SetRGBA(75,0,130); } + else if ( (L"ivory") == sValue ) { this->m_eValue = presetcolorvalIvory ; SetRGBA(255,255,240); } + break; + case 'k': + if ( (L"khaki") == sValue ) { this->m_eValue = presetcolorvalKhaki ; SetRGBA(240,230,140); } + break; + case 'l': + if ( (L"lavender") == sValue ) { this->m_eValue = presetcolorvalLavender ; SetRGBA(230,230,250); } + else if ( (L"lavenderBlush") == sValue ) { this->m_eValue = presetcolorvalLavenderBlush ; SetRGBA(255,240,245); } + else if ( (L"lawnGreen") == sValue ) { this->m_eValue = presetcolorvalLawnGreen ; SetRGBA(124,252,0); } + else if ( (L"lemonChiffon") == sValue ) { this->m_eValue = presetcolorvalLemonChiffon ; SetRGBA(255,250,205); } + else if ( (L"lightBlue") == sValue ) { this->m_eValue = presetcolorvalLightBlue ; SetRGBA(173,216,230); } + else if ( (L"lightCoral") == sValue ) { this->m_eValue = presetcolorvalLightCoral ; SetRGBA(240,128,128); } + else if ( (L"lightCyan") == sValue ) { this->m_eValue = presetcolorvalLightCyan ; SetRGBA(224,255,255); } + else if ( (L"lightGoldenrodYellow")== sValue ) { this->m_eValue = presetcolorvalLightGoldenrodYellow; SetRGBA(250,250,210); } + else if ( (L"lightGray") == sValue ) { this->m_eValue = presetcolorvalLightGray ; SetRGBA(211,211,211); } + else if ( (L"lightGreen") == sValue ) { this->m_eValue = presetcolorvalLightGreen ; SetRGBA(144,238,144); } + else if ( (L"lightGrey") == sValue ) { this->m_eValue = presetcolorvalLightGrey ; SetRGBA(211,211,211); } + else if ( (L"lightPink") == sValue ) { this->m_eValue = presetcolorvalLightPink ; SetRGBA(255,182,193); } + else if ( (L"lightSalmon") == sValue ) { this->m_eValue = presetcolorvalLightSalmon ; SetRGBA(255,160,122); } + else if ( (L"lightSeaGreen") == sValue ) { this->m_eValue = presetcolorvalLightSeaGreen ; SetRGBA(32,178,170); } + else if ( (L"lightSkyBlue") == sValue ) { this->m_eValue = presetcolorvalLightSkyBlue ; SetRGBA(135,206,250); } + else if ( (L"lightSlateGray") == sValue ) { this->m_eValue = presetcolorvalLightSlateGray ; SetRGBA(119,136,153); } + else if ( (L"lightSlateGrey") == sValue ) { this->m_eValue = presetcolorvalLightSlateGrey ; SetRGBA(119,136,153); } + else if ( (L"lightSteelBlue") == sValue ) { this->m_eValue = presetcolorvalLightSteelBlue ; SetRGBA(176,196,222); } + else if ( (L"lightYellow") == sValue ) { this->m_eValue = presetcolorvalLightYellow ; SetRGBA(255,255,224); } + else if ( (L"lime") == sValue ) { this->m_eValue = presetcolorvalLime ; SetRGBA(0,255,0); } + else if ( (L"limeGreen") == sValue ) { this->m_eValue = presetcolorvalLimeGreen ; SetRGBA(50,205,50); } + else if ( (L"linen") == sValue ) { this->m_eValue = presetcolorvalLinen; SetRGBA(250,240,230); } + else if ( (L"ltBlue") == sValue ) { this->m_eValue = presetcolorvalLtBlue ; SetRGBA(173,216,230); } + else if ( (L"ltCoral") == sValue ) { this->m_eValue = presetcolorvalLtCoral ; SetRGBA(240,128,128); } + else if ( (L"ltCyan") == sValue ) { this->m_eValue = presetcolorvalLtCyan ; SetRGBA(224,255,255); } + else if ( (L"ltGoldenrodYellow") == sValue ) { this->m_eValue = presetcolorvalLtGoldenrodYellow; SetRGBA(250,250,120); } + else if ( (L"ltGray") == sValue ) { this->m_eValue = presetcolorvalLtGray ; SetRGBA(211,211,211); } + else if ( (L"ltGreen") == sValue ) { this->m_eValue = presetcolorvalLtGreen ; SetRGBA(144,238,144); } + else if ( (L"ltGrey") == sValue ) { this->m_eValue = presetcolorvalLtGrey ; SetRGBA(211,211,211); } + else if ( (L"ltPink") == sValue ) { this->m_eValue = presetcolorvalLtPink ; SetRGBA(255,182,193); } + else if ( (L"ltSalmon") == sValue ) { this->m_eValue = presetcolorvalLtSalmon ; SetRGBA(255,160,122); } + else if ( (L"ltSeaGreen") == sValue ) { this->m_eValue = presetcolorvalLtSeaGreen ; SetRGBA(32,178,170); } + else if ( (L"ltSkyBlue") == sValue ) { this->m_eValue = presetcolorvalLtSkyBlue ; SetRGBA(135,206,250); } + else if ( (L"ltSlateGray") == sValue ) { this->m_eValue = presetcolorvalLtSlateGray ; SetRGBA(119,136,153); } + else if ( (L"ltSlateGrey") == sValue ) { this->m_eValue = presetcolorvalLtSlateGrey ; SetRGBA(119,136,153); } + else if ( (L"ltSteelBlue") == sValue ) { this->m_eValue = presetcolorvalLtSteelBlue ; SetRGBA(176,196,222); } + else if ( (L"ltYellow") == sValue ) { this->m_eValue = presetcolorvalLtYellow ; SetRGBA(255,255,224); } + break; + case 'm': + if ( (L"magenta") == sValue ) { this->m_eValue = presetcolorvalMagenta ; SetRGBA(255,0,255); } + else if ( (L"maroon") == sValue ) { this->m_eValue = presetcolorvalMaroon ; SetRGBA(128,0,0); } + else if ( (L"medAquamarine") == sValue ) { this->m_eValue = presetcolorvalMedAquamarine ; SetRGBA(102,205,170); } + else if ( (L"medBlue") == sValue ) { this->m_eValue = presetcolorvalMedBlue ; SetRGBA(0,0,205); } + else if ( (L"mediumAquamarine") == sValue ) { this->m_eValue = presetcolorvalMediumAquamarine; SetRGBA(102,205,170); } + else if ( (L"mediumBlue") == sValue ) { this->m_eValue = presetcolorvalMediumBlue ; SetRGBA(0,0,205); } + else if ( (L"mediumOrchid") == sValue ) { this->m_eValue = presetcolorvalMediumOrchid ; SetRGBA(186,85,211); } + else if ( (L"mediumPurple") == sValue ) { this->m_eValue = presetcolorvalMediumPurple ; SetRGBA(147,112,219); } + else if ( (L"mediumSeaGreen") == sValue ) { this->m_eValue = presetcolorvalMediumSeaGreen ; SetRGBA(60,179,113); } + else if ( (L"mediumSlateBlue") == sValue ) { this->m_eValue = presetcolorvalMediumSlateBlue ; SetRGBA(123,104,238); } + else if ( (L"mediumSpringGreen") == sValue ) { this->m_eValue = presetcolorvalMediumSpringGreen; SetRGBA(0,250,154); } + else if ( (L"mediumTurquoise") == sValue ) { this->m_eValue = presetcolorvalMediumTurquoise ; SetRGBA(72,209,204); } + else if ( (L"mediumVioletRed") == sValue ) { this->m_eValue = presetcolorvalMediumVioletRed ; SetRGBA(199,21,133); } + else if ( (L"medOrchid") == sValue ) { this->m_eValue = presetcolorvalMedOrchid ; SetRGBA(186,85,211); } + else if ( (L"medPurple") == sValue ) { this->m_eValue = presetcolorvalMedPurple ; SetRGBA(147,112,219); } + else if ( (L"medSeaGreen") == sValue ) { this->m_eValue = presetcolorvalMedSeaGreen ; SetRGBA(60,179,113); } + else if ( (L"medSlateBlue") == sValue ) { this->m_eValue = presetcolorvalMedSlateBlue ; SetRGBA(123,104,238); } + else if ( (L"medSpringGreen") == sValue ) { this->m_eValue = presetcolorvalMedSpringGreen ; SetRGBA(0,250,154); } + else if ( (L"medTurquoise") == sValue ) { this->m_eValue = presetcolorvalMedTurquoise ; SetRGBA(72,209,204); } + else if ( (L"medVioletRed") == sValue ) { this->m_eValue = presetcolorvalMedVioletRed ; SetRGBA(199,21,133); } + else if ( (L"midnightBlue") == sValue ) { this->m_eValue = presetcolorvalMidnightBlue ; SetRGBA(25,25,112); } + else if ( (L"mintCream") == sValue ) { this->m_eValue = presetcolorvalMintCream ; SetRGBA(245,255,250); } + else if ( (L"mistyRose") == sValue ) { this->m_eValue = presetcolorvalMistyRose ; SetRGBA(255,228,225); } + else if ( (L"moccasin") == sValue ) { this->m_eValue = presetcolorvalMoccasin ; SetRGBA(255,228,181); } + break; + case 'n': + if ( (L"navajoWhite") == sValue ) { this->m_eValue = presetcolorvalNavajoWhite ; SetRGBA(255,222,173); } + else if ( (L"navy") == sValue ) { this->m_eValue = presetcolorvalNavy ; SetRGBA(0,0,128); } + break; + case 'o': + if ( (L"oldLace") == sValue ) { this->m_eValue = presetcolorvalOldLace ; SetRGBA(253,245,230); } + else if ( (L"olive") == sValue ) { this->m_eValue = presetcolorvalOlive ; SetRGBA(128,128,0); } + else if ( (L"oliveDrab") == sValue ) { this->m_eValue = presetcolorvalOliveDrab ; SetRGBA(107,142,35); } + else if ( (L"orange") == sValue ) { this->m_eValue = presetcolorvalOrange ; SetRGBA(255,165,0); } + else if ( (L"orangeRed") == sValue ) { this->m_eValue = presetcolorvalOrangeRed ; SetRGBA(255,69,0); } + else if ( (L"orchid") == sValue ) { this->m_eValue = presetcolorvalOrchid ; SetRGBA(218,112,214); } + break; + case 'p': + if ( (L"paleGoldenrod") == sValue ) { this->m_eValue = presetcolorvalPaleGoldenrod ; SetRGBA(238,232,170); } + else if ( (L"paleGreen") == sValue ) { this->m_eValue = presetcolorvalPaleGreen ; SetRGBA(152,251,152); } + else if ( (L"paleTurquoise") == sValue ) { this->m_eValue = presetcolorvalPaleTurquoise ; SetRGBA(175,238,238); } + else if ( (L"paleVioletRed") == sValue ) { this->m_eValue = presetcolorvalPaleVioletRed ; SetRGBA(219,112,147); } + else if ( (L"papayaWhip") == sValue ) { this->m_eValue = presetcolorvalPapayaWhip ; SetRGBA(255,239,213); } + else if ( (L"peachPuff") == sValue ) { this->m_eValue = presetcolorvalPeachPuff ; SetRGBA(255,218,185); } + else if ( (L"peru") == sValue ) { this->m_eValue = presetcolorvalPeru ; SetRGBA(205,133,63); } + else if ( (L"pink") == sValue ) { this->m_eValue = presetcolorvalPink ; SetRGBA(255,192,203); } + else if ( (L"plum") == sValue ) { this->m_eValue = presetcolorvalPlum ; SetRGBA(221,160,221); } + else if ( (L"powderBlue") == sValue ) { this->m_eValue = presetcolorvalPowderBlue ; SetRGBA(176,224,230); } + else if ( (L"purple") == sValue ) { this->m_eValue = presetcolorvalPurple ; SetRGBA(128,0,128); } + break; + case 'r': + if ( (L"red") == sValue ) { this->m_eValue = presetcolorvalRed ; SetRGBA(255,0,0); } + else if ( (L"rosyBrown") == sValue ) { this->m_eValue = presetcolorvalRosyBrown ; SetRGBA(188,143,143); } + else if ( (L"royalBlue") == sValue ) { this->m_eValue = presetcolorvalRoyalBlue ; SetRGBA(65,105,225); } + break; + case 's': + if ( (L"saddleBrown") == sValue ) { this->m_eValue = presetcolorvalSaddleBrown ; SetRGBA(139,69,19); } + else if ( (L"salmon") == sValue ) { this->m_eValue = presetcolorvalSalmon ; SetRGBA(250,128,114); } + else if ( (L"sandyBrown") == sValue ) { this->m_eValue = presetcolorvalSandyBrown ; SetRGBA(244,164,96); } + else if ( (L"seaGreen") == sValue ) { this->m_eValue = presetcolorvalSeaGreen ; SetRGBA(46,139,87); } + else if ( (L"seaShell") == sValue ) { this->m_eValue = presetcolorvalSeaShell ; SetRGBA(255,245,238); } + else if ( (L"sienna") == sValue ) { this->m_eValue = presetcolorvalSienna ; SetRGBA(160,82,45); } + else if ( (L"silver") == sValue ) { this->m_eValue = presetcolorvalSilver ; SetRGBA(192,192,192); } + else if ( (L"skyBlue") == sValue ) { this->m_eValue = presetcolorvalSkyBlue ; SetRGBA(135,206,235); } + else if ( (L"slateBlue") == sValue ) { this->m_eValue = presetcolorvalSlateBlue ; SetRGBA(106,90,205); } + else if ( (L"slateGray") == sValue ) { this->m_eValue = presetcolorvalSlateGray ; SetRGBA(112,128,144); } + else if ( (L"slateGrey") == sValue ) { this->m_eValue = presetcolorvalSlateGrey ; SetRGBA(112,128,144); } + else if ( (L"snow") == sValue ) { this->m_eValue = presetcolorvalSnow ; SetRGBA(255,250,250); } + else if ( (L"springGreen") == sValue ) { this->m_eValue = presetcolorvalSpringGreen ; SetRGBA(0,255,127); } + else if ( (L"steelBlue") == sValue ) { this->m_eValue = presetcolorvalSteelBlue ; SetRGBA(70,130,180); } + break; + case 't': + if ( (L"tan") == sValue ) { this->m_eValue = presetcolorvalTan ; SetRGBA(210,180,140); } + else if ( (L"teal") == sValue ) { this->m_eValue = presetcolorvalTeal ; SetRGBA(0,128,128); } + else if ( (L"thistle") == sValue ) { this->m_eValue = presetcolorvalThistle ; SetRGBA(216,191,216); } + else if ( (L"tomato") == sValue ) { this->m_eValue = presetcolorvalTomato ; SetRGBA(255,99,71); } + else if ( (L"turquoise") == sValue ) { this->m_eValue = presetcolorvalTurquoise ; SetRGBA(64,224,208); } + break; + case 'v': + if ( (L"violet") == sValue ) { this->m_eValue = presetcolorvalViolet ; SetRGBA(238,130,238); } + break; + case 'w': + if ( (L"wheat") == sValue ) { this->m_eValue = presetcolorvalWheat ; SetRGBA(245,222,179); } + else if ( (L"white") == sValue ) { this->m_eValue = presetcolorvalWhite ; SetRGBA(255,255,255); } + else if ( (L"whiteSmoke") == sValue ) { this->m_eValue = presetcolorvalWhiteSmoke ; SetRGBA(245,245,245); } + break; + case 'y': + if ( (L"yellow") == sValue ) { this->m_eValue = presetcolorvalYellow ; SetRGBA(255,255,0); } + else if ( (L"yellowGreen") == sValue ) { this->m_eValue = presetcolorvalYellowGreen ; SetRGBA(154,205,50); } + break; + } + + return this->m_eValue; + } + + bool CPresetColorVal::FromStringIgnoreCase(const std::wstring &sValue) + { + this->m_eValue = presetcolorvalBlack; + SetRGBA( 0, 0, 0, 255 ); + + if ( sValue.empty() ) + return false; + + std::wstring sValueLower = sValue; + NSStringExt::ToLower(sValueLower); + wchar_t wChar = sValueLower[0]; + switch ( wChar ) + { + case 'a': + if ( (L"aliceblue") == sValueLower ) { this->m_eValue = presetcolorvalAliceBlue; SetRGBA(240,248,255); } + else if ( (L"antiquewhite") == sValueLower ) { this->m_eValue = presetcolorvalAntiqueWhite; SetRGBA(250,235,215); } + else if ( (L"aqua") == sValueLower ) { this->m_eValue = presetcolorvalAqua; SetRGBA(0,255,255); } + else if ( (L"aquamarine") == sValueLower ) { this->m_eValue = presetcolorvalAquamarine; SetRGBA(127,255,212); } + else if ( (L"azure") == sValueLower ) { this->m_eValue = presetcolorvalAzure; SetRGBA(240,255,255); } + break; + case 'b': + if ( (L"beige") == sValueLower ) { this->m_eValue = presetcolorvalBeige; SetRGBA(245,245,220); } + else if ( (L"bisque") == sValueLower ) { this->m_eValue = presetcolorvalBisque ; SetRGBA(255,228,196); } + else if ( (L"black") == sValueLower ) { return true; } + else if ( (L"blanchedalmond") == sValueLower ) { this->m_eValue = presetcolorvalBlanchedAlmond ; SetRGBA(255,235,205); } + else if ( (L"blue") == sValueLower ) { this->m_eValue = presetcolorvalBlue ; SetRGBA(0,0,255); } + else if ( (L"blueviolet") == sValueLower ) { this->m_eValue = presetcolorvalBlueViolet ; SetRGBA(138,43,226); } + else if ( (L"brown") == sValueLower ) { this->m_eValue = presetcolorvalBrown ; SetRGBA(165,42,42); } + else if ( (L"burlywood") == sValueLower ) { this->m_eValue = presetcolorvalBurlyWood ; SetRGBA(222,184,135); } + break; + case 'c': + if ( (L"cadetblue") == sValueLower ) { this->m_eValue = presetcolorvalCadetBlue ; SetRGBA(95,158,160); } + else if ( (L"chartreuse") == sValueLower ) { this->m_eValue = presetcolorvalChartreuse ; SetRGBA(127,255,0); } + else if ( (L"chocolate") == sValueLower ) { this->m_eValue = presetcolorvalChocolate ; SetRGBA(210,105,30); } + else if ( (L"coral") == sValueLower ) { this->m_eValue = presetcolorvalCoral ; SetRGBA(255,127,80); } + else if ( (L"cornflowerblue") == sValueLower ) { this->m_eValue = presetcolorvalCornflowerBlue ; SetRGBA(100,149,237); } + else if ( (L"cornsilk") == sValueLower ) { this->m_eValue = presetcolorvalCornsilk ; SetRGBA(255,248,220); } + else if ( (L"crimson") == sValueLower ) { this->m_eValue = presetcolorvalCrimson ; SetRGBA(220,20,60); } + else if ( (L"cyan") == sValueLower ) { this->m_eValue = presetcolorvalCyan ; SetRGBA(0,255,255); } + break; + case 'd': + if ( (L"darkblue") == sValueLower ) { this->m_eValue = presetcolorvalDarkBlue ; SetRGBA(0,0,139); } + else if ( (L"darkcyan") == sValueLower ) { this->m_eValue = presetcolorvalDarkCyan ; SetRGBA(0,139,139); } + else if ( (L"darkgoldenrod") == sValueLower ) { this->m_eValue = presetcolorvalDarkGoldenrod ; SetRGBA(184,134,11); } + else if ( (L"darkgray") == sValueLower ) { this->m_eValue = presetcolorvalDarkGray ; SetRGBA(169,169,169); } + else if ( (L"darkgreen") == sValueLower ) { this->m_eValue = presetcolorvalDarkGreen ; SetRGBA(0,100,0); } + else if ( (L"darkgrey") == sValueLower ) { this->m_eValue = presetcolorvalDarkGrey ; SetRGBA(169,169,169); } + else if ( (L"darkkhaki") == sValueLower ) { this->m_eValue = presetcolorvalDarkKhaki ; SetRGBA(189,183,107); } + else if ( (L"darkmagenta") == sValueLower ) { this->m_eValue = presetcolorvalDarkMagenta ; SetRGBA(139,0,139); } + else if ( (L"darkolivegreen") == sValueLower ) { this->m_eValue = presetcolorvalDarkOliveGreen ; SetRGBA(85,107,47); } + else if ( (L"darkorange") == sValueLower ) { this->m_eValue = presetcolorvalDarkOrange ; SetRGBA(255,140,0); } + else if ( (L"darkorchid") == sValueLower ) { this->m_eValue = presetcolorvalDarkOrchid ; SetRGBA(153,50,204); } + else if ( (L"darkred") == sValueLower ) { this->m_eValue = presetcolorvalDarkRed ; SetRGBA(139,0,0); } + else if ( (L"darksalmon") == sValueLower ) { this->m_eValue = presetcolorvalDarkSalmon ; SetRGBA(233,150,122); } + else if ( (L"darkseagreen") == sValueLower ) { this->m_eValue = presetcolorvalDarkSeaGreen ; SetRGBA(143,188,143); } + else if ( (L"darkslateblue") == sValueLower ) { this->m_eValue = presetcolorvalDarkSlateBlue ; SetRGBA(72,61,139); } + else if ( (L"darkslategray") == sValueLower ) { this->m_eValue = presetcolorvalDarkSlateGray ; SetRGBA(47,79,79); } + else if ( (L"darkslategrey") == sValueLower ) { this->m_eValue = presetcolorvalDarkSlateGrey ; SetRGBA(47,79,79); } + else if ( (L"darkturquoise") == sValueLower ) { this->m_eValue = presetcolorvalDarkTurquoise ; SetRGBA(0,206,209); } + else if ( (L"darkviolet") == sValueLower ) { this->m_eValue = presetcolorvalDarkViolet ; SetRGBA(148,0,211); } + else if ( (L"deeppink") == sValueLower ) { this->m_eValue = presetcolorvalDeepPink ; SetRGBA(255,20,147); } + else if ( (L"deepskyblue") == sValueLower ) { this->m_eValue = presetcolorvalDeepSkyBlue ; SetRGBA(0,191,255); } + else if ( (L"dimgray") == sValueLower ) { this->m_eValue = presetcolorvalDimGray ; SetRGBA(105,105,105); } + else if ( (L"dimgrey") == sValueLower ) { this->m_eValue = presetcolorvalDimGrey ; SetRGBA(105,105,105); } + else if ( (L"dkblue") == sValueLower ) { this->m_eValue = presetcolorvalDkBlue ; SetRGBA(0,0,139); } + else if ( (L"dkcyan") == sValueLower ) { this->m_eValue = presetcolorvalDkCyan ; SetRGBA(0,139,139); } + else if ( (L"dkgoldenrod") == sValueLower ) { this->m_eValue = presetcolorvalDkGoldenrod ; SetRGBA(184,134,11); } + else if ( (L"dkgray") == sValueLower ) { this->m_eValue = presetcolorvalDkGray ; SetRGBA(169,169,169); } + else if ( (L"dkgreen") == sValueLower ) { this->m_eValue = presetcolorvalDkGreen ; SetRGBA(0,100,0); } + else if ( (L"dkgrey") == sValueLower ) { this->m_eValue = presetcolorvalDkGrey ; SetRGBA(169,169,169); } + else if ( (L"dkkhaki") == sValueLower ) { this->m_eValue = presetcolorvalDkKhaki ; SetRGBA(189,183,107); } + else if ( (L"dkmagenta") == sValueLower ) { this->m_eValue = presetcolorvalDkMagenta ; SetRGBA(139,0,139); } + else if ( (L"dkolivegreen") == sValueLower ) { this->m_eValue = presetcolorvalDkOliveGreen ; SetRGBA(85,107,47); } + else if ( (L"dkorange") == sValueLower ) { this->m_eValue = presetcolorvalDkOrange ; SetRGBA(255,140,0); } + else if ( (L"dkorchid") == sValueLower ) { this->m_eValue = presetcolorvalDkOrchid ; SetRGBA(153,50,204); } + else if ( (L"dkred") == sValueLower ) { this->m_eValue = presetcolorvalDkRed ; SetRGBA(139,0,0); } + else if ( (L"dksalmon") == sValueLower ) { this->m_eValue = presetcolorvalDkSalmon ; SetRGBA(233,150,122); } + else if ( (L"dkseagreen") == sValueLower ) { this->m_eValue = presetcolorvalDkSeaGreen ; SetRGBA(143,188,139); } + else if ( (L"dkslateblue") == sValueLower ) { this->m_eValue = presetcolorvalDkSlateBlue ; SetRGBA(72,61,139); } + else if ( (L"dkslategray") == sValueLower ) { this->m_eValue = presetcolorvalDkSlateGray ; SetRGBA(47,79,79); } + else if ( (L"dkslategrey") == sValueLower ) { this->m_eValue = presetcolorvalDkSlateGrey ; SetRGBA(47,79,79); } + else if ( (L"dkturquoise") == sValueLower ) { this->m_eValue = presetcolorvalDkTurquoise ; SetRGBA(0,206,209); } + else if ( (L"dkviolet") == sValueLower ) { this->m_eValue = presetcolorvalDkViolet ; SetRGBA(148,0,211); } + else if ( (L"dodgerblue") == sValueLower ) { this->m_eValue = presetcolorvalDodgerBlue ; SetRGBA(30,144,255); } + break; + case 'f': + if ( (L"firebrick") == sValueLower ) { this->m_eValue = presetcolorvalFirebrick ; SetRGBA(178,34,34); } + else if ( (L"floralwhite") == sValueLower ) { this->m_eValue = presetcolorvalFloralWhite ; SetRGBA(255,250,240); } + else if ( (L"forestgreen") == sValueLower ) { this->m_eValue = presetcolorvalForestGreen ; SetRGBA(34,139,34); } + else if ( (L"fuchsia") == sValueLower ) { this->m_eValue = presetcolorvalFuchsia ; SetRGBA(255,0,255); } + break; + case 'g': + if ( (L"gainsboro") == sValueLower ) { this->m_eValue = presetcolorvalGainsboro ; SetRGBA(220,220,220); } + else if ( (L"ghostwhite") == sValueLower ) { this->m_eValue = presetcolorvalGhostWhite ; SetRGBA(248,248,255); } + else if ( (L"gold") == sValueLower ) { this->m_eValue = presetcolorvalGold ; SetRGBA(255,215,0); } + else if ( (L"goldenrod") == sValueLower ) { this->m_eValue = presetcolorvalGoldenrod ; SetRGBA(218,165,32); } + else if ( (L"gray") == sValueLower ) { this->m_eValue = presetcolorvalGray ; SetRGBA(128,128,128); } + else if ( (L"green") == sValueLower ) { this->m_eValue = presetcolorvalGreen ; SetRGBA(0,128,0); } + else if ( (L"greenyellow") == sValueLower ) { this->m_eValue = presetcolorvalGreenYellow ; SetRGBA(173,255,47); } + else if ( (L"grey") == sValueLower ) { this->m_eValue = presetcolorvalGrey ; SetRGBA(128,128,128); } + break; + case 'h': + if ( (L"honeydew") == sValueLower ) { this->m_eValue = presetcolorvalHoneydew ; SetRGBA(240,255,240); } + else if ( (L"hotpink") == sValueLower ) { this->m_eValue = presetcolorvalHotPink ; SetRGBA(255,105,180); } + break; + case 'i': + if ( (L"indianred") == sValueLower ) { this->m_eValue = presetcolorvalIndianRed ; SetRGBA(205,92,92); } + else if ( (L"indigo") == sValueLower ) { this->m_eValue = presetcolorvalIndigo ; SetRGBA(75,0,130); } + else if ( (L"ivory") == sValueLower ) { this->m_eValue = presetcolorvalIvory ; SetRGBA(255,255,240); } + break; + case 'k': + if ( (L"khaki") == sValueLower ) { this->m_eValue = presetcolorvalKhaki ; SetRGBA(240,230,140); } + break; + case 'l': + if ( (L"lavender") == sValueLower ) { this->m_eValue = presetcolorvalLavender ; SetRGBA(230,230,250); } + else if ( (L"lavenderblush") == sValueLower ) { this->m_eValue = presetcolorvalLavenderBlush ; SetRGBA(255,240,245); } + else if ( (L"lawngreen") == sValueLower ) { this->m_eValue = presetcolorvalLawnGreen ; SetRGBA(124,252,0); } + else if ( (L"lemonchiffon") == sValueLower ) { this->m_eValue = presetcolorvalLemonChiffon ; SetRGBA(255,250,205); } + else if ( (L"lightblue") == sValueLower ) { this->m_eValue = presetcolorvalLightBlue ; SetRGBA(173,216,230); } + else if ( (L"lightcoral") == sValueLower ) { this->m_eValue = presetcolorvalLightCoral ; SetRGBA(240,128,128); } + else if ( (L"lightcyan") == sValueLower ) { this->m_eValue = presetcolorvalLightCyan ; SetRGBA(224,255,255); } + else if ( (L"lightgoldenrodyellow")== sValueLower ) { this->m_eValue = presetcolorvalLightGoldenrodYellow; SetRGBA(250,250,210); } + else if ( (L"lightgray") == sValueLower ) { this->m_eValue = presetcolorvalLightGray ; SetRGBA(211,211,211); } + else if ( (L"lightgreen") == sValueLower ) { this->m_eValue = presetcolorvalLightGreen ; SetRGBA(144,238,144); } + else if ( (L"lightgrey") == sValueLower ) { this->m_eValue = presetcolorvalLightGrey ; SetRGBA(211,211,211); } + else if ( (L"lightpink") == sValueLower ) { this->m_eValue = presetcolorvalLightPink ; SetRGBA(255,182,193); } + else if ( (L"lightsalmon") == sValueLower ) { this->m_eValue = presetcolorvalLightSalmon ; SetRGBA(255,160,122); } + else if ( (L"lightseagreen") == sValueLower ) { this->m_eValue = presetcolorvalLightSeaGreen ; SetRGBA(32,178,170); } + else if ( (L"lightskyblue") == sValueLower ) { this->m_eValue = presetcolorvalLightSkyBlue ; SetRGBA(135,206,250); } + else if ( (L"lightslategray") == sValueLower ) { this->m_eValue = presetcolorvalLightSlateGray ; SetRGBA(119,136,153); } + else if ( (L"lightslategrey") == sValueLower ) { this->m_eValue = presetcolorvalLightSlateGrey ; SetRGBA(119,136,153); } + else if ( (L"lightsteelblue") == sValueLower ) { this->m_eValue = presetcolorvalLightSteelBlue ; SetRGBA(176,196,222); } + else if ( (L"lightyellow") == sValueLower ) { this->m_eValue = presetcolorvalLightYellow ; SetRGBA(255,255,224); } + else if ( (L"lime") == sValueLower ) { this->m_eValue = presetcolorvalLime ; SetRGBA(0,255,0); } + else if ( (L"limegreen") == sValueLower ) { this->m_eValue = presetcolorvalLimeGreen ; SetRGBA(50,205,50); } + else if ( (L"linen") == sValueLower ) { this->m_eValue = presetcolorvalLinen; SetRGBA(250,240,230); } + else if ( (L"ltblue") == sValueLower ) { this->m_eValue = presetcolorvalLtBlue ; SetRGBA(173,216,230); } + else if ( (L"ltcoral") == sValueLower ) { this->m_eValue = presetcolorvalLtCoral ; SetRGBA(240,128,128); } + else if ( (L"ltcyan") == sValueLower ) { this->m_eValue = presetcolorvalLtCyan ; SetRGBA(224,255,255); } + else if ( (L"ltgoldenrodyellow") == sValueLower ) { this->m_eValue = presetcolorvalLtGoldenrodYellow; SetRGBA(250,250,120); } + else if ( (L"ltgray") == sValueLower ) { this->m_eValue = presetcolorvalLtGray ; SetRGBA(211,211,211); } + else if ( (L"ltgreen") == sValueLower ) { this->m_eValue = presetcolorvalLtGreen ; SetRGBA(144,238,144); } + else if ( (L"ltgrey") == sValueLower ) { this->m_eValue = presetcolorvalLtGrey ; SetRGBA(211,211,211); } + else if ( (L"ltpink") == sValueLower ) { this->m_eValue = presetcolorvalLtPink ; SetRGBA(255,182,193); } + else if ( (L"ltsalmon") == sValueLower ) { this->m_eValue = presetcolorvalLtSalmon ; SetRGBA(255,160,122); } + else if ( (L"ltseagreen") == sValueLower ) { this->m_eValue = presetcolorvalLtSeaGreen ; SetRGBA(32,178,170); } + else if ( (L"ltskyblue") == sValueLower ) { this->m_eValue = presetcolorvalLtSkyBlue ; SetRGBA(135,206,250); } + else if ( (L"ltslategray") == sValueLower ) { this->m_eValue = presetcolorvalLtSlateGray ; SetRGBA(119,136,153); } + else if ( (L"ltslategrey") == sValueLower ) { this->m_eValue = presetcolorvalLtSlateGrey ; SetRGBA(119,136,153); } + else if ( (L"ltsteelblue") == sValueLower ) { this->m_eValue = presetcolorvalLtSteelBlue ; SetRGBA(176,196,222); } + else if ( (L"ltyellow") == sValueLower ) { this->m_eValue = presetcolorvalLtYellow ; SetRGBA(255,255,224); } + break; + case 'm': + if ( (L"magenta") == sValueLower ) { this->m_eValue = presetcolorvalMagenta ; SetRGBA(255,0,255); } + else if ( (L"maroon") == sValueLower ) { this->m_eValue = presetcolorvalMaroon ; SetRGBA(128,0,0); } + else if ( (L"medaquamarine") == sValueLower ) { this->m_eValue = presetcolorvalMedAquamarine ; SetRGBA(102,205,170); } + else if ( (L"medblue") == sValueLower ) { this->m_eValue = presetcolorvalMedBlue ; SetRGBA(0,0,205); } + else if ( (L"mediumaquamarine") == sValueLower ) { this->m_eValue = presetcolorvalMediumAquamarine; SetRGBA(102,205,170); } + else if ( (L"mediumblue") == sValueLower ) { this->m_eValue = presetcolorvalMediumBlue ; SetRGBA(0,0,205); } + else if ( (L"mediumorchid") == sValueLower ) { this->m_eValue = presetcolorvalMediumOrchid ; SetRGBA(186,85,211); } + else if ( (L"mediumpurple") == sValueLower ) { this->m_eValue = presetcolorvalMediumPurple ; SetRGBA(147,112,219); } + else if ( (L"mediumseagreen") == sValueLower ) { this->m_eValue = presetcolorvalMediumSeaGreen ; SetRGBA(60,179,113); } + else if ( (L"mediumslateblue") == sValueLower ) { this->m_eValue = presetcolorvalMediumSlateBlue ; SetRGBA(123,104,238); } + else if ( (L"mediumspringgreen") == sValueLower ) { this->m_eValue = presetcolorvalMediumSpringGreen; SetRGBA(0,250,154); } + else if ( (L"mediumturquoise") == sValueLower ) { this->m_eValue = presetcolorvalMediumTurquoise ; SetRGBA(72,209,204); } + else if ( (L"mediumvioletred") == sValueLower ) { this->m_eValue = presetcolorvalMediumVioletRed ; SetRGBA(199,21,133); } + else if ( (L"medorchid") == sValueLower ) { this->m_eValue = presetcolorvalMedOrchid ; SetRGBA(186,85,211); } + else if ( (L"medpurple") == sValueLower ) { this->m_eValue = presetcolorvalMedPurple ; SetRGBA(147,112,219); } + else if ( (L"medseagreen") == sValueLower ) { this->m_eValue = presetcolorvalMedSeaGreen ; SetRGBA(60,179,113); } + else if ( (L"medslateblue") == sValueLower ) { this->m_eValue = presetcolorvalMedSlateBlue ; SetRGBA(123,104,238); } + else if ( (L"medspringgreen") == sValueLower ) { this->m_eValue = presetcolorvalMedSpringGreen ; SetRGBA(0,250,154); } + else if ( (L"medturquoise") == sValueLower ) { this->m_eValue = presetcolorvalMedTurquoise ; SetRGBA(72,209,204); } + else if ( (L"medvioletred") == sValueLower ) { this->m_eValue = presetcolorvalMedVioletRed ; SetRGBA(199,21,133); } + else if ( (L"midnightblue") == sValueLower ) { this->m_eValue = presetcolorvalMidnightBlue ; SetRGBA(25,25,112); } + else if ( (L"mintcream") == sValueLower ) { this->m_eValue = presetcolorvalMintCream ; SetRGBA(245,255,250); } + else if ( (L"mistyrose") == sValueLower ) { this->m_eValue = presetcolorvalMistyRose ; SetRGBA(255,228,225); } + else if ( (L"moccasin") == sValueLower ) { this->m_eValue = presetcolorvalMoccasin ; SetRGBA(255,228,181); } + break; + case 'n': + if ( (L"navajowhite") == sValueLower ) { this->m_eValue = presetcolorvalNavajoWhite ; SetRGBA(255,222,173); } + else if ( (L"navy") == sValueLower ) { this->m_eValue = presetcolorvalNavy ; SetRGBA(0,0,128); } + break; + case 'o': + if ( (L"oldlace") == sValueLower ) { this->m_eValue = presetcolorvalOldLace ; SetRGBA(253,245,230); } + else if ( (L"olive") == sValueLower ) { this->m_eValue = presetcolorvalOlive ; SetRGBA(128,128,0); } + else if ( (L"olivedrab") == sValueLower ) { this->m_eValue = presetcolorvalOliveDrab ; SetRGBA(107,142,35); } + else if ( (L"orange") == sValueLower ) { this->m_eValue = presetcolorvalOrange ; SetRGBA(255,165,0); } + else if ( (L"orangered") == sValueLower ) { this->m_eValue = presetcolorvalOrangeRed ; SetRGBA(255,69,0); } + else if ( (L"orchid") == sValueLower ) { this->m_eValue = presetcolorvalOrchid ; SetRGBA(218,112,214); } + break; + case 'p': + if ( (L"palegoldenrod") == sValueLower ) { this->m_eValue = presetcolorvalPaleGoldenrod ; SetRGBA(238,232,170); } + else if ( (L"palegreen") == sValueLower ) { this->m_eValue = presetcolorvalPaleGreen ; SetRGBA(152,251,152); } + else if ( (L"paleturquoise") == sValueLower ) { this->m_eValue = presetcolorvalPaleTurquoise ; SetRGBA(175,238,238); } + else if ( (L"palevioletred") == sValueLower ) { this->m_eValue = presetcolorvalPaleVioletRed ; SetRGBA(219,112,147); } + else if ( (L"papayawhip") == sValueLower ) { this->m_eValue = presetcolorvalPapayaWhip ; SetRGBA(255,239,213); } + else if ( (L"peachpuff") == sValueLower ) { this->m_eValue = presetcolorvalPeachPuff ; SetRGBA(255,218,185); } + else if ( (L"peru") == sValueLower ) { this->m_eValue = presetcolorvalPeru ; SetRGBA(205,133,63); } + else if ( (L"pink") == sValueLower ) { this->m_eValue = presetcolorvalPink ; SetRGBA(255,192,203); } + else if ( (L"plum") == sValueLower ) { this->m_eValue = presetcolorvalPlum ; SetRGBA(221,160,221); } + else if ( (L"powderblue") == sValueLower ) { this->m_eValue = presetcolorvalPowderBlue ; SetRGBA(176,224,230); } + else if ( (L"purple") == sValueLower ) { this->m_eValue = presetcolorvalPurple ; SetRGBA(128,0,128); } + break; + case 'r': + if ( (L"red") == sValueLower ) { this->m_eValue = presetcolorvalRed ; SetRGBA(255,0,0); } + else if ( (L"rosybrown") == sValueLower ) { this->m_eValue = presetcolorvalRosyBrown ; SetRGBA(188,143,143); } + else if ( (L"royalblue") == sValueLower ) { this->m_eValue = presetcolorvalRoyalBlue ; SetRGBA(65,105,225); } + break; + case 's': + if ( (L"saddlebrown") == sValueLower ) { this->m_eValue = presetcolorvalSaddleBrown ; SetRGBA(139,69,19); } + else if ( (L"salmon") == sValueLower ) { this->m_eValue = presetcolorvalSalmon ; SetRGBA(250,128,114); } + else if ( (L"sandybrown") == sValueLower ) { this->m_eValue = presetcolorvalSandyBrown ; SetRGBA(244,164,96); } + else if ( (L"seagreen") == sValueLower ) { this->m_eValue = presetcolorvalSeaGreen ; SetRGBA(46,139,87); } + else if ( (L"seashell") == sValueLower ) { this->m_eValue = presetcolorvalSeaShell ; SetRGBA(255,245,238); } + else if ( (L"sienna") == sValueLower ) { this->m_eValue = presetcolorvalSienna ; SetRGBA(160,82,45); } + else if ( (L"silver") == sValueLower ) { this->m_eValue = presetcolorvalSilver ; SetRGBA(192,192,192); } + else if ( (L"skyblue") == sValueLower ) { this->m_eValue = presetcolorvalSkyBlue ; SetRGBA(135,206,235); } + else if ( (L"slateblue") == sValueLower ) { this->m_eValue = presetcolorvalSlateBlue ; SetRGBA(106,90,205); } + else if ( (L"slategray") == sValueLower ) { this->m_eValue = presetcolorvalSlateGray ; SetRGBA(112,128,144); } + else if ( (L"slategrey") == sValueLower ) { this->m_eValue = presetcolorvalSlateGrey ; SetRGBA(112,128,144); } + else if ( (L"snow") == sValueLower ) { this->m_eValue = presetcolorvalSnow ; SetRGBA(255,250,250); } + else if ( (L"springgreen") == sValueLower ) { this->m_eValue = presetcolorvalSpringGreen ; SetRGBA(0,255,127); } + else if ( (L"steelblue") == sValueLower ) { this->m_eValue = presetcolorvalSteelBlue ; SetRGBA(70,130,180); } + break; + case 't': + if ( (L"tan") == sValueLower ) { this->m_eValue = presetcolorvalTan ; SetRGBA(210,180,140); } + else if ( (L"teal") == sValueLower ) { this->m_eValue = presetcolorvalTeal ; SetRGBA(0,128,128); } + else if ( (L"thistle") == sValueLower ) { this->m_eValue = presetcolorvalThistle ; SetRGBA(216,191,216); } + else if ( (L"tomato") == sValueLower ) { this->m_eValue = presetcolorvalTomato ; SetRGBA(255,99,71); } + else if ( (L"turquoise") == sValueLower ) { this->m_eValue = presetcolorvalTurquoise ; SetRGBA(64,224,208); } + break; + case 'v': + if ( (L"violet") == sValueLower ) { this->m_eValue = presetcolorvalViolet ; SetRGBA(238,130,238); } + break; + case 'w': + if ( (L"wheat") == sValueLower ) { this->m_eValue = presetcolorvalWheat ; SetRGBA(245,222,179); } + else if ( (L"white") == sValueLower ) { this->m_eValue = presetcolorvalWhite ; SetRGBA(255,255,255); } + else if ( (L"whitesmoke") == sValueLower ) { this->m_eValue = presetcolorvalWhiteSmoke ; SetRGBA(245,245,245); } + break; + case 'y': + if ( (L"yellow") == sValueLower ) { this->m_eValue = presetcolorvalYellow ; SetRGBA(255,255,0); } + else if ( (L"yellowgreen") == sValueLower ) { this->m_eValue = presetcolorvalYellowGreen ; SetRGBA(154,205,50); } + break; + } + //would exit earlier if 'black' == sValue therefore here presetcolorvalBlack is default value + return presetcolorvalBlack != this->m_eValue; + } + + std::wstring CPresetColorVal::ToString () const + { + switch(this->m_eValue) + { + case presetcolorvalAliceBlue: return (L"aliceBlue"); + case presetcolorvalAntiqueWhite: return (L"antiqueWhite"); + case presetcolorvalAqua: return (L"aqua"); + case presetcolorvalAquamarine: return (L"aquamarine"); + case presetcolorvalAzure: return (L"azure"); + case presetcolorvalBeige: return (L"beige"); + case presetcolorvalBisque: return (L"bisque"); + case presetcolorvalBlack : return (L"black"); + case presetcolorvalBlanchedAlmond : return (L"blanchedAlmond"); + case presetcolorvalBlue : return (L"blue"); + case presetcolorvalBlueViolet : return (L"blueViolet"); + case presetcolorvalBrown : return (L"brown"); + case presetcolorvalBurlyWood : return (L"burlyWood"); + case presetcolorvalCadetBlue : return (L"cadetBlue"); + case presetcolorvalChartreuse : return (L"chartreuse"); + case presetcolorvalChocolate : return (L"chocolate"); + case presetcolorvalCoral : return (L"coral"); + case presetcolorvalCornflowerBlue : return (L"cornflowerBlue"); + case presetcolorvalCornsilk : return (L"cornsilk"); + case presetcolorvalCrimson : return (L"crimson"); + case presetcolorvalCyan : return (L"cyan"); + case presetcolorvalDarkBlue : return (L"darkBlue"); + case presetcolorvalDarkCyan : return (L"darkCyan"); + case presetcolorvalDarkGoldenrod : return (L"darkGoldenrod"); + case presetcolorvalDarkGray : return (L"darkGray"); + case presetcolorvalDarkGreen: return (L"darkGreen"); + case presetcolorvalDarkGrey : return (L"darkGrey"); + case presetcolorvalDarkKhaki: return (L"darkKhaki"); + case presetcolorvalDarkMagenta : return (L"darkMagenta"); + case presetcolorvalDarkOliveGreen : return (L"darkOliveGreen"); + case presetcolorvalDarkOrange : return (L"darkOrange"); + case presetcolorvalDarkOrchid : return (L"darkOrchid"); + case presetcolorvalDarkRed : return (L"darkRed"); + case presetcolorvalDarkSalmon : return (L"darkSalmon"); + case presetcolorvalDarkSeaGreen : return (L"darkSeaGreen"); + case presetcolorvalDarkSlateBlue : return (L"darkSlateBlue"); + case presetcolorvalDarkSlateGray : return (L"darkSlateGray"); + case presetcolorvalDarkSlateGrey : return (L"darkSlateGrey"); + case presetcolorvalDarkTurquoise : return (L"darkTurquoise"); + case presetcolorvalDarkViolet : return (L"darkViolet"); + case presetcolorvalDeepPink : return (L"deepPink"); + case presetcolorvalDeepSkyBlue : return (L"deepSkyBlue"); + case presetcolorvalDimGray : return (L"dimGray"); + case presetcolorvalDimGrey : return (L"dimGrey"); + case presetcolorvalDkBlue : return (L"dkBlue"); + case presetcolorvalDkCyan : return (L"dkCyan"); + case presetcolorvalDkGoldenrod : return (L"dkGoldenrod"); + case presetcolorvalDkGray : return (L"dkGray"); + case presetcolorvalDkGreen : return (L"dkGreen"); + case presetcolorvalDkGrey : return (L"dkGrey"); + case presetcolorvalDkKhaki : return (L"dkKhaki"); + case presetcolorvalDkMagenta : return (L"dkMagenta"); + case presetcolorvalDkOliveGreen : return (L"dkOliveGreen"); + case presetcolorvalDkOrange : return (L"dkOrange"); + case presetcolorvalDkOrchid : return (L"dkOrchid"); + case presetcolorvalDkRed : return (L"dkRed"); + case presetcolorvalDkSalmon : return (L"dkSalmon"); + case presetcolorvalDkSeaGreen : return (L"dkSeaGreen"); + case presetcolorvalDkSlateBlue : return (L"dkSlateBlue"); + case presetcolorvalDkSlateGray : return (L"dkSlateGray"); + case presetcolorvalDkSlateGrey : return (L"dkSlateGrey"); + case presetcolorvalDkTurquoise : return (L"dkTurquoise"); + case presetcolorvalDkViolet : return (L"dkViolet"); + case presetcolorvalDodgerBlue : return (L"dodgerBlue"); + case presetcolorvalFirebrick : return (L"firebrick"); + case presetcolorvalFloralWhite : return (L"floralWhite"); + case presetcolorvalForestGreen : return (L"forestGreen"); + case presetcolorvalFuchsia : return (L"fuchsia"); + case presetcolorvalGainsboro : return (L"gainsboro"); + case presetcolorvalGhostWhite : return (L"ghostWhite"); + case presetcolorvalGold : return (L"gold"); + case presetcolorvalGoldenrod : return (L"goldenrod"); + case presetcolorvalGray : return (L"gray"); + case presetcolorvalGreen : return (L"green"); + case presetcolorvalGreenYellow : return (L"greenYellow"); + case presetcolorvalGrey : return (L"grey"); + case presetcolorvalHoneydew : return (L"honeydew"); + case presetcolorvalHotPink : return (L"hotPink"); + case presetcolorvalIndianRed : return (L"indianRed"); + case presetcolorvalIndigo : return (L"indigo"); + case presetcolorvalIvory : return (L"ivory"); + case presetcolorvalKhaki : return (L"khaki"); + case presetcolorvalLavender : return (L"lavender"); + case presetcolorvalLavenderBlush : return (L"lavenderBlush"); + case presetcolorvalLawnGreen: return (L"lawnGreen"); + case presetcolorvalLemonChiffon : return (L"lemonChiffon"); + case presetcolorvalLightBlue : return (L"lightBlue"); + case presetcolorvalLightCoral : return (L"lightCoral"); + case presetcolorvalLightCyan : return (L"lightCyan"); + case presetcolorvalLightGoldenrodYellow:return (L"lightGoldenrodYellow"); + case presetcolorvalLightGray : return (L"lightGray"); + case presetcolorvalLightGreen : return (L"lightGreen"); + case presetcolorvalLightGrey : return (L"lightGrey"); + case presetcolorvalLightPink : return (L"lightPink"); + case presetcolorvalLightSalmon : return (L"lightSalmon"); + case presetcolorvalLightSeaGreen : return (L"lightSeaGreen"); + case presetcolorvalLightSkyBlue : return (L"lightSkyBlue"); + case presetcolorvalLightSlateGray : return (L"lightSlateGray"); + case presetcolorvalLightSlateGrey : return (L"lightSlateGrey"); + case presetcolorvalLightSteelBlue : return (L"lightSteelBlue"); + case presetcolorvalLightYellow : return (L"lightYellow"); + case presetcolorvalLime : return (L"lime"); + case presetcolorvalLimeGreen : return (L"limeGreen"); + case presetcolorvalLinen: return (L"linen"); + case presetcolorvalLtBlue : return (L"ltBlue"); + case presetcolorvalLtCoral : return (L"ltCoral"); + case presetcolorvalLtCyan : return (L"ltCyan"); + case presetcolorvalLtGoldenrodYellow: return (L"ltGoldenrodYellow"); + case presetcolorvalLtGray : return (L"ltGray"); + case presetcolorvalLtGreen : return (L"ltGreen"); + case presetcolorvalLtGrey : return (L"ltGrey"); + case presetcolorvalLtPink : return (L"ltPink"); + case presetcolorvalLtSalmon : return (L"ltSalmon"); + case presetcolorvalLtSeaGreen : return (L"ltSeaGreen"); + case presetcolorvalLtSkyBlue : return (L"ltSkyBlue"); + case presetcolorvalLtSlateGray : return (L"ltSlateGray"); + case presetcolorvalLtSlateGrey : return (L"ltSlateGrey"); + case presetcolorvalLtSteelBlue : return (L"ltSteelBlue"); + case presetcolorvalLtYellow : return (L"ltYellow"); + case presetcolorvalMagenta : return (L"magenta"); + case presetcolorvalMaroon : return (L"maroon"); + case presetcolorvalMedAquamarine : return (L"medAquamarine"); + case presetcolorvalMedBlue : return (L"medBlue"); + case presetcolorvalMediumAquamarine: return (L"mediumAquamarine"); + case presetcolorvalMediumBlue : return (L"mediumBlue"); + case presetcolorvalMediumOrchid : return (L"mediumOrchid"); + case presetcolorvalMediumPurple : return (L"mediumPurple"); + case presetcolorvalMediumSeaGreen : return (L"mediumSeaGreen"); + case presetcolorvalMediumSlateBlue : return (L"mediumSlateBlue"); + case presetcolorvalMediumSpringGreen: return (L"mediumSpringGreen"); + case presetcolorvalMediumTurquoise : return (L"mediumTurquoise"); + case presetcolorvalMediumVioletRed : return (L"mediumVioletRed"); + case presetcolorvalMedOrchid : return (L"medOrchid"); + case presetcolorvalMedPurple : return (L"medPurple"); + case presetcolorvalMedSeaGreen : return (L"medSeaGreen"); + case presetcolorvalMedSlateBlue : return (L"medSlateBlue"); + case presetcolorvalMedSpringGreen : return (L"medSpringGreen"); + case presetcolorvalMedTurquoise : return (L"medTurquoise"); + case presetcolorvalMedVioletRed : return (L"medVioletRed"); + case presetcolorvalMidnightBlue : return (L"midnightBlue"); + case presetcolorvalMintCream : return (L"mintCream"); + case presetcolorvalMistyRose : return (L"mistyRose"); + case presetcolorvalMoccasin : return (L"moccasin"); + case presetcolorvalNavajoWhite : return (L"navajoWhite"); + case presetcolorvalNavy : return (L"navy"); + case presetcolorvalOldLace : return (L"oldLace"); + case presetcolorvalOlive : return (L"olive"); + case presetcolorvalOliveDrab : return (L"oliveDrab"); + case presetcolorvalOrange : return (L"orange"); + case presetcolorvalOrangeRed : return (L"orangeRed"); + case presetcolorvalOrchid : return (L"orchid"); + case presetcolorvalPaleGoldenrod : return (L"paleGoldenrod"); + case presetcolorvalPaleGreen : return (L"paleGreen"); + case presetcolorvalPaleTurquoise : return (L"paleTurquoise"); + case presetcolorvalPaleVioletRed : return (L"paleVioletRed"); + case presetcolorvalPapayaWhip : return (L"papayaWhip"); + case presetcolorvalPeachPuff : return (L"peachPuff"); + case presetcolorvalPeru : return (L"peru"); + case presetcolorvalPink : return (L"pink"); + case presetcolorvalPlum : return (L"plum"); + case presetcolorvalPowderBlue : return (L"powderBlue"); + case presetcolorvalPurple : return (L"purple"); + case presetcolorvalRed : return (L"red"); + case presetcolorvalRosyBrown : return (L"rosyBrown"); + case presetcolorvalRoyalBlue : return (L"royalBlue"); + case presetcolorvalSaddleBrown : return (L"saddleBrown"); + case presetcolorvalSalmon : return (L"salmon"); + case presetcolorvalSandyBrown : return (L"sandyBrown"); + case presetcolorvalSeaGreen : return (L"seaGreen"); + case presetcolorvalSeaShell : return (L"seaShell"); + case presetcolorvalSienna : return (L"sienna"); + case presetcolorvalSilver : return (L"silver"); + case presetcolorvalSkyBlue : return (L"skyBlue"); + case presetcolorvalSlateBlue : return (L"slateBlue"); + case presetcolorvalSlateGray : return (L"slateGray"); + case presetcolorvalSlateGrey : return (L"slateGrey"); + case presetcolorvalSnow : return (L"snow"); + case presetcolorvalSpringGreen : return (L"springGreen"); + case presetcolorvalSteelBlue : return (L"steelBlue"); + case presetcolorvalTan : return (L"tan"); + case presetcolorvalTeal : return (L"teal"); + case presetcolorvalThistle : return (L"thistle"); + case presetcolorvalTomato : return (L"tomato"); + case presetcolorvalTurquoise : return (L"turquoise"); + case presetcolorvalViolet : return (L"violet"); + case presetcolorvalWheat : return (L"wheat"); + case presetcolorvalWhite : return (L"white"); + case presetcolorvalWhiteSmoke : return (L"whiteSmoke"); + case presetcolorvalYellow : return (L"yellow"); + case presetcolorvalYellowGreen : return (L"yellowGreen"); + default : return (L"black"); + } + } + + unsigned char CPresetColorVal::Get_R() const + { + return m_unR; + } + + unsigned char CPresetColorVal::Get_G() const + { + return m_unG; + } + + unsigned char CPresetColorVal::Get_B() const + { + return m_unB; + } + + unsigned char CPresetColorVal::Get_A() const + { + return m_unA; + } + + //-------------------------------------------------------------------------------- + // PresetLineDashVal 20.1.10.49 (Part 1) + //-------------------------------------------------------------------------------- + + EPresetLineDashVal CPresetLineDashVal::FromString(const std::wstring &sValue) + { + this->m_eValue = presetlinedashvalSolid; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'd': + if ( (L"dash") == sValue ) this->m_eValue = presetlinedashvalDash; + else if ( (L"dashDot") == sValue ) this->m_eValue = presetlinedashvalDashDot; + else if ( (L"dot") == sValue ) this->m_eValue = presetlinedashvalDot; + break; + case 'l': + if ( (L"lgDash") == sValue ) this->m_eValue = presetlinedashvalLgDash; + else if ( (L"lgDashDot") == sValue ) this->m_eValue = presetlinedashvalLgDashDot; + else if ( (L"lgDashDotDot") == sValue ) this->m_eValue = presetlinedashvalLgDashDotDot; + break; + case 's': + if ( (L"solid") == sValue ) this->m_eValue = presetlinedashvalSolid; + else if ( (L"sysDash") == sValue ) this->m_eValue = presetlinedashvalSysDash; + else if ( (L"sysDashDot") == sValue ) this->m_eValue = presetlinedashvalSysDashDot; + else if ( (L"sysDashDotDot") == sValue ) this->m_eValue = presetlinedashvalSysDashDotDot; + else if ( (L"sysDot") == sValue ) this->m_eValue = presetlinedashvalSysDot; + break; + } + + return this->m_eValue; + } + + std::wstring CPresetLineDashVal::ToString () const + { + switch(this->m_eValue) + { + case presetlinedashvalDash: return (L"dash"); + case presetlinedashvalDashDot: return (L"dashDot"); + case presetlinedashvalDot: return (L"dot"); + case presetlinedashvalLgDash: return (L"lgDash"); + case presetlinedashvalLgDashDot: return (L"lgDashDot"); + case presetlinedashvalLgDashDotDot: return (L"lgDashDotDot"); + case presetlinedashvalSolid: return (L"solid"); + case presetlinedashvalSysDash: return (L"sysDash"); + case presetlinedashvalSysDashDot: return (L"sysDashDot"); + case presetlinedashvalSysDashDotDot: return (L"sysDashDotDot"); + case presetlinedashvalSysDot: return (L"sysDot"); + default : return (L"solid"); + } + } + + //-------------------------------------------------------------------------------- + // PresetMaterialType 20.1.10.50 (Part 1) + //-------------------------------------------------------------------------------- + + EPresetMaterialType CPresetMaterialType::FromString(const std::wstring &sValue) + { + this->m_eValue = presetmaterialtypeClear; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( (L"clear") == sValue ) this->m_eValue = presetmaterialtypeClear; + break; + case 'd': + if ( (L"dkEdge") == sValue ) this->m_eValue = presetmaterialtypeDkEdge; + break; + case 'f': + if ( (L"flat") == sValue ) this->m_eValue = presetmaterialtypeFlat; + break; + case 'l': + if ( (L"legacyMatte") == sValue ) this->m_eValue = presetmaterialtypeLegacyMatte; + else if ( (L"legacyMetal") == sValue ) this->m_eValue = presetmaterialtypeLegacyMetal; + else if ( (L"legacyPlastic") == sValue ) this->m_eValue = presetmaterialtypeLegacyPlastic; + else if ( (L"legacyWireframe") == sValue ) this->m_eValue = presetmaterialtypeLegacyWireframe; + break; + case 'm': + if ( (L"matte") == sValue ) this->m_eValue = presetmaterialtypeMatte; + else if ( (L"metal") == sValue ) this->m_eValue = presetmaterialtypeMetal; + break; + case 'p': + if ( (L"plastic") == sValue ) this->m_eValue = presetmaterialtypePlastic; + else if ( (L"powder") == sValue ) this->m_eValue = presetmaterialtypePowder; + break; + case 's': + if ( (L"softEdge") == sValue ) this->m_eValue = presetmaterialtypeSoftEdge; + else if ( (L"softmetal") == sValue ) this->m_eValue = presetmaterialtypeSoftmetal; + break; + case 't': + if ( (L"translucentPowder") == sValue ) this->m_eValue = presetmaterialtypeTranslucentPowder; + break; + case 'w': + if ( (L"warmMatte") == sValue ) this->m_eValue = presetmaterialtypeWarmMatte; + break; + } + + return this->m_eValue; + } + + std::wstring CPresetMaterialType::ToString () const + { + switch(this->m_eValue) + { + case presetmaterialtypeClear : return (L"clear"); + case presetmaterialtypeDkEdge : return (L"dkEdge"); + case presetmaterialtypeFlat : return (L"flat"); + case presetmaterialtypeLegacyMatte : return (L"legacyMatte"); + case presetmaterialtypeLegacyMetal : return (L"legacyMetal"); + case presetmaterialtypeLegacyPlastic : return (L"legacyPlastic"); + case presetmaterialtypeLegacyWireframe : return (L"legacyWireframe"); + case presetmaterialtypeMatte : return (L"matte"); + case presetmaterialtypeMetal : return (L"metal"); + case presetmaterialtypePlastic : return (L"plastic"); + case presetmaterialtypePowder : return (L"powder"); + case presetmaterialtypeSoftEdge : return (L"softEdge"); + case presetmaterialtypeSoftmetal : return (L"softmetal"); + case presetmaterialtypeTranslucentPowder : return (L"translucentPowder"); + case presetmaterialtypeWarmMatte : return (L"warmMatte"); + default : return (L"clear"); + } + } + + //-------------------------------------------------------------------------------- + // PresetPatternVal 20.1.10.51 (Part 1) + //-------------------------------------------------------------------------------- + + EPresetPatternVal CPresetPatternVal::FromString(const std::wstring &sValue) + { + this->m_eValue = presetpatternvalPct10; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( (L"cross") == sValue ) this->m_eValue = presetpatternvalCross; + break; + case 'd': + if ( (L"dashDnDiag") == sValue ) this->m_eValue = presetpatternvalDashDnDiag; + else if ( (L"dashHorz") == sValue ) this->m_eValue = presetpatternvalDashHorz; + else if ( (L"dashUpDiag") == sValue ) this->m_eValue = presetpatternvalDashUpDiag; + else if ( (L"dashVert") == sValue ) this->m_eValue = presetpatternvalDashVert; + else if ( (L"diagBrick") == sValue ) this->m_eValue = presetpatternvalDiagBrick; + else if ( (L"diagCross") == sValue ) this->m_eValue = presetpatternvalDiagCross; + else if ( (L"divot") == sValue ) this->m_eValue = presetpatternvalDivot; + else if ( (L"dkDnDiag") == sValue ) this->m_eValue = presetpatternvalDkDnDiag; + else if ( (L"dkHorz") == sValue ) this->m_eValue = presetpatternvalDkHorz; + else if ( (L"dkUpDiag") == sValue ) this->m_eValue = presetpatternvalDkUpDiag; + else if ( (L"dkVert") == sValue ) this->m_eValue = presetpatternvalDkVert; + else if ( (L"dnDiag") == sValue ) this->m_eValue = presetpatternvalDnDiag; + else if ( (L"dotDmnd") == sValue ) this->m_eValue = presetpatternvalDotDmnd; + else if ( (L"dotGrid") == sValue ) this->m_eValue = presetpatternvalDotGrid; + break; + case 'h': + if ( (L"horz") == sValue ) this->m_eValue = presetpatternvalHorz; + else if ( (L"horzBrick") == sValue ) this->m_eValue = presetpatternvalHorzBrick; + break; + case 'l': + if ( (L"lgCheck") == sValue ) this->m_eValue = presetpatternvalLgCheck; + else if ( (L"lgConfetti") == sValue ) this->m_eValue = presetpatternvalLgConfetti; + else if ( (L"lgGrid") == sValue ) this->m_eValue = presetpatternvalLgGrid; + else if ( (L"ltDnDiag") == sValue ) this->m_eValue = presetpatternvalLtDnDiag; + else if ( (L"ltHorz") == sValue ) this->m_eValue = presetpatternvalLtHorz; + else if ( (L"ltUpDiag") == sValue ) this->m_eValue = presetpatternvalLtUpDiag; + else if ( (L"ltVert") == sValue ) this->m_eValue = presetpatternvalLtVert; + break; + case 'n': + if ( (L"narHorz") == sValue ) this->m_eValue = presetpatternvalNarHorz; + else if ( (L"narVert") == sValue ) this->m_eValue = presetpatternvalNarVert; + break; + case 'o': + if ( (L"openDmnd") == sValue ) this->m_eValue = presetpatternvalOpenDmnd; + break; + case 'p': + if ( (L"pct10") == sValue ) this->m_eValue = presetpatternvalPct10; + else if ( (L"pct20") == sValue ) this->m_eValue = presetpatternvalPct20; + else if ( (L"pct25") == sValue ) this->m_eValue = presetpatternvalPct25; + else if ( (L"pct30") == sValue ) this->m_eValue = presetpatternvalPct30; + else if ( (L"pct40") == sValue ) this->m_eValue = presetpatternvalPct40; + else if ( (L"pct5") == sValue ) this->m_eValue = presetpatternvalPct5; + else if ( (L"pct50") == sValue ) this->m_eValue = presetpatternvalPct50; + else if ( (L"pct60") == sValue ) this->m_eValue = presetpatternvalPct60; + else if ( (L"pct70") == sValue ) this->m_eValue = presetpatternvalPct70; + else if ( (L"pct75") == sValue ) this->m_eValue = presetpatternvalPct75; + else if ( (L"pct80") == sValue ) this->m_eValue = presetpatternvalPct80; + else if ( (L"pct90") == sValue ) this->m_eValue = presetpatternvalPct90; + else if ( (L"plaid") == sValue ) this->m_eValue = presetpatternvalPlaid; + break; + case 's': + if ( (L"shingle") == sValue ) this->m_eValue = presetpatternvalShingle; + else if ( (L"smCheck") == sValue ) this->m_eValue = presetpatternvalSmCheck; + else if ( (L"smConfetti") == sValue ) this->m_eValue = presetpatternvalSmConfetti; + else if ( (L"smGrid") == sValue ) this->m_eValue = presetpatternvalSmGrid; + else if ( (L"solidDmnd") == sValue ) this->m_eValue = presetpatternvalSolidDmnd; + else if ( (L"sphere") == sValue ) this->m_eValue = presetpatternvalSphere; + break; + case 't': + if ( (L"trellis") == sValue ) this->m_eValue = presetpatternvalTrellis; + break; + case 'u': + if ( (L"upDiag") == sValue ) this->m_eValue = presetpatternvalUpDiag; + break; + case 'v': + if ( (L"vert") == sValue ) this->m_eValue = presetpatternvalVert; + break; + case 'w': + if ( (L"wave") == sValue ) this->m_eValue = presetpatternvalWave; + else if ( (L"wdDnDiag") == sValue ) this->m_eValue = presetpatternvalWdDnDiag; + else if ( (L"wdUpDiag") == sValue ) this->m_eValue = presetpatternvalWdUpDiag; + else if ( (L"weave") == sValue ) this->m_eValue = presetpatternvalWeave; + break; + case 'z': + if ( (L"zigZag") == sValue ) this->m_eValue = presetpatternvalZigZag; + break; + } + + return this->m_eValue; + } + + std::wstring CPresetPatternVal::ToString () const + { + switch(this->m_eValue) + { + case presetpatternvalCross: return (L"cross"); + case presetpatternvalDashDnDiag: return (L"dashDnDiag"); + case presetpatternvalDashHorz: return (L"dashHorz"); + case presetpatternvalDashUpDiag: return (L"dashUpDiag"); + case presetpatternvalDashVert: return (L"dashVert"); + case presetpatternvalDiagBrick: return (L"diagBrick"); + case presetpatternvalDiagCross: return (L"diagCross"); + case presetpatternvalDivot: return (L"divot"); + case presetpatternvalDkDnDiag: return (L"dkDnDiag"); + case presetpatternvalDkHorz: return (L"dkHorz"); + case presetpatternvalDkUpDiag: return (L"dkUpDiag"); + case presetpatternvalDkVert: return (L"dkVert"); + case presetpatternvalDnDiag: return (L"dnDiag"); + case presetpatternvalDotDmnd: return (L"dotDmnd"); + case presetpatternvalDotGrid: return (L"dotGrid"); + case presetpatternvalHorz: return (L"horz"); + case presetpatternvalHorzBrick: return (L"horzBrick"); + case presetpatternvalLgCheck: return (L"lgCheck"); + case presetpatternvalLgConfetti: return (L"lgConfetti"); + case presetpatternvalLgGrid: return (L"lgGrid"); + case presetpatternvalLtDnDiag: return (L"ltDnDiag"); + case presetpatternvalLtHorz: return (L"ltHorz"); + case presetpatternvalLtUpDiag: return (L"ltUpDiag"); + case presetpatternvalLtVert: return (L"ltVert"); + case presetpatternvalNarHorz: return (L"narHorz"); + case presetpatternvalNarVert: return (L"narVert"); + case presetpatternvalOpenDmnd: return (L"openDmnd"); + case presetpatternvalPct10: return (L"pct10"); + case presetpatternvalPct20: return (L"pct20"); + case presetpatternvalPct25: return (L"pct25"); + case presetpatternvalPct30: return (L"pct30"); + case presetpatternvalPct40: return (L"pct40"); + case presetpatternvalPct5: return (L"pct5"); + case presetpatternvalPct50: return (L"pct50"); + case presetpatternvalPct60: return (L"pct60"); + case presetpatternvalPct70: return (L"pct70"); + case presetpatternvalPct75: return (L"pct75"); + case presetpatternvalPct80: return (L"pct80"); + case presetpatternvalPct90: return (L"pct90"); + case presetpatternvalPlaid: return (L"plaid"); + case presetpatternvalShingle: return (L"shingle"); + case presetpatternvalSmCheck: return (L"smCheck"); + case presetpatternvalSmConfetti: return (L"smConfetti"); + case presetpatternvalSmGrid: return (L"smGrid"); + case presetpatternvalSolidDmnd: return (L"solidDmnd"); + case presetpatternvalSphere: return (L"sphere"); + case presetpatternvalTrellis: return (L"trellis"); + case presetpatternvalUpDiag: return (L"upDiag"); + case presetpatternvalVert: return (L"vert"); + case presetpatternvalWave: return (L"wave"); + case presetpatternvalWdDnDiag: return (L"wdDnDiag"); + case presetpatternvalWdUpDiag: return (L"wdUpDiag"); + case presetpatternvalWeave: return (L"weave"); + case presetpatternvalZigZag: return (L"zigZag Zag"); + default : return (L"pct10"); + } + } + + //-------------------------------------------------------------------------------- + // PresetShadowVal 20.1.10.52 (Part 1) + //-------------------------------------------------------------------------------- + + EPresetShadowVal CPresetShadowVal::FromString(const std::wstring &sValue) + { + if ( (L"shdw1") == sValue ) this->m_eValue = presetshadowvalShdw1; + else if ( (L"shdw10") == sValue ) this->m_eValue = presetshadowvalShdw10; + else if ( (L"shdw11") == sValue ) this->m_eValue = presetshadowvalShdw11; + else if ( (L"shdw12") == sValue ) this->m_eValue = presetshadowvalShdw12; + else if ( (L"shdw13") == sValue ) this->m_eValue = presetshadowvalShdw13; + else if ( (L"shdw14") == sValue ) this->m_eValue = presetshadowvalShdw14; + else if ( (L"shdw15") == sValue ) this->m_eValue = presetshadowvalShdw15; + else if ( (L"shdw16") == sValue ) this->m_eValue = presetshadowvalShdw16; + else if ( (L"shdw17") == sValue ) this->m_eValue = presetshadowvalShdw17; + else if ( (L"shdw18") == sValue ) this->m_eValue = presetshadowvalShdw18; + else if ( (L"shdw19") == sValue ) this->m_eValue = presetshadowvalShdw19; + else if ( (L"shdw2") == sValue ) this->m_eValue = presetshadowvalShdw2; + else if ( (L"shdw20") == sValue ) this->m_eValue = presetshadowvalShdw20; + else if ( (L"shdw3") == sValue ) this->m_eValue = presetshadowvalShdw3; + else if ( (L"shdw4") == sValue ) this->m_eValue = presetshadowvalShdw4; + else if ( (L"shdw5") == sValue ) this->m_eValue = presetshadowvalShdw5; + else if ( (L"shdw6") == sValue ) this->m_eValue = presetshadowvalShdw6; + else if ( (L"shdw7") == sValue ) this->m_eValue = presetshadowvalShdw7; + else if ( (L"shdw8") == sValue ) this->m_eValue = presetshadowvalShdw8; + else if ( (L"shdw9") == sValue ) this->m_eValue = presetshadowvalShdw9; + else this->m_eValue = presetshadowvalShdw14; + + return this->m_eValue; + } + + std::wstring CPresetShadowVal::ToString () const + { + switch(this->m_eValue) + { + case presetshadowvalShdw1: return (L"shdw1"); + case presetshadowvalShdw2: return (L"shdw2"); + case presetshadowvalShdw3: return (L"shdw3"); + case presetshadowvalShdw4: return (L"shdw4"); + case presetshadowvalShdw5: return (L"shdw5"); + case presetshadowvalShdw6: return (L"shdw6"); + case presetshadowvalShdw7: return (L"shdw7"); + case presetshadowvalShdw8: return (L"shdw8"); + case presetshadowvalShdw9: return (L"shdw9"); + case presetshadowvalShdw10: return (L"shdw10"); + case presetshadowvalShdw11: return (L"shdw11"); + case presetshadowvalShdw12: return (L"shdw12"); + case presetshadowvalShdw13: return (L"shdw13"); + case presetshadowvalShdw14: return (L"shdw14"); + case presetshadowvalShdw15: return (L"shdw15"); + case presetshadowvalShdw16: return (L"shdw16"); + case presetshadowvalShdw17: return (L"shdw17"); + case presetshadowvalShdw18: return (L"shdw18"); + case presetshadowvalShdw19: return (L"shdw19"); + case presetshadowvalShdw20: return (L"shdw20"); + default : return (L"shdw14"); + } + } + + //-------------------------------------------------------------------------------- + // RectAlignment 20.1.10.53 (Part 1) + //-------------------------------------------------------------------------------- + + ERectAlignment CRectAlignment::FromString(const std::wstring &sValue) + { + if ( (L"b") == sValue ) this->m_eValue = rectalignmentB; + else if ( (L"bl") == sValue ) this->m_eValue = rectalignmentBL; + else if ( (L"br") == sValue ) this->m_eValue = rectalignmentBR; + else if ( (L"ctr") == sValue ) this->m_eValue = rectalignmentCtr; + else if ( (L"l") == sValue ) this->m_eValue = rectalignmentL; + else if ( (L"r") == sValue ) this->m_eValue = rectalignmentR; + else if ( (L"t") == sValue ) this->m_eValue = rectalignmentT; + else if ( (L"tl") == sValue ) this->m_eValue = rectalignmentTL; + else if ( (L"tr") == sValue ) this->m_eValue = rectalignmentTR; + else this->m_eValue = rectalignmentBL; + + return this->m_eValue; + } + + std::wstring CRectAlignment::ToString () const + { + switch(this->m_eValue) + { + case rectalignmentB : return (L"b"); + case rectalignmentBL : return (L"bl"); + case rectalignmentBR : return (L"br"); + case rectalignmentCtr: return (L"ctr"); + case rectalignmentL : return (L"l"); + case rectalignmentR : return (L"r"); + case rectalignmentT : return (L"t"); + case rectalignmentTL : return (L"tl"); + case rectalignmentTR : return (L"tr"); + default : return (L"bl"); + } + } + + //-------------------------------------------------------------------------------- + // ShemeColorVal 20.1.10.54 (Part 1) + //-------------------------------------------------------------------------------- + + EShemeColorVal CShemeColorVal::FromString(const std::wstring &sValue) + { + this->m_eValue = shemecolorvalAccent1; + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( (L"accent1") == sValue ) this->m_eValue = shemecolorvalAccent1; + else if ( (L"accent2") == sValue ) this->m_eValue = shemecolorvalAccent2; + else if ( (L"accent3") == sValue ) this->m_eValue = shemecolorvalAccent3; + else if ( (L"accent4") == sValue ) this->m_eValue = shemecolorvalAccent4; + else if ( (L"accent5") == sValue ) this->m_eValue = shemecolorvalAccent5; + else if ( (L"accent6") == sValue ) this->m_eValue = shemecolorvalAccent6; + break; + case 'b': + if ( (L"bg1") == sValue ) this->m_eValue = shemecolorvalBg1; + else if ( (L"bg2") == sValue ) this->m_eValue = shemecolorvalBg2; + break; + case 'd': + if ( (L"dk1") == sValue ) this->m_eValue = shemecolorvalDk1; + else if ( (L"dk2") == sValue ) this->m_eValue = shemecolorvalDk2; + break; + case 'f': + if ( (L"folHlink") == sValue ) this->m_eValue = shemecolorvalFolHlink; + break; + case 'h': + if ( (L"hlink") == sValue ) this->m_eValue = shemecolorvalHlink; + break; + case 'l': + if ( (L"lt1") == sValue ) this->m_eValue = shemecolorvalLt1; + else if ( (L"lt2") == sValue ) this->m_eValue = shemecolorvalLt2; + break; + case 'p': + if ( (L"phClr") == sValue ) this->m_eValue = shemecolorvalPhClr; + break; + case 't': + if ( (L"tx1") == sValue ) this->m_eValue = shemecolorvalTx1; + else if ( (L"tx2") == sValue ) this->m_eValue = shemecolorvalTx2; + break; + } + + return this->m_eValue; + } + + std::wstring CShemeColorVal::ToString () const + { + switch(this->m_eValue) + { + case shemecolorvalAccent1: return (L"accent1"); + case shemecolorvalAccent2: return (L"accent2"); + case shemecolorvalAccent3: return (L"accent3"); + case shemecolorvalAccent4: return (L"accent4"); + case shemecolorvalAccent5: return (L"accent5"); + case shemecolorvalAccent6: return (L"accent6"); + case shemecolorvalBg1: return (L"bg1"); + case shemecolorvalBg2: return (L"bg2"); + case shemecolorvalDk1: return (L"dk1"); + case shemecolorvalDk2: return (L"dk2"); + case shemecolorvalFolHlink: return (L"folHlink"); + case shemecolorvalHlink: return (L"hlink"); + case shemecolorvalLt1: return (L"lt1"); + case shemecolorvalLt2: return (L"lt2"); + case shemecolorvalPhClr: return (L"phClr"); + case shemecolorvalTx1: return (L"tx1"); + case shemecolorvalTx2: return (L"tx2"); + default : return (L"accent1"); + } + } + + //-------------------------------------------------------------------------------- + // ShapeType 20.1.10.56 (Part 1) + //-------------------------------------------------------------------------------- + + EShapeType CShapeType::FromString(const std::wstring &sValue) + { + this->m_eValue = shapetypeRect; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + + if ( (L"accentBorderCallout1") == sValue ) this->m_eValue = shapetypeAccentBorderCallout1; + else if ( (L"accentBorderCallout2") == sValue ) this->m_eValue = shapetypeAccentBorderCallout2; + else if ( (L"accentBorderCallout3") == sValue ) this->m_eValue = shapetypeAccentBorderCallout3; + else if ( (L"accentCallout1") == sValue ) this->m_eValue = shapetypeAccentCallout1; + else if ( (L"accentCallout2") == sValue ) this->m_eValue = shapetypeAccentCallout2; + else if ( (L"accentCallout3") == sValue ) this->m_eValue = shapetypeAccentCallout3; + else if ( (L"actionButtonBackPrevious")== sValue ) this->m_eValue = shapetypeActionButtonBackPrevious; + else if ( (L"actionButtonBeginning") == sValue ) this->m_eValue = shapetypeActionButtonBeginning; + else if ( (L"actionButtonBlank") == sValue ) this->m_eValue = shapetypeActionButtonBlank; + else if ( (L"actionButtonDocument") == sValue ) this->m_eValue = shapetypeActionButtonDocument; + else if ( (L"actionButtonEnd") == sValue ) this->m_eValue = shapetypeActionButtonEnd; + else if ( (L"actionButtonForwardNext") == sValue ) this->m_eValue = shapetypeActionButtonForwardNext; + else if ( (L"actionButtonHelp") == sValue ) this->m_eValue = shapetypeActionButtonHelp; + else if ( (L"actionButtonHome") == sValue ) this->m_eValue = shapetypeActionButtonHome; + else if ( (L"actionButtonInformation") == sValue ) this->m_eValue = shapetypeActionButtonInformation; + else if ( (L"actionButtonMovie") == sValue ) this->m_eValue = shapetypeActionButtonMovie; + else if ( (L"actionButtonReturn") == sValue ) this->m_eValue = shapetypeActionButtonReturn; + else if ( (L"actionButtonSound") == sValue ) this->m_eValue = shapetypeActionButtonSound; + else if ( (L"arc") == sValue ) this->m_eValue = shapetypeArc; + break; + + case 'b': + if ( (L"bentArrow") == sValue ) this->m_eValue = shapetypeBentArrow; + else if ( (L"bentConnector2") == sValue ) this->m_eValue = shapetypeBentConnector2; + else if ( (L"bentConnector3") == sValue ) this->m_eValue = shapetypeBentConnector3; + else if ( (L"bentConnector4") == sValue ) this->m_eValue = shapetypeBentConnector4; + else if ( (L"bentConnector5") == sValue ) this->m_eValue = shapetypeBentConnector5; + else if ( (L"bentUpArrow") == sValue ) this->m_eValue = shapetypeBentUpArrow; + else if ( (L"bevel") == sValue ) this->m_eValue = shapetypeBevel; + else if ( (L"blockArc") == sValue ) this->m_eValue = shapetypeBlockArc; + else if ( (L"borderCallout1") == sValue ) this->m_eValue = shapetypeBorderCallout1; + else if ( (L"borderCallout2") == sValue ) this->m_eValue = shapetypeBorderCallout2; + else if ( (L"borderCallout3") == sValue ) this->m_eValue = shapetypeBorderCallout3; + else if ( (L"bracePair") == sValue ) this->m_eValue = shapetypeBracePair; + else if ( (L"bracketPair") == sValue ) this->m_eValue = shapetypeBracketPair; + /////new + else if ( (L"Balloon") == sValue ) this->m_eValue = shapetypeBallon; + break; + + case 'c': + if ( (L"callout1") == sValue ) this->m_eValue = shapetypeCallout1; + else if ( (L"callout2") == sValue ) this->m_eValue = shapetypeCallout2; + else if ( (L"callout3") == sValue ) this->m_eValue = shapetypeCallout3; + else if ( (L"can") == sValue ) this->m_eValue = shapetypeCan; + else if ( (L"chartPlus") == sValue ) this->m_eValue = shapetypeChartPlus; + else if ( (L"chartStar") == sValue ) this->m_eValue = shapetypeChartStar; + else if ( (L"chartX") == sValue ) this->m_eValue = shapetypeChartX; + else if ( (L"chevron") == sValue ) this->m_eValue = shapetypeChevron; + else if ( (L"chord") == sValue ) this->m_eValue = shapetypeChord; + else if ( (L"circularArrow") == sValue ) this->m_eValue = shapetypeCircularArrow; + else if ( (L"cloud") == sValue ) this->m_eValue = shapetypeCloud; + else if ( (L"cloudCallout") == sValue ) this->m_eValue = shapetypeCloudCallout; + else if ( (L"corner") == sValue ) this->m_eValue = shapetypeCorner; + else if ( (L"cornerTabs") == sValue ) this->m_eValue = shapetypeCornerTabs; + else if ( (L"cube") == sValue ) this->m_eValue = shapetypeCube; + else if ( (L"curvedConnector2") == sValue ) this->m_eValue = shapetypeCurvedConnector2; + else if ( (L"curvedConnector3") == sValue ) this->m_eValue = shapetypeCurvedConnector3; + else if ( (L"curvedConnector4") == sValue ) this->m_eValue = shapetypeCurvedConnector4; + else if ( (L"curvedConnector5") == sValue ) this->m_eValue = shapetypeCurvedConnector5; + else if ( (L"curvedDownArrow") == sValue ) this->m_eValue = shapetypeCurvedDownArrow; + else if ( (L"curvedLeftArrow") == sValue ) this->m_eValue = shapetypeCurvedLeftArrow; + else if ( (L"curvedRightArrow") == sValue ) this->m_eValue = shapetypeCurvedRightArrow; + else if ( (L"curvedUpArrow") == sValue ) this->m_eValue = shapetypeCurvedUpArrow; + break; + + case 'd': + if ( (L"decagon") == sValue ) this->m_eValue = shapetypeDecagon; + else if ( (L"diagStripe") == sValue ) this->m_eValue = shapetypeDiagStripe; + else if ( (L"diamond") == sValue ) this->m_eValue = shapetypeDiamond; + else if ( (L"dodecagon") == sValue ) this->m_eValue = shapetypeDodecagon; + else if ( (L"donut") == sValue ) this->m_eValue = shapetypeDonut; + else if ( (L"doubleWave") == sValue ) this->m_eValue = shapetypeDoubleWave; + else if ( (L"downArrow") == sValue ) this->m_eValue = shapetypeDownArrow; + else if ( (L"downArrowCallout") == sValue ) this->m_eValue = shapetypeDownArrowCallout; + break; + + case 'e': + if ( (L"ellipse") == sValue ) this->m_eValue = shapetypeEllipse; + else if ( (L"ellipseRibbon") == sValue ) this->m_eValue = shapetypeEllipseRibbon; + else if ( (L"ellipseRibbon2") == sValue ) this->m_eValue = shapetypeEllipseRibbon2; + break; + + case 'f': + if ( (L"flowChartAlternateProcess") == sValue ) this->m_eValue = shapetypeFlowChartAlternateProcess; + else if ( (L"flowChartCollate") == sValue ) this->m_eValue = shapetypeFlowChartCollate; + else if ( (L"flowChartConnector") == sValue ) this->m_eValue = shapetypeFlowChartConnector; + else if ( (L"flowChartDecision") == sValue ) this->m_eValue = shapetypeFlowChartDecision; + else if ( (L"flowChartDelay") == sValue ) this->m_eValue = shapetypeFlowChartDelay; + else if ( (L"flowChartDisplay") == sValue ) this->m_eValue = shapetypeFlowChartDisplay; + else if ( (L"flowChartDocument") == sValue ) this->m_eValue = shapetypeFlowChartDocument; + else if ( (L"flowChartExtract") == sValue ) this->m_eValue = shapetypeFlowChartExtract; + else if ( (L"flowChartInputOutput") == sValue ) this->m_eValue = shapetypeFlowChartInputOutput; + else if ( (L"flowChartInternalStorage") == sValue ) this->m_eValue = shapetypeFlowChartInternalStorage; + else if ( (L"flowChartMagneticDisk") == sValue ) this->m_eValue = shapetypeFlowChartMagneticDisk; + else if ( (L"flowChartMagneticDrum") == sValue ) this->m_eValue = shapetypeFlowChartMagneticDrum; + else if ( (L"flowChartMagneticTape") == sValue ) this->m_eValue = shapetypeFlowChartMagneticTape; + else if ( (L"flowChartManualInput") == sValue ) this->m_eValue = shapetypeFlowChartManualInput; + else if ( (L"flowChartManualOperation") == sValue ) this->m_eValue = shapetypeFlowChartManualOperation; + else if ( (L"flowChartMerge") == sValue ) this->m_eValue = shapetypeFlowChartMerge; + else if ( (L"flowChartMultidocument") == sValue ) this->m_eValue = shapetypeFlowChartMultidocument; + else if ( (L"flowChartOfflineStorage") == sValue ) this->m_eValue = shapetypeFlowChartOfflineStorage; + else if ( (L"flowChartOffpageConnector") == sValue ) this->m_eValue = shapetypeFlowChartOffpageConnector; + else if ( (L"flowChartOnlineStorage") == sValue ) this->m_eValue = shapetypeFlowChartOnlineStorage; + else if ( (L"flowChartOr") == sValue ) this->m_eValue = shapetypeFlowChartOr; + else if ( (L"flowChartPredefinedProcess") == sValue ) this->m_eValue = shapetypeFlowChartPredefinedProcess; + else if ( (L"flowChartPreparation") == sValue ) this->m_eValue = shapetypeFlowChartPreparation; + else if ( (L"flowChartProcess") == sValue ) this->m_eValue = shapetypeFlowChartProcess; + else if ( (L"flowChartPunchedCard") == sValue ) this->m_eValue = shapetypeFlowChartPunchedCard; + else if ( (L"flowChartPunchedTape") == sValue ) this->m_eValue = shapetypeFlowChartPunchedTape; + else if ( (L"flowChartSort") == sValue ) this->m_eValue = shapetypeFlowChartSort; + else if ( (L"flowChartSummingJunction") == sValue ) this->m_eValue = shapetypeFlowChartSummingJunction; + else if ( (L"flowChartTerminator") == sValue ) this->m_eValue = shapetypeFlowChartTerminator; + else if ( (L"foldedCorner") == sValue ) this->m_eValue = shapetypeFoldedCorner; + else if ( (L"frame") == sValue ) this->m_eValue = shapetypeFrame; + else if ( (L"funnel") == sValue ) this->m_eValue = shapetypeFunnel; + break; + + case 'g': + if ( (L"gear6") == sValue ) this->m_eValue = shapetypeGear6; + else if ( (L"gear9") == sValue ) this->m_eValue = shapetypeGear9; + break; + + case 'h': + if ( (L"halfFrame") == sValue ) this->m_eValue = shapetypeHalfFrame; + else if ( (L"heart") == sValue ) this->m_eValue = shapetypeHeart; + else if ( (L"heptagon") == sValue ) this->m_eValue = shapetypeHeptagon; + else if ( (L"hexagon") == sValue ) this->m_eValue = shapetypeHexagon; + else if ( (L"homePlate") == sValue ) this->m_eValue = shapetypeHomePlate; + else if ( (L"horizontalScroll") == sValue ) this->m_eValue = shapetypeHorizontalScroll; + break; + + case 'i': + if ( (L"irregularSeal1") == sValue ) this->m_eValue = shapetypeIrregularSeal1; + else if ( (L"irregularSeal2") == sValue ) this->m_eValue = shapetypeIrregularSeal2; + break; + + case 'l': + if ( (L"leftArrow") == sValue ) this->m_eValue = shapetypeLeftArrow; + else if ( (L"leftArrowCallout") == sValue ) this->m_eValue = shapetypeLeftArrowCallout; + else if ( (L"leftBrace") == sValue ) this->m_eValue = shapetypeLeftBrace; + else if ( (L"leftBracket") == sValue ) this->m_eValue = shapetypeLeftBracket; + else if ( (L"leftCircularArrow") == sValue ) this->m_eValue = shapetypeLeftCircularArrow; + else if ( (L"leftRightArrow") == sValue ) this->m_eValue = shapetypeLeftRightArrow; + else if ( (L"leftRightArrowCallout") == sValue ) this->m_eValue = shapetypeLeftRightArrowCallout; + else if ( (L"leftRightCircularArrow") == sValue ) this->m_eValue = shapetypeLeftRightCircularArrow; + else if ( (L"leftRightRibbon") == sValue ) this->m_eValue = shapetypeLeftRightRibbon; + else if ( (L"leftRightUpArrow") == sValue ) this->m_eValue = shapetypeLeftRightUpArrow; + else if ( (L"leftUpArrow") == sValue ) this->m_eValue = shapetypeLeftUpArrow; + else if ( (L"lightningBolt") == sValue ) this->m_eValue = shapetypeLightningBolt; + else if ( (L"line") == sValue ) this->m_eValue = shapetypeLine; + else if ( (L"lineInv") == sValue ) this->m_eValue = shapetypeLineInv; + break; + + case 'm': + if ( (L"mathDivide") == sValue ) this->m_eValue = shapetypeMathDivide; + else if ( (L"mathEqual") == sValue ) this->m_eValue = shapetypeMathEqual; + else if ( (L"mathMinus") == sValue ) this->m_eValue = shapetypeMathMinus; + else if ( (L"mathMultiply") == sValue ) this->m_eValue = shapetypeMathMultiply; + else if ( (L"mathNotEqual") == sValue ) this->m_eValue = shapetypeMathNotEqual; + else if ( (L"mathPlus") == sValue ) this->m_eValue = shapetypeMathPlus; + else if ( (L"moon") == sValue ) this->m_eValue = shapetypeMoon; + break; + + case 'n': + if ( (L"nonIsoscelesTrapezoid") == sValue ) this->m_eValue = shapetypeNonIsoscelesTrapezoid; + else if ( (L"noSmoking") == sValue ) this->m_eValue = shapetypeNoSmoking; + else if ( (L"notchedRightArrow") == sValue ) this->m_eValue = shapetypeNotchedRightArrow; + break; + + case 'o': + if ( (L"octagon") == sValue ) this->m_eValue = shapetypeOctagon; + break; + + case 'p': + if ( (L"parallelogram") == sValue ) this->m_eValue = shapetypeParallelogram; + else if ( (L"pentagon") == sValue ) this->m_eValue = shapetypePentagon; + else if ( (L"pie") == sValue ) this->m_eValue = shapetypePie; + else if ( (L"pieWedge") == sValue ) this->m_eValue = shapetypePieWedge; + else if ( (L"plaque") == sValue ) this->m_eValue = shapetypePlaque; + else if ( (L"plaqueTabs") == sValue ) this->m_eValue = shapetypePlaqueTabs; + else if ( (L"plus") == sValue ) this->m_eValue = shapetypePlus; + break; + + case 'q': + if ( (L"quadArrow") == sValue ) this->m_eValue = shapetypeQuadArrow; + else if ( (L"quadArrowCallout") == sValue ) this->m_eValue = shapetypeQuadArrowCallout; + break; + + case 'r': + if ( (L"rect") == sValue ) this->m_eValue = shapetypeRect; + else if ( (L"ribbon") == sValue ) this->m_eValue = shapetypeRibbon; + else if ( (L"ribbon2") == sValue ) this->m_eValue = shapetypeRibbon2; + else if ( (L"rightArrow") == sValue ) this->m_eValue = shapetypeRightArrow; + else if ( (L"rightArrowCallout") == sValue ) this->m_eValue = shapetypeRightArrowCallout; + else if ( (L"rightBrace") == sValue ) this->m_eValue = shapetypeRightBrace; + else if ( (L"rightBracket") == sValue ) this->m_eValue = shapetypeRightBracket; + else if ( (L"round1Rect") == sValue ) this->m_eValue = shapetypeRound1Rect; + else if ( (L"round2DiagRect") == sValue ) this->m_eValue = shapetypeRound2DiagRect; + else if ( (L"round2SameRect") == sValue ) this->m_eValue = shapetypeRound2SameRect; + else if ( (L"roundRect") == sValue ) this->m_eValue = shapetypeRoundRect; + else if ( (L"rtTriangle") == sValue ) this->m_eValue = shapetypeRtTriangle; + ////new + else if ( (L"rightUpArrow") == sValue ) this->m_eValue = shapetypeRightUpArrow; + break; + + case 's': + if ( (L"smileyFace") == sValue ) this->m_eValue = shapetypeSmileyFace; + else if ( (L"snip1Rect") == sValue ) this->m_eValue = shapetypeSnip1Rect; + else if ( (L"snip2DiagRect") == sValue ) this->m_eValue = shapetypeSnip2DiagRect; + else if ( (L"snip2SameRect") == sValue ) this->m_eValue = shapetypeSnip2SameRect; + else if ( (L"snipRoundRect") == sValue ) this->m_eValue = shapetypeSnipRoundRect; + else if ( (L"squareTabs") == sValue ) this->m_eValue = shapetypeSquareTabs; + else if ( (L"star10") == sValue ) this->m_eValue = shapetypeStar10; + else if ( (L"star12") == sValue ) this->m_eValue = shapetypeStar12; + else if ( (L"star16") == sValue ) this->m_eValue = shapetypeStar16; + else if ( (L"star24") == sValue ) this->m_eValue = shapetypeStar24; + else if ( (L"star32") == sValue ) this->m_eValue = shapetypeStar32; + else if ( (L"star4") == sValue ) this->m_eValue = shapetypeStar4; + else if ( (L"star5") == sValue ) this->m_eValue = shapetypeStar5; + else if ( (L"star6") == sValue ) this->m_eValue = shapetypeStar6; + else if ( (L"star7") == sValue ) this->m_eValue = shapetypeStar7; + else if ( (L"star8") == sValue ) this->m_eValue = shapetypeStar8; + else if ( (L"straightConnector1") == sValue ) this->m_eValue = shapetypeStraightConnector1; + else if ( (L"stripedRightArrow") == sValue ) this->m_eValue = shapetypeStripedRightArrow; + else if ( (L"sun") == sValue ) this->m_eValue = shapetypeSun; + else if ( (L"swooshArrow") == sValue ) this->m_eValue = shapetypeSwooshArrow; + break; + + case 't': + if ( (L"teardrop") == sValue ) this->m_eValue = shapetypeTeardrop; + else if ( (L"trapezoid") == sValue ) this->m_eValue = shapetypeTrapezoid; + else if ( (L"triangle") == sValue ) this->m_eValue = shapetypeTriangle; + /////new + else if ( (L"textArchDownPour") == sValue ) this->m_eValue = shapetypeTextArchDownPour; + else if ( (L"textArchUpPour") == sValue ) this->m_eValue = shapetypeTextArchUpPour; + else if ( (L"textCanDown") == sValue ) this->m_eValue = shapetypeTextCanDown; + else if ( (L"textCanUp") == sValue ) this->m_eValue = shapetypeTextCanUp; + else if ( (L"textCirclePour") == sValue ) this->m_eValue = shapetypeTextCirclePour; + else if ( (L"textCurveDown") == sValue ) this->m_eValue = shapetypeTextCurveDown; + else if ( (L"textCurveUp") == sValue ) this->m_eValue = shapetypeTextCurveUp; + else if ( (L"textDeflate") == sValue ) this->m_eValue = shapetypeTextDeflate; + else if ( (L"textDeflateBottom") == sValue ) this->m_eValue = shapetypeTextDeflateBottom; + else if ( (L"textDeflateInflate") == sValue ) this->m_eValue = shapetypeTextDeflateInflate; + else if ( (L"textDeflateInflateDeflate") == sValue ) this->m_eValue = shapetypeTextDeflateInflateDeflat; + else if ( (L"textDeflateTop") == sValue ) this->m_eValue = shapetypeTextDeflateTop; + else if ( (L"textDoubleWave1") == sValue ) this->m_eValue = shapetypeTextDoubleWave1; + else if ( (L"textFadeDown") == sValue ) this->m_eValue = shapetypeTextFadeDown; + else if ( (L"textFadeLeft") == sValue ) this->m_eValue = shapetypeTextFadeLeft; + else if ( (L"textFadeRight") == sValue ) this->m_eValue = shapetypeTextFadeRight; + else if ( (L"textFadeUp") == sValue ) this->m_eValue = shapetypeTextFadeUp; + else if ( (L"textInflateBottom") == sValue ) this->m_eValue = shapetypeTextInflateBottom; + else if ( (L"textInflateTop") == sValue ) this->m_eValue = shapetypeTextInflateTop; + else if ( (L"textRingInside") == sValue ) this->m_eValue = shapetypeTextRingInside; + else if ( (L"textRingOutside") == sValue ) this->m_eValue = shapetypeTextRingOutside; + else if ( (L"textWave1") == sValue ) this->m_eValue = shapetypeTextWave1; + else if ( (L"textWave2") == sValue ) this->m_eValue = shapetypeTextWave2; + else if ( (L"textWave4") == sValue ) this->m_eValue = shapetypeTextWave4; + else if ( (L"thickArrow") == sValue ) this->m_eValue = shapetypeThickArrow; + break; + case 'u': + if ( (L"upArrow") == sValue ) this->m_eValue = shapetypeUpArrow; + else if ( (L"upArrowCallout") == sValue ) this->m_eValue = shapetypeUpArrowCallout; + else if ( (L"upDownArrow") == sValue ) this->m_eValue = shapetypeUpDownArrow; + else if ( (L"upDownArrowCallout") == sValue ) this->m_eValue = shapetypeUpDownArrowCallout; + else if ( (L"uturnArrow") == sValue ) this->m_eValue = shapetypeUturnArrow; + break; + + case 'v': + if ( (L"verticalScroll") == sValue ) this->m_eValue = shapetypeVerticalScroll; + break; + + case 'w': + if ( (L"wave") == sValue ) this->m_eValue = shapetypeWave; + else if ( (L"wedgeEllipseCallout") == sValue ) this->m_eValue = shapetypeWedgeEllipseCallout; + else if ( (L"wedgeRectCallout") == sValue ) this->m_eValue = shapetypeWedgeRectCallout; + else if ( (L"wedgeRoundRectCallout") == sValue ) this->m_eValue = shapetypeWedgeRoundRectCallout; + break; + } + + return this->m_eValue; + } + + std::wstring CShapeType::ToString () const + { + switch(this->m_eValue) + { + case shapetypeAccentBorderCallout1: return (L"accentBorderCallout1"); + case shapetypeAccentBorderCallout2: return (L"accentBorderCallout2"); + case shapetypeAccentBorderCallout3: return (L"accentBorderCallout3"); + case shapetypeAccentCallout1: return (L"accentCallout1"); + case shapetypeAccentCallout2: return (L"accentCallout2"); + case shapetypeAccentCallout3: return (L"accentCallout3"); + case shapetypeActionButtonBackPrevious: return (L"actionButtonBackPrevious"); + case shapetypeActionButtonBeginning: return (L"actionButtonBeginning"); + case shapetypeActionButtonBlank: return (L"actionButtonBlank"); + case shapetypeActionButtonDocument: return (L"actionButtonDocument"); + case shapetypeActionButtonEnd: return (L"actionButtonEnd"); + case shapetypeActionButtonForwardNext: return (L"actionButtonForwardNext"); + case shapetypeActionButtonHelp: return (L"actionButtonHelp"); + case shapetypeActionButtonHome: return (L"actionButtonHome"); + case shapetypeActionButtonInformation: return (L"actionButtonInformation"); + case shapetypeActionButtonMovie: return (L"actionButtonMovie"); + case shapetypeActionButtonReturn: return (L"actionButtonReturn"); + case shapetypeActionButtonSound: return (L"actionButtonSound"); + case shapetypeArc: return (L"arc"); + case shapetypeBentArrow: return (L"bentArrow"); + case shapetypeBentConnector2: return (L"bentConnector2"); + case shapetypeBentConnector3: return (L"bentConnector3"); + case shapetypeBentConnector4: return (L"bentConnector4"); + case shapetypeBentConnector5: return (L"bentConnector5"); + case shapetypeBentUpArrow: return (L"bentUpArrow"); + case shapetypeBevel: return (L"bevel"); + case shapetypeBlockArc: return (L"blockArc"); + case shapetypeBorderCallout1: return (L"borderCallout1"); + case shapetypeBorderCallout2: return (L"borderCallout2"); + case shapetypeBorderCallout3: return (L"borderCallout3"); + case shapetypeBracePair: return (L"bracePair"); + case shapetypeBracketPair: return (L"bracketPair"); + case shapetypeCallout1: return (L"callout1"); + case shapetypeCallout2: return (L"callout2"); + case shapetypeCallout3: return (L"callout3"); + case shapetypeCan: return (L"can"); + case shapetypeChartPlus: return (L"chartPlus"); + case shapetypeChartStar: return (L"chartStar"); + case shapetypeChartX: return (L"chartX"); + case shapetypeChevron: return (L"chevron"); + case shapetypeChord: return (L"chord"); + case shapetypeCircularArrow: return (L"circularArrow"); + case shapetypeCloud: return (L"cloud"); + case shapetypeCloudCallout: return (L"cloudCallout"); + case shapetypeCorner: return (L"corner"); + case shapetypeCornerTabs: return (L"cornerTabs"); + case shapetypeCube: return (L"cube"); + case shapetypeCurvedConnector2: return (L"curvedConnector2"); + case shapetypeCurvedConnector3: return (L"curvedConnector3"); + case shapetypeCurvedConnector4: return (L"curvedConnector4"); + case shapetypeCurvedConnector5: return (L"curvedConnector5"); + case shapetypeCurvedDownArrow: return (L"curvedDownArrow"); + case shapetypeCurvedLeftArrow: return (L"curvedLeftArrow"); + case shapetypeCurvedRightArrow: return (L"curvedRightArrow"); + case shapetypeCurvedUpArrow: return (L"curvedUpArrow"); + case shapetypeDecagon: return (L"decagon"); + case shapetypeDiagStripe: return (L"diagStripe"); + case shapetypeDiamond: return (L"diamond"); + case shapetypeDodecagon: return (L"dodecagon"); + case shapetypeDonut: return (L"donut"); + case shapetypeDoubleWave: return (L"doubleWave"); + case shapetypeDownArrow: return (L"downArrow"); + case shapetypeDownArrowCallout: return (L"downArrowCallout"); + case shapetypeEllipse: return (L"ellipse"); + case shapetypeEllipseRibbon: return (L"ellipseRibbon"); + case shapetypeEllipseRibbon2: return (L"ellipseRibbon2"); + case shapetypeFlowChartAlternateProcess: return (L"flowChartAlternateProcess"); + case shapetypeFlowChartCollate: return (L"flowChartCollate"); + case shapetypeFlowChartConnector: return (L"flowChartConnector"); + case shapetypeFlowChartDecision: return (L"flowChartDecision"); + case shapetypeFlowChartDelay: return (L"flowChartDelay"); + case shapetypeFlowChartDisplay: return (L"flowChartDisplay"); + case shapetypeFlowChartDocument: return (L"flowChartDocument"); + case shapetypeFlowChartExtract: return (L"flowChartExtract"); + case shapetypeFlowChartInputOutput: return (L"flowChartInputOutput"); + case shapetypeFlowChartInternalStorage: return (L"flowChartInternalStorage"); + case shapetypeFlowChartMagneticDisk: return (L"flowChartMagneticDisk"); + case shapetypeFlowChartMagneticDrum: return (L"flowChartMagneticDrum"); + case shapetypeFlowChartMagneticTape: return (L"flowChartMagneticTape"); + case shapetypeFlowChartManualInput: return (L"flowChartManualInput"); + case shapetypeFlowChartManualOperation: return (L"flowChartManualOperation"); + case shapetypeFlowChartMerge: return (L"flowChartMerge"); + case shapetypeFlowChartMultidocument: return (L"flowChartMultidocument"); + case shapetypeFlowChartOfflineStorage: return (L"flowChartOfflineStorage"); + case shapetypeFlowChartOffpageConnector: return (L"flowChartOffpageConnector"); + case shapetypeFlowChartOnlineStorage: return (L"flowChartOnlineStorage"); + case shapetypeFlowChartOr: return (L"flowChartOr"); + case shapetypeFlowChartPredefinedProcess: return (L"flowChartPredefinedProcess"); + case shapetypeFlowChartPreparation: return (L"flowChartPreparation"); + case shapetypeFlowChartProcess: return (L"flowChartProcess"); + case shapetypeFlowChartPunchedCard: return (L"flowChartPunchedCard"); + case shapetypeFlowChartPunchedTape: return (L"flowChartPunchedTape"); + case shapetypeFlowChartSort: return (L"flowChartSort"); + case shapetypeFlowChartSummingJunction: return (L"flowChartSummingJunction"); + case shapetypeFlowChartTerminator: return (L"flowChartTerminator"); + case shapetypeFoldedCorner: return (L"foldedCorner"); + case shapetypeFrame: return (L"frame"); + case shapetypeFunnel: return (L"funnel"); + case shapetypeGear6: return (L"gear6"); + case shapetypeGear9: return (L"gear9"); + case shapetypeHalfFrame: return (L"halfFrame"); + case shapetypeHeart: return (L"heart"); + case shapetypeHeptagon: return (L"heptagon"); + case shapetypeHexagon: return (L"hexagon"); + case shapetypeHomePlate: return (L"homePlate"); + case shapetypeHorizontalScroll: return (L"horizontalScroll"); + case shapetypeIrregularSeal1: return (L"irregularSeal1"); + case shapetypeIrregularSeal2: return (L"irregularSeal2"); + case shapetypeLeftArrow: return (L"leftArrow"); + case shapetypeLeftArrowCallout: return (L"leftArrowCallout"); + case shapetypeLeftBrace: return (L"leftBrace"); + case shapetypeLeftBracket: return (L"leftBracket"); + case shapetypeLeftCircularArrow: return (L"leftCircularArrow"); + case shapetypeLeftRightArrow: return (L"leftRightArrow"); + case shapetypeLeftRightArrowCallout: return (L"leftRightArrowCallout"); + case shapetypeLeftRightCircularArrow: return (L"leftRightCircularArrow"); + case shapetypeLeftRightRibbon: return (L"leftRightRibbon"); + case shapetypeLeftRightUpArrow: return (L"leftRightUpArrow"); + case shapetypeLeftUpArrow: return (L"leftUpArrow"); + case shapetypeLightningBolt: return (L"lightningBolt"); + case shapetypeLine: return (L"line"); + case shapetypeLineInv: return (L"lineInv"); + case shapetypeMathDivide: return (L"mathDivide"); + case shapetypeMathEqual: return (L"mathEqual"); + case shapetypeMathMinus: return (L"mathMinus"); + case shapetypeMathMultiply: return (L"mathMultiply"); + case shapetypeMathNotEqual: return (L"mathNotEqual"); + case shapetypeMathPlus: return (L"mathPlus"); + case shapetypeMoon: return (L"moon"); + case shapetypeNonIsoscelesTrapezoid: return (L"nonIsoscelesTrapezoid"); + case shapetypeNoSmoking: return (L"noSmoking"); + case shapetypeNotchedRightArrow: return (L"notchedRightArrow"); + case shapetypeOctagon: return (L"octagon"); + case shapetypeParallelogram: return (L"parallelogram"); + case shapetypePentagon: return (L"pentagon"); + case shapetypePie: return (L"pie"); + case shapetypePieWedge: return (L"pieWedge"); + case shapetypePlaque: return (L"plaque"); + case shapetypePlaqueTabs: return (L"plaqueTabs"); + case shapetypePlus: return (L"plus"); + case shapetypeQuadArrow: return (L"quadArrow"); + case shapetypeQuadArrowCallout: return (L"quadArrowCallout"); + case shapetypeRect: return (L"rect"); + case shapetypeRibbon: return (L"ribbon"); + case shapetypeRibbon2: return (L"ribbon2"); + case shapetypeRightArrow: return (L"rightArrow"); + case shapetypeRightArrowCallout: return (L"rightArrowCallout"); + case shapetypeRightBrace: return (L"rightBrace"); + case shapetypeRightBracket: return (L"rightBracket"); + case shapetypeRound1Rect: return (L"round1Rect"); + case shapetypeRound2DiagRect: return (L"round2DiagRect"); + case shapetypeRound2SameRect: return (L"round2SameRect"); + case shapetypeRoundRect: return (L"roundRect"); + case shapetypeRtTriangle: return (L"rtTriangle"); + case shapetypeSmileyFace: return (L"smileyFace"); + case shapetypeSnip1Rect: return (L"snip1Rect"); + case shapetypeSnip2DiagRect: return (L"snip2DiagRect"); + case shapetypeSnip2SameRect: return (L"snip2SameRect"); + case shapetypeSnipRoundRect: return (L"snipRoundRect"); + case shapetypeSquareTabs: return (L"squareTabs"); + case shapetypeStar10: return (L"star10"); + case shapetypeStar12: return (L"star12"); + case shapetypeStar16: return (L"star16"); + case shapetypeStar24: return (L"star24"); + case shapetypeStar32: return (L"star32"); + case shapetypeStar4: return (L"star4"); + case shapetypeStar5: return (L"star5"); + case shapetypeStar6: return (L"star6"); + case shapetypeStar7: return (L"star7"); + case shapetypeStar8: return (L"star8"); + case shapetypeStraightConnector1: return (L"straightConnector1"); + case shapetypeStripedRightArrow: return (L"stripedRightArrow"); + case shapetypeSun: return (L"sun"); + case shapetypeSwooshArrow: return (L"swooshArrow"); + case shapetypeTeardrop: return (L"teardrop"); + case shapetypeTrapezoid: return (L"trapezoid"); + case shapetypeTriangle: return (L"triangle"); + case shapetypeUpArrow: return (L"upArrow"); + case shapetypeUpArrowCallout: return (L"upArrowCallout"); + case shapetypeUpDownArrow: return (L"upDownArrow"); + case shapetypeUpDownArrowCallout: return (L"upDownArrowCallout"); + case shapetypeUturnArrow: return (L"uturnArrow"); + case shapetypeVerticalScroll: return (L"verticalScroll"); + case shapetypeWave: return (L"wave"); + case shapetypeWedgeEllipseCallout: return (L"wedgeEllipseCallout"); + case shapetypeWedgeRectCallout: return (L"wedgeRectCallout"); + case shapetypeWedgeRoundRectCallout: return (L"wedgeRoundRectCallout"); + ///new// + case shapetypeBallon: return (L"Balloon"); + case shapetypeRightUpArrow: return (L"rightUpArrow"); + case shapetypeTextArchDownPour: return (L"textArchDownPour"); + case shapetypeTextArchUpPour: return (L"textArchUpPour"); + case shapetypeTextCanDown: return (L"textCanDown"); + case shapetypeTextCanUp: return (L"textCanUp"); + case shapetypeTextCirclePour: return (L"textCirclePour"); + case shapetypeTextCurveDown: return (L"textCurveDown"); + case shapetypeTextCurveUp: return (L"textCurveUp"); + case shapetypeTextDeflate: return (L"textDeflate"); + case shapetypeTextDeflateBottom: return (L"textDeflateBottom"); + case shapetypeTextDeflateInflate: return (L"textDeflateInflate"); + case shapetypeTextDeflateInflateDeflat: return (L"textDeflateInflateDeflate"); + case shapetypeTextDeflateTop: return (L"textDeflateTop"); + case shapetypeTextDoubleWave1: return (L"textDoubleWave1"); + case shapetypeTextFadeDown: return (L"textFadeDown"); + case shapetypeTextFadeLeft: return (L"textFadeLeft"); + case shapetypeTextFadeRight: return (L"textFadeRight"); + case shapetypeTextFadeUp: return (L"textFadeUp"); + case shapetypeTextInflateBottom: return (L"textInflateBottom"); + case shapetypeTextInflateTop: return (L"textInflateTop"); + case shapetypeTextRingInside: return (L"textRingInside"); + case shapetypeTextRingOutside: return (L"textRingOutside"); + case shapetypeTextWave1: return (L"textWave1"); + case shapetypeTextWave2: return (L"textWave2"); + case shapetypeTextWave4: return (L"textWave4"); + case shapetypeThickArrow: return (L"thickArrow"); + + default : return (L"rect"); + } + } + + //-------------------------------------------------------------------------------- + // SystemColorVal 20.1.10.58 (Part 1) (included from ASCWinAPI.h) + //-------------------------------------------------------------------------------- + + void CSystemColorVal::SetRGBASys(int nIndex) + { + DWORD dwRGB = GetSysColor(nIndex); + + m_unB = static_cast(dwRGB & 0xFF); + m_unG = static_cast((dwRGB & 0xFF00)>>8); + m_unR = static_cast((dwRGB & 0xFF0000)>>16); + m_unA = 255; + } + + void CSystemColorVal::SetRGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA) + { + m_unR = unR; + m_unG = unG; + m_unB = unB; + m_unA = unA; + } + + ESystemColorVal CSystemColorVal::FromString(const std::wstring &sValue) + { + this->m_eValue = systemcolorvalWindow; + SetRGBA( 0, 0, 0, 255 ); + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case '3': + if ( (L"3dDkShadow") == sValue ) { this->m_eValue = systemcolorval3dDkShadow; SetRGBASys( COLOR_3DDKSHADOW ); } + else if ( (L"3dLight") == sValue ) { this->m_eValue = systemcolorval3dLight; SetRGBASys( COLOR_3DLIGHT ); } + break; + case 'a': + if ( (L"activeBorder") == sValue ) { this->m_eValue = systemcolorvalActiveBorder; SetRGBASys( COLOR_ACTIVEBORDER ); } + else if ( (L"activeCaption") == sValue ) { this->m_eValue = systemcolorvalActiveCaption; SetRGBASys( COLOR_ACTIVECAPTION ); } + else if ( (L"appWorkspace") == sValue ) { this->m_eValue = systemcolorvalAppWorkspace; SetRGBASys( COLOR_APPWORKSPACE ); } + break; + case 'b': + if ( (L"background") == sValue ) { this->m_eValue = systemcolorvalBackground; SetRGBASys( COLOR_BACKGROUND ); } + else if ( (L"btnFace") == sValue ) { this->m_eValue = systemcolorvalBtnFace ; SetRGBASys( COLOR_BTNFACE ); } + else if ( (L"btnHighlight") == sValue ) { this->m_eValue = systemcolorvalBtnHighlight ; SetRGBASys( COLOR_BTNHIGHLIGHT ); } + else if ( (L"btnShadow") == sValue ) { this->m_eValue = systemcolorvalBtnShadow ; SetRGBASys( COLOR_BTNSHADOW ); } + else if ( (L"btnText") == sValue ) { this->m_eValue = systemcolorvalBtnText ; SetRGBASys( COLOR_BTNTEXT ); } + break; + case 'c': + if ( (L"captionText") == sValue ) { this->m_eValue = systemcolorvalCaptionText ; SetRGBASys( COLOR_CAPTIONTEXT ); } + break; + case 'g': + if ( (L"gradientActiveCaption") == sValue ) { this->m_eValue = systemcolorvalGradientActiveCaption ; SetRGBASys( COLOR_GRADIENTACTIVECAPTION ); } + else if ( (L"gradientInactiveCaption") == sValue ) { this->m_eValue = systemcolorvalGradientInactiveCaption ; SetRGBASys( COLOR_GRADIENTINACTIVECAPTION ); } + else if ( (L"grayText") == sValue ) { this->m_eValue = systemcolorvalGrayText ; SetRGBASys( COLOR_GRAYTEXT ); } + break; + case 'h': + if ( (L"highlight") == sValue ) { this->m_eValue = systemcolorvalHighlight ; SetRGBASys( COLOR_HIGHLIGHT ); } + else if ( (L"highlightText") == sValue ) { this->m_eValue = systemcolorvalHighlightText ; SetRGBASys( COLOR_HIGHLIGHTTEXT ); } + else if ( (L"hotLight") == sValue ) { this->m_eValue = systemcolorvalHotLight ; SetRGBASys( COLOR_HOTLIGHT ); } + break; + case 'i': + if ( (L"inactiveBorder") == sValue ) { this->m_eValue = systemcolorvalInactiveBorder ; SetRGBASys( COLOR_INACTIVEBORDER ); } + else if ( (L"inactiveCaption") == sValue ) { this->m_eValue = systemcolorvalInactiveCaption ; SetRGBASys( COLOR_INACTIVECAPTION ); } + else if ( (L"inactiveCaptionText") == sValue ) { this->m_eValue = systemcolorvalInactiveCaptionText ; SetRGBASys( COLOR_INACTIVECAPTIONTEXT ); } + else if ( (L"infoBk") == sValue ) { this->m_eValue = systemcolorvalInfoBk ; SetRGBASys( COLOR_INFOBK ); } + else if ( (L"infoText") == sValue ) { this->m_eValue = systemcolorvalInfoText ; SetRGBASys( COLOR_INFOTEXT ); } + break; + case 'm': + if ( (L"menu") == sValue ) { this->m_eValue = systemcolorvalMenu ; SetRGBASys( COLOR_MENU ); } + else if ( (L"menuBar") == sValue ) { this->m_eValue = systemcolorvalMenuBar ; SetRGBASys( COLOR_MENUBAR ); } + else if ( (L"menuHighlight") == sValue ) { this->m_eValue = systemcolorvalMenuHighlight ; SetRGBASys( COLOR_MENUHILIGHT ); } + else if ( (L"menuText") == sValue ) { this->m_eValue = systemcolorvalMenuText ; SetRGBASys( COLOR_MENUTEXT ); } + break; + case 's': + if ( (L"scrollBar") == sValue ) { this->m_eValue = systemcolorvalScrollBar ; SetRGBASys( COLOR_SCROLLBAR ); } + break; + case 'w': + if ( (L"window") == sValue ) { this->m_eValue = systemcolorvalWindow ; SetRGBASys( COLOR_WINDOW ); } + else if ( (L"windowFrame") == sValue ) { this->m_eValue = systemcolorvalWindowFrame ; SetRGBASys( COLOR_WINDOWFRAME ); } + else if ( (L"windowText") == sValue ) { this->m_eValue = systemcolorvalWindowText ; SetRGBASys( COLOR_WINDOWTEXT ); } + break; + } + + return this->m_eValue; + } + + std::wstring CSystemColorVal::ToString () const + { + switch(this->m_eValue) + { + case systemcolorval3dDkShadow: return (L"3dDkShadow"); + case systemcolorval3dLight: return (L"3dLight"); + case systemcolorvalActiveBorder: return (L"activeBorder"); + case systemcolorvalActiveCaption: return (L"activeCaption"); + case systemcolorvalAppWorkspace: return (L"appWorkspace"); + case systemcolorvalBackground: return (L"background"); + case systemcolorvalBtnFace: return (L"btnFace"); + case systemcolorvalBtnHighlight: return (L"btnHighlight"); + case systemcolorvalBtnShadow: return (L"btnShadow"); + case systemcolorvalBtnText: return (L"btnText"); + case systemcolorvalCaptionText: return (L"captionText"); + case systemcolorvalGradientActiveCaption: return (L"gradientActiveCaption"); + case systemcolorvalGradientInactiveCaption: return (L"gradientInactiveCaption"); + case systemcolorvalGrayText: return (L"grayText"); + case systemcolorvalHighlight: return (L"highlight"); + case systemcolorvalHighlightText: return (L"highlightText"); + case systemcolorvalHotLight: return (L"hotLight"); + case systemcolorvalInactiveBorder: return (L"inactiveBorder"); + case systemcolorvalInactiveCaption: return (L"inactiveCaption"); + case systemcolorvalInactiveCaptionText: return (L"inactiveCaptionText"); + case systemcolorvalInfoBk: return (L"infoBk"); + case systemcolorvalInfoText: return (L"infoText"); + case systemcolorvalMenu: return (L"menu"); + case systemcolorvalMenuBar: return (L"menuBar"); + case systemcolorvalMenuHighlight: return (L"menuHighlight"); + case systemcolorvalMenuText: return (L"menuText"); + case systemcolorvalScrollBar: return (L"scrollBar"); + case systemcolorvalWindow: return (L"window"); + case systemcolorvalWindowFrame: return (L"windowFrame"); + case systemcolorvalWindowText: return (L"windowText"); + default : return (L"window"); + } + } + + unsigned char CSystemColorVal::Get_R() const + { + return m_unR; + } + + unsigned char CSystemColorVal::Get_G() const + { + return m_unG; + } + + unsigned char CSystemColorVal::Get_B() const + { + return m_unB; + } + + unsigned char CSystemColorVal::Get_A() const + { + return m_unA; + } + + //-------------------------------------------------------------------------------- + // TextAlignmentType 20.1.10.59 (Part 1) + //-------------------------------------------------------------------------------- + + ETextAlignmentType CTextAlignmentType::FromString(const std::wstring &sValue) + { + this->m_eValue = textalignmenttypeL; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'l': + if ( (L"l") == sValue ) this->m_eValue = textalignmenttypeL; + break; + case 'c': + if ( (L"ctr") == sValue ) this->m_eValue = textalignmenttypeCtr; + break; + case 'd': + if ( (L"dist") == sValue ) this->m_eValue = textalignmenttypeDist; + break; + case 'j': + if ( (L"just") == sValue ) this->m_eValue = textalignmenttypeJust; + break; + case 'r': + if ( (L"r") == sValue ) this->m_eValue = textalignmenttypeR; + break; + } + + return this->m_eValue; + } + + std::wstring CTextAlignmentType::ToString () const + { + switch(this->m_eValue) + { + case textalignmenttypeR : return (L"r"); + case textalignmenttypeCtr : return (L"ctr"); + case textalignmenttypeDist: return (L"dist"); + case textalignmenttypeJust: return (L"just"); + case textalignmenttypeL : return (L"l"); + default : return (L"l"); + } + } + + //-------------------------------------------------------------------------------- + // TextAnchoringType 20.1.10.60 (Part 1) + //-------------------------------------------------------------------------------- + + ETextAnchoringType CTextAnchoringType::FromString(const std::wstring &sValue) + { + this->m_eValue = textanchoringtypeT; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( (L"b") == sValue ) this->m_eValue = textanchoringtypeB; + break; + case 'c': + if ( (L"ctr") == sValue ) this->m_eValue = textanchoringtypeCtr; + break; + case 'd': + if ( (L"dist") == sValue ) this->m_eValue = textanchoringtypeDist; + break; + case 'j': + if ( (L"just") == sValue ) this->m_eValue = textanchoringtypeJust; + break; + case 't': + if ( (L"t") == sValue ) this->m_eValue = textanchoringtypeT; + break; + } + + return this->m_eValue; + } + + std::wstring CTextAnchoringType::ToString () const + { + switch(this->m_eValue) + { + case textanchoringtypeB : return (L"b"); + case textanchoringtypeCtr : return (L"ctr"); + case textanchoringtypeDist: return (L"dist"); + case textanchoringtypeJust: return (L"just"); + case textanchoringtypeT : return (L"t"); + default : return (L"t"); + } + } + + //-------------------------------------------------------------------------------- + // TextColumnCount 20.1.10.65 (Part 1) + //-------------------------------------------------------------------------------- + + void CTextColumnCount::SetValue (unsigned char unValue) + { + this->m_eValue = (std::min)( 16, (std::max)( 1, (int) unValue ) ); + } + + unsigned char CTextColumnCount::FromString(const std::wstring &sValue) + { + this->m_eValue = (unsigned char)XmlUtils::GetInteger(sValue); + + if (this->m_eValue < 1) + this->m_eValue = 1; + if (this->m_eValue > 16) + this->m_eValue = 16; + + return this->m_eValue; + } + + std::wstring CTextColumnCount::ToString () const + { + std::wstring sResult = std::to_wstring(this->m_eValue); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // 20.1.10.66 TextFontAlignType (Font Alignment Types) + //-------------------------------------------------------------------------------- + + ETextFontAlignType CTextFontAlignType::FromString(const std::wstring &sValue) + { + this->m_eValue = textfontaligntypeAuto; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( (L"a") == sValue ) this->m_eValue = textfontaligntypeAuto; + break; + case 'c': + if ( (L"ctr") == sValue ) this->m_eValue = textfontaligntypeCtr; + break; + case 'b': + if ( (L"base") == sValue ) this->m_eValue = textfontaligntypeBase; + if ( (L"b") == sValue ) this->m_eValue = textfontaligntypeB; + break; + case 't': + if ( (L"just") == sValue ) this->m_eValue = textfontaligntypeT; + break; + } + + return this->m_eValue; + } + + std::wstring CTextFontAlignType::ToString () const + { + switch(this->m_eValue) + { + case textfontaligntypeB : return (L"b"); + case textfontaligntypeCtr : return (L"ctr"); + case textfontaligntypeT : return (L"t"); + case textfontaligntypeBase: return (L"base"); + case textfontaligntypeAuto: return (L"auto"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // TextFontScalePercentOrPercentString 20.1.10.67 (Part 1) + 12.1.2.5 (Part4) + //-------------------------------------------------------------------------------- + + CTextFontScalePercentOrPercentString::CTextFontScalePercentOrPercentString() + { + m_dValue = 0; + } + + double CTextFontScalePercentOrPercentString::GetValue() const + { + return m_dValue; + } + + void CTextFontScalePercentOrPercentString::SetValue(double dValue) + { + m_dValue = dValue; + } + + double CTextFontScalePercentOrPercentString::FromString(const std::wstring &sValue) + { + int nPos = (int)sValue.find( '%' ); + int nLen = (int)sValue.length(); + if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) + { + if ( -1 == nPos && nLen > 0) + { + // Поправка 12.1.2.5 (Part4) + int nValue = (std::min)( 100000, (std::max)( 1000, XmlUtils::GetInteger(sValue) ) ); + m_dValue = nValue / 1000.0; + } + return + m_dValue = 0; + } + else + m_dValue = XmlUtils::GetDouble( sValue.substr( 0, nLen - 1) ); + + return m_dValue; + } + + std::wstring CTextFontScalePercentOrPercentString::ToString () const + { + return boost::lexical_cast(m_dValue) + L"%"; + } + + //-------------------------------------------------------------------------------- + // TextHorzOverflowType 20.1.10.69 (Part 1) + //-------------------------------------------------------------------------------- + + ETextHorzOverflowType CTextHorzOverflowType::FromString(const std::wstring &sValue) + { + this->m_eValue = texthorzoverflowtypeOverflow; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( (L"clip") == sValue ) this->m_eValue = texthorzoverflowtypeClip; + break; + case 'o': + if ( (L"overflow") == sValue ) this->m_eValue = texthorzoverflowtypeOverflow; + break; + } + + return this->m_eValue; + } + + std::wstring CTextHorzOverflowType::ToString () const + { + switch(this->m_eValue) + { + case texthorzoverflowtypeClip : return (L"clip"); + case texthorzoverflowtypeOverflow : return (L"overflow"); + default : return (L"overflow"); + } + } + + //-------------------------------------------------------------------------------- + // 20.1.10.70 ST_TextIndent (Text Indentation) + //-------------------------------------------------------------------------------- + + __int64 CTextIndent::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger64( sValue ); + if (this->m_eValue < -51206400) + this->m_eValue = -51206400; + if (this->m_eValue > 51206400) + this->m_eValue = 51206400; + + return this->m_eValue; + } + + std::wstring CTextIndent::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + double CTextIndent::ToPoints() + { + return Emu_To_Pt((double)this->m_eValue); + } + + double CTextIndent::ToInches() + { + return Emu_To_Inch( (double)this->m_eValue ); + } + + double CTextIndent::ToCm() + { + return Emu_To_Cm( (double)this->m_eValue ); + } + + //-------------------------------------------------------------------------------- + // 20.1.10.72 ST_TextMargin (Text Margin) + //-------------------------------------------------------------------------------- + + _INT64 CTextMargin::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger64(sValue); + if (this->m_eValue < 0) + this->m_eValue = 0; + if (this->m_eValue > 51206400) + this->m_eValue = 51206400; + + return this->m_eValue; + } + + std::wstring CTextMargin::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + double CTextMargin::ToPoints() + { + return Emu_To_Pt((double)this->m_eValue); + } + + double CTextMargin::ToInches() + { + return Emu_To_Inch( (double)this->m_eValue ); + } + + double CTextMargin::ToCm() + { + return Emu_To_Cm( (double)this->m_eValue ); + } + + // //-------------------------------------------------------------------------------- + // // 20.1.10.74 ST_TextPoint (Text Point) + // //-------------------------------------------------------------------------------- + // template<__int64 nDefValue = 0> + // class CTextPoint : public CSimpleType<__int64, nDefValue> + // { + // public: + ///* The ST_TextPointUnqualified simple type (§20.1.10.75). + // The ST_UniversalMeasure simple type (§22.9.2.15). */ + // CTextPoint() {} + // + // __int64 FromString(const std::wstring &sValue) + // { + // this->m_eValue = XmlUtils::GetInteger64( sValue ); + // if (this->m_eValue < 0) + // this->m_eValue = 0; + // if (this->m_eValue > 51206400) + // this->m_eValue = 51206400; + // + // return this->m_eValue; + // } + // + // std::wstring ToString () const + // { + // std::wstring sResult = std::to_wstring( this->m_eValue); + // + // return sResult; + // } + // + // SimpleType_FromString (__int64) + // SimpleTypes_Default(TextPoint) + // + // double ToPoints() + // { + // return Emu_To_Pt(this->m_eValue); + // } + // + // double ToInches() + // { + // return Emu_To_Inch( this->m_eValue ); + // } + // double ToCm() + // { + // return Emu_To_Cm( this->m_eValue ); + // } + // }; + //-------------------------------------------------------------------------------- + // TextShapeType 20.1.10.76 (Part 1) + //-------------------------------------------------------------------------------- + + ETextShapeType CTextShapeType::FromString(const std::wstring &sValue) + { + this->m_eValue = textshapetypeTextPlain; + + if ( sValue.length() <= 5 ) + return this->m_eValue; + + wchar_t wChar = sValue[4]; + switch ( wChar ) + { + case 'A': + + if ( (L"textArchDown") == sValue ) this->m_eValue = textshapetypeTextArchDown; + else if ( (L"textArchDownPour") == sValue ) this->m_eValue = textshapetypeTextArchDownPour; + else if ( (L"textArchUp") == sValue ) this->m_eValue = textshapetypeTextArchUp; + else if ( (L"textArchUpPour") == sValue ) this->m_eValue = textshapetypeTextArchUpPour; + break; + + case 'B': + + if ( (L"textButton") == sValue ) this->m_eValue = textshapetypeTextButton; + else if ( (L"textButtonPour") == sValue ) this->m_eValue = textshapetypeTextButtonPour; + break; + + case 'C': + + if ( (L"textCanDown") == sValue ) this->m_eValue = textshapetypeTextCanDown; + else if ( (L"textCanUp") == sValue ) this->m_eValue = textshapetypeTextCanUp; + else if ( (L"textCascadeDown") == sValue ) this->m_eValue = textshapetypeTextCascadeDown; + else if ( (L"textCascadeUp") == sValue ) this->m_eValue = textshapetypeTextCascadeUp; + else if ( (L"textChevron") == sValue ) this->m_eValue = textshapetypeTextChevron; + else if ( (L"textChevronInverted") == sValue ) this->m_eValue = textshapetypeTextChevronInverted; + else if ( (L"textCircle") == sValue ) this->m_eValue = textshapetypeTextCircle; + else if ( (L"textCirclePour") == sValue ) this->m_eValue = textshapetypeTextCirclePour; + else if ( (L"textCurveDown") == sValue ) this->m_eValue = textshapetypeTextCurveDown; + else if ( (L"textCurveUp") == sValue ) this->m_eValue = textshapetypeTextCurveUp; + break; + + case 'D': + if ( (L"textDeflate") == sValue ) this->m_eValue = textshapetypeTextDeflate; + else if ( (L"textDeflateBottom") == sValue ) this->m_eValue = textshapetypeTextDeflateBottom; + else if ( (L"textDeflateInflate") == sValue ) this->m_eValue = textshapetypeTextDeflateInflate; + else if ( (L"textDeflateInflateDeflate") == sValue ) this->m_eValue = textshapetypeTextDeflateInflateDeflate; + else if ( (L"textDeflateTop") == sValue ) this->m_eValue = textshapetypeTextDeflateTop; + else if ( (L"textDoubleWave1") == sValue ) this->m_eValue = textshapetypeTextDoubleWave1; + break; + + case 'F': + if ( (L"textFadeDown") == sValue ) this->m_eValue = textshapetypeTextFadeDown; + else if ( (L"textFadeLeft") == sValue ) this->m_eValue = textshapetypeTextFadeLeft; + else if ( (L"textFadeRight") == sValue ) this->m_eValue = textshapetypeTextFadeRight; + else if ( (L"textFadeUp") == sValue ) this->m_eValue = textshapetypeTextFadeUp; + break; + + case 'I': + + if ( (L"textInflate") == sValue ) this->m_eValue = textshapetypeTextInflate; + else if ( (L"textInflateBottom") == sValue ) this->m_eValue = textshapetypeTextInflateBottom; + else if ( (L"textInflateTop") == sValue ) this->m_eValue = textshapetypeTextInflateTop; + break; + + case 'N': + if ( (L"textNoShape") == sValue ) this->m_eValue = textshapetypeTextNoShape; + break; + + case 'P': + + if ( (L"textPlain") == sValue ) this->m_eValue = textshapetypeTextPlain; + break; + + case 'R': + + if ( (L"textRingInside") == sValue ) this->m_eValue = textshapetypeTextRingInside; + else if ( (L"textRingOutside") == sValue ) this->m_eValue = textshapetypeTextRingOutside; + break; + + case 'S': + + if ( (L"textSlantDown") == sValue ) this->m_eValue = textshapetypeTextSlantDown; + else if ( (L"textSlantUp") == sValue ) this->m_eValue = textshapetypeTextSlantUp; + else if ( (L"textStop") == sValue ) this->m_eValue = textshapetypeTextStop; + break; + + case 'T': + + if ( (L"textTriangle") == sValue ) this->m_eValue = textshapetypeTextTriangle; + else if ( (L"textTriangleInverted")== sValue ) this->m_eValue = textshapetypeTextTriangleInverted; + break; + + case 'W': + + if ( (L"textWave1") == sValue ) this->m_eValue = textshapetypeTextWave1; + else if ( (L"textWave2") == sValue ) this->m_eValue = textshapetypeTextWave2; + else if ( (L"textWave4") == sValue ) this->m_eValue = textshapetypeTextWave4; + break; + } + + return this->m_eValue; + } + + std::wstring CTextShapeType::ToString () const + { + switch(this->m_eValue) + { + case textshapetypeTextArchDown: return (L"textArchDown"); + case textshapetypeTextArchDownPour: return (L"textArchDownPour"); + case textshapetypeTextArchUp: return (L"textArchUp"); + case textshapetypeTextArchUpPour: return (L"textArchUpPour"); + case textshapetypeTextButton: return (L"textButton"); + case textshapetypeTextButtonPour: return (L"textButtonPour"); + case textshapetypeTextCanDown: return (L"textCanDown"); + case textshapetypeTextCanUp: return (L"textCanUp"); + case textshapetypeTextCascadeDown: return (L"textCascadeDown"); + case textshapetypeTextCascadeUp: return (L"textCascadeUp"); + case textshapetypeTextChevron: return (L"textChevron"); + case textshapetypeTextChevronInverted: return (L"textChevronInverted"); + case textshapetypeTextCircle: return (L"textCircle"); + case textshapetypeTextCirclePour: return (L"textCirclePour"); + case textshapetypeTextCurveDown: return (L"textCurveDown"); + case textshapetypeTextCurveUp: return (L"textCurveUp"); + case textshapetypeTextDeflate: return (L"textDeflate"); + case textshapetypeTextDeflateBottom: return (L"textDeflateBottom"); + case textshapetypeTextDeflateInflate: return (L"textDeflateInflate"); + case textshapetypeTextDeflateInflateDeflate:return (L"textDeflateInflateDeflate"); + case textshapetypeTextDeflateTop: return (L"textDeflateTop"); + case textshapetypeTextDoubleWave1: return (L"textDoubleWave1"); + case textshapetypeTextFadeDown: return (L"textFadeDown"); + case textshapetypeTextFadeLeft: return (L"textFadeLeft"); + case textshapetypeTextFadeRight: return (L"textFadeRight"); + case textshapetypeTextFadeUp: return (L"textFadeUp"); + case textshapetypeTextInflate: return (L"textInflate"); + case textshapetypeTextInflateBottom: return (L"textInflateBottom"); + case textshapetypeTextInflateTop: return (L"textInflateTop"); + case textshapetypeTextNoShape: return (L"textNoShape"); + case textshapetypeTextPlain: return (L"textPlain"); + case textshapetypeTextRingInside: return (L"textRingInside"); + case textshapetypeTextRingOutside: return (L"textRingOutside"); + case textshapetypeTextSlantDown: return (L"textSlantDown"); + case textshapetypeTextSlantUp: return (L"textSlantUp"); + case textshapetypeTextStop: return (L"textStop"); + case textshapetypeTextTriangle: return (L"textTriangle"); + case textshapetypeTextTriangleInverted: return (L"textTriangleInverted"); + case textshapetypeTextWave1: return (L"textWave1"); + case textshapetypeTextWave2: return (L"textWave2"); + case textshapetypeTextWave4: return (L"textWave4"); + default : return (L"textPlain"); + } + } + + //-------------------------------------------------------------------------------- + // TextSpacingPercentOrPercentString 20.1.10.77 (Part 1) + 12.1.2.7 (Part4) + //-------------------------------------------------------------------------------- + + CTextSpacingPercentOrPercentString::CTextSpacingPercentOrPercentString() + { + m_dValue = 0; + } + + double CTextSpacingPercentOrPercentString::GetValue() const + { + return m_dValue; + } + + void CTextSpacingPercentOrPercentString::SetValue(double dValue) + { + m_dValue = dValue; + } + + double CTextSpacingPercentOrPercentString::FromString(const std::wstring &sValue) + { + int nPos = (int)sValue.find( '%' ); + int nLen = (int)sValue.length(); + if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) + { + if ( -1 == nPos && nLen > 0) + { + // Поправка 12.1.2.7 (Part4) + int nValue = (std::min)( 13200000, (std::max)( 0, XmlUtils::GetInteger(sValue) ) ); + m_dValue = nValue / 1000.0; + } + return m_dValue; + } + else + m_dValue = XmlUtils::GetDouble( sValue.substr( 0, nLen - 1 )); + + return m_dValue; + } + + std::wstring CTextSpacingPercentOrPercentString::ToString () const + { + return boost::lexical_cast(m_dValue) + L"%"; + } + + //-------------------------------------------------------------------------------- + // 20.1.10.78 ST_TextSpacingPoint (Text Spacing Point) + //-------------------------------------------------------------------------------- + + _INT64 CTextSpacingPoint::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger64(sValue); + if (this->m_eValue < 0) + this->m_eValue = 0; + if (this->m_eValue > 158400) + this->m_eValue = 158400; + + return this->m_eValue; + } + + std::wstring CTextSpacingPoint::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + double CTextSpacingPoint::ToPoints() + { + return (double)this->m_eValue; + } + + double CTextSpacingPoint::ToInches() + { + return Pt_To_Inch( (double)this->m_eValue ); + } + + double CTextSpacingPoint::ToCm() + { + return Pt_To_Cm( (double)this->m_eValue ); + } + + //-------------------------------------------------------------------------------- + // TextTypeface 20.1.10.81 (Part 1) + //-------------------------------------------------------------------------------- + + CTextTypeface::CTextTypeface() {} + + std::wstring CTextTypeface::GetValue() const + { + return m_sValue; + } + + void CTextTypeface::SetValue(std::wstring &sValue) + { + m_sValue = sValue; + } + + + std::wstring CTextTypeface::FromString(const std::wstring &sValue) + { + m_sValue = sValue; + + return m_sValue; + } + + std::wstring CTextTypeface::ToString () const + { + return m_sValue; + } + + //-------------------------------------------------------------------------------- + // TextVerticalType 20.1.10.83 (Part 1) + //-------------------------------------------------------------------------------- + + ETextVerticalType CTextVerticalType::FromString(const std::wstring &sValue) + { + this->m_eValue = textverticaltypeHorz; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'e': + if ( (L"eaVert") == sValue ) this->m_eValue = textverticaltypeEaVert; + break; + case 'h': + if ( (L"horz") == sValue ) this->m_eValue = textverticaltypeHorz; + break; + case 'm': + if ( (L"mongolianVert") == sValue ) this->m_eValue = textverticaltypeMongolianVert; + break; + case 'v': + if ( (L"vert") == sValue ) this->m_eValue = textverticaltypeVert; + else if ( (L"vert270") == sValue ) this->m_eValue = textverticaltypeVert270; + break; + case 'w': + if ( (L"wordArtVert") == sValue ) this->m_eValue = textverticaltypeWordArtVert; + else if ( (L"wordArtVertRtl") == sValue ) this->m_eValue = textverticaltypeWordArtVertRtl; + break; + } + + return this->m_eValue; + } + + std::wstring CTextVerticalType::ToString () const + { + switch(this->m_eValue) + { + case textverticaltypeEaVert : return (L"eaVert"); + case textverticaltypeHorz : return (L"horz"); + case textverticaltypeMongolianVert : return (L"mongolianVert"); + case textverticaltypeVert : return (L"vert"); + case textverticaltypeVert270 : return (L"vert270"); + case textverticaltypeWordArtVert : return (L"wordArtVert"); + case textverticaltypeWordArtVertRtl : return (L"wordArtVertRtl"); + default : return (L"horz"); + } + } + + //-------------------------------------------------------------------------------- + // TextVertOverflowType 20.1.10.84 (Part 1) + //-------------------------------------------------------------------------------- + + ETextVertOverflowType CTextVertOverflowType::FromString(const std::wstring &sValue) + { + this->m_eValue = textvertoverflowtypeOverflow; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( (L"clip") == sValue ) this->m_eValue = textvertoverflowtypeClip; + break; + case 'e': + if ( (L"ellipsis") == sValue ) this->m_eValue = textvertoverflowtypeEllipsis; + break; + case 'o': + if ( (L"overflow") == sValue ) this->m_eValue = textvertoverflowtypeOverflow; + break; + } + + return this->m_eValue; + } + + std::wstring CTextVertOverflowType::ToString () const + { + switch(this->m_eValue) + { + case textvertoverflowtypeClip : return (L"clip"); + case textvertoverflowtypeEllipsis : return (L"ellipsis"); + case textvertoverflowtypeOverflow : return (L"overflow"); + default : return (L"overflow"); + } + } + + //-------------------------------------------------------------------------------- + // TextWrappingType 20.1.10.85 (Part 1) + //-------------------------------------------------------------------------------- + + ETextWrappingType CTextWrappingType::FromString(const std::wstring &sValue) + { + this->m_eValue = textwrappingtypeNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'n': + if ( (L"none") == sValue ) this->m_eValue = textwrappingtypeNone; + break; + case 's': + if ( (L"square") == sValue ) this->m_eValue = textwrappingtypeSquare; + break; + } + + return this->m_eValue; + } + + std::wstring CTextWrappingType::ToString () const + { + switch(this->m_eValue) + { + case textwrappingtypeNone : return (L"none"); + case textwrappingtypeSquare : return (L"square"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // TileFlipMode 20.1.10.86 (Part 1) + //-------------------------------------------------------------------------------- + + ETileFlipMode CTileFlipMode::FromString(const std::wstring &sValue) + { + if ( (L"none") == sValue ) this->m_eValue = tileflipmodeNone; + else if ( (L"x") == sValue ) this->m_eValue = tileflipmodeX; + else if ( (L"xy") == sValue ) this->m_eValue = tileflipmodeXY; + else if ( (L"y") == sValue ) this->m_eValue = tileflipmodeY; + else this->m_eValue = tileflipmodeNone; + + return this->m_eValue; + } + + std::wstring CTileFlipMode::ToString () const + { + switch(this->m_eValue) + { + case tileflipmodeNone: return (L"none"); + case tileflipmodeX : return (L"x"); + case tileflipmodeXY : return (L"xy"); + case tileflipmodeY : return (L"y"); + default : return (L"none"); + } + } + +} // SimpleTypes + +// Здесь представлены все простые типы Drawing-Word из спецификации Office Open Xml (20.4.3) +namespace SimpleTypes +{ + //-------------------------------------------------------------------------------- + // AlignH 20.4.3.1 (Part 1) + //-------------------------------------------------------------------------------- + + EAlignH CAlignH::FromString(const std::wstring &sValue) + { + if ( (L"center") == sValue ) this->m_eValue = alignhCenter; + else if ( (L"inside") == sValue ) this->m_eValue = alignhInside; + else if ( (L"left") == sValue ) this->m_eValue = alignhLeft; + else if ( (L"outside") == sValue ) this->m_eValue = alignhOutside; + else if ( (L"right") == sValue ) this->m_eValue = alignhRight; + else this->m_eValue = alignhLeft; + + return this->m_eValue; + } + + std::wstring CAlignH::ToString() const + { + switch(this->m_eValue) + { + case alignhCenter : return (L"center"); + case alignhInside : return (L"inside"); + case alignhLeft : return (L"left"); + case alignhOutside : return (L"outside"); + case alignhRight : return (L"right"); + default : return (L"left"); + } + } + + //-------------------------------------------------------------------------------- + // AlignV 20.4.3.2 (Part 1) + //-------------------------------------------------------------------------------- + + EAlignV CAlignV::FromString(const std::wstring &sValue) + { + if ( (L"bottom") == sValue ) this->m_eValue = alignvBottom; + else if ( (L"center") == sValue ) this->m_eValue = alignvCenter; + else if ( (L"inside") == sValue ) this->m_eValue = alignvInside; + else if ( (L"outside") == sValue ) this->m_eValue = alignvOutside; + else if ( (L"top") == sValue ) this->m_eValue = alignvTop; + else this->m_eValue = alignvTop; + + return this->m_eValue; + } + + std::wstring CAlignV::ToString() const + { + switch(this->m_eValue) + { + case alignvBottom : return (L"bottom"); + case alignvCenter : return (L"center"); + case alignvInside : return (L"inside"); + case alignvOutside : return (L"outside"); + case alignvTop : return (L"top"); + default : return (L"top"); + } + } + + //-------------------------------------------------------------------------------- + // PositionOffset 10.4.3.3 (Part 1) + //-------------------------------------------------------------------------------- + + __int64 CPositionOffset::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger64( sValue ); + + return this->m_eValue; + } + + std::wstring CPositionOffset::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + + double CPositionOffset::ToPoints() + { + return Emu_To_Pt( (double)this->m_eValue ); + } + + double CPositionOffset::ToMM() const + { + return Emu_To_Mm( (double)this->m_eValue ); + } + + double CPositionOffset::ToInches() + { + return Emu_To_Inch( (double)this->m_eValue ); + } + + double CPositionOffset::ToTwips() + { + return Emu_To_Twips((double) this->m_eValue ); + } + + //-------------------------------------------------------------------------------- + // RelFromH 20.4.3.4 (Part 1) + //-------------------------------------------------------------------------------- + + ERelFromH CRelFromH::FromString(const std::wstring &sValue) + { + if ( (L"character") == sValue ) this->m_eValue = relfromhCharacter; + else if ( (L"column") == sValue ) this->m_eValue = relfromhColumn; + else if ( (L"insideMargin") == sValue ) this->m_eValue = relfromhInsideMargin; + else if ( (L"leftMargin") == sValue ) this->m_eValue = relfromhLeftMargin; + else if ( (L"margin") == sValue ) this->m_eValue = relfromhMargin; + else if ( (L"outsideMargin") == sValue ) this->m_eValue = relfromhOutsideMargin; + else if ( (L"page") == sValue ) this->m_eValue = relfromhPage; + else if ( (L"rightMargin") == sValue ) this->m_eValue = relfromhRightMargin; + else this->m_eValue = relfromhPage; + + return this->m_eValue; + } + + std::wstring CRelFromH::ToString() const + { + switch(this->m_eValue) + { + case relfromhCharacter : return (L"character"); + case relfromhColumn : return (L"column"); + case relfromhInsideMargin : return (L"insideMargin"); + case relfromhLeftMargin : return (L"leftMargin"); + case relfromhMargin : return (L"margin"); + case relfromhOutsideMargin : return (L"outsideMargin"); + case relfromhPage : return (L"page"); + case relfromhRightMargin : return (L"rightMargin"); + default : return (L"page"); + } + } + + //-------------------------------------------------------------------------------- + // RelFromV 20.4.3.5 (Part 1) + //-------------------------------------------------------------------------------- + + ERelFromV CRelFromV::FromString(const std::wstring &sValue) + { + if ( (L"bottomMargin") == sValue ) this->m_eValue = relfromvBottomMargin; + else if ( (L"insideMargin") == sValue ) this->m_eValue = relfromvInsideMargin; + else if ( (L"line") == sValue ) this->m_eValue = relfromvLine; + else if ( (L"margin") == sValue ) this->m_eValue = relfromvMargin; + else if ( (L"outsideMargin") == sValue ) this->m_eValue = relfromvOutsideMargin; + else if ( (L"page") == sValue ) this->m_eValue = relfromvPage; + else if ( (L"paragraph") == sValue ) this->m_eValue = relfromvParagraph; + else if ( (L"topMargin") == sValue ) this->m_eValue = relfromvTopMargin; + else this->m_eValue = relfromvPage; + + return this->m_eValue; + } + + std::wstring CRelFromV::ToString() const + { + switch(this->m_eValue) + { + case relfromvBottomMargin : return (L"bottomMargin"); + case relfromvInsideMargin : return (L"insideMargin"); + case relfromvLine : return (L"line"); + case relfromvMargin : return (L"margin"); + case relfromvOutsideMargin : return (L"outsideMargin"); + case relfromvPage : return (L"page"); + case relfromvParagraph : return (L"paragraph"); + case relfromvTopMargin : return (L"topMargin"); + default : return (L"page"); + } + } + + ESizeRelFromH CSizeRelFromH::FromString(const std::wstring &sValue) + { + if ( (L"margin") == sValue ) this->m_eValue = sizerelfromhMargin; + else if ( (L"page") == sValue ) this->m_eValue = sizerelfromhPage; + else if ( (L"leftMargin") == sValue ) this->m_eValue = sizerelfromhLeftMargin; + else if ( (L"rightMargin") == sValue ) this->m_eValue = sizerelfromhRightMargin; + else if ( (L"insideMargin") == sValue ) this->m_eValue = sizerelfromhInsideMargin; + else if ( (L"outsideMargin") == sValue ) this->m_eValue = sizerelfromhOutsideMargin; + else this->m_eValue = sizerelfromhPage; + + return this->m_eValue; + } + + std::wstring CSizeRelFromH::ToString() const + { + switch(this->m_eValue) + { + case sizerelfromhMargin : return (L"margin"); + case sizerelfromhPage : return (L"page"); + case sizerelfromhLeftMargin : return (L"leftMargin"); + case sizerelfromhRightMargin : return (L"rightMargin"); + case sizerelfromhInsideMargin : return (L"insideMargin"); + case sizerelfromhOutsideMargin : return (L"outsideMargin"); + } + return L"margin"; + } + + ESizeRelFromV CSizeRelFromV::FromString(const std::wstring &sValue) + { + if ( (L"margin") == sValue ) this->m_eValue = sizerelfromvMargin; + else if ( (L"page") == sValue ) this->m_eValue = sizerelfromvPage; + else if ( (L"topMargin") == sValue ) this->m_eValue = sizerelfromvTopMargin; + else if ( (L"bottomMargin") == sValue ) this->m_eValue = sizerelfromvBottomMargin; + else if ( (L"insideMargin") == sValue ) this->m_eValue = sizerelfromvInsideMargin; + else if ( (L"outsideMargin") == sValue ) this->m_eValue = sizerelfromvOutsideMargin; + else this->m_eValue = sizerelfromvPage; + + return this->m_eValue; + } + + std::wstring CSizeRelFromV::ToString() const + { + switch(this->m_eValue) + { + case sizerelfromvMargin : return (L"margin"); + case sizerelfromvPage : return (L"page"); + case sizerelfromvTopMargin : return (L"topMargin"); + case sizerelfromvBottomMargin : return (L"bottomMargin"); + case sizerelfromvInsideMargin : return (L"insideMargin"); + case sizerelfromvOutsideMargin : return (L"outsideMargin"); + } + return L"margin"; + } + + //-------------------------------------------------------------------------------- + // WrapDistance 10.4.3.6 (Part 1) + //-------------------------------------------------------------------------------- + + __int64 CWrapDistance::FromString(const std::wstring &sValue) + { + this->m_eValue = wcstoul( sValue.c_str(), NULL, 10 ); + + return this->m_eValue; + } + + std::wstring CWrapDistance::ToString () const + { + return std::to_wstring(this->m_eValue); + } + + double CWrapDistance::ToPoints() + { + return Emu_To_Pt( (double)this->m_eValue ); + } + + double CWrapDistance::ToMM() const + { + return Emu_To_Mm( (double)this->m_eValue ); + } + + double CWrapDistance::ToInches() + { + return Emu_To_Inch( (double)this->m_eValue ); + } + + double CWrapDistance::ToTwips() + { + return Emu_To_Twips( (double) this->m_eValue ); + } + + //-------------------------------------------------------------------------------- + // WrapText 20.4.3.7 (Part 1) + //-------------------------------------------------------------------------------- + + EWrapText CWrapText::FromString(const std::wstring &sValue) + { + if ( (L"bothSides") == sValue ) this->m_eValue = wraptextBothSides; + else if ( (L"largest") == sValue ) this->m_eValue = wraptextLargest; + else if ( (L"left") == sValue ) this->m_eValue = wraptextLeft; + else if ( (L"right") == sValue ) this->m_eValue = wraptextRight; + else this->m_eValue = wraptextLeft; + + return this->m_eValue; + } + + std::wstring CWrapText::ToString() const + { + switch(this->m_eValue) + { + case wraptextBothSides : return (L"bothSides"); + case wraptextLargest : return (L"largest"); + case wraptextLeft : return (L"left"); + case wraptextRight : return (L"right"); + default : return (L"left"); + } + } + +} // SimpleTypes + +// Здесь представлены все простые типы Drawing-Spreadsheet из спецификации Office Open Xml (20.5.3) +namespace SimpleTypes +{ + +} // SimpleTypes + +// Здесь представлены все простые типы Drawing-Charts из спецификации Office Open Xml (21.2.3, 21.3.3) +namespace SimpleTypes +{ + +} // SimpleTypes + +// Здесь представлены все простые типы Drawing-Diagrams из спецификации Office Open Xml (21.4.7) +namespace SimpleTypes +{ + EHueDirType CHueDirType::FromString(const std::wstring &sValue) + { + if (L"ccw" == sValue) this->m_eValue = hueDirCCw; + else if (L"cw" == sValue) this->m_eValue = hueDirCw; + else this->m_eValue = hueDirCw; + + return this->m_eValue; + } + + std::wstring CHueDirType::ToString() const + { + switch (this->m_eValue) + { + case hueDirCCw: return L"ccw"; + case hueDirCw: return L"cw"; + default: return L"cw"; + } + } + + //------------------------------------------------------------ + + EColorMethod CColorMethod::FromString(const std::wstring &sValue) + { + if (L"cycle" == sValue) this->m_eValue = colorMethodCycle; + else if (L"repeat" == sValue) this->m_eValue = colorMethodRepeat; + else if (L"span" == sValue) this->m_eValue = colorMethodSpan; + else this->m_eValue = colorMethodSpan; + + return this->m_eValue; + } + + std::wstring CColorMethod::ToString() const + { + switch (this->m_eValue) + { + case colorMethodCycle: return (L"cycle"); + case colorMethodRepeat: return (L"repeat"); + case colorMethodSpan: + default: return (L"span"); + } + } + + //------------------------------------------------------------ + + EChOrder CChOrder::FromString(const std::wstring &sValue) + { + if (L"b" == sValue) this->m_eValue = chOrderB; + else if (L"t" == sValue) this->m_eValue = chOrderT; + else this->m_eValue = chOrderB; + + return this->m_eValue; + } + + std::wstring CChOrder::ToString() const + { + switch (this->m_eValue) + { + case chOrderB: return L"b"; + case chOrderT: return L"t"; + default: return L"b"; + } + } + + //------------------------------------------------------------ + + EAxisTypes CAxisTypes::FromString(const std::wstring &sValue) + { + if (L"none" == sValue) this->m_eValue = axisTypes_none; + else if (L"self" == sValue) this->m_eValue = axisTypes_self; + else if (L"ch" == sValue) this->m_eValue = axisTypes_ch; + else if (L"des" == sValue) this->m_eValue = axisTypes_des; + else if (L"desOrSelf" == sValue) this->m_eValue = axisTypes_desOrSelf; + else if (L"par" == sValue) this->m_eValue = axisTypes_par; + else if (L"ancst" == sValue) this->m_eValue = axisTypes_ancst; + else if (L"ancstOrSelf" == sValue) this->m_eValue = axisTypes_ancstOrSelf; + else if (L"followSib" == sValue) this->m_eValue = axisTypes_followSib; + else if (L"precedSib" == sValue) this->m_eValue = axisTypes_precedSib; + else if (L"follow" == sValue) this->m_eValue = axisTypes_follow; + else if (L"preced" == sValue) this->m_eValue = axisTypes_preced; + else if (L"root" == sValue) this->m_eValue = axisTypes_root; + else this->m_eValue = axisTypes_none; + + return this->m_eValue; + } + + std::wstring CAxisTypes::ToString() const + { + switch (this->m_eValue) + { + case axisTypes_self: return L"self"; + case axisTypes_ch: return L"ch"; + case axisTypes_des: return L"des"; + case axisTypes_desOrSelf: return L"desOrSelf"; + case axisTypes_par: return L"par"; + case axisTypes_ancst: return L"ancst"; + case axisTypes_ancstOrSelf: return L"ancstOrSelf"; + case axisTypes_followSib: return L"followSib"; + case axisTypes_precedSib: return L"precedSib"; + case axisTypes_follow: return L"follow"; + case axisTypes_preced: return L"preced"; + case axisTypes_root: return L"root"; + case axisTypes_none: + default: return L"none"; + } + } + + //------------------------------------------------------------ + + EParameterId CParameterId::FromString(const std::wstring &sValue) + { + if (L"horzAlign" == sValue) this->m_eValue = parameterId_horzAlign; + else if (L"vertAlign" == sValue) this->m_eValue = parameterId_vertAlign; + else if (L"chDir" == sValue) this->m_eValue = parameterId_chDir; + else if (L"chAlign" == sValue) this->m_eValue = parameterId_chAlign; + else if (L"secChAlign" == sValue) this->m_eValue = parameterId_secChAlign; + else if (L"linDir" == sValue) this->m_eValue = parameterId_linDir; + else if (L"secLinDir" == sValue) this->m_eValue = parameterId_secLinDir; + else if (L"stElem" == sValue) this->m_eValue = parameterId_stElem; + else if (L"bendPt" == sValue) this->m_eValue = parameterId_bendPt; + else if (L"connRout" == sValue) this->m_eValue = parameterId_connRout; + else if (L"begSty" == sValue) this->m_eValue = parameterId_begSty; + else if (L"endSty" == sValue) this->m_eValue = parameterId_endSty; + else if (L"dim" == sValue) this->m_eValue = parameterId_dim; + else if (L"rotPath" == sValue) this->m_eValue = parameterId_rotPath; + else if (L"ctrShpMap" == sValue) this->m_eValue = parameterId_ctrShpMap; + else if (L"nodeHorzAlign" == sValue) this->m_eValue = parameterId_nodeHorzAlign; + else if (L"nodeVertAlign" == sValue) this->m_eValue = parameterId_nodeVertAlign; + else if (L"fallback" == sValue) this->m_eValue = parameterId_fallback; + else if (L"txDir" == sValue) this->m_eValue = parameterId_txDir; + else if (L"pyraAcctPos" == sValue) this->m_eValue = parameterId_pyraAcctPos; + else if (L"pyraAcctTxMar" == sValue) this->m_eValue = parameterId_pyraAcctTxMar; + else if (L"txBlDir" == sValue) this->m_eValue = parameterId_txBlDir; + else if (L"txAnchorHorz" == sValue) this->m_eValue = parameterId_txAnchorHorz; + else if (L"txAnchorVert" == sValue) this->m_eValue = parameterId_txAnchorVert; + else if (L"txAnchorHorzCh" == sValue) this->m_eValue = parameterId_txAnchorHorzCh; + else if (L"txAnchorVertCh" == sValue) this->m_eValue = parameterId_txAnchorVertCh; + else if (L"parTxLTRAlign" == sValue) this->m_eValue = parameterId_parTxLTRAlign; + else if (L"parTxRTLAlign" == sValue) this->m_eValue = parameterId_parTxRTLAlign; + else if (L"shpTxLTRAlignCh" == sValue) this->m_eValue = parameterId_shpTxLTRAlignCh; + else if (L"shpTxRTLAlignCh" == sValue) this->m_eValue = parameterId_shpTxRTLAlignCh; + else if (L"autoTxRot" == sValue) this->m_eValue = parameterId_autoTxRot; + else if (L"grDir" == sValue) this->m_eValue = parameterId_grDir; + else if (L"flowDir" == sValue) this->m_eValue = parameterId_flowDir; + else if (L"contDir" == sValue) this->m_eValue = parameterId_contDir; + else if (L"bkpt" == sValue) this->m_eValue = parameterId_bkpt; + else if (L"off" == sValue) this->m_eValue = parameterId_off; + else if (L"hierAlign" == sValue) this->m_eValue = parameterId_hierAlign; + else if (L"bkPtFixedVal" == sValue) this->m_eValue = parameterId_bkPtFixedVal; + else if (L"stBulletLvl" == sValue) this->m_eValue = parameterId_stBulletLvl; + else if (L"stAng" == sValue) this->m_eValue = parameterId_stAng; + else if (L"spanAng" == sValue) this->m_eValue = parameterId_spanAng; + else if (L"ar" == sValue) this->m_eValue = parameterId_ar; + else if (L"lnSpPar" == sValue) this->m_eValue = parameterId_lnSpPar; + else if (L"lnSpAfParP" == sValue) this->m_eValue = parameterId_lnSpAfParP; + else if (L"lnSpCh" == sValue) this->m_eValue = parameterId_lnSpCh; + else if (L"lnSpAfChP" == sValue) this->m_eValue = parameterId_lnSpAfChP; + else if (L"rtShortDist" == sValue) this->m_eValue = parameterId_rtShortDist; + else if (L"alignTx" == sValue) this->m_eValue = parameterId_alignTx; + else if (L"pyraLvlNode" == sValue) this->m_eValue = parameterId_pyraLvlNode; + else if (L"pyraAcctBkgdNode" == sValue) this->m_eValue = parameterId_pyraAcctBkgdNode; + else if (L"pyraAcctTxNode" == sValue) this->m_eValue = parameterId_pyraAcctTxNode; + else if (L"srcNode" == sValue) this->m_eValue = parameterId_srcNode; + else if (L"dstNode" == sValue) this->m_eValue = parameterId_dstNode; + else if (L"begPts" == sValue) this->m_eValue = parameterId_begPts; + else if (L"endPts" == sValue) this->m_eValue = parameterId_endPts; + + else this->m_eValue = parameterId_horzAlign; + + return this->m_eValue; + } + + std::wstring CParameterId::ToString() const + { + switch (this->m_eValue) + { + case parameterId_horzAlign: return L"horzAlign"; + case parameterId_vertAlign: return L"vertAlign"; + case parameterId_chDir: return L"chDir"; + case parameterId_chAlign: return L"chAlign"; + case parameterId_secChAlign: return L"secChAlign"; + case parameterId_linDir: return L"linDir"; + case parameterId_secLinDir: return L"secLinDir"; + case parameterId_stElem: return L"stElem"; + case parameterId_bendPt: return L"bendPt"; + case parameterId_connRout: return L"connRout"; + case parameterId_begSty: return L"begSty"; + case parameterId_endSty: return L"endSty"; + case parameterId_dim: return L"dim"; + case parameterId_rotPath: return L"rotPath"; + case parameterId_ctrShpMap: return L"ctrShpMap"; + case parameterId_nodeHorzAlign: return L"nodeHorzAlign"; + case parameterId_nodeVertAlign: return L"nodeVertAlign"; + case parameterId_fallback: return L"fallback"; + case parameterId_txDir: return L"txDir"; + case parameterId_pyraAcctPos: return L"pyraAcctPos"; + case parameterId_pyraAcctTxMar: return L"pyraAcctTxMar"; + case parameterId_txBlDir: return L"txBlDir"; + case parameterId_txAnchorHorz: return L"txAnchorHorz"; + case parameterId_txAnchorVert: return L"txAnchorVert"; + case parameterId_txAnchorHorzCh: return L"txAnchorHorzCh"; + case parameterId_txAnchorVertCh: return L"txAnchorVertCh"; + case parameterId_parTxLTRAlign: return L"parTxLTRAlign"; + case parameterId_parTxRTLAlign: return L"parTxRTLAlign"; + case parameterId_shpTxLTRAlignCh: return L"shpTxLTRAlignCh"; + case parameterId_shpTxRTLAlignCh: return L"shpTxRTLAlignCh"; + case parameterId_autoTxRot: return L"autoTxRot"; + case parameterId_grDir: return L"grDir"; + case parameterId_flowDir: return L"flowDir"; + case parameterId_contDir: return L"contDir"; + case parameterId_bkpt: return L"bkpt"; + case parameterId_off: return L"off"; + case parameterId_hierAlign: return L"hierAlign"; + case parameterId_bkPtFixedVal: return L"bkPtFixedVal"; + case parameterId_stBulletLvl: return L"stBulletLvl"; + case parameterId_stAng: return L"stAng"; + case parameterId_spanAng: return L"spanAng"; + case parameterId_ar: return L"ar"; + case parameterId_lnSpPar: return L"lnSpPar"; + case parameterId_lnSpAfParP: return L"lnSpAfParP"; + case parameterId_lnSpCh: return L"lnSpCh"; + case parameterId_lnSpAfChP: return L"lnSpAfChP"; + case parameterId_rtShortDist: return L"rtShortDist"; + case parameterId_alignTx: return L"alignTx"; + case parameterId_pyraLvlNode: return L"pyraLvlNode"; + case parameterId_pyraAcctBkgdNode: return L"pyraAcctBkgdNode"; + case parameterId_pyraAcctTxNode: return L"pyraAcctTxNode"; + case parameterId_srcNode: return L"srcNode"; + case parameterId_dstNode: return L"dstNode"; + case parameterId_begPts: return L"begPts"; + case parameterId_endPts: return L"endPts"; + default: return L"horzAlign"; + } + } + + //------------------------------------------------------------ + + EConstraintRelationship CConstraintRelationship::FromString(const std::wstring &sValue) + { + if (L"self" == sValue) this->m_eValue = constraintRels_self; + else if (L"ch" == sValue) this->m_eValue = constraintRels_ch; + else if (L"des" == sValue) this->m_eValue = constraintRels_des; + else this->m_eValue = constraintRels_self; + + return this->m_eValue; + } + + std::wstring CConstraintRelationship::ToString() const + { + switch (this->m_eValue) + { + case constraintRels_ch: return L"ch"; + case constraintRels_des: return L"des"; + case constraintRels_self: + default: return L"self"; + } + } + + //------------------------------------------------------------ + + EConstraintType CConstraintType::FromString(const std::wstring &sValue) + { + if (L"none" == sValue) this->m_eValue = constraintType_none; + else if (L"alignOff" == sValue) this->m_eValue = constraintType_alignOff; + else if (L"begMarg" == sValue) this->m_eValue = constraintType_begMarg; + else if (L"bendDist" == sValue) this->m_eValue = constraintType_bendDist; + else if (L"begPad" == sValue) this->m_eValue = constraintType_begPad; + else if (L"b" == sValue) this->m_eValue = constraintType_b; + else if (L"bMarg" == sValue) this->m_eValue = constraintType_bMarg; + else if (L"bOff" == sValue) this->m_eValue = constraintType_bOff; + else if (L"ctrX" == sValue) this->m_eValue = constraintType_ctrX; + else if (L"ctrXOff" == sValue) this->m_eValue = constraintType_ctrXOff; + else if (L"ctrY" == sValue) this->m_eValue = constraintType_ctrY; + else if (L"ctrYOff" == sValue) this->m_eValue = constraintType_ctrYOff; + else if (L"connDist" == sValue) this->m_eValue = constraintType_connDist; + else if (L"diam" == sValue) this->m_eValue = constraintType_diam; + else if (L"endMarg" == sValue) this->m_eValue = constraintType_endMarg; + else if (L"endPad" == sValue) this->m_eValue = constraintType_endPad; + else if (L"h" == sValue) this->m_eValue = constraintType_h; + else if (L"hArH" == sValue) this->m_eValue = constraintType_hArH; + else if (L"l" == sValue) this->m_eValue = constraintType_l; + else if (L"lMarg" == sValue) this->m_eValue = constraintType_lMarg; + else if (L"lOff" == sValue) this->m_eValue = constraintType_lOff; + else if (L"r" == sValue) this->m_eValue = constraintType_r; + else if (L"rMarg" == sValue) this->m_eValue = constraintType_rMarg; + else if (L"rOff" == sValue) this->m_eValue = constraintType_rOff; + else if (L"primFontSz" == sValue) this->m_eValue = constraintType_primFontSz; + else if (L"pyraAcctRatio" == sValue) this->m_eValue = constraintType_pyraAcctRatio; + else if (L"secFontSz" == sValue) this->m_eValue = constraintType_secFontSz; + else if (L"sibSp" == sValue) this->m_eValue = constraintType_sibSp; + else if (L"secSibSp" == sValue) this->m_eValue = constraintType_secSibSp; + else if (L"sp" == sValue) this->m_eValue = constraintType_sp; + else if (L"stemThick" == sValue) this->m_eValue = sconstraintType_temThick; + else if (L"t" == sValue) this->m_eValue = constraintType_t; + else if (L"tMarg" == sValue) this->m_eValue = constraintType_tMarg; + else if (L"tOff" == sValue) this->m_eValue = constraintType_tOff; + else if (L"userA" == sValue) this->m_eValue = constraintType_userA; + else if (L"userB" == sValue) this->m_eValue = constraintType_userB; + else if (L"userC" == sValue) this->m_eValue = constraintType_userC; + else if (L"userD" == sValue) this->m_eValue = constraintType_userD; + else if (L"userE" == sValue) this->m_eValue = constraintType_userE; + else if (L"userF" == sValue) this->m_eValue = constraintType_userF; + else if (L"userG" == sValue) this->m_eValue = constraintType_userG; + else if (L"userH" == sValue) this->m_eValue = constraintType_userH; + else if (L"userI" == sValue) this->m_eValue = constraintType_userI; + else if (L"userJ" == sValue) this->m_eValue = constraintType_userJ; + else if (L"userK" == sValue) this->m_eValue = constraintType_userK; + else if (L"userL" == sValue) this->m_eValue = constraintType_userL; + else if (L"userM" == sValue) this->m_eValue = constraintType_userM; + else if (L"userN" == sValue) this->m_eValue = constraintType_userN; + else if (L"userO" == sValue) this->m_eValue = constraintType_userO; + else if (L"userP" == sValue) this->m_eValue = constraintType_userP; + else if (L"userQ" == sValue) this->m_eValue = constraintType_userQ; + else if (L"userR" == sValue) this->m_eValue = constraintType_userR; + else if (L"userS" == sValue) this->m_eValue = constraintType_userS; + else if (L"userT" == sValue) this->m_eValue = constraintType_userT; + else if (L"userU" == sValue) this->m_eValue = constraintType_userU; + else if (L"userV" == sValue) this->m_eValue = constraintType_userV; + else if (L"userW" == sValue) this->m_eValue = constraintType_userW; + else if (L"userX" == sValue) this->m_eValue = constraintType_userX; + else if (L"userY" == sValue) this->m_eValue = constraintType_userY; + else if (L"userZ" == sValue) this->m_eValue = constraintType_userZ; + else if (L"w" == sValue) this->m_eValue = constraintType_w; + else if (L"wArH" == sValue) this->m_eValue = constraintType_wArH; + else if (L"wOff" == sValue) this->m_eValue = constraintType_wOff; + else this->m_eValue = constraintType_none; + + return this->m_eValue; + } + + std::wstring CConstraintType::ToString() const + { + switch (this->m_eValue) + { + case constraintType_none: return L"none"; + case constraintType_alignOff: return L"alignOff"; + case constraintType_begMarg: return L"begMarg"; + case constraintType_bendDist: return L"bendDist"; + case constraintType_begPad: return L"begPad"; + case constraintType_b: return L"b"; + case constraintType_bMarg: return L"bMarg"; + case constraintType_bOff: return L"bOff"; + case constraintType_ctrX: return L"ctrX"; + case constraintType_ctrXOff: return L"ctrXOff"; + case constraintType_ctrY: return L"ctrY"; + case constraintType_ctrYOff: return L"ctrYOff"; + case constraintType_connDist: return L"connDist"; + case constraintType_diam: return L"diam"; + case constraintType_endMarg: return L"endMarg"; + case constraintType_endPad: return L"endPad"; + case constraintType_h: return L"h"; + case constraintType_hArH: return L"hArH"; + case constraintType_l: return L"l"; + case constraintType_lMarg: return L"lMarg"; + case constraintType_lOff: return L"lOff"; + case constraintType_r: return L"r"; + case constraintType_rMarg: return L"rMarg"; + case constraintType_rOff: return L"rOff"; + case constraintType_primFontSz: return L"primFontSz"; + case constraintType_pyraAcctRatio: return L"pyraAcctRatio"; + case constraintType_secFontSz: return L"secFontSz"; + case constraintType_sibSp: return L"sibSp"; + case constraintType_secSibSp: return L"secSibSp"; + case constraintType_sp: return L"sp"; + case sconstraintType_temThick: return L"stemThick"; + case constraintType_t: return L"t"; + case constraintType_tMarg: return L"tMarg"; + case constraintType_tOff: return L"tOff"; + case constraintType_userA: return L"userA"; + case constraintType_userB: return L"userB"; + case constraintType_userC: return L"userC"; + case constraintType_userD: return L"userD"; + case constraintType_userE: return L"userE"; + case constraintType_userF: return L"userF"; + case constraintType_userG: return L"userG"; + case constraintType_userH: return L"userH"; + case constraintType_userI: return L"userI"; + case constraintType_userJ: return L"userJ"; + case constraintType_userK: return L"userK"; + case constraintType_userL: return L"userL"; + case constraintType_userM: return L"userM"; + case constraintType_userN: return L"userN"; + case constraintType_userO: return L"userO"; + case constraintType_userP: return L"userP"; + case constraintType_userQ: return L"userQ"; + case constraintType_userR: return L"userR"; + case constraintType_userS: return L"userS"; + case constraintType_userT: return L"userT"; + case constraintType_userU: return L"userU"; + case constraintType_userV: return L"userV"; + case constraintType_userW: return L"userW"; + case constraintType_userX: return L"userX"; + case constraintType_userY: return L"userY"; + case constraintType_userZ: return L"userZ"; + case constraintType_w: return L"w"; + case constraintType_wArH: return L"wArH"; + case constraintType_wOff: return L"wOff"; + default: return L"none"; + } + } + + //------------------------------------------------------------ + + EBoolOperator CBoolOperator::FromString(const std::wstring &sValue) + { + if (L"none" == sValue) this->m_eValue = boolOperator_none; + else if (L"equ" == sValue) this->m_eValue = boolOperator_equ; + else if (L"gte" == sValue) this->m_eValue = boolOperator_gte; + else if (L"lte" == sValue) this->m_eValue = boolOperator_lte; + else this->m_eValue = boolOperator_none; + + return this->m_eValue; + } + + std::wstring CBoolOperator::ToString() const + { + switch (this->m_eValue) + { + case boolOperator_equ: return L"equ"; + case boolOperator_gte: return L"gte"; + case boolOperator_lte: return L"lte"; + case boolOperator_none: + default: return L"none"; + } + } + + //--------------------------------------------------------------------------- + + EElementTypes CElementTypes::FromString(const std::wstring &sValue) + { + if (L"all" == sValue) this->m_eValue = elementTypes_all; + else if (L"doc" == sValue) this->m_eValue = elementTypes_doc; + else if (L"node" == sValue) this->m_eValue = elementTypes_node; + else if (L"norm" == sValue) this->m_eValue = elementTypes_norm; + else if (L"nonNorm" == sValue) this->m_eValue = elementTypes_nonNorm; + else if (L"asst" == sValue) this->m_eValue = elementTypes_asst; + else if (L"nonAsst" == sValue) this->m_eValue = elementTypes_nonAsst; + else if (L"parTrans" == sValue) this->m_eValue = elementTypes_parTrans; + else if (L"pres" == sValue) this->m_eValue = elementTypes_pres; + else if (L"sibTrans" == sValue) this->m_eValue = elementTypes_sibTrans; + else this->m_eValue = elementTypes_all; + return this->m_eValue; + } + + std::wstring CElementTypes::ToString() const + { + switch (this->m_eValue) + { + case elementTypes_all: return L"all"; + case elementTypes_doc: return L"doc"; + case elementTypes_node: return L"node"; + case elementTypes_norm: return L"norm"; + case elementTypes_nonNorm: return L"nonNorm"; + case elementTypes_asst: return L"asst"; + case elementTypes_nonAsst: return L"nonAsst"; + case elementTypes_parTrans: return L"parTrans"; + case elementTypes_pres: return L"pres"; + case elementTypes_sibTrans: return L"sibTrans"; + default: return L"all"; + } + } + + //--------------------------------------------------------------------------- + + EAlgorithmType CAlgorithmType::FromString(const std::wstring &sValue) + { + if (L"composite" == sValue) this->m_eValue = algorithmType_composite; + else if (L"conn" == sValue) this->m_eValue = algorithmType_conn; + else if (L"cycle" == sValue) this->m_eValue = algorithmType_cycle; + else if (L"hierChild" == sValue) this->m_eValue = algorithmType_hierChild; + else if (L"hierRoot" == sValue) this->m_eValue = algorithmType_hierRoot; + else if (L"pyra" == sValue) this->m_eValue = algorithmType_pyra; + else if (L"lin" == sValue) this->m_eValue = algorithmType_lin; + else if (L"sp" == sValue) this->m_eValue = algorithmType_sp; + else if (L"tx" == sValue) this->m_eValue = algorithmType_tx; + else if (L"snake" == sValue) this->m_eValue = algorithmType_snake; + else this->m_eValue = algorithmType_composite; + + return this->m_eValue; + } + + std::wstring CAlgorithmType::ToString() const + { + switch (this->m_eValue) + { + case algorithmType_composite: return L"composite"; + case algorithmType_conn: return L"conn"; + case algorithmType_cycle: return L"cycle"; + case algorithmType_hierChild: return L"hierChild"; + case algorithmType_hierRoot: return L"hierRoot"; + case algorithmType_pyra: return L"pyra"; + case algorithmType_lin: return L"lin"; + case algorithmType_sp: return L"sp"; + case algorithmType_tx: return L"tx"; + case algorithmType_snake: return L"snake"; + default: return L"composite"; + } + } + + //--------------------------------------------------------------------------- + + EFunctionType CFunctionType::FromString(const std::wstring &sValue) + { + if (L"cnt" == sValue) this->m_eValue = functionType_cnt; + else if (L"pos" == sValue) this->m_eValue = functionType_pos; + else if (L"revPos" == sValue) this->m_eValue = functionType_revPos; + else if (L"posEven" == sValue) this->m_eValue = functionType_posEven; + else if (L"posOdd" == sValue) this->m_eValue = functionType_posOdd; + else if (L"var" == sValue) this->m_eValue = functionType_var; + else if (L"depth" == sValue) this->m_eValue = functionType_depth; + else if (L"maxDepth" == sValue) this->m_eValue = functionType_maxDepth; + else this->m_eValue = functionType_cnt; + return this->m_eValue; + } + + std::wstring CFunctionType::ToString() const + { + switch (this->m_eValue) + { + case functionType_cnt: return L"cnt"; + case functionType_pos: return L"pos"; + case functionType_revPos: return L"revPos"; + case functionType_posEven: return L"posEven"; + case functionType_posOdd: return L"posOdd"; + case functionType_var: return L"var"; + case functionType_depth: return L"depth"; + case functionType_maxDepth: return L"maxDepth"; + default: return L"composite"; + } + } + + //--------------------------------------------------------------------------- + + EFunctionOperator CFunctionOperator::FromString(const std::wstring &sValue) + { + if (L"equ" == sValue) this->m_eValue = functionOperator_equ; + else if (L"neq" == sValue) this->m_eValue = functionOperator_neq; + else if (L"gt" == sValue) this->m_eValue = functionOperator_gt; + else if (L"lt" == sValue) this->m_eValue = functionOperator_lt; + else if (L"gte" == sValue) this->m_eValue = functionOperator_gte; + else if (L"lte" == sValue) this->m_eValue = functionOperator_lte; + else this->m_eValue = functionOperator_equ; + return this->m_eValue; + } + + std::wstring CFunctionOperator::ToString() const + { + switch (this->m_eValue) + { + case functionOperator_equ: return L"equ"; + case functionOperator_neq: return L"neq"; + case functionOperator_gt: return L"gt"; + case functionOperator_lt: return L"lt"; + case functionOperator_gte: return L"gte"; + case functionOperator_lte: return L"lte"; + default: return L"equ"; + } + } + + //--------------------------------------------------------------------------- + + EAnimLvlStr CAnimLvlStr::FromString(const std::wstring &sValue) + { + if (L"none" == sValue) this->m_eValue = animLvlStr_none; + else if (L"ctr" == sValue) this->m_eValue = animLvlStr_ctr; + else if (L"lvl" == sValue) this->m_eValue = animLvlStr_lvl; + else this->m_eValue = animLvlStr_none; + return this->m_eValue; + } + + std::wstring CAnimLvlStr::ToString() const + { + switch (this->m_eValue) + { + case animLvlStr_ctr: return L"ctr"; + case animLvlStr_lvl: return L"lvl"; + default: return L"none"; + } + } + + //--------------------------------------------------------------------------- + + EAnimOneStr CAnimOneStr::FromString(const std::wstring &sValue) + { + if (L"none" == sValue) this->m_eValue = animOneStr_none; + else if (L"branch" == sValue) this->m_eValue = animOneStr_branch; + else if (L"one" == sValue) this->m_eValue = animOneStr_one; + else this->m_eValue = animOneStr_none; + return this->m_eValue; + } + + std::wstring CAnimOneStr::ToString() const + { + switch (this->m_eValue) + { + case animOneStr_branch: return L"branch"; + case animOneStr_one: return L"one"; + default: return L"none"; + } + } + + //--------------------------------------------------------------------------- + + EDirectionDraw CDirectionDraw::FromString(const std::wstring &sValue) + { + if (L"norm" == sValue) this->m_eValue = direction_norm; + else if (L"rev" == sValue) this->m_eValue = direction_rev; + else this->m_eValue = direction_norm; + return this->m_eValue; + } + + std::wstring CDirectionDraw::ToString() const + { + switch (this->m_eValue) + { + case direction_rev: return L"rev"; + default: return L"norm"; + } + } + + //--------------------------------------------------------------------------- + + EHierBranch CHierBranch::FromString(const std::wstring &sValue) + { + if (L"none" == sValue) this->m_eValue = hierBranch_hang; + else if (L"init" == sValue) this->m_eValue = hierBranch_init; + else if (L"l" == sValue) this->m_eValue = hierBranch_l; + else if (L"r" == sValue) this->m_eValue = hierBranch_r; + else if (L"l" == sValue) this->m_eValue = hierBranch_l; + else if (L"std" == sValue) this->m_eValue = hierBranch_std; + else this->m_eValue = hierBranch_hang; + return this->m_eValue; + } + + std::wstring CHierBranch::ToString() const + { + switch (this->m_eValue) + { + case hierBranch_init: return L"init"; + case hierBranch_l: return L"l"; + case hierBranch_r: return L"r"; + case hierBranch_std: return L"std"; + case hierBranch_hang: + default: return L"hang"; + } + } + + //--------------------------------------------------------------------------- + + EResizeHandles CResizeHandles::FromString(const std::wstring &sValue) + { + if (L"exact" == sValue) this->m_eValue = resizeHandles_exact; + else if (L"rel" == sValue) this->m_eValue = resizeHandles_rel; + else this->m_eValue = resizeHandles_exact; + return this->m_eValue; + } + + std::wstring CResizeHandles::ToString() const + { + switch (this->m_eValue) + { + case resizeHandles_rel: return L"rel"; + case resizeHandles_exact: + default: return L"exact"; + } + } + + //--------------------------------------------------------------------------- + + EPtTypes CPtTypes::FromString(const std::wstring &sValue) + { + if (L"node" == sValue) this->m_eValue = ptTypes_node; + else if (L"asst" == sValue) this->m_eValue = ptTypes_asst; + else if (L"doc" == sValue) this->m_eValue = ptTypes_doc; + else if (L"pres" == sValue) this->m_eValue = ptTypes_pres; + else if (L"parTrans" == sValue) this->m_eValue = ptTypes_parTrans; + else if (L"sibTrans" == sValue) this->m_eValue = ptTypes_sibTrans; + else this->m_eValue = ptTypes_node; + return this->m_eValue; + } + + std::wstring CPtTypes::ToString() const + { + switch (this->m_eValue) + { + case ptTypes_asst: return L"asst"; + case ptTypes_doc: return L"doc"; + case ptTypes_pres: return L"pres"; + case ptTypes_parTrans: return L"parTrans"; + case ptTypes_sibTrans: return L"sibTrans"; + case ptTypes_node: + default: return L"node"; + } + } +} // SimpleTypes + diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h b/Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h index 50c67fdd94..13f886a4c9 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h @@ -32,8 +32,7 @@ #pragma once #include "SimpleTypes_Base.h" -#include "../Base/ASCWinAPI.h" // GetSysColor -#include "../../../../DesktopEditor/common/StringExt.h" + // Здесь представлены все простые типы Drawing-Main из спецификации Office Open Xml (20.1.10) namespace SimpleTypes { @@ -45,83 +44,18 @@ namespace SimpleTypes { adjangleAngle = 0, adjangleGuide = 1 - }; + }; - template - class CAdjAngle : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CAdjAngle, EAdjAngle, adjangleAngle) public: - - CAdjAngle() - { - m_nAngle = 0; - } - - virtual EAdjAngle FromString(std::wstring &sValue) - { - m_nAngle = 0; - m_sGuide.clear(); - - Parse( sValue ); - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - if ( adjangleAngle == this->m_eValue ) - { - return std::to_wstring( m_nAngle ); - } - else - { - return m_sGuide; - } - } - - SimpleType_FromString (EAdjAngle) - SimpleType_Operator_Equal (CAdjAngle) - - double GetAngle() const - { - return m_nAngle / 60000.0; - } - - std::wstring GetGuide() const - { - return m_sGuide; - } + double GetAngle() const; + std::wstring GetGuide() const; private: + void Parse(const std::wstring &sValue); - void Parse(std::wstring &sValue) - { - bool bAngleValue = true; - - for ( size_t nIndex = 0; nIndex < sValue.length(); nIndex++ ) - { - if ( !iswdigit( sValue[nIndex] ) ) - { - bAngleValue = false; - break; - } - } - - if ( bAngleValue ) - { - this->m_eValue = adjangleAngle; - m_nAngle = _wtoi( sValue.c_str() ); - } - else - { - this->m_eValue = adjangleGuide; - m_sGuide = sValue; - } - } - - - int m_nAngle; - std::wstring m_sGuide; + int m_nAngle = adjangleAngle; + std::wstring m_sGuide; }; //-------------------------------------------------------------------------------- @@ -138,181 +72,47 @@ namespace SimpleTypes class CAdjCoordinate : public CUniversalMeasure { public: + CAdjCoordinate(); - CAdjCoordinate() - { - this->m_eValue = eDefValue; - } - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = FromEmu(dValue); - } - virtual double FromString(std::wstring &sValue) - { - m_sGuide.clear(); + virtual void SetValue(double dValue); + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString() const; - Parse2( sValue ); + SimpleTypes_Default(CAdjCoordinate) - return m_dValue; - } - - virtual std::wstring ToString() const - { - if ( adjcoordinateCoord == this->m_eValue ) - { - if ( m_bUnit ) - { - return XmlUtils::DoubleToString(m_dValue, L"%.2f") + L"pt"; - } - else - { - return std::to_wstring( (int)Pt_To_Emu( m_dValue ) ); - } - } - else - { - return m_sGuide; - } - } - - SimpleType_FromString (double) - SimpleType_Operator_Equal (CAdjCoordinate) - - std::wstring GetGuide() const - { - return m_sGuide; - } - - double GetValue() const - { - return m_dValue; - } - private: - - void Parse2(std::wstring &sValue) - { - Parse( sValue, 12700 ); - - bool bGuide = false; - if ( !m_bUnit ) - { - for ( size_t nIndex = 0; nIndex < sValue.length(); nIndex++ ) - { - if ( !iswdigit( sValue[nIndex] ) ) - { - bGuide = true; - break; - } - } - } - else - { - // Последние два символа не проверяем - for ( size_t nIndex = 0; nIndex < sValue.length() - 2; nIndex++ ) - { - if ( !iswdigit( sValue[nIndex] ) && sValue[nIndex] != '.' && sValue[nIndex] != '-' ) - { - bGuide = true; - break; - } - } - } - - - if ( bGuide ) - { - this->m_eValue = adjcoordinateGuide; - m_sGuide = sValue; - } - else - { - this->m_eValue = adjcoordinateCoord; - // Значение хранится в m_dValue - } - } + std::wstring GetGuide() const; + double GetValue() const; private: + void Parse2(const std::wstring &sValue); - EAdjCoordinate m_eValue; - std::wstring m_sGuide; + EAdjCoordinate m_eValue; + std::wstring m_sGuide; }; - - - //-------------------------------------------------------------------------------- // Angle 20.1.10.3 (Part 1) //-------------------------------------------------------------------------------- - template - class CAngle : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CAngle, int, 0) public: - - CAngle() {} - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - return std::to_wstring( this->m_eValue ); - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CAngle) - - double GetAngle() const - { - return this->m_eValue / 60000.0; - } - + double GetAngle() const; }; //-------------------------------------------------------------------------------- // AnimationBuildType 20.1.10.4 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EAnimationBuildType { animationbuildtypeAllAtOnce = 0 }; - template - class CAnimationBuildType : public CSimpleType - { - public: - CAnimationBuildType() {} - - virtual EAnimationBuildType FromString(std::wstring &sValue) - { - if ( (L"allAtOnce") == sValue ) this->m_eValue = animationbuildtypeAllAtOnce; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case animationbuildtypeAllAtOnce : return (L"allAtOnce"); - default : return (L"allAtOnce"); - } - } - - SimpleType_FromString (EAnimationBuildType) - SimpleType_Operator_Equal (CAnimationBuildType) - }; + DEFINE_SIMPLE_TYPE(CAnimationBuildType, EAnimationBuildType, animationbuildtypeAllAtOnce) //-------------------------------------------------------------------------------- // AnimationChartBuildType 20.1.10.5 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EAnimationChartBuildType { @@ -323,43 +123,11 @@ namespace SimpleTypes animationchartbuildtypeSeriesEl = 4 }; - template - class CAnimationChartBuildType : public CSimpleType - { - public: - CAnimationChartBuildType() {} + DEFINE_SIMPLE_TYPE(CAnimationChartBuildType, EAnimationChartBuildType, animationchartbuildtypeAllAtOnce) - virtual EAnimationChartBuildType FromString(std::wstring &sValue) - { - if ( (L"allAtOnce") == sValue ) this->m_eValue = animationchartbuildtypeAllAtOnce; - else if ( (L"category") == sValue ) this->m_eValue = animationchartbuildtypeCategory; - else if ( (L"categoryEl") == sValue ) this->m_eValue = animationchartbuildtypeCategoryEl; - else if ( (L"series") == sValue ) this->m_eValue = animationchartbuildtypeSeries; - else if ( (L"seriesEl") == sValue ) this->m_eValue = animationchartbuildtypeSeriesEl; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case animationchartbuildtypeAllAtOnce : return (L"allAtOnce"); - case animationchartbuildtypeCategory : return (L"category"); - case animationchartbuildtypeCategoryEl : return (L"categoryEl"); - case animationchartbuildtypeSeries : return (L"series"); - case animationchartbuildtypeSeriesEl : return (L"seriesEl"); - default : return (L"allAtOnce"); - } - } - - SimpleType_FromString (EAnimationChartBuildType) - SimpleType_Operator_Equal (CAnimationChartBuildType) - }; //-------------------------------------------------------------------------------- // AnimationChartOnlyBuildType 20.1.10.6 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EAnimationChartOnlyBuildType { @@ -369,44 +137,11 @@ namespace SimpleTypes animationchartonlybuildtypeSeriesEl = 3 }; - template - class CAnimationChartOnlyBuildType : public CSimpleType - { - public: - CAnimationChartOnlyBuildType() {} - - virtual EAnimationChartOnlyBuildType FromString(std::wstring &sValue) - { - if ( (L"category") == sValue ) this->m_eValue = animationchartonlybuildtypeCategory; - else if ( (L"categoryEl") == sValue ) this->m_eValue = animationchartonlybuildtypeCategoryEl; - else if ( (L"series") == sValue ) this->m_eValue = animationchartonlybuildtypeSeries; - else if ( (L"seriesEl") == sValue ) this->m_eValue = animationchartonlybuildtypeSeriesEl; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case animationchartonlybuildtypeCategory : return (L"category"); - case animationchartonlybuildtypeCategoryEl : return (L"categoryEl"); - case animationchartonlybuildtypeSeries : return (L"series"); - case animationchartonlybuildtypeSeriesEl : return (L"seriesEl"); - default : return (L"category"); - } - } - - SimpleType_FromString (EAnimationChartOnlyBuildType) - SimpleType_Operator_Equal (CAnimationChartOnlyBuildType) - }; - - + DEFINE_SIMPLE_TYPE(CAnimationChartOnlyBuildType, EAnimationChartOnlyBuildType, animationchartonlybuildtypeCategory) //-------------------------------------------------------------------------------- // AnimationDgmBuildType 20.1.10.7 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EAnimationDgmBuildType { @@ -416,45 +151,11 @@ namespace SimpleTypes animationdgmbuildtypeOne = 3 }; - template - class CAnimationDgmBuildType : public CSimpleType - { - public: - CAnimationDgmBuildType() {} - - virtual EAnimationDgmBuildType FromString(std::wstring &sValue) - { - if ( (L"allAtOnce") == sValue ) this->m_eValue = animationdgmbuildtypeAllAtOnce; - else if ( (L"lvlAtOnce") == sValue ) this->m_eValue = animationdgmbuildtypeLvlAtOnce; - else if ( (L"lvlOne") == sValue ) this->m_eValue = animationdgmbuildtypeLvlOne; - else if ( (L"one") == sValue ) this->m_eValue = animationdgmbuildtypeOne; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case animationdgmbuildtypeAllAtOnce : return (L"allAtOnce"); - case animationdgmbuildtypeLvlAtOnce : return (L"lvlAtOnce"); - case animationdgmbuildtypeLvlOne : return (L"lvlOne"); - case animationdgmbuildtypeOne : return (L"one"); - default : return (L"allAtOnce"); - } - } - - SimpleType_FromString (EAnimationDgmBuildType) - SimpleType_Operator_Equal (CAnimationDgmBuildType) - }; - - - + DEFINE_SIMPLE_TYPE(CAnimationDgmBuildType, EAnimationDgmBuildType, animationdgmbuildtypeAllAtOnce) //-------------------------------------------------------------------------------- // AnimationDgmOnlyBuildType 20.1.10.8 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EAnimationDgmOnlyBuildType { @@ -463,39 +164,11 @@ namespace SimpleTypes animationdgmonlybuildtypeOne = 2 }; - template - class CAnimationDgmOnlyBuildType : public CSimpleType - { - public: - CAnimationDgmOnlyBuildType() {} + DEFINE_SIMPLE_TYPE(CAnimationDgmOnlyBuildType, EAnimationDgmOnlyBuildType, animationdgmonlybuildtypeOne) - virtual EAnimationDgmOnlyBuildType FromString(std::wstring &sValue) - { - if ( (L"lvlAtOnce") == sValue ) this->m_eValue = animationdgmonlybuildtypeLvlAtOnce; - else if ( (L"lvlOne") == sValue ) this->m_eValue = animationdgmonlybuildtypeLvlOne; - else if ( (L"one") == sValue ) this->m_eValue = animationdgmonlybuildtypeOne; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case animationdgmonlybuildtypeLvlAtOnce : return (L"lvlAtOnce"); - case animationdgmonlybuildtypeLvlOne : return (L"lvlOne"); - case animationdgmonlybuildtypeOne : return (L"one"); - default : return (L"lvlAtOnce"); - } - } - - SimpleType_FromString (EAnimationDgmOnlyBuildType) - SimpleType_Operator_Equal (CAnimationDgmOnlyBuildType) - }; //-------------------------------------------------------------------------------- // BevelPresetType 20.1.10.9 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EBevelPresetType { @@ -513,58 +186,11 @@ namespace SimpleTypes bevelpresettypeSoftRound = 11 }; - template - class CBevelPresetType : public CSimpleType - { - public: - CBevelPresetType() {} - - virtual EBevelPresetType FromString(std::wstring &sValue) - { - if ( (L"angle") == sValue ) this->m_eValue = bevelpresettypeAngle; - else if ( (L"artDeco") == sValue ) this->m_eValue = bevelpresettypeArtDeco; - else if ( (L"circle") == sValue ) this->m_eValue = bevelpresettypeCircle; - else if ( (L"convex") == sValue ) this->m_eValue = bevelpresettypeConvex; - else if ( (L"coolSlant") == sValue ) this->m_eValue = bevelpresettypeCoolSlant; - else if ( (L"cross") == sValue ) this->m_eValue = bevelpresettypeCross; - else if ( (L"divot") == sValue ) this->m_eValue = bevelpresettypeDivot; - else if ( (L"hardEdge") == sValue ) this->m_eValue = bevelpresettypeHardEdge; - else if ( (L"relaxedInset") == sValue ) this->m_eValue = bevelpresettypeRelaxedInset; - else if ( (L"riblet") == sValue ) this->m_eValue = bevelpresettypeRiblet; - else if ( (L"slope") == sValue ) this->m_eValue = bevelpresettypeSlope; - else if ( (L"softRound") == sValue ) this->m_eValue = bevelpresettypeSoftRound; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case bevelpresettypeAngle : return (L"angle"); - case bevelpresettypeArtDeco : return (L"artDeco"); - case bevelpresettypeCircle : return (L"circle"); - case bevelpresettypeConvex : return (L"convex"); - case bevelpresettypeCoolSlant : return (L"coolSlant"); - case bevelpresettypeCross : return (L"cross"); - case bevelpresettypeDivot : return (L"divot"); - case bevelpresettypeHardEdge : return (L"hardEdge"); - case bevelpresettypeRelaxedInset : return (L"relaxedInset"); - case bevelpresettypeRiblet : return (L"riblet"); - case bevelpresettypeSlope : return (L"slope"); - case bevelpresettypeSoftRound : return (L"softRound"); - default : return (L"angle"); - } - } - - SimpleType_FromString (EBevelPresetType) - SimpleType_Operator_Equal (CBevelPresetType) - }; + DEFINE_SIMPLE_TYPE(CBevelPresetType, EBevelPresetType, bevelpresettypeAngle) //-------------------------------------------------------------------------------- // BlackWhiteMode 20.1.10.10 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EBlackWhiteMode { @@ -581,56 +207,11 @@ namespace SimpleTypes blackwhitemodeWhite = 10 }; - template - class CBlackWhiteMode : public CSimpleType - { - public: - CBlackWhiteMode() {} - - virtual EBlackWhiteMode FromString(std::wstring &sValue) - { - if ( (L"auto") == sValue ) this->m_eValue = blackwhitemodeAuto; - else if ( (L"black") == sValue ) this->m_eValue = blackwhitemodeBlack; - else if ( (L"blackGray") == sValue ) this->m_eValue = blackwhitemodeBlackGray; - else if ( (L"blackWhite") == sValue ) this->m_eValue = blackwhitemodeBlackWhite; - else if ( (L"clr") == sValue ) this->m_eValue = blackwhitemodeClr; - else if ( (L"gray") == sValue ) this->m_eValue = blackwhitemodeGray; - else if ( (L"grayWhite") == sValue ) this->m_eValue = blackwhitemodeGrayWhite; - else if ( (L"hidden") == sValue ) this->m_eValue = blackwhitemodeHidden; - else if ( (L"invGray") == sValue ) this->m_eValue = blackwhitemodeInvGray; - else if ( (L"ltGray") == sValue ) this->m_eValue = blackwhitemodeLtGray; - else if ( (L"white") == sValue ) this->m_eValue = blackwhitemodeWhite; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case blackwhitemodeAuto : return (L"auto"); - case blackwhitemodeBlack : return (L"black"); - case blackwhitemodeBlackGray : return (L"blackGray"); - case blackwhitemodeBlackWhite : return (L"blackWhite"); - case blackwhitemodeClr : return (L"clr"); - case blackwhitemodeGray : return (L"gray"); - case blackwhitemodeGrayWhite : return (L"grayWhite"); - case blackwhitemodeHidden : return (L"hidden"); - case blackwhitemodeInvGray : return (L"invGray"); - case blackwhitemodeLtGray : return (L"ltGray"); - case blackwhitemodeWhite : return (L"white"); - default : return (L"auto"); - } - } - - SimpleType_FromString (EBlackWhiteMode) - SimpleType_Operator_Equal (CBlackWhiteMode) - }; + DEFINE_SIMPLE_TYPE(CBlackWhiteMode, EBlackWhiteMode, blackwhitemodeAuto) //-------------------------------------------------------------------------------- // BlendMode 20.1.10.11 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EBlendMode { @@ -641,45 +222,12 @@ namespace SimpleTypes blendmodeScreen = 4 }; - template - class CBlendMode : public CSimpleType - { - public: - CBlendMode() {} - - virtual EBlendMode FromString(std::wstring &sValue) - { - if ( (L"darken") == sValue ) this->m_eValue = blendmodeDarken; - else if ( (L"lighten") == sValue ) this->m_eValue = blendmodeLighten; - else if ( (L"mult") == sValue ) this->m_eValue = blendmodeMult; - else if ( (L"over") == sValue ) this->m_eValue = blendmodeOver; - else if ( (L"screen") == sValue ) this->m_eValue = blendmodeScreen; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case blendmodeDarken : return (L"darken"); - case blendmodeLighten : return (L"lighten"); - case blendmodeMult : return (L"mult"); - case blendmodeOver : return (L"over"); - case blendmodeScreen : return (L"screen"); - default : return (L"mult"); - } - } - - SimpleType_FromString (EBlendMode) - SimpleType_Operator_Equal (CBlendMode) - }; - + DEFINE_SIMPLE_TYPE(CBlendMode, EBlendMode, blendmodeMult) //-------------------------------------------------------------------------------- // BlipCompression 20.1.10.12 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EBlipCompression { blipcompressionEmail = 0, @@ -689,44 +237,12 @@ namespace SimpleTypes blipcompressionScreen = 4 }; - template - class CBlipCompression : public CSimpleType - { - public: - CBlipCompression() {} - - virtual EBlipCompression FromString(std::wstring &sValue) - { - if ( (L"email") == sValue ) this->m_eValue = blipcompressionEmail; - else if ( (L"hqprint") == sValue ) this->m_eValue = blipcompressionHQPrint; - else if ( (L"none") == sValue ) this->m_eValue = blipcompressionNone; - else if ( (L"print") == sValue ) this->m_eValue = blipcompressionPrint; - else if ( (L"screen") == sValue ) this->m_eValue = blipcompressionScreen; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case blipcompressionEmail : return (L"email"); - case blipcompressionHQPrint : return (L"hqprint"); - case blipcompressionNone : return (L"none"); - case blipcompressionPrint : return (L"print"); - case blipcompressionScreen : return (L"screen"); - default : return (L"none"); - } - } - - SimpleType_FromString (EBlipCompression) - SimpleType_Operator_Equal (CBlipCompression) - }; + DEFINE_SIMPLE_TYPE(CBlipCompression, EBlipCompression, blipcompressionNone) //-------------------------------------------------------------------------------- // ColorSchemeIndex 20.1.10.14 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EColorSchemeIndex { colorschemeindexAccent1 = 0, @@ -743,75 +259,12 @@ namespace SimpleTypes colorschemeindexLt2 = 11, }; - template - class CColorSchemeIndex : public CSimpleType - { - public: - CColorSchemeIndex() {} + DEFINE_SIMPLE_TYPE(CColorSchemeIndex, EColorSchemeIndex, colorschemeindexAccent1) - virtual EColorSchemeIndex FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( (L"accent1") == sValue ) this->m_eValue = colorschemeindexAccent1; - else if ( (L"accent2") == sValue ) this->m_eValue = colorschemeindexAccent2; - else if ( (L"accent3") == sValue ) this->m_eValue = colorschemeindexAccent3; - else if ( (L"accent4") == sValue ) this->m_eValue = colorschemeindexAccent4; - else if ( (L"accent5") == sValue ) this->m_eValue = colorschemeindexAccent5; - else if ( (L"accent6") == sValue ) this->m_eValue = colorschemeindexAccent6; - break; - case 'd': - if ( (L"dk1") == sValue ) this->m_eValue = colorschemeindexDk1; - else if ( (L"dk2") == sValue ) this->m_eValue = colorschemeindexDk2; - break; - case 'f': - if ( (L"folHlink") == sValue ) this->m_eValue = colorschemeindexFolHlink; - break; - case 'h': - if ( (L"hlink") == sValue ) this->m_eValue = colorschemeindexHlink; - break; - case 'l': - if ( (L"lt1") == sValue ) this->m_eValue = colorschemeindexLt1; - else if ( (L"lt2") == sValue ) this->m_eValue = colorschemeindexLt2; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case colorschemeindexAccent1 : return (L"accent1"); - case colorschemeindexAccent2 : return (L"accent2"); - case colorschemeindexAccent3 : return (L"accent3"); - case colorschemeindexAccent4 : return (L"accent4"); - case colorschemeindexAccent5 : return (L"accent5"); - case colorschemeindexAccent6 : return (L"accent6"); - case colorschemeindexDk1 : return (L"dk1"); - case colorschemeindexDk2 : return (L"dk2"); - case colorschemeindexFolHlink: return (L"folHlink"); - case colorschemeindexHlink : return (L"hlink"); - case colorschemeindexLt1 : return (L"lt1"); - case colorschemeindexLt2 : return (L"lt2"); - default : return (L"accent1"); - } - } - - SimpleType_FromString (EColorSchemeIndex) - SimpleType_Operator_Equal (CColorSchemeIndex) - }; //-------------------------------------------------------------------------------- // CompoundLine 20.1.10.15 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ECompoundLine { compoundlineDbl = 0, @@ -821,279 +274,88 @@ namespace SimpleTypes compoundlineTri = 4, }; - template - class CCompoundLine : public CSimpleType + DEFINE_SIMPLE_TYPE(CCompoundLine, ECompoundLine, compoundlineSng) + + //-------------------------------------------------------------------------------- + // Coordinate 20.1.10.16 (Part 1) + //-------------------------------------------------------------------------------- + + class CCoordinate : public CUniversalMeasure { public: - CCompoundLine() {} + CCoordinate(); - virtual ECompoundLine FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; + double GetValue() const; + virtual void SetValue(double dValue); + virtual double FromString(const std::wstring &sValue); - if ( sValue.empty() ) - return this->m_eValue; + virtual std::wstring ToString () const; - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'd': - if ( (L"dbl") == sValue ) this->m_eValue = compoundlineDbl; - break; - case 's': - if ( (L"sng") == sValue ) this->m_eValue = compoundlineSng; - break; - case 't': - if ( (L"thickThin") == sValue ) this->m_eValue = compoundlineThickThin; - else if ( (L"thinThick") == sValue ) this->m_eValue = compoundlineThinThick; - else if ( (L"tri") == sValue ) this->m_eValue = compoundlineTri; - break; - } + _INT64 ToEmu() const; + double ToCm() const; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case compoundlineDbl: return (L"dbl"); - case compoundlineSng: return (L"sng"); - case compoundlineThickThin: return (L"thickThin"); - case compoundlineThinThick: return (L"thinThick"); - case compoundlineTri: return (L"tri"); - default : return (L"sng"); - } - } - - SimpleType_FromString (ECompoundLine) - SimpleType_Operator_Equal (CCompoundLine) + SimpleTypes_DefaultD(CCoordinate) }; - //-------------------------------------------------------------------------------- - // Coordinate 20.1.10.16 (Part 1) - //-------------------------------------------------------------------------------- - class CCoordinate : public CUniversalMeasure - { - public: - CCoordinate() {} - - double GetValue() const - { - return m_dValue; - } - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = dValue; - } - virtual double FromString(std::wstring &sValue) - { - Parse(sValue, 12700); - - return m_dValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - - if ( m_bUnit ) - sResult = boost::lexical_cast(m_dValue) + L"pt"; - else - sResult = std::to_wstring( (__int64)m_dValue ); - - return sResult; - } - - __int64 ToEmu() const - { - return (__int64)Pt_To_Emu( m_dValue ); - } - double ToCm() const - { - return Pt_To_Cm( m_dValue ); - } - SimpleType_FromString (double) - SimpleType_Operator_Equal (CCoordinate) - }; //-------------------------------------------------------------------------------- - // Coordinate32 20.1.10.17 (Part 1) + // Coordinate32 20.1.10.17 (Part 1) //-------------------------------------------------------------------------------- - #define CCoordinate32 CCoordinate + +#define CCoordinate32 CCoordinate + //-------------------------------------------------------------------------------- // DrawingElementId 20.1.10.21 (Part 1) //-------------------------------------------------------------------------------- - template - class CDrawingElementId : public CSimpleType - { - public: - CDrawingElementId() {} - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString2 (int) - SimpleType_Operator_Equal (CDrawingElementId) - }; + DEFINE_SIMPLE_TYPE(CDrawingElementId, int, 0) //-------------------------------------------------------------------------------- // EffectContainerType 20.1.10.22 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EEffectContainerType { effectcontainertypeSib = 0, effectcontainertypeTree = 1, }; - template - class CEffectContainerType : public CSimpleType - { - public: - CEffectContainerType() {} - - virtual EEffectContainerType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 's': - if ( (L"sib") == sValue ) this->m_eValue = effectcontainertypeSib; - break; - case 't': - if ( (L"tree") == sValue ) this->m_eValue = effectcontainertypeTree; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case effectcontainertypeSib: return (L"sib"); - case effectcontainertypeTree: return (L"tree"); - default : return (L"sib"); - } - } - - SimpleType_FromString (EEffectContainerType) - SimpleType_Operator_Equal (CEffectContainerType) - }; - + DEFINE_SIMPLE_TYPE(CEffectContainerType, EEffectContainerType, effectcontainertypeSib) //-------------------------------------------------------------------------------- // FixedAngle 20.1.10.23 (Part 1) - //-------------------------------------------------------------------------------- - template - class CFixedAngle : public CSimpleType - { + //-------------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE_START_NSV(CFixedAngle, int, 0) public: - - CFixedAngle() {} - - void SetValue(int nValue) - { - this->m_eValue = (std::min)( 5400000, (std::max)( -5400000, nValue ) ); - } - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = (std::min)( 5400000, (std::max)( -5400000, _wtoi( sValue.c_str() ) ) ); - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - std::wstring sResult = std::to_wstring( this->m_eValue ); - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CFixedAngle) - - double GetAngle() const - { - return this->m_eValue / 60000.0; - } - + double GetAngle() const; }; //-------------------------------------------------------------------------------- - // FixedPercentage 20.1.10.24 (Part 1) + 12.1.2.1 (Part4) - //-------------------------------------------------------------------------------- - class CFixedPercentage - { - public: - CFixedPercentage() - { - m_dValue = 0; - } + // FixedPercentage 20.1.10.24 (Part 1) + 12.1.2.1 (Part4) + //-------------------------------------------------------------------------------- - double GetValue() const - { - return m_dValue; - } + class CFixedPercentage + { + public: + CFixedPercentage(); - void SetValue(double dValue) - { - m_dValue = (std::min)( 100.0, (std::max)( -100.0, dValue ) ); - } + double GetValue() const; + void SetValue(double dValue); - virtual double FromString(std::wstring &sValue) - { - int nPos = (int)sValue.find( '%' ); - int nLen = (int)sValue.length(); - if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) - { - if ( -1 == nPos && nLen > 0) - { - // Поправка 12.1.2.1 Part4 - int nValue = (std::min)( 100000, (std::max)( -100000, _wtoi( sValue.c_str() ) ) ); - m_dValue = nValue / 1000.0; - } - else - m_dValue = 0; - } - else - m_dValue = (std::min)( 100.0, (std::max)( -100.0, XmlUtils::GetDouble( sValue.substr( 0, nLen - 1 ) ) ) ); + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - return m_dValue; - } + SimpleTypes_DefaultD(CFixedPercentage) - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dValue) + L"%"; - } + private: - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CFixedPercentage) + double m_dValue; + }; - private: - - double m_dValue; - }; //-------------------------------------------------------------------------------- // FontCollectionIndex 20.1.10.25 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EFontCollectionIndex { fontcollectionindexMajor = 0, @@ -1101,175 +363,67 @@ namespace SimpleTypes fontcollectionindexNone = 2, }; - template - class CFontCollectionIndex : public CSimpleType - { - public: - CFontCollectionIndex() {} - - virtual EFontCollectionIndex FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'm': - if ( (L"major") == sValue ) this->m_eValue = fontcollectionindexMajor; - else if ( (L"minor") == sValue ) this->m_eValue = fontcollectionindexMinor; - break; - case 'n': - if ( (L"none") == sValue ) this->m_eValue = fontcollectionindexNone; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case fontcollectionindexMajor: return (L"major"); - case fontcollectionindexMinor: return (L"minor"); - case fontcollectionindexNone : return (L"none"); - default : return (L"none"); - } - } - - SimpleType_FromString (EFontCollectionIndex) - SimpleType_Operator_Equal (CFontCollectionIndex) - }; - + DEFINE_SIMPLE_TYPE(CFontCollectionIndex, EFontCollectionIndex, fontcollectionindexNone) //-------------------------------------------------------------------------------- // FOVAngle 20.1.10.26 (Part 1) - //-------------------------------------------------------------------------------- - template - class CFOVAngle : public CSimpleType - { + //-------------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE_START_NSV(CFOVAngle, int, 0) public: - - CFOVAngle() {} - - void SetValue(int nValue) - { - this->m_eValue = (std::min)( 10800000, (std::max)( 0, nValue ) ); - } - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = (std::min)( 10800000, (std::max)( 0, _wtoi( sValue.c_str() ) ) ); - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - std::wstring sResult = std::to_wstring( this->m_eValue ); - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CFOVAngle) - - double GetAngle() const - { - return this->m_eValue / 60000.0; - } - + double GetAngle() const; }; //-------------------------------------------------------------------------------- // GeomGuideFormula 20.1.10.27 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CGeomGuideFormula { public: - CGeomGuideFormula() {} + CGeomGuideFormula(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - void SetValue(std::wstring &sValue) - { - m_sValue = sValue; - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + SimpleTypes_DefaultS(CGeomGuideFormula) - std::wstring FromString(std::wstring &sValue) - { - m_sValue = sValue; - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CGeomGuideFormula) + private: + void Parse(); private: - - void Parse() - { - // TO DO: Сделать разбор формул. См. стр.3244 Part1. - } - - private: - - std::wstring m_sValue; + std::wstring m_sValue; }; + //-------------------------------------------------------------------------------- // GeomGuideName 20.1.10.28 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CGeomGuideName { public: - CGeomGuideName() {} + CGeomGuideName(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - void SetValue(std::wstring &sValue) - { - m_sValue = sValue; - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + SimpleTypes_DefaultS(CGeomGuideName) - std::wstring FromString(std::wstring &sValue) - { - m_sValue = sValue; + private: - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CGeomGuideName) - - private: - - std::wstring m_sValue; + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // LightRigDirection 20.1.10.29 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ELightRigDirection { lightrigdirectionB = 0, @@ -1282,65 +436,12 @@ namespace SimpleTypes lightrigdirectionTR = 7, }; - template - class CLightRigDirection : public CSimpleType - { - public: - CLightRigDirection() {} + DEFINE_SIMPLE_TYPE(CLightRigDirection, ELightRigDirection, lightrigdirectionTR) - virtual ELightRigDirection FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( (L"b") == sValue ) this->m_eValue = lightrigdirectionB; - else if ( (L"bl") == sValue ) this->m_eValue = lightrigdirectionBL; - else if ( (L"br") == sValue ) this->m_eValue = lightrigdirectionBR; - break; - case 'l': - if ( (L"l") == sValue ) this->m_eValue = lightrigdirectionL; - break; - case 'r': - if ( (L"r") == sValue ) this->m_eValue = lightrigdirectionR; - break; - case 't': - if ( (L"t") == sValue ) this->m_eValue = lightrigdirectionT; - else if ( (L"tl") == sValue ) this->m_eValue = lightrigdirectionTL; - else if ( (L"tr") == sValue ) this->m_eValue = lightrigdirectionTR; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case lightrigdirectionB: return (L"b"); - case lightrigdirectionBL: return (L"bl"); - case lightrigdirectionBR: return (L"br"); - case lightrigdirectionL: return (L"l"); - case lightrigdirectionR: return (L"r"); - case lightrigdirectionT: return (L"t"); - case lightrigdirectionTL: return (L"tl"); - case lightrigdirectionTR: return (L"tr"); - default : return (L"tr"); - } - } - - SimpleType_FromString (ELightRigDirection) - SimpleType_Operator_Equal (CLightRigDirection) - }; //-------------------------------------------------------------------------------- // LightRigType 20.1.10.30 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ELightRigType { lightrigtypeBalanced = 0, @@ -1372,113 +473,12 @@ namespace SimpleTypes lightrigtypeTwoPt = 26, }; - template - class CLightRigType : public CSimpleType - { - public: - CLightRigType() {} + DEFINE_SIMPLE_TYPE(CLightRigType, ELightRigType, lightrigtypeBalanced) - virtual ELightRigType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( (L"balanced") == sValue ) this->m_eValue = lightrigtypeBalanced; - else if ( (L"brightRoom") == sValue ) this->m_eValue = lightrigtypeBrightRoom; - break; - case 'c': - if ( (L"chilly") == sValue ) this->m_eValue = lightrigtypeChilly; - else if ( (L"contrasting") == sValue ) this->m_eValue = lightrigtypeContrasting; - break; - case 'f': - if ( (L"flat") == sValue ) this->m_eValue = lightrigtypeFlat; - else if ( (L"flood") == sValue ) this->m_eValue = lightrigtypeFlood; - else if ( (L"freezing") == sValue ) this->m_eValue = lightrigtypeFreezing; - break; - case 'g': - if ( (L"glow") == sValue ) this->m_eValue = lightrigtypeGlow; - break; - case 'h': - if ( (L"harsh") == sValue ) this->m_eValue = lightrigtypeHarsh; - break; - case 'l': - if ( (L"legacyFlat1") == sValue ) this->m_eValue = lightrigtypeLegacyFlat1; - else if ( (L"legacyFlat2") == sValue ) this->m_eValue = lightrigtypeLegacyFlat2; - else if ( (L"legacyFlat3") == sValue ) this->m_eValue = lightrigtypeLegacyFlat3; - else if ( (L"legacyFlat4") == sValue ) this->m_eValue = lightrigtypeLegacyFlat4; - else if ( (L"legacyHarsh1") == sValue ) this->m_eValue = lightrigtypeLegacyHarsh1; - else if ( (L"legacyHarsh2") == sValue ) this->m_eValue = lightrigtypeLegacyHarsh2; - else if ( (L"legacyHarsh3") == sValue ) this->m_eValue = lightrigtypeLegacyHarsh3; - else if ( (L"legacyHarsh4") == sValue ) this->m_eValue = lightrigtypeLegacyHarsh4; - else if ( (L"legacyNormal1") == sValue ) this->m_eValue = lightrigtypeLegacyNormal1; - else if ( (L"legacyNormal2") == sValue ) this->m_eValue = lightrigtypeLegacyNormal2; - else if ( (L"legacyNormal3") == sValue ) this->m_eValue = lightrigtypeLegacyNormal3; - else if ( (L"legacyNormal4") == sValue ) this->m_eValue = lightrigtypeLegacyNormal4; - break; - case 'm': - if ( (L"morning") == sValue ) this->m_eValue = lightrigtypeMorning; - break; - case 's': - if ( (L"soft") == sValue ) this->m_eValue = lightrigtypeSoft; - else if ( (L"sunrise") == sValue ) this->m_eValue = lightrigtypeSunrise; - else if ( (L"sunset") == sValue ) this->m_eValue = lightrigtypeSunset; - break; - case 't': - if ( (L"threePt") == sValue ) this->m_eValue = lightrigtypeThreePt; - else if ( (L"twoPt") == sValue ) this->m_eValue = lightrigtypeTwoPt; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case lightrigtypeBalanced : return (L"balanced"); - case lightrigtypeBrightRoom : return (L"brightRoom"); - case lightrigtypeChilly : return (L"chilly"); - case lightrigtypeContrasting : return (L"contrasting"); - case lightrigtypeFlat : return (L"flat"); - case lightrigtypeFlood : return (L"flood"); - case lightrigtypeFreezing : return (L"freezing"); - case lightrigtypeGlow : return (L"glow"); - case lightrigtypeHarsh : return (L"harsh"); - case lightrigtypeLegacyFlat1 : return (L"legacyFlat1"); - case lightrigtypeLegacyFlat2 : return (L"legacyFlat2"); - case lightrigtypeLegacyFlat3 : return (L"legacyFlat3"); - case lightrigtypeLegacyFlat4 : return (L"legacyFlat4"); - case lightrigtypeLegacyHarsh1 : return (L"legacyHarsh1"); - case lightrigtypeLegacyHarsh2 : return (L"legacyHarsh2"); - case lightrigtypeLegacyHarsh3 : return (L"legacyHarsh3"); - case lightrigtypeLegacyHarsh4 : return (L"legacyHarsh4"); - case lightrigtypeLegacyNormal1 : return (L"legacyNormal1"); - case lightrigtypeLegacyNormal2 : return (L"legacyNormal2"); - case lightrigtypeLegacyNormal3 : return (L"legacyNormal3"); - case lightrigtypeLegacyNormal4 : return (L"legacyNormal4"); - case lightrigtypeMorning : return (L"morning"); - case lightrigtypeSoft : return (L"soft"); - case lightrigtypeSunrise : return (L"sunrise"); - case lightrigtypeSunset : return (L"sunset"); - case lightrigtypeThreePt : return (L"threePt"); - case lightrigtypeTwoPt : return (L"twoPt"); - default : return (L"balanced"); - } - } - - SimpleType_FromString (ELightRigType) - SimpleType_Operator_Equal (CLightRigType) - }; //-------------------------------------------------------------------------------- // LineCap 20.1.10.31 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ELineCap { linecapFlat = 0, @@ -1486,53 +486,12 @@ namespace SimpleTypes linecapSq = 2, }; - template - class CLineCap : public CSimpleType - { - public: - CLineCap() {} + DEFINE_SIMPLE_TYPE(CLineCap, ELineCap, linecapRnd) - virtual ELineCap FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'f': - if ( (L"flat") == sValue ) this->m_eValue = linecapFlat; - break; - case 'r': - if ( (L"rnd") == sValue ) this->m_eValue = linecapRnd; - break; - case 's': - if ( (L"sq") == sValue ) this->m_eValue = linecapSq; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case linecapFlat: return (L"flat"); - case linecapRnd: return (L"rnd"); - case linecapSq: return (L"sq"); - default : return (L"rnd"); - } - } - - SimpleType_FromString (ELineCap) - SimpleType_Operator_Equal (CLineCap) - }; //-------------------------------------------------------------------------------- // LineEndLength 20.1.10.32 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ELineEndLength { lineendlengthLarge = 0, @@ -1540,55 +499,12 @@ namespace SimpleTypes lineendlengthSmall = 2, }; - template - class CLineEndLength : public CSimpleType - { - public: - CLineEndLength() {} - - virtual ELineEndLength FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'l': - if ( (L"lg") == sValue ) this->m_eValue = lineendlengthLarge; - break; - case 'm': - if ( (L"med") == sValue ) this->m_eValue = lineendlengthMedium; - break; - case 's': - if ( (L"sm") == sValue ) this->m_eValue = lineendlengthSmall; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case lineendlengthLarge: return (L"lg"); - case lineendlengthMedium: return (L"med"); - case lineendlengthSmall: return (L"sm"); - default : return (L"med"); - } - } - - SimpleType_FromString (ELineEndLength) - SimpleType_Operator_Equal (CLineEndLength) - }; - + DEFINE_SIMPLE_TYPE(CLineEndLength, ELineEndLength, lineendlengthMedium) //-------------------------------------------------------------------------------- // LineEndType 20.1.10.33 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ELineEndType { lineendtypeArrow = 0, @@ -1599,67 +515,12 @@ namespace SimpleTypes lineendtypeTriangle = 5, }; - template - class CLineEndType : public CSimpleType - { - public: - CLineEndType() {} - - virtual ELineEndType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( (L"arrow") == sValue ) this->m_eValue = lineendtypeArrow; - break; - case 'd': - if ( (L"diamond") == sValue ) this->m_eValue = lineendtypeDiamond; - break; - case 'n': - if ( (L"none") == sValue ) this->m_eValue = lineendtypeNone; - break; - case 'o': - if ( (L"oval") == sValue ) this->m_eValue = lineendtypeOval; - break; - case 's': - if ( (L"stealth") == sValue ) this->m_eValue = lineendtypeStealth; - break; - case 't': - if ( (L"triangle") == sValue ) this->m_eValue = lineendtypeTriangle; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case lineendtypeArrow: return (L"arrow"); - case lineendtypeDiamond: return (L"diamond"); - case lineendtypeNone: return (L"none"); - case lineendtypeOval: return (L"oval"); - case lineendtypeStealth: return (L"stealth"); - case lineendtypeTriangle: return (L"triangle"); - default : return (L"none"); - } - } - - SimpleType_FromString (ELineEndType) - SimpleType_Operator_Equal (CLineEndType) - }; - + DEFINE_SIMPLE_TYPE(CLineEndType, ELineEndType, lineendtypeNone) //-------------------------------------------------------------------------------- // LineEndWidth 20.1.10.34 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ELineEndWidth { lineendwidthLarge = 0, @@ -1667,101 +528,24 @@ namespace SimpleTypes lineendwidthSmall = 2, }; - template - class CLineEndWidth : public CSimpleType - { + DEFINE_SIMPLE_TYPE(CLineEndWidth, ELineEndWidth, lineendwidthMedium) + + //-------------------------------------------------------------------------------- + // LineWidth 20.1.10.35 (Part 1) + //-------------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE_START(CLineWidth, _INT64, 0) public: - CLineEndWidth() {} + double ToPoints(); + double ToInches(); - virtual ELineEndWidth FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'l': - if ( (L"lg") == sValue ) this->m_eValue = lineendwidthLarge; - break; - case 'm': - if ( (L"med") == sValue ) this->m_eValue = lineendwidthMedium; - break; - case 's': - if ( (L"sm") == sValue ) this->m_eValue = lineendwidthSmall; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case lineendwidthLarge: return (L"lg"); - case lineendwidthMedium: return (L"med"); - case lineendwidthSmall: return (L"sm"); - default : return (L"med"); - } - } - - SimpleType_FromString (ELineEndWidth) - SimpleType_Operator_Equal (CLineEndWidth) + double FromEmu(const _INT64 nEmu); }; - - //-------------------------------------------------------------------------------- - // LineWidth 20.1.10.35 (Part 1) - //-------------------------------------------------------------------------------- - template<__int64 nDefValue = 0> - class CLineWidth : public CSimpleType<__int64, nDefValue> - { - public: - CLineWidth() {} - - virtual __int64 FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi64( sValue.c_str() ); - if (this->m_eValue < 0) - this->m_eValue = 0; - if (this->m_eValue > 20116800) - this->m_eValue = 20116800; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (__int64) - SimpleType_Operator_Equal (CLineWidth) - - double ToPoints() - { - return Emu_To_Pt( this->m_eValue ); - } - - double ToInches() - { - return Emu_To_Inch( this->m_eValue ); - } - - double FromEmu(const __int64 nEmu) - { - this->m_eValue = nEmu; - return Emu_To_Pt( this->m_eValue ); - } - }; //-------------------------------------------------------------------------------- // PathFillMode 20.1.10.37 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPathFillMode { pathfillmodeDarken = 0, @@ -1772,61 +556,12 @@ namespace SimpleTypes pathfillmodeNorm = 5, }; - template - class CPathFillMode : public CSimpleType - { - public: - CPathFillMode() {} - - virtual EPathFillMode FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'd': - if ( (L"darken") == sValue ) this->m_eValue = pathfillmodeDarken; - else if ( (L"darkenLess") == sValue ) this->m_eValue = pathfillmodeDarkenLess; - break; - case 'l': - if ( (L"lighten") == sValue ) this->m_eValue = pathfillmodeLighten; - else if ( (L"darkenLess") == sValue ) this->m_eValue = pathfillmodeLightenLess; - break; - case 'n': - if ( (L"none") == sValue ) this->m_eValue = pathfillmodeNone; - else if ( (L"norm") == sValue ) this->m_eValue = pathfillmodeNorm; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pathfillmodeDarken: return (L"darken"); - case pathfillmodeDarkenLess: return (L"darkenLess"); - case pathfillmodeLighten: return (L"lighten"); - case pathfillmodeLightenLess: return (L"lightenLess"); - case pathfillmodeNone: return (L"none"); - case pathfillmodeNorm: return (L"norm"); - default : return (L"none"); - } - } - - SimpleType_FromString (EPathFillMode) - SimpleType_Operator_Equal (CPathFillMode) - }; - + DEFINE_SIMPLE_TYPE(CPathFillMode, EPathFillMode, pathfillmodeNone) //-------------------------------------------------------------------------------- // PathShadeType 20.1.10.38 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPathShadeType { pathshadetypeCircle = 0, @@ -1834,1542 +569,405 @@ namespace SimpleTypes pathshadetypeShape = 2, }; - template - class CPathShadeType : public CSimpleType - { - public: - CPathShadeType() {} - - virtual EPathShadeType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( (L"circle") == sValue ) this->m_eValue = pathshadetypeCircle; - break; - case 'r': - if ( (L"rect") == sValue ) this->m_eValue = pathshadetypeRect; - break; - case 's': - if ( (L"shape") == sValue ) this->m_eValue = pathshadetypeShape; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pathshadetypeCircle: return (L"circle"); - case pathshadetypeRect: return (L"rect"); - case pathshadetypeShape: return (L"shape"); - default : return (L"rect"); - } - } - - SimpleType_FromString (EPathShadeType) - SimpleType_Operator_Equal (CPathShadeType) - }; - + DEFINE_SIMPLE_TYPE(CPathShadeType, EPathShadeType, pathshadetypeRect) //-------------------------------------------------------------------------------- // PenAlignment 20.1.10.39 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPenAlignment { penalignmentCtr = 0, penalignmentIn = 1, }; - template - class CPenAlignment : public CSimpleType + DEFINE_SIMPLE_TYPE(CPenAlignment, EPenAlignment, penalignmentCtr) + + //-------------------------------------------------------------------------------- + // Percentage 20.1.10.40 (Part 1) + 12.1.2.2 (Part4) + //-------------------------------------------------------------------------------- + + class CPercentage { public: - CPenAlignment() {} + CPercentage(); - virtual EPenAlignment FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; + double GetValue() const; + void SetValue(double dValue); - if ( sValue.empty() ) - return this->m_eValue; + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; + virtual std::wstring ToStringDecimalNumber () const; - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( (L"ctr") == sValue ) this->m_eValue = penalignmentCtr; - break; - case 'i': - if ( (L"in") == sValue ) this->m_eValue = penalignmentIn; - break; - } + SimpleTypes_DefaultD(CPercentage) - return this->m_eValue; - } + private: - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case penalignmentCtr: return (L"ctr"); - case penalignmentIn: return (L"in"); - default : return (L"ctr"); - } - } - - SimpleType_FromString (EPenAlignment) - SimpleType_Operator_Equal (CPenAlignment) + double m_dValue; }; + //-------------------------------------------------------------------------------- - // Percentage 20.1.10.40 (Part 1) + 12.1.2.2 (Part4) + // PositiveCoordinate 20.1.10.42 (Part 1) //-------------------------------------------------------------------------------- - class CPercentage - { - public: - CPercentage() - { - m_dValue = 0; - } - double GetValue() const - { - return m_dValue; - } + DEFINE_SIMPLE_TYPE_START(CPositiveCoordinate, _INT64, 0) + public: + double ToPoints() const; + double ToMM() const; - void SetValue(double dValue) - { - m_dValue = dValue; - } + double ToInches(); + double ToTwips(); + double FromEmu(const _INT64& nEmu); + }; - virtual double FromString(std::wstring &sValue) - { - //todo странно что если пришло значение от 0 до 1, то m_dValue от 0 до 1. В других случаях от 0 до 100 - int nPos = (int)sValue.find( '%' ); - int nLen = (int)sValue.length(); - if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) - { - if ( -1 == nPos ) - { - //test - double dValue = XmlUtils::GetDouble(sValue); - if (fabs(dValue) >= 0 && fabs(dValue) <=1 ) - { - m_dValue = dValue; - } - else - { - // Поправка 12.1.2.2 (Part4) - m_dValue = dValue / 1000.0; - } - } - else - m_dValue = 0; - } - else - { - std::wstring strValue = sValue.substr( 0, nLen - 1 ); - m_dValue = XmlUtils::GetDouble( strValue ); - } - - return m_dValue; - } - - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dValue) + L"%"; - } - virtual std::wstring ToStringDecimalNumber () const - { - std::wstring sResult = std::to_wstring( int(m_dValue * 1000.0) ); - - return sResult; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CPercentage) - - private: - - double m_dValue; - }; //-------------------------------------------------------------------------------- - // PositiveCoordinate 20.1.10.42 (Part 1) - //-------------------------------------------------------------------------------- - template<__int64 nDefValue = 0> - class CPositiveCoordinate : public CSimpleType<__int64, nDefValue> - { - public: - CPositiveCoordinate() {} - - virtual __int64 FromString(std::wstring &sValue) - { - this->m_eValue = sValue.empty() ? 0 : _wtoi64( sValue.c_str() ); - - if (this->m_eValue < 0) - this->m_eValue = 0; - if (this->m_eValue > 27273042316900) - this->m_eValue = 27273042316900; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (__int64) - SimpleType_Operator_Equal (CPositiveCoordinate) - - double ToPoints() const - { - return Emu_To_Pt( this->m_eValue ); - } - double ToMM() const - { - return Emu_To_Mm( (double)this->m_eValue ); - } - - double ToInches() - { - return Emu_To_Inch( (double)this->m_eValue ); - } - double ToTwips() - { - return Emu_To_Twips( (double)this->m_eValue ); - } - double FromEmu(const __int64& nEmu) - { - this->m_eValue = nEmu; - return Emu_To_Pt( (double)this->m_eValue ); - } - }; + // PositiveCoordinate32 20.1.10.43 (Part 1) //-------------------------------------------------------------------------------- - // PositiveCoordinate32 20.1.10.43 (Part 1) - //-------------------------------------------------------------------------------- - #define CPositiveCoordinate32 CPositiveCoordinate + +#define CPositiveCoordinate32 CPositiveCoordinate + //-------------------------------------------------------------------------------- // PositiveFixedAngle 20.1.10.44 (Part 1) - //-------------------------------------------------------------------------------- - template - class CPositiveFixedAngle : public CSimpleType - { + //-------------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE_START_NSV(CPositiveFixedAngle, int, 0) public: - - CPositiveFixedAngle() {} - - void SetValue(int nValue) - { - this->m_eValue = (std::min)( 21600000, (std::max)( 0, nValue ) ); - } - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = (std::min)( 21600000, (std::max)( 0, _wtoi( sValue.c_str() ) ) ); - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - std::wstring sResult = std::to_wstring( this->m_eValue ); - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CPositiveFixedAngle) - - double GetAngle() const - { - return this->m_eValue / 60000.0; - } - + double GetAngle() const; }; //-------------------------------------------------------------------------------- - // PositiveFixedPercentage 20.1.10.45 (Part 1) + 12.1.2.3 (Part4) - //-------------------------------------------------------------------------------- - class CPositiveFixedPercentage - { - public: - CPositiveFixedPercentage() {} - - double GetValue() const - { - return m_dValue; - } - - void SetValue(double dValue) - { - m_dValue = (std::min)( 100.0, (std::max)( 0.0, dValue ) ); - } - - virtual double FromString(std::wstring &sValue) - { - int nPos = (int)sValue.find( '%' ); - int nLen = (int)sValue.length(); - if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) - { - if ( -1 == nPos && nLen > 0) - { - // Поправка 12.1.2.3 (Part4) - int nValue = (std::max)( 0, (std::min)( 100000, _wtoi( sValue.c_str() ) ) ); - m_dValue = nValue / 1000.0; - } - else - m_dValue = 0; - } - else - m_dValue = (std::min)( 100.0, (std::max)( 0.0, XmlUtils::GetDouble( sValue.substr( 0, nLen - 1 )) ) ); - - return m_dValue; - } - - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dValue) + L"%"; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CPositiveFixedPercentage) - - private: - - double m_dValue; - }; + // PositiveFixedPercentage 20.1.10.45 (Part 1) + 12.1.2.3 (Part4) //-------------------------------------------------------------------------------- - // PositivePercentage 20.1.10.46 (Part 1) + 12.1.2.4 (Part4) + + class CPositiveFixedPercentage + { + public: + CPositiveFixedPercentage(); + + double GetValue() const; + void SetValue(double dValue); + + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; + + SimpleTypes_DefaultD(CPositiveFixedPercentage) + + private: + double m_dValue; + }; + + //-------------------------------------------------------------------------------- + // PositivePercentage 20.1.10.46 (Part 1) + 12.1.2.4 (Part4) //-------------------------------------------------------------------------------- - class CPositivePercentage - { - public: - CPositivePercentage() {} - double GetValue() const - { - return m_dValue; - } + class CPositivePercentage + { + public: + CPositivePercentage(); - void SetValue(double dValue) - { - m_dValue = (std::max)( 0.0, dValue ); - } + double GetValue() const; + void SetValue(double dValue); - virtual double FromString(std::wstring &sValue) - { - int nPos = (int)sValue.find( '%' ); - int nLen = (int)sValue.length(); - if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) - { - if ( -1 == nPos && nLen > 0) - { - // Поправка 12.1.2.4 (Part4) - int nValue = (std::max)( 0, _wtoi( sValue.c_str() ) ); - m_dValue = nValue / 1000.0; - } - return - m_dValue; - } - else - m_dValue = (std::max)( 0.0, XmlUtils::GetDouble( sValue.substr( 0, nLen - 1 ) ) ); + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - return m_dValue; - } + SimpleTypes_DefaultD(CPositivePercentage) - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dValue) + L"%"; - } + private: + double m_dValue; + }; - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CPositivePercentage) - - private: - - double m_dValue; - }; //-------------------------------------------------------------------------------- // PresetCameraType 20.1.10.47 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPresetCameraType { - presetcameratypeIsometricBottomDown, // (Isometric Bottom Down) - presetcameratypeIsometricBottomUp, // (Isometric Bottom Up) - presetcameratypeIsometricLeftDown, // (Isometric Left Down) - presetcameratypeIsometricLeftUp, // (Isometric Left Up) - presetcameratypeIsometricOffAxis1Left, // (Isometric Off Axis 1 Left) - presetcameratypeIsometricOffAxis1Right, // (Isometric Off Axis 1 Right) - presetcameratypeIsometricOffAxis1Top, // (Isometric Off Axis 1 Top) - presetcameratypeIsometricOffAxis2Left, // (Isometric Off Axis 2 Left) + presetcameratypeIsometricBottomDown, // (Isometric Bottom Down) + presetcameratypeIsometricBottomUp, // (Isometric Bottom Up) + presetcameratypeIsometricLeftDown, // (Isometric Left Down) + presetcameratypeIsometricLeftUp, // (Isometric Left Up) + presetcameratypeIsometricOffAxis1Left, // (Isometric Off Axis 1 Left) + presetcameratypeIsometricOffAxis1Right, // (Isometric Off Axis 1 Right) + presetcameratypeIsometricOffAxis1Top, // (Isometric Off Axis 1 Top) + presetcameratypeIsometricOffAxis2Left, // (Isometric Off Axis 2 Left) presetcameratypeIsometricOffAxis2Right, // (Isometric Off Axis 2 Right - presetcameratypeIsometricOffAxis2Top, // (Isometric Off Axis 2 Top) - presetcameratypeIsometricOffAxis3Bottom, // (Isometric Off Axis 3 Bottom) - presetcameratypeIsometricOffAxis3Left, // (Isometric Off Axis 3 Left) - presetcameratypeIsometricOffAxis3Right, // (Isometric Off Axis 3 Right) - presetcameratypeIsometricOffAxis4Bottom, // (Isometric Off Axis 4 Bottom) - presetcameratypeIsometricOffAxis4Left, // (Isometric Off Axis 4 Left) - presetcameratypeIsometricOffAxis4Right, // (Isometric Off Axis 4 Right) - presetcameratypeIsometricRightDown, // (Isometric Right Down) - presetcameratypeIsometricRightUp, // (Isometric Right Up) - presetcameratypeIsometricTopDown, // (Isometric Top Down) - presetcameratypeIsometricTopUp, // (Isometric Top Up) - presetcameratypeLegacyObliqueBottom, // (Legacy Oblique Bottom) - presetcameratypeLegacyObliqueBottomLeft, // (Legacy Oblique Bottom Left) - presetcameratypeLegacyObliqueBottomRight, // (Legacy Oblique Bottom Right) - presetcameratypeLegacyObliqueFront, // (Legacy Oblique Front) - presetcameratypeLegacyObliqueLeft, // (Legacy Oblique Left) - presetcameratypeLegacyObliqueRight, // (Legacy Oblique Right) - presetcameratypeLegacyObliqueTop, // (Legacy Oblique Top) - presetcameratypeLegacyObliqueTopLeft, // (Legacy Oblique Top Left) - presetcameratypeLegacyObliqueTopRight, // (Legacy Oblique Top Right) - presetcameratypeLegacyPerspectiveBottom, // (Legacy Perspective Bottom) - presetcameratypeLegacyPerspectiveBottomLeft, // (Legacy Perspective Bottom Left) - presetcameratypeLegacyPerspectiveBottomRight, // (Legacy Perspective Bottom Right) - presetcameratypeLegacyPerspectiveFront, // (Legacy Perspective Front) - presetcameratypeLegacyPerspectiveLeft, // (Legacy Perspective Left) - presetcameratypeLegacyPerspectiveRight, // (Legacy Perspective Right) - presetcameratypeLegacyPerspectiveTop, // (Legacy Perspective Top) - presetcameratypeLegacyPerspectiveTopLeft, // (Legacy Perspective Top Left) - presetcameratypeLegacyPerspectiveTopRight, // (Legacy Perspective Top Right) - presetcameratypeObliqueBottom, // (Oblique Bottom) - presetcameratypeObliqueBottomLeft, // (Oblique Bottom Left) - presetcameratypeObliqueBottomRight, // (Oblique Bottom Right) - presetcameratypeObliqueLeft, // (Oblique Left) - presetcameratypeObliqueRight, // (Oblique Right) - presetcameratypeObliqueTop, // (Oblique Top) - presetcameratypeObliqueTopLeft, // (Oblique Top Left) - presetcameratypeObliqueTopRight, // (Oblique Top Right) - presetcameratypeOrthographicFront, // (Orthographic Front) - presetcameratypePerspectiveAbove, // (Orthographic Above) - presetcameratypePerspectiveAboveLeftFacing, // (Perspective Above Left Facing) - presetcameratypePerspectiveAboveRightFacing, // (Perspective Above Right Facing) - presetcameratypePerspectiveBelow, // (Perspective Below) - presetcameratypePerspectiveContrastingLeftFacing, // (Perspective Contrasting Left Facing) - presetcameratypePerspectiveContrastingRightFacing, // (Perspective Contrasting Right Facing) - presetcameratypePerspectiveFront, // (Perspective Front) - presetcameratypePerspectiveHeroicExtremeLeftFacing, // (Perspective Heroic Extreme Left Facing) - presetcameratypePerspectiveHeroicExtremeRightFacing, // (Perspective Heroic Extreme Right Facing) - presetcameratypePerspectiveHeroicLeftFacing, // (Perspective Heroic Left Facing) - presetcameratypePerspectiveHeroicRightFacing, // (Perspective Heroic Right Facing) - presetcameratypePerspectiveLeft, // (Perspective Left) - presetcameratypePerspectiveRelaxed, // (Perspective Relaxed) - presetcameratypePerspectiveRelaxedModerately, // (Perspective Relaxed Moderately) - presetcameratypePerspectiveRight, // (Perspective Right) - }; - - template - class CPresetCameraType : public CSimpleType - { - public: - CPresetCameraType() {} - - virtual EPresetCameraType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'i': - if ( (L"isometricBottomDown") == sValue ) this->m_eValue = presetcameratypeIsometricBottomDown; - else if ( (L"isometricBottomUp") == sValue ) this->m_eValue = presetcameratypeIsometricBottomUp; - else if ( (L"isometricLeftDown") == sValue ) this->m_eValue = presetcameratypeIsometricLeftDown; - else if ( (L"isometricLeftUp") == sValue ) this->m_eValue = presetcameratypeIsometricLeftUp; - else if ( (L"isometricOffAxis1Left") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis1Left; - else if ( (L"isometricOffAxis1Right") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis1Right; - else if ( (L"isometricOffAxis1Top") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis1Top; - else if ( (L"isometricOffAxis2Left") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis2Left; - else if ( (L"isometricOffAxis2Right") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis2Right; - else if ( (L"isometricOffAxis2Top") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis2Top; - else if ( (L"isometricOffAxis3Bottom") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis3Bottom ; - else if ( (L"isometricOffAxis3Left") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis3Left; - else if ( (L"isometricOffAxis3Right") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis3Right; - else if ( (L"isometricOffAxis4Bottom") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis4Bottom; - else if ( (L"isometricOffAxis4Left") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis4Left; - else if ( (L"isometricOffAxis4Right") == sValue ) this->m_eValue = presetcameratypeIsometricOffAxis4Right; - else if ( (L"isometricRightDown") == sValue ) this->m_eValue = presetcameratypeIsometricRightDown; - else if ( (L"isometricRightUp") == sValue ) this->m_eValue = presetcameratypeIsometricRightUp; - else if ( (L"isometricTopDown") == sValue ) this->m_eValue = presetcameratypeIsometricTopDown; - else if ( (L"isometricTopUp") == sValue ) this->m_eValue = presetcameratypeIsometricTopUp; - break; - case 'l': - if ( (L"legacyObliqueBottom") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueBottom; - else if ( (L"legacyObliqueBottomLeft") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueBottomLeft; - else if ( (L"legacyObliqueBottomRight") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueBottomRight; - else if ( (L"legacyObliqueFront") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueFront; - else if ( (L"legacyObliqueLeft") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueLeft; - else if ( (L"legacyObliqueRight") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueRight; - else if ( (L"legacyObliqueTop") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueTop; - else if ( (L"legacyObliqueTopLeft") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueTopLeft; - else if ( (L"legacyObliqueTopRight") == sValue ) this->m_eValue = presetcameratypeLegacyObliqueTopRight; - else if ( (L"legacyPerspectiveBottom") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveBottom; - else if ( (L"legacyPerspectiveBottomLeft") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveBottomLeft; - else if ( (L"legacyPerspectiveBottomRight") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveBottomRight; - else if ( (L"legacyPerspectiveFront") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveFront; - else if ( (L"legacyPerspectiveLeft") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveLeft; - else if ( (L"legacyPerspectiveRight") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveRight; - else if ( (L"legacyPerspectiveTop") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveTop; - else if ( (L"legacyPerspectiveTopLeft") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveTopLeft; - else if ( (L"legacyPerspectiveTopRight") == sValue ) this->m_eValue = presetcameratypeLegacyPerspectiveTopRight; - break; - case 'o': - if ( (L"obliqueBottom") == sValue ) this->m_eValue = presetcameratypeObliqueBottom; - else if ( (L"obliqueBottomLeft") == sValue ) this->m_eValue = presetcameratypeObliqueBottomLeft; - else if ( (L"obliqueBottomRight") == sValue ) this->m_eValue = presetcameratypeObliqueBottomRight; - else if ( (L"obliqueLeft") == sValue ) this->m_eValue = presetcameratypeObliqueLeft; - else if ( (L"obliqueRight") == sValue ) this->m_eValue = presetcameratypeObliqueRight; - else if ( (L"obliqueTop") == sValue ) this->m_eValue = presetcameratypeObliqueTop; - else if ( (L"obliqueTopLeft") == sValue ) this->m_eValue = presetcameratypeObliqueTopLeft; - else if ( (L"obliqueTopRight") == sValue ) this->m_eValue = presetcameratypeObliqueTopRight; - else if ( (L"orthographicFront") == sValue ) this->m_eValue = presetcameratypeOrthographicFront; - break; - case 'p': - if ( (L"perspectiveAbove") == sValue ) this->m_eValue = presetcameratypePerspectiveAbove; - else if ( (L"perspectiveAboveLeftFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveAboveLeftFacing; - else if ( (L"perspectiveAboveRightFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveAboveRightFacing; - else if ( (L"perspectiveBelow") == sValue ) this->m_eValue = presetcameratypePerspectiveBelow; - else if ( (L"perspectiveContrastingLeftFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveContrastingLeftFacing; - else if ( (L"perspectiveContrastingRightFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveContrastingRightFacing; - else if ( (L"perspectiveFront") == sValue ) this->m_eValue = presetcameratypePerspectiveFront; - else if ( (L"perspectiveHeroicExtremeLeftFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveHeroicExtremeLeftFacing; - else if ( (L"perspectiveHeroicExtremeRightFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveHeroicExtremeRightFacing; - else if ( (L"perspectiveHeroicLeftFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveHeroicLeftFacing; - else if ( (L"perspectiveHeroicRightFacing") == sValue ) this->m_eValue = presetcameratypePerspectiveHeroicRightFacing; - else if ( (L"perspectiveLeft") == sValue ) this->m_eValue = presetcameratypePerspectiveLeft; - else if ( (L"perspectiveRelaxed") == sValue ) this->m_eValue = presetcameratypePerspectiveRelaxed; - else if ( (L"perspectiveRelaxedModerately") == sValue ) this->m_eValue = presetcameratypePerspectiveRelaxedModerately; - else if ( (L"perspectiveRight") == sValue ) this->m_eValue = presetcameratypePerspectiveRight; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case presetcameratypeIsometricBottomDown: return (L"isometricBottomDown"); // (Isometric Bottom Down) - case presetcameratypeIsometricBottomUp: return (L"isometricBottomUp"); // (Isometric Bottom Up) - case presetcameratypeIsometricLeftDown: return (L"isometricLeftDown"); // (Isometric Left Down) - case presetcameratypeIsometricLeftUp: return (L"isometricLeftUp"); // (Isometric Left Up) - case presetcameratypeIsometricOffAxis1Left: return (L"isometricOffAxis1Left"); // (Isometric Off Axis 1 Left) - case presetcameratypeIsometricOffAxis1Right: return (L"isometricOffAxis1Right"); // (Isometric Off Axis 1 Right) - case presetcameratypeIsometricOffAxis1Top: return (L"isometricOffAxis1Top"); // (Isometric Off Axis 1 Top) - case presetcameratypeIsometricOffAxis2Left: return (L"isometricOffAxis2Left"); // (Isometric Off Axis 2 Left) - case presetcameratypeIsometricOffAxis2Right: return (L"isometricOffAxis2Right"); // (Isometric Off Axis 2 Right - case presetcameratypeIsometricOffAxis2Top: return (L"isometricOffAxis2Top"); // (Isometric Off Axis 2 Top) - case presetcameratypeIsometricOffAxis3Bottom: return (L"isometricOffAxis3Bottom"); // (Isometric Off Axis 3 Bottom) - case presetcameratypeIsometricOffAxis3Left: return (L"isometricOffAxis3Left"); // (Isometric Off Axis 3 Left) - case presetcameratypeIsometricOffAxis3Right: return (L"isometricOffAxis3Right"); // (Isometric Off Axis 3 Right) - case presetcameratypeIsometricOffAxis4Bottom: return (L"isometricOffAxis4Bottom"); // (Isometric Off Axis 4 Bottom) - case presetcameratypeIsometricOffAxis4Left: return (L"isometricOffAxis4Left"); // (Isometric Off Axis 4 Left) - case presetcameratypeIsometricOffAxis4Right: return (L"isometricOffAxis4Right"); // (Isometric Off Axis 4 Right) - case presetcameratypeIsometricRightDown: return (L"isometricRightDown"); // (Isometric Right Down) - case presetcameratypeIsometricRightUp: return (L"isometricRightUp"); // (Isometric Right Up) - case presetcameratypeIsometricTopDown: return (L"isometricTopDown"); // (Isometric Top Down) - case presetcameratypeIsometricTopUp: return (L"isometricTopUp"); // (Isometric Top Up) - case presetcameratypeLegacyObliqueBottom: return (L"legacyObliqueBottom"); // (Legacy Oblique Bottom) - case presetcameratypeLegacyObliqueBottomLeft: return (L"legacyObliqueBottomLeft"); // (Legacy Oblique Bottom Left) - case presetcameratypeLegacyObliqueBottomRight: return (L"legacyObliqueBottomRight"); // (Legacy Oblique Bottom Right) - case presetcameratypeLegacyObliqueFront: return (L"legacyObliqueFront"); // (Legacy Oblique Front) - case presetcameratypeLegacyObliqueLeft: return (L"legacyObliqueLeft"); // (Legacy Oblique Left) - case presetcameratypeLegacyObliqueRight: return (L"legacyObliqueRight"); // (Legacy Oblique Right) - case presetcameratypeLegacyObliqueTop: return (L"legacyObliqueTop"); // (Legacy Oblique Top) - case presetcameratypeLegacyObliqueTopLeft: return (L"legacyObliqueTopLeft"); // (Legacy Oblique Top Left) - case presetcameratypeLegacyObliqueTopRight: return (L"legacyObliqueTopRight"); // (Legacy Oblique Top Right) - case presetcameratypeLegacyPerspectiveBottom: return (L"legacyPerspectiveBottom"); // (Legacy Perspective Bottom) - case presetcameratypeLegacyPerspectiveBottomLeft: return (L"legacyPerspectiveBottomLeft"); // (Legacy Perspective Bottom Left) - case presetcameratypeLegacyPerspectiveBottomRight: return (L"legacyPerspectiveBottomRight"); // (Legacy Perspective Bottom Right) - case presetcameratypeLegacyPerspectiveFront: return (L"legacyPerspectiveFront"); // (Legacy Perspective Front) - case presetcameratypeLegacyPerspectiveLeft: return (L"legacyPerspectiveLeft"); // (Legacy Perspective Left) - case presetcameratypeLegacyPerspectiveRight: return (L"legacyPerspectiveRight"); // (Legacy Perspective Right) - case presetcameratypeLegacyPerspectiveTop: return (L"legacyPerspectiveTop"); // (Legacy Perspective Top) - case presetcameratypeLegacyPerspectiveTopLeft: return (L"legacyPerspectiveTopLeft"); // (Legacy Perspective Top Left) - case presetcameratypeLegacyPerspectiveTopRight: return (L"legacyPerspectiveTopRight"); // (Legacy Perspective Top Right) - case presetcameratypeObliqueBottom: return (L"obliqueBottom"); // (Oblique Bottom) - case presetcameratypeObliqueBottomLeft: return (L"obliqueBottomLeft"); // (Oblique Bottom Left) - case presetcameratypeObliqueBottomRight: return (L"obliqueBottomRight"); // (Oblique Bottom Right) - case presetcameratypeObliqueLeft: return (L"obliqueLeft"); // (Oblique Left) - case presetcameratypeObliqueRight: return (L"obliqueRight"); // (Oblique Right) - case presetcameratypeObliqueTop: return (L"obliqueTop"); // (Oblique Top) - case presetcameratypeObliqueTopLeft: return (L"obliqueTopLeft"); // (Oblique Top Left) - case presetcameratypeObliqueTopRight: return (L"obliqueTopRight"); // (Oblique Top Right) - case presetcameratypeOrthographicFront: return (L"orthographicFront"); // (Orthographic Front) - case presetcameratypePerspectiveAbove: return (L"perspectiveAbove"); // (Orthographic Above) - case presetcameratypePerspectiveAboveLeftFacing: return (L"perspectiveAboveLeftFacing"); // (Perspective Above Left Facing) - case presetcameratypePerspectiveAboveRightFacing: return (L"perspectiveAboveRightFacing"); // (Perspective Above Right Facing) - case presetcameratypePerspectiveBelow: return (L"perspectiveBelow"); // (Perspective Below) - case presetcameratypePerspectiveContrastingLeftFacing: return (L"perspectiveContrastingLeftFacing"); // (Perspective Contrasting Left Facing) - case presetcameratypePerspectiveContrastingRightFacing: return (L"perspectiveContrastingRightFacing"); // (Perspective Contrasting Right Facing) - case presetcameratypePerspectiveFront: return (L"perspectiveFront"); // (Perspective Front) - case presetcameratypePerspectiveHeroicExtremeLeftFacing: return (L"perspectiveHeroicExtremeLeftFacing"); // (Perspective Heroic Extreme Left Facing) - case presetcameratypePerspectiveHeroicExtremeRightFacing: return (L"perspectiveHeroicExtremeRightFacing"); // (Perspective Heroic Extreme Right Facing) - case presetcameratypePerspectiveHeroicLeftFacing: return (L"perspectiveHeroicLeftFacing"); // (Perspective Heroic Left Facing) - case presetcameratypePerspectiveHeroicRightFacing: return (L"perspectiveHeroicRightFacing"); // (Perspective Heroic Right Facing) - case presetcameratypePerspectiveLeft: return (L"perspectiveLeft"); // (Perspective Left) - case presetcameratypePerspectiveRelaxed: return (L"perspectiveRelaxed"); // (Perspective Relaxed) - case presetcameratypePerspectiveRelaxedModerately: return (L"perspectiveRelaxedModerately"); // (Perspective Relaxed Moderately) - case presetcameratypePerspectiveRight: return (L"perspectiveRight"); // (Perspective Right) - default : return (L"orthographicFront"); - } - } - - SimpleType_FromString (EPresetCameraType) - SimpleType_Operator_Equal (CPresetCameraType) + presetcameratypeIsometricOffAxis2Top, // (Isometric Off Axis 2 Top) + presetcameratypeIsometricOffAxis3Bottom, // (Isometric Off Axis 3 Bottom) + presetcameratypeIsometricOffAxis3Left, // (Isometric Off Axis 3 Left) + presetcameratypeIsometricOffAxis3Right, // (Isometric Off Axis 3 Right) + presetcameratypeIsometricOffAxis4Bottom, // (Isometric Off Axis 4 Bottom) + presetcameratypeIsometricOffAxis4Left, // (Isometric Off Axis 4 Left) + presetcameratypeIsometricOffAxis4Right, // (Isometric Off Axis 4 Right) + presetcameratypeIsometricRightDown, // (Isometric Right Down) + presetcameratypeIsometricRightUp, // (Isometric Right Up) + presetcameratypeIsometricTopDown, // (Isometric Top Down) + presetcameratypeIsometricTopUp, // (Isometric Top Up) + presetcameratypeLegacyObliqueBottom, // (Legacy Oblique Bottom) + presetcameratypeLegacyObliqueBottomLeft, // (Legacy Oblique Bottom Left) + presetcameratypeLegacyObliqueBottomRight, // (Legacy Oblique Bottom Right) + presetcameratypeLegacyObliqueFront, // (Legacy Oblique Front) + presetcameratypeLegacyObliqueLeft, // (Legacy Oblique Left) + presetcameratypeLegacyObliqueRight, // (Legacy Oblique Right) + presetcameratypeLegacyObliqueTop, // (Legacy Oblique Top) + presetcameratypeLegacyObliqueTopLeft, // (Legacy Oblique Top Left) + presetcameratypeLegacyObliqueTopRight, // (Legacy Oblique Top Right) + presetcameratypeLegacyPerspectiveBottom, // (Legacy Perspective Bottom) + presetcameratypeLegacyPerspectiveBottomLeft, // (Legacy Perspective Bottom Left) + presetcameratypeLegacyPerspectiveBottomRight, // (Legacy Perspective Bottom Right) + presetcameratypeLegacyPerspectiveFront, // (Legacy Perspective Front) + presetcameratypeLegacyPerspectiveLeft, // (Legacy Perspective Left) + presetcameratypeLegacyPerspectiveRight, // (Legacy Perspective Right) + presetcameratypeLegacyPerspectiveTop, // (Legacy Perspective Top) + presetcameratypeLegacyPerspectiveTopLeft, // (Legacy Perspective Top Left) + presetcameratypeLegacyPerspectiveTopRight, // (Legacy Perspective Top Right) + presetcameratypeObliqueBottom, // (Oblique Bottom) + presetcameratypeObliqueBottomLeft, // (Oblique Bottom Left) + presetcameratypeObliqueBottomRight, // (Oblique Bottom Right) + presetcameratypeObliqueLeft, // (Oblique Left) + presetcameratypeObliqueRight, // (Oblique Right) + presetcameratypeObliqueTop, // (Oblique Top) + presetcameratypeObliqueTopLeft, // (Oblique Top Left) + presetcameratypeObliqueTopRight, // (Oblique Top Right) + presetcameratypeOrthographicFront, // (Orthographic Front) + presetcameratypePerspectiveAbove, // (Orthographic Above) + presetcameratypePerspectiveAboveLeftFacing, // (Perspective Above Left Facing) + presetcameratypePerspectiveAboveRightFacing, // (Perspective Above Right Facing) + presetcameratypePerspectiveBelow, // (Perspective Below) + presetcameratypePerspectiveContrastingLeftFacing, // (Perspective Contrasting Left Facing) + presetcameratypePerspectiveContrastingRightFacing, // (Perspective Contrasting Right Facing) + presetcameratypePerspectiveFront, // (Perspective Front) + presetcameratypePerspectiveHeroicExtremeLeftFacing, // (Perspective Heroic Extreme Left Facing) + presetcameratypePerspectiveHeroicExtremeRightFacing, // (Perspective Heroic Extreme Right Facing) + presetcameratypePerspectiveHeroicLeftFacing, // (Perspective Heroic Left Facing) + presetcameratypePerspectiveHeroicRightFacing, // (Perspective Heroic Right Facing) + presetcameratypePerspectiveLeft, // (Perspective Left) + presetcameratypePerspectiveRelaxed, // (Perspective Relaxed) + presetcameratypePerspectiveRelaxedModerately, // (Perspective Relaxed Moderately) + presetcameratypePerspectiveRight, // (Perspective Right) }; + DEFINE_SIMPLE_TYPE(CPresetCameraType, EPresetCameraType, presetcameratypePerspectiveFront) //-------------------------------------------------------------------------------- // PresetColorVal 20.1.10.48 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPresetColorVal { - presetcolorvalAliceBlue = 0, // (Alice Blue Preset Color) - presetcolorvalAntiqueWhite, // (Antique White Preset Color) - presetcolorvalAqua, // (Aqua Preset Color) - presetcolorvalAquamarine, // (Aquamarine Preset Color) - presetcolorvalAzure, // (Azure Preset Color) - presetcolorvalBeige, // (Beige Preset Color) - presetcolorvalBisque, // (Bisque Preset Color) - presetcolorvalBlack, // (Black Preset Color) - presetcolorvalBlanchedAlmond, // (Blanched Almond Preset Color) - presetcolorvalBlue, // (Blue Preset Color) - presetcolorvalBlueViolet, // (Blue Violet Preset Color) - presetcolorvalBrown, // (Brown Preset Color) - presetcolorvalBurlyWood, // (Burly Wood Preset Color) - presetcolorvalCadetBlue, // (Cadet Blue Preset Color) - presetcolorvalChartreuse, // (Chartreuse Preset Color) - presetcolorvalChocolate, // (Chocolate Preset Color) - presetcolorvalCoral, // (Coral Preset Color) - presetcolorvalCornflowerBlue, // (Cornflower Blue Preset Color) - presetcolorvalCornsilk, // (Cornsilk Preset Color) - presetcolorvalCrimson, // (Crimson Preset Color) - presetcolorvalCyan, // (Cyan Preset Color) - presetcolorvalDarkBlue, // (Dark Blue Preset Color) - presetcolorvalDarkCyan, // (Dark Cyan Preset Color) - presetcolorvalDarkGoldenrod, // (Dark Goldenrod Preset Color) - presetcolorvalDarkGray, // (Dark Gray Preset Color) - presetcolorvalDarkGreen, // (Dark Green Preset Color) - presetcolorvalDarkGrey, // (Dark Gray Preset Color) - presetcolorvalDarkKhaki, // (Dark Khaki Preset Color) - presetcolorvalDarkMagenta, // (Dark Magenta Preset Color) - presetcolorvalDarkOliveGreen, // (Dark Olive Green Preset Color) - presetcolorvalDarkOrange, // (Dark Orange Preset Color) - presetcolorvalDarkOrchid, // (Dark Orchid Preset Color) - presetcolorvalDarkRed, // (Dark Red Preset Color) - presetcolorvalDarkSalmon, // (Dark Salmon Preset Color) - presetcolorvalDarkSeaGreen, // (Dark Sea Green Preset Color) - presetcolorvalDarkSlateBlue, // (Dark Slate Blue Preset Color) - presetcolorvalDarkSlateGray, // (Dark Slate Gray Preset Color) - presetcolorvalDarkSlateGrey, // (Dark Slate Gray Preset Color) - presetcolorvalDarkTurquoise, // (Dark Turquoise Preset Color) - presetcolorvalDarkViolet, // (Dark Violet Preset Color) - presetcolorvalDeepPink, // (Deep Pink Preset Color) - presetcolorvalDeepSkyBlue, // (Deep Sky Blue Preset Color) - presetcolorvalDimGray, // (Dim Gray Preset Color) - presetcolorvalDimGrey, // (Dim Gray Preset Color) - presetcolorvalDkBlue, // (Dark Blue Preset Color) - presetcolorvalDkCyan, // (Dark Cyan Preset Color) - presetcolorvalDkGoldenrod, // (Dark Goldenrod Preset Color) - presetcolorvalDkGray, // (Dark Gray Preset Color) - presetcolorvalDkGreen, // (Dark Green Preset Color) - presetcolorvalDkGrey, // (Dark Gray Preset Color) - presetcolorvalDkKhaki, // (Dark Khaki Preset Color) - presetcolorvalDkMagenta, // (Dark Magenta Preset Color) - presetcolorvalDkOliveGreen, // (Dark Olive Green Preset Color) - presetcolorvalDkOrange, // (Dark Orange Preset Color) - presetcolorvalDkOrchid, // (Dark Orchid Preset Color) - presetcolorvalDkRed, // (Dark Red Preset Color) - presetcolorvalDkSalmon, // (Dark Salmon Preset Color) - presetcolorvalDkSeaGreen, // (Dark Sea Green Preset Color) - presetcolorvalDkSlateBlue, // (Dark Slate Blue Preset Color) - presetcolorvalDkSlateGray, // (Dark Slate Gray Preset Color) - presetcolorvalDkSlateGrey, // (Dark Slate Gray Preset Color) - presetcolorvalDkTurquoise, // (Dark Turquoise Preset Color) - presetcolorvalDkViolet, // (Dark Violet Preset Color) - presetcolorvalDodgerBlue, // (Dodger Blue Preset Color) - presetcolorvalFirebrick, // (Firebrick Preset Color) - presetcolorvalFloralWhite, // (Floral White Preset Color) - presetcolorvalForestGreen, // (Forest Green Preset Color) - presetcolorvalFuchsia, // (Fuchsia Preset Color) - presetcolorvalGainsboro, // (Gainsboro Preset Color) - presetcolorvalGhostWhite, // (Ghost White Preset Color) - presetcolorvalGold, // (Gold Preset Color) - presetcolorvalGoldenrod, // (Goldenrod Preset Color) - presetcolorvalGray, // (Gray Preset Color) - presetcolorvalGreen, // (Green Preset Color) - presetcolorvalGreenYellow, // (Green Yellow Preset Color) - presetcolorvalGrey, // (Gray Preset Color) - presetcolorvalHoneydew, // (Honeydew Preset Color) - presetcolorvalHotPink, // (Hot Pink Preset Color) - presetcolorvalIndianRed, // (Indian Red Preset Color) - presetcolorvalIndigo, // (Indigo Preset Color) - presetcolorvalIvory, // (Ivory Preset Color) - presetcolorvalKhaki, // (Khaki Preset Color) - presetcolorvalLavender, // (Lavender Preset Color) - presetcolorvalLavenderBlush, // (Lavender Blush Preset Color) - presetcolorvalLawnGreen, // (Lawn Green Preset Color) - presetcolorvalLemonChiffon, // (Lemon Chiffon Preset Color) - presetcolorvalLightBlue, // (Light Blue Preset Color) - presetcolorvalLightCoral, // (Light Coral Preset Color) - presetcolorvalLightCyan, // (Light Cyan Preset Color) - presetcolorvalLightGoldenrodYellow, // (Light Goldenrod Yellow PreseColor) - presetcolorvalLightGray, // (Light Gray Preset Color) - presetcolorvalLightGreen, // (Light Green Preset Color) - presetcolorvalLightGrey, // (Light Gray Preset Color) - presetcolorvalLightPink, // (Light Pink Preset Color) - presetcolorvalLightSalmon, // (Light Salmon Preset Color) - presetcolorvalLightSeaGreen, // (Light Sea Green Preset Color) - presetcolorvalLightSkyBlue, // (Light Sky Blue Preset Color) - presetcolorvalLightSlateGray, // (Light Slate Gray Preset Color) - presetcolorvalLightSlateGrey, // (Light Slate Gray Preset Color) - presetcolorvalLightSteelBlue, // (Light Steel Blue Preset Color) - presetcolorvalLightYellow, // (Light Yellow Preset Color) - presetcolorvalLime, // (Lime Preset Color) - presetcolorvalLimeGreen, // (Lime Green Preset Color) - presetcolorvalLinen, // (Linen Preset Color) - presetcolorvalLtBlue, // (Light Blue Preset Color) - presetcolorvalLtCoral, // (Light Coral Preset Color) - presetcolorvalLtCyan, // (Light Cyan Preset Color) - presetcolorvalLtGoldenrodYellow, // (Light Goldenrod Yellow Preset Color) - presetcolorvalLtGray, // (Light Gray Preset Color) - presetcolorvalLtGreen, // (Light Green Preset Color) - presetcolorvalLtGrey, // (Light Gray Preset Color) - presetcolorvalLtPink, // (Light Pink Preset Color) - presetcolorvalLtSalmon, // (Light Salmon Preset Color) - presetcolorvalLtSeaGreen, // (Light Sea Green Preset Color) - presetcolorvalLtSkyBlue, // (Light Sky Blue Preset Color) - presetcolorvalLtSlateGray, // (Light Slate Gray Preset Color) - presetcolorvalLtSlateGrey, // (Light Slate Gray Preset Color) - presetcolorvalLtSteelBlue, // (Light Steel Blue Preset Color) - presetcolorvalLtYellow, // (Light Yellow Preset Color) - presetcolorvalMagenta, // (Magenta Preset Color) - presetcolorvalMaroon, // (Maroon Preset Color) - presetcolorvalMedAquamarine, // (Medium Aquamarine Preset Color) - presetcolorvalMedBlue, // (Medium Blue Preset Color) - presetcolorvalMediumAquamarine, // (Medium Aquamarine Preset Color) - presetcolorvalMediumBlue, // (Medium Blue Preset Color) - presetcolorvalMediumOrchid, // (Medium Orchid Preset Color) - presetcolorvalMediumPurple, // (Medium Purple Preset Color) - presetcolorvalMediumSeaGreen, // (Medium Sea Green Preset Color) - presetcolorvalMediumSlateBlue, // (Medium Slate Blue Preset Color) - presetcolorvalMediumSpringGreen, // (Medium Spring Green Preset Color) - presetcolorvalMediumTurquoise, // (Medium Turquoise Preset Color) - presetcolorvalMediumVioletRed, // (Medium Violet Red Preset Color) - presetcolorvalMedOrchid, // (Medium Orchid Preset Color) - presetcolorvalMedPurple, // (Medium Purple Preset Color) - presetcolorvalMedSeaGreen, // (Medium Sea Green Preset Color) - presetcolorvalMedSlateBlue, // (Medium Slate Blue Preset Color) + presetcolorvalAliceBlue = 0, // (Alice Blue Preset Color) + presetcolorvalAntiqueWhite, // (Antique White Preset Color) + presetcolorvalAqua, // (Aqua Preset Color) + presetcolorvalAquamarine, // (Aquamarine Preset Color) + presetcolorvalAzure, // (Azure Preset Color) + presetcolorvalBeige, // (Beige Preset Color) + presetcolorvalBisque, // (Bisque Preset Color) + presetcolorvalBlack, // (Black Preset Color) + presetcolorvalBlanchedAlmond, // (Blanched Almond Preset Color) + presetcolorvalBlue, // (Blue Preset Color) + presetcolorvalBlueViolet, // (Blue Violet Preset Color) + presetcolorvalBrown, // (Brown Preset Color) + presetcolorvalBurlyWood, // (Burly Wood Preset Color) + presetcolorvalCadetBlue, // (Cadet Blue Preset Color) + presetcolorvalChartreuse, // (Chartreuse Preset Color) + presetcolorvalChocolate, // (Chocolate Preset Color) + presetcolorvalCoral, // (Coral Preset Color) + presetcolorvalCornflowerBlue, // (Cornflower Blue Preset Color) + presetcolorvalCornsilk, // (Cornsilk Preset Color) + presetcolorvalCrimson, // (Crimson Preset Color) + presetcolorvalCyan, // (Cyan Preset Color) + presetcolorvalDarkBlue, // (Dark Blue Preset Color) + presetcolorvalDarkCyan, // (Dark Cyan Preset Color) + presetcolorvalDarkGoldenrod, // (Dark Goldenrod Preset Color) + presetcolorvalDarkGray, // (Dark Gray Preset Color) + presetcolorvalDarkGreen, // (Dark Green Preset Color) + presetcolorvalDarkGrey, // (Dark Gray Preset Color) + presetcolorvalDarkKhaki, // (Dark Khaki Preset Color) + presetcolorvalDarkMagenta, // (Dark Magenta Preset Color) + presetcolorvalDarkOliveGreen, // (Dark Olive Green Preset Color) + presetcolorvalDarkOrange, // (Dark Orange Preset Color) + presetcolorvalDarkOrchid, // (Dark Orchid Preset Color) + presetcolorvalDarkRed, // (Dark Red Preset Color) + presetcolorvalDarkSalmon, // (Dark Salmon Preset Color) + presetcolorvalDarkSeaGreen, // (Dark Sea Green Preset Color) + presetcolorvalDarkSlateBlue, // (Dark Slate Blue Preset Color) + presetcolorvalDarkSlateGray, // (Dark Slate Gray Preset Color) + presetcolorvalDarkSlateGrey, // (Dark Slate Gray Preset Color) + presetcolorvalDarkTurquoise, // (Dark Turquoise Preset Color) + presetcolorvalDarkViolet, // (Dark Violet Preset Color) + presetcolorvalDeepPink, // (Deep Pink Preset Color) + presetcolorvalDeepSkyBlue, // (Deep Sky Blue Preset Color) + presetcolorvalDimGray, // (Dim Gray Preset Color) + presetcolorvalDimGrey, // (Dim Gray Preset Color) + presetcolorvalDkBlue, // (Dark Blue Preset Color) + presetcolorvalDkCyan, // (Dark Cyan Preset Color) + presetcolorvalDkGoldenrod, // (Dark Goldenrod Preset Color) + presetcolorvalDkGray, // (Dark Gray Preset Color) + presetcolorvalDkGreen, // (Dark Green Preset Color) + presetcolorvalDkGrey, // (Dark Gray Preset Color) + presetcolorvalDkKhaki, // (Dark Khaki Preset Color) + presetcolorvalDkMagenta, // (Dark Magenta Preset Color) + presetcolorvalDkOliveGreen, // (Dark Olive Green Preset Color) + presetcolorvalDkOrange, // (Dark Orange Preset Color) + presetcolorvalDkOrchid, // (Dark Orchid Preset Color) + presetcolorvalDkRed, // (Dark Red Preset Color) + presetcolorvalDkSalmon, // (Dark Salmon Preset Color) + presetcolorvalDkSeaGreen, // (Dark Sea Green Preset Color) + presetcolorvalDkSlateBlue, // (Dark Slate Blue Preset Color) + presetcolorvalDkSlateGray, // (Dark Slate Gray Preset Color) + presetcolorvalDkSlateGrey, // (Dark Slate Gray Preset Color) + presetcolorvalDkTurquoise, // (Dark Turquoise Preset Color) + presetcolorvalDkViolet, // (Dark Violet Preset Color) + presetcolorvalDodgerBlue, // (Dodger Blue Preset Color) + presetcolorvalFirebrick, // (Firebrick Preset Color) + presetcolorvalFloralWhite, // (Floral White Preset Color) + presetcolorvalForestGreen, // (Forest Green Preset Color) + presetcolorvalFuchsia, // (Fuchsia Preset Color) + presetcolorvalGainsboro, // (Gainsboro Preset Color) + presetcolorvalGhostWhite, // (Ghost White Preset Color) + presetcolorvalGold, // (Gold Preset Color) + presetcolorvalGoldenrod, // (Goldenrod Preset Color) + presetcolorvalGray, // (Gray Preset Color) + presetcolorvalGreen, // (Green Preset Color) + presetcolorvalGreenYellow, // (Green Yellow Preset Color) + presetcolorvalGrey, // (Gray Preset Color) + presetcolorvalHoneydew, // (Honeydew Preset Color) + presetcolorvalHotPink, // (Hot Pink Preset Color) + presetcolorvalIndianRed, // (Indian Red Preset Color) + presetcolorvalIndigo, // (Indigo Preset Color) + presetcolorvalIvory, // (Ivory Preset Color) + presetcolorvalKhaki, // (Khaki Preset Color) + presetcolorvalLavender, // (Lavender Preset Color) + presetcolorvalLavenderBlush, // (Lavender Blush Preset Color) + presetcolorvalLawnGreen, // (Lawn Green Preset Color) + presetcolorvalLemonChiffon, // (Lemon Chiffon Preset Color) + presetcolorvalLightBlue, // (Light Blue Preset Color) + presetcolorvalLightCoral, // (Light Coral Preset Color) + presetcolorvalLightCyan, // (Light Cyan Preset Color) + presetcolorvalLightGoldenrodYellow, // (Light Goldenrod Yellow PreseColor) + presetcolorvalLightGray, // (Light Gray Preset Color) + presetcolorvalLightGreen, // (Light Green Preset Color) + presetcolorvalLightGrey, // (Light Gray Preset Color) + presetcolorvalLightPink, // (Light Pink Preset Color) + presetcolorvalLightSalmon, // (Light Salmon Preset Color) + presetcolorvalLightSeaGreen, // (Light Sea Green Preset Color) + presetcolorvalLightSkyBlue, // (Light Sky Blue Preset Color) + presetcolorvalLightSlateGray, // (Light Slate Gray Preset Color) + presetcolorvalLightSlateGrey, // (Light Slate Gray Preset Color) + presetcolorvalLightSteelBlue, // (Light Steel Blue Preset Color) + presetcolorvalLightYellow, // (Light Yellow Preset Color) + presetcolorvalLime, // (Lime Preset Color) + presetcolorvalLimeGreen, // (Lime Green Preset Color) + presetcolorvalLinen, // (Linen Preset Color) + presetcolorvalLtBlue, // (Light Blue Preset Color) + presetcolorvalLtCoral, // (Light Coral Preset Color) + presetcolorvalLtCyan, // (Light Cyan Preset Color) + presetcolorvalLtGoldenrodYellow, // (Light Goldenrod Yellow Preset Color) + presetcolorvalLtGray, // (Light Gray Preset Color) + presetcolorvalLtGreen, // (Light Green Preset Color) + presetcolorvalLtGrey, // (Light Gray Preset Color) + presetcolorvalLtPink, // (Light Pink Preset Color) + presetcolorvalLtSalmon, // (Light Salmon Preset Color) + presetcolorvalLtSeaGreen, // (Light Sea Green Preset Color) + presetcolorvalLtSkyBlue, // (Light Sky Blue Preset Color) + presetcolorvalLtSlateGray, // (Light Slate Gray Preset Color) + presetcolorvalLtSlateGrey, // (Light Slate Gray Preset Color) + presetcolorvalLtSteelBlue, // (Light Steel Blue Preset Color) + presetcolorvalLtYellow, // (Light Yellow Preset Color) + presetcolorvalMagenta, // (Magenta Preset Color) + presetcolorvalMaroon, // (Maroon Preset Color) + presetcolorvalMedAquamarine, // (Medium Aquamarine Preset Color) + presetcolorvalMedBlue, // (Medium Blue Preset Color) + presetcolorvalMediumAquamarine, // (Medium Aquamarine Preset Color) + presetcolorvalMediumBlue, // (Medium Blue Preset Color) + presetcolorvalMediumOrchid, // (Medium Orchid Preset Color) + presetcolorvalMediumPurple, // (Medium Purple Preset Color) + presetcolorvalMediumSeaGreen, // (Medium Sea Green Preset Color) + presetcolorvalMediumSlateBlue, // (Medium Slate Blue Preset Color) + presetcolorvalMediumSpringGreen, // (Medium Spring Green Preset Color) + presetcolorvalMediumTurquoise, // (Medium Turquoise Preset Color) + presetcolorvalMediumVioletRed, // (Medium Violet Red Preset Color) + presetcolorvalMedOrchid, // (Medium Orchid Preset Color) + presetcolorvalMedPurple, // (Medium Purple Preset Color) + presetcolorvalMedSeaGreen, // (Medium Sea Green Preset Color) + presetcolorvalMedSlateBlue, // (Medium Slate Blue Preset Color) presetcolorvalMedSpringGreen, // (Medium Spring Green Preset Color) - presetcolorvalMedTurquoise, // (Medium Turquoise Preset Color) - presetcolorvalMedVioletRed, // (Medium Violet Red Preset Color) - presetcolorvalMidnightBlue, // (Midnight Blue Preset Color) - presetcolorvalMintCream, // (Mint Cream Preset Color) - presetcolorvalMistyRose, // (Misty Rose Preset Color) - presetcolorvalMoccasin, // (Moccasin Preset Color) - presetcolorvalNavajoWhite, // (Navajo White Preset Color) - presetcolorvalNavy, // (Navy Preset Color) - presetcolorvalOldLace, // (Old Lace Preset Color) - presetcolorvalOlive, // (Olive Preset Color) - presetcolorvalOliveDrab, // (Olive Drab Preset Color) - presetcolorvalOrange, // (Orange Preset Color) - presetcolorvalOrangeRed, // (Orange Red Preset Color) - presetcolorvalOrchid, // (Orchid Preset Color) - presetcolorvalPaleGoldenrod, // (Pale Goldenrod Preset Color) - presetcolorvalPaleGreen, // (Pale Green Preset Color) - presetcolorvalPaleTurquoise, // (Pale Turquoise Preset Color) - presetcolorvalPaleVioletRed, // (Pale Violet Red Preset Color) - presetcolorvalPapayaWhip, // (Papaya Whip Preset Color) - presetcolorvalPeachPuff, // (Peach Puff Preset Color) - presetcolorvalPeru, // (Peru Preset Color) - presetcolorvalPink, // (Pink Preset Color) - presetcolorvalPlum, // (Plum Preset Color) - presetcolorvalPowderBlue, // (Powder Blue Preset Color) - presetcolorvalPurple, // (Purple Preset Color) - presetcolorvalRed, // (Red Preset Color) - presetcolorvalRosyBrown, // (Rosy Brown Preset Color) - presetcolorvalRoyalBlue, // (Royal Blue Preset Color) - presetcolorvalSaddleBrown, // (Saddle Brown Preset Color) - presetcolorvalSalmon, // (Salmon Preset Color) - presetcolorvalSandyBrown, // (Sandy Brown Preset Color) - presetcolorvalSeaGreen, // (Sea Green Preset Color) - presetcolorvalSeaShell, // (Sea Shell Preset Color) - presetcolorvalSienna, // (Sienna Preset Color) - presetcolorvalSilver, // (Silver Preset Color) - presetcolorvalSkyBlue, // (Sky Blue Preset Color) - presetcolorvalSlateBlue, // (Slate Blue Preset Color) - presetcolorvalSlateGray, // (Slate Gray Preset Color) - presetcolorvalSlateGrey, // (Slate Gray Preset Color) - presetcolorvalSnow, // (Snow Preset Color) - presetcolorvalSpringGreen, // (Spring Green Preset Color) - presetcolorvalSteelBlue, // (Steel Blue Preset Color) - presetcolorvalTan, // (Tan Preset Color) + presetcolorvalMedTurquoise, // (Medium Turquoise Preset Color) + presetcolorvalMedVioletRed, // (Medium Violet Red Preset Color) + presetcolorvalMidnightBlue, // (Midnight Blue Preset Color) + presetcolorvalMintCream, // (Mint Cream Preset Color) + presetcolorvalMistyRose, // (Misty Rose Preset Color) + presetcolorvalMoccasin, // (Moccasin Preset Color) + presetcolorvalNavajoWhite, // (Navajo White Preset Color) + presetcolorvalNavy, // (Navy Preset Color) + presetcolorvalOldLace, // (Old Lace Preset Color) + presetcolorvalOlive, // (Olive Preset Color) + presetcolorvalOliveDrab, // (Olive Drab Preset Color) + presetcolorvalOrange, // (Orange Preset Color) + presetcolorvalOrangeRed, // (Orange Red Preset Color) + presetcolorvalOrchid, // (Orchid Preset Color) + presetcolorvalPaleGoldenrod, // (Pale Goldenrod Preset Color) + presetcolorvalPaleGreen, // (Pale Green Preset Color) + presetcolorvalPaleTurquoise, // (Pale Turquoise Preset Color) + presetcolorvalPaleVioletRed, // (Pale Violet Red Preset Color) + presetcolorvalPapayaWhip, // (Papaya Whip Preset Color) + presetcolorvalPeachPuff, // (Peach Puff Preset Color) + presetcolorvalPeru, // (Peru Preset Color) + presetcolorvalPink, // (Pink Preset Color) + presetcolorvalPlum, // (Plum Preset Color) + presetcolorvalPowderBlue, // (Powder Blue Preset Color) + presetcolorvalPurple, // (Purple Preset Color) + presetcolorvalRed, // (Red Preset Color) + presetcolorvalRosyBrown, // (Rosy Brown Preset Color) + presetcolorvalRoyalBlue, // (Royal Blue Preset Color) + presetcolorvalSaddleBrown, // (Saddle Brown Preset Color) + presetcolorvalSalmon, // (Salmon Preset Color) + presetcolorvalSandyBrown, // (Sandy Brown Preset Color) + presetcolorvalSeaGreen, // (Sea Green Preset Color) + presetcolorvalSeaShell, // (Sea Shell Preset Color) + presetcolorvalSienna, // (Sienna Preset Color) + presetcolorvalSilver, // (Silver Preset Color) + presetcolorvalSkyBlue, // (Sky Blue Preset Color) + presetcolorvalSlateBlue, // (Slate Blue Preset Color) + presetcolorvalSlateGray, // (Slate Gray Preset Color) + presetcolorvalSlateGrey, // (Slate Gray Preset Color) + presetcolorvalSnow, // (Snow Preset Color) + presetcolorvalSpringGreen, // (Spring Green Preset Color) + presetcolorvalSteelBlue, // (Steel Blue Preset Color) + presetcolorvalTan, // (Tan Preset Color) presetcolorvalTeal, // (Teal Preset Color) - presetcolorvalThistle, // (Thistle Preset Color) - presetcolorvalTomato, // (Tomato Preset Color) - presetcolorvalTurquoise, // (Turquoise Preset Color) - presetcolorvalViolet, // (Violet Preset Color) - presetcolorvalWheat, // (Wheat Preset Color) - presetcolorvalWhite, // (White Preset Color) - presetcolorvalWhiteSmoke, // (White Smoke Preset Color) - presetcolorvalYellow, // (Yellow Preset Color) - presetcolorvalYellowGreen, // (Yellow Green Preset Color) + presetcolorvalThistle, // (Thistle Preset Color) + presetcolorvalTomato, // (Tomato Preset Color) + presetcolorvalTurquoise, // (Turquoise Preset Color) + presetcolorvalViolet, // (Violet Preset Color) + presetcolorvalWheat, // (Wheat Preset Color) + presetcolorvalWhite, // (White Preset Color) + presetcolorvalWhiteSmoke, // (White Smoke Preset Color) + presetcolorvalYellow, // (Yellow Preset Color) + presetcolorvalYellowGreen, // (Yellow Green Preset Color) }; - template - class CPresetColorVal : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CPresetColorVal, EPresetColorVal, presetcolorvalBlack) public: - CPresetColorVal() {} + bool FromStringIgnoreCase(const std::wstring &sValue); + unsigned char Get_R() const; + unsigned char Get_G() const; + unsigned char Get_B() const; + unsigned char Get_A() const; - virtual EPresetColorVal FromString(std::wstring &sValue) - { - this->m_eValue = presetcolorvalBlack; - SetRGBA( 0, 0, 0, 255 ); - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( (L"aliceBlue") == sValue ) { this->m_eValue = presetcolorvalAliceBlue; SetRGBA(240,248,255); } - else if ( (L"antiqueWhite") == sValue ) { this->m_eValue = presetcolorvalAntiqueWhite; SetRGBA(250,235,215); } - else if ( (L"aqua") == sValue ) { this->m_eValue = presetcolorvalAqua; SetRGBA(0,255,255); } - else if ( (L"aquamarine") == sValue ) { this->m_eValue = presetcolorvalAquamarine; SetRGBA(127,255,212); } - else if ( (L"azure") == sValue ) { this->m_eValue = presetcolorvalAzure; SetRGBA(240,255,255); } - break; - case 'b': - if ( (L"beige") == sValue ) { this->m_eValue = presetcolorvalBeige; SetRGBA(245,245,220); } - else if ( (L"bisque") == sValue ) { this->m_eValue = presetcolorvalBisque ; SetRGBA(255,228,196); } - else if ( (L"black") == sValue ) { this->m_eValue = presetcolorvalBlack ; SetRGBA(0,0,0); } - else if ( (L"blanchedAlmond") == sValue ) { this->m_eValue = presetcolorvalBlanchedAlmond ; SetRGBA(255,235,205); } - else if ( (L"blue") == sValue ) { this->m_eValue = presetcolorvalBlue ; SetRGBA(0,0,255); } - else if ( (L"blueViolet") == sValue ) { this->m_eValue = presetcolorvalBlueViolet ; SetRGBA(138,43,226); } - else if ( (L"brown") == sValue ) { this->m_eValue = presetcolorvalBrown ; SetRGBA(165,42,42); } - else if ( (L"burlyWood") == sValue ) { this->m_eValue = presetcolorvalBurlyWood ; SetRGBA(222,184,135); } - break; - case 'c': - if ( (L"cadetBlue") == sValue ) { this->m_eValue = presetcolorvalCadetBlue ; SetRGBA(95,158,160); } - else if ( (L"chartreuse") == sValue ) { this->m_eValue = presetcolorvalChartreuse ; SetRGBA(127,255,0); } - else if ( (L"chocolate") == sValue ) { this->m_eValue = presetcolorvalChocolate ; SetRGBA(210,105,30); } - else if ( (L"coral") == sValue ) { this->m_eValue = presetcolorvalCoral ; SetRGBA(255,127,80); } - else if ( (L"cornflowerBlue") == sValue ) { this->m_eValue = presetcolorvalCornflowerBlue ; SetRGBA(100,149,237); } - else if ( (L"cornsilk") == sValue ) { this->m_eValue = presetcolorvalCornsilk ; SetRGBA(255,248,220); } - else if ( (L"crimson") == sValue ) { this->m_eValue = presetcolorvalCrimson ; SetRGBA(220,20,60); } - else if ( (L"cyan") == sValue ) { this->m_eValue = presetcolorvalCyan ; SetRGBA(0,255,255); } - break; - case 'd': - if ( (L"darkBlue") == sValue ) { this->m_eValue = presetcolorvalDarkBlue ; SetRGBA(0,0,139); } - else if ( (L"darkCyan") == sValue ) { this->m_eValue = presetcolorvalDarkCyan ; SetRGBA(0,139,139); } - else if ( (L"darkGoldenrod") == sValue ) { this->m_eValue = presetcolorvalDarkGoldenrod ; SetRGBA(184,134,11); } - else if ( (L"darkGray") == sValue ) { this->m_eValue = presetcolorvalDarkGray ; SetRGBA(169,169,169); } - else if ( (L"darkGreen") == sValue ) { this->m_eValue = presetcolorvalDarkGreen ; SetRGBA(0,100,0); } - else if ( (L"darkGrey") == sValue ) { this->m_eValue = presetcolorvalDarkGrey ; SetRGBA(169,169,169); } - else if ( (L"darkKhaki") == sValue ) { this->m_eValue = presetcolorvalDarkKhaki ; SetRGBA(189,183,107); } - else if ( (L"darkMagenta") == sValue ) { this->m_eValue = presetcolorvalDarkMagenta ; SetRGBA(139,0,139); } - else if ( (L"darkOliveGreen") == sValue ) { this->m_eValue = presetcolorvalDarkOliveGreen ; SetRGBA(85,107,47); } - else if ( (L"darkOrange") == sValue ) { this->m_eValue = presetcolorvalDarkOrange ; SetRGBA(255,140,0); } - else if ( (L"darkOrchid") == sValue ) { this->m_eValue = presetcolorvalDarkOrchid ; SetRGBA(153,50,204); } - else if ( (L"darkRed") == sValue ) { this->m_eValue = presetcolorvalDarkRed ; SetRGBA(139,0,0); } - else if ( (L"darkSalmon") == sValue ) { this->m_eValue = presetcolorvalDarkSalmon ; SetRGBA(233,150,122); } - else if ( (L"darkSeaGreen") == sValue ) { this->m_eValue = presetcolorvalDarkSeaGreen ; SetRGBA(143,188,143); } - else if ( (L"darkSlateBlue") == sValue ) { this->m_eValue = presetcolorvalDarkSlateBlue ; SetRGBA(72,61,139); } - else if ( (L"darkSlateGray") == sValue ) { this->m_eValue = presetcolorvalDarkSlateGray ; SetRGBA(47,79,79); } - else if ( (L"darkSlateGrey") == sValue ) { this->m_eValue = presetcolorvalDarkSlateGrey ; SetRGBA(47,79,79); } - else if ( (L"darkTurquoise") == sValue ) { this->m_eValue = presetcolorvalDarkTurquoise ; SetRGBA(0,206,209); } - else if ( (L"darkViolet") == sValue ) { this->m_eValue = presetcolorvalDarkViolet ; SetRGBA(148,0,211); } - else if ( (L"deepPink") == sValue ) { this->m_eValue = presetcolorvalDeepPink ; SetRGBA(255,20,147); } - else if ( (L"deepSkyBlue") == sValue ) { this->m_eValue = presetcolorvalDeepSkyBlue ; SetRGBA(0,191,255); } - else if ( (L"dimGray") == sValue ) { this->m_eValue = presetcolorvalDimGray ; SetRGBA(105,105,105); } - else if ( (L"dimGrey") == sValue ) { this->m_eValue = presetcolorvalDimGrey ; SetRGBA(105,105,105); } - else if ( (L"dkBlue") == sValue ) { this->m_eValue = presetcolorvalDkBlue ; SetRGBA(0,0,139); } - else if ( (L"dkCyan") == sValue ) { this->m_eValue = presetcolorvalDkCyan ; SetRGBA(0,139,139); } - else if ( (L"dkGoldenrod") == sValue ) { this->m_eValue = presetcolorvalDkGoldenrod ; SetRGBA(184,134,11); } - else if ( (L"dkGray") == sValue ) { this->m_eValue = presetcolorvalDkGray ; SetRGBA(169,169,169); } - else if ( (L"dkGreen") == sValue ) { this->m_eValue = presetcolorvalDkGreen ; SetRGBA(0,100,0); } - else if ( (L"dkGrey") == sValue ) { this->m_eValue = presetcolorvalDkGrey ; SetRGBA(169,169,169); } - else if ( (L"dkKhaki") == sValue ) { this->m_eValue = presetcolorvalDkKhaki ; SetRGBA(189,183,107); } - else if ( (L"dkMagenta") == sValue ) { this->m_eValue = presetcolorvalDkMagenta ; SetRGBA(139,0,139); } - else if ( (L"dkOliveGreen") == sValue ) { this->m_eValue = presetcolorvalDkOliveGreen ; SetRGBA(85,107,47); } - else if ( (L"dkOrange") == sValue ) { this->m_eValue = presetcolorvalDkOrange ; SetRGBA(255,140,0); } - else if ( (L"dkOrchid") == sValue ) { this->m_eValue = presetcolorvalDkOrchid ; SetRGBA(153,50,204); } - else if ( (L"dkRed") == sValue ) { this->m_eValue = presetcolorvalDkRed ; SetRGBA(139,0,0); } - else if ( (L"dkSalmon") == sValue ) { this->m_eValue = presetcolorvalDkSalmon ; SetRGBA(233,150,122); } - else if ( (L"dkSeaGreen") == sValue ) { this->m_eValue = presetcolorvalDkSeaGreen ; SetRGBA(143,188,139); } - else if ( (L"dkSlateBlue") == sValue ) { this->m_eValue = presetcolorvalDkSlateBlue ; SetRGBA(72,61,139); } - else if ( (L"dkSlateGray") == sValue ) { this->m_eValue = presetcolorvalDkSlateGray ; SetRGBA(47,79,79); } - else if ( (L"dkSlateGrey") == sValue ) { this->m_eValue = presetcolorvalDkSlateGrey ; SetRGBA(47,79,79); } - else if ( (L"dkTurquoise") == sValue ) { this->m_eValue = presetcolorvalDkTurquoise ; SetRGBA(0,206,209); } - else if ( (L"dkViolet") == sValue ) { this->m_eValue = presetcolorvalDkViolet ; SetRGBA(148,0,211); } - else if ( (L"dodgerBlue") == sValue ) { this->m_eValue = presetcolorvalDodgerBlue ; SetRGBA(30,144,255); } - break; - case 'f': - if ( (L"firebrick") == sValue ) { this->m_eValue = presetcolorvalFirebrick ; SetRGBA(178,34,34); } - else if ( (L"floralWhite") == sValue ) { this->m_eValue = presetcolorvalFloralWhite ; SetRGBA(255,250,240); } - else if ( (L"forestGreen") == sValue ) { this->m_eValue = presetcolorvalForestGreen ; SetRGBA(34,139,34); } - else if ( (L"fuchsia") == sValue ) { this->m_eValue = presetcolorvalFuchsia ; SetRGBA(255,0,255); } - break; - case 'g': - if ( (L"gainsboro") == sValue ) { this->m_eValue = presetcolorvalGainsboro ; SetRGBA(220,220,220); } - else if ( (L"ghostWhite") == sValue ) { this->m_eValue = presetcolorvalGhostWhite ; SetRGBA(248,248,255); } - else if ( (L"gold") == sValue ) { this->m_eValue = presetcolorvalGold ; SetRGBA(255,215,0); } - else if ( (L"goldenrod") == sValue ) { this->m_eValue = presetcolorvalGoldenrod ; SetRGBA(218,165,32); } - else if ( (L"gray") == sValue ) { this->m_eValue = presetcolorvalGray ; SetRGBA(128,128,128); } - else if ( (L"green") == sValue ) { this->m_eValue = presetcolorvalGreen ; SetRGBA(0,128,0); } - else if ( (L"greenYellow") == sValue ) { this->m_eValue = presetcolorvalGreenYellow ; SetRGBA(173,255,47); } - else if ( (L"grey") == sValue ) { this->m_eValue = presetcolorvalGrey ; SetRGBA(128,128,128); } - break; - case 'h': - if ( (L"honeydew") == sValue ) { this->m_eValue = presetcolorvalHoneydew ; SetRGBA(240,255,240); } - else if ( (L"hotPink") == sValue ) { this->m_eValue = presetcolorvalHotPink ; SetRGBA(255,105,180); } - break; - case 'i': - if ( (L"indianRed") == sValue ) { this->m_eValue = presetcolorvalIndianRed ; SetRGBA(205,92,92); } - else if ( (L"indigo") == sValue ) { this->m_eValue = presetcolorvalIndigo ; SetRGBA(75,0,130); } - else if ( (L"ivory") == sValue ) { this->m_eValue = presetcolorvalIvory ; SetRGBA(255,255,240); } - break; - case 'k': - if ( (L"khaki") == sValue ) { this->m_eValue = presetcolorvalKhaki ; SetRGBA(240,230,140); } - break; - case 'l': - if ( (L"lavender") == sValue ) { this->m_eValue = presetcolorvalLavender ; SetRGBA(230,230,250); } - else if ( (L"lavenderBlush") == sValue ) { this->m_eValue = presetcolorvalLavenderBlush ; SetRGBA(255,240,245); } - else if ( (L"lawnGreen") == sValue ) { this->m_eValue = presetcolorvalLawnGreen ; SetRGBA(124,252,0); } - else if ( (L"lemonChiffon") == sValue ) { this->m_eValue = presetcolorvalLemonChiffon ; SetRGBA(255,250,205); } - else if ( (L"lightBlue") == sValue ) { this->m_eValue = presetcolorvalLightBlue ; SetRGBA(173,216,230); } - else if ( (L"lightCoral") == sValue ) { this->m_eValue = presetcolorvalLightCoral ; SetRGBA(240,128,128); } - else if ( (L"lightCyan") == sValue ) { this->m_eValue = presetcolorvalLightCyan ; SetRGBA(224,255,255); } - else if ( (L"lightGoldenrodYellow")== sValue ) { this->m_eValue = presetcolorvalLightGoldenrodYellow; SetRGBA(250,250,210); } - else if ( (L"lightGray") == sValue ) { this->m_eValue = presetcolorvalLightGray ; SetRGBA(211,211,211); } - else if ( (L"lightGreen") == sValue ) { this->m_eValue = presetcolorvalLightGreen ; SetRGBA(144,238,144); } - else if ( (L"lightGrey") == sValue ) { this->m_eValue = presetcolorvalLightGrey ; SetRGBA(211,211,211); } - else if ( (L"lightPink") == sValue ) { this->m_eValue = presetcolorvalLightPink ; SetRGBA(255,182,193); } - else if ( (L"lightSalmon") == sValue ) { this->m_eValue = presetcolorvalLightSalmon ; SetRGBA(255,160,122); } - else if ( (L"lightSeaGreen") == sValue ) { this->m_eValue = presetcolorvalLightSeaGreen ; SetRGBA(32,178,170); } - else if ( (L"lightSkyBlue") == sValue ) { this->m_eValue = presetcolorvalLightSkyBlue ; SetRGBA(135,206,250); } - else if ( (L"lightSlateGray") == sValue ) { this->m_eValue = presetcolorvalLightSlateGray ; SetRGBA(119,136,153); } - else if ( (L"lightSlateGrey") == sValue ) { this->m_eValue = presetcolorvalLightSlateGrey ; SetRGBA(119,136,153); } - else if ( (L"lightSteelBlue") == sValue ) { this->m_eValue = presetcolorvalLightSteelBlue ; SetRGBA(176,196,222); } - else if ( (L"lightYellow") == sValue ) { this->m_eValue = presetcolorvalLightYellow ; SetRGBA(255,255,224); } - else if ( (L"lime") == sValue ) { this->m_eValue = presetcolorvalLime ; SetRGBA(0,255,0); } - else if ( (L"limeGreen") == sValue ) { this->m_eValue = presetcolorvalLimeGreen ; SetRGBA(50,205,50); } - else if ( (L"linen") == sValue ) { this->m_eValue = presetcolorvalLinen; SetRGBA(250,240,230); } - else if ( (L"ltBlue") == sValue ) { this->m_eValue = presetcolorvalLtBlue ; SetRGBA(173,216,230); } - else if ( (L"ltCoral") == sValue ) { this->m_eValue = presetcolorvalLtCoral ; SetRGBA(240,128,128); } - else if ( (L"ltCyan") == sValue ) { this->m_eValue = presetcolorvalLtCyan ; SetRGBA(224,255,255); } - else if ( (L"ltGoldenrodYellow") == sValue ) { this->m_eValue = presetcolorvalLtGoldenrodYellow; SetRGBA(250,250,120); } - else if ( (L"ltGray") == sValue ) { this->m_eValue = presetcolorvalLtGray ; SetRGBA(211,211,211); } - else if ( (L"ltGreen") == sValue ) { this->m_eValue = presetcolorvalLtGreen ; SetRGBA(144,238,144); } - else if ( (L"ltGrey") == sValue ) { this->m_eValue = presetcolorvalLtGrey ; SetRGBA(211,211,211); } - else if ( (L"ltPink") == sValue ) { this->m_eValue = presetcolorvalLtPink ; SetRGBA(255,182,193); } - else if ( (L"ltSalmon") == sValue ) { this->m_eValue = presetcolorvalLtSalmon ; SetRGBA(255,160,122); } - else if ( (L"ltSeaGreen") == sValue ) { this->m_eValue = presetcolorvalLtSeaGreen ; SetRGBA(32,178,170); } - else if ( (L"ltSkyBlue") == sValue ) { this->m_eValue = presetcolorvalLtSkyBlue ; SetRGBA(135,206,250); } - else if ( (L"ltSlateGray") == sValue ) { this->m_eValue = presetcolorvalLtSlateGray ; SetRGBA(119,136,153); } - else if ( (L"ltSlateGrey") == sValue ) { this->m_eValue = presetcolorvalLtSlateGrey ; SetRGBA(119,136,153); } - else if ( (L"ltSteelBlue") == sValue ) { this->m_eValue = presetcolorvalLtSteelBlue ; SetRGBA(176,196,222); } - else if ( (L"ltYellow") == sValue ) { this->m_eValue = presetcolorvalLtYellow ; SetRGBA(255,255,224); } - break; - case 'm': - if ( (L"magenta") == sValue ) { this->m_eValue = presetcolorvalMagenta ; SetRGBA(255,0,255); } - else if ( (L"maroon") == sValue ) { this->m_eValue = presetcolorvalMaroon ; SetRGBA(128,0,0); } - else if ( (L"medAquamarine") == sValue ) { this->m_eValue = presetcolorvalMedAquamarine ; SetRGBA(102,205,170); } - else if ( (L"medBlue") == sValue ) { this->m_eValue = presetcolorvalMedBlue ; SetRGBA(0,0,205); } - else if ( (L"mediumAquamarine") == sValue ) { this->m_eValue = presetcolorvalMediumAquamarine; SetRGBA(102,205,170); } - else if ( (L"mediumBlue") == sValue ) { this->m_eValue = presetcolorvalMediumBlue ; SetRGBA(0,0,205); } - else if ( (L"mediumOrchid") == sValue ) { this->m_eValue = presetcolorvalMediumOrchid ; SetRGBA(186,85,211); } - else if ( (L"mediumPurple") == sValue ) { this->m_eValue = presetcolorvalMediumPurple ; SetRGBA(147,112,219); } - else if ( (L"mediumSeaGreen") == sValue ) { this->m_eValue = presetcolorvalMediumSeaGreen ; SetRGBA(60,179,113); } - else if ( (L"mediumSlateBlue") == sValue ) { this->m_eValue = presetcolorvalMediumSlateBlue ; SetRGBA(123,104,238); } - else if ( (L"mediumSpringGreen") == sValue ) { this->m_eValue = presetcolorvalMediumSpringGreen; SetRGBA(0,250,154); } - else if ( (L"mediumTurquoise") == sValue ) { this->m_eValue = presetcolorvalMediumTurquoise ; SetRGBA(72,209,204); } - else if ( (L"mediumVioletRed") == sValue ) { this->m_eValue = presetcolorvalMediumVioletRed ; SetRGBA(199,21,133); } - else if ( (L"medOrchid") == sValue ) { this->m_eValue = presetcolorvalMedOrchid ; SetRGBA(186,85,211); } - else if ( (L"medPurple") == sValue ) { this->m_eValue = presetcolorvalMedPurple ; SetRGBA(147,112,219); } - else if ( (L"medSeaGreen") == sValue ) { this->m_eValue = presetcolorvalMedSeaGreen ; SetRGBA(60,179,113); } - else if ( (L"medSlateBlue") == sValue ) { this->m_eValue = presetcolorvalMedSlateBlue ; SetRGBA(123,104,238); } - else if ( (L"medSpringGreen") == sValue ) { this->m_eValue = presetcolorvalMedSpringGreen ; SetRGBA(0,250,154); } - else if ( (L"medTurquoise") == sValue ) { this->m_eValue = presetcolorvalMedTurquoise ; SetRGBA(72,209,204); } - else if ( (L"medVioletRed") == sValue ) { this->m_eValue = presetcolorvalMedVioletRed ; SetRGBA(199,21,133); } - else if ( (L"midnightBlue") == sValue ) { this->m_eValue = presetcolorvalMidnightBlue ; SetRGBA(25,25,112); } - else if ( (L"mintCream") == sValue ) { this->m_eValue = presetcolorvalMintCream ; SetRGBA(245,255,250); } - else if ( (L"mistyRose") == sValue ) { this->m_eValue = presetcolorvalMistyRose ; SetRGBA(255,228,225); } - else if ( (L"moccasin") == sValue ) { this->m_eValue = presetcolorvalMoccasin ; SetRGBA(255,228,181); } - break; - case 'n': - if ( (L"navajoWhite") == sValue ) { this->m_eValue = presetcolorvalNavajoWhite ; SetRGBA(255,222,173); } - else if ( (L"navy") == sValue ) { this->m_eValue = presetcolorvalNavy ; SetRGBA(0,0,128); } - break; - case 'o': - if ( (L"oldLace") == sValue ) { this->m_eValue = presetcolorvalOldLace ; SetRGBA(253,245,230); } - else if ( (L"olive") == sValue ) { this->m_eValue = presetcolorvalOlive ; SetRGBA(128,128,0); } - else if ( (L"oliveDrab") == sValue ) { this->m_eValue = presetcolorvalOliveDrab ; SetRGBA(107,142,35); } - else if ( (L"orange") == sValue ) { this->m_eValue = presetcolorvalOrange ; SetRGBA(255,165,0); } - else if ( (L"orangeRed") == sValue ) { this->m_eValue = presetcolorvalOrangeRed ; SetRGBA(255,69,0); } - else if ( (L"orchid") == sValue ) { this->m_eValue = presetcolorvalOrchid ; SetRGBA(218,112,214); } - break; - case 'p': - if ( (L"paleGoldenrod") == sValue ) { this->m_eValue = presetcolorvalPaleGoldenrod ; SetRGBA(238,232,170); } - else if ( (L"paleGreen") == sValue ) { this->m_eValue = presetcolorvalPaleGreen ; SetRGBA(152,251,152); } - else if ( (L"paleTurquoise") == sValue ) { this->m_eValue = presetcolorvalPaleTurquoise ; SetRGBA(175,238,238); } - else if ( (L"paleVioletRed") == sValue ) { this->m_eValue = presetcolorvalPaleVioletRed ; SetRGBA(219,112,147); } - else if ( (L"papayaWhip") == sValue ) { this->m_eValue = presetcolorvalPapayaWhip ; SetRGBA(255,239,213); } - else if ( (L"peachPuff") == sValue ) { this->m_eValue = presetcolorvalPeachPuff ; SetRGBA(255,218,185); } - else if ( (L"peru") == sValue ) { this->m_eValue = presetcolorvalPeru ; SetRGBA(205,133,63); } - else if ( (L"pink") == sValue ) { this->m_eValue = presetcolorvalPink ; SetRGBA(255,192,203); } - else if ( (L"plum") == sValue ) { this->m_eValue = presetcolorvalPlum ; SetRGBA(221,160,221); } - else if ( (L"powderBlue") == sValue ) { this->m_eValue = presetcolorvalPowderBlue ; SetRGBA(176,224,230); } - else if ( (L"purple") == sValue ) { this->m_eValue = presetcolorvalPurple ; SetRGBA(128,0,128); } - break; - case 'r': - if ( (L"red") == sValue ) { this->m_eValue = presetcolorvalRed ; SetRGBA(255,0,0); } - else if ( (L"rosyBrown") == sValue ) { this->m_eValue = presetcolorvalRosyBrown ; SetRGBA(188,143,143); } - else if ( (L"royalBlue") == sValue ) { this->m_eValue = presetcolorvalRoyalBlue ; SetRGBA(65,105,225); } - break; - case 's': - if ( (L"saddleBrown") == sValue ) { this->m_eValue = presetcolorvalSaddleBrown ; SetRGBA(139,69,19); } - else if ( (L"salmon") == sValue ) { this->m_eValue = presetcolorvalSalmon ; SetRGBA(250,128,114); } - else if ( (L"sandyBrown") == sValue ) { this->m_eValue = presetcolorvalSandyBrown ; SetRGBA(244,164,96); } - else if ( (L"seaGreen") == sValue ) { this->m_eValue = presetcolorvalSeaGreen ; SetRGBA(46,139,87); } - else if ( (L"seaShell") == sValue ) { this->m_eValue = presetcolorvalSeaShell ; SetRGBA(255,245,238); } - else if ( (L"sienna") == sValue ) { this->m_eValue = presetcolorvalSienna ; SetRGBA(160,82,45); } - else if ( (L"silver") == sValue ) { this->m_eValue = presetcolorvalSilver ; SetRGBA(192,192,192); } - else if ( (L"skyBlue") == sValue ) { this->m_eValue = presetcolorvalSkyBlue ; SetRGBA(135,206,235); } - else if ( (L"slateBlue") == sValue ) { this->m_eValue = presetcolorvalSlateBlue ; SetRGBA(106,90,205); } - else if ( (L"slateGray") == sValue ) { this->m_eValue = presetcolorvalSlateGray ; SetRGBA(112,128,144); } - else if ( (L"slateGrey") == sValue ) { this->m_eValue = presetcolorvalSlateGrey ; SetRGBA(112,128,144); } - else if ( (L"snow") == sValue ) { this->m_eValue = presetcolorvalSnow ; SetRGBA(255,250,250); } - else if ( (L"springGreen") == sValue ) { this->m_eValue = presetcolorvalSpringGreen ; SetRGBA(0,255,127); } - else if ( (L"steelBlue") == sValue ) { this->m_eValue = presetcolorvalSteelBlue ; SetRGBA(70,130,180); } - break; - case 't': - if ( (L"tan") == sValue ) { this->m_eValue = presetcolorvalTan ; SetRGBA(210,180,140); } - else if ( (L"teal") == sValue ) { this->m_eValue = presetcolorvalTeal ; SetRGBA(0,128,128); } - else if ( (L"thistle") == sValue ) { this->m_eValue = presetcolorvalThistle ; SetRGBA(216,191,216); } - else if ( (L"tomato") == sValue ) { this->m_eValue = presetcolorvalTomato ; SetRGBA(255,99,71); } - else if ( (L"turquoise") == sValue ) { this->m_eValue = presetcolorvalTurquoise ; SetRGBA(64,224,208); } - break; - case 'v': - if ( (L"violet") == sValue ) { this->m_eValue = presetcolorvalViolet ; SetRGBA(238,130,238); } - break; - case 'w': - if ( (L"wheat") == sValue ) { this->m_eValue = presetcolorvalWheat ; SetRGBA(245,222,179); } - else if ( (L"white") == sValue ) { this->m_eValue = presetcolorvalWhite ; SetRGBA(255,255,255); } - else if ( (L"whiteSmoke") == sValue ) { this->m_eValue = presetcolorvalWhiteSmoke ; SetRGBA(245,245,245); } - break; - case 'y': - if ( (L"yellow") == sValue ) { this->m_eValue = presetcolorvalYellow ; SetRGBA(255,255,0); } - else if ( (L"yellowGreen") == sValue ) { this->m_eValue = presetcolorvalYellowGreen ; SetRGBA(154,205,50); } - break; - } - - return this->m_eValue; - } - - bool FromStringIgnoreCase(std::wstring &sValue) - { - this->m_eValue = presetcolorvalBlack; - SetRGBA( 0, 0, 0, 255 ); - - if ( sValue.empty() ) - return false; - - std::wstring sValueLower = sValue; - NSStringExt::ToLower(sValueLower); - wchar_t wChar = sValueLower[0]; - switch ( wChar ) - { - case 'a': - if ( (L"aliceblue") == sValueLower ) { this->m_eValue = presetcolorvalAliceBlue; SetRGBA(240,248,255); } - else if ( (L"antiquewhite") == sValueLower ) { this->m_eValue = presetcolorvalAntiqueWhite; SetRGBA(250,235,215); } - else if ( (L"aqua") == sValueLower ) { this->m_eValue = presetcolorvalAqua; SetRGBA(0,255,255); } - else if ( (L"aquamarine") == sValueLower ) { this->m_eValue = presetcolorvalAquamarine; SetRGBA(127,255,212); } - else if ( (L"azure") == sValueLower ) { this->m_eValue = presetcolorvalAzure; SetRGBA(240,255,255); } - break; - case 'b': - if ( (L"beige") == sValueLower ) { this->m_eValue = presetcolorvalBeige; SetRGBA(245,245,220); } - else if ( (L"bisque") == sValueLower ) { this->m_eValue = presetcolorvalBisque ; SetRGBA(255,228,196); } - else if ( (L"black") == sValueLower ) { return true; } - else if ( (L"blanchedalmond") == sValueLower ) { this->m_eValue = presetcolorvalBlanchedAlmond ; SetRGBA(255,235,205); } - else if ( (L"blue") == sValueLower ) { this->m_eValue = presetcolorvalBlue ; SetRGBA(0,0,255); } - else if ( (L"blueviolet") == sValueLower ) { this->m_eValue = presetcolorvalBlueViolet ; SetRGBA(138,43,226); } - else if ( (L"brown") == sValueLower ) { this->m_eValue = presetcolorvalBrown ; SetRGBA(165,42,42); } - else if ( (L"burlywood") == sValueLower ) { this->m_eValue = presetcolorvalBurlyWood ; SetRGBA(222,184,135); } - break; - case 'c': - if ( (L"cadetblue") == sValueLower ) { this->m_eValue = presetcolorvalCadetBlue ; SetRGBA(95,158,160); } - else if ( (L"chartreuse") == sValueLower ) { this->m_eValue = presetcolorvalChartreuse ; SetRGBA(127,255,0); } - else if ( (L"chocolate") == sValueLower ) { this->m_eValue = presetcolorvalChocolate ; SetRGBA(210,105,30); } - else if ( (L"coral") == sValueLower ) { this->m_eValue = presetcolorvalCoral ; SetRGBA(255,127,80); } - else if ( (L"cornflowerblue") == sValueLower ) { this->m_eValue = presetcolorvalCornflowerBlue ; SetRGBA(100,149,237); } - else if ( (L"cornsilk") == sValueLower ) { this->m_eValue = presetcolorvalCornsilk ; SetRGBA(255,248,220); } - else if ( (L"crimson") == sValueLower ) { this->m_eValue = presetcolorvalCrimson ; SetRGBA(220,20,60); } - else if ( (L"cyan") == sValueLower ) { this->m_eValue = presetcolorvalCyan ; SetRGBA(0,255,255); } - break; - case 'd': - if ( (L"darkblue") == sValueLower ) { this->m_eValue = presetcolorvalDarkBlue ; SetRGBA(0,0,139); } - else if ( (L"darkcyan") == sValueLower ) { this->m_eValue = presetcolorvalDarkCyan ; SetRGBA(0,139,139); } - else if ( (L"darkgoldenrod") == sValueLower ) { this->m_eValue = presetcolorvalDarkGoldenrod ; SetRGBA(184,134,11); } - else if ( (L"darkgray") == sValueLower ) { this->m_eValue = presetcolorvalDarkGray ; SetRGBA(169,169,169); } - else if ( (L"darkgreen") == sValueLower ) { this->m_eValue = presetcolorvalDarkGreen ; SetRGBA(0,100,0); } - else if ( (L"darkgrey") == sValueLower ) { this->m_eValue = presetcolorvalDarkGrey ; SetRGBA(169,169,169); } - else if ( (L"darkkhaki") == sValueLower ) { this->m_eValue = presetcolorvalDarkKhaki ; SetRGBA(189,183,107); } - else if ( (L"darkmagenta") == sValueLower ) { this->m_eValue = presetcolorvalDarkMagenta ; SetRGBA(139,0,139); } - else if ( (L"darkolivegreen") == sValueLower ) { this->m_eValue = presetcolorvalDarkOliveGreen ; SetRGBA(85,107,47); } - else if ( (L"darkorange") == sValueLower ) { this->m_eValue = presetcolorvalDarkOrange ; SetRGBA(255,140,0); } - else if ( (L"darkorchid") == sValueLower ) { this->m_eValue = presetcolorvalDarkOrchid ; SetRGBA(153,50,204); } - else if ( (L"darkred") == sValueLower ) { this->m_eValue = presetcolorvalDarkRed ; SetRGBA(139,0,0); } - else if ( (L"darksalmon") == sValueLower ) { this->m_eValue = presetcolorvalDarkSalmon ; SetRGBA(233,150,122); } - else if ( (L"darkseagreen") == sValueLower ) { this->m_eValue = presetcolorvalDarkSeaGreen ; SetRGBA(143,188,143); } - else if ( (L"darkslateblue") == sValueLower ) { this->m_eValue = presetcolorvalDarkSlateBlue ; SetRGBA(72,61,139); } - else if ( (L"darkslategray") == sValueLower ) { this->m_eValue = presetcolorvalDarkSlateGray ; SetRGBA(47,79,79); } - else if ( (L"darkslategrey") == sValueLower ) { this->m_eValue = presetcolorvalDarkSlateGrey ; SetRGBA(47,79,79); } - else if ( (L"darkturquoise") == sValueLower ) { this->m_eValue = presetcolorvalDarkTurquoise ; SetRGBA(0,206,209); } - else if ( (L"darkviolet") == sValueLower ) { this->m_eValue = presetcolorvalDarkViolet ; SetRGBA(148,0,211); } - else if ( (L"deeppink") == sValueLower ) { this->m_eValue = presetcolorvalDeepPink ; SetRGBA(255,20,147); } - else if ( (L"deepskyblue") == sValueLower ) { this->m_eValue = presetcolorvalDeepSkyBlue ; SetRGBA(0,191,255); } - else if ( (L"dimgray") == sValueLower ) { this->m_eValue = presetcolorvalDimGray ; SetRGBA(105,105,105); } - else if ( (L"dimgrey") == sValueLower ) { this->m_eValue = presetcolorvalDimGrey ; SetRGBA(105,105,105); } - else if ( (L"dkblue") == sValueLower ) { this->m_eValue = presetcolorvalDkBlue ; SetRGBA(0,0,139); } - else if ( (L"dkcyan") == sValueLower ) { this->m_eValue = presetcolorvalDkCyan ; SetRGBA(0,139,139); } - else if ( (L"dkgoldenrod") == sValueLower ) { this->m_eValue = presetcolorvalDkGoldenrod ; SetRGBA(184,134,11); } - else if ( (L"dkgray") == sValueLower ) { this->m_eValue = presetcolorvalDkGray ; SetRGBA(169,169,169); } - else if ( (L"dkgreen") == sValueLower ) { this->m_eValue = presetcolorvalDkGreen ; SetRGBA(0,100,0); } - else if ( (L"dkgrey") == sValueLower ) { this->m_eValue = presetcolorvalDkGrey ; SetRGBA(169,169,169); } - else if ( (L"dkkhaki") == sValueLower ) { this->m_eValue = presetcolorvalDkKhaki ; SetRGBA(189,183,107); } - else if ( (L"dkmagenta") == sValueLower ) { this->m_eValue = presetcolorvalDkMagenta ; SetRGBA(139,0,139); } - else if ( (L"dkolivegreen") == sValueLower ) { this->m_eValue = presetcolorvalDkOliveGreen ; SetRGBA(85,107,47); } - else if ( (L"dkorange") == sValueLower ) { this->m_eValue = presetcolorvalDkOrange ; SetRGBA(255,140,0); } - else if ( (L"dkorchid") == sValueLower ) { this->m_eValue = presetcolorvalDkOrchid ; SetRGBA(153,50,204); } - else if ( (L"dkred") == sValueLower ) { this->m_eValue = presetcolorvalDkRed ; SetRGBA(139,0,0); } - else if ( (L"dksalmon") == sValueLower ) { this->m_eValue = presetcolorvalDkSalmon ; SetRGBA(233,150,122); } - else if ( (L"dkseagreen") == sValueLower ) { this->m_eValue = presetcolorvalDkSeaGreen ; SetRGBA(143,188,139); } - else if ( (L"dkslateblue") == sValueLower ) { this->m_eValue = presetcolorvalDkSlateBlue ; SetRGBA(72,61,139); } - else if ( (L"dkslategray") == sValueLower ) { this->m_eValue = presetcolorvalDkSlateGray ; SetRGBA(47,79,79); } - else if ( (L"dkslategrey") == sValueLower ) { this->m_eValue = presetcolorvalDkSlateGrey ; SetRGBA(47,79,79); } - else if ( (L"dkturquoise") == sValueLower ) { this->m_eValue = presetcolorvalDkTurquoise ; SetRGBA(0,206,209); } - else if ( (L"dkviolet") == sValueLower ) { this->m_eValue = presetcolorvalDkViolet ; SetRGBA(148,0,211); } - else if ( (L"dodgerblue") == sValueLower ) { this->m_eValue = presetcolorvalDodgerBlue ; SetRGBA(30,144,255); } - break; - case 'f': - if ( (L"firebrick") == sValueLower ) { this->m_eValue = presetcolorvalFirebrick ; SetRGBA(178,34,34); } - else if ( (L"floralwhite") == sValueLower ) { this->m_eValue = presetcolorvalFloralWhite ; SetRGBA(255,250,240); } - else if ( (L"forestgreen") == sValueLower ) { this->m_eValue = presetcolorvalForestGreen ; SetRGBA(34,139,34); } - else if ( (L"fuchsia") == sValueLower ) { this->m_eValue = presetcolorvalFuchsia ; SetRGBA(255,0,255); } - break; - case 'g': - if ( (L"gainsboro") == sValueLower ) { this->m_eValue = presetcolorvalGainsboro ; SetRGBA(220,220,220); } - else if ( (L"ghostwhite") == sValueLower ) { this->m_eValue = presetcolorvalGhostWhite ; SetRGBA(248,248,255); } - else if ( (L"gold") == sValueLower ) { this->m_eValue = presetcolorvalGold ; SetRGBA(255,215,0); } - else if ( (L"goldenrod") == sValueLower ) { this->m_eValue = presetcolorvalGoldenrod ; SetRGBA(218,165,32); } - else if ( (L"gray") == sValueLower ) { this->m_eValue = presetcolorvalGray ; SetRGBA(128,128,128); } - else if ( (L"green") == sValueLower ) { this->m_eValue = presetcolorvalGreen ; SetRGBA(0,128,0); } - else if ( (L"greenyellow") == sValueLower ) { this->m_eValue = presetcolorvalGreenYellow ; SetRGBA(173,255,47); } - else if ( (L"grey") == sValueLower ) { this->m_eValue = presetcolorvalGrey ; SetRGBA(128,128,128); } - break; - case 'h': - if ( (L"honeydew") == sValueLower ) { this->m_eValue = presetcolorvalHoneydew ; SetRGBA(240,255,240); } - else if ( (L"hotpink") == sValueLower ) { this->m_eValue = presetcolorvalHotPink ; SetRGBA(255,105,180); } - break; - case 'i': - if ( (L"indianred") == sValueLower ) { this->m_eValue = presetcolorvalIndianRed ; SetRGBA(205,92,92); } - else if ( (L"indigo") == sValueLower ) { this->m_eValue = presetcolorvalIndigo ; SetRGBA(75,0,130); } - else if ( (L"ivory") == sValueLower ) { this->m_eValue = presetcolorvalIvory ; SetRGBA(255,255,240); } - break; - case 'k': - if ( (L"khaki") == sValueLower ) { this->m_eValue = presetcolorvalKhaki ; SetRGBA(240,230,140); } - break; - case 'l': - if ( (L"lavender") == sValueLower ) { this->m_eValue = presetcolorvalLavender ; SetRGBA(230,230,250); } - else if ( (L"lavenderblush") == sValueLower ) { this->m_eValue = presetcolorvalLavenderBlush ; SetRGBA(255,240,245); } - else if ( (L"lawngreen") == sValueLower ) { this->m_eValue = presetcolorvalLawnGreen ; SetRGBA(124,252,0); } - else if ( (L"lemonchiffon") == sValueLower ) { this->m_eValue = presetcolorvalLemonChiffon ; SetRGBA(255,250,205); } - else if ( (L"lightblue") == sValueLower ) { this->m_eValue = presetcolorvalLightBlue ; SetRGBA(173,216,230); } - else if ( (L"lightcoral") == sValueLower ) { this->m_eValue = presetcolorvalLightCoral ; SetRGBA(240,128,128); } - else if ( (L"lightcyan") == sValueLower ) { this->m_eValue = presetcolorvalLightCyan ; SetRGBA(224,255,255); } - else if ( (L"lightgoldenrodyellow")== sValueLower ) { this->m_eValue = presetcolorvalLightGoldenrodYellow; SetRGBA(250,250,210); } - else if ( (L"lightgray") == sValueLower ) { this->m_eValue = presetcolorvalLightGray ; SetRGBA(211,211,211); } - else if ( (L"lightgreen") == sValueLower ) { this->m_eValue = presetcolorvalLightGreen ; SetRGBA(144,238,144); } - else if ( (L"lightgrey") == sValueLower ) { this->m_eValue = presetcolorvalLightGrey ; SetRGBA(211,211,211); } - else if ( (L"lightpink") == sValueLower ) { this->m_eValue = presetcolorvalLightPink ; SetRGBA(255,182,193); } - else if ( (L"lightsalmon") == sValueLower ) { this->m_eValue = presetcolorvalLightSalmon ; SetRGBA(255,160,122); } - else if ( (L"lightseagreen") == sValueLower ) { this->m_eValue = presetcolorvalLightSeaGreen ; SetRGBA(32,178,170); } - else if ( (L"lightskyblue") == sValueLower ) { this->m_eValue = presetcolorvalLightSkyBlue ; SetRGBA(135,206,250); } - else if ( (L"lightslategray") == sValueLower ) { this->m_eValue = presetcolorvalLightSlateGray ; SetRGBA(119,136,153); } - else if ( (L"lightslategrey") == sValueLower ) { this->m_eValue = presetcolorvalLightSlateGrey ; SetRGBA(119,136,153); } - else if ( (L"lightsteelblue") == sValueLower ) { this->m_eValue = presetcolorvalLightSteelBlue ; SetRGBA(176,196,222); } - else if ( (L"lightyellow") == sValueLower ) { this->m_eValue = presetcolorvalLightYellow ; SetRGBA(255,255,224); } - else if ( (L"lime") == sValueLower ) { this->m_eValue = presetcolorvalLime ; SetRGBA(0,255,0); } - else if ( (L"limegreen") == sValueLower ) { this->m_eValue = presetcolorvalLimeGreen ; SetRGBA(50,205,50); } - else if ( (L"linen") == sValueLower ) { this->m_eValue = presetcolorvalLinen; SetRGBA(250,240,230); } - else if ( (L"ltblue") == sValueLower ) { this->m_eValue = presetcolorvalLtBlue ; SetRGBA(173,216,230); } - else if ( (L"ltcoral") == sValueLower ) { this->m_eValue = presetcolorvalLtCoral ; SetRGBA(240,128,128); } - else if ( (L"ltcyan") == sValueLower ) { this->m_eValue = presetcolorvalLtCyan ; SetRGBA(224,255,255); } - else if ( (L"ltgoldenrodyellow") == sValueLower ) { this->m_eValue = presetcolorvalLtGoldenrodYellow; SetRGBA(250,250,120); } - else if ( (L"ltgray") == sValueLower ) { this->m_eValue = presetcolorvalLtGray ; SetRGBA(211,211,211); } - else if ( (L"ltgreen") == sValueLower ) { this->m_eValue = presetcolorvalLtGreen ; SetRGBA(144,238,144); } - else if ( (L"ltgrey") == sValueLower ) { this->m_eValue = presetcolorvalLtGrey ; SetRGBA(211,211,211); } - else if ( (L"ltpink") == sValueLower ) { this->m_eValue = presetcolorvalLtPink ; SetRGBA(255,182,193); } - else if ( (L"ltsalmon") == sValueLower ) { this->m_eValue = presetcolorvalLtSalmon ; SetRGBA(255,160,122); } - else if ( (L"ltseagreen") == sValueLower ) { this->m_eValue = presetcolorvalLtSeaGreen ; SetRGBA(32,178,170); } - else if ( (L"ltskyblue") == sValueLower ) { this->m_eValue = presetcolorvalLtSkyBlue ; SetRGBA(135,206,250); } - else if ( (L"ltslategray") == sValueLower ) { this->m_eValue = presetcolorvalLtSlateGray ; SetRGBA(119,136,153); } - else if ( (L"ltslategrey") == sValueLower ) { this->m_eValue = presetcolorvalLtSlateGrey ; SetRGBA(119,136,153); } - else if ( (L"ltsteelblue") == sValueLower ) { this->m_eValue = presetcolorvalLtSteelBlue ; SetRGBA(176,196,222); } - else if ( (L"ltyellow") == sValueLower ) { this->m_eValue = presetcolorvalLtYellow ; SetRGBA(255,255,224); } - break; - case 'm': - if ( (L"magenta") == sValueLower ) { this->m_eValue = presetcolorvalMagenta ; SetRGBA(255,0,255); } - else if ( (L"maroon") == sValueLower ) { this->m_eValue = presetcolorvalMaroon ; SetRGBA(128,0,0); } - else if ( (L"medaquamarine") == sValueLower ) { this->m_eValue = presetcolorvalMedAquamarine ; SetRGBA(102,205,170); } - else if ( (L"medblue") == sValueLower ) { this->m_eValue = presetcolorvalMedBlue ; SetRGBA(0,0,205); } - else if ( (L"mediumaquamarine") == sValueLower ) { this->m_eValue = presetcolorvalMediumAquamarine; SetRGBA(102,205,170); } - else if ( (L"mediumblue") == sValueLower ) { this->m_eValue = presetcolorvalMediumBlue ; SetRGBA(0,0,205); } - else if ( (L"mediumorchid") == sValueLower ) { this->m_eValue = presetcolorvalMediumOrchid ; SetRGBA(186,85,211); } - else if ( (L"mediumpurple") == sValueLower ) { this->m_eValue = presetcolorvalMediumPurple ; SetRGBA(147,112,219); } - else if ( (L"mediumseagreen") == sValueLower ) { this->m_eValue = presetcolorvalMediumSeaGreen ; SetRGBA(60,179,113); } - else if ( (L"mediumslateblue") == sValueLower ) { this->m_eValue = presetcolorvalMediumSlateBlue ; SetRGBA(123,104,238); } - else if ( (L"mediumspringgreen") == sValueLower ) { this->m_eValue = presetcolorvalMediumSpringGreen; SetRGBA(0,250,154); } - else if ( (L"mediumturquoise") == sValueLower ) { this->m_eValue = presetcolorvalMediumTurquoise ; SetRGBA(72,209,204); } - else if ( (L"mediumvioletred") == sValueLower ) { this->m_eValue = presetcolorvalMediumVioletRed ; SetRGBA(199,21,133); } - else if ( (L"medorchid") == sValueLower ) { this->m_eValue = presetcolorvalMedOrchid ; SetRGBA(186,85,211); } - else if ( (L"medpurple") == sValueLower ) { this->m_eValue = presetcolorvalMedPurple ; SetRGBA(147,112,219); } - else if ( (L"medseagreen") == sValueLower ) { this->m_eValue = presetcolorvalMedSeaGreen ; SetRGBA(60,179,113); } - else if ( (L"medslateblue") == sValueLower ) { this->m_eValue = presetcolorvalMedSlateBlue ; SetRGBA(123,104,238); } - else if ( (L"medspringgreen") == sValueLower ) { this->m_eValue = presetcolorvalMedSpringGreen ; SetRGBA(0,250,154); } - else if ( (L"medturquoise") == sValueLower ) { this->m_eValue = presetcolorvalMedTurquoise ; SetRGBA(72,209,204); } - else if ( (L"medvioletred") == sValueLower ) { this->m_eValue = presetcolorvalMedVioletRed ; SetRGBA(199,21,133); } - else if ( (L"midnightblue") == sValueLower ) { this->m_eValue = presetcolorvalMidnightBlue ; SetRGBA(25,25,112); } - else if ( (L"mintcream") == sValueLower ) { this->m_eValue = presetcolorvalMintCream ; SetRGBA(245,255,250); } - else if ( (L"mistyrose") == sValueLower ) { this->m_eValue = presetcolorvalMistyRose ; SetRGBA(255,228,225); } - else if ( (L"moccasin") == sValueLower ) { this->m_eValue = presetcolorvalMoccasin ; SetRGBA(255,228,181); } - break; - case 'n': - if ( (L"navajowhite") == sValueLower ) { this->m_eValue = presetcolorvalNavajoWhite ; SetRGBA(255,222,173); } - else if ( (L"navy") == sValueLower ) { this->m_eValue = presetcolorvalNavy ; SetRGBA(0,0,128); } - break; - case 'o': - if ( (L"oldlace") == sValueLower ) { this->m_eValue = presetcolorvalOldLace ; SetRGBA(253,245,230); } - else if ( (L"olive") == sValueLower ) { this->m_eValue = presetcolorvalOlive ; SetRGBA(128,128,0); } - else if ( (L"olivedrab") == sValueLower ) { this->m_eValue = presetcolorvalOliveDrab ; SetRGBA(107,142,35); } - else if ( (L"orange") == sValueLower ) { this->m_eValue = presetcolorvalOrange ; SetRGBA(255,165,0); } - else if ( (L"orangered") == sValueLower ) { this->m_eValue = presetcolorvalOrangeRed ; SetRGBA(255,69,0); } - else if ( (L"orchid") == sValueLower ) { this->m_eValue = presetcolorvalOrchid ; SetRGBA(218,112,214); } - break; - case 'p': - if ( (L"palegoldenrod") == sValueLower ) { this->m_eValue = presetcolorvalPaleGoldenrod ; SetRGBA(238,232,170); } - else if ( (L"palegreen") == sValueLower ) { this->m_eValue = presetcolorvalPaleGreen ; SetRGBA(152,251,152); } - else if ( (L"paleturquoise") == sValueLower ) { this->m_eValue = presetcolorvalPaleTurquoise ; SetRGBA(175,238,238); } - else if ( (L"palevioletred") == sValueLower ) { this->m_eValue = presetcolorvalPaleVioletRed ; SetRGBA(219,112,147); } - else if ( (L"papayawhip") == sValueLower ) { this->m_eValue = presetcolorvalPapayaWhip ; SetRGBA(255,239,213); } - else if ( (L"peachpuff") == sValueLower ) { this->m_eValue = presetcolorvalPeachPuff ; SetRGBA(255,218,185); } - else if ( (L"peru") == sValueLower ) { this->m_eValue = presetcolorvalPeru ; SetRGBA(205,133,63); } - else if ( (L"pink") == sValueLower ) { this->m_eValue = presetcolorvalPink ; SetRGBA(255,192,203); } - else if ( (L"plum") == sValueLower ) { this->m_eValue = presetcolorvalPlum ; SetRGBA(221,160,221); } - else if ( (L"powderblue") == sValueLower ) { this->m_eValue = presetcolorvalPowderBlue ; SetRGBA(176,224,230); } - else if ( (L"purple") == sValueLower ) { this->m_eValue = presetcolorvalPurple ; SetRGBA(128,0,128); } - break; - case 'r': - if ( (L"red") == sValueLower ) { this->m_eValue = presetcolorvalRed ; SetRGBA(255,0,0); } - else if ( (L"rosybrown") == sValueLower ) { this->m_eValue = presetcolorvalRosyBrown ; SetRGBA(188,143,143); } - else if ( (L"royalblue") == sValueLower ) { this->m_eValue = presetcolorvalRoyalBlue ; SetRGBA(65,105,225); } - break; - case 's': - if ( (L"saddlebrown") == sValueLower ) { this->m_eValue = presetcolorvalSaddleBrown ; SetRGBA(139,69,19); } - else if ( (L"salmon") == sValueLower ) { this->m_eValue = presetcolorvalSalmon ; SetRGBA(250,128,114); } - else if ( (L"sandybrown") == sValueLower ) { this->m_eValue = presetcolorvalSandyBrown ; SetRGBA(244,164,96); } - else if ( (L"seagreen") == sValueLower ) { this->m_eValue = presetcolorvalSeaGreen ; SetRGBA(46,139,87); } - else if ( (L"seashell") == sValueLower ) { this->m_eValue = presetcolorvalSeaShell ; SetRGBA(255,245,238); } - else if ( (L"sienna") == sValueLower ) { this->m_eValue = presetcolorvalSienna ; SetRGBA(160,82,45); } - else if ( (L"silver") == sValueLower ) { this->m_eValue = presetcolorvalSilver ; SetRGBA(192,192,192); } - else if ( (L"skyblue") == sValueLower ) { this->m_eValue = presetcolorvalSkyBlue ; SetRGBA(135,206,235); } - else if ( (L"slateblue") == sValueLower ) { this->m_eValue = presetcolorvalSlateBlue ; SetRGBA(106,90,205); } - else if ( (L"slategray") == sValueLower ) { this->m_eValue = presetcolorvalSlateGray ; SetRGBA(112,128,144); } - else if ( (L"slategrey") == sValueLower ) { this->m_eValue = presetcolorvalSlateGrey ; SetRGBA(112,128,144); } - else if ( (L"snow") == sValueLower ) { this->m_eValue = presetcolorvalSnow ; SetRGBA(255,250,250); } - else if ( (L"springgreen") == sValueLower ) { this->m_eValue = presetcolorvalSpringGreen ; SetRGBA(0,255,127); } - else if ( (L"steelblue") == sValueLower ) { this->m_eValue = presetcolorvalSteelBlue ; SetRGBA(70,130,180); } - break; - case 't': - if ( (L"tan") == sValueLower ) { this->m_eValue = presetcolorvalTan ; SetRGBA(210,180,140); } - else if ( (L"teal") == sValueLower ) { this->m_eValue = presetcolorvalTeal ; SetRGBA(0,128,128); } - else if ( (L"thistle") == sValueLower ) { this->m_eValue = presetcolorvalThistle ; SetRGBA(216,191,216); } - else if ( (L"tomato") == sValueLower ) { this->m_eValue = presetcolorvalTomato ; SetRGBA(255,99,71); } - else if ( (L"turquoise") == sValueLower ) { this->m_eValue = presetcolorvalTurquoise ; SetRGBA(64,224,208); } - break; - case 'v': - if ( (L"violet") == sValueLower ) { this->m_eValue = presetcolorvalViolet ; SetRGBA(238,130,238); } - break; - case 'w': - if ( (L"wheat") == sValueLower ) { this->m_eValue = presetcolorvalWheat ; SetRGBA(245,222,179); } - else if ( (L"white") == sValueLower ) { this->m_eValue = presetcolorvalWhite ; SetRGBA(255,255,255); } - else if ( (L"whitesmoke") == sValueLower ) { this->m_eValue = presetcolorvalWhiteSmoke ; SetRGBA(245,245,245); } - break; - case 'y': - if ( (L"yellow") == sValueLower ) { this->m_eValue = presetcolorvalYellow ; SetRGBA(255,255,0); } - else if ( (L"yellowgreen") == sValueLower ) { this->m_eValue = presetcolorvalYellowGreen ; SetRGBA(154,205,50); } - break; - } - //would exit earlier if 'black' == sValue therefore here presetcolorvalBlack is default value - return presetcolorvalBlack != this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case presetcolorvalAliceBlue: return (L"aliceBlue"); - case presetcolorvalAntiqueWhite: return (L"antiqueWhite"); - case presetcolorvalAqua: return (L"aqua"); - case presetcolorvalAquamarine: return (L"aquamarine"); - case presetcolorvalAzure: return (L"azure"); - case presetcolorvalBeige: return (L"beige"); - case presetcolorvalBisque: return (L"bisque"); - case presetcolorvalBlack : return (L"black"); - case presetcolorvalBlanchedAlmond : return (L"blanchedAlmond"); - case presetcolorvalBlue : return (L"blue"); - case presetcolorvalBlueViolet : return (L"blueViolet"); - case presetcolorvalBrown : return (L"brown"); - case presetcolorvalBurlyWood : return (L"burlyWood"); - case presetcolorvalCadetBlue : return (L"cadetBlue"); - case presetcolorvalChartreuse : return (L"chartreuse"); - case presetcolorvalChocolate : return (L"chocolate"); - case presetcolorvalCoral : return (L"coral"); - case presetcolorvalCornflowerBlue : return (L"cornflowerBlue"); - case presetcolorvalCornsilk : return (L"cornsilk"); - case presetcolorvalCrimson : return (L"crimson"); - case presetcolorvalCyan : return (L"cyan"); - case presetcolorvalDarkBlue : return (L"darkBlue"); - case presetcolorvalDarkCyan : return (L"darkCyan"); - case presetcolorvalDarkGoldenrod : return (L"darkGoldenrod"); - case presetcolorvalDarkGray : return (L"darkGray"); - case presetcolorvalDarkGreen: return (L"darkGreen"); - case presetcolorvalDarkGrey : return (L"darkGrey"); - case presetcolorvalDarkKhaki: return (L"darkKhaki"); - case presetcolorvalDarkMagenta : return (L"darkMagenta"); - case presetcolorvalDarkOliveGreen : return (L"darkOliveGreen"); - case presetcolorvalDarkOrange : return (L"darkOrange"); - case presetcolorvalDarkOrchid : return (L"darkOrchid"); - case presetcolorvalDarkRed : return (L"darkRed"); - case presetcolorvalDarkSalmon : return (L"darkSalmon"); - case presetcolorvalDarkSeaGreen : return (L"darkSeaGreen"); - case presetcolorvalDarkSlateBlue : return (L"darkSlateBlue"); - case presetcolorvalDarkSlateGray : return (L"darkSlateGray"); - case presetcolorvalDarkSlateGrey : return (L"darkSlateGrey"); - case presetcolorvalDarkTurquoise : return (L"darkTurquoise"); - case presetcolorvalDarkViolet : return (L"darkViolet"); - case presetcolorvalDeepPink : return (L"deepPink"); - case presetcolorvalDeepSkyBlue : return (L"deepSkyBlue"); - case presetcolorvalDimGray : return (L"dimGray"); - case presetcolorvalDimGrey : return (L"dimGrey"); - case presetcolorvalDkBlue : return (L"dkBlue"); - case presetcolorvalDkCyan : return (L"dkCyan"); - case presetcolorvalDkGoldenrod : return (L"dkGoldenrod"); - case presetcolorvalDkGray : return (L"dkGray"); - case presetcolorvalDkGreen : return (L"dkGreen"); - case presetcolorvalDkGrey : return (L"dkGrey"); - case presetcolorvalDkKhaki : return (L"dkKhaki"); - case presetcolorvalDkMagenta : return (L"dkMagenta"); - case presetcolorvalDkOliveGreen : return (L"dkOliveGreen"); - case presetcolorvalDkOrange : return (L"dkOrange"); - case presetcolorvalDkOrchid : return (L"dkOrchid"); - case presetcolorvalDkRed : return (L"dkRed"); - case presetcolorvalDkSalmon : return (L"dkSalmon"); - case presetcolorvalDkSeaGreen : return (L"dkSeaGreen"); - case presetcolorvalDkSlateBlue : return (L"dkSlateBlue"); - case presetcolorvalDkSlateGray : return (L"dkSlateGray"); - case presetcolorvalDkSlateGrey : return (L"dkSlateGrey"); - case presetcolorvalDkTurquoise : return (L"dkTurquoise"); - case presetcolorvalDkViolet : return (L"dkViolet"); - case presetcolorvalDodgerBlue : return (L"dodgerBlue"); - case presetcolorvalFirebrick : return (L"firebrick"); - case presetcolorvalFloralWhite : return (L"floralWhite"); - case presetcolorvalForestGreen : return (L"forestGreen"); - case presetcolorvalFuchsia : return (L"fuchsia"); - case presetcolorvalGainsboro : return (L"gainsboro"); - case presetcolorvalGhostWhite : return (L"ghostWhite"); - case presetcolorvalGold : return (L"gold"); - case presetcolorvalGoldenrod : return (L"goldenrod"); - case presetcolorvalGray : return (L"gray"); - case presetcolorvalGreen : return (L"green"); - case presetcolorvalGreenYellow : return (L"greenYellow"); - case presetcolorvalGrey : return (L"grey"); - case presetcolorvalHoneydew : return (L"honeydew"); - case presetcolorvalHotPink : return (L"hotPink"); - case presetcolorvalIndianRed : return (L"indianRed"); - case presetcolorvalIndigo : return (L"indigo"); - case presetcolorvalIvory : return (L"ivory"); - case presetcolorvalKhaki : return (L"khaki"); - case presetcolorvalLavender : return (L"lavender"); - case presetcolorvalLavenderBlush : return (L"lavenderBlush"); - case presetcolorvalLawnGreen: return (L"lawnGreen"); - case presetcolorvalLemonChiffon : return (L"lemonChiffon"); - case presetcolorvalLightBlue : return (L"lightBlue"); - case presetcolorvalLightCoral : return (L"lightCoral"); - case presetcolorvalLightCyan : return (L"lightCyan"); - case presetcolorvalLightGoldenrodYellow:return (L"lightGoldenrodYellow"); - case presetcolorvalLightGray : return (L"lightGray"); - case presetcolorvalLightGreen : return (L"lightGreen"); - case presetcolorvalLightGrey : return (L"lightGrey"); - case presetcolorvalLightPink : return (L"lightPink"); - case presetcolorvalLightSalmon : return (L"lightSalmon"); - case presetcolorvalLightSeaGreen : return (L"lightSeaGreen"); - case presetcolorvalLightSkyBlue : return (L"lightSkyBlue"); - case presetcolorvalLightSlateGray : return (L"lightSlateGray"); - case presetcolorvalLightSlateGrey : return (L"lightSlateGrey"); - case presetcolorvalLightSteelBlue : return (L"lightSteelBlue"); - case presetcolorvalLightYellow : return (L"lightYellow"); - case presetcolorvalLime : return (L"lime"); - case presetcolorvalLimeGreen : return (L"limeGreen"); - case presetcolorvalLinen: return (L"linen"); - case presetcolorvalLtBlue : return (L"ltBlue"); - case presetcolorvalLtCoral : return (L"ltCoral"); - case presetcolorvalLtCyan : return (L"ltCyan"); - case presetcolorvalLtGoldenrodYellow: return (L"ltGoldenrodYellow"); - case presetcolorvalLtGray : return (L"ltGray"); - case presetcolorvalLtGreen : return (L"ltGreen"); - case presetcolorvalLtGrey : return (L"ltGrey"); - case presetcolorvalLtPink : return (L"ltPink"); - case presetcolorvalLtSalmon : return (L"ltSalmon"); - case presetcolorvalLtSeaGreen : return (L"ltSeaGreen"); - case presetcolorvalLtSkyBlue : return (L"ltSkyBlue"); - case presetcolorvalLtSlateGray : return (L"ltSlateGray"); - case presetcolorvalLtSlateGrey : return (L"ltSlateGrey"); - case presetcolorvalLtSteelBlue : return (L"ltSteelBlue"); - case presetcolorvalLtYellow : return (L"ltYellow"); - case presetcolorvalMagenta : return (L"magenta"); - case presetcolorvalMaroon : return (L"maroon"); - case presetcolorvalMedAquamarine : return (L"medAquamarine"); - case presetcolorvalMedBlue : return (L"medBlue"); - case presetcolorvalMediumAquamarine: return (L"mediumAquamarine"); - case presetcolorvalMediumBlue : return (L"mediumBlue"); - case presetcolorvalMediumOrchid : return (L"mediumOrchid"); - case presetcolorvalMediumPurple : return (L"mediumPurple"); - case presetcolorvalMediumSeaGreen : return (L"mediumSeaGreen"); - case presetcolorvalMediumSlateBlue : return (L"mediumSlateBlue"); - case presetcolorvalMediumSpringGreen: return (L"mediumSpringGreen"); - case presetcolorvalMediumTurquoise : return (L"mediumTurquoise"); - case presetcolorvalMediumVioletRed : return (L"mediumVioletRed"); - case presetcolorvalMedOrchid : return (L"medOrchid"); - case presetcolorvalMedPurple : return (L"medPurple"); - case presetcolorvalMedSeaGreen : return (L"medSeaGreen"); - case presetcolorvalMedSlateBlue : return (L"medSlateBlue"); - case presetcolorvalMedSpringGreen : return (L"medSpringGreen"); - case presetcolorvalMedTurquoise : return (L"medTurquoise"); - case presetcolorvalMedVioletRed : return (L"medVioletRed"); - case presetcolorvalMidnightBlue : return (L"midnightBlue"); - case presetcolorvalMintCream : return (L"mintCream"); - case presetcolorvalMistyRose : return (L"mistyRose"); - case presetcolorvalMoccasin : return (L"moccasin"); - case presetcolorvalNavajoWhite : return (L"navajoWhite"); - case presetcolorvalNavy : return (L"navy"); - case presetcolorvalOldLace : return (L"oldLace"); - case presetcolorvalOlive : return (L"olive"); - case presetcolorvalOliveDrab : return (L"oliveDrab"); - case presetcolorvalOrange : return (L"orange"); - case presetcolorvalOrangeRed : return (L"orangeRed"); - case presetcolorvalOrchid : return (L"orchid"); - case presetcolorvalPaleGoldenrod : return (L"paleGoldenrod"); - case presetcolorvalPaleGreen : return (L"paleGreen"); - case presetcolorvalPaleTurquoise : return (L"paleTurquoise"); - case presetcolorvalPaleVioletRed : return (L"paleVioletRed"); - case presetcolorvalPapayaWhip : return (L"papayaWhip"); - case presetcolorvalPeachPuff : return (L"peachPuff"); - case presetcolorvalPeru : return (L"peru"); - case presetcolorvalPink : return (L"pink"); - case presetcolorvalPlum : return (L"plum"); - case presetcolorvalPowderBlue : return (L"powderBlue"); - case presetcolorvalPurple : return (L"purple"); - case presetcolorvalRed : return (L"red"); - case presetcolorvalRosyBrown : return (L"rosyBrown"); - case presetcolorvalRoyalBlue : return (L"royalBlue"); - case presetcolorvalSaddleBrown : return (L"saddleBrown"); - case presetcolorvalSalmon : return (L"salmon"); - case presetcolorvalSandyBrown : return (L"sandyBrown"); - case presetcolorvalSeaGreen : return (L"seaGreen"); - case presetcolorvalSeaShell : return (L"seaShell"); - case presetcolorvalSienna : return (L"sienna"); - case presetcolorvalSilver : return (L"silver"); - case presetcolorvalSkyBlue : return (L"skyBlue"); - case presetcolorvalSlateBlue : return (L"slateBlue"); - case presetcolorvalSlateGray : return (L"slateGray"); - case presetcolorvalSlateGrey : return (L"slateGrey"); - case presetcolorvalSnow : return (L"snow"); - case presetcolorvalSpringGreen : return (L"springGreen"); - case presetcolorvalSteelBlue : return (L"steelBlue"); - case presetcolorvalTan : return (L"tan"); - case presetcolorvalTeal : return (L"teal"); - case presetcolorvalThistle : return (L"thistle"); - case presetcolorvalTomato : return (L"tomato"); - case presetcolorvalTurquoise : return (L"turquoise"); - case presetcolorvalViolet : return (L"violet"); - case presetcolorvalWheat : return (L"wheat"); - case presetcolorvalWhite : return (L"white"); - case presetcolorvalWhiteSmoke : return (L"whiteSmoke"); - case presetcolorvalYellow : return (L"yellow"); - case presetcolorvalYellowGreen : return (L"yellowGreen"); - default : return (L"black"); - } - } - - SimpleType_FromString (EPresetColorVal) - SimpleType_Operator_Equal (CPresetColorVal) - unsigned char Get_R() const - { - return m_unR; - } - unsigned char Get_G() const - { - return m_unG; - } - - unsigned char Get_B() const - { - return m_unB; - } - - unsigned char Get_A() const - { - return m_unA; - } - - void SetRGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA = 255) - { - m_unR = unR; - m_unG = unG; - m_unB = unB; - m_unA = unA; - } + void SetRGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA = 255); private: - unsigned char m_unR; unsigned char m_unG; unsigned char m_unB; unsigned char m_unA; }; - //-------------------------------------------------------------------------------- // PresetLineDashVal 20.1.10.49 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPresetLineDashVal { presetlinedashvalDash = 0, @@ -3385,71 +983,12 @@ namespace SimpleTypes presetlinedashvalSysDot = 10, }; - template - class CPresetLineDashVal : public CSimpleType - { - public: - CPresetLineDashVal() {} - - virtual EPresetLineDashVal FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'd': - if ( (L"dash") == sValue ) this->m_eValue = presetlinedashvalDash; - else if ( (L"dashDot") == sValue ) this->m_eValue = presetlinedashvalDashDot; - else if ( (L"dot") == sValue ) this->m_eValue = presetlinedashvalDot; - break; - case 'l': - if ( (L"lgDash") == sValue ) this->m_eValue = presetlinedashvalLgDash; - else if ( (L"lgDashDot") == sValue ) this->m_eValue = presetlinedashvalLgDashDot; - else if ( (L"lgDashDotDot") == sValue ) this->m_eValue = presetlinedashvalLgDashDotDot; - break; - case 's': - if ( (L"solid") == sValue ) this->m_eValue = presetlinedashvalSolid; - else if ( (L"sysDash") == sValue ) this->m_eValue = presetlinedashvalSysDash; - else if ( (L"sysDashDot") == sValue ) this->m_eValue = presetlinedashvalSysDashDot; - else if ( (L"sysDashDotDot") == sValue ) this->m_eValue = presetlinedashvalSysDashDotDot; - else if ( (L"sysDot") == sValue ) this->m_eValue = presetlinedashvalSysDot; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case presetlinedashvalDash: return (L"dash"); - case presetlinedashvalDashDot: return (L"dashDot"); - case presetlinedashvalDot: return (L"dot"); - case presetlinedashvalLgDash: return (L"lgDash"); - case presetlinedashvalLgDashDot: return (L"lgDashDot"); - case presetlinedashvalLgDashDotDot: return (L"lgDashDotDot"); - case presetlinedashvalSolid: return (L"solid"); - case presetlinedashvalSysDash: return (L"sysDash"); - case presetlinedashvalSysDashDot: return (L"sysDashDot"); - case presetlinedashvalSysDashDotDot: return (L"sysDashDotDot"); - case presetlinedashvalSysDot: return (L"sysDot"); - default : return (L"solid"); - } - } - - SimpleType_FromString (EPresetLineDashVal) - SimpleType_Operator_Equal (CPresetLineDashVal) - }; - + DEFINE_SIMPLE_TYPE(CPresetLineDashVal, EPresetLineDashVal, presetlinedashvalSolid) //-------------------------------------------------------------------------------- // PresetMaterialType 20.1.10.50 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPresetMaterialType { presetmaterialtypeClear = 0, @@ -3469,317 +1008,76 @@ namespace SimpleTypes presetmaterialtypeWarmMatte = 14, }; - template - class CPresetMaterialType : public CSimpleType - { - public: - CPresetMaterialType() {} + DEFINE_SIMPLE_TYPE(CPresetMaterialType, EPresetMaterialType, presetmaterialtypeClear) - virtual EPresetMaterialType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( (L"clear") == sValue ) this->m_eValue = presetmaterialtypeClear; - break; - case 'd': - if ( (L"dkEdge") == sValue ) this->m_eValue = presetmaterialtypeDkEdge; - break; - case 'f': - if ( (L"flat") == sValue ) this->m_eValue = presetmaterialtypeFlat; - break; - case 'l': - if ( (L"legacyMatte") == sValue ) this->m_eValue = presetmaterialtypeLegacyMatte; - else if ( (L"legacyMetal") == sValue ) this->m_eValue = presetmaterialtypeLegacyMetal; - else if ( (L"legacyPlastic") == sValue ) this->m_eValue = presetmaterialtypeLegacyPlastic; - else if ( (L"legacyWireframe") == sValue ) this->m_eValue = presetmaterialtypeLegacyWireframe; - break; - case 'm': - if ( (L"matte") == sValue ) this->m_eValue = presetmaterialtypeMatte; - else if ( (L"metal") == sValue ) this->m_eValue = presetmaterialtypeMetal; - break; - case 'p': - if ( (L"plastic") == sValue ) this->m_eValue = presetmaterialtypePlastic; - else if ( (L"powder") == sValue ) this->m_eValue = presetmaterialtypePowder; - break; - case 's': - if ( (L"softEdge") == sValue ) this->m_eValue = presetmaterialtypeSoftEdge; - else if ( (L"softmetal") == sValue ) this->m_eValue = presetmaterialtypeSoftmetal; - break; - case 't': - if ( (L"translucentPowder") == sValue ) this->m_eValue = presetmaterialtypeTranslucentPowder; - break; - case 'w': - if ( (L"warmMatte") == sValue ) this->m_eValue = presetmaterialtypeWarmMatte; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case presetmaterialtypeClear : return (L"clear"); - case presetmaterialtypeDkEdge : return (L"dkEdge"); - case presetmaterialtypeFlat : return (L"flat"); - case presetmaterialtypeLegacyMatte : return (L"legacyMatte"); - case presetmaterialtypeLegacyMetal : return (L"legacyMetal"); - case presetmaterialtypeLegacyPlastic : return (L"legacyPlastic"); - case presetmaterialtypeLegacyWireframe : return (L"legacyWireframe"); - case presetmaterialtypeMatte : return (L"matte"); - case presetmaterialtypeMetal : return (L"metal"); - case presetmaterialtypePlastic : return (L"plastic"); - case presetmaterialtypePowder : return (L"powder"); - case presetmaterialtypeSoftEdge : return (L"softEdge"); - case presetmaterialtypeSoftmetal : return (L"softmetal"); - case presetmaterialtypeTranslucentPowder : return (L"translucentPowder"); - case presetmaterialtypeWarmMatte : return (L"warmMatte"); - default : return (L"clear"); - } - } - - SimpleType_FromString (EPresetMaterialType) - SimpleType_Operator_Equal (CPresetMaterialType) - }; //-------------------------------------------------------------------------------- // PresetPatternVal 20.1.10.51 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPresetPatternVal { - presetpatternvalCross = 0, // (Cross) - presetpatternvalDashDnDiag, // (Dashed Downward Diagonal) - presetpatternvalDashHorz, // (Dashed Horizontal) - presetpatternvalDashUpDiag, // (Dashed Upward DIagonal) - presetpatternvalDashVert, // (Dashed Vertical) - presetpatternvalDiagBrick, // (Diagonal Brick) - presetpatternvalDiagCross, // (Diagonal Cross) - presetpatternvalDivot, // (Divot) - presetpatternvalDkDnDiag, // (Dark Downward Diagonal) - presetpatternvalDkHorz, // (Dark Horizontal) - presetpatternvalDkUpDiag, // (Dark Upward Diagonal) - presetpatternvalDkVert, // (Dark Vertical) - presetpatternvalDnDiag, // (Downward Diagonal) - presetpatternvalDotDmnd, // (Dotted Diamond) - presetpatternvalDotGrid, // (Dotted Grid) - presetpatternvalHorz, // (Horizontal) - presetpatternvalHorzBrick, // (Horizontal Brick) - presetpatternvalLgCheck, // (Large Checker Board) - presetpatternvalLgConfetti, // (Large Confetti) - presetpatternvalLgGrid, // (Large Grid) - presetpatternvalLtDnDiag, // (Light Downward Diagonal) - presetpatternvalLtHorz, // (Light Horizontal) - presetpatternvalLtUpDiag, // (Light Upward Diagonal) - presetpatternvalLtVert, // (Light Vertical) - presetpatternvalNarHorz, // (Narrow Horizontal) - presetpatternvalNarVert, // (Narrow Vertical) - presetpatternvalOpenDmnd, // (Open Diamond) - presetpatternvalPct10, // (10%) - presetpatternvalPct20, // (20%) - presetpatternvalPct25, // (25%) - presetpatternvalPct30, // (30%) - presetpatternvalPct40, // (40%) - presetpatternvalPct5, // (5%) - presetpatternvalPct50, // (50%) - presetpatternvalPct60, // (60%) - presetpatternvalPct70, // (70%) - presetpatternvalPct75, // (75%) - presetpatternvalPct80, // (80%) - presetpatternvalPct90, // (90%) - presetpatternvalPlaid, // (Plaid) - presetpatternvalShingle, // (Shingle) - presetpatternvalSmCheck, // (Small Checker Board) - presetpatternvalSmConfetti, // (Small Confetti) - presetpatternvalSmGrid, // (Small Grid) - presetpatternvalSolidDmnd, // (Solid Diamond) - presetpatternvalSphere, // (Sphere) - presetpatternvalTrellis, // (Trellis) - presetpatternvalUpDiag, // (Upward Diagonal) - presetpatternvalVert, // (Vertical) - presetpatternvalWave, // (Wave) - presetpatternvalWdDnDiag, // (Wide Downward Diagonal) - presetpatternvalWdUpDiag, // (Wide Upward Diagonal) - presetpatternvalWeave, // (Weave) - presetpatternvalZigZag, // (Zig Zag) - }; - - template - class CPresetPatternVal : public CSimpleType - { - public: - CPresetPatternVal() {} - virtual EPresetPatternVal FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( (L"cross") == sValue ) this->m_eValue = presetpatternvalCross; - break; - case 'd': - if ( (L"dashDnDiag") == sValue ) this->m_eValue = presetpatternvalDashDnDiag; - else if ( (L"dashHorz") == sValue ) this->m_eValue = presetpatternvalDashHorz; - else if ( (L"dashUpDiag") == sValue ) this->m_eValue = presetpatternvalDashUpDiag; - else if ( (L"dashVert") == sValue ) this->m_eValue = presetpatternvalDashVert; - else if ( (L"diagBrick") == sValue ) this->m_eValue = presetpatternvalDiagBrick; - else if ( (L"diagCross") == sValue ) this->m_eValue = presetpatternvalDiagCross; - else if ( (L"divot") == sValue ) this->m_eValue = presetpatternvalDivot; - else if ( (L"dkDnDiag") == sValue ) this->m_eValue = presetpatternvalDkDnDiag; - else if ( (L"dkHorz") == sValue ) this->m_eValue = presetpatternvalDkHorz; - else if ( (L"dkUpDiag") == sValue ) this->m_eValue = presetpatternvalDkUpDiag; - else if ( (L"dkVert") == sValue ) this->m_eValue = presetpatternvalDkVert; - else if ( (L"dnDiag") == sValue ) this->m_eValue = presetpatternvalDnDiag; - else if ( (L"dotDmnd") == sValue ) this->m_eValue = presetpatternvalDotDmnd; - else if ( (L"dotGrid") == sValue ) this->m_eValue = presetpatternvalDotGrid; - break; - case 'h': - if ( (L"horz") == sValue ) this->m_eValue = presetpatternvalHorz; - else if ( (L"horzBrick") == sValue ) this->m_eValue = presetpatternvalHorzBrick; - break; - case 'l': - if ( (L"lgCheck") == sValue ) this->m_eValue = presetpatternvalLgCheck; - else if ( (L"lgConfetti") == sValue ) this->m_eValue = presetpatternvalLgConfetti; - else if ( (L"lgGrid") == sValue ) this->m_eValue = presetpatternvalLgGrid; - else if ( (L"ltDnDiag") == sValue ) this->m_eValue = presetpatternvalLtDnDiag; - else if ( (L"ltHorz") == sValue ) this->m_eValue = presetpatternvalLtHorz; - else if ( (L"ltUpDiag") == sValue ) this->m_eValue = presetpatternvalLtUpDiag; - else if ( (L"ltVert") == sValue ) this->m_eValue = presetpatternvalLtVert; - break; - case 'n': - if ( (L"narHorz") == sValue ) this->m_eValue = presetpatternvalNarHorz; - else if ( (L"narVert") == sValue ) this->m_eValue = presetpatternvalNarVert; - break; - case 'o': - if ( (L"openDmnd") == sValue ) this->m_eValue = presetpatternvalOpenDmnd; - break; - case 'p': - if ( (L"pct10") == sValue ) this->m_eValue = presetpatternvalPct10; - else if ( (L"pct20") == sValue ) this->m_eValue = presetpatternvalPct20; - else if ( (L"pct25") == sValue ) this->m_eValue = presetpatternvalPct25; - else if ( (L"pct30") == sValue ) this->m_eValue = presetpatternvalPct30; - else if ( (L"pct40") == sValue ) this->m_eValue = presetpatternvalPct40; - else if ( (L"pct5") == sValue ) this->m_eValue = presetpatternvalPct5; - else if ( (L"pct50") == sValue ) this->m_eValue = presetpatternvalPct50; - else if ( (L"pct60") == sValue ) this->m_eValue = presetpatternvalPct60; - else if ( (L"pct70") == sValue ) this->m_eValue = presetpatternvalPct70; - else if ( (L"pct75") == sValue ) this->m_eValue = presetpatternvalPct75; - else if ( (L"pct80") == sValue ) this->m_eValue = presetpatternvalPct80; - else if ( (L"pct90") == sValue ) this->m_eValue = presetpatternvalPct90; - else if ( (L"plaid") == sValue ) this->m_eValue = presetpatternvalPlaid; - break; - case 's': - if ( (L"shingle") == sValue ) this->m_eValue = presetpatternvalShingle; - else if ( (L"smCheck") == sValue ) this->m_eValue = presetpatternvalSmCheck; - else if ( (L"smConfetti") == sValue ) this->m_eValue = presetpatternvalSmConfetti; - else if ( (L"smGrid") == sValue ) this->m_eValue = presetpatternvalSmGrid; - else if ( (L"solidDmnd") == sValue ) this->m_eValue = presetpatternvalSolidDmnd; - else if ( (L"sphere") == sValue ) this->m_eValue = presetpatternvalSphere; - break; - case 't': - if ( (L"trellis") == sValue ) this->m_eValue = presetpatternvalTrellis; - break; - case 'u': - if ( (L"upDiag") == sValue ) this->m_eValue = presetpatternvalUpDiag; - break; - case 'v': - if ( (L"vert") == sValue ) this->m_eValue = presetpatternvalVert; - break; - case 'w': - if ( (L"wave") == sValue ) this->m_eValue = presetpatternvalWave; - else if ( (L"wdDnDiag") == sValue ) this->m_eValue = presetpatternvalWdDnDiag; - else if ( (L"wdUpDiag") == sValue ) this->m_eValue = presetpatternvalWdUpDiag; - else if ( (L"weave") == sValue ) this->m_eValue = presetpatternvalWeave; - break; - case 'z': - if ( (L"zigZag") == sValue ) this->m_eValue = presetpatternvalZigZag; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case presetpatternvalCross: return (L"cross"); - case presetpatternvalDashDnDiag: return (L"dashDnDiag"); - case presetpatternvalDashHorz: return (L"dashHorz"); - case presetpatternvalDashUpDiag: return (L"dashUpDiag"); - case presetpatternvalDashVert: return (L"dashVert"); - case presetpatternvalDiagBrick: return (L"diagBrick"); - case presetpatternvalDiagCross: return (L"diagCross"); - case presetpatternvalDivot: return (L"divot"); - case presetpatternvalDkDnDiag: return (L"dkDnDiag"); - case presetpatternvalDkHorz: return (L"dkHorz"); - case presetpatternvalDkUpDiag: return (L"dkUpDiag"); - case presetpatternvalDkVert: return (L"dkVert"); - case presetpatternvalDnDiag: return (L"dnDiag"); - case presetpatternvalDotDmnd: return (L"dotDmnd"); - case presetpatternvalDotGrid: return (L"dotGrid"); - case presetpatternvalHorz: return (L"horz"); - case presetpatternvalHorzBrick: return (L"horzBrick"); - case presetpatternvalLgCheck: return (L"lgCheck"); - case presetpatternvalLgConfetti: return (L"lgConfetti"); - case presetpatternvalLgGrid: return (L"lgGrid"); - case presetpatternvalLtDnDiag: return (L"ltDnDiag"); - case presetpatternvalLtHorz: return (L"ltHorz"); - case presetpatternvalLtUpDiag: return (L"ltUpDiag"); - case presetpatternvalLtVert: return (L"ltVert"); - case presetpatternvalNarHorz: return (L"narHorz"); - case presetpatternvalNarVert: return (L"narVert"); - case presetpatternvalOpenDmnd: return (L"openDmnd"); - case presetpatternvalPct10: return (L"pct10"); - case presetpatternvalPct20: return (L"pct20"); - case presetpatternvalPct25: return (L"pct25"); - case presetpatternvalPct30: return (L"pct30"); - case presetpatternvalPct40: return (L"pct40"); - case presetpatternvalPct5: return (L"pct5"); - case presetpatternvalPct50: return (L"pct50"); - case presetpatternvalPct60: return (L"pct60"); - case presetpatternvalPct70: return (L"pct70"); - case presetpatternvalPct75: return (L"pct75"); - case presetpatternvalPct80: return (L"pct80"); - case presetpatternvalPct90: return (L"pct90"); - case presetpatternvalPlaid: return (L"plaid"); - case presetpatternvalShingle: return (L"shingle"); - case presetpatternvalSmCheck: return (L"smCheck"); - case presetpatternvalSmConfetti: return (L"smConfetti"); - case presetpatternvalSmGrid: return (L"smGrid"); - case presetpatternvalSolidDmnd: return (L"solidDmnd"); - case presetpatternvalSphere: return (L"sphere"); - case presetpatternvalTrellis: return (L"trellis"); - case presetpatternvalUpDiag: return (L"upDiag"); - case presetpatternvalVert: return (L"vert"); - case presetpatternvalWave: return (L"wave"); - case presetpatternvalWdDnDiag: return (L"wdDnDiag"); - case presetpatternvalWdUpDiag: return (L"wdUpDiag"); - case presetpatternvalWeave: return (L"weave"); - case presetpatternvalZigZag: return (L"zigZag Zag"); - default : return (L"pct10"); - } - } - - SimpleType_FromString (EPresetPatternVal) - SimpleType_Operator_Equal (CPresetPatternVal) + presetpatternvalCross = 0, // (Cross) + presetpatternvalDashDnDiag, // (Dashed Downward Diagonal) + presetpatternvalDashHorz, // (Dashed Horizontal) + presetpatternvalDashUpDiag, // (Dashed Upward DIagonal) + presetpatternvalDashVert, // (Dashed Vertical) + presetpatternvalDiagBrick, // (Diagonal Brick) + presetpatternvalDiagCross, // (Diagonal Cross) + presetpatternvalDivot, // (Divot) + presetpatternvalDkDnDiag, // (Dark Downward Diagonal) + presetpatternvalDkHorz, // (Dark Horizontal) + presetpatternvalDkUpDiag, // (Dark Upward Diagonal) + presetpatternvalDkVert, // (Dark Vertical) + presetpatternvalDnDiag, // (Downward Diagonal) + presetpatternvalDotDmnd, // (Dotted Diamond) + presetpatternvalDotGrid, // (Dotted Grid) + presetpatternvalHorz, // (Horizontal) + presetpatternvalHorzBrick, // (Horizontal Brick) + presetpatternvalLgCheck, // (Large Checker Board) + presetpatternvalLgConfetti, // (Large Confetti) + presetpatternvalLgGrid, // (Large Grid) + presetpatternvalLtDnDiag, // (Light Downward Diagonal) + presetpatternvalLtHorz, // (Light Horizontal) + presetpatternvalLtUpDiag, // (Light Upward Diagonal) + presetpatternvalLtVert, // (Light Vertical) + presetpatternvalNarHorz, // (Narrow Horizontal) + presetpatternvalNarVert, // (Narrow Vertical) + presetpatternvalOpenDmnd, // (Open Diamond) + presetpatternvalPct10, // (10%) + presetpatternvalPct20, // (20%) + presetpatternvalPct25, // (25%) + presetpatternvalPct30, // (30%) + presetpatternvalPct40, // (40%) + presetpatternvalPct5, // (5%) + presetpatternvalPct50, // (50%) + presetpatternvalPct60, // (60%) + presetpatternvalPct70, // (70%) + presetpatternvalPct75, // (75%) + presetpatternvalPct80, // (80%) + presetpatternvalPct90, // (90%) + presetpatternvalPlaid, // (Plaid) + presetpatternvalShingle, // (Shingle) + presetpatternvalSmCheck, // (Small Checker Board) + presetpatternvalSmConfetti, // (Small Confetti) + presetpatternvalSmGrid, // (Small Grid) + presetpatternvalSolidDmnd, // (Solid Diamond) + presetpatternvalSphere, // (Sphere) + presetpatternvalTrellis, // (Trellis) + presetpatternvalUpDiag, // (Upward Diagonal) + presetpatternvalVert, // (Vertical) + presetpatternvalWave, // (Wave) + presetpatternvalWdDnDiag, // (Wide Downward Diagonal) + presetpatternvalWdUpDiag, // (Wide Upward Diagonal) + presetpatternvalWeave, // (Weave) + presetpatternvalZigZag, // (Zig Zag) }; + DEFINE_SIMPLE_TYPE(CPresetPatternVal, EPresetPatternVal, presetpatternvalPct10) //-------------------------------------------------------------------------------- // PresetShadowVal 20.1.10.52 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPresetShadowVal { presetshadowvalShdw1 = 1, @@ -3804,74 +1102,12 @@ namespace SimpleTypes presetshadowvalShdw9 = 9, }; - template - class CPresetShadowVal : public CSimpleType - { - public: - CPresetShadowVal() {} - virtual EPresetShadowVal FromString(std::wstring &sValue) - { - if ( (L"shdw1") == sValue ) this->m_eValue = presetshadowvalShdw1; - else if ( (L"shdw10") == sValue ) this->m_eValue = presetshadowvalShdw10; - else if ( (L"shdw11") == sValue ) this->m_eValue = presetshadowvalShdw11; - else if ( (L"shdw12") == sValue ) this->m_eValue = presetshadowvalShdw12; - else if ( (L"shdw13") == sValue ) this->m_eValue = presetshadowvalShdw13; - else if ( (L"shdw14") == sValue ) this->m_eValue = presetshadowvalShdw14; - else if ( (L"shdw15") == sValue ) this->m_eValue = presetshadowvalShdw15; - else if ( (L"shdw16") == sValue ) this->m_eValue = presetshadowvalShdw16; - else if ( (L"shdw17") == sValue ) this->m_eValue = presetshadowvalShdw17; - else if ( (L"shdw18") == sValue ) this->m_eValue = presetshadowvalShdw18; - else if ( (L"shdw19") == sValue ) this->m_eValue = presetshadowvalShdw19; - else if ( (L"shdw2") == sValue ) this->m_eValue = presetshadowvalShdw2; - else if ( (L"shdw20") == sValue ) this->m_eValue = presetshadowvalShdw20; - else if ( (L"shdw3") == sValue ) this->m_eValue = presetshadowvalShdw3; - else if ( (L"shdw4") == sValue ) this->m_eValue = presetshadowvalShdw4; - else if ( (L"shdw5") == sValue ) this->m_eValue = presetshadowvalShdw5; - else if ( (L"shdw6") == sValue ) this->m_eValue = presetshadowvalShdw6; - else if ( (L"shdw7") == sValue ) this->m_eValue = presetshadowvalShdw7; - else if ( (L"shdw8") == sValue ) this->m_eValue = presetshadowvalShdw8; - else if ( (L"shdw9") == sValue ) this->m_eValue = presetshadowvalShdw9; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case presetshadowvalShdw1: return (L"shdw1"); - case presetshadowvalShdw2: return (L"shdw2"); - case presetshadowvalShdw3: return (L"shdw3"); - case presetshadowvalShdw4: return (L"shdw4"); - case presetshadowvalShdw5: return (L"shdw5"); - case presetshadowvalShdw6: return (L"shdw6"); - case presetshadowvalShdw7: return (L"shdw7"); - case presetshadowvalShdw8: return (L"shdw8"); - case presetshadowvalShdw9: return (L"shdw9"); - case presetshadowvalShdw10: return (L"shdw10"); - case presetshadowvalShdw11: return (L"shdw11"); - case presetshadowvalShdw12: return (L"shdw12"); - case presetshadowvalShdw13: return (L"shdw13"); - case presetshadowvalShdw14: return (L"shdw14"); - case presetshadowvalShdw15: return (L"shdw15"); - case presetshadowvalShdw16: return (L"shdw16"); - case presetshadowvalShdw17: return (L"shdw17"); - case presetshadowvalShdw18: return (L"shdw18"); - case presetshadowvalShdw19: return (L"shdw19"); - case presetshadowvalShdw20: return (L"shdw20"); - default : return (L"shdw14"); - } - } - - SimpleType_FromString (EPresetShadowVal) - SimpleType_Operator_Equal (CPresetShadowVal) - }; - + DEFINE_SIMPLE_TYPE(CPresetShadowVal, EPresetShadowVal, presetshadowvalShdw14) //-------------------------------------------------------------------------------- // RectAlignment 20.1.10.53 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ERectAlignment { rectalignmentB = 0, @@ -3885,53 +1121,12 @@ namespace SimpleTypes rectalignmentTR = 8, }; - template - class CRectAlignment : public CSimpleType - { - public: - CRectAlignment() {} - - virtual ERectAlignment FromString(std::wstring &sValue) - { - if ( (L"b") == sValue ) this->m_eValue = rectalignmentB; - else if ( (L"bl") == sValue ) this->m_eValue = rectalignmentBL; - else if ( (L"br") == sValue ) this->m_eValue = rectalignmentBR; - else if ( (L"ctr") == sValue ) this->m_eValue = rectalignmentCtr; - else if ( (L"l") == sValue ) this->m_eValue = rectalignmentL; - else if ( (L"r") == sValue ) this->m_eValue = rectalignmentR; - else if ( (L"t") == sValue ) this->m_eValue = rectalignmentT; - else if ( (L"tl") == sValue ) this->m_eValue = rectalignmentTL; - else if ( (L"tr") == sValue ) this->m_eValue = rectalignmentTR; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case rectalignmentB : return (L"b"); - case rectalignmentBL : return (L"bl"); - case rectalignmentBR : return (L"br"); - case rectalignmentCtr: return (L"ctr"); - case rectalignmentL : return (L"l"); - case rectalignmentR : return (L"r"); - case rectalignmentT : return (L"t"); - case rectalignmentTL : return (L"tl"); - case rectalignmentTR : return (L"tr"); - default : return (L"bl"); - } - } - - SimpleType_FromString (ERectAlignment) - SimpleType_Operator_Equal (CRectAlignment) - }; - + DEFINE_SIMPLE_TYPE(CRectAlignment, ERectAlignment, rectalignmentBL) //-------------------------------------------------------------------------------- // ShemeColorVal 20.1.10.54 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EShemeColorVal { shemecolorvalAccent1 = 0, @@ -3953,92 +1148,12 @@ namespace SimpleTypes shemecolorvalTx2 = 16, }; - template - class CShemeColorVal : public CSimpleType - { - public: - CShemeColorVal() {} - - virtual EShemeColorVal FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( (L"accent1") == sValue ) this->m_eValue = shemecolorvalAccent1; - else if ( (L"accent2") == sValue ) this->m_eValue = shemecolorvalAccent2; - else if ( (L"accent3") == sValue ) this->m_eValue = shemecolorvalAccent3; - else if ( (L"accent4") == sValue ) this->m_eValue = shemecolorvalAccent4; - else if ( (L"accent5") == sValue ) this->m_eValue = shemecolorvalAccent5; - else if ( (L"accent6") == sValue ) this->m_eValue = shemecolorvalAccent6; - break; - case 'b': - if ( (L"bg1") == sValue ) this->m_eValue = shemecolorvalBg1; - else if ( (L"bg2") == sValue ) this->m_eValue = shemecolorvalBg2; - break; - case 'd': - if ( (L"dk1") == sValue ) this->m_eValue = shemecolorvalDk1; - else if ( (L"dk2") == sValue ) this->m_eValue = shemecolorvalDk2; - break; - case 'f': - if ( (L"folHlink") == sValue ) this->m_eValue = shemecolorvalFolHlink; - break; - case 'h': - if ( (L"hlink") == sValue ) this->m_eValue = shemecolorvalHlink; - break; - case 'l': - if ( (L"lt1") == sValue ) this->m_eValue = shemecolorvalLt1; - else if ( (L"lt2") == sValue ) this->m_eValue = shemecolorvalLt2; - break; - case 'p': - if ( (L"phClr") == sValue ) this->m_eValue = shemecolorvalPhClr; - break; - case 't': - if ( (L"tx1") == sValue ) this->m_eValue = shemecolorvalTx1; - else if ( (L"tx2") == sValue ) this->m_eValue = shemecolorvalTx2; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case shemecolorvalAccent1: return (L"accent1"); - case shemecolorvalAccent2: return (L"accent2"); - case shemecolorvalAccent3: return (L"accent3"); - case shemecolorvalAccent4: return (L"accent4"); - case shemecolorvalAccent5: return (L"accent5"); - case shemecolorvalAccent6: return (L"accent6"); - case shemecolorvalBg1: return (L"bg1"); - case shemecolorvalBg2: return (L"bg2"); - case shemecolorvalDk1: return (L"dk1"); - case shemecolorvalDk2: return (L"dk2"); - case shemecolorvalFolHlink: return (L"folHlink"); - case shemecolorvalHlink: return (L"hlink"); - case shemecolorvalLt1: return (L"lt1"); - case shemecolorvalLt2: return (L"lt2"); - case shemecolorvalPhClr: return (L"phClr"); - case shemecolorvalTx1: return (L"tx1"); - case shemecolorvalTx2: return (L"tx2"); - default : return (L"accent1"); - } - } - - SimpleType_FromString (EShemeColorVal) - SimpleType_Operator_Equal (CShemeColorVal) - }; - + DEFINE_SIMPLE_TYPE(CShemeColorVal, EShemeColorVal, shemecolorvalAccent1) //-------------------------------------------------------------------------------- // ShapeType 20.1.10.56 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EShapeType { shapetypeAccentBorderCallout1 = 0, @@ -4228,760 +1343,87 @@ namespace SimpleTypes shapetypeWedgeEllipseCallout, shapetypeWedgeRectCallout, shapetypeWedgeRoundRectCallout, -////new////////////// - shapetypeBallon, - shapetypeRightUpArrow, - //дубирует с WordArd - может задаваться как внутри текстого бокса, так и в виде объекта - shapetypeTextArchDownPour, - shapetypeTextArchUpPour, - shapetypeTextCanDown, - shapetypeTextCanUp, - shapetypeTextCirclePour, - shapetypeTextCurveDown, - shapetypeTextCurveUp, - shapetypeTextDeflate, - shapetypeTextDeflateBottom, - shapetypeTextDeflateInflate, - shapetypeTextDeflateInflateDeflat, - shapetypeTextDeflateTop, - shapetypeTextDoubleWave1, - shapetypeTextFadeDown, - shapetypeTextFadeLeft, - shapetypeTextFadeRight, - shapetypeTextFadeUp, - shapetypeTextInflateBottom, - shapetypeTextInflateTop, - shapetypeTextRingInside, - shapetypeTextRingOutside, - shapetypeTextWave1, - shapetypeTextWave2, - shapetypeTextWave4, - shapetypeThickArrow + ////new////////////// + shapetypeBallon, + shapetypeRightUpArrow, + //дубирует с WordArd - может задаваться как внутри текстого бокса, так и в виде объекта + shapetypeTextArchDownPour, + shapetypeTextArchUpPour, + shapetypeTextCanDown, + shapetypeTextCanUp, + shapetypeTextCirclePour, + shapetypeTextCurveDown, + shapetypeTextCurveUp, + shapetypeTextDeflate, + shapetypeTextDeflateBottom, + shapetypeTextDeflateInflate, + shapetypeTextDeflateInflateDeflat, + shapetypeTextDeflateTop, + shapetypeTextDoubleWave1, + shapetypeTextFadeDown, + shapetypeTextFadeLeft, + shapetypeTextFadeRight, + shapetypeTextFadeUp, + shapetypeTextInflateBottom, + shapetypeTextInflateTop, + shapetypeTextRingInside, + shapetypeTextRingOutside, + shapetypeTextWave1, + shapetypeTextWave2, + shapetypeTextWave4, + shapetypeThickArrow }; - template - class CShapeType : public CSimpleType - { - public: - CShapeType() {} - - virtual EShapeType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - - if ( (L"accentBorderCallout1") == sValue ) this->m_eValue = shapetypeAccentBorderCallout1; - else if ( (L"accentBorderCallout2") == sValue ) this->m_eValue = shapetypeAccentBorderCallout2; - else if ( (L"accentBorderCallout3") == sValue ) this->m_eValue = shapetypeAccentBorderCallout3; - else if ( (L"accentCallout1") == sValue ) this->m_eValue = shapetypeAccentCallout1; - else if ( (L"accentCallout2") == sValue ) this->m_eValue = shapetypeAccentCallout2; - else if ( (L"accentCallout3") == sValue ) this->m_eValue = shapetypeAccentCallout3; - else if ( (L"actionButtonBackPrevious")== sValue ) this->m_eValue = shapetypeActionButtonBackPrevious; - else if ( (L"actionButtonBeginning") == sValue ) this->m_eValue = shapetypeActionButtonBeginning; - else if ( (L"actionButtonBlank") == sValue ) this->m_eValue = shapetypeActionButtonBlank; - else if ( (L"actionButtonDocument") == sValue ) this->m_eValue = shapetypeActionButtonDocument; - else if ( (L"actionButtonEnd") == sValue ) this->m_eValue = shapetypeActionButtonEnd; - else if ( (L"actionButtonForwardNext") == sValue ) this->m_eValue = shapetypeActionButtonForwardNext; - else if ( (L"actionButtonHelp") == sValue ) this->m_eValue = shapetypeActionButtonHelp; - else if ( (L"actionButtonHome") == sValue ) this->m_eValue = shapetypeActionButtonHome; - else if ( (L"actionButtonInformation") == sValue ) this->m_eValue = shapetypeActionButtonInformation; - else if ( (L"actionButtonMovie") == sValue ) this->m_eValue = shapetypeActionButtonMovie; - else if ( (L"actionButtonReturn") == sValue ) this->m_eValue = shapetypeActionButtonReturn; - else if ( (L"actionButtonSound") == sValue ) this->m_eValue = shapetypeActionButtonSound; - else if ( (L"arc") == sValue ) this->m_eValue = shapetypeArc; - break; - - case 'b': - if ( (L"bentArrow") == sValue ) this->m_eValue = shapetypeBentArrow; - else if ( (L"bentConnector2") == sValue ) this->m_eValue = shapetypeBentConnector2; - else if ( (L"bentConnector3") == sValue ) this->m_eValue = shapetypeBentConnector3; - else if ( (L"bentConnector4") == sValue ) this->m_eValue = shapetypeBentConnector4; - else if ( (L"bentConnector5") == sValue ) this->m_eValue = shapetypeBentConnector5; - else if ( (L"bentUpArrow") == sValue ) this->m_eValue = shapetypeBentUpArrow; - else if ( (L"bevel") == sValue ) this->m_eValue = shapetypeBevel; - else if ( (L"blockArc") == sValue ) this->m_eValue = shapetypeBlockArc; - else if ( (L"borderCallout1") == sValue ) this->m_eValue = shapetypeBorderCallout1; - else if ( (L"borderCallout2") == sValue ) this->m_eValue = shapetypeBorderCallout2; - else if ( (L"borderCallout3") == sValue ) this->m_eValue = shapetypeBorderCallout3; - else if ( (L"bracePair") == sValue ) this->m_eValue = shapetypeBracePair; - else if ( (L"bracketPair") == sValue ) this->m_eValue = shapetypeBracketPair; - /////new - else if ( (L"Balloon") == sValue ) this->m_eValue = shapetypeBallon; - break; - - case 'c': - if ( (L"callout1") == sValue ) this->m_eValue = shapetypeCallout1; - else if ( (L"callout2") == sValue ) this->m_eValue = shapetypeCallout2; - else if ( (L"callout3") == sValue ) this->m_eValue = shapetypeCallout3; - else if ( (L"can") == sValue ) this->m_eValue = shapetypeCan; - else if ( (L"chartPlus") == sValue ) this->m_eValue = shapetypeChartPlus; - else if ( (L"chartStar") == sValue ) this->m_eValue = shapetypeChartStar; - else if ( (L"chartX") == sValue ) this->m_eValue = shapetypeChartX; - else if ( (L"chevron") == sValue ) this->m_eValue = shapetypeChevron; - else if ( (L"chord") == sValue ) this->m_eValue = shapetypeChord; - else if ( (L"circularArrow") == sValue ) this->m_eValue = shapetypeCircularArrow; - else if ( (L"cloud") == sValue ) this->m_eValue = shapetypeCloud; - else if ( (L"cloudCallout") == sValue ) this->m_eValue = shapetypeCloudCallout; - else if ( (L"corner") == sValue ) this->m_eValue = shapetypeCorner; - else if ( (L"cornerTabs") == sValue ) this->m_eValue = shapetypeCornerTabs; - else if ( (L"cube") == sValue ) this->m_eValue = shapetypeCube; - else if ( (L"curvedConnector2") == sValue ) this->m_eValue = shapetypeCurvedConnector2; - else if ( (L"curvedConnector3") == sValue ) this->m_eValue = shapetypeCurvedConnector3; - else if ( (L"curvedConnector4") == sValue ) this->m_eValue = shapetypeCurvedConnector4; - else if ( (L"curvedConnector5") == sValue ) this->m_eValue = shapetypeCurvedConnector5; - else if ( (L"curvedDownArrow") == sValue ) this->m_eValue = shapetypeCurvedDownArrow; - else if ( (L"curvedLeftArrow") == sValue ) this->m_eValue = shapetypeCurvedLeftArrow; - else if ( (L"curvedRightArrow") == sValue ) this->m_eValue = shapetypeCurvedRightArrow; - else if ( (L"curvedUpArrow") == sValue ) this->m_eValue = shapetypeCurvedUpArrow; - break; - - case 'd': - if ( (L"decagon") == sValue ) this->m_eValue = shapetypeDecagon; - else if ( (L"diagStripe") == sValue ) this->m_eValue = shapetypeDiagStripe; - else if ( (L"diamond") == sValue ) this->m_eValue = shapetypeDiamond; - else if ( (L"dodecagon") == sValue ) this->m_eValue = shapetypeDodecagon; - else if ( (L"donut") == sValue ) this->m_eValue = shapetypeDonut; - else if ( (L"doubleWave") == sValue ) this->m_eValue = shapetypeDoubleWave; - else if ( (L"downArrow") == sValue ) this->m_eValue = shapetypeDownArrow; - else if ( (L"downArrowCallout") == sValue ) this->m_eValue = shapetypeDownArrowCallout; - break; - - case 'e': - if ( (L"ellipse") == sValue ) this->m_eValue = shapetypeEllipse; - else if ( (L"ellipseRibbon") == sValue ) this->m_eValue = shapetypeEllipseRibbon; - else if ( (L"ellipseRibbon2") == sValue ) this->m_eValue = shapetypeEllipseRibbon2; - break; - - case 'f': - if ( (L"flowChartAlternateProcess") == sValue ) this->m_eValue = shapetypeFlowChartAlternateProcess; - else if ( (L"flowChartCollate") == sValue ) this->m_eValue = shapetypeFlowChartCollate; - else if ( (L"flowChartConnector") == sValue ) this->m_eValue = shapetypeFlowChartConnector; - else if ( (L"flowChartDecision") == sValue ) this->m_eValue = shapetypeFlowChartDecision; - else if ( (L"flowChartDelay") == sValue ) this->m_eValue = shapetypeFlowChartDelay; - else if ( (L"flowChartDisplay") == sValue ) this->m_eValue = shapetypeFlowChartDisplay; - else if ( (L"flowChartDocument") == sValue ) this->m_eValue = shapetypeFlowChartDocument; - else if ( (L"flowChartExtract") == sValue ) this->m_eValue = shapetypeFlowChartExtract; - else if ( (L"flowChartInputOutput") == sValue ) this->m_eValue = shapetypeFlowChartInputOutput; - else if ( (L"flowChartInternalStorage") == sValue ) this->m_eValue = shapetypeFlowChartInternalStorage; - else if ( (L"flowChartMagneticDisk") == sValue ) this->m_eValue = shapetypeFlowChartMagneticDisk; - else if ( (L"flowChartMagneticDrum") == sValue ) this->m_eValue = shapetypeFlowChartMagneticDrum; - else if ( (L"flowChartMagneticTape") == sValue ) this->m_eValue = shapetypeFlowChartMagneticTape; - else if ( (L"flowChartManualInput") == sValue ) this->m_eValue = shapetypeFlowChartManualInput; - else if ( (L"flowChartManualOperation") == sValue ) this->m_eValue = shapetypeFlowChartManualOperation; - else if ( (L"flowChartMerge") == sValue ) this->m_eValue = shapetypeFlowChartMerge; - else if ( (L"flowChartMultidocument") == sValue ) this->m_eValue = shapetypeFlowChartMultidocument; - else if ( (L"flowChartOfflineStorage") == sValue ) this->m_eValue = shapetypeFlowChartOfflineStorage; - else if ( (L"flowChartOffpageConnector") == sValue ) this->m_eValue = shapetypeFlowChartOffpageConnector; - else if ( (L"flowChartOnlineStorage") == sValue ) this->m_eValue = shapetypeFlowChartOnlineStorage; - else if ( (L"flowChartOr") == sValue ) this->m_eValue = shapetypeFlowChartOr; - else if ( (L"flowChartPredefinedProcess") == sValue ) this->m_eValue = shapetypeFlowChartPredefinedProcess; - else if ( (L"flowChartPreparation") == sValue ) this->m_eValue = shapetypeFlowChartPreparation; - else if ( (L"flowChartProcess") == sValue ) this->m_eValue = shapetypeFlowChartProcess; - else if ( (L"flowChartPunchedCard") == sValue ) this->m_eValue = shapetypeFlowChartPunchedCard; - else if ( (L"flowChartPunchedTape") == sValue ) this->m_eValue = shapetypeFlowChartPunchedTape; - else if ( (L"flowChartSort") == sValue ) this->m_eValue = shapetypeFlowChartSort; - else if ( (L"flowChartSummingJunction") == sValue ) this->m_eValue = shapetypeFlowChartSummingJunction; - else if ( (L"flowChartTerminator") == sValue ) this->m_eValue = shapetypeFlowChartTerminator; - else if ( (L"foldedCorner") == sValue ) this->m_eValue = shapetypeFoldedCorner; - else if ( (L"frame") == sValue ) this->m_eValue = shapetypeFrame; - else if ( (L"funnel") == sValue ) this->m_eValue = shapetypeFunnel; - break; - - case 'g': - if ( (L"gear6") == sValue ) this->m_eValue = shapetypeGear6; - else if ( (L"gear9") == sValue ) this->m_eValue = shapetypeGear9; - break; - - case 'h': - if ( (L"halfFrame") == sValue ) this->m_eValue = shapetypeHalfFrame; - else if ( (L"heart") == sValue ) this->m_eValue = shapetypeHeart; - else if ( (L"heptagon") == sValue ) this->m_eValue = shapetypeHeptagon; - else if ( (L"hexagon") == sValue ) this->m_eValue = shapetypeHexagon; - else if ( (L"homePlate") == sValue ) this->m_eValue = shapetypeHomePlate; - else if ( (L"horizontalScroll") == sValue ) this->m_eValue = shapetypeHorizontalScroll; - break; - - case 'i': - if ( (L"irregularSeal1") == sValue ) this->m_eValue = shapetypeIrregularSeal1; - else if ( (L"irregularSeal2") == sValue ) this->m_eValue = shapetypeIrregularSeal2; - break; - - case 'l': - if ( (L"leftArrow") == sValue ) this->m_eValue = shapetypeLeftArrow; - else if ( (L"leftArrowCallout") == sValue ) this->m_eValue = shapetypeLeftArrowCallout; - else if ( (L"leftBrace") == sValue ) this->m_eValue = shapetypeLeftBrace; - else if ( (L"leftBracket") == sValue ) this->m_eValue = shapetypeLeftBracket; - else if ( (L"leftCircularArrow") == sValue ) this->m_eValue = shapetypeLeftCircularArrow; - else if ( (L"leftRightArrow") == sValue ) this->m_eValue = shapetypeLeftRightArrow; - else if ( (L"leftRightArrowCallout") == sValue ) this->m_eValue = shapetypeLeftRightArrowCallout; - else if ( (L"leftRightCircularArrow") == sValue ) this->m_eValue = shapetypeLeftRightCircularArrow; - else if ( (L"leftRightRibbon") == sValue ) this->m_eValue = shapetypeLeftRightRibbon; - else if ( (L"leftRightUpArrow") == sValue ) this->m_eValue = shapetypeLeftRightUpArrow; - else if ( (L"leftUpArrow") == sValue ) this->m_eValue = shapetypeLeftUpArrow; - else if ( (L"lightningBolt") == sValue ) this->m_eValue = shapetypeLightningBolt; - else if ( (L"line") == sValue ) this->m_eValue = shapetypeLine; - else if ( (L"lineInv") == sValue ) this->m_eValue = shapetypeLineInv; - break; - - case 'm': - if ( (L"mathDivide") == sValue ) this->m_eValue = shapetypeMathDivide; - else if ( (L"mathEqual") == sValue ) this->m_eValue = shapetypeMathEqual; - else if ( (L"mathMinus") == sValue ) this->m_eValue = shapetypeMathMinus; - else if ( (L"mathMultiply") == sValue ) this->m_eValue = shapetypeMathMultiply; - else if ( (L"mathNotEqual") == sValue ) this->m_eValue = shapetypeMathNotEqual; - else if ( (L"mathPlus") == sValue ) this->m_eValue = shapetypeMathPlus; - else if ( (L"moon") == sValue ) this->m_eValue = shapetypeMoon; - break; - - case 'n': - if ( (L"nonIsoscelesTrapezoid") == sValue ) this->m_eValue = shapetypeNonIsoscelesTrapezoid; - else if ( (L"noSmoking") == sValue ) this->m_eValue = shapetypeNoSmoking; - else if ( (L"notchedRightArrow") == sValue ) this->m_eValue = shapetypeNotchedRightArrow; - break; - - case 'o': - if ( (L"octagon") == sValue ) this->m_eValue = shapetypeOctagon; - break; - - case 'p': - if ( (L"parallelogram") == sValue ) this->m_eValue = shapetypeParallelogram; - else if ( (L"pentagon") == sValue ) this->m_eValue = shapetypePentagon; - else if ( (L"pie") == sValue ) this->m_eValue = shapetypePie; - else if ( (L"pieWedge") == sValue ) this->m_eValue = shapetypePieWedge; - else if ( (L"plaque") == sValue ) this->m_eValue = shapetypePlaque; - else if ( (L"plaqueTabs") == sValue ) this->m_eValue = shapetypePlaqueTabs; - else if ( (L"plus") == sValue ) this->m_eValue = shapetypePlus; - break; - - case 'q': - if ( (L"quadArrow") == sValue ) this->m_eValue = shapetypeQuadArrow; - else if ( (L"quadArrowCallout") == sValue ) this->m_eValue = shapetypeQuadArrowCallout; - break; - - case 'r': - if ( (L"rect") == sValue ) this->m_eValue = shapetypeRect; - else if ( (L"ribbon") == sValue ) this->m_eValue = shapetypeRibbon; - else if ( (L"ribbon2") == sValue ) this->m_eValue = shapetypeRibbon2; - else if ( (L"rightArrow") == sValue ) this->m_eValue = shapetypeRightArrow; - else if ( (L"rightArrowCallout") == sValue ) this->m_eValue = shapetypeRightArrowCallout; - else if ( (L"rightBrace") == sValue ) this->m_eValue = shapetypeRightBrace; - else if ( (L"rightBracket") == sValue ) this->m_eValue = shapetypeRightBracket; - else if ( (L"round1Rect") == sValue ) this->m_eValue = shapetypeRound1Rect; - else if ( (L"round2DiagRect") == sValue ) this->m_eValue = shapetypeRound2DiagRect; - else if ( (L"round2SameRect") == sValue ) this->m_eValue = shapetypeRound2SameRect; - else if ( (L"roundRect") == sValue ) this->m_eValue = shapetypeRoundRect; - else if ( (L"rtTriangle") == sValue ) this->m_eValue = shapetypeRtTriangle; - ////new - else if ( (L"rightUpArrow") == sValue ) this->m_eValue = shapetypeRightUpArrow; - break; - - case 's': - if ( (L"smileyFace") == sValue ) this->m_eValue = shapetypeSmileyFace; - else if ( (L"snip1Rect") == sValue ) this->m_eValue = shapetypeSnip1Rect; - else if ( (L"snip2DiagRect") == sValue ) this->m_eValue = shapetypeSnip2DiagRect; - else if ( (L"snip2SameRect") == sValue ) this->m_eValue = shapetypeSnip2SameRect; - else if ( (L"snipRoundRect") == sValue ) this->m_eValue = shapetypeSnipRoundRect; - else if ( (L"squareTabs") == sValue ) this->m_eValue = shapetypeSquareTabs; - else if ( (L"star10") == sValue ) this->m_eValue = shapetypeStar10; - else if ( (L"star12") == sValue ) this->m_eValue = shapetypeStar12; - else if ( (L"star16") == sValue ) this->m_eValue = shapetypeStar16; - else if ( (L"star24") == sValue ) this->m_eValue = shapetypeStar24; - else if ( (L"star32") == sValue ) this->m_eValue = shapetypeStar32; - else if ( (L"star4") == sValue ) this->m_eValue = shapetypeStar4; - else if ( (L"star5") == sValue ) this->m_eValue = shapetypeStar5; - else if ( (L"star6") == sValue ) this->m_eValue = shapetypeStar6; - else if ( (L"star7") == sValue ) this->m_eValue = shapetypeStar7; - else if ( (L"star8") == sValue ) this->m_eValue = shapetypeStar8; - else if ( (L"straightConnector1") == sValue ) this->m_eValue = shapetypeStraightConnector1; - else if ( (L"stripedRightArrow") == sValue ) this->m_eValue = shapetypeStripedRightArrow; - else if ( (L"sun") == sValue ) this->m_eValue = shapetypeSun; - else if ( (L"swooshArrow") == sValue ) this->m_eValue = shapetypeSwooshArrow; - break; - - case 't': - if ( (L"teardrop") == sValue ) this->m_eValue = shapetypeTeardrop; - else if ( (L"trapezoid") == sValue ) this->m_eValue = shapetypeTrapezoid; - else if ( (L"triangle") == sValue ) this->m_eValue = shapetypeTriangle; - /////new - else if ( (L"textArchDownPour") == sValue ) this->m_eValue = shapetypeTextArchDownPour; - else if ( (L"textArchUpPour") == sValue ) this->m_eValue = shapetypeTextArchUpPour; - else if ( (L"textCanDown") == sValue ) this->m_eValue = shapetypeTextCanDown; - else if ( (L"textCanUp") == sValue ) this->m_eValue = shapetypeTextCanUp; - else if ( (L"textCirclePour") == sValue ) this->m_eValue = shapetypeTextCirclePour; - else if ( (L"textCurveDown") == sValue ) this->m_eValue = shapetypeTextCurveDown; - else if ( (L"textCurveUp") == sValue ) this->m_eValue = shapetypeTextCurveUp; - else if ( (L"textDeflate") == sValue ) this->m_eValue = shapetypeTextDeflate; - else if ( (L"textDeflateBottom") == sValue ) this->m_eValue = shapetypeTextDeflateBottom; - else if ( (L"textDeflateInflate") == sValue ) this->m_eValue = shapetypeTextDeflateInflate; - else if ( (L"textDeflateInflateDeflate") == sValue ) this->m_eValue = shapetypeTextDeflateInflateDeflat; - else if ( (L"textDeflateTop") == sValue ) this->m_eValue = shapetypeTextDeflateTop; - else if ( (L"textDoubleWave1") == sValue ) this->m_eValue = shapetypeTextDoubleWave1; - else if ( (L"textFadeDown") == sValue ) this->m_eValue = shapetypeTextFadeDown; - else if ( (L"textFadeLeft") == sValue ) this->m_eValue = shapetypeTextFadeLeft; - else if ( (L"textFadeRight") == sValue ) this->m_eValue = shapetypeTextFadeRight; - else if ( (L"textFadeUp") == sValue ) this->m_eValue = shapetypeTextFadeUp; - else if ( (L"textInflateBottom") == sValue ) this->m_eValue = shapetypeTextInflateBottom; - else if ( (L"textInflateTop") == sValue ) this->m_eValue = shapetypeTextInflateTop; - else if ( (L"textRingInside") == sValue ) this->m_eValue = shapetypeTextRingInside; - else if ( (L"textRingOutside") == sValue ) this->m_eValue = shapetypeTextRingOutside; - else if ( (L"textWave1") == sValue ) this->m_eValue = shapetypeTextWave1; - else if ( (L"textWave2") == sValue ) this->m_eValue = shapetypeTextWave2; - else if ( (L"textWave4") == sValue ) this->m_eValue = shapetypeTextWave4; - else if ( (L"thickArrow") == sValue ) this->m_eValue = shapetypeThickArrow; - break; - case 'u': - if ( (L"upArrow") == sValue ) this->m_eValue = shapetypeUpArrow; - else if ( (L"upArrowCallout") == sValue ) this->m_eValue = shapetypeUpArrowCallout; - else if ( (L"upDownArrow") == sValue ) this->m_eValue = shapetypeUpDownArrow; - else if ( (L"upDownArrowCallout") == sValue ) this->m_eValue = shapetypeUpDownArrowCallout; - else if ( (L"uturnArrow") == sValue ) this->m_eValue = shapetypeUturnArrow; - break; - - case 'v': - if ( (L"verticalScroll") == sValue ) this->m_eValue = shapetypeVerticalScroll; - break; - - case 'w': - if ( (L"wave") == sValue ) this->m_eValue = shapetypeWave; - else if ( (L"wedgeEllipseCallout") == sValue ) this->m_eValue = shapetypeWedgeEllipseCallout; - else if ( (L"wedgeRectCallout") == sValue ) this->m_eValue = shapetypeWedgeRectCallout; - else if ( (L"wedgeRoundRectCallout") == sValue ) this->m_eValue = shapetypeWedgeRoundRectCallout; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case shapetypeAccentBorderCallout1: return (L"accentBorderCallout1"); - case shapetypeAccentBorderCallout2: return (L"accentBorderCallout2"); - case shapetypeAccentBorderCallout3: return (L"accentBorderCallout3"); - case shapetypeAccentCallout1: return (L"accentCallout1"); - case shapetypeAccentCallout2: return (L"accentCallout2"); - case shapetypeAccentCallout3: return (L"accentCallout3"); - case shapetypeActionButtonBackPrevious: return (L"actionButtonBackPrevious"); - case shapetypeActionButtonBeginning: return (L"actionButtonBeginning"); - case shapetypeActionButtonBlank: return (L"actionButtonBlank"); - case shapetypeActionButtonDocument: return (L"actionButtonDocument"); - case shapetypeActionButtonEnd: return (L"actionButtonEnd"); - case shapetypeActionButtonForwardNext: return (L"actionButtonForwardNext"); - case shapetypeActionButtonHelp: return (L"actionButtonHelp"); - case shapetypeActionButtonHome: return (L"actionButtonHome"); - case shapetypeActionButtonInformation: return (L"actionButtonInformation"); - case shapetypeActionButtonMovie: return (L"actionButtonMovie"); - case shapetypeActionButtonReturn: return (L"actionButtonReturn"); - case shapetypeActionButtonSound: return (L"actionButtonSound"); - case shapetypeArc: return (L"arc"); - case shapetypeBentArrow: return (L"bentArrow"); - case shapetypeBentConnector2: return (L"bentConnector2"); - case shapetypeBentConnector3: return (L"bentConnector3"); - case shapetypeBentConnector4: return (L"bentConnector4"); - case shapetypeBentConnector5: return (L"bentConnector5"); - case shapetypeBentUpArrow: return (L"bentUpArrow"); - case shapetypeBevel: return (L"bevel"); - case shapetypeBlockArc: return (L"blockArc"); - case shapetypeBorderCallout1: return (L"borderCallout1"); - case shapetypeBorderCallout2: return (L"borderCallout2"); - case shapetypeBorderCallout3: return (L"borderCallout3"); - case shapetypeBracePair: return (L"bracePair"); - case shapetypeBracketPair: return (L"bracketPair"); - case shapetypeCallout1: return (L"callout1"); - case shapetypeCallout2: return (L"callout2"); - case shapetypeCallout3: return (L"callout3"); - case shapetypeCan: return (L"can"); - case shapetypeChartPlus: return (L"chartPlus"); - case shapetypeChartStar: return (L"chartStar"); - case shapetypeChartX: return (L"chartX"); - case shapetypeChevron: return (L"chevron"); - case shapetypeChord: return (L"chord"); - case shapetypeCircularArrow: return (L"circularArrow"); - case shapetypeCloud: return (L"cloud"); - case shapetypeCloudCallout: return (L"cloudCallout"); - case shapetypeCorner: return (L"corner"); - case shapetypeCornerTabs: return (L"cornerTabs"); - case shapetypeCube: return (L"cube"); - case shapetypeCurvedConnector2: return (L"curvedConnector2"); - case shapetypeCurvedConnector3: return (L"curvedConnector3"); - case shapetypeCurvedConnector4: return (L"curvedConnector4"); - case shapetypeCurvedConnector5: return (L"curvedConnector5"); - case shapetypeCurvedDownArrow: return (L"curvedDownArrow"); - case shapetypeCurvedLeftArrow: return (L"curvedLeftArrow"); - case shapetypeCurvedRightArrow: return (L"curvedRightArrow"); - case shapetypeCurvedUpArrow: return (L"curvedUpArrow"); - case shapetypeDecagon: return (L"decagon"); - case shapetypeDiagStripe: return (L"diagStripe"); - case shapetypeDiamond: return (L"diamond"); - case shapetypeDodecagon: return (L"dodecagon"); - case shapetypeDonut: return (L"donut"); - case shapetypeDoubleWave: return (L"doubleWave"); - case shapetypeDownArrow: return (L"downArrow"); - case shapetypeDownArrowCallout: return (L"downArrowCallout"); - case shapetypeEllipse: return (L"ellipse"); - case shapetypeEllipseRibbon: return (L"ellipseRibbon"); - case shapetypeEllipseRibbon2: return (L"ellipseRibbon2"); - case shapetypeFlowChartAlternateProcess: return (L"flowChartAlternateProcess"); - case shapetypeFlowChartCollate: return (L"flowChartCollate"); - case shapetypeFlowChartConnector: return (L"flowChartConnector"); - case shapetypeFlowChartDecision: return (L"flowChartDecision"); - case shapetypeFlowChartDelay: return (L"flowChartDelay"); - case shapetypeFlowChartDisplay: return (L"flowChartDisplay"); - case shapetypeFlowChartDocument: return (L"flowChartDocument"); - case shapetypeFlowChartExtract: return (L"flowChartExtract"); - case shapetypeFlowChartInputOutput: return (L"flowChartInputOutput"); - case shapetypeFlowChartInternalStorage: return (L"flowChartInternalStorage"); - case shapetypeFlowChartMagneticDisk: return (L"flowChartMagneticDisk"); - case shapetypeFlowChartMagneticDrum: return (L"flowChartMagneticDrum"); - case shapetypeFlowChartMagneticTape: return (L"flowChartMagneticTape"); - case shapetypeFlowChartManualInput: return (L"flowChartManualInput"); - case shapetypeFlowChartManualOperation: return (L"flowChartManualOperation"); - case shapetypeFlowChartMerge: return (L"flowChartMerge"); - case shapetypeFlowChartMultidocument: return (L"flowChartMultidocument"); - case shapetypeFlowChartOfflineStorage: return (L"flowChartOfflineStorage"); - case shapetypeFlowChartOffpageConnector: return (L"flowChartOffpageConnector"); - case shapetypeFlowChartOnlineStorage: return (L"flowChartOnlineStorage"); - case shapetypeFlowChartOr: return (L"flowChartOr"); - case shapetypeFlowChartPredefinedProcess: return (L"flowChartPredefinedProcess"); - case shapetypeFlowChartPreparation: return (L"flowChartPreparation"); - case shapetypeFlowChartProcess: return (L"flowChartProcess"); - case shapetypeFlowChartPunchedCard: return (L"flowChartPunchedCard"); - case shapetypeFlowChartPunchedTape: return (L"flowChartPunchedTape"); - case shapetypeFlowChartSort: return (L"flowChartSort"); - case shapetypeFlowChartSummingJunction: return (L"flowChartSummingJunction"); - case shapetypeFlowChartTerminator: return (L"flowChartTerminator"); - case shapetypeFoldedCorner: return (L"foldedCorner"); - case shapetypeFrame: return (L"frame"); - case shapetypeFunnel: return (L"funnel"); - case shapetypeGear6: return (L"gear6"); - case shapetypeGear9: return (L"gear9"); - case shapetypeHalfFrame: return (L"halfFrame"); - case shapetypeHeart: return (L"heart"); - case shapetypeHeptagon: return (L"heptagon"); - case shapetypeHexagon: return (L"hexagon"); - case shapetypeHomePlate: return (L"homePlate"); - case shapetypeHorizontalScroll: return (L"horizontalScroll"); - case shapetypeIrregularSeal1: return (L"irregularSeal1"); - case shapetypeIrregularSeal2: return (L"irregularSeal2"); - case shapetypeLeftArrow: return (L"leftArrow"); - case shapetypeLeftArrowCallout: return (L"leftArrowCallout"); - case shapetypeLeftBrace: return (L"leftBrace"); - case shapetypeLeftBracket: return (L"leftBracket"); - case shapetypeLeftCircularArrow: return (L"leftCircularArrow"); - case shapetypeLeftRightArrow: return (L"leftRightArrow"); - case shapetypeLeftRightArrowCallout: return (L"leftRightArrowCallout"); - case shapetypeLeftRightCircularArrow: return (L"leftRightCircularArrow"); - case shapetypeLeftRightRibbon: return (L"leftRightRibbon"); - case shapetypeLeftRightUpArrow: return (L"leftRightUpArrow"); - case shapetypeLeftUpArrow: return (L"leftUpArrow"); - case shapetypeLightningBolt: return (L"lightningBolt"); - case shapetypeLine: return (L"line"); - case shapetypeLineInv: return (L"lineInv"); - case shapetypeMathDivide: return (L"mathDivide"); - case shapetypeMathEqual: return (L"mathEqual"); - case shapetypeMathMinus: return (L"mathMinus"); - case shapetypeMathMultiply: return (L"mathMultiply"); - case shapetypeMathNotEqual: return (L"mathNotEqual"); - case shapetypeMathPlus: return (L"mathPlus"); - case shapetypeMoon: return (L"moon"); - case shapetypeNonIsoscelesTrapezoid: return (L"nonIsoscelesTrapezoid"); - case shapetypeNoSmoking: return (L"noSmoking"); - case shapetypeNotchedRightArrow: return (L"notchedRightArrow"); - case shapetypeOctagon: return (L"octagon"); - case shapetypeParallelogram: return (L"parallelogram"); - case shapetypePentagon: return (L"pentagon"); - case shapetypePie: return (L"pie"); - case shapetypePieWedge: return (L"pieWedge"); - case shapetypePlaque: return (L"plaque"); - case shapetypePlaqueTabs: return (L"plaqueTabs"); - case shapetypePlus: return (L"plus"); - case shapetypeQuadArrow: return (L"quadArrow"); - case shapetypeQuadArrowCallout: return (L"quadArrowCallout"); - case shapetypeRect: return (L"rect"); - case shapetypeRibbon: return (L"ribbon"); - case shapetypeRibbon2: return (L"ribbon2"); - case shapetypeRightArrow: return (L"rightArrow"); - case shapetypeRightArrowCallout: return (L"rightArrowCallout"); - case shapetypeRightBrace: return (L"rightBrace"); - case shapetypeRightBracket: return (L"rightBracket"); - case shapetypeRound1Rect: return (L"round1Rect"); - case shapetypeRound2DiagRect: return (L"round2DiagRect"); - case shapetypeRound2SameRect: return (L"round2SameRect"); - case shapetypeRoundRect: return (L"roundRect"); - case shapetypeRtTriangle: return (L"rtTriangle"); - case shapetypeSmileyFace: return (L"smileyFace"); - case shapetypeSnip1Rect: return (L"snip1Rect"); - case shapetypeSnip2DiagRect: return (L"snip2DiagRect"); - case shapetypeSnip2SameRect: return (L"snip2SameRect"); - case shapetypeSnipRoundRect: return (L"snipRoundRect"); - case shapetypeSquareTabs: return (L"squareTabs"); - case shapetypeStar10: return (L"star10"); - case shapetypeStar12: return (L"star12"); - case shapetypeStar16: return (L"star16"); - case shapetypeStar24: return (L"star24"); - case shapetypeStar32: return (L"star32"); - case shapetypeStar4: return (L"star4"); - case shapetypeStar5: return (L"star5"); - case shapetypeStar6: return (L"star6"); - case shapetypeStar7: return (L"star7"); - case shapetypeStar8: return (L"star8"); - case shapetypeStraightConnector1: return (L"straightConnector1"); - case shapetypeStripedRightArrow: return (L"stripedRightArrow"); - case shapetypeSun: return (L"sun"); - case shapetypeSwooshArrow: return (L"swooshArrow"); - case shapetypeTeardrop: return (L"teardrop"); - case shapetypeTrapezoid: return (L"trapezoid"); - case shapetypeTriangle: return (L"triangle"); - case shapetypeUpArrow: return (L"upArrow"); - case shapetypeUpArrowCallout: return (L"upArrowCallout"); - case shapetypeUpDownArrow: return (L"upDownArrow"); - case shapetypeUpDownArrowCallout: return (L"upDownArrowCallout"); - case shapetypeUturnArrow: return (L"uturnArrow"); - case shapetypeVerticalScroll: return (L"verticalScroll"); - case shapetypeWave: return (L"wave"); - case shapetypeWedgeEllipseCallout: return (L"wedgeEllipseCallout"); - case shapetypeWedgeRectCallout: return (L"wedgeRectCallout"); - case shapetypeWedgeRoundRectCallout: return (L"wedgeRoundRectCallout"); - ///new// - case shapetypeBallon: return (L"Balloon"); - case shapetypeRightUpArrow: return (L"rightUpArrow"); - case shapetypeTextArchDownPour: return (L"textArchDownPour"); - case shapetypeTextArchUpPour: return (L"textArchUpPour"); - case shapetypeTextCanDown: return (L"textCanDown"); - case shapetypeTextCanUp: return (L"textCanUp"); - case shapetypeTextCirclePour: return (L"textCirclePour"); - case shapetypeTextCurveDown: return (L"textCurveDown"); - case shapetypeTextCurveUp: return (L"textCurveUp"); - case shapetypeTextDeflate: return (L"textDeflate"); - case shapetypeTextDeflateBottom: return (L"textDeflateBottom"); - case shapetypeTextDeflateInflate: return (L"textDeflateInflate"); - case shapetypeTextDeflateInflateDeflat: return (L"textDeflateInflateDeflate"); - case shapetypeTextDeflateTop: return (L"textDeflateTop"); - case shapetypeTextDoubleWave1: return (L"textDoubleWave1"); - case shapetypeTextFadeDown: return (L"textFadeDown"); - case shapetypeTextFadeLeft: return (L"textFadeLeft"); - case shapetypeTextFadeRight: return (L"textFadeRight"); - case shapetypeTextFadeUp: return (L"textFadeUp"); - case shapetypeTextInflateBottom: return (L"textInflateBottom"); - case shapetypeTextInflateTop: return (L"textInflateTop"); - case shapetypeTextRingInside: return (L"textRingInside"); - case shapetypeTextRingOutside: return (L"textRingOutside"); - case shapetypeTextWave1: return (L"textWave1"); - case shapetypeTextWave2: return (L"textWave2"); - case shapetypeTextWave4: return (L"textWave4"); - case shapetypeThickArrow: return (L"thickArrow"); - - default : return (L"rect"); - } - } - - SimpleType_FromString (EShapeType) - SimpleType_Operator_Equal (CShapeType) - - EShapeType GetValue() const - { - return this->m_eValue; - } - }; - + DEFINE_SIMPLE_TYPE(CShapeType, EShapeType, shapetypeRect) //-------------------------------------------------------------------------------- - // SystemColorVal 20.1.10.58 (Part 1) (included from ASCWinAPI.h) - //-------------------------------------------------------------------------------- - - + // SystemColorVal 20.1.10.58 (Part 1) (included from ASCWinAPI.h) + //-------------------------------------------------------------------------------- enum ESystemColorVal { - systemcolorval3dDkShadow = 0, // (3D Dark System Color) - systemcolorval3dLight, // (3D Light System Color) - systemcolorvalActiveBorder, // (Active Border System Color) - systemcolorvalActiveCaption, // (Active Caption System Color) - systemcolorvalAppWorkspace, // (Application Workspace System Color) - systemcolorvalBackground, // (Background System Color) - systemcolorvalBtnFace, // (Button Face System Color) - systemcolorvalBtnHighlight, // (Button Highlight System Color) - systemcolorvalBtnShadow, // (Button Shadow System Color) - systemcolorvalBtnText, // (Button Text System Color) - systemcolorvalCaptionText, // (Caption Text System Color) - systemcolorvalGradientActiveCaption, // (Gradient Active Caption System Color) - systemcolorvalGradientInactiveCaption, // (Gradient Inactive Caption System Color) - systemcolorvalGrayText, // (Gray Text System Color) - systemcolorvalHighlight, // (Highlight System Color) - systemcolorvalHighlightText, // (Highlight Text System Color) - systemcolorvalHotLight, // (Hot Light System Color) - systemcolorvalInactiveBorder, // (Inactive Border System Color) - systemcolorvalInactiveCaption, // (Inactive Caption System Color) - systemcolorvalInactiveCaptionText, // (Inactive Caption Text System Color) - systemcolorvalInfoBk, // (Info Back System Color) - systemcolorvalInfoText, // (Info Text System Color) - systemcolorvalMenu, // (Menu System Color) - systemcolorvalMenuBar, // (Menu Bar System Color) - systemcolorvalMenuHighlight, // (Menu Highlight System Color) - systemcolorvalMenuText, // (Menu Text System Color) - systemcolorvalScrollBar, // (Scroll Bar System Color) - systemcolorvalWindow, // (Window System Color) - systemcolorvalWindowFrame, // (Window Frame System Color) - systemcolorvalWindowText, // (Window Text System Color) + systemcolorval3dDkShadow = 0, // (3D Dark System Color) + systemcolorval3dLight, // (3D Light System Color) + systemcolorvalActiveBorder, // (Active Border System Color) + systemcolorvalActiveCaption, // (Active Caption System Color) + systemcolorvalAppWorkspace, // (Application Workspace System Color) + systemcolorvalBackground, // (Background System Color) + systemcolorvalBtnFace, // (Button Face System Color) + systemcolorvalBtnHighlight, // (Button Highlight System Color) + systemcolorvalBtnShadow, // (Button Shadow System Color) + systemcolorvalBtnText, // (Button Text System Color) + systemcolorvalCaptionText, // (Caption Text System Color) + systemcolorvalGradientActiveCaption, // (Gradient Active Caption System Color) + systemcolorvalGradientInactiveCaption, // (Gradient Inactive Caption System Color) + systemcolorvalGrayText, // (Gray Text System Color) + systemcolorvalHighlight, // (Highlight System Color) + systemcolorvalHighlightText, // (Highlight Text System Color) + systemcolorvalHotLight, // (Hot Light System Color) + systemcolorvalInactiveBorder, // (Inactive Border System Color) + systemcolorvalInactiveCaption, // (Inactive Caption System Color) + systemcolorvalInactiveCaptionText, // (Inactive Caption Text System Color) + systemcolorvalInfoBk, // (Info Back System Color) + systemcolorvalInfoText, // (Info Text System Color) + systemcolorvalMenu, // (Menu System Color) + systemcolorvalMenuBar, // (Menu Bar System Color) + systemcolorvalMenuHighlight, // (Menu Highlight System Color) + systemcolorvalMenuText, // (Menu Text System Color) + systemcolorvalScrollBar, // (Scroll Bar System Color) + systemcolorvalWindow, // (Window System Color) + systemcolorvalWindowFrame, // (Window Frame System Color) + systemcolorvalWindowText, // (Window Text System Color) }; - template - class CSystemColorVal : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CSystemColorVal, ESystemColorVal, systemcolorvalWindow) public: - CSystemColorVal() {} + unsigned char Get_R() const; + unsigned char Get_G() const; + unsigned char Get_B() const; + unsigned char Get_A() const; - virtual ESystemColorVal FromString(std::wstring &sValue) - { - this->m_eValue = systemcolorvalWindow; - SetRGBA( 0, 0, 0, 255 ); - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case '3': - if ( (L"3dDkShadow") == sValue ) { this->m_eValue = systemcolorval3dDkShadow; SetRGBASys( COLOR_3DDKSHADOW ); } - else if ( (L"3dLight") == sValue ) { this->m_eValue = systemcolorval3dLight; SetRGBASys( COLOR_3DLIGHT ); } - break; - case 'a': - if ( (L"activeBorder") == sValue ) { this->m_eValue = systemcolorvalActiveBorder; SetRGBASys( COLOR_ACTIVEBORDER ); } - else if ( (L"activeCaption") == sValue ) { this->m_eValue = systemcolorvalActiveCaption; SetRGBASys( COLOR_ACTIVECAPTION ); } - else if ( (L"appWorkspace") == sValue ) { this->m_eValue = systemcolorvalAppWorkspace; SetRGBASys( COLOR_APPWORKSPACE ); } - break; - case 'b': - if ( (L"background") == sValue ) { this->m_eValue = systemcolorvalBackground; SetRGBASys( COLOR_BACKGROUND ); } - else if ( (L"btnFace") == sValue ) { this->m_eValue = systemcolorvalBtnFace ; SetRGBASys( COLOR_BTNFACE ); } - else if ( (L"btnHighlight") == sValue ) { this->m_eValue = systemcolorvalBtnHighlight ; SetRGBASys( COLOR_BTNHIGHLIGHT ); } - else if ( (L"btnShadow") == sValue ) { this->m_eValue = systemcolorvalBtnShadow ; SetRGBASys( COLOR_BTNSHADOW ); } - else if ( (L"btnText") == sValue ) { this->m_eValue = systemcolorvalBtnText ; SetRGBASys( COLOR_BTNTEXT ); } - break; - case 'c': - if ( (L"captionText") == sValue ) { this->m_eValue = systemcolorvalCaptionText ; SetRGBASys( COLOR_CAPTIONTEXT ); } - break; - case 'g': - if ( (L"gradientActiveCaption") == sValue ) { this->m_eValue = systemcolorvalGradientActiveCaption ; SetRGBASys( COLOR_GRADIENTACTIVECAPTION ); } - else if ( (L"gradientInactiveCaption") == sValue ) { this->m_eValue = systemcolorvalGradientInactiveCaption ; SetRGBASys( COLOR_GRADIENTINACTIVECAPTION ); } - else if ( (L"grayText") == sValue ) { this->m_eValue = systemcolorvalGrayText ; SetRGBASys( COLOR_GRAYTEXT ); } - break; - case 'h': - if ( (L"highlight") == sValue ) { this->m_eValue = systemcolorvalHighlight ; SetRGBASys( COLOR_HIGHLIGHT ); } - else if ( (L"highlightText") == sValue ) { this->m_eValue = systemcolorvalHighlightText ; SetRGBASys( COLOR_HIGHLIGHTTEXT ); } - else if ( (L"hotLight") == sValue ) { this->m_eValue = systemcolorvalHotLight ; SetRGBASys( COLOR_HOTLIGHT ); } - break; - case 'i': - if ( (L"inactiveBorder") == sValue ) { this->m_eValue = systemcolorvalInactiveBorder ; SetRGBASys( COLOR_INACTIVEBORDER ); } - else if ( (L"inactiveCaption") == sValue ) { this->m_eValue = systemcolorvalInactiveCaption ; SetRGBASys( COLOR_INACTIVECAPTION ); } - else if ( (L"inactiveCaptionText") == sValue ) { this->m_eValue = systemcolorvalInactiveCaptionText ; SetRGBASys( COLOR_INACTIVECAPTIONTEXT ); } - else if ( (L"infoBk") == sValue ) { this->m_eValue = systemcolorvalInfoBk ; SetRGBASys( COLOR_INFOBK ); } - else if ( (L"infoText") == sValue ) { this->m_eValue = systemcolorvalInfoText ; SetRGBASys( COLOR_INFOTEXT ); } - break; - case 'm': - if ( (L"menu") == sValue ) { this->m_eValue = systemcolorvalMenu ; SetRGBASys( COLOR_MENU ); } - else if ( (L"menuBar") == sValue ) { this->m_eValue = systemcolorvalMenuBar ; SetRGBASys( COLOR_MENUBAR ); } - else if ( (L"menuHighlight") == sValue ) { this->m_eValue = systemcolorvalMenuHighlight ; SetRGBASys( COLOR_MENUHILIGHT ); } - else if ( (L"menuText") == sValue ) { this->m_eValue = systemcolorvalMenuText ; SetRGBASys( COLOR_MENUTEXT ); } - break; - case 's': - if ( (L"scrollBar") == sValue ) { this->m_eValue = systemcolorvalScrollBar ; SetRGBASys( COLOR_SCROLLBAR ); } - break; - case 'w': - if ( (L"window") == sValue ) { this->m_eValue = systemcolorvalWindow ; SetRGBASys( COLOR_WINDOW ); } - else if ( (L"windowFrame") == sValue ) { this->m_eValue = systemcolorvalWindowFrame ; SetRGBASys( COLOR_WINDOWFRAME ); } - else if ( (L"windowText") == sValue ) { this->m_eValue = systemcolorvalWindowText ; SetRGBASys( COLOR_WINDOWTEXT ); } - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case systemcolorval3dDkShadow: return (L"3dDkShadow"); - case systemcolorval3dLight: return (L"3dLight"); - case systemcolorvalActiveBorder: return (L"activeBorder"); - case systemcolorvalActiveCaption: return (L"activeCaption"); - case systemcolorvalAppWorkspace: return (L"appWorkspace"); - case systemcolorvalBackground: return (L"background"); - case systemcolorvalBtnFace: return (L"btnFace"); - case systemcolorvalBtnHighlight: return (L"btnHighlight"); - case systemcolorvalBtnShadow: return (L"btnShadow"); - case systemcolorvalBtnText: return (L"btnText"); - case systemcolorvalCaptionText: return (L"captionText"); - case systemcolorvalGradientActiveCaption: return (L"gradientActiveCaption"); - case systemcolorvalGradientInactiveCaption: return (L"gradientInactiveCaption"); - case systemcolorvalGrayText: return (L"grayText"); - case systemcolorvalHighlight: return (L"highlight"); - case systemcolorvalHighlightText: return (L"highlightText"); - case systemcolorvalHotLight: return (L"hotLight"); - case systemcolorvalInactiveBorder: return (L"inactiveBorder"); - case systemcolorvalInactiveCaption: return (L"inactiveCaption"); - case systemcolorvalInactiveCaptionText: return (L"inactiveCaptionText"); - case systemcolorvalInfoBk: return (L"infoBk"); - case systemcolorvalInfoText: return (L"infoText"); - case systemcolorvalMenu: return (L"menu"); - case systemcolorvalMenuBar: return (L"menuBar"); - case systemcolorvalMenuHighlight: return (L"menuHighlight"); - case systemcolorvalMenuText: return (L"menuText"); - case systemcolorvalScrollBar: return (L"scrollBar"); - case systemcolorvalWindow: return (L"window"); - case systemcolorvalWindowFrame: return (L"windowFrame"); - case systemcolorvalWindowText: return (L"windowText"); - default : return (L"window"); - } - } - - SimpleType_FromString (ESystemColorVal) - SimpleType_Operator_Equal (CSystemColorVal) - unsigned char Get_R() const - { - return m_unR; - } - unsigned char Get_G() const - { - return m_unG; - } - - unsigned char Get_B() const - { - return m_unB; - } - - unsigned char Get_A() const - { - return m_unA; - } - - void SetRGBASys(int nIndex) - { - DWORD dwRGB = GetSysColor(nIndex); - - m_unB = static_cast(dwRGB & 0xFF); - m_unG = static_cast((dwRGB & 0xFF00)>>8); - m_unR = static_cast((dwRGB & 0xFF0000)>>16); - m_unA = 255; - } - - void SetRGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA = 255) - { - m_unR = unR; - m_unG = unG; - m_unB = unB; - m_unA = unA; - } + void SetRGBASys(int nIndex); + void SetRGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA = 255); private: @@ -4993,7 +1435,8 @@ namespace SimpleTypes //-------------------------------------------------------------------------------- // TextAlignmentType 20.1.10.59 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ETextAlignmentType { textalignmenttypeL = 0, @@ -5002,63 +1445,13 @@ namespace SimpleTypes textalignmenttypeJust = 3, textalignmenttypeR = 4, }; - template - class CTextAlignmentType : public CSimpleType - { - public: - CTextAlignmentType() {} - - virtual ETextAlignmentType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'l': - if ( (L"l") == sValue ) this->m_eValue = textalignmenttypeL; - break; - case 'c': - if ( (L"ctr") == sValue ) this->m_eValue = textalignmenttypeCtr; - break; - case 'd': - if ( (L"dist") == sValue ) this->m_eValue = textalignmenttypeDist; - break; - case 'j': - if ( (L"just") == sValue ) this->m_eValue = textalignmenttypeJust; - break; - case 'r': - if ( (L"r") == sValue ) this->m_eValue = textalignmenttypeR; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textalignmenttypeR : return (L"r"); - case textalignmenttypeCtr : return (L"ctr"); - case textalignmenttypeDist: return (L"dist"); - case textalignmenttypeJust: return (L"just"); - case textalignmenttypeL : return (L"l"); - default : return (L"l"); - } - } - - SimpleType_FromString (ETextAlignmentType) - SimpleType_Operator_Equal (CTextAlignmentType) - }; + DEFINE_SIMPLE_TYPE(CTextAlignmentType, ETextAlignmentType, textalignmenttypeL) //-------------------------------------------------------------------------------- // TextAnchoringType 20.1.10.60 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ETextAnchoringType { textanchoringtypeB = 0, @@ -5068,99 +1461,18 @@ namespace SimpleTypes textanchoringtypeT = 4, }; - template - class CTextAnchoringType : public CSimpleType - { - public: - CTextAnchoringType() {} - - virtual ETextAnchoringType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( (L"b") == sValue ) this->m_eValue = textanchoringtypeB; - break; - case 'c': - if ( (L"ctr") == sValue ) this->m_eValue = textanchoringtypeCtr; - break; - case 'd': - if ( (L"dist") == sValue ) this->m_eValue = textanchoringtypeDist; - break; - case 'j': - if ( (L"just") == sValue ) this->m_eValue = textanchoringtypeJust; - break; - case 't': - if ( (L"t") == sValue ) this->m_eValue = textanchoringtypeT; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textanchoringtypeB : return (L"b"); - case textanchoringtypeCtr : return (L"ctr"); - case textanchoringtypeDist: return (L"dist"); - case textanchoringtypeJust: return (L"just"); - case textanchoringtypeT : return (L"t"); - default : return (L"t"); - } - } - - SimpleType_FromString (ETextAnchoringType) - SimpleType_Operator_Equal (CTextAnchoringType) - }; - + DEFINE_SIMPLE_TYPE(CTextAnchoringType, ETextAnchoringType, textanchoringtypeT) //-------------------------------------------------------------------------------- - // TextColumnCount 20.1.10.65 (Part 1) - //-------------------------------------------------------------------------------- - template - class CTextColumnCount : public CSimpleType - { - public: - CTextColumnCount() {} + // TextColumnCount 20.1.10.65 (Part 1) + //-------------------------------------------------------------------------------- - virtual void SetValue (unsigned char unValue) - { - this->m_eValue = (std::min)( 16, (std::max)( 1, (int) unValue ) ); - } - virtual unsigned char FromString(std::wstring &sValue) - { - this->m_eValue = (unsigned char)_wtoi( sValue.c_str() ); - - if (this->m_eValue < 1) - this->m_eValue = 1; - if (this->m_eValue > 16) - this->m_eValue = 16; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring(this->m_eValue); - - return sResult; - } - - SimpleType_FromString (unsigned char) - SimpleType_Operator_Equal (CTextColumnCount) - }; + DEFINE_SIMPLE_TYPE_NSV(CTextColumnCount, unsigned char, 1) //-------------------------------------------------------------------------------- - // 20.1.10.66 TextFontAlignType (Font Alignment Types) - //-------------------------------------------------------------------------------- + // 20.1.10.66 TextFontAlignType (Font Alignment Types) + //-------------------------------------------------------------------------------- + enum ETextFontAlignType { textfontaligntypeAuto = 0, @@ -5169,300 +1481,116 @@ namespace SimpleTypes textfontaligntypeT = 3, textfontaligntypeB = 4, }; - template - class CTextFontAlignType : public CSimpleType - { - public: - CTextFontAlignType() {} - - virtual ETextFontAlignType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( (L"a") == sValue ) this->m_eValue = textfontaligntypeAuto; - break; - case 'c': - if ( (L"ctr") == sValue ) this->m_eValue = textfontaligntypeCtr; - break; - case 'b': - if ( (L"base") == sValue ) this->m_eValue = textfontaligntypeBase; - if ( (L"b") == sValue ) this->m_eValue = textfontaligntypeB; - break; - case 't': - if ( (L"just") == sValue ) this->m_eValue = textfontaligntypeT; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textfontaligntypeB : return (L"b"); - case textfontaligntypeCtr : return (L"ctr"); - case textfontaligntypeT : return (L"t"); - case textfontaligntypeBase: return (L"base"); - case textfontaligntypeAuto: return (L"auto"); - default : return (L"auto"); - } - } - - SimpleType_FromString (ETextFontAlignType) - SimpleType_Operator_Equal (CTextFontAlignType) - }; + DEFINE_SIMPLE_TYPE(CTextFontAlignType, ETextFontAlignType, textfontaligntypeAuto) //-------------------------------------------------------------------------------- - // TextFontScalePercentOrPercentString 20.1.10.67 (Part 1) + 12.1.2.5 (Part4) + // TextFontScalePercentOrPercentString 20.1.10.67 (Part 1) + 12.1.2.5 (Part4) //-------------------------------------------------------------------------------- - class CTextFontScalePercentOrPercentString - { - public: - CTextFontScalePercentOrPercentString() - { - m_dValue = 0; - } - double GetValue() const - { - return m_dValue; - } + class CTextFontScalePercentOrPercentString + { + public: + CTextFontScalePercentOrPercentString(); - void SetValue(double dValue) - { - m_dValue = dValue; - } + double GetValue() const; + void SetValue(double dValue); - virtual double FromString(std::wstring &sValue) - { - int nPos = (int)sValue.find( '%' ); - int nLen = (int)sValue.length(); - if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) - { - if ( -1 == nPos && nLen > 0) - { - // Поправка 12.1.2.5 (Part4) - int nValue = (std::min)( 100000, (std::max)( 1000, _wtoi( sValue.c_str() ) ) ); - m_dValue = nValue / 1000.0; - } - return - m_dValue = 0; - } - else - m_dValue = XmlUtils::GetDouble( sValue.substr( 0, nLen - 1) ); + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - return m_dValue; - } + SimpleTypes_DefaultD(CTextFontScalePercentOrPercentString) - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dValue) + L"%"; - } + private: - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CTextFontScalePercentOrPercentString) + double m_dValue; + }; - private: - - double m_dValue; - }; //-------------------------------------------------------------------------------- // TextHorzOverflowType 20.1.10.69 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ETextHorzOverflowType { texthorzoverflowtypeClip = 0, texthorzoverflowtypeOverflow = 1, }; - template - class CTextHorzOverflowType : public CSimpleType - { + DEFINE_SIMPLE_TYPE(CTextHorzOverflowType, ETextHorzOverflowType, texthorzoverflowtypeOverflow) + + //-------------------------------------------------------------------------------- + // 20.1.10.70 ST_TextIndent (Text Indentation) + //-------------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE_START(CTextIndent, _INT64, 0) public: - CTextHorzOverflowType() {} - - virtual ETextHorzOverflowType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( (L"clip") == sValue ) this->m_eValue = texthorzoverflowtypeClip; - break; - case 'o': - if ( (L"overflow") == sValue ) this->m_eValue = texthorzoverflowtypeOverflow; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case texthorzoverflowtypeClip : return (L"clip"); - case texthorzoverflowtypeOverflow : return (L"overflow"); - default : return (L"overflow"); - } - } - - SimpleType_FromString (ETextHorzOverflowType) - SimpleType_Operator_Equal (CTextHorzOverflowType) + double ToPoints(); + double ToInches(); + double ToCm(); }; - //-------------------------------------------------------------------------------- - // 20.1.10.70 ST_TextIndent (Text Indentation) + // 20.1.10.72 ST_TextMargin (Text Margin) //-------------------------------------------------------------------------------- - template<__int64 nDefValue = 0> - class CTextIndent : public CSimpleType<__int64, nDefValue> - { - public: - CTextIndent() {} - virtual __int64 FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi64( sValue.c_str() ); - if (this->m_eValue < -51206400) - this->m_eValue = -51206400; - if (this->m_eValue > 51206400) - this->m_eValue = 51206400; + DEFINE_SIMPLE_TYPE_START(CTextMargin, _INT64, 0) + public: + double ToPoints(); + double ToInches(); + double ToCm(); + }; - return this->m_eValue; - } + // //-------------------------------------------------------------------------------- + // // 20.1.10.74 ST_TextPoint (Text Point) + // //-------------------------------------------------------------------------------- + // template<__int64 nDefValue = 0> + // class CTextPoint : public CSimpleType<__int64, nDefValue> + // { + // public: + // The ST_TextPointUnqualified simple type (§20.1.10.75). + // The ST_UniversalMeasure simple type (§22.9.2.15). + // CTextPoint(); + // + // virtual __int64 FromString(const std::wstring &sValue) + // { + // this->m_eValue = XmlUtils::GetInteger64( sValue ); + // if (this->m_eValue < 0) + // this->m_eValue = 0; + // if (this->m_eValue > 51206400) + // this->m_eValue = 51206400; + // + // return this->m_eValue; + // } + // + // virtual std::wstring ToString () const + // { + // std::wstring sResult = std::to_wstring( this->m_eValue); + // + // return sResult; + // } + // + // SimpleType_FromString (__int64) + // SimpleTypes_Default (TextPoint) + // + // double ToPoints() + // { + // return Emu_To_Pt(this->m_eValue); + // } + // + // double ToInches() + // { + // return Emu_To_Inch( this->m_eValue ); + // } + // double ToCm() + // { + // return Emu_To_Cm( this->m_eValue ); + // } + // }; - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (__int64) - SimpleType_Operator_Equal (CTextIndent) - - double ToPoints() - { - return Emu_To_Pt(this->m_eValue); - } - - double ToInches() - { - return Emu_To_Inch( this->m_eValue ); - } - double ToCm() - { - return Emu_To_Cm( this->m_eValue ); - } - }; - //-------------------------------------------------------------------------------- - // 20.1.10.72 ST_TextMargin (Text Margin) - //-------------------------------------------------------------------------------- - template<__int64 nDefValue = 0> - class CTextMargin : public CSimpleType<__int64, nDefValue> - { - public: - CTextMargin() {} - - virtual __int64 FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi64( sValue.c_str() ); - if (this->m_eValue < 0) - this->m_eValue = 0; - if (this->m_eValue > 51206400) - this->m_eValue = 51206400; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (__int64) - SimpleType_Operator_Equal (CTextMargin) - - double ToPoints() - { - return Emu_To_Pt(this->m_eValue); - } - - double ToInches() - { - return Emu_To_Inch( this->m_eValue ); - } - double ToCm() - { - return Emu_To_Cm( this->m_eValue ); - } - }; -// //-------------------------------------------------------------------------------- -// // 20.1.10.74 ST_TextPoint (Text Point) -// //-------------------------------------------------------------------------------- -// template<__int64 nDefValue = 0> -// class CTextPoint : public CSimpleType<__int64, nDefValue> -// { -// public: -///* The ST_TextPointUnqualified simple type (§20.1.10.75). -// The ST_UniversalMeasure simple type (§22.9.2.15). */ -// CTextPoint() {} -// -// virtual __int64 FromString(std::wstring &sValue) -// { -// this->m_eValue = _wtoi64( sValue ); -// if (this->m_eValue < 0) -// this->m_eValue = 0; -// if (this->m_eValue > 51206400) -// this->m_eValue = 51206400; -// -// return this->m_eValue; -// } -// -// virtual std::wstring ToString () const -// { -// std::wstring sResult = std::to_wstring( this->m_eValue); -// -// return sResult; -// } -// -// SimpleType_FromString (__int64) -// SimpleType_Operator_Equal (TextPoint) -// -// double ToPoints() -// { -// return Emu_To_Pt(this->m_eValue); -// } -// -// double ToInches() -// { -// return Emu_To_Inch( this->m_eValue ); -// } -// double ToCm() -// { -// return Emu_To_Cm( this->m_eValue ); -// } -// }; //-------------------------------------------------------------------------------- // TextShapeType 20.1.10.76 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ETextShapeType { textshapetypeTextArchDown = 0, @@ -5508,305 +1636,65 @@ namespace SimpleTypes textshapetypeTextWave4, }; - template - class CTextShapeType : public CSimpleType + DEFINE_SIMPLE_TYPE(CTextShapeType, ETextShapeType, textshapetypeTextPlain) + + //-------------------------------------------------------------------------------- + // TextSpacingPercentOrPercentString 20.1.10.77 (Part 1) + 12.1.2.7 (Part4) + //-------------------------------------------------------------------------------- + + class CTextSpacingPercentOrPercentString { public: - CTextShapeType() {} + CTextSpacingPercentOrPercentString(); - virtual ETextShapeType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; + double GetValue() const; + void SetValue(double dValue); - if ( sValue.length() <= 5 ) - return this->m_eValue; + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - wchar_t wChar = sValue[4]; - switch ( wChar ) - { - case 'A': + SimpleTypes_DefaultD(CTextSpacingPercentOrPercentString) - if ( (L"textArchDown") == sValue ) this->m_eValue = textshapetypeTextArchDown; - else if ( (L"textArchDownPour") == sValue ) this->m_eValue = textshapetypeTextArchDownPour; - else if ( (L"textArchUp") == sValue ) this->m_eValue = textshapetypeTextArchUp; - else if ( (L"textArchUpPour") == sValue ) this->m_eValue = textshapetypeTextArchUpPour; - break; - - case 'B': - - if ( (L"textButton") == sValue ) this->m_eValue = textshapetypeTextButton; - else if ( (L"textButtonPour") == sValue ) this->m_eValue = textshapetypeTextButtonPour; - break; - - case 'C': - - if ( (L"textCanDown") == sValue ) this->m_eValue = textshapetypeTextCanDown; - else if ( (L"textCanUp") == sValue ) this->m_eValue = textshapetypeTextCanUp; - else if ( (L"textCascadeDown") == sValue ) this->m_eValue = textshapetypeTextCascadeDown; - else if ( (L"textCascadeUp") == sValue ) this->m_eValue = textshapetypeTextCascadeUp; - else if ( (L"textChevron") == sValue ) this->m_eValue = textshapetypeTextChevron; - else if ( (L"textChevronInverted") == sValue ) this->m_eValue = textshapetypeTextChevronInverted; - else if ( (L"textCircle") == sValue ) this->m_eValue = textshapetypeTextCircle; - else if ( (L"textCirclePour") == sValue ) this->m_eValue = textshapetypeTextCirclePour; - else if ( (L"textCurveDown") == sValue ) this->m_eValue = textshapetypeTextCurveDown; - else if ( (L"textCurveUp") == sValue ) this->m_eValue = textshapetypeTextCurveUp; - break; - - case 'D': - if ( (L"textDeflate") == sValue ) this->m_eValue = textshapetypeTextDeflate; - else if ( (L"textDeflateBottom") == sValue ) this->m_eValue = textshapetypeTextDeflateBottom; - else if ( (L"textDeflateInflate") == sValue ) this->m_eValue = textshapetypeTextDeflateInflate; - else if ( (L"textDeflateInflateDeflate") == sValue ) this->m_eValue = textshapetypeTextDeflateInflateDeflate; - else if ( (L"textDeflateTop") == sValue ) this->m_eValue = textshapetypeTextDeflateTop; - else if ( (L"textDoubleWave1") == sValue ) this->m_eValue = textshapetypeTextDoubleWave1; - break; - - case 'F': - if ( (L"textFadeDown") == sValue ) this->m_eValue = textshapetypeTextFadeDown; - else if ( (L"textFadeLeft") == sValue ) this->m_eValue = textshapetypeTextFadeLeft; - else if ( (L"textFadeRight") == sValue ) this->m_eValue = textshapetypeTextFadeRight; - else if ( (L"textFadeUp") == sValue ) this->m_eValue = textshapetypeTextFadeUp; - break; - - case 'I': - - if ( (L"textInflate") == sValue ) this->m_eValue = textshapetypeTextInflate; - else if ( (L"textInflateBottom") == sValue ) this->m_eValue = textshapetypeTextInflateBottom; - else if ( (L"textInflateTop") == sValue ) this->m_eValue = textshapetypeTextInflateTop; - break; - - case 'N': - if ( (L"textNoShape") == sValue ) this->m_eValue = textshapetypeTextNoShape; - break; - - case 'P': - - if ( (L"textPlain") == sValue ) this->m_eValue = textshapetypeTextPlain; - break; - - case 'R': - - if ( (L"textRingInside") == sValue ) this->m_eValue = textshapetypeTextRingInside; - else if ( (L"textRingOutside") == sValue ) this->m_eValue = textshapetypeTextRingOutside; - break; - - case 'S': - - if ( (L"textSlantDown") == sValue ) this->m_eValue = textshapetypeTextSlantDown; - else if ( (L"textSlantUp") == sValue ) this->m_eValue = textshapetypeTextSlantUp; - else if ( (L"textStop") == sValue ) this->m_eValue = textshapetypeTextStop; - break; - - case 'T': - - if ( (L"textTriangle") == sValue ) this->m_eValue = textshapetypeTextTriangle; - else if ( (L"textTriangleInverted")== sValue ) this->m_eValue = textshapetypeTextTriangleInverted; - break; - - case 'W': - - if ( (L"textWave1") == sValue ) this->m_eValue = textshapetypeTextWave1; - else if ( (L"textWave2") == sValue ) this->m_eValue = textshapetypeTextWave2; - else if ( (L"textWave4") == sValue ) this->m_eValue = textshapetypeTextWave4; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textshapetypeTextArchDown: return (L"textArchDown"); - case textshapetypeTextArchDownPour: return (L"textArchDownPour"); - case textshapetypeTextArchUp: return (L"textArchUp"); - case textshapetypeTextArchUpPour: return (L"textArchUpPour"); - case textshapetypeTextButton: return (L"textButton"); - case textshapetypeTextButtonPour: return (L"textButtonPour"); - case textshapetypeTextCanDown: return (L"textCanDown"); - case textshapetypeTextCanUp: return (L"textCanUp"); - case textshapetypeTextCascadeDown: return (L"textCascadeDown"); - case textshapetypeTextCascadeUp: return (L"textCascadeUp"); - case textshapetypeTextChevron: return (L"textChevron"); - case textshapetypeTextChevronInverted: return (L"textChevronInverted"); - case textshapetypeTextCircle: return (L"textCircle"); - case textshapetypeTextCirclePour: return (L"textCirclePour"); - case textshapetypeTextCurveDown: return (L"textCurveDown"); - case textshapetypeTextCurveUp: return (L"textCurveUp"); - case textshapetypeTextDeflate: return (L"textDeflate"); - case textshapetypeTextDeflateBottom: return (L"textDeflateBottom"); - case textshapetypeTextDeflateInflate: return (L"textDeflateInflate"); - case textshapetypeTextDeflateInflateDeflate:return (L"textDeflateInflateDeflate"); - case textshapetypeTextDeflateTop: return (L"textDeflateTop"); - case textshapetypeTextDoubleWave1: return (L"textDoubleWave1"); - case textshapetypeTextFadeDown: return (L"textFadeDown"); - case textshapetypeTextFadeLeft: return (L"textFadeLeft"); - case textshapetypeTextFadeRight: return (L"textFadeRight"); - case textshapetypeTextFadeUp: return (L"textFadeUp"); - case textshapetypeTextInflate: return (L"textInflate"); - case textshapetypeTextInflateBottom: return (L"textInflateBottom"); - case textshapetypeTextInflateTop: return (L"textInflateTop"); - case textshapetypeTextNoShape: return (L"textNoShape"); - case textshapetypeTextPlain: return (L"textPlain"); - case textshapetypeTextRingInside: return (L"textRingInside"); - case textshapetypeTextRingOutside: return (L"textRingOutside"); - case textshapetypeTextSlantDown: return (L"textSlantDown"); - case textshapetypeTextSlantUp: return (L"textSlantUp"); - case textshapetypeTextStop: return (L"textStop"); - case textshapetypeTextTriangle: return (L"textTriangle"); - case textshapetypeTextTriangleInverted: return (L"textTriangleInverted"); - case textshapetypeTextWave1: return (L"textWave1"); - case textshapetypeTextWave2: return (L"textWave2"); - case textshapetypeTextWave4: return (L"textWave4"); - default : return (L"textPlain"); - } - } - - SimpleType_FromString (ETextShapeType) - SimpleType_Operator_Equal (CTextShapeType) + private: + double m_dValue; }; - //-------------------------------------------------------------------------------- - // TextSpacingPercentOrPercentString 20.1.10.77 (Part 1) + 12.1.2.7 (Part4) + // 20.1.10.78 ST_TextSpacingPoint (Text Spacing Point) //-------------------------------------------------------------------------------- - class CTextSpacingPercentOrPercentString - { - public: - CTextSpacingPercentOrPercentString() - { - m_dValue = 0; - } - double GetValue() const - { - return m_dValue; - } + DEFINE_SIMPLE_TYPE_START(CTextSpacingPoint, _INT64, 0) + public: + double ToPoints(); + double ToInches(); + double ToCm(); + }; - void SetValue(double dValue) - { - m_dValue = dValue; - } - - virtual double FromString(std::wstring &sValue) - { - int nPos = (int)sValue.find( '%' ); - int nLen = (int)sValue.length(); - if ( -1 == nPos || nPos != (int)sValue.length() - 1 || nLen <= 0 ) - { - if ( -1 == nPos && nLen > 0) - { - // Поправка 12.1.2.7 (Part4) - int nValue = (std::min)( 13200000, (std::max)( 0, _wtoi( sValue.c_str() ) ) ); - m_dValue = nValue / 1000.0; - } - return m_dValue; - } - else - m_dValue = XmlUtils::GetDouble( sValue.substr( 0, nLen - 1 )); - - return m_dValue; - } - - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dValue) + L"%"; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CTextSpacingPercentOrPercentString) - - private: - - double m_dValue; - }; - //-------------------------------------------------------------------------------- - // 20.1.10.78 ST_TextSpacingPoint (Text Spacing Point) - //-------------------------------------------------------------------------------- - template<__int64 nDefValue = 0> - class CTextSpacingPoint : public CSimpleType<__int64, nDefValue> - { - public: - CTextSpacingPoint() {} - - virtual __int64 FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi64( sValue.c_str() ); - if (this->m_eValue < 0) - this->m_eValue = 0; - if (this->m_eValue > 158400) - this->m_eValue = 158400; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (__int64) - SimpleType_Operator_Equal (CTextSpacingPoint) - - double ToPoints() - { - return this->m_eValue; - } - - double ToInches() - { - return Pt_To_Inch( this->m_eValue ); - } - double ToCm() - { - return Pt_To_Cm( this->m_eValue ); - } - }; //-------------------------------------------------------------------------------- // TextTypeface 20.1.10.81 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CTextTypeface { public: - CTextTypeface() {} + CTextTypeface(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - void SetValue(std::wstring &sValue) - { - m_sValue = sValue; - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + SimpleTypes_DefaultS(CTextTypeface) - std::wstring FromString(std::wstring &sValue) - { - m_sValue = sValue; - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CTextTypeface) - - private: - - std::wstring m_sValue; + private: + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // TextVerticalType 20.1.10.83 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ETextVerticalType { textverticaltypeEaVert = 0, @@ -5818,67 +1706,12 @@ namespace SimpleTypes textverticaltypeWordArtVertRtl = 6, }; - template - class CTextVerticalType : public CSimpleType - { - public: - CTextVerticalType() {} - - virtual ETextVerticalType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'e': - if ( (L"eaVert") == sValue ) this->m_eValue = textverticaltypeEaVert; - break; - case 'h': - if ( (L"horz") == sValue ) this->m_eValue = textverticaltypeHorz; - break; - case 'm': - if ( (L"mongolianVert") == sValue ) this->m_eValue = textverticaltypeMongolianVert; - break; - case 'v': - if ( (L"vert") == sValue ) this->m_eValue = textverticaltypeVert; - else if ( (L"vert270") == sValue ) this->m_eValue = textverticaltypeVert270; - break; - case 'w': - if ( (L"wordArtVert") == sValue ) this->m_eValue = textverticaltypeWordArtVert; - else if ( (L"wordArtVertRtl") == sValue ) this->m_eValue = textverticaltypeWordArtVertRtl; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textverticaltypeEaVert : return (L"eaVert"); - case textverticaltypeHorz : return (L"horz"); - case textverticaltypeMongolianVert : return (L"mongolianVert"); - case textverticaltypeVert : return (L"vert"); - case textverticaltypeVert270 : return (L"vert270"); - case textverticaltypeWordArtVert : return (L"wordArtVert"); - case textverticaltypeWordArtVertRtl : return (L"wordArtVertRtl"); - default : return (L"horz"); - } - } - - SimpleType_FromString (ETextVerticalType) - SimpleType_Operator_Equal (CTextVerticalType) - }; - + DEFINE_SIMPLE_TYPE(CTextVerticalType, ETextVerticalType, textverticaltypeHorz) //-------------------------------------------------------------------------------- // TextVertOverflowType 20.1.10.84 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ETextVertOverflowType { textvertoverflowtypeClip = 0, @@ -5886,106 +1719,24 @@ namespace SimpleTypes textvertoverflowtypeOverflow = 2, }; - template - class CTextVertOverflowType : public CSimpleType - { - public: - CTextVertOverflowType() {} - - virtual ETextVertOverflowType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( (L"clip") == sValue ) this->m_eValue = textvertoverflowtypeClip; - break; - case 'e': - if ( (L"ellipsis") == sValue ) this->m_eValue = textvertoverflowtypeEllipsis; - break; - case 'o': - if ( (L"overflow") == sValue ) this->m_eValue = textvertoverflowtypeOverflow; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textvertoverflowtypeClip : return (L"clip"); - case textvertoverflowtypeEllipsis : return (L"ellipsis"); - case textvertoverflowtypeOverflow : return (L"overflow"); - default : return (L"overflow"); - } - } - - SimpleType_FromString (ETextVertOverflowType) - SimpleType_Operator_Equal (CTextVertOverflowType) - }; - + DEFINE_SIMPLE_TYPE(CTextVertOverflowType, ETextVertOverflowType, textvertoverflowtypeOverflow) //-------------------------------------------------------------------------------- // TextWrappingType 20.1.10.85 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ETextWrappingType { textwrappingtypeNone = 0, textwrappingtypeSquare = 1, }; - template - class CTextWrappingType : public CSimpleType - { - public: - CTextWrappingType() {} - - virtual ETextWrappingType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'n': - if ( (L"none") == sValue ) this->m_eValue = textwrappingtypeNone; - break; - case 's': - if ( (L"square") == sValue ) this->m_eValue = textwrappingtypeSquare; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textwrappingtypeNone : return (L"none"); - case textwrappingtypeSquare : return (L"square"); - default : return (L"none"); - } - } - - SimpleType_FromString (ETextWrappingType) - SimpleType_Operator_Equal (CTextWrappingType) - }; - + DEFINE_SIMPLE_TYPE(CTextWrappingType, ETextWrappingType, textwrappingtypeNone) //-------------------------------------------------------------------------------- // TileFlipMode 20.1.10.86 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ETileFlipMode { tileflipmodeNone = 0, @@ -5994,39 +1745,7 @@ namespace SimpleTypes tileflipmodeY = 3, }; - template - class CTileFlipMode : public CSimpleType - { - public: - CTileFlipMode() {} - - virtual ETileFlipMode FromString(std::wstring &sValue) - { - if ( (L"none") == sValue ) this->m_eValue = tileflipmodeNone; - else if ( (L"x") == sValue ) this->m_eValue = tileflipmodeX; - else if ( (L"xy") == sValue ) this->m_eValue = tileflipmodeXY; - else if ( (L"y") == sValue ) this->m_eValue = tileflipmodeY; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case tileflipmodeNone: return (L"none"); - case tileflipmodeX : return (L"x"); - case tileflipmodeXY : return (L"xy"); - case tileflipmodeY : return (L"y"); - default : return (L"none"); - } - } - - SimpleType_FromString (ETileFlipMode) - SimpleType_Operator_Equal (CTileFlipMode) - }; - + DEFINE_SIMPLE_TYPE(CTileFlipMode, ETileFlipMode, tileflipmodeNone) } // SimpleTypes @@ -6046,43 +1765,7 @@ namespace SimpleTypes alignhRight = 4 }; - template - class CAlignH : public CSimpleType - { - public: - - CAlignH() {} - - virtual EAlignH FromString(std::wstring &sValue) - { - if ( (L"center") == sValue ) this->m_eValue = alignhCenter; - else if ( (L"inside") == sValue ) this->m_eValue = alignhInside; - else if ( (L"left") == sValue ) this->m_eValue = alignhLeft; - else if ( (L"outside") == sValue ) this->m_eValue = alignhOutside; - else if ( (L"right") == sValue ) this->m_eValue = alignhRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case alignhCenter : return (L"center"); - case alignhInside : return (L"inside"); - case alignhLeft : return (L"left"); - case alignhOutside : return (L"outside"); - case alignhRight : return (L"right"); - default : return (L"left"); - } - } - - SimpleType_FromString (EAlignH) - SimpleType_Operator_Equal (CAlignH) - }; - - + DEFINE_SIMPLE_TYPE(CAlignH, EAlignH, alignhLeft) //-------------------------------------------------------------------------------- // AlignV 20.4.3.2 (Part 1) @@ -6097,88 +1780,18 @@ namespace SimpleTypes alignvTop = 4 }; - template - class CAlignV : public CSimpleType - { - public: - - CAlignV() {} - - virtual EAlignV FromString(std::wstring &sValue) - { - if ( (L"bottom") == sValue ) this->m_eValue = alignvBottom; - else if ( (L"center") == sValue ) this->m_eValue = alignvCenter; - else if ( (L"inside") == sValue ) this->m_eValue = alignvInside; - else if ( (L"outside") == sValue ) this->m_eValue = alignvOutside; - else if ( (L"top") == sValue ) this->m_eValue = alignvTop; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case alignvBottom : return (L"bottom"); - case alignvCenter : return (L"center"); - case alignvInside : return (L"inside"); - case alignvOutside : return (L"outside"); - case alignvTop : return (L"top"); - default : return (L"top"); - } - } - - SimpleType_FromString (EAlignV) - SimpleType_Operator_Equal (CAlignV) - }; - - + DEFINE_SIMPLE_TYPE(CAlignV, EAlignV, alignvTop) //-------------------------------------------------------------------------------- // PositionOffset 10.4.3.3 (Part 1) //-------------------------------------------------------------------------------- - template<__int64 nDefValue = 0> - class CPositionOffset : public CSimpleType<__int64, nDefValue> - { + DEFINE_SIMPLE_TYPE_START(CPositionOffset, _INT64, 0) public: - CPositionOffset() {} - - virtual __int64 FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi64( sValue.c_str() ); - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - - SimpleType_FromString (__int64) - SimpleType_Operator_Equal (CPositionOffset) - - double ToPoints() - { - return Emu_To_Pt( this->m_eValue ); - } - double ToMM() const - { - return Emu_To_Mm( (double)this->m_eValue ); - } - double ToInches() - { - return Emu_To_Inch( this->m_eValue ); - } - double ToTwips() - { - return Emu_To_Twips((double) this->m_eValue ); - } + double ToPoints(); + double ToMM() const; + double ToInches(); + double ToTwips(); }; //-------------------------------------------------------------------------------- @@ -6197,50 +1810,7 @@ namespace SimpleTypes relfromhRightMargin = 7 }; - template - class CRelFromH : public CSimpleType - { - public: - - CRelFromH() {} - - virtual ERelFromH FromString(std::wstring &sValue) - { - if ( (L"character") == sValue ) this->m_eValue = relfromhCharacter; - else if ( (L"column") == sValue ) this->m_eValue = relfromhColumn; - else if ( (L"insideMargin") == sValue ) this->m_eValue = relfromhInsideMargin; - else if ( (L"leftMargin") == sValue ) this->m_eValue = relfromhLeftMargin; - else if ( (L"margin") == sValue ) this->m_eValue = relfromhMargin; - else if ( (L"outsideMargin") == sValue ) this->m_eValue = relfromhOutsideMargin; - else if ( (L"page") == sValue ) this->m_eValue = relfromhPage; - else if ( (L"rightMargin") == sValue ) this->m_eValue = relfromhRightMargin; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case relfromhCharacter : return (L"character"); - case relfromhColumn : return (L"column"); - case relfromhInsideMargin : return (L"insideMargin"); - case relfromhLeftMargin : return (L"leftMargin"); - case relfromhMargin : return (L"margin"); - case relfromhOutsideMargin : return (L"outsideMargin"); - case relfromhPage : return (L"page"); - case relfromhRightMargin : return (L"rightMargin"); - default : return (L"page"); - } - } - - SimpleType_FromString (ERelFromH) - SimpleType_Operator_Equal (CRelFromH) - }; - - - + DEFINE_SIMPLE_TYPE(CRelFromH, ERelFromH, relfromhPage) //-------------------------------------------------------------------------------- // RelFromV 20.4.3.5 (Part 1) @@ -6258,47 +1828,11 @@ namespace SimpleTypes relfromvTopMargin = 7 }; - template - class CRelFromV : public CSimpleType - { - public: + DEFINE_SIMPLE_TYPE(CRelFromV, ERelFromV, relfromvPage) - CRelFromV() {} - - virtual ERelFromV FromString(std::wstring &sValue) - { - if ( (L"bottomMargin") == sValue ) this->m_eValue = relfromvBottomMargin; - else if ( (L"insideMargin") == sValue ) this->m_eValue = relfromvInsideMargin; - else if ( (L"line") == sValue ) this->m_eValue = relfromvLine; - else if ( (L"margin") == sValue ) this->m_eValue = relfromvMargin; - else if ( (L"outsideMargin") == sValue ) this->m_eValue = relfromvOutsideMargin; - else if ( (L"page") == sValue ) this->m_eValue = relfromvPage; - else if ( (L"paragraph") == sValue ) this->m_eValue = relfromvParagraph; - else if ( (L"topMargin") == sValue ) this->m_eValue = relfromvTopMargin; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case relfromvBottomMargin : return (L"bottomMargin"); - case relfromvInsideMargin : return (L"insideMargin"); - case relfromvLine : return (L"line"); - case relfromvMargin : return (L"margin"); - case relfromvOutsideMargin : return (L"outsideMargin"); - case relfromvPage : return (L"page"); - case relfromvParagraph : return (L"paragraph"); - case relfromvTopMargin : return (L"topMargin"); - default : return (L"page"); - } - } - - SimpleType_FromString (ERelFromV) - SimpleType_Operator_Equal (CRelFromV) - }; + //-------------------------------------------------------------------------------- + // SizeRelFromH + //-------------------------------------------------------------------------------- enum ESizeRelFromH { @@ -6310,43 +1844,11 @@ namespace SimpleTypes sizerelfromhOutsideMargin = 5 }; - template - class CSizeRelFromH : public CSimpleType - { - public: + DEFINE_SIMPLE_TYPE(CSizeRelFromH, ESizeRelFromH, sizerelfromhPage) - CSizeRelFromH() {} - - virtual ESizeRelFromH FromString(std::wstring &sValue) - { - if ( (L"margin") == sValue ) this->m_eValue = sizerelfromhMargin; - else if ( (L"page") == sValue ) this->m_eValue = sizerelfromhPage; - else if ( (L"leftMargin") == sValue ) this->m_eValue = sizerelfromhLeftMargin; - else if ( (L"rightMargin") == sValue ) this->m_eValue = sizerelfromhRightMargin; - else if ( (L"insideMargin") == sValue ) this->m_eValue = sizerelfromhInsideMargin; - else if ( (L"outsideMargin") == sValue ) this->m_eValue = sizerelfromhOutsideMargin; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case sizerelfromhMargin : return (L"margin"); - case sizerelfromhPage : return (L"page"); - case sizerelfromhLeftMargin : return (L"leftMargin"); - case sizerelfromhRightMargin : return (L"rightMargin"); - case sizerelfromhInsideMargin : return (L"insideMargin"); - case sizerelfromhOutsideMargin : return (L"outsideMargin"); - } - return L"margin"; - } - - SimpleType_FromString (ESizeRelFromH) - SimpleType_Operator_Equal (CSizeRelFromH) - }; + //-------------------------------------------------------------------------------- + // SizeRelFromV + //-------------------------------------------------------------------------------- enum ESizeRelFromV { @@ -6358,90 +1860,20 @@ namespace SimpleTypes sizerelfromvOutsideMargin = 5 }; - template - class CSizeRelFromV : public CSimpleType - { - public: - - CSizeRelFromV() {} - - virtual ESizeRelFromV FromString(std::wstring &sValue) - { - if ( (L"margin") == sValue ) this->m_eValue = sizerelfromvMargin; - else if ( (L"page") == sValue ) this->m_eValue = sizerelfromvPage; - else if ( (L"topMargin") == sValue ) this->m_eValue = sizerelfromvTopMargin; - else if ( (L"bottomMargin") == sValue ) this->m_eValue = sizerelfromvBottomMargin; - else if ( (L"insideMargin") == sValue ) this->m_eValue = sizerelfromvInsideMargin; - else if ( (L"outsideMargin") == sValue ) this->m_eValue = sizerelfromvOutsideMargin; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case sizerelfromvMargin : return (L"margin"); - case sizerelfromvPage : return (L"page"); - case sizerelfromvTopMargin : return (L"topMargin"); - case sizerelfromvBottomMargin : return (L"bottomMargin"); - case sizerelfromvInsideMargin : return (L"insideMargin"); - case sizerelfromvOutsideMargin : return (L"outsideMargin"); - } - return L"margin"; - } - - SimpleType_FromString (ESizeRelFromV) - SimpleType_Operator_Equal (CSizeRelFromV) - }; + DEFINE_SIMPLE_TYPE(CSizeRelFromV, ESizeRelFromV, sizerelfromvPage) //-------------------------------------------------------------------------------- // WrapDistance 10.4.3.6 (Part 1) //-------------------------------------------------------------------------------- - template<__int64 nDefValue = 0> - class CWrapDistance : public CSimpleType<__int64, nDefValue> - { + DEFINE_SIMPLE_TYPE_START(CWrapDistance, _INT64, 0) public: - CWrapDistance() {} - - virtual __int64 FromString(std::wstring &sValue) - { - this->m_eValue = wcstoul( sValue.c_str(), NULL, 10 ); - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return std::to_wstring(this->m_eValue); - } - - - SimpleType_FromString (__int64) - SimpleType_Operator_Equal (CWrapDistance) - - double ToPoints() - { - return Emu_To_Pt( this->m_eValue ); - } - double ToMM() const - { - return Emu_To_Mm( (double)this->m_eValue ); - } - - double ToInches() - { - return Emu_To_Inch( this->m_eValue ); - } - double ToTwips() - { - return Emu_To_Twips( (double) this->m_eValue ); - } + double ToPoints(); + double ToMM() const; + double ToInches(); + double ToTwips(); }; - //-------------------------------------------------------------------------------- // WrapText 20.4.3.7 (Part 1) //-------------------------------------------------------------------------------- @@ -6454,39 +1886,8 @@ namespace SimpleTypes wraptextRight = 3 }; - template - class CWrapText : public CSimpleType - { - public: + DEFINE_SIMPLE_TYPE(CWrapText, EWrapText, wraptextLeft) - CWrapText() {} - - virtual EWrapText FromString(std::wstring &sValue) - { - if ( (L"bothSides") == sValue ) this->m_eValue = wraptextBothSides; - else if ( (L"largest") == sValue ) this->m_eValue = wraptextLargest; - else if ( (L"left") == sValue ) this->m_eValue = wraptextLeft; - else if ( (L"right") == sValue ) this->m_eValue = wraptextRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case wraptextBothSides : return (L"bothSides"); - case wraptextLargest : return (L"largest"); - case wraptextLeft : return (L"left"); - case wraptextRight : return (L"right"); - default : return (L"left"); - } - } - - SimpleType_FromString (EWrapText) - SimpleType_Operator_Equal (CWrapText) - }; } // SimpleTypes // Здесь представлены все простые типы Drawing-Spreadsheet из спецификации Office Open Xml (20.5.3) @@ -6504,41 +1905,22 @@ namespace SimpleTypes // Здесь представлены все простые типы Drawing-Diagrams из спецификации Office Open Xml (21.4.7) namespace SimpleTypes { + //-------------------------------------------------------------------------------- + // HueDirType + //-------------------------------------------------------------------------------- + enum EHueDirType { hueDirCCw = 0, hueDirCw = 1 }; - template - class CHueDirType : public CSimpleType - { - public: - CHueDirType() {} + DEFINE_SIMPLE_TYPE(CHueDirType, EHueDirType, hueDirCw) - virtual EHueDirType FromString(std::wstring &sValue) - { - if (L"ccw" == sValue) this->m_eValue = hueDirCCw; - else if (L"cw" == sValue) this->m_eValue = hueDirCw; - else this->m_eValue = eDefValue; + //-------------------------------------------------------------------------------- + // ColorMethod + //-------------------------------------------------------------------------------- - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case hueDirCCw: return L"ccw"; - case hueDirCw: return L"cw"; - default: return L"cw"; - } - } - - SimpleType_FromString(EHueDirType) - SimpleType_Operator_Equal(CHueDirType) - }; - //------------------------------------------------------------ enum EColorMethod { colorMethodCycle = 0, @@ -6546,71 +1928,24 @@ namespace SimpleTypes colorMethodSpan = 2 }; - template - class CColorMethod : public CSimpleType - { - public: - CColorMethod() {} + DEFINE_SIMPLE_TYPE(CColorMethod, EColorMethod, colorMethodSpan) - virtual EColorMethod FromString(std::wstring &sValue) - { - if (L"cycle" == sValue) this->m_eValue = colorMethodCycle; - else if (L"repeat" == sValue) this->m_eValue = colorMethodRepeat; - else if (L"span" == sValue) this->m_eValue = colorMethodSpan; - else this->m_eValue = eDefValue; + //-------------------------------------------------------------------------------- + // ChOrder + //-------------------------------------------------------------------------------- - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case colorMethodCycle: return (L"cycle"); - case colorMethodRepeat: return (L"repeat"); - case colorMethodSpan: - default: return (L"span"); - } - } - - SimpleType_FromString(EColorMethod) - SimpleType_Operator_Equal(CColorMethod) - }; -//------------------------------------------------------------ enum EChOrder { chOrderB = 0, chOrderT = 1 }; - template - class CChOrder : public CSimpleType - { - public: - CChOrder() {} - virtual EChOrder FromString(std::wstring &sValue) - { - if (L"b" == sValue) this->m_eValue = chOrderB; - else if (L"t" == sValue) this->m_eValue = chOrderT; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CChOrder, EChOrder, chOrderB) - return this->m_eValue; - } + //-------------------------------------------------------------------------------- + // AxisTypes + //-------------------------------------------------------------------------------- - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case chOrderB: return L"b"; - case chOrderT: return L"t"; - default: return L"b"; - } - } - - SimpleType_FromString(EChOrder) - SimpleType_Operator_Equal(CChOrder) - }; -//------------------------------------------------------------ enum EAxisTypes { axisTypes_none = 0, @@ -6627,57 +1962,13 @@ namespace SimpleTypes axisTypes_preced = 11, axisTypes_root = 12 }; - template - class CAxisTypes : public CSimpleType - { - public: - CAxisTypes() {} - virtual EAxisTypes FromString(std::wstring &sValue) - { - if (L"none" == sValue) this->m_eValue = axisTypes_none; - else if (L"self" == sValue) this->m_eValue = axisTypes_self; - else if (L"ch" == sValue) this->m_eValue = axisTypes_ch; - else if (L"des" == sValue) this->m_eValue = axisTypes_des; - else if (L"desOrSelf" == sValue) this->m_eValue = axisTypes_desOrSelf; - else if (L"par" == sValue) this->m_eValue = axisTypes_par; - else if (L"ancst" == sValue) this->m_eValue = axisTypes_ancst; - else if (L"ancstOrSelf" == sValue) this->m_eValue = axisTypes_ancstOrSelf; - else if (L"followSib" == sValue) this->m_eValue = axisTypes_followSib; - else if (L"precedSib" == sValue) this->m_eValue = axisTypes_precedSib; - else if (L"follow" == sValue) this->m_eValue = axisTypes_follow; - else if (L"preced" == sValue) this->m_eValue = axisTypes_preced; - else if (L"root" == sValue) this->m_eValue = axisTypes_root; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CAxisTypes, EAxisTypes, axisTypes_none) - return this->m_eValue; - } + //-------------------------------------------------------------------------------- + // ParameterId + //-------------------------------------------------------------------------------- - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case axisTypes_self: return L"self"; - case axisTypes_ch: return L"ch"; - case axisTypes_des: return L"des"; - case axisTypes_desOrSelf: return L"desOrSelf"; - case axisTypes_par: return L"par"; - case axisTypes_ancst: return L"ancst"; - case axisTypes_ancstOrSelf: return L"ancstOrSelf"; - case axisTypes_followSib: return L"followSib"; - case axisTypes_precedSib: return L"precedSib"; - case axisTypes_follow: return L"follow"; - case axisTypes_preced: return L"preced"; - case axisTypes_root: return L"root"; - case axisTypes_none: - default: return L"none"; - } - } - - SimpleType_FromString(EAxisTypes) - SimpleType_Operator_Equal(CAxisTypes) - }; -//------------------------------------------------------------ enum EParameterId { parameterId_horzAlign = 0, @@ -6736,178 +2027,26 @@ namespace SimpleTypes parameterId_begPts = 53, parameterId_endPts = 54 }; - template - class CParameterId : public CSimpleType - { - public: - CParameterId() {} - virtual EParameterId FromString(std::wstring &sValue) - { - if (L"horzAlign" == sValue) this->m_eValue = parameterId_horzAlign; - else if (L"vertAlign" == sValue) this->m_eValue = parameterId_vertAlign; - else if (L"chDir" == sValue) this->m_eValue = parameterId_chDir; - else if (L"chAlign" == sValue) this->m_eValue = parameterId_chAlign; - else if (L"secChAlign" == sValue) this->m_eValue = parameterId_secChAlign; - else if (L"linDir" == sValue) this->m_eValue = parameterId_linDir; - else if (L"secLinDir" == sValue) this->m_eValue = parameterId_secLinDir; - else if (L"stElem" == sValue) this->m_eValue = parameterId_stElem; - else if (L"bendPt" == sValue) this->m_eValue = parameterId_bendPt; - else if (L"connRout" == sValue) this->m_eValue = parameterId_connRout; - else if (L"begSty" == sValue) this->m_eValue = parameterId_begSty; - else if (L"endSty" == sValue) this->m_eValue = parameterId_endSty; - else if (L"dim" == sValue) this->m_eValue = parameterId_dim; - else if (L"rotPath" == sValue) this->m_eValue = parameterId_rotPath; - else if (L"ctrShpMap" == sValue) this->m_eValue = parameterId_ctrShpMap; - else if (L"nodeHorzAlign" == sValue) this->m_eValue = parameterId_nodeHorzAlign; - else if (L"nodeVertAlign" == sValue) this->m_eValue = parameterId_nodeVertAlign; - else if (L"fallback" == sValue) this->m_eValue = parameterId_fallback; - else if (L"txDir" == sValue) this->m_eValue = parameterId_txDir; - else if (L"pyraAcctPos" == sValue) this->m_eValue = parameterId_pyraAcctPos; - else if (L"pyraAcctTxMar" == sValue) this->m_eValue = parameterId_pyraAcctTxMar; - else if (L"txBlDir" == sValue) this->m_eValue = parameterId_txBlDir; - else if (L"txAnchorHorz" == sValue) this->m_eValue = parameterId_txAnchorHorz; - else if (L"txAnchorVert" == sValue) this->m_eValue = parameterId_txAnchorVert; - else if (L"txAnchorHorzCh" == sValue) this->m_eValue = parameterId_txAnchorHorzCh; - else if (L"txAnchorVertCh" == sValue) this->m_eValue = parameterId_txAnchorVertCh; - else if (L"parTxLTRAlign" == sValue) this->m_eValue = parameterId_parTxLTRAlign; - else if (L"parTxRTLAlign" == sValue) this->m_eValue = parameterId_parTxRTLAlign; - else if (L"shpTxLTRAlignCh" == sValue) this->m_eValue = parameterId_shpTxLTRAlignCh; - else if (L"shpTxRTLAlignCh" == sValue) this->m_eValue = parameterId_shpTxRTLAlignCh; - else if (L"autoTxRot" == sValue) this->m_eValue = parameterId_autoTxRot; - else if (L"grDir" == sValue) this->m_eValue = parameterId_grDir; - else if (L"flowDir" == sValue) this->m_eValue = parameterId_flowDir; - else if (L"contDir" == sValue) this->m_eValue = parameterId_contDir; - else if (L"bkpt" == sValue) this->m_eValue = parameterId_bkpt; - else if (L"off" == sValue) this->m_eValue = parameterId_off; - else if (L"hierAlign" == sValue) this->m_eValue = parameterId_hierAlign; - else if (L"bkPtFixedVal" == sValue) this->m_eValue = parameterId_bkPtFixedVal; - else if (L"stBulletLvl" == sValue) this->m_eValue = parameterId_stBulletLvl; - else if (L"stAng" == sValue) this->m_eValue = parameterId_stAng; - else if (L"spanAng" == sValue) this->m_eValue = parameterId_spanAng; - else if (L"ar" == sValue) this->m_eValue = parameterId_ar; - else if (L"lnSpPar" == sValue) this->m_eValue = parameterId_lnSpPar; - else if (L"lnSpAfParP" == sValue) this->m_eValue = parameterId_lnSpAfParP; - else if (L"lnSpCh" == sValue) this->m_eValue = parameterId_lnSpCh; - else if (L"lnSpAfChP" == sValue) this->m_eValue = parameterId_lnSpAfChP; - else if (L"rtShortDist" == sValue) this->m_eValue = parameterId_rtShortDist; - else if (L"alignTx" == sValue) this->m_eValue = parameterId_alignTx; - else if (L"pyraLvlNode" == sValue) this->m_eValue = parameterId_pyraLvlNode; - else if (L"pyraAcctBkgdNode" == sValue) this->m_eValue = parameterId_pyraAcctBkgdNode; - else if (L"pyraAcctTxNode" == sValue) this->m_eValue = parameterId_pyraAcctTxNode; - else if (L"srcNode" == sValue) this->m_eValue = parameterId_srcNode; - else if (L"dstNode" == sValue) this->m_eValue = parameterId_dstNode; - else if (L"begPts" == sValue) this->m_eValue = parameterId_begPts; - else if (L"endPts" == sValue) this->m_eValue = parameterId_endPts; + DEFINE_SIMPLE_TYPE(CParameterId, EParameterId, parameterId_horzAlign) - else this->m_eValue = eDefValue; + //-------------------------------------------------------------------------------- + // ConstraintRelationship + //-------------------------------------------------------------------------------- - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case parameterId_horzAlign: return L"horzAlign"; - case parameterId_vertAlign: return L"vertAlign"; - case parameterId_chDir: return L"chDir"; - case parameterId_chAlign: return L"chAlign"; - case parameterId_secChAlign: return L"secChAlign"; - case parameterId_linDir: return L"linDir"; - case parameterId_secLinDir: return L"secLinDir"; - case parameterId_stElem: return L"stElem"; - case parameterId_bendPt: return L"bendPt"; - case parameterId_connRout: return L"connRout"; - case parameterId_begSty: return L"begSty"; - case parameterId_endSty: return L"endSty"; - case parameterId_dim: return L"dim"; - case parameterId_rotPath: return L"rotPath"; - case parameterId_ctrShpMap: return L"ctrShpMap"; - case parameterId_nodeHorzAlign: return L"nodeHorzAlign"; - case parameterId_nodeVertAlign: return L"nodeVertAlign"; - case parameterId_fallback: return L"fallback"; - case parameterId_txDir: return L"txDir"; - case parameterId_pyraAcctPos: return L"pyraAcctPos"; - case parameterId_pyraAcctTxMar: return L"pyraAcctTxMar"; - case parameterId_txBlDir: return L"txBlDir"; - case parameterId_txAnchorHorz: return L"txAnchorHorz"; - case parameterId_txAnchorVert: return L"txAnchorVert"; - case parameterId_txAnchorHorzCh: return L"txAnchorHorzCh"; - case parameterId_txAnchorVertCh: return L"txAnchorVertCh"; - case parameterId_parTxLTRAlign: return L"parTxLTRAlign"; - case parameterId_parTxRTLAlign: return L"parTxRTLAlign"; - case parameterId_shpTxLTRAlignCh: return L"shpTxLTRAlignCh"; - case parameterId_shpTxRTLAlignCh: return L"shpTxRTLAlignCh"; - case parameterId_autoTxRot: return L"autoTxRot"; - case parameterId_grDir: return L"grDir"; - case parameterId_flowDir: return L"flowDir"; - case parameterId_contDir: return L"contDir"; - case parameterId_bkpt: return L"bkpt"; - case parameterId_off: return L"off"; - case parameterId_hierAlign: return L"hierAlign"; - case parameterId_bkPtFixedVal: return L"bkPtFixedVal"; - case parameterId_stBulletLvl: return L"stBulletLvl"; - case parameterId_stAng: return L"stAng"; - case parameterId_spanAng: return L"spanAng"; - case parameterId_ar: return L"ar"; - case parameterId_lnSpPar: return L"lnSpPar"; - case parameterId_lnSpAfParP: return L"lnSpAfParP"; - case parameterId_lnSpCh: return L"lnSpCh"; - case parameterId_lnSpAfChP: return L"lnSpAfChP"; - case parameterId_rtShortDist: return L"rtShortDist"; - case parameterId_alignTx: return L"alignTx"; - case parameterId_pyraLvlNode: return L"pyraLvlNode"; - case parameterId_pyraAcctBkgdNode: return L"pyraAcctBkgdNode"; - case parameterId_pyraAcctTxNode: return L"pyraAcctTxNode"; - case parameterId_srcNode: return L"srcNode"; - case parameterId_dstNode: return L"dstNode"; - case parameterId_begPts: return L"begPts"; - case parameterId_endPts: return L"endPts"; - default: return L"horzAlign"; - } - } - SimpleType_FromString(EParameterId) - SimpleType_Operator_Equal(CParameterId) - }; -//------------------------------------------------------------ enum EConstraintRelationship { constraintRels_self = 0, constraintRels_ch = 1, constraintRels_des = 2 }; - template - class CConstraintRelationship : public CSimpleType - { - public: - CConstraintRelationship() {} - virtual EConstraintRelationship FromString(std::wstring &sValue) - { - if (L"self" == sValue) this->m_eValue = constraintRels_self; - else if (L"ch" == sValue) this->m_eValue = constraintRels_ch; - else if (L"des" == sValue) this->m_eValue = constraintRels_des; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CConstraintRelationship, EConstraintRelationship, constraintRels_self) - return this->m_eValue; - } + //-------------------------------------------------------------------------------- + // ConstraintType + //-------------------------------------------------------------------------------- - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case constraintRels_ch: return L"ch"; - case constraintRels_des: return L"des"; - case constraintRels_self: - default: return L"self"; - } - } - - SimpleType_FromString(EConstraintRelationship) - SimpleType_Operator_Equal(CConstraintRelationship) - }; -//------------------------------------------------------------ enum EConstraintType { constraintType_none = 0, @@ -6974,156 +2113,13 @@ namespace SimpleTypes constraintType_wArH = 61, constraintType_wOff = 62 }; - template - class CConstraintType : public CSimpleType - { - public: - CConstraintType() {} - virtual EConstraintType FromString(std::wstring &sValue) - { - if (L"none" == sValue) this->m_eValue = constraintType_none; - else if (L"alignOff" == sValue) this->m_eValue = constraintType_alignOff; - else if (L"begMarg" == sValue) this->m_eValue = constraintType_begMarg; - else if (L"bendDist" == sValue) this->m_eValue = constraintType_bendDist; - else if (L"begPad" == sValue) this->m_eValue = constraintType_begPad; - else if (L"b" == sValue) this->m_eValue = constraintType_b; - else if (L"bMarg" == sValue) this->m_eValue = constraintType_bMarg; - else if (L"bOff" == sValue) this->m_eValue = constraintType_bOff; - else if (L"ctrX" == sValue) this->m_eValue = constraintType_ctrX; - else if (L"ctrXOff" == sValue) this->m_eValue = constraintType_ctrXOff; - else if (L"ctrY" == sValue) this->m_eValue = constraintType_ctrY; - else if (L"ctrYOff" == sValue) this->m_eValue = constraintType_ctrYOff; - else if (L"connDist" == sValue) this->m_eValue = constraintType_connDist; - else if (L"diam" == sValue) this->m_eValue = constraintType_diam; - else if (L"endMarg" == sValue) this->m_eValue = constraintType_endMarg; - else if (L"endPad" == sValue) this->m_eValue = constraintType_endPad; - else if (L"h" == sValue) this->m_eValue = constraintType_h; - else if (L"hArH" == sValue) this->m_eValue = constraintType_hArH; - else if (L"l" == sValue) this->m_eValue = constraintType_l; - else if (L"lMarg" == sValue) this->m_eValue = constraintType_lMarg; - else if (L"lOff" == sValue) this->m_eValue = constraintType_lOff; - else if (L"r" == sValue) this->m_eValue = constraintType_r; - else if (L"rMarg" == sValue) this->m_eValue = constraintType_rMarg; - else if (L"rOff" == sValue) this->m_eValue = constraintType_rOff; - else if (L"primFontSz" == sValue) this->m_eValue = constraintType_primFontSz; - else if (L"pyraAcctRatio" == sValue) this->m_eValue = constraintType_pyraAcctRatio; - else if (L"secFontSz" == sValue) this->m_eValue = constraintType_secFontSz; - else if (L"sibSp" == sValue) this->m_eValue = constraintType_sibSp; - else if (L"secSibSp" == sValue) this->m_eValue = constraintType_secSibSp; - else if (L"sp" == sValue) this->m_eValue = constraintType_sp; - else if (L"stemThick" == sValue) this->m_eValue = sconstraintType_temThick; - else if (L"t" == sValue) this->m_eValue = constraintType_t; - else if (L"tMarg" == sValue) this->m_eValue = constraintType_tMarg; - else if (L"tOff" == sValue) this->m_eValue = constraintType_tOff; - else if (L"userA" == sValue) this->m_eValue = constraintType_userA; - else if (L"userB" == sValue) this->m_eValue = constraintType_userB; - else if (L"userC" == sValue) this->m_eValue = constraintType_userC; - else if (L"userD" == sValue) this->m_eValue = constraintType_userD; - else if (L"userE" == sValue) this->m_eValue = constraintType_userE; - else if (L"userF" == sValue) this->m_eValue = constraintType_userF; - else if (L"userG" == sValue) this->m_eValue = constraintType_userG; - else if (L"userH" == sValue) this->m_eValue = constraintType_userH; - else if (L"userI" == sValue) this->m_eValue = constraintType_userI; - else if (L"userJ" == sValue) this->m_eValue = constraintType_userJ; - else if (L"userK" == sValue) this->m_eValue = constraintType_userK; - else if (L"userL" == sValue) this->m_eValue = constraintType_userL; - else if (L"userM" == sValue) this->m_eValue = constraintType_userM; - else if (L"userN" == sValue) this->m_eValue = constraintType_userN; - else if (L"userO" == sValue) this->m_eValue = constraintType_userO; - else if (L"userP" == sValue) this->m_eValue = constraintType_userP; - else if (L"userQ" == sValue) this->m_eValue = constraintType_userQ; - else if (L"userR" == sValue) this->m_eValue = constraintType_userR; - else if (L"userS" == sValue) this->m_eValue = constraintType_userS; - else if (L"userT" == sValue) this->m_eValue = constraintType_userT; - else if (L"userU" == sValue) this->m_eValue = constraintType_userU; - else if (L"userV" == sValue) this->m_eValue = constraintType_userV; - else if (L"userW" == sValue) this->m_eValue = constraintType_userW; - else if (L"userX" == sValue) this->m_eValue = constraintType_userX; - else if (L"userY" == sValue) this->m_eValue = constraintType_userY; - else if (L"userZ" == sValue) this->m_eValue = constraintType_userZ; - else if (L"w" == sValue) this->m_eValue = constraintType_w; - else if (L"wArH" == sValue) this->m_eValue = constraintType_wArH; - else if (L"wOff" == sValue) this->m_eValue = constraintType_wOff; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CConstraintType, EConstraintType, constraintType_none) - return this->m_eValue; - } + //-------------------------------------------------------------------------------- + // BoolOperator + //-------------------------------------------------------------------------------- - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case constraintType_none: return L"none"; - case constraintType_alignOff: return L"alignOff"; - case constraintType_begMarg: return L"begMarg"; - case constraintType_bendDist: return L"bendDist"; - case constraintType_begPad: return L"begPad"; - case constraintType_b: return L"b"; - case constraintType_bMarg: return L"bMarg"; - case constraintType_bOff: return L"bOff"; - case constraintType_ctrX: return L"ctrX"; - case constraintType_ctrXOff: return L"ctrXOff"; - case constraintType_ctrY: return L"ctrY"; - case constraintType_ctrYOff: return L"ctrYOff"; - case constraintType_connDist: return L"connDist"; - case constraintType_diam: return L"diam"; - case constraintType_endMarg: return L"endMarg"; - case constraintType_endPad: return L"endPad"; - case constraintType_h: return L"h"; - case constraintType_hArH: return L"hArH"; - case constraintType_l: return L"l"; - case constraintType_lMarg: return L"lMarg"; - case constraintType_lOff: return L"lOff"; - case constraintType_r: return L"r"; - case constraintType_rMarg: return L"rMarg"; - case constraintType_rOff: return L"rOff"; - case constraintType_primFontSz: return L"primFontSz"; - case constraintType_pyraAcctRatio: return L"pyraAcctRatio"; - case constraintType_secFontSz: return L"secFontSz"; - case constraintType_sibSp: return L"sibSp"; - case constraintType_secSibSp: return L"secSibSp"; - case constraintType_sp: return L"sp"; - case sconstraintType_temThick: return L"stemThick"; - case constraintType_t: return L"t"; - case constraintType_tMarg: return L"tMarg"; - case constraintType_tOff: return L"tOff"; - case constraintType_userA: return L"userA"; - case constraintType_userB: return L"userB"; - case constraintType_userC: return L"userC"; - case constraintType_userD: return L"userD"; - case constraintType_userE: return L"userE"; - case constraintType_userF: return L"userF"; - case constraintType_userG: return L"userG"; - case constraintType_userH: return L"userH"; - case constraintType_userI: return L"userI"; - case constraintType_userJ: return L"userJ"; - case constraintType_userK: return L"userK"; - case constraintType_userL: return L"userL"; - case constraintType_userM: return L"userM"; - case constraintType_userN: return L"userN"; - case constraintType_userO: return L"userO"; - case constraintType_userP: return L"userP"; - case constraintType_userQ: return L"userQ"; - case constraintType_userR: return L"userR"; - case constraintType_userS: return L"userS"; - case constraintType_userT: return L"userT"; - case constraintType_userU: return L"userU"; - case constraintType_userV: return L"userV"; - case constraintType_userW: return L"userW"; - case constraintType_userX: return L"userX"; - case constraintType_userY: return L"userY"; - case constraintType_userZ: return L"userZ"; - case constraintType_w: return L"w"; - case constraintType_wArH: return L"wArH"; - case constraintType_wOff: return L"wOff"; - default: return L"none"; - } - } - SimpleType_FromString(EConstraintType) - SimpleType_Operator_Equal(CConstraintType) - }; -//------------------------------------------------------------ enum EBoolOperator { boolOperator_none = 0, @@ -7131,36 +2127,13 @@ namespace SimpleTypes boolOperator_gte = 2, boolOperator_lte = 3 }; - template - class CBoolOperator : public CSimpleType - { - public: - CBoolOperator() {} - virtual EBoolOperator FromString(std::wstring &sValue) - { - if (L"none" == sValue) this->m_eValue = boolOperator_none; - else if (L"equ" == sValue) this->m_eValue = boolOperator_equ; - else if (L"gte" == sValue) this->m_eValue = boolOperator_gte; - else if (L"lte" == sValue) this->m_eValue = boolOperator_lte; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case boolOperator_equ: return L"equ"; - case boolOperator_gte: return L"gte"; - case boolOperator_lte: return L"lte"; - case boolOperator_none: - default: return L"none"; - } - } - SimpleType_FromString(EBoolOperator) - SimpleType_Operator_Equal(CBoolOperator) - }; -//--------------------------------------------------------------------------- + DEFINE_SIMPLE_TYPE(CBoolOperator, EBoolOperator, boolOperator_none) + + //-------------------------------------------------------------------------------- + // ElementTypes + //-------------------------------------------------------------------------------- + enum EElementTypes { elementTypes_all = 0, @@ -7174,47 +2147,13 @@ namespace SimpleTypes elementTypes_pres = 8, elementTypes_sibTrans = 9 }; - template - class CElementTypes : public CSimpleType - { - public: - CElementTypes() {} - virtual EElementTypes FromString(std::wstring &sValue) - { - if (L"all" == sValue) this->m_eValue = elementTypes_all; - else if (L"doc" == sValue) this->m_eValue = elementTypes_doc; - else if (L"node" == sValue) this->m_eValue = elementTypes_node; - else if (L"norm" == sValue) this->m_eValue = elementTypes_norm; - else if (L"nonNorm" == sValue) this->m_eValue = elementTypes_nonNorm; - else if (L"asst" == sValue) this->m_eValue = elementTypes_asst; - else if (L"nonAsst" == sValue) this->m_eValue = elementTypes_nonAsst; - else if (L"parTrans" == sValue) this->m_eValue = elementTypes_parTrans; - else if (L"pres" == sValue) this->m_eValue = elementTypes_pres; - else if (L"sibTrans" == sValue) this->m_eValue = elementTypes_sibTrans; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case elementTypes_all: return L"all"; - case elementTypes_doc: return L"doc"; - case elementTypes_node: return L"node"; - case elementTypes_norm: return L"norm"; - case elementTypes_nonNorm: return L"nonNorm"; - case elementTypes_asst: return L"asst"; - case elementTypes_nonAsst: return L"nonAsst"; - case elementTypes_parTrans: return L"parTrans"; - case elementTypes_pres: return L"pres"; - case elementTypes_sibTrans: return L"sibTrans"; - default: return L"all"; - } - } - SimpleType_FromString(EElementTypes) - SimpleType_Operator_Equal(CElementTypes) - }; -//--------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE(CElementTypes, EElementTypes, elementTypes_all) + + //-------------------------------------------------------------------------------- + // AlgorithmType + //-------------------------------------------------------------------------------- + enum EAlgorithmType { algorithmType_composite = 0, @@ -7228,48 +2167,13 @@ namespace SimpleTypes algorithmType_tx = 8, algorithmType_snake = 9 }; - template - class CAlgorithmType : public CSimpleType - { - public: - CAlgorithmType() {} - virtual EAlgorithmType FromString(std::wstring &sValue) - { - if (L"composite" == sValue) this->m_eValue = algorithmType_composite; - else if (L"conn" == sValue) this->m_eValue = algorithmType_conn; - else if (L"cycle" == sValue) this->m_eValue = algorithmType_cycle; - else if (L"hierChild" == sValue) this->m_eValue = algorithmType_hierChild; - else if (L"hierRoot" == sValue) this->m_eValue = algorithmType_hierRoot; - else if (L"pyra" == sValue) this->m_eValue = algorithmType_pyra; - else if (L"lin" == sValue) this->m_eValue = algorithmType_lin; - else if (L"sp" == sValue) this->m_eValue = algorithmType_sp; - else if (L"tx" == sValue) this->m_eValue = algorithmType_tx; - else if (L"snake" == sValue) this->m_eValue = algorithmType_snake; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case algorithmType_composite: return L"composite"; - case algorithmType_conn: return L"conn"; - case algorithmType_cycle: return L"cycle"; - case algorithmType_hierChild: return L"hierChild"; - case algorithmType_hierRoot: return L"hierRoot"; - case algorithmType_pyra: return L"pyra"; - case algorithmType_lin: return L"lin"; - case algorithmType_sp: return L"sp"; - case algorithmType_tx: return L"tx"; - case algorithmType_snake: return L"snake"; - default: return L"composite"; - } - } - SimpleType_FromString(EAlgorithmType) - SimpleType_Operator_Equal(CAlgorithmType) - }; -//--------------------------------------------------------------------------- + DEFINE_SIMPLE_TYPE(CAlgorithmType, EAlgorithmType, algorithmType_composite) + + //-------------------------------------------------------------------------------- + // FunctionType + //-------------------------------------------------------------------------------- + enum EFunctionType { functionType_cnt = 0, @@ -7281,43 +2185,13 @@ namespace SimpleTypes functionType_depth = 6, functionType_maxDepth = 7 }; - template - class CFunctionType : public CSimpleType - { - public: - CFunctionType() {} - virtual EFunctionType FromString(std::wstring &sValue) - { - if (L"cnt" == sValue) this->m_eValue = functionType_cnt; - else if (L"pos" == sValue) this->m_eValue = functionType_pos; - else if (L"revPos" == sValue) this->m_eValue = functionType_revPos; - else if (L"posEven" == sValue) this->m_eValue = functionType_posEven; - else if (L"posOdd" == sValue) this->m_eValue = functionType_posOdd; - else if (L"var" == sValue) this->m_eValue = functionType_var; - else if (L"depth" == sValue) this->m_eValue = functionType_depth; - else if (L"maxDepth" == sValue) this->m_eValue = functionType_maxDepth; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case functionType_cnt: return L"cnt"; - case functionType_pos: return L"pos"; - case functionType_revPos: return L"revPos"; - case functionType_posEven: return L"posEven"; - case functionType_posOdd: return L"posOdd"; - case functionType_var: return L"var"; - case functionType_depth: return L"depth"; - case functionType_maxDepth: return L"maxDepth"; - default: return L"composite"; - } - } - SimpleType_FromString(EFunctionType) - SimpleType_Operator_Equal(CFunctionType) - }; -//--------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE(CFunctionType, EFunctionType, functionType_cnt) + + //-------------------------------------------------------------------------------- + // FunctionOperator + //-------------------------------------------------------------------------------- + enum EFunctionOperator { functionOperator_equ = 0, @@ -7327,132 +2201,51 @@ namespace SimpleTypes functionOperator_gte = 4, functionOperator_lte = 5 }; - template - class CFunctionOperator : public CSimpleType - { - public: - CFunctionOperator() {} - virtual EFunctionOperator FromString(std::wstring &sValue) - { - if (L"equ" == sValue) this->m_eValue = functionOperator_equ; - else if (L"neq" == sValue) this->m_eValue = functionOperator_neq; - else if (L"gt" == sValue) this->m_eValue = functionOperator_gt; - else if (L"lt" == sValue) this->m_eValue = functionOperator_lt; - else if (L"gte" == sValue) this->m_eValue = functionOperator_gte; - else if (L"lte" == sValue) this->m_eValue = functionOperator_lte; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case functionOperator_equ: return L"equ"; - case functionOperator_neq: return L"neq"; - case functionOperator_gt: return L"gt"; - case functionOperator_lt: return L"lt"; - case functionOperator_gte: return L"gte"; - case functionOperator_lte: return L"lte"; - default: return L"equ"; - } - } - SimpleType_FromString(EFunctionOperator) - SimpleType_Operator_Equal(CFunctionOperator) - }; -//--------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE(CFunctionOperator, EFunctionOperator, functionOperator_equ) + + //-------------------------------------------------------------------------------- + // AnimLvlStr + //-------------------------------------------------------------------------------- + enum EAnimLvlStr { animLvlStr_none = 0, animLvlStr_ctr = 1, animLvlStr_lvl = 2 }; - template - class CAnimLvlStr : public CSimpleType - { - public: - CAnimLvlStr() {} - virtual EAnimLvlStr FromString(std::wstring &sValue) - { - if (L"none" == sValue) this->m_eValue = animLvlStr_none; - else if (L"ctr" == sValue) this->m_eValue = animLvlStr_ctr; - else if (L"lvl" == sValue) this->m_eValue = animLvlStr_lvl; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case animLvlStr_ctr: return L"ctr"; - case animLvlStr_lvl: return L"lvl"; - default: return L"none"; - } - } - SimpleType_FromString(EAnimLvlStr) - SimpleType_Operator_Equal(CAnimLvlStr) - }; -//--------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE(CAnimLvlStr, EAnimLvlStr, animLvlStr_none) + + //-------------------------------------------------------------------------------- + // AnimOneStr + //-------------------------------------------------------------------------------- + enum EAnimOneStr { animOneStr_none = 0, animOneStr_branch = 1, animOneStr_one = 2 }; - template - class CAnimOneStr : public CSimpleType - { - public: - CAnimOneStr() {} - virtual EAnimOneStr FromString(std::wstring &sValue) - { - if (L"none" == sValue) this->m_eValue = animOneStr_none; - else if (L"branch" == sValue) this->m_eValue = animOneStr_branch; - else if (L"one" == sValue) this->m_eValue = animOneStr_one; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case animOneStr_branch: return L"branch"; - case animOneStr_one: return L"one"; - default: return L"none"; - } - } - SimpleType_FromString(EAnimOneStr) - SimpleType_Operator_Equal(CAnimOneStr) - }; -//--------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE(CAnimOneStr, EAnimOneStr, animOneStr_none) + + //-------------------------------------------------------------------------------- + // DirectionDraw + //-------------------------------------------------------------------------------- + enum EDirectionDraw { direction_norm = 0, direction_rev = 1 }; - template - class CDirectionDraw : public CSimpleType - { - public: - CDirectionDraw() {} - virtual EDirectionDraw FromString(std::wstring &sValue) - { - if (L"norm" == sValue) this->m_eValue = direction_norm; - else if (L"rev" == sValue) this->m_eValue = direction_rev; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case direction_rev: return L"rev"; - default: return L"norm"; - } - } - SimpleType_FromString(EDirectionDraw) - SimpleType_Operator_Equal(CDirectionDraw) - }; -//--------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE(CDirectionDraw, EDirectionDraw, direction_norm) + + //-------------------------------------------------------------------------------- + // HierBranch + //-------------------------------------------------------------------------------- + enum EHierBranch { hierBranch_hang = 0, @@ -7461,68 +2254,25 @@ namespace SimpleTypes hierBranch_r = 3, hierBranch_std = 4 }; - template - class CHierBranch : public CSimpleType - { - public: - CHierBranch() {} - virtual EHierBranch FromString(std::wstring &sValue) - { - if (L"none" == sValue) this->m_eValue = hierBranch_hang; - else if (L"init" == sValue) this->m_eValue = hierBranch_init; - else if (L"l" == sValue) this->m_eValue = hierBranch_l; - else if (L"r" == sValue) this->m_eValue = hierBranch_r; - else if (L"l" == sValue) this->m_eValue = hierBranch_l; - else if (L"std" == sValue) this->m_eValue = hierBranch_std; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case hierBranch_init: return L"init"; - case hierBranch_l: return L"l"; - case hierBranch_r: return L"r"; - case hierBranch_std: return L"std"; - case hierBranch_hang: - default: return L"hang"; - } - } - SimpleType_FromString(EHierBranch) - SimpleType_Operator_Equal(CHierBranch) - }; -//--------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE(CHierBranch, EHierBranch, hierBranch_hang) + + //-------------------------------------------------------------------------------- + // ResizeHandles + //-------------------------------------------------------------------------------- + enum EResizeHandles { resizeHandles_exact = 0, resizeHandles_rel = 1 }; - template - class CResizeHandles : public CSimpleType - { - public: - CResizeHandles() {} - virtual EResizeHandles FromString(std::wstring &sValue) - { - if (L"exact" == sValue) this->m_eValue = resizeHandles_exact; - else if (L"rel" == sValue) this->m_eValue = resizeHandles_rel; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case resizeHandles_rel: return L"rel"; - case resizeHandles_exact: - default: return L"exact"; - } - } - SimpleType_FromString(EResizeHandles) - SimpleType_Operator_Equal(CResizeHandles) - }; -//--------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE(CResizeHandles, EResizeHandles, resizeHandles_exact) + + //-------------------------------------------------------------------------------- + // PtTypes + //-------------------------------------------------------------------------------- + enum EPtTypes { ptTypes_node = 0, @@ -7532,37 +2282,8 @@ namespace SimpleTypes ptTypes_parTrans = 4, ptTypes_sibTrans = 5 }; - template - class CPtTypes : public CSimpleType - { - public: - CPtTypes() {} - virtual EPtTypes FromString(std::wstring &sValue) - { - if (L"node" == sValue) this->m_eValue = ptTypes_node; - else if (L"asst" == sValue) this->m_eValue = ptTypes_asst; - else if (L"doc" == sValue) this->m_eValue = ptTypes_doc; - else if (L"pres" == sValue) this->m_eValue = ptTypes_pres; - else if (L"parTrans" == sValue) this->m_eValue = ptTypes_parTrans; - else if (L"sibTrans" == sValue) this->m_eValue = ptTypes_sibTrans; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case ptTypes_asst: return L"asst"; - case ptTypes_doc: return L"doc"; - case ptTypes_pres: return L"pres"; - case ptTypes_parTrans: return L"parTrans"; - case ptTypes_sibTrans: return L"sibTrans"; - case ptTypes_node: - default: return L"node"; - } - } - SimpleType_FromString(EPtTypes) - SimpleType_Operator_Equal(CPtTypes) - }; + + DEFINE_SIMPLE_TYPE(CPtTypes, EPtTypes, ptTypes_node) + } // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_OMath.cpp b/Common/DocxFormat/Source/Common/SimpleTypes_OMath.cpp new file mode 100644 index 0000000000..c7a25c3910 --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_OMath.cpp @@ -0,0 +1,369 @@ +/* + * (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_OMath.h" +#include "../Base/Unit.h" + +// Здесь представлены все простые типы Drawing-Main из спецификации Office Open Xml (22.1.3) +namespace SimpleTypes +{ + EBreakBin CBreakBin::FromString(const std::wstring &sValue) + { + if ( L"after" == sValue ) this->m_eValue = breakBinAfter; + else if ( L"before" == sValue ) this->m_eValue = breakBinBefore; + else this->m_eValue = breakBinRepeat; + + return this->m_eValue; + } + + std::wstring CBreakBin::ToString() const + { + switch(this->m_eValue) + { + case breakBinAfter : return L"after"; + case breakBinBefore : return L"before"; + case breakBinRepeat : return L"repeat"; + default : return L"repeat"; + } + } + + //-------------------------------------------------------------------------------- + // BreakBinSub 22.1.3.2 (Break Binary Subtraction Operators) + //-------------------------------------------------------------------------------- + + EBreakBinSub CBreakBinSub::FromString(const std::wstring &sValue) + { + if ( L"+-" == sValue ) this->m_eValue = breakBinPlusMinus; + else if ( L"-+" == sValue ) this->m_eValue = breakBinMinusPlus; + else this->m_eValue = breakBinMinusMinus; + + return this->m_eValue; + } + + std::wstring CBreakBinSub::ToString() const + { + switch(this->m_eValue) + { + case breakBinPlusMinus : return L"+-"; + case breakBinMinusPlus : return L"-+"; + case breakBinMinusMinus : return L"--"; + default : return L"--"; + } + } + + //-------------------------------------------------------------------------------- + // CMChar 22.1.3.3 (Character) + //-------------------------------------------------------------------------------- + + CMChar::CMChar() {} + + std::wstring CMChar::GetValue() const + { + return m_sValue; + } + + void CMChar::SetValue(const std::wstring &sValue) + { + m_sValue = sValue; + } + + std::wstring CMChar::FromString(const std::wstring &sValue) + { + m_sValue = sValue; + return m_sValue; + } + + std::wstring CMChar::ToString() const + { + return m_sValue; + } + + //-------------------------------------------------------------------------------- + // CFType 22.1.3.4 (Fraction Type) + //-------------------------------------------------------------------------------- + + EFType CFType::FromString(const std::wstring &sValue) + { + if ( L"bar" == sValue ) this->m_eValue = fTypeBar; + else if ( L"lin" == sValue ) this->m_eValue = fTypeLin; + else if ( L"noBar" == sValue ) this->m_eValue = fTypeNoBar; + else this->m_eValue = fTypeSkw; + + return this->m_eValue; + } + + std::wstring CFType::ToString() const + { + switch(this->m_eValue) + { + case fTypeBar : return L"bar"; + case fTypeLin : return L"lin"; + case fTypeNoBar : return L"noBar"; + case fTypeSkw : return L"skw"; + default : return L"bar"; + } + } + + //-------------------------------------------------------------------------------- + // CInteger2 22.1.3.5 + //-------------------------------------------------------------------------------- + + int CInteger2::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger( sValue ); + + if (this->m_eValue < -2) + this->m_eValue = -2; + if (this->m_eValue > 2) + this->m_eValue = 2; + + return this->m_eValue; + } + + std::wstring CInteger2::ToString() const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // CInteger255 22.1.3.6 (Integer value (1 to 255)) + //-------------------------------------------------------------------------------- + + int CInteger255::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger64( sValue.c_str() ); + + if (this->m_eValue < 1) + this->m_eValue = 1; + if (this->m_eValue > 255) + this->m_eValue = 255; + + return this->m_eValue; + } + + std::wstring CInteger255::ToString() const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // CMJc 22.1.3.7 (Justification Math) + //-------------------------------------------------------------------------------- + + EMJc CMJc::FromString(const std::wstring &sValue) + { + if ( L"center" == sValue ) this->m_eValue = mjcCenter; + else if ( L"centerGroup" == sValue ) this->m_eValue = mjcCenterGroup; + else if ( L"left" == sValue ) this->m_eValue = mjcLeft; + else this->m_eValue = mjcRight; + + return this->m_eValue; + } + + std::wstring CMJc::ToString() const + { + switch(this->m_eValue) + { + case mjcCenter : return L"center"; + case mjcCenterGroup : return L"centerGroup"; + case mjcLeft : return L"left"; + case mjcRight : return L"right"; + default : return L"centerGroup"; + } + } + + //-------------------------------------------------------------------------------- + // CLimLoc 22.1.3.8 (Limit Location) + //-------------------------------------------------------------------------------- + + ELimLoc CLimLoc::FromString(const std::wstring &sValue) + { + if ( L"subSup" == sValue ) this->m_eValue = limLocSubSup; + else this->m_eValue = limLocUndOvr; + + return this->m_eValue; + } + + std::wstring CLimLoc::ToString() const + { + switch(this->m_eValue) + { + case limLocSubSup : return L"subSup"; + case limLocUndOvr : return L"undOvr"; + default : return L"subSup"; + } + } + + //-------------------------------------------------------------------------------- + // CScript 22.1.3.9 (Script) + //-------------------------------------------------------------------------------- + + EScript CScript::FromString(const std::wstring &sValue) + { + if ( L"double-struck" == sValue ) this->m_eValue = scriptDoubleStruck; + else if ( L"fraktur" == sValue ) this->m_eValue = scriptFraktur; + else if ( L"monospace" == sValue ) this->m_eValue = scriptMonospace; + else if ( L"roman" == sValue ) this->m_eValue = scriptRoman; + else if ( L"sans-serif" == sValue ) this->m_eValue = scriptSansSerif; + else this->m_eValue = scriptScript; + + return this->m_eValue; + } + + std::wstring CScript::ToString() const + { + switch(this->m_eValue) + { + case scriptDoubleStruck : return L"double-struck"; + case scriptFraktur : return L"fraktur"; + case scriptMonospace : return L"monospace"; + case scriptRoman : return L"roman"; + case scriptSansSerif : return L"sans-serif"; + case scriptScript : return L"script"; + default : return L"roman"; + } + } + + //-------------------------------------------------------------------------------- + // CShp 22.1.3.10 (Shape (Delimiters)) + //-------------------------------------------------------------------------------- + + EShp CShp::FromString(const std::wstring &sValue) + { + if ( L"centered" == sValue ) this->m_eValue = shpCentered; + else this->m_eValue = shpMatch; + + return this->m_eValue; + } + + std::wstring CShp::ToString() const + { + switch(this->m_eValue) + { + case shpCentered : return L"centered"; + case shpMatch : return L"match"; + default : return L"centered"; + } + } + + //-------------------------------------------------------------------------------- + // CSpacingRule 22.1.3.11 (Spacing Rule) + //-------------------------------------------------------------------------------- + + int CSpacingRule::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger( sValue ); + + if (this->m_eValue < 0) + this->m_eValue = 0; + if (this->m_eValue > 4) + this->m_eValue = 4; + + return this->m_eValue; + } + + std::wstring CSpacingRule::ToString() const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // CStyle 22.1.3.12 (Style) + //-------------------------------------------------------------------------------- + + EStyle CStyle::FromString(const std::wstring &sValue) + { + if ( L"b" == sValue ) this->m_eValue = styleBold; + else if ( L"bi" == sValue ) this->m_eValue = styleBoldItalic; + else if ( L"i" == sValue ) this->m_eValue = styleItalic; + else this->m_eValue = stylePlain; + + return this->m_eValue; + } + + std::wstring CStyle::ToString() const + { + switch(this->m_eValue) + { + case styleBold : return L"b"; + case styleBoldItalic : return L"bi"; + case styleItalic : return L"i"; + case stylePlain : return L"p"; + default : return L"i"; + } + } + + //-------------------------------------------------------------------------------- + // CTopBot 22.1.3.13 (Top-Bottom) + //-------------------------------------------------------------------------------- + + ETopBot CTopBot::FromString(const std::wstring &sValue) + { + if ( L"bot" == sValue ) this->m_eValue = tbBot; + else if ( L"bottom"== sValue ) this->m_eValue = tbBot; + else this->m_eValue = tbTop; + + return this->m_eValue; + } + + std::wstring CTopBot::ToString() const + { + switch(this->m_eValue) + { + case tbBot : return L"bot"; + case tbTop : return L"top"; + default : return L"bot"; + } + } + + //-------------------------------------------------------------------------------- + // CUnSignedInteger 22.1.3.14 (Part 1) + //-------------------------------------------------------------------------------- + + unsigned int CUnSignedInteger::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetUInteger( sValue ); + + return this->m_eValue; + } + + std::wstring CUnSignedInteger::ToString() const + { + return std::to_wstring( this->m_eValue); + } +} diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_OMath.h b/Common/DocxFormat/Source/Common/SimpleTypes_OMath.h index 66017af3f9..73ea8dbf66 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_OMath.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_OMath.h @@ -33,11 +33,11 @@ #include "SimpleTypes_Base.h" -// «десь представлены все простые типы Drawing-Main из спецификации Office Open Xml (22.1.3) +// Здесь представлены все простые типы Drawing-Main из спецификации Office Open Xml (22.1.3) namespace SimpleTypes { //-------------------------------------------------------------------------------- - // BreakBin 22.1.3.1 (Break Binary Operators) + // BreakBin 22.1.3.1 (Break Binary Operators) //-------------------------------------------------------------------------------- enum EBreakBin @@ -47,39 +47,10 @@ namespace SimpleTypes breakBinRepeat = 2 }; - template - class CBreakBin : public CSimpleType - { - public: - - CBreakBin() {} - - virtual EBreakBin FromString(std::wstring &sValue) - { - if ( _T("after") == sValue ) this->m_eValue = breakBinAfter; - else if ( _T("before") == sValue ) this->m_eValue = breakBinBefore; - else this->m_eValue = breakBinRepeat; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case breakBinAfter : return _T("after"); - case breakBinBefore : return _T("before"); - case breakBinRepeat : return _T("repeat"); - default : return _T("repeat"); - } - } - - SimpleType_FromString (EBreakBin) - SimpleType_Operator_Equal (CBreakBin) - }; + DEFINE_SIMPLE_TYPE(CBreakBin, EBreakBin, breakBinRepeat) //-------------------------------------------------------------------------------- - // BreakBinSub 22.1.3.2 (Break Binary Subtraction Operators) + // BreakBinSub 22.1.3.2 (Break Binary Subtraction Operators) //-------------------------------------------------------------------------------- enum EBreakBinSub @@ -89,76 +60,28 @@ namespace SimpleTypes breakBinMinusMinus = 2 }; - template - class CBreakBinSub : public CSimpleType + DEFINE_SIMPLE_TYPE(CBreakBinSub, EBreakBinSub, breakBinMinusMinus) + + //-------------------------------------------------------------------------------- + // CMChar 22.1.3.3 (Character) + //-------------------------------------------------------------------------------- + + class CMChar { public: + CMChar(); - CBreakBinSub() {} + std::wstring GetValue() const; + void SetValue(const std::wstring &sValue); - virtual EBreakBinSub FromString(std::wstring &sValue) - { - if ( _T("+-") == sValue ) this->m_eValue = breakBinPlusMinus; - else if ( _T("-+") == sValue ) this->m_eValue = breakBinMinusPlus; - else this->m_eValue = breakBinMinusMinus; + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; - return this->m_eValue; - } + SimpleTypes_DefaultS(CMChar) - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case breakBinPlusMinus : return _T("+-"); - case breakBinMinusPlus : return _T("-+"); - case breakBinMinusMinus : return _T("--"); - default : return _T("--"); - } - } - - SimpleType_FromString (EBreakBinSub) - SimpleType_Operator_Equal (CBreakBinSub) - }; - - //-------------------------------------------------------------------------------- - // CMChar 22.1.3.3 (Character) - //-------------------------------------------------------------------------------- - - class CMChar - { - public: - CMChar() {} - - std::wstring GetValue() const - { - return m_sValue; - } - - void SetValue(std::wstring &sValue) - { - m_sValue = sValue; - } - - - std::wstring FromString(std::wstring &sValue) - { - m_sValue = sValue; - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString (std::wstring) - SimpleType_Operator_Equal (CMChar) - - private: - - std::wstring m_sValue; - }; + private: + std::wstring m_sValue; + }; //-------------------------------------------------------------------------------- // CFType 22.1.3.4 (Fraction Type) @@ -172,109 +95,22 @@ namespace SimpleTypes fTypeSkw = 3 }; - template - class CFType : public CSimpleType - { - public: - - CFType() {} - - virtual EFType FromString(std::wstring &sValue) - { - if ( _T("bar") == sValue ) this->m_eValue = fTypeBar; - else if ( _T("lin") == sValue ) this->m_eValue = fTypeLin; - else if ( _T("noBar") == sValue ) this->m_eValue = fTypeNoBar; - else this->m_eValue = fTypeSkw; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case fTypeBar : return _T("bar"); - case fTypeLin : return _T("lin"); - case fTypeNoBar : return _T("noBar"); - case fTypeSkw : return _T("skw"); - default : return _T("bar"); - } - } - - SimpleType_FromString (EFType) - SimpleType_Operator_Equal (CFType) - }; + DEFINE_SIMPLE_TYPE(CFType, EFType, fTypeBar) //-------------------------------------------------------------------------------- // CInteger2 22.1.3.5 //-------------------------------------------------------------------------------- - template - class CInteger2 : public CSimpleType - { - public: - CInteger2() {} + DEFINE_SIMPLE_TYPE(CInteger2, int, 0) - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - if (this->m_eValue < -2) - this->m_eValue = -2; - if (this->m_eValue > 2) - this->m_eValue = 2; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CInteger2) - - }; - //-------------------------------------------------------------------------------- // CInteger255 22.1.3.6 (Integer value (1 to 255)) //-------------------------------------------------------------------------------- - template - class CInteger255 : public CSimpleType - { - public: - CInteger255() {} - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - if (this->m_eValue < 1) - this->m_eValue = 1; - if (this->m_eValue > 255) - this->m_eValue = 255; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CInteger255) - - }; + DEFINE_SIMPLE_TYPE(CInteger255, int, 1) //-------------------------------------------------------------------------------- - // CMJc 22.1.3.7 (Justification Math) + // CMJc 22.1.3.7 (Justification Math) //-------------------------------------------------------------------------------- enum EMJc @@ -285,41 +121,10 @@ namespace SimpleTypes mjcRight = 3 }; - template - class CMJc : public CSimpleType - { - public: - - CMJc() {} - - virtual EMJc FromString(std::wstring &sValue) - { - if ( _T("center") == sValue ) this->m_eValue = mjcCenter; - else if ( _T("centerGroup") == sValue ) this->m_eValue = mjcCenterGroup; - else if ( _T("left") == sValue ) this->m_eValue = mjcLeft; - else this->m_eValue = mjcRight; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case mjcCenter : return _T("center"); - case mjcCenterGroup : return _T("centerGroup"); - case mjcLeft : return _T("left"); - case mjcRight : return _T("right"); - default : return _T("centerGroup"); - } - } - - SimpleType_FromString (EMJc) - SimpleType_Operator_Equal (CMJc) - }; + DEFINE_SIMPLE_TYPE(CMJc, EMJc, mjcCenterGroup) //-------------------------------------------------------------------------------- - // CLimLoc 22.1.3.8 (Limit Location) + // CLimLoc 22.1.3.8 (Limit Location) //-------------------------------------------------------------------------------- enum ELimLoc @@ -328,35 +133,8 @@ namespace SimpleTypes limLocUndOvr = 1 }; - template - class CLimLoc : public CSimpleType - { - public: + DEFINE_SIMPLE_TYPE(CLimLoc, ELimLoc, limLocSubSup) - CLimLoc() {} - - virtual ELimLoc FromString(std::wstring &sValue) - { - if ( _T("subSup") == sValue ) this->m_eValue = limLocSubSup; - else this->m_eValue = limLocUndOvr; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case limLocSubSup : return _T("subSup"); - case limLocUndOvr : return _T("undOvr"); - default : return _T("subSup"); - } - } - - SimpleType_FromString (ELimLoc) - SimpleType_Operator_Equal (CLimLoc) - }; - //-------------------------------------------------------------------------------- // CScript 22.1.3.9 (Script) //-------------------------------------------------------------------------------- @@ -371,45 +149,10 @@ namespace SimpleTypes scriptScript = 5 }; - template - class CScript : public CSimpleType - { - public: - - CScript() {} - - virtual EScript FromString(std::wstring &sValue) - { - if ( _T("double-struck") == sValue ) this->m_eValue = scriptDoubleStruck; - else if ( _T("fraktur") == sValue ) this->m_eValue = scriptFraktur; - else if ( _T("monospace") == sValue ) this->m_eValue = scriptMonospace; - else if ( _T("roman") == sValue ) this->m_eValue = scriptRoman; - else if ( _T("sans-serif") == sValue ) this->m_eValue = scriptSansSerif; - else this->m_eValue = scriptScript; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case scriptDoubleStruck : return _T("double-struck"); - case scriptFraktur : return _T("fraktur"); - case scriptMonospace : return _T("monospace"); - case scriptRoman : return _T("roman"); - case scriptSansSerif : return _T("sans-serif"); - case scriptScript : return _T("script"); - default : return _T("roman"); - } - } - - SimpleType_FromString (EScript) - SimpleType_Operator_Equal (CScript) - }; + DEFINE_SIMPLE_TYPE(CScript, EScript, scriptRoman) //-------------------------------------------------------------------------------- - // CShp 22.1.3.10 (Shape (Delimiters)) + // CShp 22.1.3.10 (Shape (Delimiters)) //-------------------------------------------------------------------------------- enum EShp @@ -418,67 +161,13 @@ namespace SimpleTypes shpMatch = 1 }; - template - class CShp : public CSimpleType - { - public: - - CShp() {} - - virtual EShp FromString(std::wstring &sValue) - { - if ( _T("centered") == sValue ) this->m_eValue = shpCentered; - else this->m_eValue = shpMatch; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case shpCentered : return _T("centered"); - case shpMatch : return _T("match"); - default : return _T("centered"); - } - } - - SimpleType_FromString (EShp) - SimpleType_Operator_Equal (CShp) - }; + DEFINE_SIMPLE_TYPE(CShp, EShp, shpCentered) //-------------------------------------------------------------------------------- - // CSpacingRule 22.1.3.11 (Spacing Rule) - //-------------------------------------------------------------------------------- + // CSpacingRule 22.1.3.11 (Spacing Rule) + //-------------------------------------------------------------------------------- - template - class CSpacingRule : public CSimpleType - { - public: - CSpacingRule() {} - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - if (this->m_eValue < 0) - this->m_eValue = 0; - if (this->m_eValue > 4) - this->m_eValue = 4; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CSpacingRule) - }; + DEFINE_SIMPLE_TYPE(CSpacingRule, int, 0) //-------------------------------------------------------------------------------- // CStyle 22.1.3.12 (Style) @@ -492,41 +181,10 @@ namespace SimpleTypes stylePlain = 3 }; - template - class CStyle : public CSimpleType - { - public: - - CStyle() {} - - virtual EStyle FromString(std::wstring &sValue) - { - if ( _T("b") == sValue ) this->m_eValue = styleBold; - else if ( _T("bi") == sValue ) this->m_eValue = styleBoldItalic; - else if ( _T("i") == sValue ) this->m_eValue = styleItalic; - else this->m_eValue = stylePlain; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case styleBold : return _T("b"); - case styleBoldItalic : return _T("bi"); - case styleItalic : return _T("i"); - case stylePlain : return _T("p"); - default : return _T("i"); - } - } - - SimpleType_FromString (EStyle) - SimpleType_Operator_Equal (CStyle) - }; + DEFINE_SIMPLE_TYPE(CStyle, EStyle, styleBoldItalic) //-------------------------------------------------------------------------------- - // CTopBot 22.1.3.13 (Top-Bottom) + // CTopBot 22.1.3.13 (Top-Bottom) //-------------------------------------------------------------------------------- enum ETopBot @@ -535,59 +193,11 @@ namespace SimpleTypes tbTop = 1 }; - template - class CTopBot : public CSimpleType - { - public: - - CTopBot() {} - - virtual ETopBot FromString(std::wstring &sValue) - { - if ( _T("bot") == sValue ) this->m_eValue = tbBot; - else if ( _T("bottom") == sValue ) this->m_eValue = tbBot; - else this->m_eValue = tbTop; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case tbBot : return _T("bot"); - case tbTop : return _T("top"); - default : return _T("bot"); - } - } - - SimpleType_FromString (ETopBot) - SimpleType_Operator_Equal (CTopBot) - }; + DEFINE_SIMPLE_TYPE(CTopBot, ETopBot, tbBot) //-------------------------------------------------------------------------------- // CUnSignedInteger 22.1.3.14 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - template - class CUnSignedInteger : public CSimpleType - { - public: - CUnSignedInteger() {} - - virtual unsigned int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return std::to_wstring( this->m_eValue); - } - - SimpleType_FromString (unsigned int) - SimpleType_Operator_Equal (CUnSignedInteger) - }; + DEFINE_SIMPLE_TYPE(CUnSignedInteger, unsigned int, 0) } diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Utility.h b/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.cpp similarity index 60% rename from ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Utility.h rename to Common/DocxFormat/Source/Common/SimpleTypes_Rtf.cpp index e8f064c284..c6291e7bb4 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Utility.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.cpp @@ -1,59 +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 - * - */ -#pragma once - -#include "../Common/Encoding.h" -#include - -template -static const std::vector _transform(const std::vector& lines, const Out(*func)(const In&)) -{ - std::vector result; - for (typename std::vector::const_iterator iter = lines.begin(); iter != lines.end(); ++iter) - { - result.push_back(func(*iter)); - } - - return result; -} - -template -static const std::vector _transform2(const std::vector& lines, const int codepage, const Out(*func)(const In&, const In2 codePage)) -{ - std::vector result; - for (typename std::vector::const_iterator iter = lines.begin(); iter != lines.end(); ++iter) - { - result.push_back(func(*iter, codepage)); - } - return result; -} - +/* + * (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/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/precompiled_utility.h b/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.h similarity index 74% rename from ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/precompiled_utility.h rename to Common/DocxFormat/Source/Common/SimpleTypes_Rtf.h index 14d4e24a95..b2121abc86 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/precompiled_utility.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Rtf.h @@ -1,38 +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 -#include - -#include -#include +/* + * (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/Common/SimpleTypes_Shared.cpp b/Common/DocxFormat/Source/Common/SimpleTypes_Shared.cpp new file mode 100644 index 0000000000..6fefd5362c --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Shared.cpp @@ -0,0 +1,1135 @@ +/* + * (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_Shared.h" +#include "SimpleTypes_Word.h" +#include +#include "boost/lexical_cast.hpp" +#include "boost/format.hpp" +#include "../Base/Unit.h" + +// Здесь представлены все простые типы SharedML из спецификации Office Open Xml (22.8) +namespace SimpleTypes +{ + const static int shemeDefaultColor[] = + { + 0x00000000, 0x00FFFFFF, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00FFFF00, 0x00FF00FF, 0x0000FFFF, + 0x00000000, 0x00FFFFFF, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00FFFF00, 0x00FF00FF, 0x0000FFFF, + 0x00800000, 0x00008000, 0x00000080, 0x00808000, 0x00800080, 0x00008080, 0x00C0C0C0, 0x00808080, + 0x009999FF, 0x00993366, 0x00FFFFCC, 0x00CCFFFF, 0x00660066, 0x00FF8080, 0x000066CC, 0x00CCCCFF, + 0x00000080, 0x00FF00FF, 0x00FFFF00, 0x0000FFFF, 0x00800080, 0x00800000, 0x00008080, 0x000000FF, + 0x0000CCFF, 0x00CCFFFF, 0x00CCFFCC, 0x00FFFF99, 0x0099CCFF, 0x00FF99CC, 0x00CC99FF, 0x00FFCC99, + 0x003366FF, 0x0033CCCC, 0x0099CC00, 0x00FFCC00, 0x00FF9900, 0x00FF6600, 0x00666699, 0x00969696, + 0x00003366, 0x00339966, 0x00003300, 0x00333300, 0x00993300, 0x00993366, 0x00333399, 0x00333333 + }; + const static int controlPanelColors2[] = + { + 0x00000000, 0x00FFFFFF, 0x00000000, 0x00FFFFFF, + 0x00000000, 0x00000000, 0x00000000, 0x00FFFFFF, + 0x00FFFFFF, 0x00000000, 0x00FFFFFF, 0x00FFFFFF, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00FFFFFF, 0x00FFFFFF, 0x00FFFFFF, 0x00000000, + 0x00FFFFFF, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00FFFFFF, 0x00FFFFFF + }; + const static int controlPanelColors1[] = + { + 0x00FFFFFF, 0x00CCCCCC, 0x00FFFFFF, 0x006363CE, + 0x00DDDDDD, 0x00DDDDDD, 0x00888888, 0x00000000, + 0x00000000, 0x00808080, 0x00B5D5FF, 0x00000000, + 0x00FFFFFF, 0x00FFFFFF, 0x007F7F7F, 0x00FBFCC5, + 0x00000000, 0x00F7F7F7, 0x00000000, 0x00FFFFFF, + 0x00666666, 0x00C0C0C0, 0x00DDDDDD, 0x00C0C0C0, + 0x00888888, 0x00FFFFFF, 0x00CCCCCC, 0x00000000 + }; + //-------------------------------------------------------------------------------- + // RelationshipId 22.8.2.1 (Part 1) + //-------------------------------------------------------------------------------- + + CRelationshipId::CRelationshipId() {} + + std::wstring CRelationshipId::GetValue() const + { + return m_sValue; + } + + void CRelationshipId::SetValue(const std::wstring &sValue) + { + m_sValue = sValue; + } + + std::wstring CRelationshipId::FromString(const std::wstring &sValue) + { + m_sValue = sValue; + + return m_sValue; + } + + std::wstring CRelationshipId::ToString () const + { + return m_sValue; + } + +} // SimpleTypes + +// Здесь представлены все простые типы SharedML из спецификации Office Open Xml (22.9) +namespace SimpleTypes +{ + //-------------------------------------------------------------------------------- + // CalendarType 22.9.2.1 (Part 1) + //-------------------------------------------------------------------------------- + + ECalendarType CCalendarType::FromString(const std::wstring &sValue) + { + if ( L"gregorian" == sValue ) this->m_eValue = calendartypeGregorian; + else if ( L"gregorianArabic" == sValue ) this->m_eValue = calendartypeGregorianArabic; + else if ( L"gregorianMeFrench" == sValue ) this->m_eValue = calendartypeGregorianMeFrench; + else if ( L"gregorianUs" == sValue ) this->m_eValue = calendartypeGregorianUs; + else if ( L"gregorianXlitEnglish" == sValue ) this->m_eValue = calendartypeGregorianXlitEnglish; + else if ( L"gregorianXlitFrench" == sValue ) this->m_eValue = calendartypeGregorianXlitFrench; + else if ( L"hebrew" == sValue ) this->m_eValue = calendartypeHebrew; + else if ( L"hijri" == sValue ) this->m_eValue = calendartypeHijri; + else if ( L"japan" == sValue ) this->m_eValue = calendartypeJapan; + else if ( L"korea" == sValue ) this->m_eValue = calendartypeKorea; + else if ( L"none" == sValue ) this->m_eValue = calendartypeNone; + else if ( L"saka" == sValue ) this->m_eValue = calendartypeSaka; + else if ( L"taiwan" == sValue ) this->m_eValue = calendartypeTaiwan; + else if ( L"thai" == sValue ) this->m_eValue = calendartypeThai; + else this->m_eValue = calendartypeNone; + + return this->m_eValue; + } + + std::wstring CCalendarType::ToString () const + { + switch(this->m_eValue) + { + case calendartypeGregorian : return L"gregorian"; + case calendartypeGregorianArabic : return L"gregorianArabic"; + case calendartypeGregorianMeFrench : return L"gregorianMeFrench"; + case calendartypeGregorianUs : return L"gregorianUs"; + case calendartypeGregorianXlitEnglish : return L"gregorianXlitEnglish"; + case calendartypeGregorianXlitFrench : return L"gregorianXlitFrench"; + case calendartypeHebrew : return L"hebrew"; + case calendartypeHijri : return L"hijri"; + case calendartypeJapan : return L"japan"; + case calendartypeKorea : return L"korea"; + case calendartypeNone : return L"none"; + case calendartypeSaka : return L"saka"; + case calendartypeTaiwan : return L"taiwan"; + case calendartypeThai : return L"thai"; + default : return L"none"; + } + } + + //-------------------------------------------------------------------------------- + // ConformanceClass 22.9.2.2 (Part 1) + //-------------------------------------------------------------------------------- + + EConformanceClass CConformanceClass::FromString(const std::wstring &sValue) + { + if ( L"strict" == sValue ) this->m_eValue = conformanceclassStrict; + else if ( L"transitional" == sValue ) this->m_eValue = conformanceclassTransitional; + else this->m_eValue = conformanceclassTransitional; + + return this->m_eValue; + } + + std::wstring CConformanceClass::ToString () const + { + switch(this->m_eValue) + { + case conformanceclassStrict : return L"strict"; + case conformanceclassTransitional : return L"transitional"; + default : return L"strict"; + } + } + + //-------------------------------------------------------------------------------- + // Guid 22.9.2.4 (Part 1) + //-------------------------------------------------------------------------------- + + CGuid::CGuid() {} + + bool CGuid::FromString(const std::wstring &sValue) + { + // GUID "{00000000-5BD2-4BC8-9F70-7020E1357FB2}" + + TGuid oZeroGUID = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + m_oGUID = oZeroGUID; + + if ( sValue.length() != 38 ) + return false; + + T_ULONG64 unTemp = 0; + + std::wstring sMidValue; + sMidValue = sValue.substr( 1, 8 ); + + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.a = (unsigned int)unTemp; + + sMidValue = sValue.substr( 10, 4 ); + if ( !HexToInt(sMidValue, unTemp ) ) + return false; + + m_oGUID.b = (unsigned short)unTemp; + + sMidValue = sValue.substr( 15, 4 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.c = (unsigned short)unTemp; + + sMidValue = sValue.substr( 20, 2 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.d = (unsigned char)unTemp; + + + sMidValue = sValue.substr( 22, 2 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.e = (unsigned char)unTemp; + + sMidValue = sValue.substr( 25, 2 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.f = (unsigned char)unTemp; + + sMidValue = sValue.substr( 27, 2 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.g = (unsigned char)unTemp; + + sMidValue = sValue.substr( 29, 2 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.h = (unsigned char)unTemp; + + sMidValue = sValue.substr( 31, 2 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.i = (unsigned char)unTemp; + + sMidValue = sValue.substr( 33, 2 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.j = (unsigned char)unTemp; + + sMidValue = sValue.substr( 35, 2 ); + if ( !HexToInt( sMidValue, unTemp ) ) + return false; + + m_oGUID.k = (unsigned char)unTemp; + + return true; + } + + std::wstring CGuid::ToString () const + { + std::wstringstream sstream; + sstream << boost::wformat( L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" ) % m_oGUID.a % m_oGUID.b % m_oGUID.c % m_oGUID.d % m_oGUID.e % m_oGUID.f % m_oGUID.g % m_oGUID.h % m_oGUID.i % m_oGUID.j % m_oGUID.k; + return sstream.str(); + } + + bool CGuid::IsZero() + { + return 0 == m_oGUID.a && 0 == m_oGUID.b && 0 == m_oGUID.c && 0 == m_oGUID.d && 0 == m_oGUID.e && 0 == m_oGUID.f && 0 == m_oGUID.g && 0 == m_oGUID.h && 0 == m_oGUID.i && 0 == m_oGUID.j && 0 == m_oGUID.k; + } + + bool CGuid::HexToInt(std::wstring& sValue, T_ULONG64& unResult) + { + bool bResult = true; + + unResult = 0; + for ( int nIndex = (int)sValue.length() - 1, nMult = 0; nIndex >= 0; nIndex--, nMult += 4 ) + { + unResult += HexToInt( (int)sValue[nIndex], bResult ) << nMult; + } + + return bResult; + } + + int CGuid::HexToInt(int nHex, bool &bResult) + { + if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); + if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); + if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); + + bResult = false; + + return 0; + } + + //-------------------------------------------------------------------------------- + // HexColorRGB 22.9.2.5 (Part 1) + //-------------------------------------------------------------------------------- + + int CHexColorRGB::HexToInt(int nHex) + { + if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); + if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); + if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); + + return 0; + } + + void CHexColorRGB::Parse(const std::wstring& sValue) + { + if ( sValue.length() < 6 ) + return; + + m_unR = HexToInt( (int)sValue[1] ) + (unsigned char)(HexToInt( (int)sValue[0] ) << 4); + m_unG = HexToInt( (int)sValue[3] ) + (unsigned char)(HexToInt( (int)sValue[2] ) << 4); + m_unB = HexToInt( (int)sValue[5] ) + (unsigned char)(HexToInt( (int)sValue[4] ) << 4); + m_unA = 255; + + this->m_eValue = ((int)m_unR << 16) + ((int)m_unG << 8) + m_unB; + } + + int CHexColorRGB::FromString(const std::wstring &sValue) + { + if ( 6 <= sValue.length() ) + { + std::wstring midString = sValue.substr( 0, 6 ); + Parse( midString ); + } + else + this->m_eValue = 0; + + return this->m_eValue; + } + + std::wstring CHexColorRGB::ToString () const + { + return XmlUtils::ToString(this->m_eValue, L"%06X"); + } + + unsigned char CHexColorRGB::Get_R() const + { + return m_unR; + } + + unsigned char CHexColorRGB::Get_G() const + { + return m_unG; + } + + unsigned char CHexColorRGB::Get_B() const + { + return m_unB; + } + + unsigned char CHexColorRGB::Get_A() const + { + return m_unA; + } + + void CHexColorRGB::Set_RGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA) + { + m_unR = unR; + m_unG = unG; + m_unB = unB; + m_unA = unA; + + this->m_eValue = ((int)m_unR << 16) + ((int)m_unG << 8) + m_unB; + } + + //-------------------------------------------------------------------------------- + // Lang 22.9.2.6 (Part 1) + //-------------------------------------------------------------------------------- + + // TO DO: сделать парсер языка по спецификации RFC 4646/BCP 47 + //class CLang + //{ + //public: + // CLang() {} + + // std::wstring GetValue() const + // { + // return m_sValue; + // } + + // void SetValue(std::wstring &sValue) + // { + // m_sValue = sValue; + // } + + + // std::wstring FromString(const std::wstring &sValue) + // { + // m_sValue = sValue; + + // return m_sValue; + // } + + // std::wstring ToString () const + // { + // return m_sValue; + // } + + // SimpleType_FromString2 (std::wstring) + // SimpleTypes_Default(CLang) + + //private: + + // std::wstring m_sValue; + //}; + + + //-------------------------------------------------------------------------------- + // OnOff 22.9.2.7 (Part 1) + //-------------------------------------------------------------------------------- + + // Согласно части 4 стр. 1459, значений "on" и "off" быть не должно + + COnOff::COnOff(const bool & bVal) + { + this->m_eValue = (false != bVal) ? onoffTrue : onoffFalse; + } + + EOnOff COnOff::FromString(const std::wstring &sValue) + { + if ( L"true" == sValue ) this->m_eValue = onoffTrue; + else if ( L"True" == sValue ) this->m_eValue = onoffTrue; + else if ( L"1" == sValue ) this->m_eValue = onoffTrue; + else if ( L"t" == sValue ) this->m_eValue = onoffTrue; + else if ( L"on" == sValue ) this->m_eValue = onoffTrue; + else if ( L"f" == sValue ) this->m_eValue = onoffFalse; + else if ( L"0" == sValue ) this->m_eValue = onoffFalse; + else if ( L"false" == sValue ) this->m_eValue = onoffFalse; + else if ( L"False" == sValue ) this->m_eValue = onoffFalse; + else if ( L"off" == sValue ) this->m_eValue = onoffFalse; + else this->m_eValue = onoffFalse; + + return this->m_eValue; + } + + /*EOnOff COnOff::FromStringA(const std::string& sValue) + { + if ("1" == sValue) this->m_eValue = onoffTrue; + else if ("0" == sValue) this->m_eValue = onoffFalse; + else if ("true" == sValue) this->m_eValue = onoffTrue; + else if ("True" == sValue) this->m_eValue = onoffTrue; + else if ("t" == sValue) this->m_eValue = onoffTrue; + else if ("on" == sValue) this->m_eValue = onoffTrue; + else if ("f" == sValue) this->m_eValue = onoffFalse; + else if ("false" == sValue) this->m_eValue = onoffFalse; + else if ("False" == sValue) this->m_eValue = onoffFalse; + else if ("off" == sValue) this->m_eValue = onoffFalse; + else this->m_eValue = onoffFalse; + + return this->m_eValue; + }*/ + + EOnOff COnOff::FromStringA(const char* sValue) + { + if (strcmp("1", sValue) == 0) this->m_eValue = onoffTrue; + else if (strcmp("0", sValue) == 0) this->m_eValue = onoffFalse; + else if (strcmp("true", sValue) == 0) this->m_eValue = onoffTrue; + else if (strcmp("True", sValue) == 0) this->m_eValue = onoffTrue; + else if (strcmp("t", sValue) == 0) this->m_eValue = onoffTrue; + else if (strcmp("on", sValue) == 0) this->m_eValue = onoffTrue; + else if (strcmp("f", sValue) == 0) this->m_eValue = onoffFalse; + else if (strcmp("false", sValue) == 0) this->m_eValue = onoffFalse; + else if (strcmp("False", sValue) == 0) this->m_eValue = onoffFalse; + else if (strcmp("off", sValue) == 0) this->m_eValue = onoffFalse; + else this->m_eValue = onoffFalse; + + return this->m_eValue; + } + + std::wstring COnOff::ToString () const + { + switch(this->m_eValue) + { + case onoffFalse : return L"false"; + case onoffTrue : return L"true"; + default : return L"false"; + } + } + + std::wstring COnOff::ToString2(EOnOffToString eType) const + { + if (onofftostringTrue == eType) + { + switch (this->m_eValue) + { + case onoffFalse: return L"false"; + case onoffTrue: return L"true"; + default: return L"false"; + } + } + else if (onofftostring1 == eType) + { + switch (this->m_eValue) + { + case onoffFalse: return L"0"; + case onoffTrue: return L"1"; + default: return L"0"; + } + } + else if (onofftostringOn == eType) + { + switch (this->m_eValue) + { + case onoffFalse: return L"off"; + case onoffTrue: return L"on"; + default: return L"off"; + } + } + else if (onofftostringT == eType) + { + switch (this->m_eValue) + { + case onoffFalse: return L"f"; + case onoffTrue: return L"t"; + default: return L"f"; + } + } + return L"false"; + } + + std::wstring COnOff::ToString3(EOnOffToString eType) const + { + if(onofftostringTrue == eType) + { + switch(this->m_eValue) + { + case onoffFalse : return L"false"; + case onoffTrue : return L"true"; + default : return L"false"; + } + } + else if(onofftostring1 == eType) + { + switch(this->m_eValue) + { + case onoffFalse : return L"0"; + case onoffTrue : return L"1"; + default : return L"0"; + } + } + else if(onofftostringOn == eType) + { + switch(this->m_eValue) + { + case onoffFalse : return L"off"; + case onoffTrue : return L"on"; + default : return L"off"; + } + } + else if(onofftostringT == eType) + { + switch(this->m_eValue) + { + case onoffFalse : return L"f"; + case onoffTrue : return L"t"; + default : return L"f"; + } + } + return L"false"; + } + + bool COnOff::ToBool() + { + return onoffTrue == this->m_eValue; + } + + void COnOff::FromBool(bool bVal) + { + this->m_eValue = (false != bVal) ? onoffTrue : onoffFalse; + } + + CBool::CBool() {} + + CBool::CBool(const bool & bVal) + { + this->m_eValue = (false != bVal) ? onoffTrue : onoffFalse; + } + std::wstring CBool::ToString() const + { + switch (m_eValue) + { + case onoffTrue: return L"1"; + case onoffFalse: + default: return L"0"; + } + } + EOnOff CBool::FromString(const std::wstring &sValue) + { + return COnOff::FromString(sValue); + } + + //-------------------------------------------------------------------------------- + // Panose 22.9.2.8 (Part 1) + //-------------------------------------------------------------------------------- + + CPanose::CPanose() {} + + std::wstring CPanose::GetValue() const + { + return m_sValue; + } + + void CPanose::SetValue(std::wstring &sValue) + { + m_sValue = sValue; + } + + + std::wstring CPanose::FromString(const std::wstring &sValue) + { + if ( 20 > sValue.length() ) + { + m_sValue = sValue; + for ( size_t nIndex = 0; nIndex < 20 - sValue.length(); nIndex++ ) + { + m_sValue += L"0"; + } + } + else if ( 20 == sValue.length() ) + m_sValue = sValue; + else + { + m_sValue = sValue.substr( 0, 20 ); + } + + return m_sValue; + } + + std::wstring CPanose::ToString () const + { + return m_sValue; + } + + unsigned char CPanose::Get_Number(int nIndex) + { + if ( m_sValue.length() < 20 ) + return 0; + + nIndex = (std::max)( 0, (std::min)( 9, nIndex ) ); + + unsigned int unChar1 = XmlUtils::GetDigit( m_sValue[2 * nIndex] ); + unsigned int unChar2 = XmlUtils::GetDigit( m_sValue[2 * nIndex + 1] ); + + return (unChar2 + (unsigned char)(unChar1 << 4)); + } + + //-------------------------------------------------------------------------------- + // String 22.9.2.13 (Part 1) + //-------------------------------------------------------------------------------- + + // Ничего не делаем, используем ATL::std::wstring + + //-------------------------------------------------------------------------------- + // TwipsMeasure 22.9.2.14 (Part 1) + //-------------------------------------------------------------------------------- + + CTwipsMeasure::CTwipsMeasure() {} + + double CTwipsMeasure::FromString(const std::wstring &sValue) + { + Parse(sValue, 20); + + // В данном типе только положительные числа + m_dValue = fabs( m_dValue ); + + return m_dValue; + } + void CTwipsMeasure::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = FromTwips(dValue); + } + std::wstring CTwipsMeasure::ToString() const + { + std::wstring sResult; + + if ( m_bUnit ) + sResult = boost::lexical_cast( m_dValue ) + L"pt"; + else + sResult = std::to_wstring( (int)(m_dValue * 20) ); + + return sResult; + } + + double CTwipsMeasure::FromPoints(double dValue) + { + m_dValue = fabs( dValue ); + return m_dValue; + } + double CTwipsMeasure::FromInches(double dValue) + { + m_dValue = fabs( dValue ) * 72; + return m_dValue; + } + + //-------------------------------------------------------------------------------- + // UnsignedDecimalNumber 22.9.2.16 (Part 1) + //-------------------------------------------------------------------------------- + + CUnsignedDecimalNumber::CUnsignedDecimalNumber(const CUnsignedDecimalNumber& obj) + { + this->m_eValue = obj.m_eValue; + } + + CUnsignedDecimalNumber::CUnsignedDecimalNumber(const int& val) + { + this->m_eValue = (unsigned int)val; + } + + unsigned int CUnsignedDecimalNumber::FromString(const std::wstring &sValue) + { + try + { + this->m_eValue = XmlUtils::GetInteger(sValue); + return this->m_eValue; + } + catch(...) + { + } + + try + { + this->m_eValue = static_cast(XmlUtils::GetInteger64(sValue)); + } + catch(...) + { + this->m_eValue = 0; + } + + return this->m_eValue; + } + + std::wstring CUnsignedDecimalNumber::ToString() const + { + return std::to_wstring( this->m_eValue); + } + + //-------------------------------------------------------------------------------- + // VerticalAlignRun 22.9.2.17 (Part 1) + //-------------------------------------------------------------------------------- + + EVerticalAlignRun CVerticalAlignRun::FromString(const std::wstring &sValue) + { + if ( L"baseline" == sValue || L"None" == sValue) this->m_eValue = verticalalignrunBaseline; + else if ( L"subscript" == sValue || L"Subscript" == sValue) this->m_eValue = verticalalignrunSubscript; + else if ( L"superscript" == sValue || L"Superscript" == sValue) this->m_eValue = verticalalignrunSuperscript; + else this->m_eValue = verticalalignrunBaseline; + + return this->m_eValue; + } + + std::wstring CVerticalAlignRun::ToString() const + { + switch(this->m_eValue) + { + case verticalalignrunBaseline : return L"baseline"; + case verticalalignrunSubscript : return L"subscript"; + case verticalalignrunSuperscript : return L"superscript"; + default : return L"baseline"; + } + } + + //-------------------------------------------------------------------------------- + // XAlign 22.9.2.18 (Part 1) + //-------------------------------------------------------------------------------- + + EXAlign CXAlign::FromString(const std::wstring &sValue) + { + if ( L"center" == sValue ) this->m_eValue = xalignCenter; + else if ( L"inside" == sValue ) this->m_eValue = xalignInside; + else if ( L"left" == sValue ) this->m_eValue = xalignLeft; + else if ( L"outside" == sValue ) this->m_eValue = xalignOutside; + else if ( L"right" == sValue ) this->m_eValue = xalignRight; + else this->m_eValue = xalignLeft; + + return this->m_eValue; + } + + std::wstring CXAlign::ToString () const + { + switch(this->m_eValue) + { + case xalignCenter : return L"center"; + case xalignInside : return L"inside"; + case xalignLeft : return L"left"; + case xalignOutside : return L"outside"; + case xalignRight : return L"right"; + default : return L"left"; + } + } + + //-------------------------------------------------------------------------------- + // YAlign 22.9.2.20 (Part 1) + //-------------------------------------------------------------------------------- + + EYAlign CYAlign::FromString(const std::wstring &sValue) + { + if ( L"bottom" == sValue ) this->m_eValue = yalignBottom; + else if ( L"bot" == sValue ) this->m_eValue = yalignBottom; + else if ( L"center" == sValue ) this->m_eValue = yalignCenter; + else if ( L"inline" == sValue ) this->m_eValue = yalignInline; + else if ( L"inside" == sValue ) this->m_eValue = yalignInside; + else if ( L"outside" == sValue ) this->m_eValue = yalignOutside; + else if ( L"top" == sValue ) this->m_eValue = yalignTop; + else this->m_eValue = yalignTop; + + return this->m_eValue; + } + + std::wstring CYAlign::ToString () const + { + switch(this->m_eValue) + { + case yalignBottom : return L"bottom"; + case yalignCenter : return L"center"; + case yalignInline : return L"inline"; + case yalignInside : return L"inside"; + case yalignOutside : return L"outside"; + case yalignTop : return L"top"; + default : return L"top"; + } + } +} // SimpleTypes + +// Здесь представлены все простые типы SharedML из спецификации Office Open Xml (15.1.2 - part 4) +namespace SimpleTypes +{ + //-------------------------------------------------------------------------------- + // ColorType 15.1.2.3 (Part 4) + //-------------------------------------------------------------------------------- + + void CColorType::SetRGB() + { + if (this->m_eValue == colortypeRGB) return; + + switch(this->m_eValue) + { + case colortypeAqua: + { + m_unR = 0x00; + m_unG = 0xff; + m_unB = 0xff; + }break; + case colortypeBlack: + { + m_unR = 0x00; + m_unG = 0x00; + m_unB = 0x00; + }break; + case colortypeBlue: + { + m_unR = 0x00; + m_unG = 0x00; + m_unB = 0xff; + }break; + case colortypeFuchsia: + { + m_unR = 0xff; + m_unG = 0x00; + m_unB = 0xff; + }break; + case colortypeGray: + { + m_unR = 0x80; + m_unG = 0x80; + m_unB = 0x80; + }break; + case colortypeGreen: + { + m_unR = 0x00; + m_unG = 0x80; + m_unB = 0x00; + }break; + case colortypeLime: + { + m_unR = 0x00; + m_unG = 0xff; + m_unB = 0x00; + }break; + case colortypeMaroon: + { + m_unR = 0x80; + m_unG = 0x00; + m_unB = 0x00; + }break; + case colortypeNavy: + { + m_unR = 0x00; + m_unG = 0x00; + m_unB = 0x80; + }break; + case colortypeOlive: + { + m_unR = 0x80; + m_unG = 0x80; + m_unB = 0x00; + }break; + case colortypePurple: + { + m_unR = 0x80; + m_unG = 0x00; + m_unB = 0x80; + }break; + case colortypeRed: + { + m_unR = 0xff; + m_unG = 0x00; + m_unB = 0x00; + }break; + case colortypeSilver: + { + m_unR = 0xc0; + m_unG = 0xc0; + m_unB = 0xc0; + }break; + case colortypeTeal: + { + m_unR = 0x00; + m_unG = 0x80; + m_unB = 0x80; + }break; + case colortypeWhite: + { + m_unR = 0xff; + m_unG = 0xff; + m_unB = 0xff; + }break; + case colortypeYellow: + { + m_unR = 0xff; + m_unG = 0xff; + m_unB = 0; + }break; + case colortypeNone: + default: + { + m_unR = 0; + m_unG = 0; + m_unB = 0; + }break; + } + } + + CColorType::CColorType() + { + SetRGB(); + + std::wstringstream sstream; + sstream << boost::wformat( L"%02x%02x%02x" ) % m_unR % m_unG % m_unB; + m_sValue = sstream.str(); + } + + void CColorType::ByHexColor(const std::wstring& sValue) + { + this->m_eValue = colortypeRGB; + + CHexColor hexColor; + hexColor.FromString(sValue); + + m_unR = hexColor.Get_R(); + m_unG = hexColor.Get_G(); + m_unB = hexColor.Get_B(); + } + + void CColorType::ByColorName(const std::wstring& sValue) + { + this->m_eValue = colortypeNone; + + if (std::wstring::npos != sValue.find(L"aqua")) this->m_eValue = colortypeAqua; + else if (std::wstring::npos != sValue.find(L"black")) this->m_eValue = colortypeBlack; + else if (std::wstring::npos != sValue.find(L"blue")) this->m_eValue = colortypeBlue; + else if (std::wstring::npos != sValue.find(L"fuchsia")) this->m_eValue = colortypeFuchsia; + else if (std::wstring::npos != sValue.find(L"gray")) this->m_eValue = colortypeGray; + else if (std::wstring::npos != sValue.find(L"green")) this->m_eValue = colortypeGreen; + else if (std::wstring::npos != sValue.find(L"lime")) this->m_eValue = colortypeLime; + else if (std::wstring::npos != sValue.find(L"maroon")) this->m_eValue = colortypeMaroon; + else if (std::wstring::npos != sValue.find(L"navy")) this->m_eValue = colortypeNavy; + else if (std::wstring::npos != sValue.find(L"olive")) this->m_eValue = colortypeOlive; + else if (std::wstring::npos != sValue.find(L"purple")) this->m_eValue = colortypePurple; + else if (std::wstring::npos != sValue.find(L"red")) this->m_eValue = colortypeRed; + else if (std::wstring::npos != sValue.find(L"silver")) this->m_eValue = colortypeSilver; + else if (std::wstring::npos != sValue.find(L"teal")) this->m_eValue = colortypeTeal; + else if (std::wstring::npos != sValue.find(L"white")) this->m_eValue = colortypeWhite; + else if (std::wstring::npos != sValue.find(L"yellow")) this->m_eValue = colortypeYellow; + else if (std::wstring::npos != sValue.find(L"[") && std::wstring::npos != sValue.find(L"]")) + { + size_t p1 = sValue.find(L"["); + size_t p2 = sValue.find(L"]"); + std::wstring sIndex = p2 > p1 ? sValue.substr(p1 + 1, p2 - p1 - 1) : L""; + + if (!sIndex.empty()) + { + int index = XmlUtils::GetInteger(sIndex); + int nRGB = 0; + if (index < 64) + { + nRGB = shemeDefaultColor[index]; + } + else if (index > 64 && index < 92) + { + nRGB = controlPanelColors1[index - 65]; + } + m_unR = static_cast((nRGB >> 16) & 0xff); + m_unG = static_cast((nRGB >> 8) & 0xff); + m_unB = static_cast(nRGB & 0xff); + this->m_eValue = colortypeRGB; + } + } + + SetRGB(); + } + + EColorType CColorType::FromString(const std::wstring& sValue) + { + wchar_t wsFirstChar = 0; + if (sValue.length() > 0) + wsFirstChar = sValue[0]; + + m_sValue = sValue; + if (wsFirstChar == '#') + { + std::wstring sHexColor = sValue.substr(1); + ByHexColor(sHexColor); + } + else + ByColorName(sValue); + + return this->m_eValue; + } + + std::wstring CColorType::ToString() const + { + return m_sValue; + } + + void CColorType::SetRGB(unsigned char unR, unsigned char unG, unsigned char unB) + { + this->m_eValue = colortypeRGB; + m_unR = unR; + m_unG = unG; + m_unB = unB; + + std::wstringstream sstream; + sstream << boost::wformat( L"%02x%02x%02x" ) % m_unR % m_unG % m_unB; + m_sValue = sstream.str(); + } + + unsigned char CColorType::Get_R() const + { + return m_unR; + } + + unsigned char CColorType::Get_G() const + { + return m_unG; + } + + unsigned char CColorType::Get_B() const + { + return m_unB; + } + + unsigned char CColorType::Get_A() const + { + return 255; + } + + //-------------------------------------------------------------------------------- + // CTrueFalse 15.1.2.5 - 15.1.2.6 (Part 4) + //-------------------------------------------------------------------------------- + + ETrueFalse CTrueFalse::FromString(const std::wstring &sValue) + { + if ( L"t" == sValue ) this->m_eValue = booleanTrue; + else if ( L"true" == sValue ) this->m_eValue = booleanTrue; + else if ( L"True" == sValue ) this->m_eValue = booleanTrue; + else if ( L"" == sValue ) this->m_eValue = booleanFalse; + else if ( L"f" == sValue ) this->m_eValue = booleanFalse; + else if ( L"false" == sValue ) this->m_eValue = booleanFalse; + else if ( L"False" == sValue ) this->m_eValue = booleanFalse; + else this->m_eValue = booleanFalse; + + return this->m_eValue; + } + + bool CTrueFalse::GetBool() + { + return this->m_eValue == booleanTrue; + } + + std::wstring CTrueFalse::ToString () const + { + switch(this->m_eValue) + { + case booleanFalse : return L"f"; + case booleanTrue : return L"t"; + default : return L"f"; + } + } + + //-------------------------------------------------------------------------------- + // CSdtAppearance + //-------------------------------------------------------------------------------- + + ESdtAppearance CSdtAppearance::FromString(const std::wstring &sValue) + { + if ( L"boundingBox" == sValue ) this->m_eValue = sdtappearenceBoundingBox; + else if ( L"tags" == sValue ) this->m_eValue = sdtappearenceTags; + else if ( L"hidden" == sValue ) this->m_eValue = sdtappearenceHidden; + + return this->m_eValue; + } + + std::wstring CSdtAppearance::ToString () const + { + switch(this->m_eValue) + { + case sdtappearenceTags : return L"tags"; + case sdtappearenceHidden : return L"hidden"; + default : return L"boundingBox"; + } + } + +} // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Shared.h b/Common/DocxFormat/Source/Common/SimpleTypes_Shared.h index 472ca80927..388ad1d300 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Shared.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Shared.h @@ -32,83 +32,30 @@ #pragma once #include "SimpleTypes_Base.h" -#include "SimpleTypes_Word.h" +#include "../../../../DesktopEditor/common/Types.h" // Здесь представлены все простые типы SharedML из спецификации Office Open Xml (22.8) namespace SimpleTypes { - const static int shemeDefaultColor[] = - { - 0x00000000, 0x00FFFFFF, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00FFFF00, 0x00FF00FF, 0x0000FFFF, - 0x00000000, 0x00FFFFFF, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00FFFF00, 0x00FF00FF, 0x0000FFFF, - 0x00800000, 0x00008000, 0x00000080, 0x00808000, 0x00800080, 0x00008080, 0x00C0C0C0, 0x00808080, - 0x009999FF, 0x00993366, 0x00FFFFCC, 0x00CCFFFF, 0x00660066, 0x00FF8080, 0x000066CC, 0x00CCCCFF, - 0x00000080, 0x00FF00FF, 0x00FFFF00, 0x0000FFFF, 0x00800080, 0x00800000, 0x00008080, 0x000000FF, - 0x0000CCFF, 0x00CCFFFF, 0x00CCFFCC, 0x00FFFF99, 0x0099CCFF, 0x00FF99CC, 0x00CC99FF, 0x00FFCC99, - 0x003366FF, 0x0033CCCC, 0x0099CC00, 0x00FFCC00, 0x00FF9900, 0x00FF6600, 0x00666699, 0x00969696, - 0x00003366, 0x00339966, 0x00003300, 0x00333300, 0x00993300, 0x00993366, 0x00333399, 0x00333333 - }; - const static int controlPanelColors2[] = - { - 0x00000000, 0x00FFFFFF, 0x00000000, 0x00FFFFFF, - 0x00000000, 0x00000000, 0x00000000, 0x00FFFFFF, - 0x00FFFFFF, 0x00000000, 0x00FFFFFF, 0x00FFFFFF, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00FFFFFF, 0x00FFFFFF, 0x00FFFFFF, 0x00000000, - 0x00FFFFFF, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00FFFFFF, 0x00FFFFFF - }; - const static int controlPanelColors1[] = - { - 0x00FFFFFF, 0x00CCCCCC, 0x00FFFFFF, 0x006363CE, - 0x00DDDDDD, 0x00DDDDDD, 0x00888888, 0x00000000, - 0x00000000, 0x00808080, 0x00B5D5FF, 0x00000000, - 0x00FFFFFF, 0x00FFFFFF, 0x007F7F7F, 0x00FBFCC5, - 0x00000000, 0x00F7F7F7, 0x00000000, 0x00FFFFFF, - 0x00666666, 0x00C0C0C0, 0x00DDDDDD, 0x00C0C0C0, - 0x00888888, 0x00FFFFFF, 0x00CCCCCC, 0x00000000 - }; //-------------------------------------------------------------------------------- // RelationshipId 22.8.2.1 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CRelationshipId { public: - CRelationshipId() {} + CRelationshipId(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(const std::wstring &sValue); + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; - void SetValue(const std::wstring &sValue) - { - m_sValue = sValue; - } - - - std::wstring FromString(std::wstring &sValue) - { - m_sValue = sValue; - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CRelationshipId) + SimpleTypes_DefaultS(CRelationshipId) private: - - std::wstring m_sValue; + std::wstring m_sValue; }; - - } // SimpleTypes // Здесь представлены все простые типы SharedML из спецификации Office Open Xml (22.9) @@ -116,7 +63,8 @@ namespace SimpleTypes { //-------------------------------------------------------------------------------- // CalendarType 22.9.2.1 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ECalendarType { calendartypeGregorian = 0, @@ -135,242 +83,42 @@ namespace SimpleTypes calendartypeThai = 13 }; - template - class CCalendarType : public CSimpleType - { - public: - CCalendarType() {} - - virtual ECalendarType FromString(std::wstring &sValue) - { - if ( L"gregorian" == sValue ) this->m_eValue = calendartypeGregorian; - else if ( L"gregorianArabic" == sValue ) this->m_eValue = calendartypeGregorianArabic; - else if ( L"gregorianMeFrench" == sValue ) this->m_eValue = calendartypeGregorianMeFrench; - else if ( L"gregorianUs" == sValue ) this->m_eValue = calendartypeGregorianUs; - else if ( L"gregorianXlitEnglish" == sValue ) this->m_eValue = calendartypeGregorianXlitEnglish; - else if ( L"gregorianXlitFrench" == sValue ) this->m_eValue = calendartypeGregorianXlitFrench; - else if ( L"hebrew" == sValue ) this->m_eValue = calendartypeHebrew; - else if ( L"hijri" == sValue ) this->m_eValue = calendartypeHijri; - else if ( L"japan" == sValue ) this->m_eValue = calendartypeJapan; - else if ( L"korea" == sValue ) this->m_eValue = calendartypeKorea; - else if ( L"none" == sValue ) this->m_eValue = calendartypeNone; - else if ( L"saka" == sValue ) this->m_eValue = calendartypeSaka; - else if ( L"taiwan" == sValue ) this->m_eValue = calendartypeTaiwan; - else if ( L"thai" == sValue ) this->m_eValue = calendartypeThai; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case calendartypeGregorian : return L"gregorian"; - case calendartypeGregorianArabic : return L"gregorianArabic"; - case calendartypeGregorianMeFrench : return L"gregorianMeFrench"; - case calendartypeGregorianUs : return L"gregorianUs"; - case calendartypeGregorianXlitEnglish : return L"gregorianXlitEnglish"; - case calendartypeGregorianXlitFrench : return L"gregorianXlitFrench"; - case calendartypeHebrew : return L"hebrew"; - case calendartypeHijri : return L"hijri"; - case calendartypeJapan : return L"japan"; - case calendartypeKorea : return L"korea"; - case calendartypeNone : return L"none"; - case calendartypeSaka : return L"saka"; - case calendartypeTaiwan : return L"taiwan"; - case calendartypeThai : return L"thai"; - default : return L"none"; - } - } - - SimpleType_FromString (ECalendarType) - SimpleType_Operator_Equal (CCalendarType) - }; + DEFINE_SIMPLE_TYPE(CCalendarType, ECalendarType, calendartypeNone) //-------------------------------------------------------------------------------- // ConformanceClass 22.9.2.2 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EConformanceClass { conformanceclassStrict = 0, conformanceclassTransitional = 1 }; - template - class CConformanceClass : public CSimpleType - { - public: - CConformanceClass() {} + DEFINE_SIMPLE_TYPE(CConformanceClass, EConformanceClass, conformanceclassTransitional) - virtual EConformanceClass FromString(std::wstring &sValue) - { - if ( L"strict" == sValue ) this->m_eValue = conformanceclassStrict; - else if ( L"transitional" == sValue ) this->m_eValue = conformanceclassTransitional; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case conformanceclassStrict : return L"strict"; - case conformanceclassTransitional : return L"transitional"; - default : return L"strict"; - } - } - - SimpleType_FromString (EConformanceClass) - SimpleType_Operator_Equal (CConformanceClass) - }; //-------------------------------------------------------------------------------- // Guid 22.9.2.4 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CGuid { public: - CGuid() {} + CGuid(); - bool FromString(std::wstring &sValue) - { - // GUID "{00000000-5BD2-4BC8-9F70-7020E1357FB2}" + bool FromString(const std::wstring &sValue); + std::wstring ToString () const; - TGuid oZeroGUID = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - m_oGUID = oZeroGUID; + SimpleTypes_DefaultString(CGuid) - if ( sValue.length() != 38 ) - return false; - - T_ULONG64 unTemp = 0; + bool IsZero(); - std::wstring sMidValue; - sMidValue = sValue.substr( 1, 8 ); - - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.a = (unsigned int)unTemp; - - sMidValue = sValue.substr( 10, 4 ); - if ( !HexToInt(sMidValue, unTemp ) ) - return false; - - m_oGUID.b = (unsigned short)unTemp; - - sMidValue = sValue.substr( 15, 4 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.c = (unsigned short)unTemp; - - sMidValue = sValue.substr( 20, 2 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.d = (unsigned char)unTemp; - - - sMidValue = sValue.substr( 22, 2 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.e = (unsigned char)unTemp; - - sMidValue = sValue.substr( 25, 2 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.f = (unsigned char)unTemp; - - sMidValue = sValue.substr( 27, 2 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.g = (unsigned char)unTemp; - - sMidValue = sValue.substr( 29, 2 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.h = (unsigned char)unTemp; - - sMidValue = sValue.substr( 31, 2 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.i = (unsigned char)unTemp; - - sMidValue = sValue.substr( 33, 2 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.j = (unsigned char)unTemp; - - sMidValue = sValue.substr( 35, 2 ); - if ( !HexToInt( sMidValue, unTemp ) ) - return false; - - m_oGUID.k = (unsigned char)unTemp; - - return true; - } - - bool FromString(const std::wstring& wsStr) - { - // TO DO: переделать - std::wstring sTemp( wsStr.c_str() ); - return FromString( (std::wstring &)sTemp ); - } - bool FromString(const wchar_t* cwsStr) - { - std::wstring wsStr = cwsStr; - return FromString( (const std::wstring&)wsStr ); - } - std::wstring ToString () const - { - std::wstringstream sstream; - sstream << boost::wformat( L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" ) % m_oGUID.a % m_oGUID.b % m_oGUID.c % m_oGUID.d % m_oGUID.e % m_oGUID.f % m_oGUID.g % m_oGUID.h % m_oGUID.i % m_oGUID.j % m_oGUID.k; - return sstream.str(); - } - - SimpleType_Operator_Equal (CGuid) - - bool IsZero() - { - return 0 == m_oGUID.a && 0 == m_oGUID.b && 0 == m_oGUID.c && 0 == m_oGUID.d && 0 == m_oGUID.e && 0 == m_oGUID.f && 0 == m_oGUID.g && 0 == m_oGUID.h && 0 == m_oGUID.i && 0 == m_oGUID.j && 0 == m_oGUID.k; - } private: - bool HexToInt(std::wstring& sValue, T_ULONG64& unResult) - { - bool bResult = true; - - unResult = 0; - for ( int nIndex = (int)sValue.length() - 1, nMult = 0; nIndex >= 0; nIndex--, nMult += 4 ) - { - unResult += HexToInt( (int)sValue[nIndex], bResult ) << nMult; - } - - return bResult; - } - - int HexToInt(int nHex, bool &bResult) - { - if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); - if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); - if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); - - bResult = false; - - return 0; - } - + bool HexToInt(std::wstring& sValue, T_ULONG64& unResult); + int HexToInt(int nHex, bool &bResult); public: - struct TGuid { unsigned int a; @@ -385,106 +133,35 @@ namespace SimpleTypes unsigned char j; unsigned char k; } m_oGUID; - }; + //-------------------------------------------------------------------------------- // HexColorRGB 22.9.2.5 (Part 1) - //-------------------------------------------------------------------------------- - template - class CHexColorRGB : public CSimpleType - { + //-------------------------------------------------------------------------------- + + DEFINE_SIMPLE_TYPE_START(CHexColorRGB, int, 0) public: - CHexColorRGB() - { - m_unR = 0; - m_unG = 0; - m_unB = 0; - m_unA = 255; - } + unsigned char Get_R() const; + unsigned char Get_G() const; + unsigned char Get_B() const; + unsigned char Get_A() const; - virtual int FromString(std::wstring &sValue) - { - if ( 6 <= sValue.length() ) - { - std::wstring midString = sValue.substr( 0, 6 ); - Parse( midString ); - } - else - this->m_eValue = nDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return XmlUtils::IntToString(this->m_eValue, L"%06X"); - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CHexColorRGB) - unsigned char Get_R() const - { - return m_unR; - } - unsigned char Get_G() const - { - return m_unG; - } - - unsigned char Get_B() const - { - return m_unB; - } - unsigned char Get_A() const - { - return m_unA; - } - - void Set_RGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA = 255) - { - m_unR = unR; - m_unG = unG; - m_unB = unB; - m_unA = unA; - - this->m_eValue = ((int)m_unR << 16) + ((int)m_unG << 8) + m_unB; - } + void Set_RGBA(unsigned char unR, unsigned char unG, unsigned char unB, unsigned char unA = 255); private: - - void Parse(std::wstring& sValue) - { - if ( sValue.length() < 6 ) - return; - - m_unR = HexToInt( (int)sValue[1] ) + (unsigned char)(HexToInt( (int)sValue[0] ) << 4); - m_unG = HexToInt( (int)sValue[3] ) + (unsigned char)(HexToInt( (int)sValue[2] ) << 4); - m_unB = HexToInt( (int)sValue[5] ) + (unsigned char)(HexToInt( (int)sValue[4] ) << 4); - m_unA = 255; - - this->m_eValue = ((int)m_unR << 16) + ((int)m_unG << 8) + m_unB; - } - - int HexToInt(int nHex) - { - if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); - if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); - if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); - - return 0; - } + void Parse(const std::wstring& sValue); + int HexToInt(int nHex); private: - - unsigned char m_unR; - unsigned char m_unG; - unsigned char m_unB; - unsigned char m_unA; + unsigned char m_unR = 0; + unsigned char m_unG = 0; + unsigned char m_unB = 0; + unsigned char m_unA = 255; }; //-------------------------------------------------------------------------------- // Lang 22.9.2.6 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- // TO DO: сделать парсер языка по спецификации RFC 4646/BCP 47 //class CLang @@ -492,41 +169,41 @@ namespace SimpleTypes //public: // CLang() {} - // std::wstring GetValue() const + // std::wstring GetValue() const // { // return m_sValue; // } - // void SetValue(std::wstring &sValue) + // void SetValue(std::wstring &sValue) // { // m_sValue = sValue; // } - // std::wstring FromString(std::wstring &sValue) + // std::wstring FromString(const std::wstring &sValue) // { // m_sValue = sValue; // return m_sValue; // } - // std::wstring ToString () const + // std::wstring ToString () const // { // return m_sValue; // } - // SimpleType_FromString2 (std::wstring) - // SimpleType_Operator_Equal (CLang) + // SimpleType_FromString2 (std::wstring) + // SimpleTypes_Default(CLang) //private: - // std::wstring m_sValue; + // std::wstring m_sValue; //}; //-------------------------------------------------------------------------------- // OnOff 22.9.2.7 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- // Согласно части 4 стр. 1459, значений "on" и "off" быть не должно enum EOnOff @@ -536,182 +213,40 @@ namespace SimpleTypes }; enum EOnOffToString { - onofftostringTrue = 0, - onofftostringT = 1, - onofftostringOn = 2, - onofftostring1 = 3 - }; - template - class COnOff : public CSimpleType - { + onofftostringTrue = 0, + onofftostringT = 1, + onofftostringOn = 2, + onofftostring1 = 3 + }; + + DEFINE_SIMPLE_TYPE_START(COnOff, EOnOff, onoffFalse) public: - COnOff() {} - - COnOff(const bool & bVal) - { - this->m_eValue = (false != bVal) ? onoffTrue : onoffFalse; - } + COnOff(const bool & bVal); - virtual EOnOff FromString(std::wstring &sValue) - { - if ( L"true" == sValue ) this->m_eValue = onoffTrue; - else if ( L"True" == sValue ) this->m_eValue = onoffTrue; - else if ( L"1" == sValue ) this->m_eValue = onoffTrue; - else if ( L"t" == sValue ) this->m_eValue = onoffTrue; - else if ( L"on" == sValue ) this->m_eValue = onoffTrue; - else if ( L"f" == sValue ) this->m_eValue = onoffFalse; - else if ( L"0" == sValue ) this->m_eValue = onoffFalse; - else if ( L"false" == sValue ) this->m_eValue = onoffFalse; - else if ( L"False" == sValue ) this->m_eValue = onoffFalse; - else if ( L"off" == sValue ) this->m_eValue = onoffFalse; - else this->m_eValue = eDefValue; + //EOnOff FromStringA(const std::string& sValue); + //EOnOff FromStringA(const char* sValue); - return this->m_eValue; - } - virtual EOnOff FromStringA(const char* sValue) - { - if (strcmp("1", sValue) == 0) this->m_eValue = onoffTrue; - else if (strcmp("0", sValue) == 0) this->m_eValue = onoffFalse; - else if (strcmp("true", sValue) == 0) this->m_eValue = onoffTrue; - else if (strcmp("True", sValue) == 0) this->m_eValue = onoffTrue; - else if (strcmp("t", sValue) == 0) this->m_eValue = onoffTrue; - else if (strcmp("on", sValue) == 0) this->m_eValue = onoffTrue; - else if (strcmp("f", sValue) == 0) this->m_eValue = onoffFalse; - else if (strcmp("false", sValue) == 0) this->m_eValue = onoffFalse; - else if (strcmp("False", sValue) == 0) this->m_eValue = onoffFalse; - else if (strcmp("off", sValue) == 0) this->m_eValue = onoffFalse; - else this->m_eValue = eDefValue; + std::wstring ToString2(EOnOffToString eType) const; + std::wstring ToString3(EOnOffToString eType) const; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case onoffFalse : return L"false"; - case onoffTrue : return L"true"; - default : return L"false"; - } - } - std::wstring ToString2(EOnOffToString eType) const - { - if (onofftostringTrue == eType) - { - switch (this->m_eValue) - { - case onoffFalse: return L"false"; - case onoffTrue: return L"true"; - default: return L"false"; - } - } - else if (onofftostring1 == eType) - { - switch (this->m_eValue) - { - case onoffFalse: return L"0"; - case onoffTrue: return L"1"; - default: return L"0"; - } - } - else if (onofftostringOn == eType) - { - switch (this->m_eValue) - { - case onoffFalse: return L"off"; - case onoffTrue: return L"on"; - default: return L"off"; - } - } - else if (onofftostringT == eType) - { - switch (this->m_eValue) - { - case onoffFalse: return L"f"; - case onoffTrue: return L"t"; - default: return L"f"; - } - } - return L"false"; - } - std::wstring ToString3(EOnOffToString eType) const - { - if(onofftostringTrue == eType) - { - switch(this->m_eValue) - { - case onoffFalse : return L"false"; - case onoffTrue : return L"true"; - default : return L"false"; - } - } - else if(onofftostring1 == eType) - { - switch(this->m_eValue) - { - case onoffFalse : return L"0"; - case onoffTrue : return L"1"; - default : return L"0"; - } - } - else if(onofftostringOn == eType) - { - switch(this->m_eValue) - { - case onoffFalse : return L"off"; - case onoffTrue : return L"on"; - default : return L"off"; - } - } - else if(onofftostringT == eType) - { - switch(this->m_eValue) - { - case onoffFalse : return L"f"; - case onoffTrue : return L"t"; - default : return L"f"; - } - } - return L"false"; - } - bool ToBool() - { - return onoffTrue == this->m_eValue; - } - void FromBool(bool bVal) - { - this->m_eValue = (false != bVal) ? onoffTrue : onoffFalse; - } - - SimpleType_FromString (EOnOff) - SimpleType_Operator_Equal (COnOff) + bool ToBool(); + void FromBool(bool bVal); }; - class CBool : public COnOff<> + //-------------------------------------------------------------------------------- + // Bool + //-------------------------------------------------------------------------------- + + class CBool : public COnOff { public: - CBool() {} + CBool(); + CBool(const bool & bVal); - CBool(const bool & bVal) - { - this->m_eValue = (false != bVal) ? onoffTrue : onoffFalse; - } - virtual std::wstring ToString() const - { - switch (m_eValue) - { - case onoffTrue: return L"1"; - case onoffFalse: - default: return L"0"; - } - } - virtual EOnOff FromString(std::wstring &sValue) - { - return COnOff<>::FromString(sValue); - } + virtual std::wstring ToString() const; + virtual EOnOff FromString(const std::wstring &sValue); - SimpleType_FromString(EOnOff) - SimpleType_Operator_Equal(CBool) + SimpleTypes_Default(CBool) }; //-------------------------------------------------------------------------------- @@ -721,187 +256,60 @@ namespace SimpleTypes class CPanose { public: - CPanose() {} + CPanose(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - void SetValue(std::wstring &sValue) - { - m_sValue = sValue; - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + SimpleTypes_DefaultS(CPanose) - std::wstring FromString(std::wstring &sValue) - { - if ( 20 > sValue.length() ) - { - m_sValue = sValue; - for ( size_t nIndex = 0; nIndex < 20 - sValue.length(); nIndex++ ) - { - m_sValue += L"0"; - } - } - else if ( 20 == sValue.length() ) - m_sValue = sValue; - else - { - m_sValue = sValue.substr( 0, 20 ); - } - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CPanose) - - unsigned char Get_Number(int nIndex) - { - if ( m_sValue.length() < 20 ) - return 0; - - nIndex = (std::max)( 0, (std::min)( 9, nIndex ) ); - - unsigned int unChar1 = XmlUtils::GetDigit( m_sValue[2 * nIndex] ); - unsigned int unChar2 = XmlUtils::GetDigit( m_sValue[2 * nIndex + 1] ); - - return (unChar2 + (unsigned char)(unChar1 << 4)); - } + unsigned char Get_Number(int nIndex); private: - - std::wstring m_sValue; + std::wstring m_sValue; }; - //-------------------------------------------------------------------------------- // String 22.9.2.13 (Part 1) //-------------------------------------------------------------------------------- - // Ничего не делаем, используем ATL::std::wstring + // Ничего не делаем, используем ATL::std::wstring //-------------------------------------------------------------------------------- // TwipsMeasure 22.9.2.14 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CTwipsMeasure : public CUniversalMeasure { public: - CTwipsMeasure() {} + CTwipsMeasure(); - virtual double FromString(std::wstring &sValue) - { - Parse(sValue, 20); + virtual double FromString(const std::wstring &sValue); + virtual void SetValue(double dValue); + virtual std::wstring ToString() const; - // В данном типе только положительные числа - m_dValue = fabs( m_dValue ); + virtual double FromPoints(double dValue); + virtual double FromInches(double dValue); - return m_dValue; - } - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = FromTwips(dValue); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_bUnit ) - sResult = boost::lexical_cast( m_dValue ) + L"pt"; - else - sResult = std::to_wstring( (int)(m_dValue * 20) ); - - return sResult; - } - - virtual double FromPoints(double dValue) - { - m_dValue = fabs( dValue ); - return m_dValue; - } - virtual double FromInches(double dValue) - { - m_dValue = fabs( dValue ) * 72; - return m_dValue; - } - - - - SimpleType_FromString (double) - SimpleType_Operator_Equal (CTwipsMeasure) - UniversalMeasure_AdditionalOpearators(CTwipsMeasure) + SimpleTypes_DefaultD(CTwipsMeasure) }; - - - //-------------------------------------------------------------------------------- // UnsignedDecimalNumber 22.9.2.16 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - template - class CUnsignedDecimalNumber : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CUnsignedDecimalNumber, unsigned int, 0) public: - CUnsignedDecimalNumber() {} - - CUnsignedDecimalNumber(const CUnsignedDecimalNumber& obj) - { - this->m_eValue = obj.m_eValue; - } - CUnsignedDecimalNumber(const unsigned int& val) - { - this->m_eValue = val; - } - CUnsignedDecimalNumber(const _INT32& val) - { - this->m_eValue = (unsigned int)val; - } - virtual unsigned int FromString(std::wstring &sValue) - { - - try - { - this->m_eValue = _wtoi( sValue.c_str() ); - return this->m_eValue; - } - catch(...) - { - } - - try - { - this->m_eValue = static_cast(_wtoi64(sValue.c_str())); - } - catch(...) - { - this->m_eValue = 0; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return std::to_wstring( this->m_eValue); - } - - - SimpleType_FromString (unsigned int) - SimpleType_Operator_Equal (CUnsignedDecimalNumber) + CUnsignedDecimalNumber(const CUnsignedDecimalNumber& obj); + CUnsignedDecimalNumber(const int& val); }; //-------------------------------------------------------------------------------- // VerticalAlignRun 22.9.2.17 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EVerticalAlignRun { @@ -910,41 +318,11 @@ namespace SimpleTypes verticalalignrunSuperscript = 2 }; - template - class CVerticalAlignRun : public CSimpleType - { - public: - CVerticalAlignRun() {} - - virtual EVerticalAlignRun FromString(std::wstring &sValue) - { - if ( L"baseline" == sValue || L"None" == sValue) this->m_eValue = verticalalignrunBaseline; - else if ( L"subscript" == sValue || L"Subscript" == sValue) this->m_eValue = verticalalignrunSubscript; - else if ( L"superscript" == sValue || L"Superscript" == sValue) this->m_eValue = verticalalignrunSuperscript; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case verticalalignrunBaseline : return L"baseline"; - case verticalalignrunSubscript : return L"subscript"; - case verticalalignrunSuperscript : return L"superscript"; - default : return L"baseline"; - } - } - - SimpleType_FromString (EVerticalAlignRun) - SimpleType_Operator_Equal (CVerticalAlignRun) - }; - + DEFINE_SIMPLE_TYPE(CVerticalAlignRun, EVerticalAlignRun, verticalalignrunBaseline) //-------------------------------------------------------------------------------- // XAlign 22.9.2.18 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EXAlign { @@ -955,47 +333,11 @@ namespace SimpleTypes xalignRight = 4 }; - template - class CXAlign : public CSimpleType - { - public: - CXAlign() {} - - virtual EXAlign FromString(std::wstring &sValue) - { - if ( L"center" == sValue ) this->m_eValue = xalignCenter; - else if ( L"inside" == sValue ) this->m_eValue = xalignInside; - else if ( L"left" == sValue ) this->m_eValue = xalignLeft; - else if ( L"outside" == sValue ) this->m_eValue = xalignOutside; - else if ( L"right" == sValue ) this->m_eValue = xalignRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case xalignCenter : return L"center"; - case xalignInside : return L"inside"; - case xalignLeft : return L"left"; - case xalignOutside : return L"outside"; - case xalignRight : return L"right"; - default : return L"left"; - } - } - - SimpleType_FromString (EXAlign) - SimpleType_Operator_Equal (CXAlign) - }; - - - + DEFINE_SIMPLE_TYPE(CXAlign, EXAlign, xalignLeft) //-------------------------------------------------------------------------------- // YAlign 22.9.2.20 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EYAlign { @@ -1007,47 +349,7 @@ namespace SimpleTypes yalignTop = 5 }; - template - class CYAlign : public CSimpleType - { - public: - CYAlign() {} - - virtual EYAlign FromString(std::wstring &sValue) - { - if ( L"bottom" == sValue ) this->m_eValue = yalignBottom; - else if ( L"bot" == sValue ) this->m_eValue = yalignBottom; - else if ( L"center" == sValue ) this->m_eValue = yalignCenter; - else if ( L"inline" == sValue ) this->m_eValue = yalignInline; - else if ( L"inside" == sValue ) this->m_eValue = yalignInside; - else if ( L"outside" == sValue ) this->m_eValue = yalignOutside; - else if ( L"top" == sValue ) this->m_eValue = yalignTop; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case yalignBottom : return L"bottom"; - case yalignCenter : return L"center"; - case yalignInline : return L"inline"; - case yalignInside : return L"inside"; - case yalignOutside : return L"outside"; - case yalignTop : return L"top"; - default : return L"top"; - } - } - - SimpleType_FromString (EYAlign) - SimpleType_Operator_Equal (CYAlign) - }; - - - - + DEFINE_SIMPLE_TYPE(CYAlign, EYAlign, yalignTop) } // SimpleTypes @@ -1057,6 +359,7 @@ namespace SimpleTypes //-------------------------------------------------------------------------------- // ColorType 15.1.2.3 (Part 4) //-------------------------------------------------------------------------------- + enum EColorType { colortypeNone, @@ -1078,304 +381,50 @@ namespace SimpleTypes colortypeWhite, colortypeYellow, }; - template - class CColorType : public CSimpleType - { - public: - CColorType() - { - SetRGB(); - std::wstringstream sstream; - sstream << boost::wformat( L"%02x%02x%02x" ) % m_unR % m_unG % m_unB; - m_sValue = sstream.str(); - } - - virtual EColorType FromString(std::wstring& sValue) - { - wchar_t wsFirstChar = 0; - if (sValue.length() > 0) - wsFirstChar = sValue[0]; - - m_sValue = sValue; - if (wsFirstChar == _T('#')) - { - std::wstring sHexColor = sValue.substr(1); - ByHexColor(sHexColor); - } - else - ByColorName(sValue); - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - return m_sValue; - } - - void SetRGB(unsigned char unR, unsigned char unG, unsigned char unB) - { - this->m_eValue = colortypeRGB; - m_unR = unR; - m_unG = unG; - m_unB = unB; - - std::wstringstream sstream; - sstream << boost::wformat( L"%02x%02x%02x" ) % m_unR % m_unG % m_unB; - m_sValue = sstream.str(); - } - - SimpleType_FromString (EColorType) - SimpleType_Operator_Equal (CColorType) - - unsigned char Get_R() const - { - return m_unR; - } - unsigned char Get_G() const - { - return m_unG; - } - - unsigned char Get_B() const - { - return m_unB; - } - unsigned char Get_A() const - { - return 255; - } + DEFINE_SIMPLE_TYPE_START_NC(CColorType, EColorType, colortypeNone) + public: + CColorType(); + void SetRGB(unsigned char unR, unsigned char unG, unsigned char unB); + unsigned char Get_R() const; + unsigned char Get_G() const; + unsigned char Get_B() const; + unsigned char Get_A() const; private: - void ByHexColor(std::wstring& sValue) - { - this->m_eValue = colortypeRGB; - - CHexColor<> hexColor; - hexColor.FromString(sValue); - - m_unR = hexColor.Get_R(); - m_unG = hexColor.Get_G(); - m_unB = hexColor.Get_B(); - } - void SetRGB() - { - if (this->m_eValue == colortypeRGB) return; - - switch(this->m_eValue) - { - case colortypeAqua: - { - m_unR = 0x00; - m_unG = 0xff; - m_unB = 0xff; - }break; - case colortypeBlack: - { - m_unR = 0x00; - m_unG = 0x00; - m_unB = 0x00; - }break; - case colortypeBlue: - { - m_unR = 0x00; - m_unG = 0x00; - m_unB = 0xff; - }break; - case colortypeFuchsia: - { - m_unR = 0xff; - m_unG = 0x00; - m_unB = 0xff; - }break; - case colortypeGray: - { - m_unR = 0x80; - m_unG = 0x80; - m_unB = 0x80; - }break; - case colortypeGreen: - { - m_unR = 0x00; - m_unG = 0x80; - m_unB = 0x00; - }break; - case colortypeLime: - { - m_unR = 0x00; - m_unG = 0xff; - m_unB = 0x00; - }break; - case colortypeMaroon: - { - m_unR = 0x80; - m_unG = 0x00; - m_unB = 0x00; - }break; - case colortypeNavy: - { - m_unR = 0x00; - m_unG = 0x00; - m_unB = 0x80; - }break; - case colortypeOlive: - { - m_unR = 0x80; - m_unG = 0x80; - m_unB = 0x00; - }break; - case colortypePurple: - { - m_unR = 0x80; - m_unG = 0x00; - m_unB = 0x80; - }break; - case colortypeRed: - { - m_unR = 0xff; - m_unG = 0x00; - m_unB = 0x00; - }break; - case colortypeSilver: - { - m_unR = 0xc0; - m_unG = 0xc0; - m_unB = 0xc0; - }break; - case colortypeTeal: - { - m_unR = 0x00; - m_unG = 0x80; - m_unB = 0x80; - }break; - case colortypeWhite: - { - m_unR = 0xff; - m_unG = 0xff; - m_unB = 0xff; - }break; - case colortypeYellow: - { - m_unR = 0xff; - m_unG = 0xff; - m_unB = 0; - }break; - case colortypeNone: - default: - { - m_unR = 0; - m_unG = 0; - m_unB = 0; - }break; - } - } - void ByColorName(std::wstring& sValue) - { - this->m_eValue = colortypeNone; - - if (std::wstring::npos != sValue.find(L"aqua")) this->m_eValue = colortypeAqua; - else if (std::wstring::npos != sValue.find(L"black")) this->m_eValue = colortypeBlack; - else if (std::wstring::npos != sValue.find(L"blue")) this->m_eValue = colortypeBlue; - else if (std::wstring::npos != sValue.find(L"fuchsia")) this->m_eValue = colortypeFuchsia; - else if (std::wstring::npos != sValue.find(L"gray")) this->m_eValue = colortypeGray; - else if (std::wstring::npos != sValue.find(L"green")) this->m_eValue = colortypeGreen; - else if (std::wstring::npos != sValue.find(L"lime")) this->m_eValue = colortypeLime; - else if (std::wstring::npos != sValue.find(L"maroon")) this->m_eValue = colortypeMaroon; - else if (std::wstring::npos != sValue.find(L"navy")) this->m_eValue = colortypeNavy; - else if (std::wstring::npos != sValue.find(L"olive")) this->m_eValue = colortypeOlive; - else if (std::wstring::npos != sValue.find(L"purple")) this->m_eValue = colortypePurple; - else if (std::wstring::npos != sValue.find(L"red")) this->m_eValue = colortypeRed; - else if (std::wstring::npos != sValue.find(L"silver")) this->m_eValue = colortypeSilver; - else if (std::wstring::npos != sValue.find(L"teal")) this->m_eValue = colortypeTeal; - else if (std::wstring::npos != sValue.find(L"white")) this->m_eValue = colortypeWhite; - else if (std::wstring::npos != sValue.find(L"yellow")) this->m_eValue = colortypeYellow; - else if (std::wstring::npos != sValue.find(L"[") && std::wstring::npos != sValue.find(L"]")) - { - size_t p1 = sValue.find(L"["); - size_t p2 = sValue.find(L"]"); - std::wstring sIndex = p2 > p1 ? sValue.substr(p1 + 1, p2 - p1 - 1) : L""; - - if (!sIndex.empty()) - { - int index = XmlUtils::GetInteger(sIndex); - int nRGB = 0; - if (index < 64) - { - nRGB = shemeDefaultColor[index]; - } - else if (index > 64 && index < 92) - { - nRGB = controlPanelColors1[index - 65]; - } - m_unR = static_cast((nRGB >> 16) & 0xff); - m_unG = static_cast((nRGB >> 8) & 0xff); - m_unB = static_cast(nRGB & 0xff); - this->m_eValue = colortypeRGB; - } - } - - SetRGB(); - } + void ByHexColor(const std::wstring& sValue); + void SetRGB(); + void ByColorName(const std::wstring& sValue); private: - - std::wstring m_sValue; + std::wstring m_sValue; unsigned char m_unR; unsigned char m_unG; - unsigned char m_unB; + unsigned char m_unB; }; + //-------------------------------------------------------------------------------- // CTrueFalse 15.1.2.5 - 15.1.2.6 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETrueFalse { booleanFalse = 0, booleanTrue = 1 - }; + }; - template - class CTrueFalse : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CTrueFalse, ETrueFalse, booleanFalse) public: - CTrueFalse() {} - - virtual ETrueFalse FromString(std::wstring &sValue) - { - if ( L"t" == sValue ) this->m_eValue = booleanTrue; - else if ( L"true" == sValue ) this->m_eValue = booleanTrue; - else if ( L"True" == sValue ) this->m_eValue = booleanTrue; - else if ( L"" == sValue ) this->m_eValue = booleanFalse; - else if ( L"f" == sValue ) this->m_eValue = booleanFalse; - else if ( L"false" == sValue ) this->m_eValue = booleanFalse; - else if ( L"False" == sValue ) this->m_eValue = booleanFalse; - else this->m_eValue = booleanFalse; - - return this->m_eValue; - } - - bool GetBool() - { - return this->m_eValue == booleanTrue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case booleanFalse : return L"f"; - case booleanTrue : return L"t"; - default : return L"f"; - } - } - - SimpleType_FromString (ETrueFalse) - SimpleType_Operator_Equal (CTrueFalse) + bool GetBool(); }; + + //-------------------------------------------------------------------------------- + // SdtAppearance + //-------------------------------------------------------------------------------- + enum ESdtAppearance { sdtappearenceTags = 0, @@ -1383,32 +432,6 @@ namespace SimpleTypes sdtappearenceHidden = 2 }; - template - class CSdtAppearance : public CSimpleType - { - public: - CSdtAppearance() {} + DEFINE_SIMPLE_TYPE(CSdtAppearance, ESdtAppearance, sdtappearenceBoundingBox) - virtual ESdtAppearance FromString(std::wstring &sValue) - { - if ( L"boundingBox" == sValue ) this->m_eValue = sdtappearenceBoundingBox; - else if ( L"tags" == sValue ) this->m_eValue = sdtappearenceTags; - else if ( L"hidden" == sValue ) this->m_eValue = sdtappearenceHidden; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case sdtappearenceTags : return L"tags"; - case sdtappearenceHidden : return L"hidden"; - default : return L"boundingBox"; - } - } - - SimpleType_FromString (ESdtAppearance) - SimpleType_Operator_Equal (CSdtAppearance) - }; } // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Spreadsheet.cpp b/Common/DocxFormat/Source/Common/SimpleTypes_Spreadsheet.cpp new file mode 100644 index 0000000000..3cf56a8558 --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Spreadsheet.cpp @@ -0,0 +1,3191 @@ +/* + * (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_Spreadsheet.h" +#include "../Base/Unit.h" + +namespace SimpleTypes +{ + namespace Spreadsheet + { + ETableType CTableType::FromString(const std::wstring &sValue) + { + if ( L"queryTable" == sValue ) this->m_eValue = typeQueryTable; + else if ( L"worksheet" == sValue ) this->m_eValue = typeWorksheet; + else if ( L"xml" == sValue ) this->m_eValue = typeXml; + else this->m_eValue = typeWorksheet; + + return this->m_eValue; + } + + std::wstring CTableType::ToString () const + { + switch(this->m_eValue) + { + case typeQueryTable : return L"queryTable"; + case typeXml : return L"xml"; + case typeWorksheet : + default : return L"worksheet"; + + } + } + + EExternalConnectionType CExternalConnectionType::FromString(const std::wstring &sValue) + { + if ( L"general" == sValue ) this->m_eValue = extConnTypeGeneral; + else if ( L"text" == sValue ) this->m_eValue = extConnTypeText; + else if ( L"MDY" == sValue ) this->m_eValue = extConnTypeMDY; + else if ( L"DMY" == sValue ) this->m_eValue = extConnTypeDMY; + else if ( L"YMD" == sValue ) this->m_eValue = extConnTypeYMD; + else if ( L"MYD" == sValue ) this->m_eValue = extConnTypeMYD; + else if ( L"DYM" == sValue ) this->m_eValue = extConnTypeDYM; + else if ( L"YDM" == sValue ) this->m_eValue = extConnTypeYDM; + else if ( L"skip" == sValue ) this->m_eValue = extConnTypeSkip; + else if ( L"EMD" == sValue ) this->m_eValue = extConnTypeEMD; + else this->m_eValue = extConnTypeGeneral; + + return this->m_eValue; + } + + std::wstring CExternalConnectionType::ToString () const + { + switch(this->m_eValue) + { + case extConnTypeText: return L"text"; + case extConnTypeMDY: return L"MDY"; + case extConnTypeDMY: return L"DMY"; + case extConnTypeYMD: return L"YMD"; + case extConnTypeMYD: return L"MYD"; + case extConnTypeDYM: return L"DYM"; + case extConnTypeYDM: return L"YDM"; + case extConnTypeSkip: return L"stored"; + case extConnTypeGeneral: + default : return L"general"; + + } + } + + ECredMethod CCredMethod::FromString(const std::wstring &sValue) + { + if ( L"integrated" == sValue ) this->m_eValue = integrated_method; + else if ( L"none" == sValue ) this->m_eValue = none_method; + else if ( L"prompt" == sValue ) this->m_eValue = prompt_method; + else if ( L"stored" == sValue ) this->m_eValue = stored_method; + else this->m_eValue = integrated_method; + + return this->m_eValue; + } + + std::wstring CCredMethod::ToString () const + { + switch(this->m_eValue) + { + case none_method: return L"none"; + case prompt_method: return L"prompt"; + case stored_method: return L"stored"; + case integrated_method: + default : return L"integrated"; + + } + } + + EVisibleType CVisibleType::FromString(const std::wstring &sValue) + { + if ( L"hidden" == sValue ) this->m_eValue = visibleHidden; + else if ( L"veryHidden" == sValue ) this->m_eValue = visibleVeryHidden; + else if ( L"visible" == sValue ) this->m_eValue = visibleVisible; + else this->m_eValue = visibleVisible; + + return this->m_eValue; + } + + std::wstring CVisibleType::ToString () const + { + switch(this->m_eValue) + { + case visibleHidden : return L"hidden"; + case visibleVeryHidden : return L"veryHidden"; + case visibleVisible : + default : return L"visible"; + } + } + + EHtmlFormat CHtmlFormat::FromString(const std::wstring &sValue) + { + if ( L"none" == sValue ) this->m_eValue = htmlNone; + else if ( L"veryHidden" == sValue ) this->m_eValue = htmlRtf; + else if ( L"visible" == sValue ) this->m_eValue = htmlAll; + else this->m_eValue = htmlNone; + + return this->m_eValue; + } + + std::wstring CHtmlFormat::ToString () const + { + switch(this->m_eValue) + { + case htmlNone : return L"none"; + case htmlRtf : return L"rtf"; + case htmlAll : return L"all"; + default : return L"none"; + } + } + + EParameterType CParameterType::FromString(const std::wstring &sValue) + { + if ( L"promt" == sValue ) this->m_eValue = parameterPrompt; + else if ( L"value" == sValue ) this->m_eValue = parameterValue; + else if ( L"cell" == sValue ) this->m_eValue = parameterCell; + else this->m_eValue = parameterPrompt; + + return this->m_eValue; + } + + std::wstring CParameterType::ToString () const + { + switch(this->m_eValue) + { + case parameterValue : return L"value"; + case parameterCell : return L"cell"; + case parameterPrompt : + default : return L"promt"; + } + } + + EQualifier CQualifier::FromString(const std::wstring &sValue) + { + if ( L"doubleQuote" == sValue ) this->m_eValue = doubleQuote; + else if ( L"singleQuote" == sValue ) this->m_eValue = singleQuote; + else if ( L"none" == sValue ) this->m_eValue = noneQuote; + else this->m_eValue = doubleQuote; + + return this->m_eValue; + } + + std::wstring CQualifier::ToString () const + { + switch(this->m_eValue) + { + case noneQuote : return L"none"; + case singleQuote : return L"singleQuote"; + case doubleQuote : + default : return L"doubleQuote"; + } + } + + EFileType CFileType::FromString(const std::wstring &sValue) + { + if ( L"win" == sValue ) this->m_eValue = fileTypeWin; + else if ( L"mac" == sValue ) this->m_eValue = fileTypeMac; + else if ( L"lin" == sValue ) this->m_eValue = fileTypeLin; + else if ( L"dos" == sValue ) this->m_eValue = fileTypeDos; + else if ( L"other" == sValue ) this->m_eValue = fileTypeOther; + else this->m_eValue = fileTypeWin; + + return this->m_eValue; + } + + std::wstring CFileType::ToString () const + { + switch(this->m_eValue) + { + case fileTypeMac : return L"mac"; + case fileTypeDos : return L"dos"; + case fileTypeLin : return L"lin"; + case fileTypeOther : return L"other"; + case fileTypeWin : + default : return L"win"; + } + } + + EPhoneticAlignmentType CPhoneticAlignment::FromString(const std::wstring &sValue) + { + if ( L"center" == sValue ) this->m_eValue = phoneticalignmentCenter; + else if ( L"distributed"== sValue ) this->m_eValue = phoneticalignmentDistributed; + else if ( L"left" == sValue ) this->m_eValue = phoneticalignmentLeft; + else if ( L"noControl" == sValue ) this->m_eValue = phoneticalignmentNoControl; + else this->m_eValue = phoneticalignmentNoControl; + + return this->m_eValue; + } + + std::wstring CPhoneticAlignment::ToString () const + { + switch(this->m_eValue) + { + case phoneticalignmentCenter : return L"center"; + case phoneticalignmentDistributed : return L"distributed"; + case phoneticalignmentLeft : return L"left"; + case phoneticalignmentNoControl : + default : return L"noControl"; + } + } + + EPhoneticTypeType CPhoneticType::FromString(const std::wstring &sValue) + { + if ( L"fullwidthKatakana" == sValue ) this->m_eValue = phonetictypeFullwidthKatakana; + else if ( L"halfwidthKatakana" == sValue ) this->m_eValue = phonetictypeHalfwidthKatakana; + else if ( L"hiragana" == sValue ) this->m_eValue = phonetictypeHiragana; + else if ( L"noConversion" == sValue ) this->m_eValue = phonetictypeNoConversion; + else this->m_eValue = phonetictypeNoConversion; + + return this->m_eValue; + } + + std::wstring CPhoneticType::ToString () const + { + switch(this->m_eValue) + { + case phonetictypeFullwidthKatakana : return L"fullwidthKatakana"; + case phonetictypeHalfwidthKatakana : return L"halfwidthKatakana"; + case phonetictypeHiragana : return L"hiragana"; + case phonetictypeNoConversion : + default : return L"noConversion"; + } + } + + EFontCharset CFontCharset::FromString(const std::wstring &sValue) + { + int nCharset = XmlUtils::GetInteger(sValue.c_str()); + switch(nCharset) + { + case 0: this->m_eValue = fontcharsetANSI;break; + case 1: this->m_eValue = fontcharsetDefault;break; + case 2: this->m_eValue = fontcharsetSymbol;break; + case 77: this->m_eValue = fontcharsetMacintosh;break; + case 128: this->m_eValue = fontcharsetShitJIS;break; + case 129: this->m_eValue = fontcharsetHangeul;break; + case 130: this->m_eValue = fontcharsetJohab;break; + case 134: this->m_eValue = fontcharsetGB2313;break; + case 136: this->m_eValue = fontcharsetChineseBig5;break; + case 161: this->m_eValue = fontcharsetGreek;break; + case 162: this->m_eValue = fontcharsetTurkish;break; + case 163: this->m_eValue = fontcharsetVietnamese;break; + case 177: this->m_eValue = fontcharsetHebrew;break; + case 178: this->m_eValue = fontcharsetArabic;break; + case 186: this->m_eValue = fontcharsetBaltic;break; + case 204: this->m_eValue = fontcharsetRussian;break; + case 222: this->m_eValue = fontcharsetThai;break; + case 238: this->m_eValue = fontcharsetEastEurope;break; + case 255: this->m_eValue = fontcharsetOEM;break; + default:this->m_eValue = fontcharsetANSI; + } + + return this->m_eValue; + } + + std::wstring CFontCharset::ToString () const + { + return std::to_wstring( this->m_eValue); + } + + std::wstring CFontCharset::ToHexString () const + { + std::wstring sRes; + switch(this->m_eValue) + { + case fontcharsetANSI: sRes = L"00";break; + case fontcharsetDefault: sRes = L"01";break; + case fontcharsetSymbol: sRes = L"02";break; + case fontcharsetMacintosh: sRes = L"4D";break; + case fontcharsetShitJIS: sRes = L"80";break; + case fontcharsetHangeul: sRes = L"81";break; + case fontcharsetJohab: sRes = L"82";break; + case fontcharsetGB2313: sRes = L"86";break; + case fontcharsetChineseBig5: sRes = L"88";break; + case fontcharsetGreek: sRes = L"A1";break; + case fontcharsetTurkish: sRes = L"A2";break; + case fontcharsetVietnamese: sRes = L"A3";break; + case fontcharsetHebrew: sRes = L"B1";break; + case fontcharsetArabic: sRes = L"B2";break; + case fontcharsetBaltic: sRes = L"BA";break; + case fontcharsetRussian: sRes = L"CC";break; + case fontcharsetThai: sRes = L"DE";break; + case fontcharsetEastEurope: sRes = L"EE";break; + case fontcharsetOEM: sRes = L"FF";break; + } + return sRes; + } + + EThemeColor CThemeColor::FromString(const std::wstring &sValue) + { + int nThemeColor = XmlUtils::GetInteger(sValue); + switch(nThemeColor) + { + case 0:this->m_eValue = themecolorLight1;break; + case 1:this->m_eValue = themecolorDark1;break; + case 2:this->m_eValue = themecolorLight2;break; + case 3:this->m_eValue = themecolorDark2;break; + case 4:this->m_eValue = themecolorAccent1;break; + case 5:this->m_eValue = themecolorAccent2;break; + case 6:this->m_eValue = themecolorAccent3;break; + case 7:this->m_eValue = themecolorAccent4;break; + case 8:this->m_eValue = themecolorAccent5;break; + case 9:this->m_eValue = themecolorAccent6;break; + case 10:this->m_eValue = themecolorHyperlink;break; + case 11:this->m_eValue = themecolorFollowedHyperlink;break; + default:this->m_eValue = themecolorDark1; + } + return this->m_eValue; + } + + std::wstring CThemeColor::ToString () const + { + switch(this->m_eValue) + { + case themecolorLight1: return L"lt1"; + case themecolorDark1: return L"dk1"; + case themecolorLight2: return L"lt2"; + case themecolorDark2: return L"dk2"; + case themecolorAccent1: return L"accent1"; + case themecolorAccent2: return L"accent2"; + case themecolorAccent3: return L"accent3"; + case themecolorAccent4: return L"accent4"; + case themecolorAccent5: return L"accent5"; + case themecolorAccent6: return L"accent6"; + case themecolorHyperlink: return L"hlink"; + case themecolorFollowedHyperlink: return L"folHlink"; + default: + return L""; + } + return L""; + } + + CHexColor::CHexColor() + { + m_unA = 255; + m_unR = 0; + m_unG = 0; + m_unB = 0; + } + CHexColor::CHexColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) + { + m_unA = a; + m_unR = r; + m_unG = g; + m_unB = b; + } + CHexColor::CHexColor(std::wstring & cwsValue) + { + FromString( cwsValue ); + } + + void CHexColor::FromString(const std::wstring &sValue) + { + Parse(sValue); + } + CHexColor::CHexColor(const std::wstring& wsStr) + { + FromString( wsStr); + } + const CHexColor& CHexColor::operator =(const std::wstring& wsStr) + { + FromString( wsStr); + return *this; + } + std::wstring CHexColor::ToString () const + { + std::wstring sResult; + sResult += XmlUtils::ToString((int)m_unA, L"%02X"); + sResult += XmlUtils::ToString((int)m_unR, L"%02X"); + sResult += XmlUtils::ToString((int)m_unG, L"%02X"); + sResult += XmlUtils::ToString((int)m_unB, L"%02X"); + + return sResult; + } + void CHexColor::Set_R(unsigned char R) + { + m_unR = R; + } + void CHexColor::Set_G(unsigned char G) + { + m_unG = G; + } + void CHexColor::Set_B(unsigned char B) + { + m_unB = B; + } + void CHexColor::Set_A(unsigned char A) + { + m_unA = A; + } + unsigned char CHexColor::Get_R() const + { + return m_unR; + } + unsigned char CHexColor::Get_G() const + { + return m_unG; + } + + unsigned char CHexColor::Get_B() const + { + return m_unB; + } + unsigned char CHexColor::Get_A() const + { + return 255; + } + int CHexColor::ToInt() const + { + int nRes = m_unB; + nRes += m_unG << 8; + nRes += m_unR << 16; + nRes += m_unA << 24; + return nRes; + } + void CHexColor::FromInt(int nColor) + { + m_unB = static_cast(nColor & 0xFF); + m_unG = static_cast((nColor & 0xFF00)>>8); + m_unR = static_cast((nColor & 0xFF0000)>>16); + m_unA = 255; + } + + void CHexColor::Parse(std::wstring sValue) + { + if (0 == sValue.find(L"#")) + { + sValue = sValue.substr(1); + } + int nValueLength = (int)sValue.length(); + + if(3 == nValueLength) + { + int nTempR = HexToInt( (int)sValue[0] ); + int nTempG = HexToInt( (int)sValue[1] ); + int nTempB = HexToInt( (int)sValue[2] ); + + m_unR = nTempR + (unsigned char)(nTempR << 4); + m_unG = nTempG + (unsigned char)(nTempG << 4); + m_unB = nTempB + (unsigned char)(nTempB << 4); + } + else if(6 == nValueLength) + { + m_unR = HexToInt( (int)sValue[1] ) + (unsigned char)(HexToInt( (int)sValue[0] ) << 4); + m_unG = HexToInt( (int)sValue[3] ) + (unsigned char)(HexToInt( (int)sValue[2] ) << 4); + m_unB = HexToInt( (int)sValue[5] ) + (unsigned char)(HexToInt( (int)sValue[4] ) << 4); + } + else if(8 == nValueLength) + { + m_unA = HexToInt( (int)sValue[1] ) + (unsigned char)(HexToInt( (int)sValue[0] ) << 4); + m_unR = HexToInt( (int)sValue[3] ) + (unsigned char)(HexToInt( (int)sValue[2] ) << 4); + m_unG = HexToInt( (int)sValue[5] ) + (unsigned char)(HexToInt( (int)sValue[4] ) << 4); + m_unB = HexToInt( (int)sValue[7] ) + (unsigned char)(HexToInt( (int)sValue[6] ) << 4); + } + } + + int CHexColor::HexToInt(int nHex) + { + if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); + if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); + if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); + + return 0; + } + + EFontFamily CFontFamily::FromString(const std::wstring &sValue) + { + int nFontFamily = XmlUtils::GetInteger(sValue); + switch(nFontFamily) + { + case 0:this->m_eValue = fontfamilyNotApplicable;break; + case 1:this->m_eValue = fontfamilyRoman;break; + case 2:this->m_eValue = fontfamilySwiss;break; + case 3:this->m_eValue = fontfamilyModern;break; + case 4:this->m_eValue = fontfamilyScript;break; + case 5:this->m_eValue = fontfamilyDecorative;break; + default:this->m_eValue = fontfamilyNotApplicable; + } + return this->m_eValue; + } + + std::wstring CFontFamily::ToString () const + { + return std::to_wstring(this->m_eValue); + } + + std::wstring CFontFamily::ToStringWord() const + { + std::wstring sRes; + switch(this->m_eValue) + { + case fontfamilyNotApplicable:sRes = L"auto";break; + case fontfamilyRoman:sRes = L"roman";break; + case fontfamilySwiss:sRes = L"swiss";break; + case fontfamilyModern:sRes = L"modern";break; + case fontfamilyScript:sRes = L"script";break; + case fontfamilyDecorative:sRes = L"decorative";break; + default:sRes = L"auto"; + } + return sRes; + } + + EFontScheme CFontScheme::FromString(const std::wstring &sValue) + { + if(L"major" == sValue) + this->m_eValue = fontschemeMajor; + else if(L"minor" == sValue) + this->m_eValue = fontschemeMinor; + else if(L"none" == sValue) + this->m_eValue = fontschemeNone; + else + this->m_eValue = fontschemeNone; + return this->m_eValue; + } + + std::wstring CFontScheme::ToString () const + { + std::wstring sRes; + switch(this->m_eValue) + { + case fontschemeMajor: sRes = L"major";break; + case fontschemeMinor: sRes = L"minor";break; + case fontschemeNone: sRes = L"none";break; + } + return sRes; + } + + EUnderline CUnderline::FromString(const std::wstring &sValue) + { + if(L"double" == sValue) + this->m_eValue = underlineDouble; + else if(L"doubleAccounting" == sValue) + this->m_eValue = underlineDoubleAccounting; + else if(L"none" == sValue) + this->m_eValue = underlineNone; + else if(L"single" == sValue) + this->m_eValue = underlineSingle; + else if(L"singleAccounting" == sValue) + this->m_eValue = underlineSingleAccounting; + else + this->m_eValue = underlineSingle; + return this->m_eValue; + } + + std::wstring CUnderline::ToString () const + { + switch(this->m_eValue) + { + case underlineDouble: return L"double";break; + case underlineDoubleAccounting: return L"doubleAccounting";break; + case underlineNone: return L"none";break; + case underlineSingle: return L"single";break; + case underlineSingleAccounting: return L"singleAccounting";break; + default: return L"none"; + } + } + + EBorderStyle CBorderStyle::FromString(const std::wstring &sValue) + { + if(L"dashDot" == sValue) + this->m_eValue = borderstyleDashDot; + else if(L"dashDotDot" == sValue) + this->m_eValue = borderstyleDashDotDot; + else if(L"dashed" == sValue) + this->m_eValue = borderstyleDashed; + else if(L"dotted" == sValue) + this->m_eValue = borderstyleDotted; + else if(L"double" == sValue) + this->m_eValue = borderstyleDouble; + else if(L"hair" == sValue) + this->m_eValue = borderstyleHair; + else if(L"medium" == sValue) + this->m_eValue = borderstyleMedium; + else if(L"mediumDashDot" == sValue) + this->m_eValue = borderstyleMediumDashDot; + else if(L"mediumDashDotDot" == sValue) + this->m_eValue = borderstyleMediumDashDotDot; + else if(L"mediumDashed" == sValue) + this->m_eValue = borderstyleMediumDashed; + else if(L"none" == sValue) + this->m_eValue = borderstyleNone; + else if(L"slantDashDot" == sValue) + this->m_eValue = borderstyleSlantDashDot; + else if(L"thick" == sValue) + this->m_eValue = borderstyleThick; + else if(L"thin" == sValue) + this->m_eValue = borderstyleThin; + else + this->m_eValue = borderstyleNone; + return this->m_eValue; + } + + std::wstring CBorderStyle::ToString () const + { + switch(this->m_eValue) + { + case borderstyleDashDot : return L"dashDot";break; + case borderstyleDashDotDot : return L"dashDotDot";break; + case borderstyleDashed : return L"dashed";break; + case borderstyleDotted : return L"dotted";break; + case borderstyleDouble : return L"double";break; + case borderstyleHair : return L"hair";break; + case borderstyleMedium : return L"medium";break; + case borderstyleMediumDashDot : return L"mediumDashDot";break; + case borderstyleMediumDashDotDot : return L"mediumDashDotDot";break; + case borderstyleMediumDashed : return L"mediumDashed";break; + case borderstyleNone : return L"none";break; + case borderstyleSlantDashDot : return L"slantDashDot";break; + case borderstyleThick : return L"thick";break; + case borderstyleThin : return L"thin";break; + default:return L"none"; + } + } + + EHorizontalAlignment CHorizontalAlignment::FromString(const std::wstring &sValue) + { + // JustifyDistributed + std::wstring sValueL = XmlUtils::GetLower(sValue); + + if(L"center" == sValueL) this->m_eValue = horizontalalignmentCenter; + else if (L"centercontinuous" == sValueL) this->m_eValue = horizontalalignmentCenterContinuous; + else if(L"continuous" == sValueL) this->m_eValue = horizontalalignmentContinuous; + else if(L"distributed" == sValueL) this->m_eValue = horizontalalignmentDistributed; + else if(L"fill" == sValueL) this->m_eValue = horizontalalignmentFill; + else if(L"general" == sValueL) this->m_eValue = horizontalalignmentGeneral; + else if(L"justify" == sValueL) this->m_eValue = horizontalalignmentJustify; + else if(L"left" == sValueL) this->m_eValue = horizontalalignmentLeft; + else if(L"right" == sValueL) this->m_eValue = horizontalalignmentRight; + else + this->m_eValue = horizontalalignmentGeneral; + return this->m_eValue; + } + + std::wstring CHorizontalAlignment::ToVmlString() const + { + switch (this->m_eValue) + { + case horizontalalignmentCenter: return L"Center"; break; + case horizontalalignmentContinuous: return L"Continuous"; break; + case horizontalalignmentDistributed: return L"Distributed"; break; + case horizontalalignmentFill: return L"Fill"; break; + case horizontalalignmentGeneral: return L"Gneral"; break; + case horizontalalignmentJustify: return L"Justify"; break; + case horizontalalignmentLeft: return L"Left"; break; + case horizontalalignmentRight: return L"Right"; break; + case horizontalalignmentCenterContinuous: return L"CenterContinuous"; break; + default: return L"general"; + } + } + + std::wstring CHorizontalAlignment::ToString () const + { + switch(this->m_eValue) + { + case horizontalalignmentCenter : return L"center"; break; + case horizontalalignmentContinuous : return L"continuous"; break; + case horizontalalignmentDistributed : return L"distributed"; break; + case horizontalalignmentFill : return L"fill"; break; + case horizontalalignmentGeneral : return L"general"; break; + case horizontalalignmentJustify : return L"justify"; break; + case horizontalalignmentLeft : return L"left"; break; + case horizontalalignmentRight : return L"right"; break; + case horizontalalignmentCenterContinuous: return L"centerContinuous"; break; + default : return L"general"; + } + } + + EVerticalAlignment CVerticalAlignment::FromString(const std::wstring &sValue) + { + std::wstring sValueL = XmlUtils::GetLower(sValue); + //Automatic, JustifyDistributed + if(L"bottom" == sValueL) this->m_eValue = verticalalignmentBottom; + else if(L"center" == sValueL) this->m_eValue = verticalalignmentCenter; + else if(L"distributed" == sValueL) this->m_eValue = verticalalignmentDistributed; + else if(L"justify" == sValueL) this->m_eValue = verticalalignmentJustify; + else if(L"top" == sValueL) this->m_eValue = verticalalignmentTop; + else this->m_eValue = verticalalignmentBottom; + return this->m_eValue; + } + + std::wstring CVerticalAlignment::ToVmlString() const + { + switch (this->m_eValue) + { + case verticalalignmentBottom: return L"Bottom"; break; + case verticalalignmentCenter: return L"Center"; break; + case verticalalignmentDistributed: return L"Distributed"; break; + case verticalalignmentJustify: return L"Justify"; break; + case verticalalignmentTop: return L"Top"; break; + default:return L"Bottom"; + } + } + + std::wstring CVerticalAlignment::ToString () const + { + switch(this->m_eValue) + { + case verticalalignmentBottom : return L"bottom"; break; + case verticalalignmentCenter : return L"center"; break; + case verticalalignmentDistributed : return L"distributed"; break; + case verticalalignmentJustify : return L"justify"; break; + case verticalalignmentTop : return L"top"; break; + default:return L"bottom"; + } + } + + EGradientType CGradientType::FromString(const std::wstring &sValue) + { + if(L"line" == sValue) + this->m_eValue = gradienttypeLine; + else if(L"path" == sValue) + this->m_eValue = gradienttypePath; + else + this->m_eValue = gradienttypeLine; + return this->m_eValue; + } + + std::wstring CGradientType::ToString () const + { + switch(this->m_eValue) + { + case gradienttypeLine : return L"line"; break; + case gradienttypePath : return L"path"; break; + default:return L"line"; + } + } + + EPatternType CPatternType::FromString(const std::wstring &sValue) + { + if(L"darkDown" == sValue) + this->m_eValue = patterntypeDarkDown; + else if(L"darkGray" == sValue) + this->m_eValue = patterntypeDarkGray; + else if(L"darkGrid" == sValue) + this->m_eValue = patterntypeDarkGrid; + else if(L"darkHorizontal" == sValue) + this->m_eValue = patterntypeDarkHorizontal; + else if(L"darkTrellis" == sValue) + this->m_eValue = patterntypeDarkTrellis; + else if(L"darkUp" == sValue) + this->m_eValue = patterntypeDarkUp; + else if(L"darkVertical" == sValue || L"VertStripe" == sValue) + this->m_eValue = patterntypeDarkVertical; + else if(L"gray0625" == sValue || L"Gray0625" == sValue ) + this->m_eValue = patterntypeGray0625; + else if(L"gray125" == sValue || L"Gray125" == sValue) + this->m_eValue = patterntypeGray125; + else if(L"lightDown" == sValue) + this->m_eValue = patterntypeLightDown; + else if(L"lightGray" == sValue) + this->m_eValue = patterntypeLightGray; + else if(L"lightGrid" == sValue || L"ThinHorzCross" == sValue) + this->m_eValue = patterntypeLightGrid; + else if(L"lightHorizontal" == sValue || L"HorzStripe" == sValue) + this->m_eValue = patterntypeLightHorizontal; + else if(L"lightTrellis" == sValue) + this->m_eValue = patterntypeLightTrellis; + else if(L"lightUp" == sValue) + this->m_eValue = patterntypeLightUp; + else if(L"lightVertical" == sValue) + this->m_eValue = patterntypeLightVertical; + else if(L"mediumGray" == sValue || L"Gray50" == sValue) + this->m_eValue = patterntypeMediumGray; + else if(L"none" == sValue || L"None" == sValue) + this->m_eValue = patterntypeNone; + else if(L"solid" == sValue || L"Solid" == sValue) + this->m_eValue = patterntypeSolid; + else + this->m_eValue = patterntypeNone; + return this->m_eValue; + } + + std::wstring CPatternType::ToString () const + { + switch(this->m_eValue) + { + case patterntypeDarkDown:return L"darkDown";break; + case patterntypeDarkGray:return L"darkGray";break; + case patterntypeDarkGrid:return L"darkGrid";break; + case patterntypeDarkHorizontal:return L"darkHorizontal";break; + case patterntypeDarkTrellis:return L"darkTrellis";break; + case patterntypeDarkUp:return L"darkUp";break; + case patterntypeDarkVertical:return L"darkVertical";break; + case patterntypeGray0625:return L"gray0625";break; + case patterntypeGray125:return L"gray125";break; + case patterntypeLightDown:return L"lightDown";break; + case patterntypeLightGray:return L"lightGray";break; + case patterntypeLightGrid:return L"lightGrid";break; + case patterntypeLightHorizontal:return L"lightHorizontal";break; + case patterntypeLightTrellis:return L"lightTrellis";break; + case patterntypeLightUp:return L"lightUp";break; + case patterntypeLightVertical:return L"lightVertical";break; + case patterntypeMediumGray:return L"mediumGray";break; + case patterntypeNone:return L"none";break; + case patterntypeSolid:return L"solid";break; + default: return L"none"; + } + + return L"none"; + } + + ETableStyleType CTableStyleType::FromString(const std::wstring &sValue) + { + if(L"blankRow" == sValue) + this->m_eValue = tablestyletypeBlankRow; + else if(L"firstColumn" == sValue) + this->m_eValue = tablestyletypeFirstColumn; + else if(L"firstColumnStripe" == sValue) + this->m_eValue = tablestyletypeFirstColumnStripe; + else if(L"firstColumnSubheading" == sValue) + this->m_eValue = tablestyletypeFirstColumnSubheading; + else if(L"firstHeaderCell" == sValue) + this->m_eValue = tablestyletypeFirstHeaderCell; + else if(L"firstRowStripe" == sValue) + this->m_eValue = tablestyletypeFirstRowStripe; + else if(L"firstRowSubheading" == sValue) + this->m_eValue = tablestyletypeFirstRowSubheading; + else if(L"firstSubtotalColumn" == sValue) + this->m_eValue = tablestyletypeFirstSubtotalColumn; + else if(L"firstSubtotalRow" == sValue) + this->m_eValue = tablestyletypeFirstSubtotalRow; + else if(L"firstTotalCell" == sValue) + this->m_eValue = tablestyletypeFirstTotalCell; + else if(L"headerRow" == sValue) + this->m_eValue = tablestyletypeHeaderRow; + else if(L"lastColumn" == sValue) + this->m_eValue = tablestyletypeLastColumn; + else if(L"lastHeaderCell" == sValue) + this->m_eValue = tablestyletypeLastHeaderCell; + else if(L"lastTotalCell" == sValue) + this->m_eValue = tablestyletypeLastTotalCell; + else if(L"pageFieldLabels" == sValue) + this->m_eValue = tablestyletypePageFieldLabels; + else if(L"pageFieldValues" == sValue) + this->m_eValue = tablestyletypePageFieldValues; + else if(L"secondColumnStripe" == sValue) + this->m_eValue = tablestyletypeSecondColumnStripe; + else if(L"secondColumnSubheading" == sValue) + this->m_eValue = tablestyletypeSecondColumnSubheading; + else if(L"secondRowStripe" == sValue) + this->m_eValue = tablestyletypeSecondRowStripe; + else if(L"secondRowSubheading" == sValue) + this->m_eValue = tablestyletypeSecondRowSubheading; + else if(L"secondSubtotalColumn" == sValue) + this->m_eValue = tablestyletypeSecondSubtotalColumn; + else if(L"secondSubtotalRow" == sValue) + this->m_eValue = tablestyletypeSecondSubtotalRow; + else if(L"thirdColumnSubheading" == sValue) + this->m_eValue = tablestyletypeThirdColumnSubheading; + else if(L"thirdRowSubheading" == sValue) + this->m_eValue = tablestyletypeThirdRowSubheading; + else if(L"thirdSubtotalColumn" == sValue) + this->m_eValue = tablestyletypeThirdSubtotalColumn; + else if(L"thirdSubtotalRow" == sValue) + this->m_eValue = tablestyletypeThirdSubtotalRow; + else if(L"totalRow" == sValue) + this->m_eValue = tablestyletypeTotalRow; + else if(L"wholeTable" == sValue) + this->m_eValue = tablestyletypeWholeTable; + else + this->m_eValue = tablestyletypeBlankRow; + return this->m_eValue; + } + + std::wstring CTableStyleType::ToString () const + { + switch(this->m_eValue) + { + case tablestyletypeBlankRow: return L"blankRow";break; + case tablestyletypeFirstColumn: return L"firstColumn";break; + case tablestyletypeFirstColumnStripe: return L"firstColumnStripe";break; + case tablestyletypeFirstColumnSubheading: return L"firstColumnSubheading";break; + case tablestyletypeFirstHeaderCell: return L"firstHeaderCell";break; + case tablestyletypeFirstRowStripe: return L"firstRowStripe";break; + case tablestyletypeFirstRowSubheading: return L"firstRowSubheading";break; + case tablestyletypeFirstSubtotalColumn: return L"firstSubtotalColumn";break; + case tablestyletypeFirstSubtotalRow: return L"firstSubtotalRow";break; + case tablestyletypeFirstTotalCell: return L"firstTotalCell";break; + case tablestyletypeHeaderRow: return L"headerRow";break; + case tablestyletypeLastColumn: return L"lastColumn";break; + case tablestyletypeLastHeaderCell: return L"lastHeaderCell";break; + case tablestyletypeLastTotalCell: return L"lastTotalCell";break; + case tablestyletypePageFieldLabels: return L"pageFieldLabels";break; + case tablestyletypePageFieldValues: return L"pageFieldValues";break; + case tablestyletypeSecondColumnStripe: return L"secondColumnStripe";break; + case tablestyletypeSecondColumnSubheading: return L"secondColumnSubheading";break; + case tablestyletypeSecondRowStripe: return L"secondRowStripe";break; + case tablestyletypeSecondRowSubheading: return L"secondRowSubheading";break; + case tablestyletypeSecondSubtotalColumn: return L"secondSubtotalColumn";break; + case tablestyletypeSecondSubtotalRow: return L"secondSubtotalRow";break; + case tablestyletypeThirdColumnSubheading: return L"thirdColumnSubheading";break; + case tablestyletypeThirdRowSubheading: return L"thirdRowSubheading";break; + case tablestyletypeThirdSubtotalColumn: return L"thirdSubtotalColumn";break; + case tablestyletypeThirdSubtotalRow: return L"thirdSubtotalRow";break; + case tablestyletypeTotalRow: return L"totalRow";break; + case tablestyletypeWholeTable: return L"wholeTable";break; + default : return L"blankRow";break; + } + return L"blankRow"; + } + + ECellFormulaType CCellFormulaType::FromString(const std::wstring &sValue) + { + if(L"array" == sValue) + this->m_eValue = cellformulatypeArray; + else if(L"dataTable" == sValue) + this->m_eValue = cellformulatypeDataTable; + else if(L"normal" == sValue) + this->m_eValue = cellformulatypeNormal; + else if(L"shared" == sValue) + this->m_eValue = cellformulatypeShared; + else + this->m_eValue = cellformulatypeNormal; + return this->m_eValue; + } + + ECellFormulaType CCellFormulaType::FromStringA(const char* sValue) + { + if(strcmp("array", sValue) == 0) + this->m_eValue = cellformulatypeArray; + else if(strcmp("dataTable", sValue) == 0) + this->m_eValue = cellformulatypeDataTable; + else if(strcmp("normal", sValue) == 0) + this->m_eValue = cellformulatypeNormal; + else if(strcmp("shared", sValue) == 0) + this->m_eValue = cellformulatypeShared; + else + this->m_eValue = cellformulatypeNormal; + return this->m_eValue; + } + + std::wstring CCellFormulaType::ToString () const + { + switch(this->m_eValue) + { + case cellformulatypeArray : return L"array";break; + case cellformulatypeDataTable : return L"dataTable";break; + case cellformulatypeNormal : return L"normal";break; + case cellformulatypeShared : return L"shared";break; + default: return L"normal"; + } + } + + EUpdateLinksType CUpdateLinksType::FromString(const std::wstring &sValue) + { + if(L"always" == sValue) + this->m_eValue = updatelinksAlways; + else if(L"never" == sValue) + this->m_eValue = updatelinksNever; + else if(L"userSet" == sValue) + this->m_eValue = updatelinksUserSet; + else + this->m_eValue = updatelinksAlways; + return this->m_eValue; + } + + std::wstring CUpdateLinksType::ToString () const + { + switch(this->m_eValue) + { + case updatelinksAlways: return L"always";break; + case updatelinksNever: return L"never";break; + case updatelinksUserSet: return L"userSet";break; + default: return L"always"; + } + } + + ECellTypeType CCellTypeType::FromString(const std::wstring &sValue) + { + if(L"b" == sValue) + this->m_eValue = celltypeBool; + else if(L"d" == sValue || L"DateTime" == sValue) + this->m_eValue = celltypeDate; + else if(L"e" == sValue) + this->m_eValue = celltypeError; + else if(L"inlineStr" == sValue) + this->m_eValue = celltypeInlineStr; + else if(L"n" == sValue || L"Number" == sValue) + this->m_eValue = celltypeNumber; + else if(L"s" == sValue) + this->m_eValue = celltypeSharedString; + else if(L"str" == sValue || L"String" == sValue) + this->m_eValue = celltypeStr; + else + this->m_eValue = celltypeNumber; + return this->m_eValue; + } + + ECellTypeType CCellTypeType::FromStringA(const char* sValue) + { + if(strcmp("s", sValue) == 0) + this->m_eValue = celltypeSharedString; + else if(strcmp("str", sValue) == 0) + this->m_eValue = celltypeStr; + else if(strcmp("n", sValue) == 0) + this->m_eValue = celltypeNumber; + else if(strcmp("e", sValue) == 0) + this->m_eValue = celltypeError; + else if(strcmp("b", sValue) == 0) + this->m_eValue = celltypeBool; + else if(strcmp("inlineStr", sValue) == 0) + this->m_eValue = celltypeInlineStr; + else if(strcmp("d", sValue) == 0) + this->m_eValue = celltypeDate; + else + this->m_eValue = celltypeNumber; + return this->m_eValue; + } + + std::wstring CCellTypeType::ToString () const + { + switch(this->m_eValue) + { + case celltypeBool: return L"b";break; + case celltypeDate: return L"d";break; + case celltypeError: return L"e";break; + case celltypeInlineStr: return L"inlineStr";break; + case celltypeNumber: return L"n";break; + case celltypeSharedString: return L"s";break; + case celltypeStr: return L"str";break; + default: return L"n"; + } + } + + ECellAnchorType CCellAnchorType::FromString(const std::wstring &sValue) + { + if(L"absolute" == sValue) + this->m_eValue = cellanchorAbsolute; + else if(L"oneCell" == sValue) + this->m_eValue = cellanchorOneCell; + else if(L"twoCell" == sValue) + this->m_eValue = cellanchorTwoCell; + else + this->m_eValue = cellanchorTwoCell; + return this->m_eValue; + } + + std::wstring CCellAnchorType::ToString () const + { + switch(this->m_eValue) + { + case cellanchorAbsolute: return L"absolute"; break; + case cellanchorOneCell: return L"oneCell"; break; + case cellanchorTwoCell: return L"twoCell"; break; + default: return L"twoCell"; + } + } + + ESheetViewType CSheetViewType::FromString(const std::wstring &sValue) + { + if(L"normal" == sValue) + this->m_eValue = sheetviewNormal; + else if(L"pageBreakPreview" == sValue) + this->m_eValue = sheetviewPageBreakPreview; + else if(L"pageLayout" == sValue) + this->m_eValue = sheetviewPageLayout; + else + this->m_eValue = sheetviewNormal; + return this->m_eValue; + } + + std::wstring CSheetViewType::ToString () const + { + switch(this->m_eValue) + { + case sheetviewNormal: return L"normal"; break; + case sheetviewPageBreakPreview: return L"pageBreakPreview"; break; + case sheetviewPageLayout: return L"pageLayout"; break; + default: return L"normal"; + } + } + + EChartLegendPos CChartLegendPos::FromString(const std::wstring &sValue) + { + if(L"l" == sValue) + this->m_eValue = chartlegendposLeft; + else if(L"t" == sValue) + this->m_eValue = chartlegendposTop; + else if(L"r" == sValue) + this->m_eValue = chartlegendposRight; + else if(L"b" == sValue) + this->m_eValue = chartlegendposBottom; + else if(L"tr" == sValue) + this->m_eValue = chartlegendposRightTop; + else + this->m_eValue = chartlegendposTop; + return this->m_eValue; + } + + std::wstring CChartLegendPos::ToString () const + { + switch(this->m_eValue) + { + case chartlegendposLeft: return L"l"; break; + case chartlegendposTop: return L"t"; break; + case chartlegendposRight: return L"r"; break; + case chartlegendposBottom: return L"b"; break; + case chartlegendposRightTop: return L"tr"; break; + default: return L"t"; + } + } + + EChartHMode CChartHMode::FromString(const std::wstring &sValue) + { + if(L"factor" == sValue) + this->m_eValue = charthmodeFactor; + else if(L"edge" == sValue) + this->m_eValue = charthmodeEdge; + else + this->m_eValue = charthmodeFactor; + return this->m_eValue; + } + + std::wstring CChartHMode::ToString () const + { + switch(this->m_eValue) + { + case charthmodeFactor: return L"factor"; break; + case charthmodeEdge: return L"edge"; break; + default: return L"factor"; + } + } + + EChartLayoutTarget CChartLayoutTarget::FromString(const std::wstring &sValue) + { + if(L"inner" == sValue) + this->m_eValue = chartlayouttargetInner; + else if(L"outer" == sValue) + this->m_eValue = chartlayouttargetOuter; + else + this->m_eValue = chartlayouttargetInner; + return this->m_eValue; + } + + std::wstring CChartLayoutTarget::ToString () const + { + switch(this->m_eValue) + { + case chartlayouttargetInner: return L"inner"; break; + case chartlayouttargetOuter: return L"outer"; break; + default: return L"inner"; + } + } + + EChartAxPos CChartAxPos::FromString(const std::wstring &sValue) + { + if(L"l" == sValue) + this->m_eValue = chartaxposLeft; + else if(L"t" == sValue) + this->m_eValue = chartaxposTop; + else if(L"r" == sValue) + this->m_eValue = chartaxposRight; + else if(L"b" == sValue) + this->m_eValue = chartaxposBottom; + else + this->m_eValue = chartaxposLeft; + return this->m_eValue; + } + + std::wstring CChartAxPos::ToString () const + { + switch(this->m_eValue) + { + case chartaxposLeft: return L"l"; break; + case chartaxposTop: return L"t"; break; + case chartaxposRight: return L"r"; break; + case chartaxposBottom: return L"b"; break; + default: return L"l"; + } + } + + EChartBarGrouping CChartBarGrouping::FromString(const std::wstring &sValue) + { + if(L"clustered" == sValue) + this->m_eValue = chartbargroupingClustered; + else if(L"percentStacked" == sValue) + this->m_eValue = chartbargroupingPercentStacked; + else if(L"stacked" == sValue) + this->m_eValue = chartbargroupingStacked; + else if(L"standard" == sValue) + this->m_eValue = chartbargroupingStandard; + else + this->m_eValue = chartbargroupingClustered; + return this->m_eValue; + } + + std::wstring CChartBarGrouping::ToString () const + { + switch(this->m_eValue) + { + case chartbargroupingClustered: return L"clustered"; break; + case chartbargroupingPercentStacked: return L"percentStacked"; break; + case chartbargroupingStacked: return L"stacked"; break; + case chartbargroupingStandard: return L"standard"; break; + default: return L"clustered"; + } + } + + EChartBarDirection CChartBarDirection::FromString(const std::wstring &sValue) + { + if(L"bar" == sValue) + this->m_eValue = chartbardirectionBar; + else if(L"col" == sValue) + this->m_eValue = chartbardirectionCol; + else + this->m_eValue = chartbardirectionBar; + return this->m_eValue; + } + + std::wstring CChartBarDirection::ToString () const + { + switch(this->m_eValue) + { + case chartbardirectionBar: return L"bar"; break; + case chartbardirectionCol: return L"col"; break; + default: return L"bar"; + } + } + + EChartSymbol CChartSymbol::FromString(const std::wstring &sValue) + { + if(L"circle" == sValue) + this->m_eValue = chartsymbolCircle; + else if(L"dash" == sValue) + this->m_eValue = chartsymbolDash; + else if(L"diamond" == sValue) + this->m_eValue = chartsymbolDiamond; + else if(L"dot" == sValue) + this->m_eValue = chartsymbolDot; + else if(L"none" == sValue) + this->m_eValue = chartsymbolNone; + else if(L"picture" == sValue) + this->m_eValue = chartsymbolPicture; + else if(L"plus" == sValue) + this->m_eValue = chartsymbolPlus; + else if(L"square" == sValue) + this->m_eValue = chartsymbolSquare; + else if(L"star" == sValue) + this->m_eValue = chartsymbolStare; + else if(L"triangle" == sValue) + this->m_eValue = chartsymbolTriangle; + else if(L"x" == sValue) + this->m_eValue = chartsymbolX; + else + this->m_eValue = chartsymbolNone; + return this->m_eValue; + } + + std::wstring CChartSymbol::ToString () const + { + switch(this->m_eValue) + { + case chartsymbolCircle: return L"circle"; break; + case chartsymbolDash: return L"dash"; break; + case chartsymbolDiamond: return L"diamond"; break; + case chartsymbolDot: return L"dot"; break; + case chartsymbolNone: return L"none"; break; + case chartsymbolPicture: return L"picture"; break; + case chartsymbolPlus: return L"plus"; break; + case chartsymbolSquare: return L"square"; break; + case chartsymbolStare: return L"star"; break; + case chartsymbolTriangle: return L"triangle"; break; + case chartsymbolX: return L"x"; break; + default: return L"none"; + } + } + + EPageSize CPageSize::FromString(const std::wstring &sValue) + { + int nCharset = XmlUtils::GetInteger(sValue); + this->m_eValue = (EPageSize)nCharset; + return this->m_eValue; + } + + std::wstring CPageSize::ToString () const + { + return std::to_wstring(this->m_eValue ); + } + + EPageUnits CPageUnits::FromString(const std::wstring &sValue) + { + if (sValue == L"in") this->m_eValue = inch; + else if (sValue == L"mm") this->m_eValue = mm; + else if (sValue == L"cm") this->m_eValue = cm; + else if (sValue == L"pt") this->m_eValue = pt; + else if (sValue == L"px") this->m_eValue = px; + + return this->m_eValue; + } + + std::wstring CPageUnits::ToString () const + { + std::wstring sResult; + switch(this->m_eValue) + { + case mm: sResult = L"mm";break; + case cm: sResult = L"cm";break; + case pt: sResult = L"pt";break; + case px: sResult = L"px";break; + case inch: sResult = L"in";break; + } + return sResult; + } + + ECellComments CCellComments::FromString(const std::wstring &sValue) + { + if (L"asDisplayed" == sValue ) this->m_eValue = cellcommentsAsDisplayed; + else if (L"atEnd" == sValue ) this->m_eValue = cellcommentsAtEnd; + else if (L"none" == sValue ) this->m_eValue = cellcommentsNone; + else this->m_eValue = cellcommentsNone; + + return this->m_eValue; + } + + std::wstring CCellComments::ToString () const + { + switch(this->m_eValue) + { + case cellcommentsAsDisplayed : return L"asDisplayed"; + case cellcommentsAtEnd : return L"atEnd"; + case cellcommentsNone : return L"none"; + default : return L"none"; + } + } + + EPrintError CPrintError::FromString(const std::wstring &sValue) + { + if (L"blank" == sValue ) this->m_eValue = printerrorBlank; + else if (L"dash" == sValue ) this->m_eValue = printerrorDash; + else if (L"displayed" == sValue ) this->m_eValue = printerrorDisplayed; + else if (L"NA" == sValue ) this->m_eValue = printerrorNA; + else this->m_eValue = printerrorDisplayed; + + return this->m_eValue; + } + + std::wstring CPrintError::ToString () const + { + switch(this->m_eValue) + { + case printerrorBlank: return L"blank"; + case printerrorDash: return L"dash"; + case printerrorDisplayed: return L"displayed"; + case printerrorNA: return L"NA"; + default: return L"displayed"; + } + } + + EPageOrder CPageOrder::FromString(const std::wstring &sValue) + { + if (L"downThenOver" == sValue ) this->m_eValue = pageorderDownThenOver; + else if (L"overThenDown" == sValue ) this->m_eValue = pageorderOverThenDown; + else this->m_eValue = pageorderDownThenOver; + + return this->m_eValue; + } + + std::wstring CPageOrder::ToString () const + { + switch(this->m_eValue) + { + case pageorderDownThenOver : return L"downThenOver"; + case pageorderOverThenDown : return L"overThenDown"; + default : return L"downThenOver"; + } + } + + ETotalsRowFunction CTotalsRowFunction::FromString(const std::wstring &sValue) + { + if(L"average" == sValue) + this->m_eValue = totalrowfunctionAverage; + else if(L"count" == sValue) + this->m_eValue = totalrowfunctionCount; + else if(L"countNums" == sValue) + this->m_eValue = totalrowfunctionCountNums; + else if(L"custom" == sValue) + this->m_eValue = totalrowfunctionCustom; + else if(L"max" == sValue) + this->m_eValue = totalrowfunctionMax; + else if(L"min" == sValue) + this->m_eValue = totalrowfunctionMin; + else if(L"none" == sValue) + this->m_eValue = totalrowfunctionNone; + else if(L"stdDev" == sValue) + this->m_eValue = totalrowfunctionStdDev; + else if(L"sum" == sValue) + this->m_eValue = totalrowfunctionSum; + else if(L"var" == sValue) + this->m_eValue = totalrowfunctionVar; + else + this->m_eValue = totalrowfunctionNone; + return this->m_eValue; + } + + std::wstring CTotalsRowFunction::ToString () const + { + std::wstring sResult; + switch(this->m_eValue) + { + case totalrowfunctionAverage: sResult = L"average";break; + case totalrowfunctionCount: sResult = L"count";break; + case totalrowfunctionCountNums: sResult = L"countNums";break; + case totalrowfunctionCustom: sResult = L"custom";break; + case totalrowfunctionMax: sResult = L"max";break; + case totalrowfunctionMin: sResult = L"min";break; + case totalrowfunctionNone: sResult = L"none";break; + case totalrowfunctionStdDev: sResult = L"stdDev";break; + case totalrowfunctionSum: sResult = L"sum";break; + case totalrowfunctionVar: sResult = L"var";break; + } + return sResult; + } + + ESortBy CSortBy::FromString(const std::wstring &sValue) + { + if(L"cellColor" == sValue) + this->m_eValue = sortbyCellColor; + else if(L"fontColor" == sValue) + this->m_eValue = sortbyFontColor; + else if(L"icon" == sValue) + this->m_eValue = sortbyIcon; + else if(L"value" == sValue) + this->m_eValue = sortbyValue; + else + this->m_eValue = sortbyValue; + return this->m_eValue; + } + + std::wstring CSortBy::ToString () const + { + std::wstring sResult; + switch(this->m_eValue) + { + case sortbyCellColor: sResult = L"cellColor"; break; + case sortbyFontColor: sResult = L"fontColor"; break; + case sortbyIcon: sResult = L"icon"; break; + case sortbyValue: sResult = L"value"; break; + } + return sResult; + } + + ECustomFilter CCustomFilter::FromString(const std::wstring &sValue) + { + if(L"equal" == sValue) + this->m_eValue = customfilterEqual; + else if(L"greaterThan" == sValue) + this->m_eValue = customfilterGreaterThan; + else if(L"greaterThanOrEqual" == sValue) + this->m_eValue = customfilterGreaterThanOrEqual; + else if(L"lessThan" == sValue) + this->m_eValue = customfilterLessThan; + else if(L"lessThanOrEqual" == sValue) + this->m_eValue = customfilterLessThanOrEqual; + else if(L"notEqual" == sValue) + this->m_eValue = customfilterNotEqual; + else + this->m_eValue = customfilterEqual; + return this->m_eValue; + } + + std::wstring CCustomFilter::ToString () const + { + std::wstring sResult; + switch(this->m_eValue) + { + case customfilterEqual: sResult = L"equal";break; + case customfilterGreaterThan: sResult = L"greaterThan";break; + case customfilterGreaterThanOrEqual: sResult = L"greaterThanOrEqual";break; + case customfilterLessThan: sResult = L"lessThan";break; + case customfilterLessThanOrEqual: sResult = L"lessThanOrEqual";break; + case customfilterNotEqual: sResult = L"notEqual";break; + } + return sResult; + } + + EDateTimeGroup CDateTimeGroup::FromString(const std::wstring &sValue) + { + if(L"day" == sValue) + this->m_eValue = datetimegroupDay; + else if(L"hour" == sValue) + this->m_eValue = datetimegroupHour; + else if(L"minute" == sValue) + this->m_eValue = datetimegroupMinute; + else if(L"month" == sValue) + this->m_eValue = datetimegroupMonth; + else if(L"second" == sValue) + this->m_eValue = datetimegroupSecond; + else if(L"year" == sValue) + this->m_eValue = datetimegroupYear; + else + this->m_eValue = datetimegroupDay; + return this->m_eValue; + } + + std::wstring CDateTimeGroup::ToString () const + { + std::wstring sResult; + switch(this->m_eValue) + { + case datetimegroupDay: sResult = L"day"; break; + case datetimegroupHour: sResult = L"hour"; break; + case datetimegroupMinute: sResult = L"minute"; break; + case datetimegroupMonth: sResult = L"month"; break; + case datetimegroupSecond: sResult = L"second"; break; + case datetimegroupYear: sResult = L"year"; break; + } + return sResult; + } + + ESortMethod CSortMethod::FromString(const std::wstring &sValue) + { + if(L"none" == sValue) + this->m_eValue = sortmethodNone; + else if(L"pinYin" == sValue) + this->m_eValue = sortmethodPinYin; + else if(L"stroke" == sValue) + this->m_eValue = sortmethodStroke; + else + this->m_eValue = sortmethodNone; + return this->m_eValue; + } + + std::wstring CSortMethod::ToString () const + { + std::wstring sResult; + switch(this->m_eValue) + { + case sortmethodNone: sResult = L"none";break; + case sortmethodPinYin: sResult = L"pinYin";break; + case sortmethodStroke: sResult = L"stroke";break; + } + return sResult; + } + + EDynamicFilterType CDynamicFilterType::FromString(const std::wstring &sValue) + { + if(L"aboveAverage" == sValue) + this->m_eValue = dynamicfiltertypeAboveAverage; + else if(L"belowAverage" == sValue) + this->m_eValue = dynamicfiltertypeBelowAverage; + else if(L"lastMonth" == sValue) + this->m_eValue = dynamicfiltertypeLastMonth; + else if(L"lastQuarter" == sValue) + this->m_eValue = dynamicfiltertypeLastQuarter; + else if(L"lastWeek" == sValue) + this->m_eValue = dynamicfiltertypeLastWeek; + else if(L"lastYear" == sValue) + this->m_eValue = dynamicfiltertypeLastYear; + else if(L"M1" == sValue) + this->m_eValue = dynamicfiltertypeM1; + else if(L"M10" == sValue) + this->m_eValue = dynamicfiltertypeM10; + else if(L"M11" == sValue) + this->m_eValue = dynamicfiltertypeM11; + else if(L"M12" == sValue) + this->m_eValue = dynamicfiltertypeM12; + else if(L"M2" == sValue) + this->m_eValue = dynamicfiltertypeM2; + else if(L"M3" == sValue) + this->m_eValue = dynamicfiltertypeM3; + else if(L"M4" == sValue) + this->m_eValue = dynamicfiltertypeM4; + else if(L"M5" == sValue) + this->m_eValue = dynamicfiltertypeM5; + else if(L"M6" == sValue) + this->m_eValue = dynamicfiltertypeM6; + else if(L"M7" == sValue) + this->m_eValue = dynamicfiltertypeM7; + else if(L"M8" == sValue) + this->m_eValue = dynamicfiltertypeM8; + else if(L"M9" == sValue) + this->m_eValue = dynamicfiltertypeM9; + else if(L"nextMonth" == sValue) + this->m_eValue = dynamicfiltertypeNextMonth; + else if(L"nextQuarter" == sValue) + this->m_eValue = dynamicfiltertypeNextQuarter; + else if(L"nextWeek" == sValue) + this->m_eValue = dynamicfiltertypeNextWeek; + else if(L"nextYear" == sValue) + this->m_eValue = dynamicfiltertypeNextYear; + else if(L"null" == sValue) + this->m_eValue = dynamicfiltertypeNull; + else if(L"Q1" == sValue) + this->m_eValue = dynamicfiltertypeQ1; + else if(L"Q2" == sValue) + this->m_eValue = dynamicfiltertypeQ2; + else if(L"Q3" == sValue) + this->m_eValue = dynamicfiltertypeQ3; + else if(L"Q4" == sValue) + this->m_eValue = dynamicfiltertypeQ4; + else if(L"thisMonth" == sValue) + this->m_eValue = dynamicfiltertypeThisMonth; + else if(L"thisQuarter" == sValue) + this->m_eValue = dynamicfiltertypeThisQuarter; + else if(L"thisWeek" == sValue) + this->m_eValue = dynamicfiltertypeThisWeek; + else if(L"thisYear" == sValue) + this->m_eValue = dynamicfiltertypeThisYear; + else if(L"today" == sValue) + this->m_eValue = dynamicfiltertypeToday; + else if(L"tomorrow" == sValue) + this->m_eValue = dynamicfiltertypeTomorrow; + else if(L"yearToDate" == sValue) + this->m_eValue = dynamicfiltertypeYearToDate; + else if(L"yesterday" == sValue) + this->m_eValue = dynamicfiltertypeYesterday; + else + this->m_eValue = dynamicfiltertypeNull; + return this->m_eValue; + } + + std::wstring CDynamicFilterType::ToString () const + { + std::wstring sResult; + switch(this->m_eValue) + { + case dynamicfiltertypeAboveAverage: sResult = L"aboveAverage";break; + case dynamicfiltertypeBelowAverage: sResult = L"belowAverage";break; + case dynamicfiltertypeLastMonth: sResult = L"lastMonth";break; + case dynamicfiltertypeLastQuarter: sResult = L"lastQuarter";break; + case dynamicfiltertypeLastWeek: sResult = L"lastWeek";break; + case dynamicfiltertypeLastYear: sResult = L"lastYear";break; + case dynamicfiltertypeM1: sResult = L"M1";break; + case dynamicfiltertypeM10: sResult = L"M10";break; + case dynamicfiltertypeM11: sResult = L"M11";break; + case dynamicfiltertypeM12: sResult = L"M12";break; + case dynamicfiltertypeM2: sResult = L"M2";break; + case dynamicfiltertypeM3: sResult = L"M3";break; + case dynamicfiltertypeM4: sResult = L"M4";break; + case dynamicfiltertypeM5: sResult = L"M5";break; + case dynamicfiltertypeM6: sResult = L"M6";break; + case dynamicfiltertypeM7: sResult = L"M7";break; + case dynamicfiltertypeM8: sResult = L"M8";break; + case dynamicfiltertypeM9: sResult = L"M9";break; + case dynamicfiltertypeNextMonth: sResult = L"nextMonth";break; + case dynamicfiltertypeNextQuarter: sResult = L"nextQuarter";break; + case dynamicfiltertypeNextWeek: sResult = L"nextWeek";break; + case dynamicfiltertypeNextYear: sResult = L"nextYear";break; + case dynamicfiltertypeNull: sResult = L"null";break; + case dynamicfiltertypeQ1: sResult = L"Q1";break; + case dynamicfiltertypeQ2: sResult = L"Q2";break; + case dynamicfiltertypeQ3: sResult = L"Q3";break; + case dynamicfiltertypeQ4: sResult = L"Q4";break; + case dynamicfiltertypeThisMonth: sResult = L"thisMonth";break; + case dynamicfiltertypeThisQuarter: sResult = L"thisQuarter";break; + case dynamicfiltertypeThisWeek: sResult = L"thisWeek";break; + case dynamicfiltertypeThisYear: sResult = L"thisYear";break; + case dynamicfiltertypeToday: sResult = L"today";break; + case dynamicfiltertypeTomorrow: sResult = L"tomorrow";break; + case dynamicfiltertypeYearToDate: sResult = L"yearToDate";break; + case dynamicfiltertypeYesterday: sResult = L"yesterday";break; + } + return sResult; + } + + //-------------------------------------------------------- + // ST_IconSetType (18.18.42) + //-------------------------------------------------------- + + EIconSetType ST_IconSetType::FromString(const std::wstring &sValue) + { + if(L"3Arrows" == sValue) this->m_eValue = Arrows3; + else if(L"3ArrowsGray" == sValue) this->m_eValue = Arrows3Gray; + else if(L"3Flags" == sValue) this->m_eValue = Flags3; + else if(L"3Signs" == sValue) this->m_eValue = Signs3; + else if(L"3Symbols" == sValue) this->m_eValue = Symbols3; + else if(L"3Symbols2" == sValue) this->m_eValue = Symbols3_2; + else if(L"3TrafficLights1" == sValue) this->m_eValue = Traffic3Lights1; + else if(L"3TrafficLights2" == sValue) this->m_eValue = Traffic3Lights2; + else if(L"4Arrows" == sValue) this->m_eValue = Arrows4; + else if(L"4ArrowsGray" == sValue) this->m_eValue = Arrows4Gray; + else if(L"4Rating" == sValue) this->m_eValue = Rating4; + else if(L"4RedToBlack" == sValue) this->m_eValue = RedToBlack4; + else if(L"4TrafficLights" == sValue) this->m_eValue = Traffic4Lights; + else if(L"5Arrows" == sValue) this->m_eValue = Arrows5; + else if(L"5ArrowsGray" == sValue) this->m_eValue = Arrows5Gray; + else if(L"5Quarters" == sValue) this->m_eValue = Quarters5; + //..ext.... + else if(L"5Rating" == sValue) this->m_eValue = Rating5; + else if(L"3Triangles" == sValue) this->m_eValue = Triangles3; + else if(L"3Stars" == sValue) this->m_eValue = Stars3; + else if(L"5Boxes" == sValue) this->m_eValue = Boxes5; + else if(L"NoIcons" == sValue) this->m_eValue = NoIcons; + else this->m_eValue = Arrows3; + return this->m_eValue; + } + + std::wstring ST_IconSetType::ToString () const + { + switch(this->m_eValue) + { + case Arrows3 : return L"3Arrows"; break; + case Arrows3Gray : return L"3ArrowsGray"; break; + case Flags3 : return L"3Flags"; break; + case Signs3 : return L"3Signs"; break; + case Symbols3 : return L"3Symbols"; break; + case Symbols3_2 : return L"3Symbols2"; break; + case Traffic3Lights1: return L"3TrafficLights1"; break; + case Traffic3Lights2: return L"3TrafficLights2"; break; + case Arrows4 : return L"4Arrows"; break; + case Arrows4Gray : return L"4ArrowsGray"; break; + case Rating4 : return L"4Rating"; break; + case RedToBlack4 : return L"4RedToBlack"; break; + case Traffic4Lights : return L"4TrafficLights"; break; + case Arrows5 : return L"5Arrows"; break; + case Arrows5Gray : return L"5ArrowsGray"; break; + case Quarters5 : return L"5Quarters"; break; + case Rating5 : return L"5Rating"; break; + case Triangles3 : return L"3Triangles"; break; + case Stars3 : return L"3Stars"; break; + case Boxes5 : return L"5Boxes"; break; + case NoIcons : return L"NoIcons"; break; + default : return L"3Arrows"; + } + } + + //-------------------------------------------------------- + // ST_DataBarAxisPosition + //-------------------------------------------------------- + + EDataBarAxisPosition ST_DataBarAxisPosition::FromString(const std::wstring &sValue) + { + if(L"automatic" == sValue) this->m_eValue = automatic_pos; + else if(L"middle" == sValue) this->m_eValue = middle_pos; + else if(L"none" == sValue) this->m_eValue = none_pos; + else this->m_eValue = automatic_pos; + return this->m_eValue; + } + + std::wstring ST_DataBarAxisPosition::ToString () const + { + switch(this->m_eValue) + { + case automatic_pos : return L"automatic";break; + case middle_pos : return L"middle"; break; + case none_pos : return L"none"; break; + default : return L"automatic"; + } + } + + //-------------------------------------------------------- + // ST_DataBarDirection + //-------------------------------------------------------- + + EDataBarDirection ST_DataBarDirection::FromString(const std::wstring &sValue) + { + if(L"context" == sValue) this->m_eValue = context_direction; + else if(L"leftToRight" == sValue) this->m_eValue = leftToRight; + else if(L"rightToLeft" == sValue) this->m_eValue = rightToLeft; + else this->m_eValue = context_direction; + return this->m_eValue; + } + + std::wstring ST_DataBarDirection::ToString () const + { + switch(this->m_eValue) + { + case context_direction : return L"context"; + case leftToRight : return L"leftToRight"; + case rightToLeft : return L"rightToLeft"; + default : return L"automatic"; + } + } + + //---------------------------------------------------- + // 18.18.15 ST_CfOperator (Conditional Format Operators) + //---------------------------------------------------- + + ECfOperator ST_CfOperator::FromString(const std::wstring &sValue) + { + if(L"beginsWith" == sValue) this->m_eValue = Operator_beginsWith; + else if(L"between" == sValue) this->m_eValue = Operator_between; + else if(L"containsText" == sValue) this->m_eValue = Operator_containsText; + else if(L"endsWith" == sValue) this->m_eValue = Operator_endsWith; + else if(L"equal" == sValue) this->m_eValue = Operator_equal; + else if(L"greaterThan" == sValue) this->m_eValue = Operator_greaterThan; + else if(L"greaterThanOrEqual" == sValue) this->m_eValue = Operator_greaterThanOrEqual; + else if(L"lessThan" == sValue) this->m_eValue = Operator_lessThan; + else if(L"lessThanOrEqual" == sValue) this->m_eValue = Operator_lessThanOrEqual; + else if(L"notBetween" == sValue) this->m_eValue = Operator_notBetween; + else if(L"notContains" == sValue) this->m_eValue = Operator_notContains; + else if(L"notEqual" == sValue) this->m_eValue = Operator_notEqual; + return this->m_eValue; + } + + std::wstring ST_CfOperator::ToString () const + { + switch(this->m_eValue) + { + case Operator_beginsWith : return L"beginsWith"; break; + case Operator_between : return L"between"; break; + case Operator_containsText : return L"containsText"; break; + case Operator_endsWith : return L"endsWith"; break; + case Operator_equal : return L"equal"; break; + case Operator_greaterThan : return L"greaterThan"; break; + case Operator_greaterThanOrEqual: return L"greaterThanOrEqual";break; + case Operator_lessThan : return L"lessThan"; break; + case Operator_lessThanOrEqual : return L"lessThanOrEqual"; break; + case Operator_notBetween : return L"notBetween"; break; + case Operator_notContains : return L"notContains"; break; + case Operator_notEqual : return L"notEqual"; break; + default : return L"equal"; + } + } + + //---------------------------------------------------- + // 18.18.82 ST_TimePeriod (Conditional Format Value Object Type) + //---------------------------------------------------- + + ETimePeriod ST_TimePeriod::FromString(const std::wstring &sValue) + { + if(L"last7Days" == sValue) this->m_eValue = last7Days; + else if(L"lastMonth" == sValue) this->m_eValue = lastMonth; + else if(L"lastWeek" == sValue) this->m_eValue = lastWeek; + else if(L"nextMonth" == sValue) this->m_eValue = nextMonth; + else if(L"nextWeek" == sValue) this->m_eValue = nextWeek; + else if(L"thisMonth" == sValue) this->m_eValue = thisMonth; + else if(L"thisWeek" == sValue) this->m_eValue = thisWeek; + else if(L"today" == sValue) this->m_eValue = today; + else if(L"tomorrow" == sValue) this->m_eValue = tomorrow; + else if(L"yesterday" == sValue) this->m_eValue = yesterday; + else this->m_eValue = last7Days; + return this->m_eValue; + } + + std::wstring ST_TimePeriod::ToString () const + { + switch(this->m_eValue) + { + case last7Days: return L"last7Days"; + case lastMonth: return L"lastMonth"; + case lastWeek: return L"lastWeek"; + case nextMonth: return L"nextMonth"; + case nextWeek: return L"nextWeek"; + case thisMonth: return L"thisMonth"; + case thisWeek: return L"thisWeek"; + case today: return L"today"; + case tomorrow: return L"tomorrow"; + case yesterday: return L"yesterday"; + default : return L"num"; + } + } + + //---------------------------------------------------- + // 18.18.12 ST_CfType (Conditional Format Type) + //---------------------------------------------------- + + ECfType ST_CfType::FromString(const std::wstring &sValue) + { + if(L"aboveAverage" == sValue) this->m_eValue = aboveAverage; + else if(L"beginsWith" == sValue) this->m_eValue = beginsWith; + else if(L"cellIs" == sValue) this->m_eValue = cellIs; + else if(L"colorScale" == sValue) this->m_eValue = colorScale; + else if(L"containsBlanks" == sValue) this->m_eValue = containsBlanks; + else if(L"containsText" == sValue) this->m_eValue = containsText; + else if(L"containsErrors" == sValue) this->m_eValue = containsErrors; + else if(L"dataBar" == sValue) this->m_eValue = dataBar; + else if(L"duplicateValues" == sValue) this->m_eValue = duplicateValues; + else if(L"expression" == sValue) this->m_eValue = expression; + else if(L"iconSet" == sValue) this->m_eValue = iconSet; + else if(L"notContainsBlanks" == sValue) this->m_eValue = notContainsBlanks; + else if(L"notContainsErrors" == sValue) this->m_eValue = notContainsErrors; + else if(L"notContainsText" == sValue) this->m_eValue = notContainsText; + else if(L"timePeriod" == sValue) this->m_eValue = timePeriod; + else if(L"top10" == sValue) this->m_eValue = top10; + else if(L"uniqueValues" == sValue) this->m_eValue = uniqueValues; + else if(L"endsWith" == sValue) this->m_eValue = endsWith; + else this->m_eValue = dataBar; + return this->m_eValue; + } + + std::wstring ST_CfType::ToString () const + { + switch(this->m_eValue) + { + case aboveAverage : return L"aboveAverage"; break; + case beginsWith : return L"beginsWith"; break; + case cellIs : return L"cellIs"; break; + case colorScale : return L"colorScale"; break; + case containsBlanks : return L"containsBlanks"; break; + case containsErrors : return L"containsErrors"; break; + case containsText : return L"containsText"; break; + case dataBar : return L"dataBar"; break; + case duplicateValues : return L"duplicateValues"; break; + case expression : return L"expression"; break; + case iconSet : return L"iconSet"; break; + case notContainsBlanks : return L"notContainsBlanks";break; + case notContainsErrors : return L"notContainsErrors";break; + case notContainsText : return L"notContainsText"; break; + case timePeriod : return L"timePeriod"; break; + case top10 : return L"top10"; break; + case uniqueValues : return L"uniqueValues"; break; + case endsWith : return L"endsWith"; break; + default : return L"dataBar"; + } + } + + //---------------------------------------------------- + // 18.18.13 ST_CfvoType (Conditional Format Value Object Type) + //---------------------------------------------------- + + ECfvoType ST_CfvoType::FromString(const std::wstring &sValue) + { + if(L"formula" == sValue) this->m_eValue = Formula; + else if(L"max" == sValue) this->m_eValue = Maximum; + else if(L"min" == sValue) this->m_eValue = Minimum; + else if(L"num" == sValue) this->m_eValue = Number; + else if(L"percent" == sValue) this->m_eValue = Percent; + else if(L"percentile" == sValue)this->m_eValue = Percentile; + else if(L"autoMin" == sValue) this->m_eValue = autoMin; + else if(L"autoMax" == sValue) this->m_eValue = autoMax; + else this->m_eValue = Number; + return this->m_eValue; + } + + std::wstring ST_CfvoType::ToString () const + { + switch(this->m_eValue) + { + case Formula: return L"formula"; + case Maximum: return L"max"; + case Minimum: return L"min"; + case Number: return L"num"; + case Percent: return L"percent"; + case Percentile:return L"percentile"; + case autoMin: return L"autoMin"; + case autoMax: return L"autoMax"; + default : return L"num"; + } + } + + ESparklineType ST_SparklineType::FromString(const std::wstring &sValue) + { + if(L"line" == sValue) this->m_eValue = Line; + else if(L"column" == sValue) this->m_eValue = Column; + else if(L"stacked" == sValue) this->m_eValue = Stacked; + else this->m_eValue = Line; + return this->m_eValue; + } + + std::wstring ST_SparklineType::ToString () const + { + switch(this->m_eValue) + { + case Line: return L"line"; break; + case Column: return L"column"; break; + case Stacked: return L"stacked"; break; + default : return L"line"; + } + } + + ESparklineAxisMinMax ST_SparklineAxisMinMax::FromString(const std::wstring &sValue) + { + if(L"individual" == sValue) this->m_eValue = Individual; + else if(L"group" == sValue) this->m_eValue = Group; + else if(L"custom" == sValue) this->m_eValue = Custom; + else this->m_eValue = Individual; + return this->m_eValue; + } + + std::wstring ST_SparklineAxisMinMax::ToString () const + { + switch(this->m_eValue) + { + case Individual: return L"individual"; break; + case Group: return L"group"; break; + case Custom: return L"custom"; break; + default: return L"individual"; + } + } + + EDvAspect ST_DvAspect::FromString(const std::wstring &sValue) + { + if(L"DVASPECT_CONTENT" == sValue) this->m_eValue = Content; + else if(L"DVASPECT_ICON" == sValue) this->m_eValue = Icon; + else this->m_eValue = Icon; + return this->m_eValue; + } + + std::wstring ST_DvAspect::ToString () const + { + switch(this->m_eValue) + { + case Content: return L"DVASPECT_CONTENT"; break; + case Icon: return L"DVASPECT_ICON"; break; + default: return L"DVASPECT_CONTENT"; + } + } + + EOleUpdate ST_OleUpdate::FromString(const std::wstring &sValue) + { + if(L"OLEUPDATE_ALWAYS" == sValue) this->m_eValue = Always; + else if(L"OLEUPDATE_ONCALL" == sValue) this->m_eValue = OnCall; + else this->m_eValue = Always; + return this->m_eValue; + } + + std::wstring ST_OleUpdate::ToString () const + { + switch(this->m_eValue) + { + case Always: return L"OLEUPDATE_ALWAYS"; break; + case OnCall: return L"OLEUPDATE_ONCALL"; break; + default: return L"OLEUPDATE_ALWAYS"; + } + } + + EActivePane CActivePane::FromString(const std::wstring &sValue) + { + if ( L"bottomLeft" == sValue ) this->m_eValue = activepaneBottomLeft; + else if ( L"bottomRight" == sValue ) this->m_eValue = activepaneBottomRight; + else if ( L"topLeft" == sValue ) this->m_eValue = activepaneTopLeft; + else if ( L"topRight" == sValue ) this->m_eValue = activepaneTopRight; + else this->m_eValue = activepaneTopLeft; + + return this->m_eValue; + } + + std::wstring CActivePane::ToString () const + { + switch(this->m_eValue) + { + case activepaneBottomLeft : return L"bottomLeft"; + case activepaneBottomRight : return L"bottomRight"; + case activepaneTopLeft : return L"topLeft"; + case activepaneTopRight : return L"topRight"; + default : return L"topLeft"; + } + } + + EPaneState CPaneState::FromString(const std::wstring &sValue) + { + if ( L"frozen" == sValue ) this->m_eValue = panestateFrozen; + else if ( L"frozenSplit" == sValue ) this->m_eValue = panestateFrozenSplit; + else if ( L"split" == sValue ) this->m_eValue = panestateSplit; + else this->m_eValue = panestateFrozen; + + return this->m_eValue; + } + + std::wstring CPaneState::ToString () const + { + switch(this->m_eValue) + { + case panestateFrozen : return L"frozen"; + case panestateFrozenSplit : return L"frozenSplit"; + case panestateSplit : return L"split"; + default : return L"frozen"; + } + } + + EDdeValueType CDdeValueType::FromString(const std::wstring &sValue) + { + if ( L"nil" == sValue ) this->m_eValue = ddevaluetypeNil; + else if ( L"b" == sValue ) this->m_eValue = ddevaluetypeB; + else if ( L"n" == sValue ) this->m_eValue = ddevaluetypeN; + else if ( L"e" == sValue ) this->m_eValue = ddevaluetypeE; + else if ( L"str" == sValue ) this->m_eValue = ddevaluetypeStr; + else this->m_eValue = ddevaluetypeNil; + return this->m_eValue; + } + + std::wstring CDdeValueType::ToString () const + { + switch(this->m_eValue) + { + case ddevaluetypeNil : return L"nil"; + case ddevaluetypeB : return L"b"; + case ddevaluetypeN : return L"n"; + case ddevaluetypeE : return L"e"; + case ddevaluetypeStr : return L"str"; + default : return L"nil"; + } + } + + ECalcMode CCalcMode::FromString(const std::wstring &sValue) + { + if ( L"auto" == sValue ) this->m_eValue = calcmodeAuto; + else if ( L"autoNoTable" == sValue ) this->m_eValue = calcmodeAutoNoTable; + else if ( L"manual" == sValue ) this->m_eValue = calcmodeManual; + else this->m_eValue = calcmodeAuto; + + return this->m_eValue; + } + + std::wstring CCalcMode::ToString () const + { + switch(this->m_eValue) + { + case calcmodeAuto : return L"auto";break; + case calcmodeAutoNoTable : return L"autoNoTable";break; + case calcmodeManual : return L"manual";break; + default : return L"auto"; + + } + } + + ERefMode CRefMode::FromString(const std::wstring &sValue) + { + if ( L"A1" == sValue ) this->m_eValue = refmodeA1; + else if ( L"R1C1" == sValue ) this->m_eValue = refmodeR1C1; + else this->m_eValue = refmodeA1; + + return this->m_eValue; + } + + std::wstring CRefMode::ToString () const + { + switch(this->m_eValue) + { + case refmodeA1 : return L"A1";break; + case refmodeR1C1 : return L"R1C1";break; + default : return L"A1"; + + } + } + + template<> + CDoubleOrAutomatic::CDoubleOrAutomatic() : m_dValue(0){} + + template<> + CDoubleOrAutomatic::CDoubleOrAutomatic(const double & val) { m_dValue = val; this->m_eValue = typeDouble; } + + template<> + CDoubleOrAutomatic::CDoubleOrAutomatic(const EDoubleOrAutomatic & val) { this->m_eValue = val; m_dValue = 0; } + + template<> + EDoubleOrAutomatic CDoubleOrAutomatic::FromString(const std::wstring &sValue) + { + if(L"auto" == sValue) + { + this->m_eValue = typeAuto; + m_dValue = 0; + } + else + { + this->m_eValue = typeDouble; + m_dValue = XmlUtils::GetDouble(sValue); + } + return this->m_eValue; + } + + template<> + double CDoubleOrAutomatic::GetDoubleValue() const + { + return m_dValue; + } + + template<> + std::wstring CDoubleOrAutomatic::ToString () const + { + switch(this->m_eValue) + { + case typeAuto : return L"auto";break; + case typeDouble : + default: + { + return XmlUtils::ToString(m_dValue); + }break; + } + } + + + ESeriesLayout CSeriesLayout::FromString(const std::wstring &sValue) + { + if ( L"boxWhisker" == sValue ) this->m_eValue = typeSeriesLayoutBoxWhisker; + else if ( L"clusteredColumn" == sValue ) this->m_eValue = typeSeriesLayoutClusteredColumn; + else if ( L"funnel" == sValue ) this->m_eValue = typeSeriesLayoutFunnel; + else if ( L"paretoLine" == sValue ) this->m_eValue = typeSeriesLayoutParetoLine; + else if ( L"regionMap" == sValue ) this->m_eValue = typeSeriesLayoutRegionMap; + else if ( L"sunburst" == sValue ) this->m_eValue = typeSeriesLayoutSunburst; + else if ( L"treemap" == sValue ) this->m_eValue = typeSeriesLayoutTreemap; + else if ( L"waterfall" == sValue ) this->m_eValue = typeSeriesLayoutWaterfall; + else this->m_eValue = typeSeriesLayoutBoxWhisker; + + return this->m_eValue; + } + + std::wstring CSeriesLayout::ToString () const + { + switch(this->m_eValue) + { + case typeSeriesLayoutBoxWhisker : return L"boxWhisker";break; + case typeSeriesLayoutClusteredColumn : return L"clusteredColumn";break; + case typeSeriesLayoutFunnel: return L"funnel"; break; + case typeSeriesLayoutParetoLine : return L"paretoLine";break; + case typeSeriesLayoutRegionMap : return L"regionMap"; break; + case typeSeriesLayoutSunburst : return L"sunburst"; break; + case typeSeriesLayoutTreemap : return L"treemap"; break; + case typeSeriesLayoutWaterfall : return L"waterfall"; break; + default : return L"auto"; + } + } + + EAxisUnit CAxisUnit::FromString(const std::wstring &sValue) + { + if ( L"hundreds" == sValue ) this->m_eValue = unitHundreds; + else if ( L"thousands" == sValue ) this->m_eValue = unitThousands; + else if ( L"tenThousands" == sValue ) this->m_eValue = unitTenThousands; + else if ( L"hundredThousands" == sValue ) this->m_eValue = unitHundredThousands; + else if ( L"millions" == sValue ) this->m_eValue = unitMillions; + else if ( L"tenMillions" == sValue ) this->m_eValue = unitTenMillions; + else if ( L"hundredMillions" == sValue ) this->m_eValue = unitHundredMillions; + else if ( L"billions" == sValue ) this->m_eValue = unitBillions; + else if ( L"trillions" == sValue ) this->m_eValue = unitTrillions; + else if ( L"percentage" == sValue ) this->m_eValue = unitPercentage; + else this->m_eValue = unitPercentage; + + return this->m_eValue; + } + + std::wstring CAxisUnit::ToString () const + { + switch(this->m_eValue) + { + case unitHundreds : return L"hundreds"; break; + case unitThousands : return L"thousands"; break; + case unitTenThousands: return L"tenThousands"; break; + case unitHundredThousands : return L"hundredThousands";break; + case unitMillions : return L"millions"; break; + case unitTenMillions : return L"tenMillions"; break; + case unitHundredMillions : return L"hundredMillions";break; + case unitBillions : return L"billions"; break; + case unitTrillions : return L"trillions"; break; + case unitPercentage : return L"percentage"; break; + default : return L""; + } + } + + EDimensionType CDimensionType::FromString(const std::wstring &sValue) + { + if ( L"val" == sValue ) this->m_eValue = typeDimensionVal; + else if ( L"x" == sValue ) this->m_eValue = typeDimensionX; + else if ( L"y" == sValue ) this->m_eValue = typeDimensionY; + else if ( L"size" == sValue ) this->m_eValue = typeDimensionSize; + else if ( L"colorVal" == sValue ) this->m_eValue = typeDimensionColorVal; + else if ( L"cat" == sValue ) this->m_eValue = typeDimensionCat; + else if ( L"colorStr" == sValue ) this->m_eValue = typeDimensionColorStr; + else this->m_eValue = typeDimensionVal; + return this->m_eValue; + } + + std::wstring CDimensionType::ToString () const + { + switch(this->m_eValue) + { + case typeDimensionVal : return L"val"; + case typeDimensionX : return L"x"; + case typeDimensionY: return L"y"; + case typeDimensionSize : return L"size"; + case typeDimensionColorVal :return L"colorVal"; + case typeDimensionCat : return L"cat"; + case typeDimensionColorStr :return L"colorStr"; + default : return L""; + } + } + + EFormulaDirection CFormulaDirection::FromString(const std::wstring &sValue) + { + if(L"row" == sValue) this->m_eValue = directionRow; + else this->m_eValue = directionCol; + return this->m_eValue; + } + + std::wstring CFormulaDirection::ToString () const + { + switch(this->m_eValue) + { + case directionRow : return L"row"; + case directionCol : + default: + { + return L"col"; + }break; + } + } + + ESidePos CSidePos::FromString(const std::wstring &sValue) + { + if ( L"t" == sValue ) this->m_eValue = sideTop; + else if ( L"l" == sValue ) this->m_eValue = sideLeft; + else if ( L"r" == sValue ) this->m_eValue = sideRight; + else if ( L"b" == sValue ) this->m_eValue = sideBottom; + else this->m_eValue = sideTop; + return this->m_eValue; + } + + std::wstring CSidePos::ToString () const + { + switch(this->m_eValue) + { + case sideLeft : return L"l"; + case sideRight: return L"r"; + case sideBottom : return L"b"; + case sideTop : + default : return L"t"; + } + } + + EPosAlign CPosAlign::FromString(const std::wstring &sValue) + { + if ( L"min" == sValue ) this->m_eValue = posAlignMin; + else if ( L"max" == sValue ) this->m_eValue = posAlignMax; + else if ( L"ctr" == sValue ) this->m_eValue = posAlignCtr; + else this->m_eValue = posAlignCtr; + return this->m_eValue; + } + + std::wstring CPosAlign::ToString () const + { + switch(this->m_eValue) + { + case posAlignMax : return L"max"; + case posAlignMin: return L"min"; + case posAlignCtr : + default : return L"ctr"; + } + } + + ERegionLabelLayout CRegionLabelLayout::FromString(const std::wstring &sValue) + { + if ( L"none" == sValue ) this->m_eValue = layoutNone; + else if ( L"bestFitOnly" == sValue ) this->m_eValue = layoutBestFitOnly; + else if ( L"showAll" == sValue ) this->m_eValue = layoutShowAll; + else this->m_eValue = layoutNone; + return this->m_eValue; + } + + std::wstring CRegionLabelLayout::ToString () const + { + switch(this->m_eValue) + { + case layoutNone : return L"none"; + case layoutBestFitOnly: return L"bestFitOnly"; + case layoutShowAll : + default : return L"showAll"; + } + } + + EParentLabelLayout CParentLabelLayout::FromString(const std::wstring &sValue) + { + if ( L"none" == sValue ) this->m_eValue = layoutNone_; + else if ( L"banner" == sValue ) this->m_eValue = layoutBanner; + else if ( L"overlapping" == sValue ) this->m_eValue = layoutOverlapping; + else this->m_eValue = layoutNone_; + return this->m_eValue; + } + + std::wstring CParentLabelLayout::ToString () const + { + switch(this->m_eValue) + { + case layoutNone_ : return L"none"; + case layoutOverlapping: return L"banner"; + case layoutBanner : + default : return L"overlapping"; + } + } + + EQuartileMethod CQuartileMethod::FromString(const std::wstring &sValue) + { + if ( L"inclusive" == sValue ) this->m_eValue = methodInclusive; + else if ( L"exclusive" == sValue ) this->m_eValue = methodExclusive; + else this->m_eValue = methodInclusive; + return this->m_eValue; + } + + std::wstring CQuartileMethod::ToString () const + { + switch(this->m_eValue) + { + case methodInclusive : return L"inclusive"; + case methodExclusive: + default : return L"exclusive"; + } + } + + EDataLabelPos CDataLabelPos::FromString(const std::wstring &sValue) + { + if ( L"bestFit" == sValue ) this->m_eValue = posBestFit; + else if ( L"b" == sValue ) this->m_eValue = posBottom; + else if ( L"ctr" == sValue ) this->m_eValue = posCtr; + else if ( L"inBase" == sValue ) this->m_eValue = posInBase; + else if ( L"inEnd" == sValue ) this->m_eValue = posInEnd; + else if ( L"l" == sValue ) this->m_eValue = posLeft; + else if ( L"outEnd" == sValue ) this->m_eValue = posOutEnd; + else if ( L"r" == sValue ) this->m_eValue = posRight; + else if ( L"t" == sValue ) this->m_eValue = posTop; + else this->m_eValue = posBestFit; + return this->m_eValue; + } + + std::wstring CDataLabelPos::ToString () const + { + switch(this->m_eValue) + { + case posBottom : return L"b"; + case posCtr : return L"ctr"; + case posInBase : return L"inBase"; + case posInEnd : return L"inEnd"; + case posLeft : return L"l"; + case posOutEnd : return L"outEnd"; + case posRight : return L"r"; + case posTop : return L"t"; + case posBestFit: + default : return L"bestFit"; + } + } + + ESidePos CIntervalClosedSide::FromString(const std::wstring &sValue) + { + if ( L"l" == sValue ) this->m_eValue = sideLeft; + else if ( L"r" == sValue ) this->m_eValue = sideRight; + else this->m_eValue = sideLeft; + return this->m_eValue; + } + + std::wstring CIntervalClosedSide::ToString () const + { + switch(this->m_eValue) + { + case sideRight: return L"r"; + case sideLeft : + default : return L"l"; + } + } + + ETickMarksType CTickMarksType::FromString(const std::wstring &sValue) + { + if ( L"none" == sValue ) this->m_eValue = marksTypeNone; + else if ( L"out" == sValue ) this->m_eValue = marksTypeOut; + else if ( L"in" == sValue ) this->m_eValue = marksTypeIn; + else if ( L"cross" == sValue ) this->m_eValue = marksTypeCross; + else this->m_eValue = marksTypeNone; + return this->m_eValue; + } + + std::wstring CTickMarksType::ToString () const + { + switch(this->m_eValue) + { + case marksTypeIn : return L"in"; + case marksTypeOut : return L"out"; + case marksTypeCross : return L"cross"; + case marksTypeNone: + default : return L"none"; + } + } + + ESourceCacheType CSourceCacheType::FromString(const std::wstring &sValue) + { + if ( L"consolidation" == sValue ) this->m_eValue = typeSourceConsolidation; + else if ( L"external" == sValue ) this->m_eValue = typeSourceExternal; + else if ( L"scenario" == sValue ) this->m_eValue = typeSourceScenario; + else if ( L"worksheet" == sValue ) this->m_eValue = typeSourceWorksheet; + + return this->m_eValue; + } + + std::wstring CSourceCacheType::ToString () const + { + switch(this->m_eValue) + { + case typeSourceConsolidation: return L"consolidation"; + case typeSourceExternal: return L"external"; + case typeSourceScenario: return L"scenario"; + case typeSourceWorksheet: return L"worksheet"; + default : return L"worksheet"; + } + } + + EValuesGroupBy CValuesGroupBy::FromString(const std::wstring &sValue) + { + if ( L"days" == sValue ) this->m_eValue = groupByDays; + else if ( L"hours" == sValue ) this->m_eValue = groupByHours; + else if ( L"minutes" == sValue ) this->m_eValue = groupByMinutes; + else if ( L"months" == sValue ) this->m_eValue = groupByMonths; + else if ( L"quarters" == sValue ) this->m_eValue = groupByQuarters; + else if ( L"range" == sValue ) this->m_eValue = groupByNumericRanges; + else if ( L"seconds" == sValue ) this->m_eValue = groupBySeconds; + else if ( L"years" == sValue ) this->m_eValue = groupByYears; + + return this->m_eValue; + } + + std::wstring CValuesGroupBy::ToString () const + { + switch(this->m_eValue) + { + case groupByDays: return L"days"; + case groupByHours: return L"hours"; + case groupByMinutes: return L"minutes"; + case groupByMonths: return L"months"; + case groupByQuarters: return L"quarters"; + case groupByNumericRanges: return L"range"; + case groupBySeconds: return L"seconds"; + case groupByYears: return L"years"; + default : return L""; + } + } + + EPivotItemType CPivotItemType::FromString(const std::wstring &sValue) + { + if ( L"avg" == sValue ) this->m_eValue = typeAverage; + else if ( L"blank" == sValue ) this->m_eValue = typeBlank; + else if ( L"count" == sValue ) this->m_eValue = typeCount; + else if ( L"countA" == sValue ) this->m_eValue = typeCountA; + else if ( L"data" == sValue ) this->m_eValue = typeData; + else if ( L"default" == sValue ) this->m_eValue = typeDefault; + else if ( L"grand" == sValue ) this->m_eValue = typeGrandTotalt; + else if ( L"min" == sValue ) this->m_eValue = typeMin; + else if ( L"max" == sValue ) this->m_eValue = typeMax; + else if ( L"product" == sValue ) this->m_eValue = typeProduct; + else if ( L"stdDev" == sValue ) this->m_eValue = typeStdDev; + else if ( L"stdDevP" == sValue ) this->m_eValue = typeStdDevP; + else if ( L"sum" == sValue ) this->m_eValue = typeSum; + else if ( L"var" == sValue ) this->m_eValue = typeVar; + else if ( L"varP" == sValue ) this->m_eValue = typeVarP; + + return this->m_eValue; + } + + std::wstring CPivotItemType::ToString () const + { + switch(this->m_eValue) + { + case typeAverage: return L"avg"; + case typeBlank: return L"blank"; + case typeCount: return L"count"; + case typeCountA: return L"countA"; + case typeData: return L"data"; + case typeDefault: return L"default"; + case typeGrandTotalt:return L"grand"; + case typeMin: return L"min"; + case typeMax: return L"max"; + case typeProduct: return L"product"; + case typeStdDev: return L"stdDev"; + case typeStdDevP: return L"stdDevP"; + case typeSum: return L"sum"; + case typeVar: return L"var"; + case typeVarP: return L"varP"; + default : return L""; + } + } + + EFieldSortType CFieldSortType::FromString(const std::wstring &sValue) + { + if ( L"manual" == sValue ) this->m_eValue = sortManual; + else if ( L"ascending" == sValue ) this->m_eValue = sortAscending; + else if ( L"descending" == sValue ) this->m_eValue = sortDescending; + + return this->m_eValue; + } + + std::wstring CFieldSortType::ToString () const + { + switch(this->m_eValue) + { + case sortManual: return L"manual"; + case sortAscending: return L"ascending"; + case sortDescending: return L"descending"; + default : return L""; + } + } + + EPivotAreaType CPivotAreaType::FromString(const std::wstring &sValue) + { + if ( L"all" == sValue ) this->m_eValue = areaAll; + else if ( L"button" == sValue ) this->m_eValue = areaFieldButton; + else if ( L"data" == sValue ) this->m_eValue = areaData; + else if ( L"none" == sValue ) this->m_eValue = areaNone; + else if ( L"normal" == sValue ) this->m_eValue = areaNormal; + else if ( L"origin" == sValue ) this->m_eValue = areaOrigin; + else if ( L"topEnd" == sValue ) this->m_eValue = areaTopEnd; + + return this->m_eValue; + } + + std::wstring CPivotAreaType::ToString () const + { + switch(this->m_eValue) + { + case areaAll: return L"all"; + case areaFieldButton: return L"button"; + case areaData: return L"data"; + case areaNone: return L"none"; + case areaNormal: return L"normal"; + case areaOrigin: return L"origin"; + case areaTopEnd: return L"topEnd"; + default : return L""; + } + } + + EPivotAxisType CPivotAxisType::FromString(const std::wstring &sValue) + { + if ( L"axisCol" == sValue ) this->m_eValue = axisCol; + else if ( L"axisPage" == sValue ) this->m_eValue = axisPage; + else if ( L"axisRow" == sValue ) this->m_eValue = axisRow; + else if ( L"axisValues" == sValue ) this->m_eValue = axisValues; + + return this->m_eValue; + } + + std::wstring CPivotAxisType::ToString () const + { + switch(this->m_eValue) + { + case axisCol: return L"axisCol"; + case axisPage: return L"axisPage"; + case axisRow: return L"axisRow"; + case axisValues: return L"countNums"; + default : return L""; + } + } + + EFormatAction CFormatAction::FromString(const std::wstring &sValue) + { + if ( L"blank" == sValue ) this->m_eValue = actionBlank; + else if ( L"drill" == sValue ) this->m_eValue = actionDrill; + else if ( L"formatting" == sValue ) this->m_eValue = actionFormatting; + else if ( L"formula" == sValue ) this->m_eValue = actionFormula; + + return this->m_eValue; + } + + std::wstring CFormatAction::ToString () const + { + switch(this->m_eValue) + { + case actionBlank: return L"blank"; + case actionDrill: return L"drill"; + case actionFormatting: return L"formatting"; + case actionFormula: return L"formula"; + default : return L""; + } + } + + EShowDataAs CShowDataAs::FromString(const std::wstring &sValue) + { + if ( L"difference" == sValue ) this->m_eValue = dataAsDifference; + else if ( L"index" == sValue ) this->m_eValue = dataAsIndex; + else if ( L"normal" == sValue ) this->m_eValue = dataAsNormal; + else if ( L"percent" == sValue ) this->m_eValue = dataAsPercentOff; + else if ( L"percentDiff" == sValue ) this->m_eValue = dataAsPercentDiff; + else if ( L"percentOfCol" == sValue ) this->m_eValue = dataAsPercentOfCol; + else if ( L"percentOfRow" == sValue ) this->m_eValue = dataAsPercentOfRow; + else if ( L"percentOfTotal" == sValue ) this->m_eValue = dataAsPercentOfTotal; + else if ( L"runTotal" == sValue ) this->m_eValue = dataAsRunTotal; + else this->m_eValue = dataAsRunTotal; + return this->m_eValue; + } + + std::wstring CShowDataAs::ToString () const + { + switch(this->m_eValue) + { + case dataAsDifference: return L"difference"; + case dataAsIndex: return L"index"; + case dataAsNormal: return L"normal"; + case dataAsPercentOff: return L"percent"; + case dataAsPercentDiff: return L"percentDiff"; + case dataAsPercentOfCol: return L"percentOfCol"; + case dataAsPercentOfRow: return L"percentOfRow"; + case dataAsPercentOfTotal: return L"percentOfTotal"; + case dataAsRunTotal: return L"percentOfTotal"; + default : return L"runTotal"; + } + } + + EDataConsolidateFunction CDataConsolidateFunction::FromString(const std::wstring &sValue) + { + if ( L"average" == sValue ) this->m_eValue = functionAverage; + else if ( L"count" == sValue ) this->m_eValue = functionCount; + else if ( L"countNums" == sValue ) this->m_eValue = functionCountNums; + else if ( L"max" == sValue ) this->m_eValue = functionMaximum; + else if ( L"min" == sValue ) this->m_eValue = functionMinimum; + else if ( L"product" == sValue ) this->m_eValue = functionProduct; + else if ( L"stdDev" == sValue ) this->m_eValue = functionStdDev; + else if ( L"stdDevp" == sValue ) this->m_eValue = functionStdDevP; + else if ( L"sum" == sValue ) this->m_eValue = functionSum; + else if ( L"var" == sValue ) this->m_eValue = functionVariance; + else if ( L"varp" == sValue ) this->m_eValue = functionVarP; + else this->m_eValue = functionSum; + return this->m_eValue; + } + + std::wstring CDataConsolidateFunction::ToString () const + { + switch(this->m_eValue) + { + case functionAverage: return L"average"; + case functionCount: return L"count"; + case functionCountNums: return L"countNums"; + case functionMaximum: return L"max"; + case functionMinimum: return L"min"; + case functionProduct: return L"product"; + case functionStdDev: return L"stdDev"; + case functionStdDevP: return L"stdDevp"; + case functionSum: return L"sum"; + case functionVariance: return L"var"; + case functionVarP: return L"varp"; + default : return L"sum"; + } + } + + EDataValidationType CDataValidationType::FromString(const std::wstring &sValue) + { + if ( L"custom" == sValue ) this->m_eValue = validationTypeCustom; + else if ( L"date" == sValue ) this->m_eValue = validationTypeDate; + else if ( L"decimal" == sValue ) this->m_eValue = validationTypeDecimal; + else if ( L"list" == sValue || + L"List" == sValue) this->m_eValue = validationTypeList; + else if ( L"none" == sValue ) this->m_eValue = validationTypeNone; + else if ( L"textLength" == sValue ) this->m_eValue = validationTypeTextLength; + else if ( L"time" == sValue ) this->m_eValue = validationTypeTime; + else if ( L"whole" == sValue ) this->m_eValue = validationTypeWhole; + else this->m_eValue = validationTypeNone; + return this->m_eValue; + } + + std::wstring CDataValidationType::ToString () const + { + switch(this->m_eValue) + { + case validationTypeCustom : return L"custom"; + case validationTypeDate : return L"date"; + case validationTypeDecimal : return L"decimal"; + case validationTypeList : return L"list"; + case validationTypeNone : return L"none"; + case validationTypeTextLength : return L"textLength"; + case validationTypeTime: return L"time"; + case validationTypeWhole: return L"whole"; + default : return L"none"; + } + } + + EDataValidationErrorStyle CDataValidationErrorStyle::FromString(const std::wstring &sValue) + { + if ( L"stop" == sValue ) this->m_eValue = errorStyleStop; + else if ( L"warning" == sValue ) this->m_eValue = errorStyleWarning; + else if ( L"information" == sValue ) this->m_eValue = errorStyleInformation; + else this->m_eValue = errorStyleStop; + return this->m_eValue; + } + + std::wstring CDataValidationErrorStyle::ToString () const + { + switch(this->m_eValue) + { + case errorStyleInformation : return L"information"; + case errorStyleWarning : return L"warning"; + case errorStyleStop: + default : return L"stop"; + } + } + + EDataValidationOperator CDataValidationOperator::FromString(const std::wstring &sValue) + { + if ( L"between" == sValue ) this->m_eValue = operatorBetween; + else if ( L"notBetween" == sValue ) this->m_eValue = operatorNotBetween; + else if ( L"equal" == sValue ) this->m_eValue = operatorEqual; + else if ( L"notEqual" == sValue ) this->m_eValue = operatorNotEqual; + else if ( L"lessThan" == sValue ) this->m_eValue = operatorLessThan; + else if ( L"lessThanOrEqual" == sValue ) this->m_eValue = operatorLessThanOrEqual; + else if ( L"greaterThan" == sValue ) this->m_eValue = operatorGreaterThan; + else if ( L"greaterThanOrEqual" == sValue ) this->m_eValue = operatorGreaterThanOrEqual; + else this->m_eValue = operatorBetween; + return this->m_eValue; + } + + std::wstring CDataValidationOperator::ToString () const + { + switch(this->m_eValue) + { + case operatorBetween : return L"between"; + case operatorNotBetween : return L"notBetween"; + case operatorEqual : return L"equal"; + case operatorNotEqual : return L"notEqual"; + case operatorLessThan : return L"lessThan"; + case operatorLessThanOrEqual : return L"lessThanOrEqual"; + case operatorGreaterThan: return L"greaterThan"; + case operatorGreaterThanOrEqual:return L"greaterThanOrEqual"; + default : return L"between"; + } + } + + EDataValidationImeMode CDataValidationImeMode::FromString(const std::wstring &sValue) + { + if ( L"noControl" == sValue ) this->m_eValue = imeModeNoControl; + else if ( L"off" == sValue ) this->m_eValue = imeModeOff; + else if ( L"on" == sValue ) this->m_eValue = imeModeOn; + else if ( L"disabled" == sValue ) this->m_eValue = imeModeDisabled; + else if ( L"hiragana" == sValue ) this->m_eValue = imeModeHiragana; + else if ( L"fullKatakana" == sValue ) this->m_eValue = imeModeFullKatakana; + else if ( L"halfKatakana" == sValue ) this->m_eValue = imeModeHalfKatakana; + else if ( L"fullAlpha" == sValue ) this->m_eValue = imeModeFullAlpha; + else if ( L"halfAlpha" == sValue ) this->m_eValue = imeModeHalfAlpha; + else if ( L"fullHangul" == sValue ) this->m_eValue = imeModeFullHangul; + else if ( L"halfHangul" == sValue ) this->m_eValue = imeModeHalfHangul; + else this->m_eValue = imeModeNoControl; + return this->m_eValue; + } + + std::wstring CDataValidationImeMode::ToString () const + { + switch(this->m_eValue) + { + case imeModeNoControl : return L"noControl"; + case imeModeOff : return L"off"; + case imeModeOn : return L"on"; + case imeModeDisabled : return L"disabled"; + case imeModeHiragana : return L"hiragana"; + case imeModeFullKatakana : return L"fullKatakana"; + case imeModeHalfKatakana: return L"halfKatakana"; + case imeModeFullAlpha: return L"fullAlpha"; + case imeModeHalfAlpha: return L"halfAlpha"; + case imeModeFullHangul: return L"fullHangul"; + case imeModeHalfHangul: return L"halfHangul"; + default : return L"noControl"; + } + } + + EObjectType CObjectType::FromString(const std::wstring &sValue) + { + if ( L"Button" == sValue ) this->m_eValue = objectButton; + else if ( L"CheckBox" == sValue ) this->m_eValue = objectCheckBox; + else if ( L"Drop" == sValue ) this->m_eValue = objectDrop; + else if ( L"GBox" == sValue ) this->m_eValue = objectGBox; + else if ( L"Label" == sValue ) this->m_eValue = objectLabel; + else if ( L"List" == sValue ) this->m_eValue = objectList; + else if ( L"Radio" == sValue ) this->m_eValue = objectRadio; + else if ( L"Scroll" == sValue ) this->m_eValue = objectScroll; + else if ( L"Spin" == sValue ) this->m_eValue = objectSpin; + else if ( L"EditBox" == sValue ) this->m_eValue = objectEditBox; + else if ( L"Dialog" == sValue ) this->m_eValue = objectDialog; + else this->m_eValue = objectButton; + return this->m_eValue; + } + + std::wstring CObjectType::ToString () const + { + switch(this->m_eValue) + { + case objectButton : return L"Button"; + case objectCheckBox : return L"CheckBox"; + case objectDrop : return L"Drop"; + case objectGBox : return L"GBox"; + case objectLabel : return L"Label"; + case objectList : return L"List"; + case objectRadio: return L"Radio"; + case objectScroll: return L"Scroll"; + case objectSpin: return L"Spin"; + case objectEditBox: return L"EditBox"; + case objectDialog: return L"Dialog"; + case objectToggleButton:return L"ToggleButton"; + case objectTabStrip: return L"TabStrip"; + default : return L"Button"; + } + } + + EChecked CChecked::FromString(const std::wstring &sValue) + { + if ( L"Mixed" == sValue ) this->m_eValue = valMixed; + else if ( L"Checked" == sValue ) this->m_eValue = valChecked; + else if ( L"Unchecked" == sValue ) this->m_eValue = valUnchecked; + else if ( L"1" == sValue ) this->m_eValue = valChecked; + else if ( L"0" == sValue ) this->m_eValue = valUnchecked; + else this->m_eValue = valUnchecked; + return this->m_eValue; + } + + std::wstring CChecked::ToString () const + { + switch(this->m_eValue) + { + case valMixed : return L"Mixed"; + case valChecked : return L"Checked"; + case valUnchecked: + default : return L"Unchecked"; + } + } + + EDropStyle CDropStyle::FromString(const std::wstring &sValue) + { + std::wstring sValueL = XmlUtils::GetLower(sValue); + + if ( L"combo" == sValueL) this->m_eValue = valCombo; + else if ( L"comboedit" == sValueL) this->m_eValue = valComboedit; + else if ( L"simple" == sValueL) this->m_eValue = valSimple; + else this->m_eValue = valSimple; + return this->m_eValue; + } + + std::wstring CDropStyle::ToVmlString() const + { + switch (this->m_eValue) + { + case valCombo: return L"Combo"; + case valComboedit: return L"ComboEdit"; + case valSimple: + default: return L"Simple"; + } + } + + std::wstring CDropStyle::ToString () const + { + switch(this->m_eValue) + { + case valCombo: return L"combo"; + case valComboedit: return L"comboedit"; + case valSimple: + default : return L"simple"; + } + } + + ESelType CSelType::FromString(const std::wstring &sValue) + { + std::wstring sValueL = XmlUtils::GetLower(sValue); + + if ( L"extended" == sValueL) this->m_eValue = valExtended; + else if ( L"multi" == sValueL) this->m_eValue = valMulti; + else if ( L"single" == sValueL) this->m_eValue = valSingle; + else this->m_eValue = valSingle; + return this->m_eValue; + } + + std::wstring CSelType::ToVmlString() const + { + switch (this->m_eValue) + { + case valExtended: return L"Extended"; + case valMulti: return L"Multi"; + case valSingle: + default: return L"Single"; + } + } + + std::wstring CSelType::ToString () const + { + switch(this->m_eValue) + { + case valExtended: return L"extended"; + case valMulti : return L"multi"; + case valSingle: + default : return L"single"; + } + } + + EEditValidation CEditValidation::FromString(const std::wstring &sValue) + { + if ( L"text" == sValue ) this->m_eValue = editText; + else if ( L"integer" == sValue ) this->m_eValue = editInteger; + else if ( L"number" == sValue ) this->m_eValue = editNumber; + else if ( L"reference" == sValue ) this->m_eValue = editReference; + else if ( L"formula" == sValue ) this->m_eValue = editFormula; + else this->m_eValue = editText; + return this->m_eValue; + } + + std::wstring CEditValidation::ToString () const + { + switch(this->m_eValue) + { + case editInteger: return L"integer"; + case editNumber : return L"number"; + case editReference : return L"reference"; + case editFormula : return L"formula"; + case editText: + default : return L"text"; + } + } + + ETabularSlicerCacheSortOrder CTabularSlicerCacheSortOrder::FromString(const std::wstring &sValue) + { + if(L"ascending" == sValue) + this->m_eValue = ctabularslicercachesortorderAscending; + else if(L"descending" == sValue) + this->m_eValue = ctabularslicercachesortorderDescending; + else + this->m_eValue = ctabularslicercachesortorderAscending; + return this->m_eValue; + } + + ETabularSlicerCacheSortOrder CTabularSlicerCacheSortOrder::FromStringA(const char* sValue) + { + if(strcmp("ascending", sValue) == 0) + this->m_eValue = ctabularslicercachesortorderAscending; + else if(strcmp("descending", sValue) == 0) + this->m_eValue = ctabularslicercachesortorderDescending; + else + this->m_eValue = ctabularslicercachesortorderAscending; + return this->m_eValue; + } + + std::wstring CTabularSlicerCacheSortOrder::ToString() const + { + switch(this->m_eValue) + { + case ctabularslicercachesortorderAscending : return L"ascending";break; + case ctabularslicercachesortorderDescending : return L"descending";break; + } + return L"ascending"; + } + + ESlicerCacheCrossFilter CSlicerCacheCrossFilter::FromString(const std::wstring &sValue) + { + if(L"none" == sValue) + this->m_eValue = cslicercachecrossfilterNone; + else if(L"showItemsWithDataAtTop" == sValue) + this->m_eValue = cslicercachecrossfilterShowItemsWithDataAtTop; + else if(L"showItemsWithNoData" == sValue) + this->m_eValue = cslicercachecrossfilterShowItemsWithNoData; + else + this->m_eValue = cslicercachecrossfilterNone; + return this->m_eValue; + } + + ESlicerCacheCrossFilter CSlicerCacheCrossFilter::FromStringA(const char* sValue) + { + if(strcmp("none", sValue) == 0) + this->m_eValue = cslicercachecrossfilterNone; + else if(strcmp("showItemsWithDataAtTop", sValue) == 0) + this->m_eValue = cslicercachecrossfilterShowItemsWithDataAtTop; + else if(strcmp("showItemsWithNoData", sValue) == 0) + this->m_eValue = cslicercachecrossfilterShowItemsWithNoData; + else + this->m_eValue = cslicercachecrossfilterNone; + return this->m_eValue; + } + + std::wstring CSlicerCacheCrossFilter::ToString() const + { + switch(this->m_eValue) + { + case cslicercachecrossfilterNone : return L"none";break; + case cslicercachecrossfilterShowItemsWithDataAtTop : return L"showItemsWithDataAtTop";break; + case cslicercachecrossfilterShowItemsWithNoData : return L"showItemsWithNoData";break; + } + return L"none"; + } + + EOlapSlicerCacheSortOrder COlapSlicerCacheSortOrder::FromString(const std::wstring &sValue) + { + if(L"natural" == sValue) + this->m_eValue = colapslicercachesortorderNatural; + else if(L"ascending" == sValue) + this->m_eValue = colapslicercachesortorderAscending; + else if(L"descending" == sValue) + this->m_eValue = colapslicercachesortorderDescending; + else + this->m_eValue = colapslicercachesortorderNatural; + return this->m_eValue; + } + + EOlapSlicerCacheSortOrder COlapSlicerCacheSortOrder::FromStringA(const char* sValue) + { + if(strcmp("natural", sValue) == 0) + this->m_eValue = colapslicercachesortorderNatural; + else if(strcmp("ascending", sValue) == 0) + this->m_eValue = colapslicercachesortorderAscending; + else if(strcmp("descending", sValue) == 0) + this->m_eValue = colapslicercachesortorderDescending; + else + this->m_eValue = colapslicercachesortorderNatural; + return this->m_eValue; + } + + std::wstring COlapSlicerCacheSortOrder::ToString() const + { + switch(this->m_eValue) + { + case colapslicercachesortorderNatural : return L"natural";break; + case colapslicercachesortorderAscending : return L"ascending";break; + case colapslicercachesortorderDescending : return L"descending";break; + } + return L"natural"; + } + + ESlicerStyleType CSlicerStyleType::FromString(const std::wstring &sValue) + { + if(L"unselectedItemWithData" == sValue) + this->m_eValue = cslicerstyletypeUnselectedItemWithData; + else if(L"selectedItemWithData" == sValue) + this->m_eValue = cslicerstyletypeSelectedItemWithData; + else if(L"unselectedItemWithNoData" == sValue) + this->m_eValue = cslicerstyletypeUnselectedItemWithNoData; + else if(L"selectedItemWithNoData" == sValue) + this->m_eValue = cslicerstyletypeSelectedItemWithNoData; + else if(L"hoveredUnselectedItemWithData" == sValue) + this->m_eValue = cslicerstyletypeHoveredUnselectedItemWithData; + else if(L"hoveredSelectedItemWithData" == sValue) + this->m_eValue = cslicerstyletypeHoveredSelectedItemWithData; + else if(L"hoveredUnselectedItemWithNoData" == sValue) + this->m_eValue = cslicerstyletypeHoveredUnselectedItemWithNoData; + else if(L"hoveredSelectedItemWithNoData" == sValue) + this->m_eValue = cslicerstyletypeHoveredSelectedItemWithNoData; + else + this->m_eValue = cslicerstyletypeUnselectedItemWithData; + return this->m_eValue; + } + + ESlicerStyleType CSlicerStyleType::FromStringA(const char* sValue) + { + if(strcmp("unselectedItemWithData", sValue) == 0) + this->m_eValue = cslicerstyletypeUnselectedItemWithData; + else if(strcmp("selectedItemWithData", sValue) == 0) + this->m_eValue = cslicerstyletypeSelectedItemWithData; + else if(strcmp("unselectedItemWithNoData", sValue) == 0) + this->m_eValue = cslicerstyletypeUnselectedItemWithNoData; + else if(strcmp("selectedItemWithNoData", sValue) == 0) + this->m_eValue = cslicerstyletypeSelectedItemWithNoData; + else if(strcmp("hoveredUnselectedItemWithData", sValue) == 0) + this->m_eValue = cslicerstyletypeHoveredUnselectedItemWithData; + else if(strcmp("hoveredSelectedItemWithData", sValue) == 0) + this->m_eValue = cslicerstyletypeHoveredSelectedItemWithData; + else if(strcmp("hoveredUnselectedItemWithNoData", sValue) == 0) + this->m_eValue = cslicerstyletypeHoveredUnselectedItemWithNoData; + else if(strcmp("hoveredSelectedItemWithNoData", sValue) == 0) + this->m_eValue = cslicerstyletypeHoveredSelectedItemWithNoData; + else + this->m_eValue = cslicerstyletypeUnselectedItemWithData; + return this->m_eValue; + } + + std::wstring CSlicerStyleType::ToString() const + { + switch(this->m_eValue) + { + case cslicerstyletypeUnselectedItemWithData : return L"unselectedItemWithData";break; + case cslicerstyletypeSelectedItemWithData : return L"selectedItemWithData";break; + case cslicerstyletypeUnselectedItemWithNoData : return L"unselectedItemWithNoData";break; + case cslicerstyletypeSelectedItemWithNoData : return L"selectedItemWithNoData";break; + case cslicerstyletypeHoveredUnselectedItemWithData : return L"hoveredUnselectedItemWithData";break; + case cslicerstyletypeHoveredSelectedItemWithData : return L"hoveredSelectedItemWithData";break; + case cslicerstyletypeHoveredUnselectedItemWithNoData : return L"hoveredUnselectedItemWithNoData";break; + case cslicerstyletypeHoveredSelectedItemWithNoData : return L"hoveredSelectedItemWithNoData";break; + } + return L"unselectedItemWithData"; + } + + }// Spreadsheet +} // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Spreadsheet.h b/Common/DocxFormat/Source/Common/SimpleTypes_Spreadsheet.h new file mode 100644 index 0000000000..219a30dd1e --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Spreadsheet.h @@ -0,0 +1,1379 @@ +/* + * (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 +{ + namespace Spreadsheet + { + enum ETableType + { + typeQueryTable = 0, + typeWorksheet = 1, + typeXml = 2, + }; + + DEFINE_SIMPLE_TYPE(CTableType, ETableType, typeWorksheet) + + enum EDatabaseSourceType + { + typeODBCBasedSource = 1, + typeDAOBasedSource = 2, + typeFileBasedDatabaseSource = 3, + typeWebQuery = 4, + typeOLEDBBasedSource = 5, + typeTextBasedSource = 6, + typeADORecordSet = 7, + typeDSP + }; + + enum EExternalConnectionType + { + extConnTypeGeneral = 0, + extConnTypeText = 1, + extConnTypeMDY = 2, + extConnTypeDMY = 3, + extConnTypeYMD = 4, + extConnTypeMYD = 5, + extConnTypeDYM = 6, + extConnTypeYDM = 7, + extConnTypeSkip = 8, + extConnTypeEMD = 9 + }; + + DEFINE_SIMPLE_TYPE(CExternalConnectionType, EExternalConnectionType, extConnTypeGeneral) + + enum ECredMethod + { + integrated_method = 0, + none_method = 1, + prompt_method = 2, + stored_method = 3 + }; + + DEFINE_SIMPLE_TYPE(CCredMethod, ECredMethod, integrated_method) + + enum EVisibleType + { + visibleHidden = 0, + visibleVeryHidden = 1, + visibleVisible = 2, + }; + + DEFINE_SIMPLE_TYPE(CVisibleType, EVisibleType, visibleVisible) + + enum EHtmlFormat + { + htmlNone = 0, + htmlRtf = 1, + htmlAll = 2 + }; + + DEFINE_SIMPLE_TYPE(CHtmlFormat, EHtmlFormat, htmlNone) + + enum EParameterType + { + parameterPrompt = 0, + parameterValue = 1, + parameterCell = 2 + }; + + DEFINE_SIMPLE_TYPE(CParameterType, EParameterType, parameterPrompt) + + enum EQualifier + { + doubleQuote = 0, + singleQuote = 1, + noneQuote = 2 + }; + + DEFINE_SIMPLE_TYPE(CQualifier, EQualifier, doubleQuote) + + enum EFileType + { + fileTypeMac = 0, + fileTypeWin = 1, + fileTypeDos = 2, + fileTypeLin = 3, + fileTypeOther = 4 + }; + + DEFINE_SIMPLE_TYPE(CFileType, EFileType, fileTypeWin) + + enum EPhoneticAlignmentType + { + phoneticalignmentCenter = 0, + phoneticalignmentDistributed = 1, + phoneticalignmentLeft = 2, + phoneticalignmentNoControl = 3, + }; + + DEFINE_SIMPLE_TYPE(CPhoneticAlignment, EPhoneticAlignmentType, phoneticalignmentNoControl) + + enum EPhoneticTypeType + { + phonetictypeFullwidthKatakana = 0, + phonetictypeHalfwidthKatakana = 1, + phonetictypeHiragana = 2, + phonetictypeNoConversion = 3, + }; + + DEFINE_SIMPLE_TYPE(CPhoneticType, EPhoneticTypeType, phonetictypeNoConversion) + + enum EFontCharset + { + fontcharsetANSI = 0, // 00 + fontcharsetDefault = 1, // 01 + fontcharsetSymbol = 2, // 02 + fontcharsetMacintosh = 77, // 4D + fontcharsetShitJIS = 128, // 80 + fontcharsetHangeul = 129, // 81 + fontcharsetJohab = 130, // 82 + fontcharsetGB2313 = 134, // 86 + fontcharsetChineseBig5 = 136, // 88 + fontcharsetGreek = 161, // A1 + fontcharsetTurkish = 162, // A2 + fontcharsetVietnamese = 163, // A3 + fontcharsetHebrew = 177, // B1 + fontcharsetArabic = 178, // B2 + fontcharsetBaltic = 186, // BA + fontcharsetRussian = 204, // CC + fontcharsetThai = 222, // DE + fontcharsetEastEurope = 238, // EE + fontcharsetOEM = 255, // FF + }; + + DEFINE_SIMPLE_TYPE_START(CFontCharset, EFontCharset, fontcharsetANSI) + public: + std::wstring ToHexString () const; + }; + + enum EThemeColor + { + themecolorLight1 = 0, + themecolorDark1 = 1, + themecolorLight2 = 2, + themecolorDark2 = 3, + themecolorAccent1 = 4, + themecolorAccent2 = 5, + themecolorAccent3 = 6, + themecolorAccent4 = 7, + themecolorAccent5 = 8, + themecolorAccent6 = 9, + themecolorHyperlink = 10, + themecolorFollowedHyperlink = 11 + }; + + DEFINE_SIMPLE_TYPE(CThemeColor, EThemeColor, themecolorDark1) + + class CHexColor + { + public: + CHexColor(); + CHexColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255); + CHexColor(std::wstring & cwsValue); + + virtual void FromString(const std::wstring &sValue); + + CHexColor(const std::wstring& wsStr); + const CHexColor &operator =(const std::wstring& wsStr); + virtual std::wstring ToString () const; + void Set_R(unsigned char R); + void Set_G(unsigned char G); + void Set_B(unsigned char B); + void Set_A(unsigned char A); + unsigned char Get_R() const; + unsigned char Get_G() const; + unsigned char Get_B() const; + unsigned char Get_A() const; + int ToInt() const; + void FromInt(int nColor); + + private: + void Parse(const std::wstring sValue); + int HexToInt(int nHex); + + private: + unsigned char m_unA; + unsigned char m_unR; + unsigned char m_unG; + unsigned char m_unB; + }; + + enum EFontFamily + { + fontfamilyNotApplicable = 0, + fontfamilyRoman = 1, + fontfamilySwiss = 2, + fontfamilyModern = 3, + fontfamilyScript = 4, + fontfamilyDecorative = 5, + }; + + DEFINE_SIMPLE_TYPE_START(CFontFamily, EFontFamily, fontfamilyNotApplicable) + public: + std::wstring ToStringWord() const; + }; + + enum EFontScheme + { + fontschemeMajor = 0, + fontschemeMinor = 1, + fontschemeNone = 2 + }; + + DEFINE_SIMPLE_TYPE(CFontScheme, EFontScheme, fontschemeNone) + + enum EUnderline + { + underlineDouble = 0, + underlineDoubleAccounting = 1, + underlineNone = 2, + underlineSingle = 3, + underlineSingleAccounting = 4 + }; + + DEFINE_SIMPLE_TYPE(CUnderline, EUnderline, underlineSingle) + + enum EBorderStyle + { + borderstyleDashDot = 0, + borderstyleDashDotDot = 1, + borderstyleDashed = 2, + borderstyleDotted = 3, + borderstyleDouble = 4, + borderstyleHair = 5, + borderstyleMedium = 6, + borderstyleMediumDashDot = 7, + borderstyleMediumDashDotDot = 8, + borderstyleMediumDashed = 9, + borderstyleNone = 10, + borderstyleSlantDashDot = 11, + borderstyleThick = 12, + borderstyleThin = 13 + }; + + DEFINE_SIMPLE_TYPE(CBorderStyle, EBorderStyle, borderstyleNone) + + enum EHorizontalAlignment + { + horizontalalignmentCenter = 0, + horizontalalignmentContinuous = 1, + horizontalalignmentDistributed = 2, + horizontalalignmentFill = 3, + horizontalalignmentGeneral = 4, + horizontalalignmentJustify = 5, + horizontalalignmentLeft = 6, + horizontalalignmentRight = 7, + horizontalalignmentCenterContinuous = 8 + }; + + DEFINE_SIMPLE_TYPE_START(CHorizontalAlignment, EHorizontalAlignment, horizontalalignmentGeneral) + public: + std::wstring ToVmlString() const; + }; + + enum EVerticalAlignment + { + verticalalignmentBottom = 0, + verticalalignmentCenter = 1, + verticalalignmentDistributed = 2, + verticalalignmentJustify = 3, + verticalalignmentTop = 4 + }; + + DEFINE_SIMPLE_TYPE_START(CVerticalAlignment, EVerticalAlignment, verticalalignmentBottom) + public: + std::wstring ToVmlString() const; + }; + + enum EGradientType + { + gradienttypeLine = 0, + gradienttypePath = 1 + }; + + DEFINE_SIMPLE_TYPE(CGradientType, EGradientType, gradienttypeLine) + + enum EPatternType + { + patterntypeDarkDown = 0, + patterntypeDarkGray = 1, + patterntypeDarkGrid = 2, + patterntypeDarkHorizontal = 3, + patterntypeDarkTrellis = 4, + patterntypeDarkUp = 5, + patterntypeDarkVertical = 6, + patterntypeGray0625 = 7, + patterntypeGray125 = 8, + patterntypeLightDown = 9, + patterntypeLightGray = 10, + patterntypeLightGrid = 11, + patterntypeLightHorizontal = 12, + patterntypeLightTrellis = 13, + patterntypeLightUp = 14, + patterntypeLightVertical = 15, + patterntypeMediumGray = 16, + patterntypeNone = 17, + patterntypeSolid = 18 + }; + + DEFINE_SIMPLE_TYPE(CPatternType, EPatternType, patterntypeNone) + + enum ETableStyleType + { + tablestyletypeBlankRow = 0, + tablestyletypeFirstColumn = 1, + tablestyletypeFirstColumnStripe = 2, + tablestyletypeFirstColumnSubheading = 3, + tablestyletypeFirstHeaderCell = 4, + tablestyletypeFirstRowStripe = 5, + tablestyletypeFirstRowSubheading = 6, + tablestyletypeFirstSubtotalColumn = 7, + tablestyletypeFirstSubtotalRow = 8, + tablestyletypeFirstTotalCell = 9, + tablestyletypeHeaderRow = 10, + tablestyletypeLastColumn = 11, + tablestyletypeLastHeaderCell = 12, + tablestyletypeLastTotalCell = 13, + tablestyletypePageFieldLabels = 14, + tablestyletypePageFieldValues = 15, + tablestyletypeSecondColumnStripe = 16, + tablestyletypeSecondColumnSubheading = 17, + tablestyletypeSecondRowStripe = 18, + tablestyletypeSecondRowSubheading = 19, + tablestyletypeSecondSubtotalColumn = 20, + tablestyletypeSecondSubtotalRow = 21, + tablestyletypeThirdColumnSubheading = 22, + tablestyletypeThirdRowSubheading = 23, + tablestyletypeThirdSubtotalColumn = 24, + tablestyletypeThirdSubtotalRow = 25, + tablestyletypeTotalRow = 26, + tablestyletypeWholeTable = 27 + }; + + DEFINE_SIMPLE_TYPE(CTableStyleType, ETableStyleType, tablestyletypeBlankRow) + + enum ECellFormulaType + { + cellformulatypeArray = 0, + cellformulatypeDataTable = 1, + cellformulatypeNormal = 2, + cellformulatypeShared = 3 + }; + + DEFINE_SIMPLE_TYPE(CCellFormulaType, ECellFormulaType, cellformulatypeNormal) + + enum EUpdateLinksType + { + updatelinksAlways = 0, + updatelinksNever = 1, + updatelinksUserSet = 2 + }; + + DEFINE_SIMPLE_TYPE(CUpdateLinksType, EUpdateLinksType, updatelinksAlways) + + enum ECellTypeType + { + celltypeBool = 0, + celltypeDate = 1, + celltypeError = 2, + celltypeInlineStr = 3, + celltypeNumber = 4, + celltypeSharedString = 5, + celltypeStr = 6, + //--------------- for our using + celltypePercentage = 7, + celltypeScientific = 8, + celltypeFraction = 9, + celltypeTime = 10, + celltypeCurrency = 11, + celltypeDateTime = 12 + }; + + DEFINE_SIMPLE_TYPE(CCellTypeType, ECellTypeType, celltypeNumber) + + enum ECellAnchorType + { + cellanchorAbsolute = 0, + cellanchorOneCell = 1, + cellanchorTwoCell = 2 + }; + + DEFINE_SIMPLE_TYPE(CCellAnchorType, ECellAnchorType, cellanchorTwoCell) + + enum ESheetViewType + { + sheetviewNormal = 0, + sheetviewPageBreakPreview = 1, + sheetviewPageLayout = 2 + }; + + DEFINE_SIMPLE_TYPE(CSheetViewType, ESheetViewType, sheetviewNormal) + + enum EChartLegendPos + { + chartlegendposLeft = 0, + chartlegendposTop = 1, + chartlegendposRight = 2, + chartlegendposBottom = 3, + chartlegendposRightTop = 4 + }; + + DEFINE_SIMPLE_TYPE(CChartLegendPos, EChartLegendPos, chartlegendposTop) + + enum EChartHMode + { + charthmodeFactor = 0, + charthmodeEdge = 1 + }; + + DEFINE_SIMPLE_TYPE(CChartHMode, EChartHMode, charthmodeFactor) + + enum EChartLayoutTarget + { + chartlayouttargetInner = 0, + chartlayouttargetOuter = 1 + }; + + DEFINE_SIMPLE_TYPE(CChartLayoutTarget, EChartLayoutTarget, chartlayouttargetInner) + + enum EChartAxPos + { + chartaxposLeft = 0, + chartaxposTop = 1, + chartaxposRight = 2, + chartaxposBottom= 3 + }; + + DEFINE_SIMPLE_TYPE(CChartAxPos, EChartAxPos, chartaxposLeft) + + enum EChartBarGrouping + { + chartbargroupingClustered = 0, + chartbargroupingPercentStacked = 1, + chartbargroupingStacked = 2, + chartbargroupingStandard= 3 + }; + + DEFINE_SIMPLE_TYPE(CChartBarGrouping, EChartBarGrouping, chartbargroupingClustered) + + enum EChartBarDirection + { + chartbardirectionBar = 0, + chartbardirectionCol = 1 + }; + + DEFINE_SIMPLE_TYPE(CChartBarDirection, EChartBarDirection, chartbardirectionBar) + + enum EChartSymbol + { + chartsymbolCircle = 0, + chartsymbolDash = 1, + chartsymbolDiamond = 2, + chartsymbolDot = 3, + chartsymbolNone = 4, + chartsymbolPicture = 5, + chartsymbolPlus = 6, + chartsymbolSquare = 7, + chartsymbolStare = 8, + chartsymbolStar = 9, + chartsymbolTriangle = 10, + chartsymbolX = 11 + }; + + DEFINE_SIMPLE_TYPE(CChartSymbol, EChartSymbol, chartsymbolNone) + + enum EPageSize + { + pagesizeLetterPaper = 1, + pagesizeLetterSmall = 2, + pagesizeTabloidPaper = 3, + pagesizeLedgerPaper = 4, + pagesizeLegalPaper = 5, + pagesizeStatementPaper = 6, + pagesizeExecutivePaper = 7, + pagesizeA3Paper = 8, + pagesizeA4Paper = 9, + pagesizeA4SmallPaper = 10, + pagesizeA5Paper = 11, + pagesizeB4Paper = 12, + pagesizeB5Paper = 13, + pagesizeFolioPaper = 14, + pagesizeQuartoPaper = 15, + pagesizeStandardPaper1 = 16, + pagesizeStandardPaper2 = 17, + pagesizeNotePaper = 18, + pagesize9Envelope = 19, + pagesize10Envelope = 20, + pagesize11Envelope = 21, + pagesize12Envelope = 22, + pagesize14Envelope = 23, + pagesizeCPaper = 24, + pagesizeDPaper = 25, + pagesizeEPaper = 26, + pagesizeDLEnvelope = 27, + pagesizeC5Envelope = 28, + pagesizeC3Envelope = 29, + pagesizeC4Envelope = 30, + pagesizeC6Envelope = 31, + pagesizeC65Envelope = 32, + pagesizeB4Envelope = 33, + pagesizeB5Envelope = 34, + pagesizeB6Envelope = 35, + pagesizeItalyEnvelope = 36, + pagesizeMonarchEnvelope = 37, + pagesize6_3_4Envelope = 38, + pagesizeUSStandardFanfold = 39, + pagesizeGermanStandardFanfold = 40, + pagesizeGermanLegalFanfold = 41, + pagesizeISOB4 = 42, + pagesizeJapaneseDoublePostcard = 43, + pagesizeStandardPaper3 = 44, + pagesizeStandardPaper4 = 45, + pagesizeStandardPaper5 = 46, + pagesizeInviteEnvelope = 47, + pagesizeLetterExtraPaper = 50, + pagesizeLegalExtraPaper = 51, + pagesizeTabloidExtraPaper = 52, + pagesizeA4ExtraPaper = 53, + pagesizeLetterTransversePaper = 54, + pagesizeA4TransversePaper = 55, + pagesizeLetterExtraTransversePaper = 56, + pagesizeSuperA_SuperA_A4Paper = 57, + pagesizeSuperB_SuperB_A3Paper = 58, + pagesizeLetterPlusPaper = 59, + pagesizeA4PlusPaper = 60, + pagesizeA5TransversePaper = 61, + pagesizeJISB5TransversePaper = 62, + pagesizeA3ExtraPaper = 63, + pagesizeA5ExtraPaper = 64, + pagesizeISOB5ExtraPaper = 65, + pagesizeA2Paper = 66, + pagesizeA3TransversePaper = 67, + pagesizeA3ExtraTransversePaper = 68 + }; + + DEFINE_SIMPLE_TYPE(CPageSize, EPageSize, pagesizeA4Paper) + + enum EPageUnits + { + mm = 0, + cm = 1, + inch = 2, + pt = 3, + px = 4, + emu = 5 + + }; + + DEFINE_SIMPLE_TYPE(CPageUnits, EPageUnits, mm) + + enum ECellComments + { + cellcommentsNone = 0, + cellcommentsAsDisplayed = 1, + cellcommentsAtEnd = 2 + }; + + + DEFINE_SIMPLE_TYPE(CCellComments, ECellComments, cellcommentsNone) + + enum EPrintError + { + printerrorDisplayed = 0, + printerrorBlank = 1, + printerrorDash = 2, + printerrorNA = 3 + }; + + DEFINE_SIMPLE_TYPE(CPrintError, EPrintError, printerrorDisplayed) + + enum EPageOrder + { + pageorderDownThenOver = 0, + pageorderOverThenDown = 1 + }; + + DEFINE_SIMPLE_TYPE(CPageOrder, EPageOrder, pageorderDownThenOver) + + enum ETotalsRowFunction + { + totalrowfunctionAverage = 1, + totalrowfunctionCount = 2, + totalrowfunctionCountNums = 3, + totalrowfunctionCustom = 4, + totalrowfunctionMax = 5, + totalrowfunctionMin = 6, + totalrowfunctionNone = 7, + totalrowfunctionStdDev = 8, + totalrowfunctionSum = 9, + totalrowfunctionVar = 10 + }; + + DEFINE_SIMPLE_TYPE(CTotalsRowFunction, ETotalsRowFunction, totalrowfunctionNone) + + enum ESortBy + { + sortbyCellColor = 1, + sortbyFontColor = 2, + sortbyIcon = 3, + sortbyValue = 4 + }; + + DEFINE_SIMPLE_TYPE(CSortBy, ESortBy, sortbyValue) + + enum ECustomFilter + { + customfilterEqual = 1, + customfilterGreaterThan = 2, + customfilterGreaterThanOrEqual = 3, + customfilterLessThan = 4, + customfilterLessThanOrEqual = 5, + customfilterNotEqual = 6 + }; + + DEFINE_SIMPLE_TYPE(CCustomFilter, ECustomFilter, customfilterEqual) + + enum EDateTimeGroup + { + datetimegroupDay = 1, + datetimegroupHour = 2, + datetimegroupMinute = 3, + datetimegroupMonth = 4, + datetimegroupSecond = 5, + datetimegroupYear = 6 + }; + + DEFINE_SIMPLE_TYPE(CDateTimeGroup, EDateTimeGroup, datetimegroupDay) + + enum ESortMethod + { + sortmethodNone = 1, + sortmethodPinYin = 2, + sortmethodStroke = 3, + }; + + DEFINE_SIMPLE_TYPE(CSortMethod, ESortMethod, sortmethodNone) + + enum EDynamicFilterType + { + dynamicfiltertypeAboveAverage = 1, + dynamicfiltertypeBelowAverage = 2, + dynamicfiltertypeLastMonth = 3, + dynamicfiltertypeLastQuarter = 4, + dynamicfiltertypeLastWeek = 5, + dynamicfiltertypeLastYear = 6, + dynamicfiltertypeM1 = 7, + dynamicfiltertypeM10 = 8, + dynamicfiltertypeM11 = 9, + dynamicfiltertypeM12 = 10, + dynamicfiltertypeM2 = 11, + dynamicfiltertypeM3 = 12, + dynamicfiltertypeM4 = 13, + dynamicfiltertypeM5 = 14, + dynamicfiltertypeM6 = 15, + dynamicfiltertypeM7 = 16, + dynamicfiltertypeM8 = 17, + dynamicfiltertypeM9 = 18, + dynamicfiltertypeNextMonth = 19, + dynamicfiltertypeNextQuarter = 20, + dynamicfiltertypeNextWeek = 21, + dynamicfiltertypeNextYear = 22, + dynamicfiltertypeNull = 23, + dynamicfiltertypeQ1 = 24, + dynamicfiltertypeQ2 = 25, + dynamicfiltertypeQ3 = 26, + dynamicfiltertypeQ4 = 27, + dynamicfiltertypeThisMonth = 28, + dynamicfiltertypeThisQuarter = 29, + dynamicfiltertypeThisWeek = 30, + dynamicfiltertypeThisYear = 31, + dynamicfiltertypeToday = 32, + dynamicfiltertypeTomorrow = 33, + dynamicfiltertypeYearToDate = 34, + dynamicfiltertypeYesterday = 35 + }; + + DEFINE_SIMPLE_TYPE(CDynamicFilterType, EDynamicFilterType, dynamicfiltertypeNull) + + //-------------------------------------------------------- + // ST_IconSetType (18.18.42) + //-------------------------------------------------------- + enum EIconSetType + { + Arrows3 = 0, + Arrows3Gray = 1, + Flags3 = 2, + Signs3 = 3, + Symbols3 = 4, + Symbols3_2 = 5, + Traffic3Lights1 = 6, + Traffic3Lights2 = 7, + Arrows4 = 8, + Arrows4Gray = 9, + Rating4 = 10, + RedToBlack4 = 11, + Traffic4Lights = 12, + Arrows5 = 13, + Arrows5Gray = 14, + Quarters5 = 15, + Rating5 = 16, + Triangles3 = 17, + Stars3 = 18, + Boxes5 = 19, + NoIcons = 20 + + + }; + + DEFINE_SIMPLE_TYPE(ST_IconSetType, EIconSetType, Arrows3) + + //-------------------------------------------------------- + // ST_DataBarAxisPosition + //-------------------------------------------------------- + enum EDataBarAxisPosition + { + automatic_pos = 0, + middle_pos = 1, + none_pos = 2 + }; + + DEFINE_SIMPLE_TYPE(ST_DataBarAxisPosition, EDataBarAxisPosition, automatic_pos) + + //-------------------------------------------------------- + // ST_DataBarDirection + //-------------------------------------------------------- + enum EDataBarDirection + { + context_direction = 0, + leftToRight = 1, + rightToLeft = 2 + }; + + DEFINE_SIMPLE_TYPE(ST_DataBarDirection, EDataBarDirection, context_direction) + + //---------------------------------------------------- + // 18.18.15 ST_CfOperator (Conditional Format Operators) + //---------------------------------------------------- + enum ECfOperator + { + Operator_beginsWith = 0, + Operator_between = 1, + Operator_containsText = 2, + Operator_endsWith = 3, + Operator_equal = 4, + Operator_greaterThan = 5, + Operator_greaterThanOrEqual = 6, + Operator_lessThan = 7, + Operator_lessThanOrEqual = 8, + Operator_notBetween = 9, + Operator_notContains = 10, + Operator_notEqual = 11 + }; + + DEFINE_SIMPLE_TYPE(ST_CfOperator, ECfOperator, Operator_equal) + + //---------------------------------------------------- + // 18.18.82 ST_TimePeriod (Conditional Format Value Object Type) + //---------------------------------------------------- + enum ETimePeriod + { + last7Days = 0, + lastMonth = 1, + lastWeek = 2, + nextMonth = 3, + nextWeek = 4, + thisMonth = 5, + thisWeek = 6, + today = 7, + tomorrow = 8, + yesterday = 9 + }; + + DEFINE_SIMPLE_TYPE(ST_TimePeriod, ETimePeriod, last7Days) + + //---------------------------------------------------- + // 18.18.12 ST_CfType (Conditional Format Type) + //---------------------------------------------------- + enum ECfType + { + aboveAverage = 0, + beginsWith = 1, + cellIs = 2, + colorScale = 3, + containsBlanks = 4, + containsErrors = 5, + containsText = 6, + dataBar = 7, + duplicateValues = 8, + expression = 9, + iconSet = 10, + notContainsBlanks = 11, + notContainsErrors = 12, + notContainsText = 13, + timePeriod = 14, + top10 = 15, + uniqueValues = 16, + endsWith = 17 + }; + + DEFINE_SIMPLE_TYPE(ST_CfType, ECfType, dataBar) + + //---------------------------------------------------- + // 18.18.13 ST_CfvoType (Conditional Format Value Object Type) + //---------------------------------------------------- + enum ECfvoType + { + Formula = 0, + Maximum = 1, + Minimum = 2, + Number = 3, + Percent = 4, + Percentile = 5, + autoMin = 6, + autoMax = 7 + }; + + DEFINE_SIMPLE_TYPE(ST_CfvoType, ECfvoType, Number) + + enum ESparklineType + { + Line = 0, + Column = 1, + Stacked = 2 + }; + + DEFINE_SIMPLE_TYPE(ST_SparklineType, ESparklineType, Line) + + enum ESparklineAxisMinMax + { + Individual = 0, + Group = 1, + Custom = 2 + }; + + DEFINE_SIMPLE_TYPE(ST_SparklineAxisMinMax, ESparklineAxisMinMax, Individual) + + enum EDvAspect + { + Content = 0, + Icon = 1 + }; + + DEFINE_SIMPLE_TYPE(ST_DvAspect, EDvAspect, Icon) + + enum EOleUpdate + { + Always = 0, + OnCall = 1 + }; + + DEFINE_SIMPLE_TYPE(ST_OleUpdate, EOleUpdate, Always) + + enum EActivePane + { + activepaneBottomLeft = 0, + activepaneBottomRight = 1, + activepaneTopLeft = 2, + activepaneTopRight = 3 + }; + + DEFINE_SIMPLE_TYPE(CActivePane, EActivePane, activepaneTopLeft) + + enum EPaneState + { + panestateFrozen = 0, + panestateFrozenSplit = 1, + panestateSplit = 2 + }; + + DEFINE_SIMPLE_TYPE(CPaneState, EPaneState, panestateFrozen) + + enum EDdeValueType + { + ddevaluetypeNil = 0, + ddevaluetypeB = 1, + ddevaluetypeN = 2, + ddevaluetypeE = 3, + ddevaluetypeStr = 4 + }; + + DEFINE_SIMPLE_TYPE(CDdeValueType, EDdeValueType, ddevaluetypeNil) + + enum ECalcMode + { + calcmodeAuto = 0, + calcmodeAutoNoTable = 1, + calcmodeManual = 2, + }; + + DEFINE_SIMPLE_TYPE(CCalcMode, ECalcMode, calcmodeAuto) + + enum ERefMode + { + refmodeA1 = 0, + refmodeR1C1 = 1 + }; + + DEFINE_SIMPLE_TYPE(CRefMode, ERefMode, refmodeA1) + + enum EDoubleOrAutomatic + { + typeAuto = 0, + typeDouble = 1 + }; + + template + class CDoubleOrAutomatic : public CSimpleType + { + public: + double m_dValue; + CDoubleOrAutomatic() : m_dValue(0){} + + CDoubleOrAutomatic(const double & val) { m_dValue = val; this->m_eValue = typeDouble; } + CDoubleOrAutomatic(const EDoubleOrAutomatic & val) { this->m_eValue = val; m_dValue = 0; } + + virtual EDoubleOrAutomatic FromString(const std::wstring &sValue); + double GetDoubleValue() const; + virtual std::wstring ToString () const; + + SimpleTypes_Default(CDoubleOrAutomatic) + }; + + enum ESeriesLayout + { + typeSeriesLayoutBoxWhisker = 0, + typeSeriesLayoutClusteredColumn = 1, + typeSeriesLayoutFunnel = 2, + typeSeriesLayoutParetoLine = 3, + typeSeriesLayoutRegionMap = 4, + typeSeriesLayoutSunburst = 5, + typeSeriesLayoutTreemap = 6, + typeSeriesLayoutWaterfall = 7, + }; + + + DEFINE_SIMPLE_TYPE(CSeriesLayout, ESeriesLayout, typeSeriesLayoutBoxWhisker) + + enum EAxisUnit + { + unitHundreds = 0, + unitThousands = 1, + unitTenThousands = 2, + unitHundredThousands = 3, + unitMillions = 4, + unitTenMillions = 5, + unitHundredMillions = 6, + unitBillions = 7, + unitTrillions = 8, + unitPercentage = 9 + + }; + + DEFINE_SIMPLE_TYPE(CAxisUnit, EAxisUnit, unitPercentage) + + enum EDimensionType + { + typeDimensionVal = 0, + typeDimensionX = 1, + typeDimensionY = 2, + typeDimensionSize = 3, + typeDimensionColorVal = 4, + typeDimensionCat = 10, + typeDimensionColorStr = 11 + }; + + DEFINE_SIMPLE_TYPE(CDimensionType, EDimensionType, typeDimensionVal) + + enum EFormulaDirection + { + directionCol = 0, + directionRow = 1 + }; + + DEFINE_SIMPLE_TYPE(CFormulaDirection, EFormulaDirection, directionCol) + + enum ESidePos + { + sideLeft = 0, + sideRight = 1, + sideTop = 2, + sideBottom = 3 + }; + + DEFINE_SIMPLE_TYPE(CSidePos, ESidePos, sideTop) + + enum EPosAlign + { + posAlignMin = 0, + posAlignCtr = 1, + posAlignMax = 2 + }; + + DEFINE_SIMPLE_TYPE(CPosAlign, EPosAlign, posAlignCtr) + + enum ERegionLabelLayout + { + layoutNone = 0, + layoutBestFitOnly = 1, + layoutShowAll = 2 + }; + + DEFINE_SIMPLE_TYPE(CRegionLabelLayout, ERegionLabelLayout, layoutNone) + + enum EParentLabelLayout + { + layoutNone_ = 0, + layoutBanner = 1, + layoutOverlapping = 2 + }; + + DEFINE_SIMPLE_TYPE(CParentLabelLayout, EParentLabelLayout, layoutNone_) + + enum EQuartileMethod + { + methodInclusive = 0, + methodExclusive = 1, + }; + + DEFINE_SIMPLE_TYPE(CQuartileMethod, EQuartileMethod, methodInclusive) + + enum EDataLabelPos + { + posBestFit = 0, + posBottom = 1, + posCtr = 2, + posInBase = 3, + posInEnd = 4, + posLeft = 5, + posOutEnd = 6, + posRight = 7, + posTop = 8 + + }; + + DEFINE_SIMPLE_TYPE(CDataLabelPos, EDataLabelPos, posBestFit) + + DEFINE_SIMPLE_TYPE(CIntervalClosedSide, ESidePos, sideLeft) + + enum ETickMarksType + { + marksTypeIn = 0, + marksTypeOut = 1, + marksTypeCross = 2, + marksTypeNone = 3 + + }; + + DEFINE_SIMPLE_TYPE(CTickMarksType, ETickMarksType, marksTypeNone) + + enum ESourceCacheType + { + typeSourceConsolidation = 0, + typeSourceExternal = 1, + typeSourceScenario = 2, + typeSourceWorksheet = 3, + }; + + DEFINE_SIMPLE_TYPE(CSourceCacheType, ESourceCacheType, typeSourceWorksheet) + + enum EValuesGroupBy + { + groupByDays = 0, + groupByHours = 1, + groupByMinutes = 2, + groupByMonths = 3, + groupByQuarters = 4, + groupByNumericRanges = 5, + groupBySeconds = 6, + groupByYears = 7 + }; + + DEFINE_SIMPLE_TYPE(CValuesGroupBy, EValuesGroupBy, groupByMonths) + + enum EPivotItemType + { + typeAverage = 0, + typeBlank = 1, + typeCount = 2, + typeCountA = 3, + typeData = 4, + typeDefault = 5, + typeGrandTotalt = 6, + typeMin = 7, + typeMax = 8, + typeProduct = 9, + typeStdDev = 10, + typeStdDevP = 11, + typeSum = 12, + typeVar = 13, + typeVarP = 14 + }; + + DEFINE_SIMPLE_TYPE(CPivotItemType, EPivotItemType, typeSum) + + enum EFieldSortType + { + sortManual = 0, + sortAscending = 1, + sortDescending = 2 + }; + + DEFINE_SIMPLE_TYPE(CFieldSortType, EFieldSortType, sortManual) + + enum EPivotAreaType + { + areaAll = 0, + areaFieldButton = 1, + areaData = 2, + areaNone = 3, + areaNormal = 4, + areaOrigin = 5, + areaTopEnd = 6 + }; + + DEFINE_SIMPLE_TYPE(CPivotAreaType, EPivotAreaType, areaNone) + + enum EPivotAxisType + { + axisCol = 0, + axisPage = 1, + axisRow = 2, + axisValues = 3 + }; + + DEFINE_SIMPLE_TYPE(CPivotAxisType, EPivotAxisType, axisCol) + + enum EFormatAction + { + actionBlank = 0, + actionDrill = 1, + actionFormatting= 2, + actionFormula = 3 + }; + + DEFINE_SIMPLE_TYPE(CFormatAction, EFormatAction, actionBlank) + + enum EShowDataAs + { + dataAsDifference = 0, + dataAsIndex = 1, + dataAsNormal = 2, + dataAsPercentOff = 3, + dataAsPercentDiff = 4, + dataAsPercentOfCol = 5, + dataAsPercentOfRow = 6, + dataAsPercentOfTotal = 7, + dataAsRunTotal = 8 + }; + + DEFINE_SIMPLE_TYPE(CShowDataAs, EShowDataAs, dataAsRunTotal) + + enum EDataConsolidateFunction + { + functionAverage = 0, + functionCount = 1, + functionCountNums = 2, + functionMaximum = 3, + functionMinimum = 4, + functionProduct = 5, + functionStdDev = 6, + functionStdDevP = 7, + functionSum = 8, + functionVariance = 9, + functionVarP = 10 + }; + + DEFINE_SIMPLE_TYPE(CDataConsolidateFunction, EDataConsolidateFunction, functionSum) + + enum EDataValidationType + { + validationTypeNone = 0, + validationTypeCustom = 1, + validationTypeDate = 2, + validationTypeDecimal = 3, + validationTypeList = 4, + validationTypeTextLength= 5, + validationTypeTime = 6, + validationTypeWhole = 7 + }; + + DEFINE_SIMPLE_TYPE(CDataValidationType, EDataValidationType, validationTypeNone) + + enum EDataValidationErrorStyle + { + errorStyleStop = 0, + errorStyleWarning = 1, + errorStyleInformation = 2 + }; + + DEFINE_SIMPLE_TYPE(CDataValidationErrorStyle, EDataValidationErrorStyle, errorStyleStop) + + enum EDataValidationOperator + { + operatorBetween = 0, + operatorNotBetween = 1, + operatorEqual = 2, + operatorNotEqual = 3, + operatorLessThan = 4, + operatorLessThanOrEqual = 5, + operatorGreaterThan = 6, + operatorGreaterThanOrEqual = 7 + }; + + DEFINE_SIMPLE_TYPE(CDataValidationOperator, EDataValidationOperator, operatorBetween) + + enum EDataValidationImeMode + { + imeModeNoControl = 0, + imeModeOff = 1, + imeModeOn = 2, + imeModeDisabled = 3, + imeModeHiragana = 4, + imeModeFullKatakana = 5, + imeModeHalfKatakana = 6, + imeModeFullAlpha = 7, + imeModeHalfAlpha = 8, + imeModeFullHangul = 9, + imeModeHalfHangul = 10 + }; + + DEFINE_SIMPLE_TYPE(CDataValidationImeMode, EDataValidationImeMode, imeModeNoControl) + + enum EObjectType + { + objectButton = 0, + objectCheckBox = 1, + objectDrop = 2, + objectGBox = 3, + objectLabel = 4, + objectList = 5, + objectRadio = 6, + objectScroll = 7, + objectSpin = 8, + objectEditBox = 9, + objectDialog = 10, + objectToggleButton = 11, + objectTabStrip = 12, + objectImage = 13 + }; + + DEFINE_SIMPLE_TYPE(CObjectType, EObjectType, objectButton) + + enum EChecked + { + valUnchecked = 0, + valChecked = 1, + valMixed = 2 + }; + + DEFINE_SIMPLE_TYPE(CChecked, EChecked, valUnchecked) + + enum EDropStyle + { + valCombo = 0, + valComboedit = 1, + valSimple = 2 + }; + + DEFINE_SIMPLE_TYPE_START(CDropStyle, EDropStyle, valSimple) + public: + std::wstring ToVmlString() const; + }; + + enum ESelType + { + valSingle = 0, + valMulti = 1, + valExtended = 2 + }; + + DEFINE_SIMPLE_TYPE_START(CSelType, ESelType, valSingle) + public: + std::wstring ToVmlString() const; + }; + + enum EEditValidation + { + editText = 0, + editInteger = 1, + editNumber = 2, + editReference = 3, + editFormula = 4 + }; + + DEFINE_SIMPLE_TYPE(CEditValidation, EEditValidation, editText) + + enum ETabularSlicerCacheSortOrder + { + ctabularslicercachesortorderAscending = 0, + ctabularslicercachesortorderDescending = 1 + }; + + DEFINE_SIMPLE_TYPE(CTabularSlicerCacheSortOrder, ETabularSlicerCacheSortOrder, ctabularslicercachesortorderAscending) + + enum ESlicerCacheCrossFilter + { + cslicercachecrossfilterNone = 0, + cslicercachecrossfilterShowItemsWithDataAtTop = 1, + cslicercachecrossfilterShowItemsWithNoData = 2 + }; + + DEFINE_SIMPLE_TYPE(CSlicerCacheCrossFilter, ESlicerCacheCrossFilter, cslicercachecrossfilterNone) + + enum EOlapSlicerCacheSortOrder + { + colapslicercachesortorderNatural = 0, + colapslicercachesortorderAscending = 1, + colapslicercachesortorderDescending = 2 + }; + + DEFINE_SIMPLE_TYPE(COlapSlicerCacheSortOrder, EOlapSlicerCacheSortOrder, colapslicercachesortorderNatural) + + enum ESlicerStyleType + { + cslicerstyletypeUnselectedItemWithData = 0, + cslicerstyletypeSelectedItemWithData = 1, + cslicerstyletypeUnselectedItemWithNoData = 2, + cslicerstyletypeSelectedItemWithNoData = 3, + cslicerstyletypeHoveredUnselectedItemWithData = 4, + cslicerstyletypeHoveredSelectedItemWithData = 5, + cslicerstyletypeHoveredUnselectedItemWithNoData = 6, + cslicerstyletypeHoveredSelectedItemWithNoData = 7 + }; + + DEFINE_SIMPLE_TYPE(CSlicerStyleType, ESlicerStyleType, cslicerstyletypeUnselectedItemWithData) + + }// Spreadsheet +} // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Vml.cpp b/Common/DocxFormat/Source/Common/SimpleTypes_Vml.cpp new file mode 100644 index 0000000000..7b569a5734 --- /dev/null +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Vml.cpp @@ -0,0 +1,3971 @@ +/* + * (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_Vml.h" +#include +#include +#include "../Base/Unit.h" + +// Here are simple types Vml from spec Office Open Xml Part4 14 +namespace SimpleTypes +{ + EEditAs CEditAs::FromString(const std::wstring &sValue) + { + this->m_eValue = editasCanvas; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( L"bullseye" == sValue ) this->m_eValue = editasBullseye; + break; + case 'c': + if ( L"canvas" == sValue ) this->m_eValue = editasCanvas; + else if ( L"cycle" == sValue ) this->m_eValue = editasCycle; + break; + case 'o': + if ( L"orgchart" == sValue ) this->m_eValue = editasOrgchart; + break; + case 'r': + if ( L"radial" == sValue ) this->m_eValue = editasRadial; + break; + case 's': + if ( L"stacked" == sValue ) this->m_eValue = editasStacked; + break; + case 'v': + if ( L"venn" == sValue ) this->m_eValue = editasVenn; + break; + } + + return this->m_eValue; + } + + std::wstring CEditAs::ToString() const + { + switch(this->m_eValue) + { + case editasBullseye : return L"bullseye"; + case editasCanvas : return L"canvas"; + case editasCycle : return L"cycle"; + case editasOrgchart : return L"orgchart"; + case editasRadial : return L"radial"; + case editasStacked : return L"stacked"; + case editasVenn : return L"venn"; + default : return L"canvas"; + } + } + + //-------------------------------------------------------------------------------- + // Ext 14.1.3.2 (Part 4) + //-------------------------------------------------------------------------------- + + EExt CExt::FromString(const std::wstring &sValue) + { + this->m_eValue = extView; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( L"backwardCompatible" == sValue ) this->m_eValue = extBackwardCompatible; + break; + case 'e': + if ( L"edit" == sValue ) this->m_eValue = extEdit; + break; + case 'v': + if ( L"view" == sValue ) this->m_eValue = extView; + break; + } + + return this->m_eValue; + } + + std::wstring CExt::ToString () const + { + switch(this->m_eValue) + { + case extBackwardCompatible : return L"backwardCompatible"; + case extEdit : return L"edit"; + case extView : return L"view"; + default : return L"view"; + } + } + + //-------------------------------------------------------------------------------- + // FillMethod 14.1.3.3 (Part 4) + //-------------------------------------------------------------------------------- + + EFillMethod CFillMethod::FromString(const std::wstring& sValue) + { + if (L"any" == sValue) this->m_eValue = fillmethodAny; + else if (L"linear" == sValue) this->m_eValue = fillmethodLinear; + else if (L"linear sigma"== sValue) this->m_eValue = fillmethodLinearSigma; + else if (L"sigma" == sValue) this->m_eValue = fillmethodSigma; + else if (L"none" == sValue) this->m_eValue = fillmethodNone; + else this->m_eValue = fillmethodNone; + + return this->m_eValue; + } + + std::wstring CFillMethod::ToString() const + { + switch (this->m_eValue) + { + case fillmethodAny : return L"any"; + case fillmethodLinear : return L"linear"; + case fillmethodLinearSigma : return L"linearSigma"; + case fillmethodSigma : return L"sigma"; + case fillmethodNone : return L"none"; + default : return L"none"; + } + } + + //-------------------------------------------------------------------------------- + // FillType 14.1.3.4;14.2.3.14 (Part 4) + //-------------------------------------------------------------------------------- + + void CFillType::SetValue (EFillType eValue) + { + if ( filltypeFrame == eValue || filltypeGradient == eValue || eValue == filltypeGradientRadial || + filltypePattern == eValue || filltypeSolid == eValue || filltypeTile == eValue ) + this->m_eValue = eValue; + else + this->m_eValue = filltypeSolid; + } + + EFillType CFillType::FromString(const std::wstring &sValue) + { + if (L"frame" == sValue) this->m_eValue = filltypeFrame; + else if (L"gradient" == sValue) this->m_eValue = filltypeGradient; + else if (L"gradientRadial" == sValue) this->m_eValue = filltypeGradientRadial; + else if (L"pattern" == sValue) this->m_eValue = filltypePattern; + else if (L"solid" == sValue) this->m_eValue = filltypeSolid; + else if (L"tile" == sValue) this->m_eValue = filltypeTile; + else this->m_eValue = filltypeSolid; + + return this->m_eValue; + } + + std::wstring CFillType::ToString() const + { + switch (this->m_eValue) + { + case filltypeFrame : return L"frame"; + case filltypeGradient : return L"gradient"; + case filltypeGradientRadial : return L"gradientRadial"; + case filltypePattern : return L"pattern"; + case filltypeSolid : return L"solid"; + case filltypeTile : return L"tile"; + default : return L"solid"; + } + } + + //-------------------------------------------------------------------------------- + // + //-------------------------------------------------------------------------------- + + EFillType CFillType1::FromString(const std::wstring &sValue) + { + if (L"background" == sValue) this->m_eValue = filltypeBackground; + else if (L"frame" == sValue) this->m_eValue = filltypeFrame; + else if (L"gradient" == sValue) this->m_eValue = filltypeGradient; + else if (L"gradientCenter" == sValue) this->m_eValue = filltypeGradientCenter; + else if (L"gradientRadial" == sValue) this->m_eValue = filltypeGradientRadial; + else if (L"gradientUnscaled" == sValue) this->m_eValue = filltypeGradientUnscaled; + else if (L"pattern" == sValue) this->m_eValue = filltypePattern; + else if (L"solid" == sValue) this->m_eValue = filltypeSolid; + else if (L"tile" == sValue) this->m_eValue = filltypeTile; + else this->m_eValue = filltypeSolid; + + return this->m_eValue; + } + + std::wstring CFillType1::ToString() const + { + switch (this->m_eValue) + { + case filltypeBackground : return L"background"; + case filltypeFrame : return L"frame"; + case filltypeGradient : return L"gradient"; + case filltypeGradientCenter : return L"gradientCenter"; + case filltypeGradientRadial : return L"gradientRadial"; + case filltypeGradientUnscaled : return L"gradientUnscaled"; + case filltypePattern : return L"pattern"; + case filltypeSolid : return L"solid"; + case filltypeTile : return L"tile"; + default : return L"solid"; + } + } + + //-------------------------------------------------------------------------------- + // ImageAspect 14.1.3.5 (Part 4) + //-------------------------------------------------------------------------------- + + EImageAspect CImageAspect::FromString(const std::wstring &sValue) + { + this->m_eValue = imageaspectIgnore; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( L"atLeast" == sValue ) this->m_eValue = imageaspectAtLeast; + else if ( L"atMost" == sValue ) this->m_eValue = imageaspectAtMost; + break; + case 'i': + if ( L"ignore" == sValue ) this->m_eValue = imageaspectIgnore; + break; + } + + return this->m_eValue; + } + + std::wstring CImageAspect::ToString () const + { + switch(this->m_eValue) + { + case imageaspectAtLeast : return L"atLeast"; + case imageaspectAtMost : return L"atMost"; + case imageaspectIgnore : return L"ignore"; + default : return L"ignore"; + } + } + + // ------------------------------------------------------------------------------- + // ShadowType 14.1.3.6 (Part 4) + // ------------------------------------------------------------------------------- + + EShadowType CShadowType::FromString(const std::wstring &sValue) + { + if (L"double" == sValue) this->m_eValue = shadowtypeDouble; + else if (L"emboss" == sValue) this->m_eValue = shadowtypeEmboss; + else if (L"perspective" == sValue) this->m_eValue = shadowtypePerspective; + else if (L"single" == sValue) this->m_eValue = shadowtypeSingle; + else this->m_eValue = shadowtypeSingle; + + return this->m_eValue; + } + + std::wstring CShadowType::ToString() const + { + switch (this->m_eValue) + { + case shadowtypeDouble : return L"double"; + case shadowtypeEmboss : return L"emboss"; + case shadowtypePerspective : return L"perspective"; + case shadowtypeSingle : return L"single"; + default : return L"single"; + } + } + + //-------------------------------------------------------------------------------- + // StrokeArrowLength 14.1.3.7 (Part 4) + //-------------------------------------------------------------------------------- + + EStrokeArrowLength CStrokeArrowLength::FromString(const std::wstring &sValue) + { + this->m_eValue = strokearrowlengthMedium; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'l': + if ( L"long" == sValue ) this->m_eValue = strokearrowlengthLong; + break; + case 'm': + if ( L"medium" == sValue ) this->m_eValue = strokearrowlengthMedium; + break; + case 's': + if ( L"short" == sValue ) this->m_eValue = strokearrowlengthShort; + break; + } + + return this->m_eValue; + } + + std::wstring CStrokeArrowLength::ToString() const + { + switch(this->m_eValue) + { + case strokearrowlengthLong : return L"long"; + case strokearrowlengthMedium : return L"medium"; + case strokearrowlengthShort : return L"short"; + default : return L"medium"; + } + } + + //-------------------------------------------------------------------------------- + // StrokeArrowType 14.1.3.8 (Part 4) + //-------------------------------------------------------------------------------- + + EStrokeArrowType CStrokeArrowType::FromString(const std::wstring &sValue) + { + this->m_eValue = strokearrowtypeNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( L"block" == sValue ) this->m_eValue = strokearrowtypeBlock; + break; + case 'c': + if ( L"classic" == sValue ) this->m_eValue = strokearrowtypeClassic; + break; + case 'd': + if ( L"diamond" == sValue ) this->m_eValue = strokearrowtypeDiamond; + break; + case 'n': + if ( L"none" == sValue ) this->m_eValue = strokearrowtypeNone; + break; + case 'o': + if ( L"open" == sValue ) this->m_eValue = strokearrowtypeOpen; + else if ( L"oval" == sValue ) this->m_eValue = strokearrowtypeOval; + break; + } + + return this->m_eValue; + } + + std::wstring CStrokeArrowType::ToString () const + { + switch(this->m_eValue) + { + case strokearrowtypeBlock : return L"block"; + case strokearrowtypeClassic : return L"classic"; + case strokearrowtypeDiamond : return L"diamond"; + case strokearrowtypeNone : return L"none"; + case strokearrowtypeOpen : return L"open"; + case strokearrowtypeOval : return L"oval"; + default : return L"none"; + } + } + + //-------------------------------------------------------------------------------- + // StrokeArrowWidth 14.1.3.9 (Part 4) + //-------------------------------------------------------------------------------- + + EStrokeArrowWidth CStrokeArrowWidth::FromString(const std::wstring &sValue) + { + this->m_eValue = strokearrowwidthMedium; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'm': + if ( L"medium" == sValue ) this->m_eValue = strokearrowwidthMedium; + break; + case 'n': + if ( L"narrow" == sValue ) this->m_eValue = strokearrowwidthNarrow; + break; + case 'w': + if ( L"wide" == sValue ) this->m_eValue = strokearrowwidthWide; + break; + } + + return this->m_eValue; + } + + std::wstring CStrokeArrowWidth::ToString() const + { + switch(this->m_eValue) + { + case strokearrowwidthMedium : return L"medium"; + case strokearrowwidthNarrow : return L"narrow"; + case strokearrowwidthWide : return L"wide"; + default : return L"medium"; + } + } + + //-------------------------------------------------------------------------------- + // StrokeEndCap 14.1.3.10 (Part 4) + //-------------------------------------------------------------------------------- + + EStrokeEndCap CStrokeEndCap::FromString(const std::wstring &sValue) + { + this->m_eValue = strokeendcapRound; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'f': + if ( L"flat" == sValue ) this->m_eValue = strokeendcapFlat; + break; + case 'r': + if ( L"round" == sValue ) this->m_eValue = strokeendcapRound; + break; + case 's': + if ( L"square" == sValue ) this->m_eValue = strokeendcapSqaure; + break; + } + + return this->m_eValue; + } + + std::wstring CStrokeEndCap::ToString () const + { + switch(this->m_eValue) + { + case strokeendcapFlat : return L"flat"; + case strokeendcapRound : return L"round"; + case strokeendcapSqaure : return L"square"; + default : return L"round"; + } + } + + //-------------------------------------------------------------------------------- + // StrokeJoinStyle 14.1.3.11 (Part 4) + //-------------------------------------------------------------------------------- + + EStrokeJoinStyle CStrokeJoinStyle::FromString(const std::wstring &sValue) + { + if (L"round" == sValue) this->m_eValue = strokejoinstyleRound; + else if (L"miter" == sValue) this->m_eValue = strokejoinstyleMiter; + else if (L"bevel" == sValue) this->m_eValue = strokejoinstyleMiter; + else this->m_eValue = strokejoinstyleRound; + + return this->m_eValue; + } + + std::wstring CStrokeJoinStyle::ToString() const + { + switch (this->m_eValue) + { + case strokejoinstyleRound : return L"round"; + case strokejoinstyleMiter : return L"miter"; + case strokejoinstyleBevel : return L"bevel"; + default : return L"round"; + } + } + + //-------------------------------------------------------------------------------- + // StrokeLineStyle 14.1.3.12 (Part 4) + //-------------------------------------------------------------------------------- + + EStrokeLineStyle CStrokeLineStyle::FromString(const std::wstring &sValue) + { + this->m_eValue = strokelinestyleSingle; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 's': + if ( L"single" == sValue ) this->m_eValue = strokelinestyleSingle; + break; + case 't': + if ( L"thickBetweenThin" == sValue ) this->m_eValue = strokelinestyleThickBetweenThin; + else if ( L"thickThin" == sValue ) this->m_eValue = strokelinestyleThickThin; + else if ( L"thinThick" == sValue ) this->m_eValue = strokelinestyleThinThick; + else if ( L"thinThin" == sValue ) this->m_eValue = strokelinestyleThinThin; + break; + } + + return this->m_eValue; + } + + std::wstring CStrokeLineStyle::ToString () const + { + switch(this->m_eValue) + { + case strokelinestyleSingle : return L"single"; + case strokelinestyleThickBetweenThin : return L"thickBetweenThin"; + case strokelinestyleThickThin : return L"thickThin"; + case strokelinestyleThinThick : return L"thinThick"; + case strokelinestyleThinThin : return L"thinThin"; + default : return L"single"; + } + } +} +namespace SimpleTypes +{ + //-------------------------------------------------------------------------------- + // AlternateMathContentType 14.2.3.1 (Part 4) + //-------------------------------------------------------------------------------- + + EAlternateMathContentType CAlternateMathContentType::FromString(const std::wstring &sValue) + { + this->m_eValue = alternatemathcontenttypeOfficeOpenXmlMath; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'o': + if ( L"officeopenxmlmath" == sValue ) this->m_eValue = alternatemathcontenttypeOfficeOpenXmlMath; + break; + case 'm': + if ( L"mathml" == sValue ) this->m_eValue = alternatemathcontenttypeMathMl; + break; + } + + return this->m_eValue; + } + + std::wstring CAlternateMathContentType::ToString () const + { + switch(this->m_eValue) + { + case alternatemathcontenttypeOfficeOpenXmlMath: return L"officeopenxmlmath"; + case alternatemathcontenttypeMathMl: return L"mathml"; + default : return L"officeopenxmlmath"; + } + } + + //-------------------------------------------------------------------------------- + // VmlAngle 14.2.3.2 (Part 4) + //-------------------------------------------------------------------------------- + + EVmlAngle CVmlAngle::FromString(const std::wstring &sValue) + { + this->m_eValue = vmlangleAuto; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case '3': + if ( L"30" == sValue ) this->m_eValue = vmlangle30; + break; + case '4': + if ( L"45" == sValue ) this->m_eValue = vmlangle45; + break; + case '6': + if ( L"60" == sValue ) this->m_eValue = vmlangle60; + break; + case '9': + if ( L"90" == sValue ) this->m_eValue = vmlangle90; + break; + case 'a': + if ( L"any" == sValue ) this->m_eValue = vmlangleAny; + else if ( L"auto" == sValue ) this->m_eValue = vmlangleAuto; + break; + + } + + return this->m_eValue; + } + + std::wstring CVmlAngle::ToString() const + { + switch(this->m_eValue) + { + case vmlangle30: return L"30"; + case vmlangle45: return L"45"; + case vmlangle60: return L"60"; + case vmlangle90: return L"90"; + case vmlangleAny: return L"any"; + case vmlangleAuto: return L"auto"; + default : return L"auto"; + } + } + + //-------------------------------------------------------------------------------- + // BWMode 14.2.3.3 (Part 4) + //-------------------------------------------------------------------------------- + + EBWMode CBWMode::FromString(const std::wstring &sValue) + { + this->m_eValue = bwmodeAuto; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( L"auto" == sValue ) this->m_eValue = bwmodeAuto; + break; + case 'b': + if ( L"black" == sValue ) this->m_eValue = bwmodeBlack; + else if ( L"blackTextAndLines" == sValue ) this->m_eValue = bwmodeBlackTextAndLines; + break; + case 'c': + if ( L"color" == sValue ) this->m_eValue = bwmodeColor; + break; + case 'g': + if ( L"grayOutline" == sValue ) this->m_eValue = bwmodeGrayOutline; + else if ( L"grayScale" == sValue ) this->m_eValue = bwmodeGrayScale; + break; + case 'h': + if ( L"hide" == sValue ) this->m_eValue = bwmodeHide; + else if ( L"highContrast" == sValue ) this->m_eValue = bwmodeHighContrast; + break; + case 'i': + if ( L"inverseGray" == sValue ) this->m_eValue = bwmodeInverseGray; + break; + case 'l': + if ( L"lightGrayscale" == sValue ) this->m_eValue = bwmodeLightGrayscale; + break; + case 'u': + if ( L"undrawn" == sValue ) this->m_eValue = bwmodeUndrawn; + break; + case 'w': + if ( L"white" == sValue ) this->m_eValue = bwmodeWhite; + break; + + } + + return this->m_eValue; + } + + std::wstring CBWMode::ToString() const + { + switch(this->m_eValue) + { + case bwmodeAuto: return L"auto"; + case bwmodeBlack: return L"black"; + case bwmodeBlackTextAndLines: return L"blackTextAndLines"; + case bwmodeColor: return L"color"; + case bwmodeGrayOutline: return L"grayOutline"; + case bwmodeGrayScale: return L"grayScale"; + case bwmodeHide: return L"hide"; + case bwmodeHighContrast: return L"highContrast"; + case bwmodeInverseGray: return L"inverseGray"; + case bwmodeLightGrayscale: return L"lightGrayscale"; + case bwmodeUndrawn: return L"undrawn"; + case bwmodeWhite: return L"white"; + default : return L"auto"; + } + } + + //-------------------------------------------------------------------------------- + // CalloutDrop 14.2.3.4 (Part 4) + //-------------------------------------------------------------------------------- + + CCalloutDrop::CCalloutDrop() {} + + std::wstring CCalloutDrop::GetValue() const + { + return m_sValue; + } + + void CCalloutDrop::SetValue(std::wstring &sValue) + { + m_sValue = sValue; + } + + + std::wstring CCalloutDrop::FromString(const std::wstring &sValue) + { + m_sValue = sValue; + + return m_sValue; + } + + std::wstring CCalloutDrop::ToString () const + { + return m_sValue; + } + + //-------------------------------------------------------------------------------- + // ColorMode 14.2.3.6 (Part 4) + //-------------------------------------------------------------------------------- + + EColorMode CColorMode::FromString(const std::wstring &sValue) + { + this->m_eValue = colormodeAuto; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( L"auto" == sValue ) this->m_eValue = colormodeAuto; + break; + case 'c': + if ( L"custom" == sValue ) this->m_eValue = colormodeCustom; + break; + } + + return this->m_eValue; + } + + std::wstring CColorMode::ToString () const + { + switch(this->m_eValue) + { + case colormodeAuto: return L"auto"; + case colormodeCustom: return L"custom"; + default : return L"auto"; + } + } + + //-------------------------------------------------------------------------------- + // ConnectorType 14.2.3.7 (Part 4) + //-------------------------------------------------------------------------------- + + EConnectorType CConnectorType::FromString(const std::wstring &sValue) + { + this->m_eValue = connectortypeNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( L"curved" == sValue ) this->m_eValue = connectortypeCurved; + break; + case 'e': + if ( L"elbow" == sValue ) this->m_eValue = connectortypeElbow; + break; + case 'n': + if ( L"none" == sValue ) this->m_eValue = connectortypeNone; + break; + case 's': + if ( L"straight" == sValue ) this->m_eValue = connectortypeStraight; + break; + } + + return this->m_eValue; + } + + std::wstring CConnectorType::ToString() const + { + switch(this->m_eValue) + { + case connectortypeCurved : return L"curved"; + case connectortypeElbow : return L"elbow"; + case connectortypeNone : return L"none"; + case connectortypeStraight: return L"straight"; + default : return L"none"; + } + } + + //-------------------------------------------------------------------------------- + // ConnectType 14.2.3.8 (Part 4) + //-------------------------------------------------------------------------------- + + EConnectType CConnectType::FromString(const std::wstring &sValue) + { + this->m_eValue = connecttypeNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( L"custom" == sValue ) this->m_eValue = connecttypeCustom; + break; + case 'n': + if ( L"none" == sValue ) this->m_eValue = connecttypeNone; + break; + case 'r': + if ( L"rect" == sValue ) this->m_eValue = connecttypeRect; + break; + case 's': + if ( L"segments" == sValue ) this->m_eValue = connecttypeSegments; + break; + } + + return this->m_eValue; + } + + std::wstring CConnectType::ToString () const + { + switch(this->m_eValue) + { + case connecttypeCustom : return L"custom"; + case connecttypeNone : return L"none"; + case connecttypeRect : return L"rect"; + case connecttypeSegments: return L"segments"; + default : return L"none"; + } + } + + //-------------------------------------------------------------------------------- + // ContentType 14.2.3.9 (Part 4) + //-------------------------------------------------------------------------------- + + CContentType::CContentType() {} + + std::wstring CContentType::GetValue() const + { + return m_sValue; + } + + void CContentType::SetValue(std::wstring &sValue) + { + m_sValue = sValue; + } + + std::wstring CContentType::FromString(const std::wstring &sValue) + { + m_sValue = sValue; + + return m_sValue; + } + + std::wstring CContentType::ToString () const + { + return m_sValue; + } + + //-------------------------------------------------------------------------------- + // DiagramLayout 14.2.3.10 (Part 4) + //-------------------------------------------------------------------------------- + + EDiagramLayout CDiagramLayout::FromString(const std::wstring &sValue) + { + this->m_eValue = diagramlayout0; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case '0': + if ( L"0" == sValue ) this->m_eValue = diagramlayout0; + break; + case '1': + if ( L"1" == sValue ) this->m_eValue = diagramlayout1; + break; + case '2': + if ( L"2" == sValue ) this->m_eValue = diagramlayout2; + break; + case '3': + if ( L"3" == sValue ) this->m_eValue = diagramlayout3; + break; + } + + return this->m_eValue; + } + + std::wstring CDiagramLayout::ToString () const + { + switch(this->m_eValue) + { + case diagramlayout0 : return L"0"; + case diagramlayout1 : return L"1"; + case diagramlayout2 : return L"2"; + case diagramlayout3 : return L"3"; + default : return L"0"; + } + } + + //-------------------------------------------------------------------------------- + // ExtrusionPlane 14.2.3.11 (Part 4) + //-------------------------------------------------------------------------------- + + EExtrusionPlane CExtrusionPlane::FromString(const std::wstring &sValue) + { + this->m_eValue = extrusionplaneXY; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'X': + if ( L"XY" == sValue ) this->m_eValue = extrusionplaneXY; + break; + case 'Y': + if ( L"YZ" == sValue ) this->m_eValue = extrusionplaneYZ; + break; + case 'Z': + if ( L"ZX" == sValue ) this->m_eValue = extrusionplaneZX; + break; + case 'x': + if ( L"xy" == sValue ) this->m_eValue = extrusionplaneXY; + break; + case 'y': + if ( L"yz" == sValue ) this->m_eValue = extrusionplaneYZ; + break; + case 'z': + if ( L"zx" == sValue ) this->m_eValue = extrusionplaneZX; + break; + } + + return this->m_eValue; + } + + std::wstring CExtrusionPlane::ToString () const + { + switch(this->m_eValue) + { + case extrusionplaneXY: return L"XY"; + case extrusionplaneYZ: return L"YZ"; + case extrusionplaneZX: return L"ZX"; + default : return L"XY"; + } + } + + //-------------------------------------------------------------------------------- + // ExtrusionRender 14.2.3.12 (Part 4) + //-------------------------------------------------------------------------------- + + EExtrusionRender CExtrusionRender::FromString(const std::wstring &sValue) + { + this->m_eValue = extrusionrenderSolid; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( L"boundingCube" == sValue ) this->m_eValue = extrusionrenderBoundingCube; + break; + case 's': + if ( L"solid" == sValue ) this->m_eValue = extrusionrenderSolid; + break; + case 'w': + if ( L"wireFrame" == sValue ) this->m_eValue = extrusionrenderWireFrame; + break; + } + + return this->m_eValue; + } + + std::wstring CExtrusionRender::ToString () const + { + switch(this->m_eValue) + { + case extrusionrenderBoundingCube: return L"boundingCube"; + case extrusionrenderSolid: return L"solid"; + case extrusionrenderWireFrame: return L"wireFrame"; + default : return L"solid"; + } + } + + //-------------------------------------------------------------------------------- + // ExtructionType 14.2.3.13 (Part 4) + //-------------------------------------------------------------------------------- + + EExtrusionType CExtrusionType::FromString(const std::wstring& sValue) + { + if (L"parallel" == sValue ) this->m_eValue = extrusiontypeParallel; + else if (L"perspective" == sValue ) this->m_eValue = extrusiontypePerspective; + else this->m_eValue = extrusiontypeParallel; + + return this->m_eValue; + } + + std::wstring CExtrusionType::ToString() const + { + switch (this->m_eValue) + { + case extrusiontypeParallel : return L"parallel"; + case extrusiontypePerspective : return L"perspective"; + default : return L"parallel"; + } + } + + //-------------------------------------------------------------------------------- + // How 14.2.3.15 (Part 4) + //-------------------------------------------------------------------------------- + + EHow CHow::FromString(const std::wstring &sValue) + { + this->m_eValue = howTop; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( L"bottom" == sValue ) this->m_eValue = howBottom; + break; + case 'c': + if ( L"center" == sValue ) this->m_eValue = howCenter; + break; + case 'l': + if ( L"left" == sValue ) this->m_eValue = howLeft; + break; + case 'm': + if ( L"middle" == sValue ) this->m_eValue = howMiddle; + break; + case 'r': + if ( L"right" == sValue ) this->m_eValue = howRight; + break; + case 't': + if ( L"top" == sValue ) this->m_eValue = howTop; + break; + } + + return this->m_eValue; + } + + std::wstring CHow::ToString () const + { + switch(this->m_eValue) + { + case howBottom: return L"bottom"; + case howCenter: return L"center"; + case howLeft : return L"left"; + case howMiddle: return L"middle"; + case howRight : return L"right"; + case howTop : return L"top"; + default : return L"top"; + } + } + + //-------------------------------------------------------------------------------- + // HrAlign 14.2.3.16 (Part 4) + //-------------------------------------------------------------------------------- + + EHrAlign CHrAlign::FromString(const std::wstring &sValue) + { + this->m_eValue = hralignLeft; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( L"center" == sValue ) this->m_eValue = hralignCenter; + break; + case 'l': + if ( L"left" == sValue ) this->m_eValue = hralignLeft; + break; + case 'r': + if ( L"right" == sValue ) this->m_eValue = hralignRight; + break; + } + + return this->m_eValue; + } + + std::wstring CHrAlign::ToString () const + { + switch(this->m_eValue) + { + case hralignCenter: return L"center"; + case hralignLeft : return L"left"; + case hralignRight : return L"right"; + default : return L"left"; + } + } + + //-------------------------------------------------------------------------------- + // InsetMode 14.2.3.17 (Part 4) + //-------------------------------------------------------------------------------- + + EInsetMode CInsetMode::FromString(const std::wstring &sValue) + { + this->m_eValue = insetmodeAuto; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( L"auto" == sValue ) this->m_eValue = insetmodeAuto; + break; + case 'c': + if ( L"custom" == sValue ) this->m_eValue = insetmodeCustom; + break; + } + + return this->m_eValue; + } + + std::wstring CInsetMode::ToString () const + { + switch(this->m_eValue) + { + case insetmodeAuto : return L"auto"; + case insetmodeCustom : return L"custom"; + default : return L"auto"; + } + } + + //-------------------------------------------------------------------------------- + // OLEDrawAspect 14.2.3.18 (Part 4) + //-------------------------------------------------------------------------------- + + EOLEDrawAspect COLEDrawAspect::FromString(const std::wstring &sValue) + { + if (L"Content" == sValue) this->m_eValue = oledrawaspectContent; + else if (L"Icon" == sValue) this->m_eValue = oledrawaspectIcon; + else this->m_eValue = oledrawaspectIcon; + + return this->m_eValue; + } + + std::wstring COLEDrawAspect::ToString() const + { + switch (this->m_eValue) + { + case oledrawaspectContent : return L"Content"; + case oledrawaspectIcon : return L"Icon"; + default : return L"Content"; + } + } + + //-------------------------------------------------------------------------------- + // OLELinkType 14.2.3.19 (Part 4) + + EOLELinkType COLELinkType::FromString(const std::wstring &sValue) + { + this->m_eValue = olelinktypeBitmap; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'B': + if ( L"Bitmap" == sValue ) this->m_eValue = olelinktypeBitmap; + break; + case 'E': + if ( L"EnhancedMetaFile" == sValue ) this->m_eValue = olelinktypeEmf; + break; + case 'J': + if ( L"Jpeg" == sValue ) this->m_eValue = olelinktypeJpeg; + break; + case 'P': + if ( L"Picture" == sValue ) this->m_eValue = olelinktypePicture; + else if ( L"Png" == sValue ) this->m_eValue = olelinktypePng; + break; + } + + return this->m_eValue; + } + + std::wstring COLELinkType::ToString() const + { + switch(this->m_eValue) + { + case olelinktypeBitmap: return L"Bitmap"; + case olelinktypeEmf: return L"EnhancedMetaFile"; + case olelinktypeJpeg: return L"Jpeg"; + case olelinktypePicture: return L"Picture"; + case olelinktypePng: return L"Png"; + default : return L"Bitmap"; + } + } + + //-------------------------------------------------------------------------------- + // OleType 14.2.3.20 (Part 4) + //-------------------------------------------------------------------------------- + + EOLEType COLEType::FromString(const std::wstring &sValue) + { + if (L"embed" == sValue) this->m_eValue = oletypeEmbed; + else if (L"link" == sValue) this->m_eValue = oletypeLink; + else this->m_eValue = oletypeEmbed; + + return this->m_eValue; + } + + std::wstring COLEType::ToString() const + { + switch (this->m_eValue) + { + case oletypeEmbed : return L"embed"; + case oletypeLink : return L"link"; + default : return L"embed"; + } + } + + //-------------------------------------------------------------------------------- + // OLEUpdateMode 14.2.3.21 (Part 4) + //-------------------------------------------------------------------------------- + + EOLEUpdateMode COLEUpdateMode::FromString(const std::wstring &sValue) + { + if (L"Always" == sValue) this->m_eValue = oleupdatemodeAlways; + else if (L"OnCall" == sValue) this->m_eValue = oleupdatemodeOnCall; + else this->m_eValue = oleupdatemodeAlways; + + return this->m_eValue; + } + + std::wstring COLEUpdateMode::ToString() const + { + switch (this->m_eValue) + { + case oleupdatemodeAlways : return L"Always"; + case oleupdatemodeOnCall : return L"OnCall"; + default : return L"Always"; + } + } + + //-------------------------------------------------------------------------------- + // RType 14.2.3.22 (Part 4) + //-------------------------------------------------------------------------------- + + ERType CRType::FromString(const std::wstring &sValue) + { + this->m_eValue = rtypeAlign; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'a': + if ( L"align" == sValue ) this->m_eValue = rtypeAlign; + else if ( L"arc" == sValue ) this->m_eValue = rtypeArc; + break; + case 'c': + if ( L"callout" == sValue ) this->m_eValue = rtypeCallout; + else if ( L"connector" == sValue ) this->m_eValue = rtypeConnector; + break; + } + + return this->m_eValue; + } + + std::wstring CRType::ToString() const + { + switch(this->m_eValue) + { + case rtypeAlign : return L"align"; + case rtypeArc : return L"arc"; + case rtypeCallout : return L"callout"; + case rtypeConnector: return L"connector"; + default : return L"align"; + } + } + + //-------------------------------------------------------------------------------- + // ScreenSize 14.2.3.23 (Part 4) + //-------------------------------------------------------------------------------- + + EScreenSize CScreenSize::FromString(const std::wstring &sValue) + { + this->m_eValue = screensize640x480; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case '1': + if ( L"1024,768" == sValue ) this->m_eValue = screensize1024x768; + else if ( L"1152,862" == sValue ) this->m_eValue = screensize1152x862; + break; + case '5': + if ( L"544,376" == sValue ) this->m_eValue = screensize544x376; + break; + case '6': + if ( L"640,480" == sValue ) this->m_eValue = screensize640x480; + break; + case '7': + if ( L"720,512" == sValue ) this->m_eValue = screensize720x512; + break; + case '8': + if ( L"800,600" == sValue ) this->m_eValue = screensize800x600; + break; + } + + return this->m_eValue; + } + + std::wstring CScreenSize::ToString () const + { + switch(this->m_eValue) + { + case screensize1024x768: return L"1024,768"; + case screensize1152x862: return L"1152,862"; + case screensize544x376 : return L"544,376"; + case screensize640x480 : return L"640,480"; + case screensize720x512 : return L"720,512"; + case screensize800x600 : return L"800,600"; + default : return L"640,480"; + } + } + +} // SimpleTypes + + +namespace SimpleTypes +{ + //-------------------------------------------------------------------------------- + // BorderShadow 14.3.3.1 (Part 4) + //-------------------------------------------------------------------------------- + + EBorderShadow CBorderShadow::FromString(const std::wstring &sValue) + { + this->m_eValue = bordershadowFalse; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'f': + if ( L"f" == sValue || L"false" == sValue ) this->m_eValue = bordershadowFalse; + break; + case 't': + if ( L"t" == sValue || L"true" == sValue ) this->m_eValue = bordershadowTrue; + break; + } + + return this->m_eValue; + } + + std::wstring CBorderShadow::ToString () const + { + switch(this->m_eValue) + { + case bordershadowTrue: return L"t"; + case bordershadowFalse: return L"f"; + default : return L"f"; + } + } + + //-------------------------------------------------------------------------------- + // BorderType 14.3.3.2 (Part 4) + //-------------------------------------------------------------------------------- + + EBorderType CBorderType::FromString(const std::wstring &sValue) + { + this->m_eValue = bordertypeNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'd': + if ( L"dash" == sValue ) this->m_eValue = bordertypeDash; + else if ( L"dashDotDot" == sValue ) this->m_eValue = bordertypeDashDotDot; + else if ( L"dashDotStroked" == sValue ) this->m_eValue = bordertypeDashDotStroked; + else if ( L"dashedSmall" == sValue ) this->m_eValue = bordertypeDashedSmall; + else if ( L"dot" == sValue ) this->m_eValue = bordertypeDot; + else if ( L"dotDash" == sValue ) this->m_eValue = bordertypeDotDash; + else if ( L"double" == sValue ) this->m_eValue = bordertypeDouble; + else if ( L"doubleWave" == sValue ) this->m_eValue = bordertypeDoubleWave; + break; + case 'h': + if ( L"hairline" == sValue ) this->m_eValue = bordertypeHairline; + break; + + case 'H': + if ( L"HTMLInset" == sValue ) this->m_eValue = bordertypeHTMLInset; + else if ( L"HTMLOutset" == sValue ) this->m_eValue = bordertypeHTMLOutset; + break; + + case 'n': + if ( L"none" == sValue ) this->m_eValue = bordertypeNone; + break; + + case 's': + if ( L"single" == sValue ) this->m_eValue = bordertypeSingle; + break; + + case 't': + if ( L"thick" == sValue ) this->m_eValue = bordertypeThick; + else if ( L"thickBetweenThin" == sValue ) this->m_eValue = bordertypeThickBetweenThin; + else if ( L"thickBetweenThinLarge" == sValue ) this->m_eValue = bordertypeThickBetweenThinLarge; + else if ( L"thickBetweenThinSmall" == sValue ) this->m_eValue = bordertypeThickBetweenThinSmall; + else if ( L"thickThin" == sValue ) this->m_eValue = bordertypeThickThin; + else if ( L"thickThinLarge" == sValue ) this->m_eValue = bordertypeThickThinLarge; + else if ( L"thickThinSmall" == sValue ) this->m_eValue = bordertypeThickThinSmall; + else if ( L"thinThick" == sValue ) this->m_eValue = bordertypeThinThick; + else if ( L"thinThickLarge" == sValue ) this->m_eValue = bordertypeThinThickLarge; + else if ( L"thinThickSmall" == sValue ) this->m_eValue = bordertypeThinThickSmall; + else if ( L"threeDEmboss" == sValue ) this->m_eValue = bordertypeThreeDEmboss; + else if ( L"threeDEngrave" == sValue ) this->m_eValue = bordertypeThreeDEngrave; + else if ( L"triple" == sValue ) this->m_eValue = bordertypeTriple; + break; + + case 'w': + if ( L"wave" == sValue ) this->m_eValue = bordertypeWave; + break; + } + + return this->m_eValue; + } + + std::wstring CBorderType::ToString () const + { + switch(this->m_eValue) + { + case bordertypeDash: return L"dash"; + case bordertypeDashDotDot: return L"dashDotDot"; + case bordertypeDashDotStroked: return L"dashDotStroked"; + case bordertypeDashedSmall: return L"dashedSmall"; + case bordertypeDot: return L"dot"; + case bordertypeDotDash: return L"dotDash"; + case bordertypeDouble: return L"double"; + case bordertypeDoubleWave: return L"doubleWave"; + case bordertypeHairline: return L"hairline"; + case bordertypeHTMLInset: return L"HTMLInset"; + case bordertypeHTMLOutset: return L"HTMLOutset"; + case bordertypeNone: return L"none"; + case bordertypeSingle: return L"single"; + case bordertypeThick: return L"thick"; + case bordertypeThickBetweenThin: return L"thickBetweenThin"; + case bordertypeThickBetweenThinLarge: return L"thickBetweenThinLarge"; + case bordertypeThickBetweenThinSmall: return L"thickBetweenThinSmall"; + case bordertypeThickThin: return L"thickThin"; + case bordertypeThickThinLarge: return L"thickThinLarge"; + case bordertypeThickThinSmall: return L"thickThinSmall"; + case bordertypeThinThick: return L"thinThick"; + case bordertypeThinThickLarge: return L"thinThickLarge"; + case bordertypeThinThickSmall: return L"thinThickSmall"; + case bordertypeThreeDEmboss: return L"threeDEmboss"; + case bordertypeThreeDEngrave: return L"threeDEngrave"; + case bordertypeTriple: return L"triple"; + case bordertypeWave: return L"wave"; + default : return L"none"; + } + } + + //-------------------------------------------------------------------------------- + // HorizontalAnchor 14.3.3.3 (Part 4) + //-------------------------------------------------------------------------------- + + EHorizontalAnchor CHorizontalAnchor::FromString(const std::wstring &sValue) + { + this->m_eValue = horizontalanchorChar; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'c': + if ( L"char" == sValue ) this->m_eValue = horizontalanchorChar; + break; + case 'm': + if ( L"margin" == sValue ) this->m_eValue = horizontalanchorMargin; + break; + + case 'p': + if ( L"page" == sValue ) this->m_eValue = horizontalanchorPage; + break; + + case 't': + if ( L"text" == sValue ) this->m_eValue = horizontalanchorText; + break; + } + + return this->m_eValue; + } + + std::wstring CHorizontalAnchor::ToString () const + { + switch(this->m_eValue) + { + case horizontalanchorChar: return L"char"; + case horizontalanchorMargin: return L"margin"; + case horizontalanchorPage: return L"page"; + case horizontalanchorText: return L"text"; + default : return L"char"; + } + } + + //-------------------------------------------------------------------------------- + // VerticalAnchor 14.3.3.4 (Part 4) + //-------------------------------------------------------------------------------- + + EVerticalAnchor CVerticalAnchor::FromString(const std::wstring &sValue) + { + this->m_eValue = verticalanchorLine; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'l': + if ( L"line" == sValue ) this->m_eValue = verticalanchorLine; + break; + case 'm': + if ( L"margin" == sValue ) this->m_eValue = verticalanchorMargin; + break; + + case 'p': + if ( L"page" == sValue ) this->m_eValue = verticalanchorPage; + break; + + case 't': + if ( L"text" == sValue ) this->m_eValue = verticalanchorText; + break; + } + + return this->m_eValue; + } + + std::wstring CVerticalAnchor::ToString () const + { + switch(this->m_eValue) + { + case verticalanchorLine: return L"line"; + case verticalanchorMargin: return L"margin"; + case verticalanchorPage: return L"page"; + case verticalanchorText: return L"text"; + default : return L"line"; + } + } + + //-------------------------------------------------------------------------------- + // WrapSide 14.3.3.5 (Part 4) + //-------------------------------------------------------------------------------- + + EWrapSide CWrapSide::FromString(const std::wstring &sValue) + { + this->m_eValue = wrapsideBoth; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'b': + if ( L"both" == sValue ) this->m_eValue = wrapsideBoth; + break; + case 'l': + if ( L"largest" == sValue ) this->m_eValue = wrapsideLargest; + else if ( L"left" == sValue ) this->m_eValue = wrapsideLeft; + break; + + case 'r': + if ( L"right" == sValue ) this->m_eValue = wrapsideRight; + break; + + } + + return this->m_eValue; + } + + std::wstring CWrapSide::ToString () const + { + switch(this->m_eValue) + { + case wrapsideBoth: return L"both"; + case wrapsideLargest: return L"largest"; + case wrapsideLeft: return L"left"; + case wrapsideRight: return L"right"; + default : return L"both"; + } + } + + //-------------------------------------------------------------------------------- + // WrapType 14.3.3.6 (Part 4) + //-------------------------------------------------------------------------------- + + EWrapType CWrapType::FromString(const std::wstring &sValue) + { + this->m_eValue = wraptypeNone; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'n': + if ( L"none" == sValue ) this->m_eValue = wraptypeNone; + break; + case 's': + if ( L"square" == sValue ) this->m_eValue = wraptypeSquare; + break; + + case 't': + if ( L"through" == sValue ) this->m_eValue = wraptypeThrough; + else if ( L"tight" == sValue ) this->m_eValue = wraptypeTight; + else if ( L"topAndBottom" == sValue ) this->m_eValue = wraptypeTopAndBottom; + break; + + } + + return this->m_eValue; + } + + std::wstring CWrapType::ToString () const + { + switch(this->m_eValue) + { + case wraptypeNone: return L"none"; + case wraptypeSquare: return L"square"; + case wraptypeThrough: return L"through"; + case wraptypeTight: return L"tight"; + case wraptypeTopAndBottom: return L"topAndBottom"; + default : return L"none"; + } + } + +} // SimpleTypes + +// Дополнительные простые типы, не входящие в спецификацию +namespace SimpleTypes +{ + namespace Vml + { + EVmlClientDataObjectType CVmlClientDataObjectType::FromString(const std::wstring &sValue) + { + this->m_eValue = vmlclientdataobjecttypeButton; + + if ( sValue.empty() ) + return this->m_eValue; + + if ( L"Button" == sValue ) this->m_eValue = vmlclientdataobjecttypeButton; + else if ( L"Checkbox" == sValue ) this->m_eValue = vmlclientdataobjecttypeCheckbox; + else if ( L"Dialog" == sValue ) this->m_eValue = vmlclientdataobjecttypeDialog; + else if ( L"Drop" == sValue ) this->m_eValue = vmlclientdataobjecttypeDrop; + else if ( L"Edit" == sValue ) this->m_eValue = vmlclientdataobjecttypeEdit; + else if ( L"GBox" == sValue ) this->m_eValue = vmlclientdataobjecttypeGBox; + else if ( L"Group" == sValue ) this->m_eValue = vmlclientdataobjecttypeGroup; + else if ( L"Label" == sValue ) this->m_eValue = vmlclientdataobjecttypeLabel; + else if ( L"LineA" == sValue ) this->m_eValue = vmlclientdataobjecttypeLineA; + else if ( L"List" == sValue ) this->m_eValue = vmlclientdataobjecttypeList; + else if ( L"Movie" == sValue ) this->m_eValue = vmlclientdataobjecttypeMovie; + else if ( L"Note" == sValue ) this->m_eValue = vmlclientdataobjecttypeNote; + else if ( L"Pict" == sValue ) this->m_eValue = vmlclientdataobjecttypePict; + else if ( L"Radio" == sValue ) this->m_eValue = vmlclientdataobjecttypeRadio; + else if ( L"Rect" == sValue ) this->m_eValue = vmlclientdataobjecttypeRect; + else if ( L"RectA" == sValue ) this->m_eValue = vmlclientdataobjecttypeRectA; + else if ( L"Scroll" == sValue ) this->m_eValue = vmlclientdataobjecttypeScroll; + else if ( L"Shape" == sValue ) this->m_eValue = vmlclientdataobjecttypeShape; + else if ( L"Spin" == sValue ) this->m_eValue = vmlclientdataobjecttypeSpin; + return this->m_eValue; + } + + std::wstring CVmlClientDataObjectType::ToString () const + { + switch(this->m_eValue) + { + case vmlclientdataobjecttypeButton: return L"Button"; + case vmlclientdataobjecttypeCheckbox: return L"Checkbox"; + case vmlclientdataobjecttypeDialog: return L"Dialog"; + case vmlclientdataobjecttypeDrop: return L"Drop"; + case vmlclientdataobjecttypeEdit: return L"Edit"; + case vmlclientdataobjecttypeGBox: return L"GBox"; + case vmlclientdataobjecttypeGroup: return L"Group"; + case vmlclientdataobjecttypeLabel: return L"Label"; + case vmlclientdataobjecttypeLineA: return L"LineA"; + case vmlclientdataobjecttypeList: return L"List"; + case vmlclientdataobjecttypeMovie: return L"Movie"; + case vmlclientdataobjecttypeNote: return L"Note"; + case vmlclientdataobjecttypePict: return L"Pict"; + case vmlclientdataobjecttypeRadio: return L"Radio"; + case vmlclientdataobjecttypeRect: return L"Rect"; + case vmlclientdataobjecttypeRectA: return L"RectA"; + case vmlclientdataobjecttypeScroll: return L"Scroll"; + case vmlclientdataobjecttypeShape: return L"Shape"; + case vmlclientdataobjecttypeSpin: return L"Spin"; + default : return L"Button"; + } + } + + //-------------------------------------------------------------------------------- + // VmlCalloutType 14.2.2.2 (type) (Part 4) + //-------------------------------------------------------------------------------- + + EVmlCalloutType CVmlCalloutType::FromString(const std::wstring &sValue) + { + this->m_eValue = vmlcallouttypeRectangle; + + if ( sValue.empty() ) + return this->m_eValue; + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 'r': + if ( L"rectangle" == sValue ) this->m_eValue = vmlcallouttypeRectangle; + else if ( L"roundedrectangle" == sValue ) this->m_eValue = vmlcallouttypeRoundRectangle; + break; + case 'o': + if ( L"oval" == sValue ) this->m_eValue = vmlcallouttypeOval; + break; + case 'c': + if ( L"cloud" == sValue ) this->m_eValue = vmlcallouttypeCloud; + break; + } + + return this->m_eValue; + } + + std::wstring CVmlCalloutType::ToString () const + { + switch(this->m_eValue) + { + case vmlcallouttypeRectangle: return L"rectangle"; + case vmlcallouttypeRoundRectangle: return L"roundedrectangle"; + case vmlcallouttypeOval: return L"oval"; + case vmlcallouttypeCloud: return L"cloud"; + default : return L"rectangle"; + } + } + + //-------------------------------------------------------------------------------- + // VmlPath 14.2.2.3 (v) (Part 4) + //-------------------------------------------------------------------------------- + + CVmlPath::CVmlPath() {} + + std::wstring CVmlPath::GetValue() const + { + return m_sValue; + } + + void CVmlPath::SetValue(std::wstring &sValue) + { + m_sValue = sValue; + } + + std::wstring CVmlPath::FromString(const std::wstring &sValue) + { + // TO DO: Сделать парсер пата Part4. 14.2.2.3 + m_sValue = sValue; + + return m_sValue; + } + + std::wstring CVmlPath::ToString () const + { + return m_sValue; + } + + //-------------------------------------------------------------------------------- + // VmlDashStyle 14.2.2.1 (dashstyle) (Part 4) + //-------------------------------------------------------------------------------- + + EVmlDashStyle CVmlDashStyle::FromString(const std::wstring &sValueInput) + { + m_nCount = 0; + + this->m_eValue = vmldashstyleSolid; + + if ( sValueInput.empty() ) + return this->m_eValue; + + std::wstring sValue = sValueInput; + sValue = XmlUtils::GetLower(sValue); + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case 's': + if ( L"solid" == sValue ) this->m_eValue = vmldashstyleSolid; + else if ( L"shortdash" == sValue ) this->m_eValue = vmldashstyleShortDash; + else if ( L"shortdot" == sValue ) this->m_eValue = vmldashstyleShortDot; + else if ( L"shortdashdot" == sValue ) this->m_eValue = vmldashstyleShortDashDot; + else if ( L"shortdashdotdot" == sValue ) this->m_eValue = vmldashstyleShortDashDotDot; + break; + case 'd': + if ( L"dot" == sValue ) this->m_eValue = vmldashstyleDot; + else if ( L"dash" == sValue ) this->m_eValue = vmldashstyleDash; + else if ( L"dashdot" == sValue ) this->m_eValue = vmldashstyleDashDot; + break; + case 'l': + if ( L"longdash" == sValue ) this->m_eValue = vmldashstyleLongDash; + else if ( L"longdashdot" == sValue ) this->m_eValue = vmldashstyleLongDashDot; + else if ( L"longdashdotdot" == sValue ) this->m_eValue = vmldashstyleLongDashDotDot; + break; + + default: + { + this->m_eValue = vmldashstyleCustom; + + std::wstring sTemp = sValue; + for ( size_t nIndex = 0; nIndex < sValue.length(); nIndex++ ) + { + int nChar = sValue[nIndex ]; + if ( ' ' == nChar ) + continue; + + int nEndPos = (int)sValue.find( L" ", nIndex ); + if ( -1 == nEndPos ) + nEndPos = (int)sValue.length(); + + int nLen = (int)(nEndPos - nIndex); + + if ( nLen <= 0 ) + continue; + + std::wstring sTemp = sValue.substr( nIndex, nLen ); + double dVal = XmlUtils::GetDouble(sTemp); + + if ( m_nCount >= 32 ) + break; + + m_arrValues[m_nCount++] = dVal; + } + } + } + + return this->m_eValue; + } + + std::wstring CVmlDashStyle::ToString () const + { + switch(this->m_eValue) + { + case vmldashstyleSolid : return L"solid"; + case vmldashstyleShortDash : return L"shortdash"; + case vmldashstyleShortDot : return L"shortdot"; + case vmldashstyleShortDashDot : return L"shortdashdot"; + case vmldashstyleShortDashDotDot: return L"shortdashdotdot"; + case vmldashstyleDot : return L"dot"; + case vmldashstyleDash : return L"dash"; + case vmldashstyleLongDash : return L"longdash"; + case vmldashstyleDashDot : return L"dashdot"; + case vmldashstyleLongDashDot : return L"longdashdot"; + case vmldashstyleLongDashDotDot : return L"longdashdotdot"; + case vmldashstyleCustom : + { + std::wstring sResult; + + for (int nIndex = 0; nIndex < m_nCount; nIndex++) + { + sResult += XmlUtils::ToString( m_arrValues[nIndex] ); + sResult += L" "; + } + return sResult; + } + default: return L"solid"; + } + } + + //-------------------------------------------------------------------------------- + // Vml_1_65536 14.2.2.11 (brightness) + //-------------------------------------------------------------------------------- + + CVml_1_65536::CVml_1_65536() + { + m_dValue = 0; + } + + double CVml_1_65536::GetValue() const + { + return m_dValue; + } + + void CVml_1_65536::SetValue(double dValue) + { + m_dValue = (std::max)( 0.0, (std::min)( 1.0, dValue) ); + } + + void CVml_1_65536::SetValue(int nValue) + { + m_dValue = (std::max)( 0.0, (std::min)( 65536.0, (double) nValue) ) / 65536.0; + } + + double CVml_1_65536::FromString(const std::wstring &sValue) + { + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + bool bFraction = ( 'f' == sValue[ nLen - 1 ] ); + + if ( bFraction ) + { + std::wstring strValue = sValue.substr( 0, nLen - 1 ); + int nValue = strValue.empty() ? 0 : XmlUtils::GetInteger(strValue); + + SetValue( nValue ); + } + else + { + double dValue = XmlUtils::GetDouble( sValue); + SetValue( dValue ); + } + + return m_dValue; + } + + std::wstring CVml_1_65536::ToString () const + { + std::wstring sResult = boost::lexical_cast( m_dValue ); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // Vml_Vector3D_65536 14.2.2.11 (lightposition) + //-------------------------------------------------------------------------------- + + CVml_Vector3D_65536::CVml_Vector3D_65536() + { + m_nX = 0; + m_nY = 0; + m_nZ = 0; + } + + double CVml_Vector3D_65536::GetX() const + { + return (double)(m_nX / 65536.0); + } + double CVml_Vector3D_65536::GetY() const + { + return (double)(m_nY / 65536.0); + } + double CVml_Vector3D_65536::GetZ() const + { + return (double)(m_nZ / 65536.0); + } + + void CVml_Vector3D_65536::SetValue(int nX, int nY, int nZ) + { + m_nX = nX; + m_nY = nY; + m_nZ = nZ; + } + + void CVml_Vector3D_65536::SetValue(double dX, double dY, double dZ) + { + m_nX = (int)(dX * 65536); + m_nY = (int)(dY * 65536); + m_nZ = (int)(dZ * 65536); + } + + double CVml_Vector3D_65536::FromString(const std::wstring &sValue) + { + m_nX = 0; + m_nY = 0; + m_nZ = 0; + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nPos = (int)sValue.find( L"," ); + if ( -1 == nPos ) + return 0; + + std::wstring strX = sValue.substr( 0, nPos ); + XmlUtils::replace_all(strX, L"@", L""); + + m_nX = strX.empty() ? 0 : XmlUtils::GetInteger(strX); + + int nPos2 = (int)sValue.find( L",", nPos + 1 ); + if ( -1 == nPos2 ) + return 0; + + std::wstring strY = sValue.substr( nPos + 1, nPos2 - nPos - 1) ; + std::wstring strZ = sValue.substr( nPos2 + 1, nLen - nPos2 - 1 ); + + XmlUtils::replace_all(strY, L"@", L""); + XmlUtils::replace_all(strZ, L"@", L""); + + m_nY = strY.empty() ? 0 : XmlUtils::GetInteger(strY); + m_nZ = strZ.empty() ? 0 : XmlUtils::GetInteger(strZ); + + return 0; + } + + std::wstring CVml_Vector3D_65536::ToString () const + { + return std::to_wstring(m_nX) + L"," + std::to_wstring(m_nX) + std::to_wstring(m_nY) + L"," + std::to_wstring(m_nZ); + } + + //-------------------------------------------------------------------------------- + // Vml_Vector3D 14.2.2.11 (orientation) + //-------------------------------------------------------------------------------- + + CVml_Vector3D::CVml_Vector3D() + { + m_nX = 0; + m_nY = 0; + m_nZ = 0; + } + + int CVml_Vector3D::GetX() const + { + return m_nX; + } + int CVml_Vector3D::GetY() const + { + return m_nY; + } + int CVml_Vector3D::GetZ() const + { + return m_nZ; + } + + void CVml_Vector3D::SetValue(int nX, int nY, int nZ) + { + m_nX = nX; + m_nY = nY; + m_nZ = nZ; + } + + double CVml_Vector3D::FromString(const std::wstring &sValue) + { + m_nX = 0; + m_nY = 0; + m_nZ = 0; + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nPos = (int)sValue.find( L"," ); + if ( -1 == nPos ) + {//only x position + std::wstring strX = sValue; + XmlUtils::replace_all(strX, L"@", L""); + + m_nX = strX.empty() ? 0 : XmlUtils::GetInteger(strX); + return 0; + } + std::wstring strX = sValue.substr( 0, nPos ); + XmlUtils::replace_all(strX, L"@", L""); + + m_nX = strX.empty() ? 0 : XmlUtils::GetInteger(strX); + + int nPos2 = (int)sValue.find( L",", nPos + 1 ); + if ( -1 == nPos2 ) + {// only x, y position + std::wstring strY = sValue.substr( nPos + 1); + XmlUtils::replace_all(strY, L"@", L""); + m_nY = strY.empty() ? 0 : XmlUtils::GetInteger(strY); + return 0; + } + + std::wstring strY = sValue.substr( nPos + 1, nPos2 - nPos - 1); + std::wstring strZ = sValue.substr( nPos2 + 1, nLen - nPos2 - 1 ) ; + + XmlUtils::replace_all(strY, L"@", L""); + XmlUtils::replace_all(strZ, L"@", L""); + + m_nY = strY.empty() ? 0 : XmlUtils::GetInteger(strY); + m_nZ = strZ.empty() ? 0 : XmlUtils::GetInteger(strZ); + + return 0; + } + + std::wstring CVml_Vector3D::ToString () const + { + return std::to_wstring(m_nX) + L"," + std::to_wstring(m_nY) + L"," + std::to_wstring(m_nZ); + } + + //-------------------------------------------------------------------------------- + // Vml_Vector2D 14.2.2.11 (rotationangle) + //-------------------------------------------------------------------------------- + + CVml_Vector2D::CVml_Vector2D() + { + m_nX = 0; + m_nY = 0; + } + + int CVml_Vector2D::GetX() const + { + return m_nX; + } + int CVml_Vector2D::GetY() const + { + return m_nY; + } + + void CVml_Vector2D::SetValue(int nX, int nY) + { + m_nX = nX; + m_nY = nY; + } + + double CVml_Vector2D::FromString(const std::wstring &sValue) + { + m_nX = 0; + m_nY = 0; + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nPos = (int)sValue.find( L"," ); + + std::wstring strX, strY; + if ( -1 == nPos ) + {//only x coord + strX = sValue; + } + else + { + strX = sValue.substr( 0, nPos ); + strY = sValue.substr( nPos + 1, nLen - nPos - 1 ) ; + } + XmlUtils::replace_all(strY, L"@", L""); + XmlUtils::replace_all(strX, L"@", L""); + + m_nX = strX.empty() ? 0 : XmlUtils::GetInteger(strX); + m_nY = strY.empty() ? 0 : XmlUtils::GetInteger(strY); + + return 0; + } + + std::wstring CVml_Vector2D::ToString () const + { + return std::to_wstring(m_nX) + L"," + std::to_wstring(m_nY); + } + + //-------------------------------------------------------------------------------- + // Vml_Vector2D_F 14.2.2.11 (viewpointorigin) + //-------------------------------------------------------------------------------- + + CVml_Vector2D_F::CVml_Vector2D_F() + { + m_dX = 0; + m_dY = 0; + } + + double CVml_Vector2D_F::GetX() const + { + return m_dX; + } + double CVml_Vector2D_F::GetY() const + { + return m_dY; + } + + void CVml_Vector2D_F::SetValue(double dX, double dY) + { + m_dX = dX; + m_dY = dY; + } + + double CVml_Vector2D_F::FromString(const std::wstring &sValue) + { + m_dX = 0; + m_dY = 0; + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + size_t nPos = sValue.find( L"," ); + + std::wstring strX, strY; + if (std::wstring::npos == nPos) + { + strX = sValue;// .substr(0, nPos); + } + else + { + strX = sValue.substr( 0, nPos ); + strY = sValue.substr( nPos + 1, nLen - nPos - 1 ) ; + } + + m_dX = XmlUtils::GetDouble(strX); + m_dY = XmlUtils::GetDouble(strY); + + return 0; + } + + std::wstring CVml_Vector2D_F::ToString () const + { + return boost::lexical_cast(m_dX) + L"," + boost::lexical_cast(m_dY); + } + + //-------------------------------------------------------------------------------- + // Vml_Polygon2D 14.1.2.1 (wrapcoords) + //-------------------------------------------------------------------------------- + + CVml_Polygon2D::CVml_Polygon2D() + { + } + int CVml_Polygon2D::GetSize() const + { + return (int)m_arrPoints.size(); + } + + int CVml_Polygon2D::GetX(int nIndex) const + { + if ( nIndex < 0 || nIndex >= (int)m_arrPoints.size() ) + return 0; + + return m_arrPoints[nIndex].nX; + } + int CVml_Polygon2D::GetY(int nIndex) const + { + if ( nIndex < 0 || nIndex >= (int)m_arrPoints.size() ) + return 0; + + return m_arrPoints[nIndex].nY; + } + + void CVml_Polygon2D::AddPoint(int nX, int nY) + { + TPoint oPt( nX, nY ); + m_arrPoints.push_back( oPt ); + } + + double CVml_Polygon2D::FromString(const std::wstring &sValue) + { + m_arrPoints.clear(); + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nStartPos = 0; + while ( true ) + { + int nMidPos = (int)sValue.find( L",", nStartPos ); + int nEndPos = (int)sValue.find( L",", nMidPos + 1 ); + + if ( -1 == nMidPos ) + break; + + if ( -1 == nEndPos ) + nEndPos = nLen; + + std::wstring strX = sValue.substr( nStartPos, nMidPos - nStartPos ); + std::wstring strY = sValue.substr( nStartPos, nMidPos - nStartPos ); + + XmlUtils::replace_all(strX, L"@", L""); + XmlUtils::replace_all(strY, L"@", L""); + + int nX = strX.empty() ? 0 : XmlUtils::GetInteger(strX); + int nY = strY.empty() ? 0 : XmlUtils::GetInteger(strY); + + m_arrPoints.push_back( TPoint( nX, nY ) ); + + nStartPos = nEndPos + 1; + } + + + return 0; + } + + std::wstring CVml_Polygon2D::ToString () const + { + std::wstring sResult; + + for ( size_t nIndex = 0; nIndex < m_arrPoints.size(); nIndex++ ) + { + std::wstring sTemp = std::to_wstring(m_arrPoints[nIndex].nX) + L"," + std::to_wstring(m_arrPoints[nIndex].nY); + if ( nIndex < m_arrPoints.size() - 1 ) sTemp += L","; + sResult += sTemp; + } + + return sResult; + } + + //------------------------------------------------------------------------------------------ + // CCssProperty + //------------------------------------------------------------------------------------------ + + std::wstring RemoveWhiteSpaces(const std::wstring &sText) + { + std::wstring result; + for (size_t i = 0 ; i < sText.length(); i++) + { + WCHAR wChar = sText[i]; + if (wChar > 0x20) + { + result += wChar; + } + } + return result; + } + + CCssProperty::CCssProperty() + { + m_eType = Vml::cssptUnknown; + } + + CCssProperty::CCssProperty(std::wstring sBuffer) + { + Parse(sBuffer); + } + CCssProperty::~CCssProperty() + { + } + + const UCssValue& CCssProperty::get_Value() const + { + return m_oValue; + } + + const ECssPropertyType& CCssProperty::get_Type() const + { + return m_eType; + } + + void CCssProperty::Parse(const std::wstring &sBuffer) + { + int nPos = (int)sBuffer.find( ':' ); + std::wstring sValue; + + if ( -1 == nPos ) + { + m_eType = cssptUnknown; + } + else + { + std::wstring sProperty = sBuffer.substr( 0, nPos ); + sValue = sBuffer.substr( nPos + 1, sBuffer.length() - (nPos + 1) ); + + sProperty = RemoveWhiteSpaces( sProperty ); + + if ( sProperty.length() <= 2 ) + { + m_eType = cssptUnknown; + return; + } + + // Чтобы избежать большого количества сравнения строк проверим для начала по первым двум символам + int nChar1 = sProperty[ 0 ]; + int nChar2 = sProperty[ 1 ]; + + switch( nChar1 ) + { + case 'd': + { + if ( L"direction" == sProperty ) m_eType = cssptDirection; + else m_eType = cssptUnknown; + + break; + } + case 'f': + { + switch( nChar2 ) + { + case 'l': + { + if ( L"flip" == sProperty ) m_eType = cssptFlip; + else m_eType = cssptUnknown; + + break; + } + case 'o': + { + if ( L"font" == sProperty ) m_eType = cssptFont; + else if ( L"font-family" == sProperty ) m_eType = cssptFontFamily; + else if ( L"font-size" == sProperty ) m_eType = cssptFontSize; + else if ( L"font-style" == sProperty ) m_eType = cssptFontStyle; + else if ( L"font-variant" == sProperty ) m_eType = cssptFontVariant; + else if ( L"font-weight" == sProperty ) m_eType = cssptFontWeight; + else m_eType = cssptUnknown; + + break; + } + default: + { + m_eType = cssptUnknown; + break; + } + } + break; + } + case 'h': + { + if ( L"height" == sProperty ) m_eType = cssptHeight; + else m_eType = cssptUnknown; + + break; + } + case 'l': + { + if ( L"layout-flow" == sProperty ) m_eType = cssptLayoutFlow; + else if ( L"left" == sProperty ) m_eType = cssptLeft; + else m_eType = cssptUnknown; + + break; + } + case 'm': + { + switch( nChar2 ) + { + case 'a': + { + if ( L"margin-bottom" == sProperty ) m_eType = cssptMarginBottom; + else if ( L"margin-left" == sProperty ) m_eType = cssptMarginLeft; + else if ( L"margin-right" == sProperty ) m_eType = cssptMarginRight; + else if ( L"margin-top" == sProperty ) m_eType = cssptMarginTop; + else m_eType = cssptUnknown; + + break; + } + case 's': + { + if ( L"mso-direction-alt" == sProperty ) m_eType = cssptMsoDirectionAlt; + else if ( L"mso-fit-shape-to-text" == sProperty ) m_eType = cssptMsoFitShapeToText; + else if ( L"mso-fit-text-to-shape" == sProperty ) m_eType = cssptMsoFitTextToShape; + else if ( L"mso-layout-flow-alt" == sProperty ) m_eType = cssptMsoLayoutFlowAlt; + else if ( L"mso-next-textbox" == sProperty ) m_eType = cssptMsoNextTextbox; + else if ( L"mso-position-horizontal" == sProperty ) m_eType = cssptMsoPositionHorizontal; + else if ( L"mso-position-horizontal-relative" == sProperty ) m_eType = cssptMsoPositionHorizontalRelative; + else if ( L"mso-position-vertical" == sProperty ) m_eType = cssptMsoPositionVertical; + else if ( L"mso-position-vertical-relative" == sProperty ) m_eType = cssptMsoPositionVerticalRelative; + else if ( L"mso-rotate" == sProperty ) m_eType = cssptMsoRotate; + else if ( L"mso-text-scale" == sProperty ) m_eType = cssptMsoTextScale; + else if ( L"mso-text-shadow" == sProperty ) m_eType = cssptMsoTextShadow; + else if ( L"mso-wrap-distance-bottom" == sProperty ) m_eType = cssptMsoWrapDistanceBottom; + else if ( L"mso-wrap-distance-left" == sProperty ) m_eType = cssptMsoWrapDistanceLeft; + else if ( L"mso-wrap-distance-right" == sProperty ) m_eType = cssptMsoWrapDistanceRight; + else if ( L"mso-wrap-distance-top" == sProperty ) m_eType = cssptMsoWrapDistanceTop; + else if ( L"mso-wrap-edited" == sProperty ) m_eType = cssptMsoWrapEdited; + else if ( L"mso-wrap-style" == sProperty ) m_eType = cssptMsoWrapStyle; + else if ( L"mso-height-percent" == sProperty ) m_eType = csspctMsoHeightPercent; + else if ( L"mso-width-percent" == sProperty ) m_eType = csspctMsoWidthPercent; + else if ( L"mso-top-percent" == sProperty ) m_eType = csspctMsoTopPercent; + else if ( L"mso-left-percent" == sProperty ) m_eType = csspctMsoLeftPercent; + + else m_eType = cssptUnknown; + + break; + } + default: + { + m_eType = cssptUnknown; + break; + } + } + break; + } + case 'p': + { + if ( L"position" == sProperty ) m_eType = cssptPosition; + else m_eType = cssptUnknown; + + break; + } + case 'r': + { + if ( L"rotation" == sProperty ) m_eType = cssptRotation; + else m_eType = cssptUnknown; + + break; + } + case 't': + { + if ( L"text-decoration" == sProperty ) m_eType = cssptTextDecoration; + else if ( L"top" == sProperty ) m_eType = cssptTop; + else if ( L"text-align" == sProperty ) m_eType = cssptHTextAlign; + else m_eType = cssptUnknown; + + break; + } + case 'v': + { + if ( L"visibility" == sProperty ) m_eType = cssptVisibility; + else if ( L"v-rotate-letters" == sProperty ) m_eType = cssptVRotateLetters; + else if ( L"v-same-letter-heights" == sProperty ) m_eType = cssptVSameLetterHeights; + else if ( L"v-text-align" == sProperty ) m_eType = cssptVTextAlign; + else if ( L"v-text-anchor" == sProperty ) m_eType = cssptVTextAnchor; + else if ( L"v-text-kern" == sProperty ) m_eType = cssptVTextKern; + else if ( L"v-text-reverse" == sProperty ) m_eType = cssptVTextReverse; + else if ( L"v-text-spacing-mode" == sProperty ) m_eType = cssptVTextSpacingMode; + else if ( L"v-text-spacing" == sProperty ) m_eType = cssptVTextSpacing; + else m_eType = cssptUnknown; + + break; + } + case 'w': + { + if ( L"width" == sProperty ) m_eType = cssptWidth; + else m_eType = cssptUnknown; + + break; + } + case 'z': + { + if ( L"z-index" == sProperty ) m_eType = cssptZIndex; + else m_eType = cssptUnknown; + + break; + } + default: + { + m_eType = cssptUnknown; + break; + } + } + } + + switch ( m_eType ) + { + case cssptUnknown : ReadValue_Unknown( sValue ); break; + + case cssptFlip : ReadValue_Flip( sValue ); break; + case cssptHeight : ReadValue_Units( sValue ); break; + case cssptLeft : ReadValue_Units( sValue ); break; + case cssptMarginBottom : ReadValue_Units( sValue ); break; + case cssptMarginLeft : ReadValue_Units( sValue ); break; + case cssptMarginRight : ReadValue_Units( sValue ); break; + case cssptMarginTop : ReadValue_Units( sValue ); break; + case cssptMsoPositionHorizontal : ReadValue_MsoPosHor( sValue ); break; + case cssptMsoPositionHorizontalRelative : ReadValue_MsoPosHorRel( sValue ); break; + case cssptMsoPositionVertical : ReadValue_MsoPosVer( sValue ); break; + case cssptMsoPositionVerticalRelative : ReadValue_MsoPosVerRel( sValue ); break; + case cssptMsoWrapDistanceBottom : ReadValue_Units( sValue ); break; + case cssptMsoWrapDistanceLeft : ReadValue_Units( sValue ); break; + case cssptMsoWrapDistanceRight : ReadValue_Units( sValue ); break; + case cssptMsoWrapDistanceTop : ReadValue_Units( sValue ); break; + case cssptMsoWrapEdited : ReadValue_Boolean( sValue ); break; + case cssptMsoWrapStyle : ReadValue_MsoWrapStyle( sValue ); break; + case cssptPosition : ReadValue_Position( sValue ); break; + case cssptRotation : ReadValue_Rotation( sValue ); break; + case cssptTop : ReadValue_Units( sValue ); break; + case cssptVisibility : ReadValue_Visibility( sValue ); break; + case cssptWidth : ReadValue_Units( sValue ); break; + case cssptZIndex : ReadValue_ZIndex( sValue ); break; + + case cssptDirection : ReadValue_Direction( sValue ); break; + case cssptLayoutFlow : ReadValue_LayoutFlow( sValue ); break; + case cssptMsoDirectionAlt : ReadValue_DirectionAlt( sValue ); break; + case cssptMsoFitShapeToText : ReadValue_Boolean( sValue ); break; + case cssptMsoFitTextToShape : ReadValue_Boolean( sValue ); break; + case cssptMsoLayoutFlowAlt : ReadValue_LayoutFlowAlt( sValue ); break; + case cssptMsoNextTextbox : ReadValue_String( sValue ); break; + case cssptMsoRotate : ReadValue_MsoRotate( sValue ); break; + case cssptMsoTextScale : ReadValue_Units( sValue ); break; + case cssptVTextAnchor : ReadValue_VTextAnchor( sValue ); break; + + case cssptFont : ReadValue_String( sValue ); break; + case cssptFontFamily : ReadValue_String( sValue ); break; + case cssptFontSize : ReadValue_Units( sValue ); break; + case cssptFontStyle : ReadValue_FontStyle( sValue ); break; + case cssptFontVariant : ReadValue_FontVariant( sValue ); break; + case cssptFontWeight : ReadValue_FontWeight( sValue ); break; + case cssptMsoTextShadow : ReadValue_Boolean( sValue ); break; + case cssptTextDecoration : ReadValue_TextDecoration( sValue ); break; + case cssptVRotateLetters : ReadValue_Boolean( sValue ); break; + case cssptVSameLetterHeights : ReadValue_Boolean( sValue ); break; + case cssptVTextAlign : ReadValue_VTextAlign( sValue ); break; + case cssptVTextKern : ReadValue_Boolean( sValue ); break; + case cssptVTextReverse : ReadValue_Boolean( sValue ); break; + case cssptVTextSpacingMode : ReadValue_VTextSpacingMode( sValue ); break; + case cssptVTextSpacing : ReadValue_Units( sValue ); break; + case csspctMsoWidthPercent : ReadValue_Units( sValue ); break; + case csspctMsoHeightPercent : ReadValue_Units( sValue ); break; + case csspctMsoLeftPercent : ReadValue_Units( sValue); break; + case csspctMsoTopPercent : ReadValue_Units( sValue); break; + case cssptHTextAlign : ReadValue_VTextAlign( sValue ); break; + }; + } + + void CCssProperty::ReadValue_Unknown(std::wstring& sValue) + { + // Ничего не делаем + } + void CCssProperty::ReadValue_Flip(std::wstring& sValue) + { + if ( L"x" == sValue ) m_oValue.eFlip = cssflipX; + else if ( L"y" == sValue ) m_oValue.eFlip = cssflipY; + else if ( L"xy" == sValue ) m_oValue.eFlip = cssflipXY; + else if ( L"yx" == sValue ) m_oValue.eFlip = cssflipYX; + else + m_eType = cssptUnknown; + } + void CCssProperty::ReadValue_Units(std::wstring& sValue) + { + int nPos = -1; + if ( -1 != ( nPos = (int)sValue.find(L"auto") ) ) + { + m_oValue.oValue.eType = cssunitstypeAuto; + } + else if ( -1 != ( nPos = (int)sValue.find( L"in" ) ) ) + { + m_oValue.oValue.eType = cssunitstypeUnits; + + std::wstring strValue = sValue.substr( 0, nPos ); + double dValue = XmlUtils::GetDouble(sValue); + + m_oValue.oValue.dValue = Inch_To_Pt(dValue); + } + else if ( -1 != ( nPos = (int)sValue.find( L"cm" ) ) ) + { + m_oValue.oValue.eType = cssunitstypeUnits; + + std::wstring strValue = sValue.substr( 0, nPos ); + double dValue = XmlUtils::GetDouble(sValue); + + m_oValue.oValue.dValue = Cm_To_Pt(dValue); + } + else if ( -1 != ( nPos = (int)sValue.find( L"mm" ) ) ) + { + m_oValue.oValue.eType = cssunitstypeUnits; + + std::wstring strValue = sValue.substr( 0, nPos ); + double dValue = XmlUtils::GetDouble(sValue); + + m_oValue.oValue.dValue = Mm_To_Pt(dValue); + } + else if ( -1 != ( nPos = (int)sValue.find( L"em" ) ) ) + { + // TO DO: Реализовать единицы 'em' + } + else if ( -1 != ( nPos = (int)sValue.find( L"ex" ) ) ) + { + // TO DO: Реализовать единицы 'ex' + } + else if ( -1 != ( nPos = (int)sValue.find( L"pt" ) ) ) + { + m_oValue.oValue.eType = cssunitstypeUnits; + + std::wstring strValue = sValue.substr( 0, nPos ); + double dValue = XmlUtils::GetDouble(sValue); + + m_oValue.oValue.dValue = dValue; + } + else if ( -1 != ( nPos = (int)sValue.find( L"pc" ) ) ) + { + m_oValue.oValue.eType = cssunitstypeUnits; + + std::wstring strValue = sValue.substr( 0, nPos ); + double dValue = XmlUtils::GetDouble(sValue); + + m_oValue.oValue.dValue = dValue * 12; + } + else if ( -1 != ( nPos = (int)sValue.find( L"%" ) ) ) + { + m_oValue.oValue.eType = cssunitstypePerc; + + std::wstring strValue = sValue.substr( 0, nPos ); + m_oValue.oValue.dValue = XmlUtils::GetDouble(strValue); + } + else if ( -1 != ( nPos = (int)sValue.find( L"px" ) ) ) + { + m_oValue.oValue.eType = cssunitstypeUnits; + + std::wstring strValue = sValue.substr( 0, nPos ); + double dValue = XmlUtils::GetDouble(sValue); + + m_oValue.oValue.dValue = Px_To_Pt(dValue); + } + else + { + m_oValue.oValue.eType = cssunitstypeAbsolute; + try + { + m_oValue.oValue.dValue = XmlUtils::GetDouble(sValue); + } + catch(...) + { + m_oValue.oValue.dValue = 0; + } + } + } + + void CCssProperty::ReadValue_MsoPosHor(std::wstring& sValue) + { + if ( L"absolute" == sValue ) m_oValue.eMsoPosHor = cssmsoposhorAbsolute; + else if ( L"left" == sValue ) m_oValue.eMsoPosHor = cssmsoposhorLeft; + else if ( L"center" == sValue ) m_oValue.eMsoPosHor = cssmsoposhorCenter; + else if ( L"right" == sValue ) m_oValue.eMsoPosHor = cssmsoposhorRight; + else if ( L"inside" == sValue ) m_oValue.eMsoPosHor = cssmsoposhorInside; + else if ( L"outside" == sValue ) m_oValue.eMsoPosHor = cssmsoposhorOutside; + else + m_oValue.eMsoPosHor = cssmsoposhorAbsolute; + } + void CCssProperty::ReadValue_MsoPosHorRel(std::wstring& sValue) + { + if ( L"left-margin-area" == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelLeftMargin; + else if ( L"right-margin-area" == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelRightMargin; + else if ( L"margin" == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelMargin; + else if ( L"page" == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelPage; + else if ( L"text" == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelText; + else if ( L"char" == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelChar; + else + m_oValue.eMsoPosHorRel = cssmsoposhorrelText; + } + void CCssProperty::ReadValue_MsoPosVer(std::wstring& sValue) + { + if ( L"absolute" == sValue ) m_oValue.eMsoPosVer = cssmsoposverAbsolute; + else if ( L"top" == sValue ) m_oValue.eMsoPosVer = cssmsoposverTop; + else if ( L"center" == sValue ) m_oValue.eMsoPosVer = cssmsoposverCenter; + else if ( L"bottom" == sValue ) m_oValue.eMsoPosVer = cssmsoposverBottom; + else if ( L"inside" == sValue ) m_oValue.eMsoPosVer = cssmsoposverInside; + else if ( L"outside" == sValue ) m_oValue.eMsoPosVer = cssmsoposverOutside; + else + m_oValue.eMsoPosVer = cssmsoposverAbsolute; + } + void CCssProperty::ReadValue_MsoPosVerRel(std::wstring& sValue) + { + if ( L"bottom-margin-area" == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelBottomMargin; + else if ( L"top-margin-area" == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelTopMargin; + else if ( L"margin" == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelMargin; + else if ( L"page" == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelPage; + else if ( L"text" == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelText; + else if ( L"line" == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelLine; + else + m_oValue.eMsoPosVerRel = cssmsoposverrelText; + } + + void CCssProperty::ReadValue_Rotation(std::wstring& sValue) + { + m_oValue.oValue.eType = cssunitstypeAbsolute; + m_oValue.oValue.dValue = XmlUtils::GetDouble( sValue ); + + if (sValue.find(L"fd") != std::wstring::npos) + { + m_oValue.oValue.dValue /= 6000.; + } + else if (sValue.find(L"f") == sValue.length() - 1) + { + m_oValue.oValue.dValue /= 65536.; + } + } + void CCssProperty::ReadValue_Boolean(std::wstring& sValue) + { + if ( L"true" == sValue || L"t" == sValue || L"1" == sValue ) + m_oValue.bValue = true; + else + m_oValue.bValue = false; + } + void CCssProperty::ReadValue_MsoWrapStyle(std::wstring& sValue) + { + if ( L"square" == sValue ) m_oValue.eMsoWrapStyle = cssmsowrapstyleSqaure; + else if ( L"none" == sValue ) m_oValue.eMsoWrapStyle = cssmsowrapstyleNone; + else + m_oValue.eMsoWrapStyle = cssmsowrapstyleSqaure; + } + void CCssProperty::ReadValue_Position(std::wstring& sValue) + { + if ( L"static" == sValue ) m_oValue.ePosition = csspositionStatic; + else if ( L"absolute" == sValue ) m_oValue.ePosition = csspositionAbsolute; + else if ( L"relative" == sValue ) m_oValue.ePosition = csspositionRelative; + else + m_oValue.ePosition = csspositionAbsolute; + } + void CCssProperty::ReadValue_Visibility(std::wstring& sValue) + { + if ( L"hidden" == sValue ) m_oValue.eVisibility = cssvisibilityHidden; + else if ( L"inherit" == sValue ) m_oValue.eVisibility = cssvisibilityInherit; + else + m_oValue.eVisibility = cssvisibilityInherit; + } + void CCssProperty::ReadValue_ZIndex(std::wstring& sValue) + { + if ( L"auto" == sValue ) m_oValue.oZIndex.eType = csszindextypeAuto; + else + { + m_oValue.oZIndex.eType = csszindextypeOrder; + m_oValue.oZIndex.nOrder = XmlUtils::GetInteger(sValue); + + } + } + void CCssProperty::ReadValue_Direction(std::wstring& sValue) + { + if ( L"ltr" == sValue ) m_oValue.eDirection = cssdirectionLTR; + else if ( L"rtl" == sValue ) m_oValue.eDirection = cssdirectionRTL; + else + m_oValue.eDirection = cssdirectionLTR; + } + void CCssProperty::ReadValue_LayoutFlow(std::wstring& sValue) + { + if ( L"horizontal" == sValue ) m_oValue.eLayoutFlow = csslayoutflowHorizontal; + else if ( L"vertical" == sValue ) m_oValue.eLayoutFlow = csslayoutflowVertical; + else if ( L"vertical-ideographic" == sValue ) m_oValue.eLayoutFlow = csslayoutflowVerticalIdeographic; + else if ( L"horizontal-ideographic" == sValue ) m_oValue.eLayoutFlow = csslayoutflowHorizontalIdeographic; + else + m_oValue.eLayoutFlow = csslayoutflowHorizontal; + } + void CCssProperty::ReadValue_DirectionAlt(std::wstring& sValue) + { + m_oValue.eDirectionAlt = cssdirectionaltContext; + } + void CCssProperty::ReadValue_LayoutFlowAlt(std::wstring& sValue) + { + m_oValue.eLayoutFlowAlt = csslayoutflowaltBottomToTop; + } + void CCssProperty::ReadValue_String(std::wstring& sValue) + { + int nLen = (int)sValue.length(); + if ( nLen > 127 ) + return; + + ::memcpy( m_oValue.wsValue, sValue.c_str(), nLen * sizeof( wchar_t ) ); + m_oValue.wsValue[nLen] = '\0'; + } + + void CCssProperty::ReadValue_MsoRotate(std::wstring& sValue) + { + if ( L"0" == sValue ) m_oValue.eRotate = cssmsorotate0; + else if ( L"90" == sValue ) m_oValue.eRotate = cssmsorotate90; + else if ( L"180" == sValue ) m_oValue.eRotate = cssmsorotate180; + else if ( L"-90" == sValue ) m_oValue.eRotate = cssmsorotate270; + else + m_oValue.eRotate = cssmsorotate0; + } + void CCssProperty::ReadValue_VTextAnchor(std::wstring& sValue) + { + if ( L"top" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorTop; + else if ( L"middle" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorMiddle; + else if ( L"bottom" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorBottom; + else if ( L"top-center" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorTopCenter; + else if ( L"middle-center" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorMiddleCenter; + else if ( L"bottom-center" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorBottomCenter; + else if ( L"top-baseline" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorTopBaseline; + else if ( L"bottom-baseline" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorBottomBaseline; + else if ( L"top-center-baseline" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorTopCenterBaseline; + else if ( L"bottom-center-baseline" == sValue ) m_oValue.eVTextAnchor = cssvtextanchorBottomCenterBaseline; + else + m_oValue.eVTextAnchor = cssvtextanchorTop; + } + void CCssProperty::ReadValue_FontStyle(std::wstring& sValue) + { + if ( L"normal" == sValue ) m_oValue.eFontStyle = cssfontstyleNormal; + else if ( L"italic" == sValue ) m_oValue.eFontStyle = cssfontstyleItalic; + else if ( L"oblique" == sValue ) m_oValue.eFontStyle = cssfontstyleOblique; + else + m_oValue.eFontStyle = cssfontstyleNormal; + } + void CCssProperty::ReadValue_FontVariant(std::wstring& sValue) + { + if ( L"normal" == sValue ) m_oValue.eFontVariant = cssfontvariantNormal; + else if ( L"small-caps" == sValue ) m_oValue.eFontVariant = cssfontvariantSmallCaps; + else + m_oValue.eFontVariant = cssfontvariantNormal; + } + void CCssProperty::ReadValue_FontWeight(std::wstring& sValue) + { + if ( L"normal" == sValue ) m_oValue.eFontWeight = cssfontweightNormal; + else if ( L"lighter" == sValue ) m_oValue.eFontWeight = cssfontweightLighter; + else if ( L"100" == sValue ) m_oValue.eFontWeight = cssfontweight100; + else if ( L"200" == sValue ) m_oValue.eFontWeight = cssfontweight200; + else if ( L"300" == sValue ) m_oValue.eFontWeight = cssfontweight300; + else if ( L"400" == sValue ) m_oValue.eFontWeight = cssfontweight400; + else if ( L"bold" == sValue ) m_oValue.eFontWeight = cssfontweightBold; + else if ( L"bolder" == sValue ) m_oValue.eFontWeight = cssfontweightBolder; + else if ( L"500" == sValue ) m_oValue.eFontWeight = cssfontweight500; + else if ( L"600" == sValue ) m_oValue.eFontWeight = cssfontweight600; + else if ( L"700" == sValue ) m_oValue.eFontWeight = cssfontweight700; + else if ( L"800" == sValue ) m_oValue.eFontWeight = cssfontweight800; + else if ( L"900" == sValue ) m_oValue.eFontWeight = cssfontweight900; + else + m_oValue.eFontWeight = cssfontweightNormal; + } + void CCssProperty::ReadValue_TextDecoration(std::wstring& sValue) + { + if ( L"none" == sValue ) m_oValue.eTextDecoration = csstextdecorationNone; + else if ( L"underline" == sValue ) m_oValue.eTextDecoration = csstextdecorationUnderline; + else if ( L"overline" == sValue ) m_oValue.eTextDecoration = csstextdecorationOverline; + else if ( L"line-through" == sValue ) m_oValue.eTextDecoration = csstextdecorationLineThrough; + else if ( L"blink" == sValue ) m_oValue.eTextDecoration = csstextdecorationBlink; + else + m_oValue.eTextDecoration = csstextdecorationNone; + } + void CCssProperty::ReadValue_VTextAlign(std::wstring& sValue) + { + if ( L"left" == sValue ) m_oValue.eVTextAlign = cssvtextalignLeft; + else if ( L"right" == sValue ) m_oValue.eVTextAlign = cssvtextalignRight; + else if ( L"center" == sValue ) m_oValue.eVTextAlign = cssvtextalignCenter; + else if ( L"justify" == sValue ) m_oValue.eVTextAlign = cssvtextalignJustify; + else if ( L"letter-justify" == sValue ) m_oValue.eVTextAlign = cssvtextalignLetterJustify; + else if ( L"stretch-justify" == sValue ) m_oValue.eVTextAlign = cssvtextalignStretchJustify; + else + m_oValue.eVTextAlign = cssvtextalignLeft; + } + void CCssProperty::ReadValue_VTextSpacingMode(std::wstring& sValue) + { + if ( L"tightening" == sValue ) m_oValue.eVTextSpacingMode = cssvtextspacingmodeTightening; + else if ( L"tracking" == sValue ) m_oValue.eVTextSpacingMode = cssvtextspacingmodeTracking; + else + m_oValue.eVTextSpacingMode = cssvtextspacingmodeTightening; + } + + //-------------------------------------------------------------------------------- + // CCssStyle 14.1.2.1 (style) (Part 1) + //-------------------------------------------------------------------------------- + + CCssStyle::CCssStyle() + { + } + CCssStyle::~CCssStyle() + { + Clear(); + } + void CCssStyle::Clear() + { + m_arrProperties.clear(); + } + + std::wstring CCssStyle::FromString(const std::wstring &sValue) + { + Clear(); + + m_sCss = sValue; + ParseProperties(); + + return m_sCss; + } + + std::wstring CCssStyle::ToString () const + { + return m_sCss; + } + + void CCssStyle::mergeFrom(CCssStyle* parent) + { + if (!parent) return; + + for (std::map::iterator it = parent->m_mapProperties.begin(); it != parent->m_mapProperties.end(); ++it) + { + std::map::iterator pFind = m_mapProperties.find(it->first); + if (pFind == m_mapProperties.end()) + { + m_arrProperties.push_back(parent->m_arrProperties[it->second]); + m_mapProperties.insert(std::make_pair(it->first, m_arrProperties.size() - 1)); + } + } + } + + bool CCssStyle::ParseProperties() + { + std::wstring sTemp = m_sCss; + while ( false == sTemp.empty() ) + { + size_t nPos = (int)sTemp.find( ';' ); + if ( std::wstring::npos == nPos ) + { + CCssPropertyPtr pProperty = CCssPropertyPtr(new CCssProperty(sTemp)); + if ((pProperty) && (cssptUnknown != pProperty->get_Type()) ) + { + std::map::iterator pFind = m_mapProperties.find(pProperty->get_Type()); + if (pFind != m_mapProperties.end()) + { + m_arrProperties[pFind->second] = pProperty; + } + else + { + m_arrProperties.push_back(pProperty); + m_mapProperties.insert(std::make_pair(pProperty->get_Type(), m_arrProperties.size() - 1)); + } + } + + sTemp.clear(); + continue; + } + else + { + CCssPropertyPtr pProperty = CCssPropertyPtr(new CCssProperty( sTemp.substr( 0, nPos ))); + + if ((pProperty) && (cssptUnknown != pProperty->get_Type()) ) + { + std::map::iterator pFind = m_mapProperties.find(pProperty->get_Type()); + if (pFind != m_mapProperties.end()) + { + m_arrProperties[pFind->second] = pProperty; + } + else + { + m_arrProperties.push_back(pProperty); + m_mapProperties.insert(std::make_pair(pProperty->get_Type(), m_arrProperties.size() - 1)); + } + } + + sTemp = sTemp.substr( nPos + 1, sTemp.length() - nPos - 1 ); + } + } + + return true; + } + + //-------------------------------------------------------------------------------- + // Vml_Vector2D_Units 14.1.2.3 (from, control1, control2, to) + //-------------------------------------------------------------------------------- + + CVml_Vector2D_Units::CVml_Vector2D_Units() + { + m_dX = 0; + m_dY = 0; + } + + double CVml_Vector2D_Units::GetX() const + { + return m_dX; + } + double CVml_Vector2D_Units::GetY() const + { + return m_dY; + } + + void CVml_Vector2D_Units::SetValue(double dX, double dY) + { + m_dX = dX; + m_dY = dY; + } + + double CVml_Vector2D_Units::FromString(const std::wstring &sValue) + { + m_dX = 0; + m_dY = 0; + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nPos = (int)sValue.find( L"," ); + if ( -1 == nPos ) + {//only x position + SimpleTypes::CPoint oPt1 = sValue; + m_dX = oPt1.GetValue(); + return 0; + } + + SimpleTypes::CPoint oPt1 = sValue.substr( 0, nPos ); + m_dX = oPt1.GetValue(); + + SimpleTypes::CPoint oPt2 = sValue.substr( nPos + 1, nLen - nPos - 1 ); + m_dY = oPt2.GetValue(); + + return 0; + } + + std::wstring CVml_Vector2D_Units::ToString () const + { + return boost::lexical_cast(m_dX) + L"," + boost::lexical_cast(m_dY); + } + + //-------------------------------------------------------------------------------- + // Vml_Vector2D_Percentage + //-------------------------------------------------------------------------------- + + CVml_Vector2D_Percentage::CVml_Vector2D_Percentage() + { + m_dX = 0; + m_dY = 0; + } + + double CVml_Vector2D_Percentage::GetX() const + { + return m_dX; + } + double CVml_Vector2D_Percentage::GetY() const + { + return m_dY; + } + + void CVml_Vector2D_Percentage::SetValue(double dX, double dY) + { + m_dX = dX; + m_dY = dY; + } + + double CVml_Vector2D_Percentage::FromString(const std::wstring &sValue) + { + m_dX = 0; + m_dY = 0; + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nPos = (int)sValue.find( L"," ); + if ( -1 == nPos ) + {//only x position + SimpleTypes::CPercentage oPerc1 = sValue; + m_dX = oPerc1.GetValue(); + return 0; + } + + SimpleTypes::CPercentage oPerc1 = sValue.substr( 0, nPos ); + m_dX = oPerc1.GetValue(); + + SimpleTypes::CPercentage oPerc2 = sValue.substr( nPos + 1, nLen - nPos - 1 ); + m_dY = oPerc2.GetValue(); + + return 0; + } + + std::wstring CVml_Vector2D_Percentage::ToString () const + { + return boost::lexical_cast(m_dX) + L"%," + boost::lexical_cast(m_dY) + L"%"; + } + + //-------------------------------------------------------------------------------- + // Vml_Vector2D_1_65536 + //-------------------------------------------------------------------------------- + + CVml_Vector2D_1_65536::CVml_Vector2D_1_65536() + { + m_dX = 0; + m_dY = 0; + } + + double CVml_Vector2D_1_65536::GetX() const + { + return m_dX; + } + double CVml_Vector2D_1_65536::GetY() const + { + return m_dY; + } + + void CVml_Vector2D_1_65536::SetValue(double dX, double dY) + { + m_dX = dX; + m_dY = dY; + } + + double CVml_Vector2D_1_65536::FromString(const std::wstring &sValue) + { + m_dX = 0; + m_dY = 0; + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nPos = (int)sValue.find( L"," ); + if ( -1 == nPos ) + {//only x position + SimpleTypes::Vml::CVml_1_65536 oFraction1 = sValue; + m_dX = oFraction1.GetValue(); + return 0; + } + + SimpleTypes::Vml::CVml_1_65536 oFraction1 = sValue.substr( 0, nPos ); + m_dX = oFraction1.GetValue(); + + SimpleTypes::Vml::CVml_1_65536 oFraction2 = sValue.substr( nPos + 1, nLen - nPos - 1 ); + m_dY = oFraction2.GetValue(); + + return 0; + } + + std::wstring CVml_Vector2D_1_65536::ToString () const + { + return boost::lexical_cast(m_dX) + L"," + boost::lexical_cast(m_dY); + } + + //-------------------------------------------------------------------------------- + // CVml_TableLimits + //-------------------------------------------------------------------------------- + + CVml_TableLimits::CVml_TableLimits() + { + } + + unsigned int CVml_TableLimits::GetSize() const + { + return (unsigned int)m_arrLimits.size(); + } + double CVml_TableLimits::GetAt(int nIndex) const + { + if ( nIndex < 0 || nIndex >= (int)m_arrLimits.size() ) + return 0; + + return m_arrLimits[nIndex]; + } + + void CVml_TableLimits::AddValue(double dValue) + { + m_arrLimits.push_back( dValue ); + } + + int CVml_TableLimits::FromString(const std::wstring &sValue) + { + int nPos = 0; + int nLen = (int)sValue.length(); + + int nSpacePos = 0; + wchar_t wChar; + while ( nPos < nLen ) + { + while ( ' ' == ( wChar = sValue[nPos] ) ) + { + nPos++; + if ( nPos >= nLen ) + return 0; + } + + nSpacePos = (int)sValue.find( L" ", nPos ); + if ( -1 == nSpacePos ) + nSpacePos = nLen; + + SimpleTypes::CPoint oPoint = sValue.substr( nPos, nSpacePos - nPos ); + nPos = nSpacePos + 1; + + m_arrLimits.push_back( oPoint.ToPoints() ); + } + + return 0; + } + + std::wstring CVml_TableLimits::ToString () const + { + std::wstring sResult; + + for ( unsigned int nIndex = 0; nIndex < m_arrLimits.size(); nIndex++ ) + { + sResult += boost::lexical_cast(m_arrLimits[nIndex]) + L"pt "; + } + + return sResult; + } + + //-------------------------------------------------------------------------------- + // CVml_TableProperties + //-------------------------------------------------------------------------------- + + int CVml_TableProperties::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger(sValue); + + return this->m_eValue; + } + + std::wstring CVml_TableProperties::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + bool CVml_TableProperties::IsTable() const + { + return ( this->m_eValue & 1 ? true : false ); + } + + bool CVml_TableProperties::IsPlaceholder() const + { + return ( this->m_eValue & 2 ? true : false ); + } + + bool CVml_TableProperties::IsBiDirectionalText() const + { + return ( this->m_eValue & 4 ? true : false ); + } + + //-------------------------------------------------------------------------------- + // Vml_Vector2D_Position 14.1.2.8 (position) + //-------------------------------------------------------------------------------- + + CVml_Vector2D_Position::CVml_Vector2D_Position() + { + + } + + EVml_Vector2D_Position CVml_Vector2D_Position::GetTypeX() const + { + return m_eTypeX; + } + EVml_Vector2D_Position CVml_Vector2D_Position::GetTypeY() const + { + return m_eTypeY; + } + std::wstring CVml_Vector2D_Position::GetIdX() const + { + return m_sIdX; + } + std::wstring CVml_Vector2D_Position::GetIdY() const + { + return m_sIdY; + } + double CVml_Vector2D_Position::GetX() const + { + return m_dX; + } + double CVml_Vector2D_Position::GetY() const + { + return m_dY; + } + void CVml_Vector2D_Position::SetConstantX(double dX) + { + m_eTypeX = vmlvector2dposConstant; + m_dX = dX; + } + + void CVml_Vector2D_Position::SetConstantY(double dY) + { + m_eTypeY = vmlvector2dposConstant; + m_dY = dY; + } + + double CVml_Vector2D_Position::FromString(const std::wstring &sValue) + { + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nPos = (int)sValue.find( L"," ); + if ( -1 == nPos ) + return 0; + + std::wstring sFirst = sValue.substr( 0, nPos ); + std::wstring sSecond = sValue.substr( nPos + 1, nLen - nPos - 1 ); + + Parse( sFirst, true ); + Parse( sSecond, false ); + + return 0; + } + + std::wstring CVml_Vector2D_Position::ToString () const + { + std::wstring sResult; + + switch ( m_eTypeX ) + { + case vmlvector2dposConstant : sResult = boost::lexical_cast( m_dX ); break; + case vmlvector2dposFormula : sResult = L"@" + m_sIdX; break; + case vmlvector2dposAdjValue : sResult = L"#" + m_sIdX; break; + case vmlvector2dposCenter : sResult = L"center"; break; + case vmlvector2dposTopLeft : sResult = L"topleft"; break; + case vmlvector2dposBottomRight : sResult = L"bottomright"; break; + }; + + sResult += L","; + + switch ( m_eTypeY ) + { + case vmlvector2dposConstant : + { + std::wstring sTemp = boost::lexical_cast( m_dY ); + sResult += sTemp; + break; + } + case vmlvector2dposFormula : sResult += L"@" + m_sIdY; break; + case vmlvector2dposAdjValue : sResult += L"#" + m_sIdY; break; + case vmlvector2dposCenter : sResult += L"center"; break; + case vmlvector2dposTopLeft : sResult += L"topleft"; break; + case vmlvector2dposBottomRight : sResult += L"bottomright"; break; + }; + + return sResult; + } + + void CVml_Vector2D_Position::Parse(std::wstring &sValue, bool bFirst) + { + EVml_Vector2D_Position eValue = vmlvector2dposConstant; + double dValue = 0.0; + std::wstring sId; + + XmlUtils::replace_all( sValue, L" ", L"" ); + + int nLen = (int)sValue.length(); + if ( nLen > 0 ) + { + + wchar_t wChar = sValue[0]; + switch ( wChar ) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '.': + + eValue = vmlvector2dposConstant; + dValue = XmlUtils::GetDouble(sValue); + break; + + case 'c': + + if ( L"center" == sValue ) + eValue = vmlvector2dposCenter; + + break; + + case 't': + + if ( L"topleft" == sValue ) + eValue = vmlvector2dposTopLeft; + + break; + + case 'b': + + if ( L"bottomright" == sValue ) + eValue = vmlvector2dposBottomRight; + + break; + + case '@': + + eValue = vmlvector2dposFormula; + sId = sValue.substr( 1, nLen - 1 ); + break; + + case '#': + + eValue = vmlvector2dposAdjValue; + sId = sValue.substr( 1, nLen - 1 ); + break; + } + + } + + if ( bFirst ) + { + m_eTypeX = eValue; + m_sIdX = sId; + m_dX = dValue; + } + else + { + m_eTypeY = eValue; + m_sIdY = sId; + m_dY = dValue; + } + } + + //-------------------------------------------------------------------------------- + // Vml_Polygon2D_Units 14.1.2.15 (points) + //-------------------------------------------------------------------------------- + + CVml_Polygon2D_Units::CVml_Polygon2D_Units() + { + m_wcDelimiter = 0x20; + } + CVml_Polygon2D_Units::CVml_Polygon2D_Units(const CVml_Polygon2D_Units &oOther) + { + m_wcDelimiter = 0x20; + FromString( oOther.ToString() ); + } + CVml_Polygon2D_Units::CVml_Polygon2D_Units(const std::wstring &sValue) + { + m_wcDelimiter = 0x20; + FromString( sValue ); + } + CVml_Polygon2D_Units& CVml_Polygon2D_Units::operator =(const std::wstring &sValue) + { + FromString( sValue ); + return *this; + } + + void CVml_Polygon2D_Units::SetDelimiter(wchar_t wcNew) + { + m_wcDelimiter = wcNew; + } + double CVml_Polygon2D_Units::GetX(int nIndex) const + { + if ( nIndex < 0 || nIndex >= (int)m_arrPoints.size() ) + return 0; + + return m_arrPoints[nIndex].dX; + } + double CVml_Polygon2D_Units::GetY(int nIndex) const + { + if ( nIndex < 0 || nIndex >= (int)m_arrPoints.size() ) + return 0; + + return m_arrPoints[nIndex].dY; + } + + void CVml_Polygon2D_Units::AddPoint(double dX, double dY) + { + TPoint oPt( dX, dY ); + m_arrPoints.push_back( oPt ); + } + + double CVml_Polygon2D_Units::FromString(const std::wstring &sValue) + { + m_arrPoints.clear(); + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + int nStartPos = 0; + while ( true ) + { + int nMidPos = (int)sValue.find( L",", nStartPos ); + int nEndPos = (int)sValue.find( m_wcDelimiter, nMidPos + 1 ); + + if ( -1 == nMidPos ) + break; + + if ( -1 == nEndPos ) + nEndPos = nLen; + + std::wstring strX = sValue.substr( nStartPos, nMidPos - nStartPos ) ; + std::wstring strY = sValue.substr( nMidPos + 1, nEndPos - nMidPos - 1 ); + + XmlUtils::replace_all(strX, L"@", L""); + XmlUtils::replace_all(strY, L"@", L""); + + int nX = (int)XmlUtils::GetDouble(strX); + int nY = (int)XmlUtils::GetDouble(strY ); + + m_arrPoints.push_back( TPoint( nX, nY ) ); + + nStartPos = nEndPos + 1; + } + + + return 0; + } + + std::wstring CVml_Polygon2D_Units::ToString () const + { + std::wstring sResult; + + for ( size_t nIndex = 0; nIndex < m_arrPoints.size(); nIndex++ ) + { + sResult += boost::lexical_cast(m_arrPoints[nIndex].dX) + L"," + boost::lexical_cast(m_arrPoints[nIndex].dY); + if ( nIndex < m_arrPoints.size() - 1 ) + sResult += m_wcDelimiter; + } + + return sResult; + } + + //-------------------------------------------------------------------------------- + // Vml_1_65536_Or_Percentage 14.2.2.11 (brightness) + //-------------------------------------------------------------------------------- + CVml_1_65536_Or_Percentage::CVml_1_65536_Or_Percentage() + { + m_dValue = 0; + } + + double CVml_1_65536_Or_Percentage::GetValue() const + { + return m_dValue; + } + + void CVml_1_65536_Or_Percentage::SetValue(double dValue) + { + m_dValue = (std::max)( 0.0, (std::min)( 1.0, dValue) ); + } + + void CVml_1_65536_Or_Percentage::SetValue(int nValue) + { + m_dValue = (std::max)( 0.0, (std::min)( 65536.0, (double) nValue) ) / 65536.0; + } + void CVml_1_65536_Or_Percentage::SetPercentage(double dValue) + { + m_dValue = (std::max)( 0.0, (std::min)( 100.0, dValue ) ) / 100.0; + } + + double CVml_1_65536_Or_Percentage::FromString(const std::wstring &sValue) + { + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + bool bFraction = ( 'f' == sValue[ nLen - 1] ); + bool bPercentage = ( '%' == sValue[ nLen - 1] ); + + if ( bFraction ) + { + std::wstring strValue = sValue.substr( 0, nLen - 1 ); + int nValue = strValue.empty() ? 0 : XmlUtils::GetInteger(strValue); + + SetValue( nValue ); + } + else if ( bPercentage ) + { + std::wstring strValue = sValue.substr( 0, nLen - 1 ); + double dValue = XmlUtils::GetDouble(strValue); + + SetPercentage( dValue ); + } + else + { + double dValue = XmlUtils::GetDouble(sValue); + SetValue( dValue ); + } + + return m_dValue; + } + + std::wstring CVml_1_65536_Or_Percentage::ToString () const + { + std::wstring sResult = boost::lexical_cast( m_dValue ); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // Vml_Matrix 14.1.2.18 (matrix) + //-------------------------------------------------------------------------------- + CVml_Matrix::CVml_Matrix() + { + ResetMatrix(); + } + CVml_Matrix::CVml_Matrix(const CVml_Matrix &oOther) + { + ResetMatrix(); + FromString( oOther.ToString() ); + } + CVml_Matrix::CVml_Matrix(const std::wstring &sValue) + { + ResetMatrix(); + FromString( sValue ); + } + CVml_Matrix& CVml_Matrix::operator =(const std::wstring &sValue) + { + FromString( sValue ); + return *this; + } + void CVml_Matrix::ResetMatrix() + { + m_dSxx = 1; m_dSxy = 0; + m_dSyx = 0; m_dSyy = 1; + m_dPx = 0; m_dPy = 0; + } + void CVml_Matrix::SetMatrix(double dSxx, double dSxy, double dSyx, double dSyy, double dPx, double dPy) + { + m_dSxx = dSxx; m_dSxy = dSxy; + m_dSyx = dSyx; m_dSyy = dSyy; + m_dPx = dPx; m_dPy = dPy; + } + + double CVml_Matrix::Get_Sxx() const + { + return m_dSxx; + } + double CVml_Matrix::Get_Sxy() const + { + return m_dSxy; + } + double CVml_Matrix::Get_Syx() const + { + return m_dSyx; + } + double CVml_Matrix::Get_Syy() const + { + return m_dSyy; + } + + double CVml_Matrix::Get_Px() const + { + return m_dPx; + } + double CVml_Matrix::Get_Py() const + { + return m_dPy; + } + + double CVml_Matrix::FromString(const std::wstring &sValue) + { + ResetMatrix(); + + int nLen = (int)sValue.length(); + if ( nLen <= 0 ) + return 0; + + // Sxx + int nStartPos = 0; + int nEndPos = (int)sValue.find( L",", nStartPos ); + if ( -1 == nEndPos ) + nEndPos = nLen; + + if ( nEndPos - nStartPos > 0 ) + { + std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); + m_dSxx = XmlUtils::GetDouble(strValue); + } + + // Sxy + nStartPos = nEndPos + 1; + nEndPos = (int)sValue.find( L",", nStartPos ); + if ( -1 == nEndPos ) + nEndPos = nLen; + + if ( nEndPos - nStartPos > 0 ) + { + std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); + m_dSxy = XmlUtils::GetDouble(strValue); + } + + // Syx + nStartPos = nEndPos + 1; + nEndPos = (int)sValue.find( L",", nStartPos ); + if ( -1 == nEndPos ) + nEndPos = nLen; + + if ( nEndPos - nStartPos > 0 ) + { + std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); + m_dSyx = XmlUtils::GetDouble(strValue); + } + + // Syy + nStartPos = nEndPos + 1; + nEndPos = (int)sValue.find( L",", nStartPos ); + if ( -1 == nEndPos ) + nEndPos = nLen; + + if ( nEndPos - nStartPos > 0 ) + { + std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); + m_dSyy = XmlUtils::GetDouble(strValue); + } + + // Px + nStartPos = nEndPos + 1; + nEndPos = (int)sValue.find( L",", nStartPos ); + if ( -1 == nEndPos ) + nEndPos = nLen; + + if ( nEndPos - nStartPos > 0 ) + { + std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); + m_dPx = XmlUtils::GetDouble(strValue); + } + + // Py + nStartPos = nEndPos + 1; + nEndPos = (int)sValue.find( L",", nStartPos ); + if ( -1 == nEndPos ) + nEndPos = nLen; + + if ( nEndPos - nStartPos > 0 ) + { + std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); + m_dPy = XmlUtils::GetDouble(strValue); + } + + nStartPos = nEndPos + 1; + return 0; + } + + std::wstring CVml_Matrix::ToString () const + { + return boost::lexical_cast(m_dSxx) + L"," + boost::lexical_cast(m_dSxy) + L"," + + boost::lexical_cast(m_dSyx) + L"," + boost::lexical_cast(m_dSyy) + L"," + + boost::lexical_cast(m_dPx) + L"," + boost::lexical_cast(m_dPy); + } + + //-------------------------------------------------------------------------------- + // Vml_Vector2D_Units_Or_Percentage + //-------------------------------------------------------------------------------- + + CVml_Vector2D_Units_Or_Percentage::CVml_Vector2D_Units_Or_Percentage() + { + m_dX = 0; + m_dY = 0; + m_bUnitsX = true; + m_bUnitsY = true; + } + + double CVml_Vector2D_Units_Or_Percentage::GetX() const + { + return m_dX; + } + double CVml_Vector2D_Units_Or_Percentage::GetY() const + { + return m_dY; + } + bool CVml_Vector2D_Units_Or_Percentage::IsXinPoints() const + { + return m_bUnitsX; + } + bool CVml_Vector2D_Units_Or_Percentage::IsYinPoints() const + { + return m_bUnitsY; + } + void CVml_Vector2D_Units_Or_Percentage::SetValue_Points(double dX, double dY) + { + m_dX = dX; + m_dY = dY; + + m_bUnitsX = true; + m_bUnitsY = true; + } + + double CVml_Vector2D_Units_Or_Percentage::FromString(const std::wstring &sValue) + { + m_dX = 0; + m_dY = 0; + m_bUnitsX = true; + m_bUnitsY = true; + + int nLen = (int)sValue.length(); + if ( nLen < 1) + return 0; + + int nPos = (int)sValue.find( L"," ); + if ( -1 == nPos ) + return 0; + + std::wstring sTemp = sValue.substr( 0, nPos ); + if ( std::wstring::npos != sTemp.find( '%' ) ) + { + SimpleTypes::CPercentage oPerc = sTemp; + m_dX = oPerc.GetValue(); + m_bUnitsX = false; + } + else + { + SimpleTypes::CPoint oPt = sTemp; + m_dX = oPt.GetValue(); + m_bUnitsX = true; + } + + sTemp = sValue.substr( nPos + 1, nLen - nPos - 1 ); + if ( std::wstring::npos != sTemp.find( '%' ) ) + { + SimpleTypes::CPercentage oPerc = sTemp; + m_dY = oPerc.GetValue(); + m_bUnitsY = false; + } + else + { + SimpleTypes::CPoint oPt = sTemp; + m_dY = oPt.GetValue(); + m_bUnitsY = true; + } + + return 0; + } + + std::wstring CVml_Vector2D_Units_Or_Percentage::ToString () const + { + std::wstring sResult = boost::lexical_cast(m_dX); + + if ( m_bUnitsX ) sResult += L"pt,"; + else sResult += L"%,"; + + sResult += boost::lexical_cast(m_dY); + + if ( m_bUnitsY ) sResult += L"pt"; + else sResult += L"%"; + + return sResult; + } + + //-------------------------------------------------------------------------------- + // Vml_TextBoxInset 14.1.2.22 (inset) + //-------------------------------------------------------------------------------- + + CVml_TextBoxInset::CVml_TextBoxInset() + { + Set( 0, 0, 0, 0 ); + } + + double CVml_TextBoxInset::GetLeft(int nIndex) const + { + return m_dLeft; + } + double CVml_TextBoxInset::GetTop(int nIndex) const + { + return m_dTop; + } + double CVml_TextBoxInset::GetRight(int nIndex) const + { + return m_dRight; + } + double CVml_TextBoxInset::GetBottom(int nIndex) const + { + return m_dBottom; + } + + void CVml_TextBoxInset::Set(double dL, double dT, double dR, double dB) + { + m_dLeft = dL; + m_dTop = dT; + m_dRight = dR; + m_dBottom = dB; + } + + double CVml_TextBoxInset::FromString(const std::wstring &sValueInput) + { + Set( 0, 0, 0, 0 ); + + if ( sValueInput.empty()) + return 0; + + std::vector arSplit; + + std::wstring sValue = sValueInput; + + // Разделителями могут быть запятые и пробелы + XmlUtils::replace_all(sValue, L"@", L""); + boost::algorithm::split(arSplit, sValue, boost::algorithm::is_any_of(L", "), boost::algorithm::token_compress_on); + + if (arSplit.size() > 0) + { + SimpleTypes::CPoint oPt = arSplit[0]; + m_dLeft = oPt.GetValue(); + } + + if (arSplit.size() > 1) + { + SimpleTypes::CPoint oPt = arSplit[1]; + m_dTop = oPt.GetValue(); + } + + if (arSplit.size() > 2) + { + SimpleTypes::CPoint oPt = arSplit[2]; + m_dRight = oPt.GetValue(); + } + + if (arSplit.size() > 3) + { + SimpleTypes::CPoint oPt = arSplit[3]; + m_dBottom = oPt.GetValue(); + } + + return 0; + } + + std::wstring CVml_TextBoxInset::ToString () const + { + return boost::lexical_cast(m_dLeft) + L"pt," + boost::lexical_cast(m_dTop) + L"pt," + boost::lexical_cast(m_dRight) + L"pt,"+ boost::lexical_cast(m_dBottom) + L"pt"; + } + } // Vml +} // SimpleTypes + diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h b/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h index 11b49b07fe..50a2506c58 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h @@ -31,11 +31,11 @@ */ #pragma once -#include "SimpleTypes_Base.h" #include "SimpleTypes_Drawing.h" #include -#include +#include +#include // Here are simple types Vml from spec Office Open Xml Part4 14 namespace SimpleTypes @@ -43,218 +43,220 @@ namespace SimpleTypes namespace Vml { enum SptType - { - sptMin = 0, - sptNotPrimitive = sptMin, - sptRectangle = 1, - sptRoundRectangle = 2, - sptEllipse = 3, - sptDiamond = 4, - sptIsocelesTriangle = 5, - sptRightTriangle = 6, - sptParallelogram = 7, - sptTrapezoid = 8, - sptHexagon = 9, - sptOctagon = 10, - sptPlus = 11, - sptStar = 12, - sptArrow = 13, - sptThickArrow = 14, - sptHomePlate = 15, - sptCube = 16, - sptBalloon = 17, - sptSeal = 18, - sptArc = 19, - sptLine = 20, - sptPlaque = 21, - sptCan = 22, - sptDonut = 23, - sptTextSimple = 24, - sptTextOctagon = 25, - sptTextHexagon = 26, - sptTextCurve = 27, - sptTextWave = 28, - sptTextRing = 29, - sptTextOnCurve = 30, - sptTextOnRing = 31, - sptStraightConnector1 = 32, - sptBentConnector2 = 33, - sptBentConnector3 = 34, - sptBentConnector4 = 35, - sptBentConnector5 = 36, - sptCurvedConnector2 = 37, - sptCurvedConnector3 = 38, - sptCurvedConnector4 = 39, - sptCurvedConnector5 = 40, - sptCallout1 = 41, - sptCallout2 = 42, - sptCallout3 = 43, - sptAccentCallout1 = 44, - sptAccentCallout2 = 45, - sptAccentCallout3 = 46, - sptBorderCallout1 = 47, - sptBorderCallout2 = 48, - sptBorderCallout3 = 49, - sptAccentBorderCallout1 = 50, - sptAccentBorderCallout2 = 51, - sptAccentBorderCallout3 = 52, - sptRibbon = 53, - sptRibbon2 = 54, - sptChevron = 55, - sptPentagon = 56, - sptNoSmoking = 57, - sptSeal8 = 58, - sptSeal16 = 59, - sptSeal32 = 60, - sptWedgeRectCallout = 61, - sptWedgeRRectCallout = 62, - sptWedgeEllipseCallout = 63, - sptWave = 64, - sptFoldedCorner = 65, - sptLeftArrow = 66, - sptDownArrow = 67, - sptUpArrow = 68, - sptLeftRightArrow = 69, - sptUpDownArrow = 70, - sptIrregularSeal1 = 71, - sptIrregularSeal2 = 72, - sptLightningBolt = 73, - sptHeart = 74, - sptPictureFrame = 75, - sptQuadArrow = 76, - sptLeftArrowCallout = 77, - sptRightArrowCallout = 78, - sptUpArrowCallout = 79, - sptDownArrowCallout = 80, - sptLeftRightArrowCallout = 81, - sptUpDownArrowCallout = 82, - sptQuadArrowCallout = 83, - sptBevel = 84, - sptLeftBracket = 85, - sptRightBracket = 86, - sptLeftBrace = 87, - sptRightBrace = 88, - sptLeftUpArrow = 89, - sptBentUpArrow = 90, - sptBentArrow = 91, - sptSeal24 = 92, - sptStripedRightArrow = 93, - sptNotchedRightArrow = 94, - sptBlockArc = 95, - sptSmileyFace = 96, - sptVerticalScroll = 97, - sptHorizontalScroll = 98, - sptCircularArrow = 99, - sptNotchedCircularArrow = 100, - sptUturnArrow = 101, - sptCurvedRightArrow = 102, - sptCurvedLeftArrow = 103, - sptCurvedUpArrow = 104, - sptCurvedDownArrow = 105, - sptCloudCallout = 106, - sptEllipseRibbon = 107, - sptEllipseRibbon2 = 108, - sptFlowChartProcess = 109, - sptFlowChartDecision = 110, - sptFlowChartInputOutput = 111, - sptFlowChartPredefinedProcess = 112, - sptFlowChartInternalStorage = 113, - sptFlowChartDocument = 114, - sptFlowChartMultidocument = 115, - sptFlowChartTerminator = 116, - sptFlowChartPreparation = 117, - sptFlowChartManualInput = 118, - sptFlowChartManualOperation = 119, - sptFlowChartConnector = 120, - sptFlowChartPunchedCard = 121, - sptFlowChartPunchedTape = 122, - sptFlowChartSummingJunction = 123, - sptFlowChartOr = 124, - sptFlowChartCollate = 125, - sptFlowChartSort = 126, - sptFlowChartExtract = 127, - sptFlowChartMerge = 128, - sptFlowChartOfflineStorage = 129, - sptFlowChartOnlineStorage = 130, - sptFlowChartMagneticTape = 131, - sptFlowChartMagneticDisk = 132, - sptFlowChartMagneticDrum = 133, - sptFlowChartDisplay = 134, - sptFlowChartDelay = 135, - sptTextPlainText = 136, - sptTextStop = 137, - sptTextTriangle = 138, - sptTextTriangleInverted = 139, - sptTextChevron = 140, - sptTextChevronInverted = 141, - sptTextRingInside = 142, - sptTextRingOutside = 143, - sptTextArchUpCurve = 144, - sptTextArchDownCurve = 145, - sptTextCircleCurve = 146, - sptTextButtonCurve = 147, - sptTextArchUpPour = 148, - sptTextArchDownPour = 149, - sptTextCirclePour = 150, - sptTextButtonPour = 151, - sptTextCurveUp = 152, - sptTextCurveDown = 153, - sptTextCascadeUp = 154, - sptTextCascadeDown = 155, - sptTextWave1 = 156, - sptTextWave2 = 157, - sptTextWave3 = 158, - sptTextWave4 = 159, - sptTextInflate = 160, - sptTextDeflate = 161, - sptTextInflateBottom = 162, - sptTextDeflateBottom = 163, - sptTextInflateTop = 164, - sptTextDeflateTop = 165, - sptTextDeflateInflate = 166, - sptTextDeflateInflateDeflate = 167, - sptTextFadeRight = 168, - sptTextFadeLeft = 169, - sptTextFadeUp = 170, - sptTextFadeDown = 171, - sptTextSlantUp = 172, - sptTextSlantDown = 173, - sptTextCanUp = 174, - sptTextCanDown = 175, - sptFlowChartAlternateProcess = 176, - sptFlowChartOffpageConnector = 177, - sptCallout90 = 178, - sptAccentCallout90 = 179, - sptBorderCallout90 = 180, - sptAccentBorderCallout90 = 181, - sptLeftRightUpArrow = 182, - sptSun = 183, - sptMoon = 184, - sptBracketPair = 185, - sptBracePair = 186, - sptSeal4 = 187, - sptDoubleWave = 188, - sptActionButtonBlank = 189, - sptActionButtonHome = 190, - sptActionButtonHelp = 191, - sptActionButtonInformation = 192, - sptActionButtonForwardNext = 193, - sptActionButtonBackPrevious = 194, - sptActionButtonEnd = 195, - sptActionButtonBeginning = 196, - sptActionButtonReturn = 197, - sptActionButtonDocument = 198, - sptActionButtonSound = 199, - sptActionButtonMovie = 200, - sptHostControl = 201, - sptTextBox = 202, - sptMax, + { + sptMin = 0, + sptNotPrimitive = sptMin, + sptRectangle = 1, + sptRoundRectangle = 2, + sptEllipse = 3, + sptDiamond = 4, + sptIsocelesTriangle = 5, + sptRightTriangle = 6, + sptParallelogram = 7, + sptTrapezoid = 8, + sptHexagon = 9, + sptOctagon = 10, + sptPlus = 11, + sptStar = 12, + sptArrow = 13, + sptThickArrow = 14, + sptHomePlate = 15, + sptCube = 16, + sptBalloon = 17, + sptSeal = 18, + sptArc = 19, + sptLine = 20, + sptPlaque = 21, + sptCan = 22, + sptDonut = 23, + sptTextSimple = 24, + sptTextOctagon = 25, + sptTextHexagon = 26, + sptTextCurve = 27, + sptTextWave = 28, + sptTextRing = 29, + sptTextOnCurve = 30, + sptTextOnRing = 31, + sptStraightConnector1 = 32, + sptBentConnector2 = 33, + sptBentConnector3 = 34, + sptBentConnector4 = 35, + sptBentConnector5 = 36, + sptCurvedConnector2 = 37, + sptCurvedConnector3 = 38, + sptCurvedConnector4 = 39, + sptCurvedConnector5 = 40, + sptCallout1 = 41, + sptCallout2 = 42, + sptCallout3 = 43, + sptAccentCallout1 = 44, + sptAccentCallout2 = 45, + sptAccentCallout3 = 46, + sptBorderCallout1 = 47, + sptBorderCallout2 = 48, + sptBorderCallout3 = 49, + sptAccentBorderCallout1 = 50, + sptAccentBorderCallout2 = 51, + sptAccentBorderCallout3 = 52, + sptRibbon = 53, + sptRibbon2 = 54, + sptChevron = 55, + sptPentagon = 56, + sptNoSmoking = 57, + sptSeal8 = 58, + sptSeal16 = 59, + sptSeal32 = 60, + sptWedgeRectCallout = 61, + sptWedgeRRectCallout = 62, + sptWedgeEllipseCallout = 63, + sptWave = 64, + sptFoldedCorner = 65, + sptLeftArrow = 66, + sptDownArrow = 67, + sptUpArrow = 68, + sptLeftRightArrow = 69, + sptUpDownArrow = 70, + sptIrregularSeal1 = 71, + sptIrregularSeal2 = 72, + sptLightningBolt = 73, + sptHeart = 74, + sptPictureFrame = 75, + sptQuadArrow = 76, + sptLeftArrowCallout = 77, + sptRightArrowCallout = 78, + sptUpArrowCallout = 79, + sptDownArrowCallout = 80, + sptLeftRightArrowCallout = 81, + sptUpDownArrowCallout = 82, + sptQuadArrowCallout = 83, + sptBevel = 84, + sptLeftBracket = 85, + sptRightBracket = 86, + sptLeftBrace = 87, + sptRightBrace = 88, + sptLeftUpArrow = 89, + sptBentUpArrow = 90, + sptBentArrow = 91, + sptSeal24 = 92, + sptStripedRightArrow = 93, + sptNotchedRightArrow = 94, + sptBlockArc = 95, + sptSmileyFace = 96, + sptVerticalScroll = 97, + sptHorizontalScroll = 98, + sptCircularArrow = 99, + sptNotchedCircularArrow = 100, + sptUturnArrow = 101, + sptCurvedRightArrow = 102, + sptCurvedLeftArrow = 103, + sptCurvedUpArrow = 104, + sptCurvedDownArrow = 105, + sptCloudCallout = 106, + sptEllipseRibbon = 107, + sptEllipseRibbon2 = 108, + sptFlowChartProcess = 109, + sptFlowChartDecision = 110, + sptFlowChartInputOutput = 111, + sptFlowChartPredefinedProcess = 112, + sptFlowChartInternalStorage = 113, + sptFlowChartDocument = 114, + sptFlowChartMultidocument = 115, + sptFlowChartTerminator = 116, + sptFlowChartPreparation = 117, + sptFlowChartManualInput = 118, + sptFlowChartManualOperation = 119, + sptFlowChartConnector = 120, + sptFlowChartPunchedCard = 121, + sptFlowChartPunchedTape = 122, + sptFlowChartSummingJunction = 123, + sptFlowChartOr = 124, + sptFlowChartCollate = 125, + sptFlowChartSort = 126, + sptFlowChartExtract = 127, + sptFlowChartMerge = 128, + sptFlowChartOfflineStorage = 129, + sptFlowChartOnlineStorage = 130, + sptFlowChartMagneticTape = 131, + sptFlowChartMagneticDisk = 132, + sptFlowChartMagneticDrum = 133, + sptFlowChartDisplay = 134, + sptFlowChartDelay = 135, + sptTextPlainText = 136, + sptTextStop = 137, + sptTextTriangle = 138, + sptTextTriangleInverted = 139, + sptTextChevron = 140, + sptTextChevronInverted = 141, + sptTextRingInside = 142, + sptTextRingOutside = 143, + sptTextArchUpCurve = 144, + sptTextArchDownCurve = 145, + sptTextCircleCurve = 146, + sptTextButtonCurve = 147, + sptTextArchUpPour = 148, + sptTextArchDownPour = 149, + sptTextCirclePour = 150, + sptTextButtonPour = 151, + sptTextCurveUp = 152, + sptTextCurveDown = 153, + sptTextCascadeUp = 154, + sptTextCascadeDown = 155, + sptTextWave1 = 156, + sptTextWave2 = 157, + sptTextWave3 = 158, + sptTextWave4 = 159, + sptTextInflate = 160, + sptTextDeflate = 161, + sptTextInflateBottom = 162, + sptTextDeflateBottom = 163, + sptTextInflateTop = 164, + sptTextDeflateTop = 165, + sptTextDeflateInflate = 166, + sptTextDeflateInflateDeflate = 167, + sptTextFadeRight = 168, + sptTextFadeLeft = 169, + sptTextFadeUp = 170, + sptTextFadeDown = 171, + sptTextSlantUp = 172, + sptTextSlantDown = 173, + sptTextCanUp = 174, + sptTextCanDown = 175, + sptFlowChartAlternateProcess = 176, + sptFlowChartOffpageConnector = 177, + sptCallout90 = 178, + sptAccentCallout90 = 179, + sptBorderCallout90 = 180, + sptAccentBorderCallout90 = 181, + sptLeftRightUpArrow = 182, + sptSun = 183, + sptMoon = 184, + sptBracketPair = 185, + sptBracePair = 186, + sptSeal4 = 187, + sptDoubleWave = 188, + sptActionButtonBlank = 189, + sptActionButtonHome = 190, + sptActionButtonHelp = 191, + sptActionButtonInformation = 192, + sptActionButtonForwardNext = 193, + sptActionButtonBackPrevious = 194, + sptActionButtonEnd = 195, + sptActionButtonBeginning = 196, + sptActionButtonReturn = 197, + sptActionButtonDocument = 198, + sptActionButtonSound = 199, + sptActionButtonMovie = 200, + sptHostControl = 201, + sptTextBox = 202, + sptMax, sptNil = 0x0FFF }; } + //-------------------------------------------------------------------------------- // EditAs 14.1.3.1 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EEditAs { editasBullseye = 0, @@ -266,69 +268,12 @@ namespace SimpleTypes editasVenn = 6, }; - template - class CEditAs : public CSimpleType - { - public: - CEditAs() {} - virtual EEditAs FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( _T("bullseye") == sValue ) this->m_eValue = editasBullseye; - break; - case 'c': - if ( _T("canvas") == sValue ) this->m_eValue = editasCanvas; - else if ( _T("cycle") == sValue ) this->m_eValue = editasCycle; - break; - case 'o': - if ( _T("orgchart") == sValue ) this->m_eValue = editasOrgchart; - break; - case 'r': - if ( _T("radial") == sValue ) this->m_eValue = editasRadial; - break; - case 's': - if ( _T("stacked") == sValue ) this->m_eValue = editasStacked; - break; - case 'v': - if ( _T("venn") == sValue ) this->m_eValue = editasVenn; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case editasBullseye : return _T("bullseye"); - case editasCanvas : return _T("canvas"); - case editasCycle : return _T("cycle"); - case editasOrgchart : return _T("orgchart"); - case editasRadial : return _T("radial"); - case editasStacked : return _T("stacked"); - case editasVenn : return _T("venn"); - default : return _T("canvas"); - } - } - - SimpleType_FromString (EEditAs) - SimpleType_Operator_Equal (CEditAs) - - }; - + DEFINE_SIMPLE_TYPE(CEditAs, EEditAs, editasCanvas) //-------------------------------------------------------------------------------- // Ext 14.1.3.2 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EExt { extBackwardCompatible = 0, @@ -336,55 +281,12 @@ namespace SimpleTypes extView = 2, }; - template - class CExt : public CSimpleType - { - public: - CExt() {} - virtual EExt FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( _T("backwardCompatible") == sValue ) this->m_eValue = extBackwardCompatible; - break; - case 'e': - if ( _T("edit") == sValue ) this->m_eValue = extEdit; - break; - case 'v': - if ( _T("view") == sValue ) this->m_eValue = extView; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case extBackwardCompatible : return _T("backwardCompatible"); - case extEdit : return _T("edit"); - case extView : return _T("view"); - default : return _T("view"); - } - } - - SimpleType_FromString (EExt) - SimpleType_Operator_Equal (CExt) - - }; - + DEFINE_SIMPLE_TYPE(CExt, EExt, extView) //-------------------------------------------------------------------------------- // FillMethod 14.1.3.3 (Part 4) //-------------------------------------------------------------------------------- + enum EFillMethod { fillmethodAny, @@ -393,43 +295,13 @@ namespace SimpleTypes fillmethodSigma, fillmethodNone }; - template - class CFillMethod : public CSimpleType - { - public: - CFillMethod() {} - virtual EFillMethod FromString(std::wstring& sValue) - { - if (_T("any") == sValue) this->m_eValue = fillmethodAny; - else if (_T("linear") == sValue) this->m_eValue = fillmethodLinear; - else if (_T("linear sigma") == sValue) this->m_eValue = fillmethodLinearSigma; - else if (_T("sigma") == sValue) this->m_eValue = fillmethodSigma; - else if (_T("none") == sValue) this->m_eValue = fillmethodNone; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CFillMethod, EFillMethod, fillmethodNone) - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case fillmethodAny : return _T("any"); - case fillmethodLinear : return _T("linear"); - case fillmethodLinearSigma : return _T("linearSigma"); - case fillmethodSigma : return _T("sigma"); - case fillmethodNone : return _T("none"); - default : return _T("none"); - } - } - - SimpleType_FromString (EFillMethod) - SimpleType_Operator_Equal (CFillMethod) - }; //-------------------------------------------------------------------------------- // FillType 14.1.3.4;14.2.3.14 (Part 4) //-------------------------------------------------------------------------------- + enum EFillType { filltypeBackground = 0, @@ -442,95 +314,24 @@ namespace SimpleTypes filltypeSolid = 7, filltypeTile = 8 }; - // Тут разделяем два типа 14.13.4 - nType = 0 и 14.2.3.14 - nType != 0 - template - class CFillType : public CSimpleType - { - public: - CFillType() {} - virtual void SetValue (EFillType eValue) - { - if ( 0 == nType ) - { - if ( filltypeFrame == eValue || filltypeGradient == eValue || eValue == filltypeGradientRadial || - filltypePattern == eValue || filltypeSolid == eValue || filltypeTile == eValue ) - this->m_eValue = eValue; - else - this->m_eValue = eDefValue; - } - else - this->m_eValue = eValue; - } - virtual EFillType FromString(std::wstring &sValue) - { - if ( 0 == nType ) - { - if (_T("frame") == sValue) this->m_eValue = filltypeFrame; - else if (_T("gradient") == sValue) this->m_eValue = filltypeGradient; - else if (_T("gradientRadial") == sValue) this->m_eValue = filltypeGradientRadial; - else if (_T("pattern") == sValue) this->m_eValue = filltypePattern; - else if (_T("solid") == sValue) this->m_eValue = filltypeSolid; - else if (_T("tile") == sValue) this->m_eValue = filltypeTile; - else this->m_eValue = eDefValue; - } - else - { - if (_T("background") == sValue) this->m_eValue = filltypeBackground; - else if (_T("frame") == sValue) this->m_eValue = filltypeFrame; - else if (_T("gradient") == sValue) this->m_eValue = filltypeGradient; - else if (_T("gradientCenter") == sValue) this->m_eValue = filltypeGradientCenter; - else if (_T("gradientRadial") == sValue) this->m_eValue = filltypeGradientRadial; - else if (_T("gradientUnscaled") == sValue) this->m_eValue = filltypeGradientUnscaled; - else if (_T("pattern") == sValue) this->m_eValue = filltypePattern; - else if (_T("solid") == sValue) this->m_eValue = filltypeSolid; - else if (_T("tile") == sValue) this->m_eValue = filltypeTile; - else this->m_eValue = eDefValue; - } + // Тут разделяем два типа 14.13.4 - m_nType = 0 и 14.2.3.14 - m_nType != 0 - return this->m_eValue; - } + DEFINE_SIMPLE_TYPE_NSV(CFillType, EFillType, filltypeSolid) - virtual std::wstring ToString() const - { - if ( 0 == nType ) - { - switch (this->m_eValue) - { - case filltypeFrame : return _T("frame"); - case filltypeGradient : return _T("gradient"); - case filltypeGradientRadial : return _T("gradientRadial"); - case filltypePattern : return _T("pattern"); - case filltypeSolid : return _T("solid"); - case filltypeTile : return _T("tile"); - default : return _T("solid"); - } - } - else - { - switch (this->m_eValue) - { - case filltypeBackground : return _T("background"); - case filltypeFrame : return _T("frame"); - case filltypeGradient : return _T("gradient"); - case filltypeGradientCenter : return _T("gradientCenter"); - case filltypeGradientRadial : return _T("gradientRadial"); - case filltypeGradientUnscaled : return _T("gradientUnscaled"); - case filltypePattern : return _T("pattern"); - case filltypeSolid : return _T("solid"); - case filltypeTile : return _T("tile"); - default : return _T("solid"); - } - } - } + //-------------------------------------------------------------------------------- + // + //-------------------------------------------------------------------------------- - SimpleType_FromString (EFillType) - SimpleType_Operator_Equal (CFillType) + DEFINE_SIMPLE_TYPE_START(CFillType1, EFillType, filltypeSolid) + private: + bool m_nType; }; //-------------------------------------------------------------------------------- // ImageAspect 14.1.3.5 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EImageAspect { imageaspectAtLeast = 0, @@ -538,53 +339,12 @@ namespace SimpleTypes imageaspectIgnore = 2, }; - template - class CImageAspect : public CSimpleType - { - public: - CImageAspect() {} - virtual EImageAspect FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( _T("atLeast") == sValue ) this->m_eValue = imageaspectAtLeast; - else if ( _T("atMost") == sValue ) this->m_eValue = imageaspectAtMost; - break; - case 'i': - if ( _T("ignore") == sValue ) this->m_eValue = imageaspectIgnore; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case imageaspectAtLeast : return _T("atLeast"); - case imageaspectAtMost : return _T("atMost"); - case imageaspectIgnore : return _T("ignore"); - default : return _T("ignore"); - } - } - - SimpleType_FromString (EImageAspect) - SimpleType_Operator_Equal (CImageAspect) - - }; - + DEFINE_SIMPLE_TYPE(CImageAspect, EImageAspect, imageaspectIgnore) // ------------------------------------------------------------------------------- // ShadowType 14.1.3.6 (Part 4) // ------------------------------------------------------------------------------- + enum EShadowType { shadowtypeDouble, @@ -592,41 +352,13 @@ namespace SimpleTypes shadowtypePerspective, shadowtypeSingle, }; - template - class CShadowType : public CSimpleType - { - public: - CShadowType() {} - virtual EShadowType FromString(std::wstring &sValue) - { - if (_T("double") == sValue) this->m_eValue = shadowtypeDouble; - else if (_T("emboss") == sValue) this->m_eValue = shadowtypeEmboss; - else if (_T("perspective") == sValue) this->m_eValue = shadowtypePerspective; - else if (_T("single") == sValue) this->m_eValue = shadowtypeSingle; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CShadowType, EShadowType, shadowtypeSingle) - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case shadowtypeDouble : return _T("double"); - case shadowtypeEmboss : return _T("emboss"); - case shadowtypePerspective : return _T("perspective"); - case shadowtypeSingle : return _T("single"); - default : return _T("single"); - } - } - - SimpleType_FromString (EShadowType); - SimpleType_Operator_Equal (CShadowType); - }; //-------------------------------------------------------------------------------- // StrokeArrowLength 14.1.3.7 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EStrokeArrowLength { strokearrowlengthLong = 0, @@ -634,55 +366,12 @@ namespace SimpleTypes strokearrowlengthShort = 2, }; - template - class CStrokeArrowLength : public CSimpleType - { - public: - CStrokeArrowLength() {} - virtual EStrokeArrowLength FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'l': - if ( _T("long") == sValue ) this->m_eValue = strokearrowlengthLong; - break; - case 'm': - if ( _T("medium") == sValue ) this->m_eValue = strokearrowlengthMedium; - break; - case 's': - if ( _T("short") == sValue ) this->m_eValue = strokearrowlengthShort; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case strokearrowlengthLong : return _T("long"); - case strokearrowlengthMedium : return _T("medium"); - case strokearrowlengthShort : return _T("short"); - default : return _T("medium"); - } - } - - SimpleType_FromString (EStrokeArrowLength) - SimpleType_Operator_Equal (CStrokeArrowLength) - - }; - + DEFINE_SIMPLE_TYPE(CStrokeArrowLength, EStrokeArrowLength, strokearrowlengthMedium) //-------------------------------------------------------------------------------- // StrokeArrowType 14.1.3.8 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EStrokeArrowType { strokearrowtypeBlock = 0, @@ -693,65 +382,12 @@ namespace SimpleTypes strokearrowtypeOval = 5, }; - template - class CStrokeArrowType : public CSimpleType - { - public: - CStrokeArrowType() {} - virtual EStrokeArrowType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( _T("block") == sValue ) this->m_eValue = strokearrowtypeBlock; - break; - case 'c': - if ( _T("classic") == sValue ) this->m_eValue = strokearrowtypeClassic; - break; - case 'd': - if ( _T("diamond") == sValue ) this->m_eValue = strokearrowtypeDiamond; - break; - case 'n': - if ( _T("none") == sValue ) this->m_eValue = strokearrowtypeNone; - break; - case 'o': - if ( _T("open") == sValue ) this->m_eValue = strokearrowtypeOpen; - else if ( _T("oval") == sValue ) this->m_eValue = strokearrowtypeOval; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case strokearrowtypeBlock : return _T("block"); - case strokearrowtypeClassic : return _T("classic"); - case strokearrowtypeDiamond : return _T("diamond"); - case strokearrowtypeNone : return _T("none"); - case strokearrowtypeOpen : return _T("open"); - case strokearrowtypeOval : return _T("oval"); - default : return _T("none"); - } - } - - SimpleType_FromString (EStrokeArrowType) - SimpleType_Operator_Equal (CStrokeArrowType) - - }; - + DEFINE_SIMPLE_TYPE(CStrokeArrowType, EStrokeArrowType, strokearrowtypeNone) //-------------------------------------------------------------------------------- // StrokeArrowWidth 14.1.3.9 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EStrokeArrowWidth { strokearrowwidthMedium = 0, @@ -759,55 +395,12 @@ namespace SimpleTypes strokearrowwidthWide = 2, }; - template - class CStrokeArrowWidth : public CSimpleType - { - public: - CStrokeArrowWidth() {} - virtual EStrokeArrowWidth FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'm': - if ( _T("medium") == sValue ) this->m_eValue = strokearrowwidthMedium; - break; - case 'n': - if ( _T("narrow") == sValue ) this->m_eValue = strokearrowwidthNarrow; - break; - case 'w': - if ( _T("wide") == sValue ) this->m_eValue = strokearrowwidthWide; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case strokearrowwidthMedium : return _T("medium"); - case strokearrowwidthNarrow : return _T("narrow"); - case strokearrowwidthWide : return _T("wide"); - default : return _T("medium"); - } - } - - SimpleType_FromString (EStrokeArrowWidth) - SimpleType_Operator_Equal (CStrokeArrowWidth) - - }; - + DEFINE_SIMPLE_TYPE(CStrokeArrowWidth, EStrokeArrowWidth, strokearrowwidthMedium) //-------------------------------------------------------------------------------- // StrokeEndCap 14.1.3.10 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EStrokeEndCap { strokeendcapFlat = 0, @@ -815,94 +408,25 @@ namespace SimpleTypes strokeendcapSqaure = 2, }; - template - class CStrokeEndCap : public CSimpleType - { - public: - CStrokeEndCap() {} - virtual EStrokeEndCap FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'f': - if ( _T("flat") == sValue ) this->m_eValue = strokeendcapFlat; - break; - case 'r': - if ( _T("round") == sValue ) this->m_eValue = strokeendcapRound; - break; - case 's': - if ( _T("square") == sValue ) this->m_eValue = strokeendcapSqaure; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case strokeendcapFlat : return _T("flat"); - case strokeendcapRound : return _T("round"); - case strokeendcapSqaure : return _T("square"); - default : return _T("round"); - } - } - - SimpleType_FromString (EStrokeEndCap) - SimpleType_Operator_Equal (CStrokeEndCap) - - }; - + DEFINE_SIMPLE_TYPE(CStrokeEndCap, EStrokeEndCap, strokeendcapRound) //-------------------------------------------------------------------------------- // StrokeJoinStyle 14.1.3.11 (Part 4) //-------------------------------------------------------------------------------- + enum EStrokeJoinStyle { strokejoinstyleBevel, strokejoinstyleMiter, strokejoinstyleRound, }; - template - class CStrokeJoinStyle : public CSimpleType - { - public: - CStrokeJoinStyle() {} - virtual EStrokeJoinStyle FromString(std::wstring &sValue) - { - if (_T("round") == sValue) this->m_eValue = strokejoinstyleRound; - else if (_T("miter") == sValue) this->m_eValue = strokejoinstyleMiter; - else if (_T("bevel") == sValue) this->m_eValue = strokejoinstyleMiter; - else this->m_eValue = strokejoinstyleRound; + DEFINE_SIMPLE_TYPE(CStrokeJoinStyle, EStrokeJoinStyle, strokejoinstyleRound) - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case strokejoinstyleRound : return _T("round"); - case strokejoinstyleMiter : return _T("miter"); - case strokejoinstyleBevel : return _T("bevel"); - default : return _T("round"); - } - } - - SimpleType_FromString (EStrokeJoinStyle) - SimpleType_Operator_Equal (CStrokeJoinStyle) - }; //-------------------------------------------------------------------------------- // StrokeLineStyle 14.1.3.12 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EStrokeLineStyle { strokelinestyleSingle = 0, @@ -912,111 +436,26 @@ namespace SimpleTypes strokelinestyleThinThin = 4, }; - template - class CStrokeLineStyle : public CSimpleType - { - public: - CStrokeLineStyle() {} - virtual EStrokeLineStyle FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 's': - if ( _T("single") == sValue ) this->m_eValue = strokelinestyleSingle; - break; - case 't': - if ( _T("thickBetweenThin") == sValue ) this->m_eValue = strokelinestyleThickBetweenThin; - else if ( _T("thickThin") == sValue ) this->m_eValue = strokelinestyleThickThin; - else if ( _T("thinThick") == sValue ) this->m_eValue = strokelinestyleThinThick; - else if ( _T("thinThin") == sValue ) this->m_eValue = strokelinestyleThinThin; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case strokelinestyleSingle : return _T("single"); - case strokelinestyleThickBetweenThin : return _T("thickBetweenThin"); - case strokelinestyleThickThin : return _T("thickThin"); - case strokelinestyleThinThick : return _T("thinThick"); - case strokelinestyleThinThin : return _T("thinThin"); - default : return _T("single"); - } - } - - SimpleType_FromString (EStrokeLineStyle) - SimpleType_Operator_Equal (CStrokeLineStyle) - - }; - - + DEFINE_SIMPLE_TYPE(CStrokeLineStyle, EStrokeLineStyle, strokelinestyleSingle) } namespace SimpleTypes { //-------------------------------------------------------------------------------- // AlternateMathContentType 14.2.3.1 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EAlternateMathContentType { alternatemathcontenttypeOfficeOpenXmlMath = 0, alternatemathcontenttypeMathMl = 1, }; - template - class CAlternateMathContentType : public CSimpleType - { - public: - CAlternateMathContentType() {} - - virtual EAlternateMathContentType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'o': - if ( _T("officeopenxmlmath") == sValue ) this->m_eValue = alternatemathcontenttypeOfficeOpenXmlMath; - break; - case 'm': - if ( _T("mathml") == sValue ) this->m_eValue = alternatemathcontenttypeMathMl; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case alternatemathcontenttypeOfficeOpenXmlMath: return _T("officeopenxmlmath"); - case alternatemathcontenttypeMathMl: return _T("mathml"); - default : return _T("officeopenxmlmath"); - } - } - - SimpleType_FromString (EAlternateMathContentType) - SimpleType_Operator_Equal (CAlternateMathContentType) - }; - + DEFINE_SIMPLE_TYPE(CAlternateMathContentType, EAlternateMathContentType, alternatemathcontenttypeOfficeOpenXmlMath) //-------------------------------------------------------------------------------- // VmlAngle 14.2.3.2 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EVmlAngle { vmlangle30 = 0, @@ -1027,66 +466,12 @@ namespace SimpleTypes vmlangleAuto = 5 }; - template - class CVmlAngle : public CSimpleType - { - public: - CVmlAngle() {} - - virtual EVmlAngle FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case '3': - if ( _T("30") == sValue ) this->m_eValue = vmlangle30; - break; - case '4': - if ( _T("45") == sValue ) this->m_eValue = vmlangle45; - break; - case '6': - if ( _T("60") == sValue ) this->m_eValue = vmlangle60; - break; - case '9': - if ( _T("90") == sValue ) this->m_eValue = vmlangle90; - break; - case 'a': - if ( _T("any") == sValue ) this->m_eValue = vmlangleAny; - else if ( _T("auto") == sValue ) this->m_eValue = vmlangleAuto; - break; - - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case vmlangle30: return _T("30"); - case vmlangle45: return _T("45"); - case vmlangle60: return _T("60"); - case vmlangle90: return _T("90"); - case vmlangleAny: return _T("any"); - case vmlangleAuto: return _T("auto"); - default : return _T("auto"); - } - } - - SimpleType_FromString (EVmlAngle) - SimpleType_Operator_Equal (CVmlAngle) - }; - + DEFINE_SIMPLE_TYPE(CVmlAngle, EVmlAngle, vmlangleAuto) //-------------------------------------------------------------------------------- // BWMode 14.2.3.3 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EBWMode { bwmodeAuto = 0, @@ -1101,339 +486,97 @@ namespace SimpleTypes bwmodeLightGrayscale = 9, bwmodeUndrawn = 10, bwmodeWhite = 11, - }; - - template - class CBWMode : public CSimpleType - { - public: - CBWMode() {} - - virtual EBWMode FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( _T("auto") == sValue ) this->m_eValue = bwmodeAuto; - break; - case 'b': - if ( _T("black") == sValue ) this->m_eValue = bwmodeBlack; - else if ( _T("blackTextAndLines") == sValue ) this->m_eValue = bwmodeBlackTextAndLines; - break; - case 'c': - if ( _T("color") == sValue ) this->m_eValue = bwmodeColor; - break; - case 'g': - if ( _T("grayOutline") == sValue ) this->m_eValue = bwmodeGrayOutline; - else if ( _T("grayScale") == sValue ) this->m_eValue = bwmodeGrayScale; - break; - case 'h': - if ( _T("hide") == sValue ) this->m_eValue = bwmodeHide; - else if ( _T("highContrast") == sValue ) this->m_eValue = bwmodeHighContrast; - break; - case 'i': - if ( _T("inverseGray") == sValue ) this->m_eValue = bwmodeInverseGray; - break; - case 'l': - if ( _T("lightGrayscale") == sValue ) this->m_eValue = bwmodeLightGrayscale; - break; - case 'u': - if ( _T("undrawn") == sValue ) this->m_eValue = bwmodeUndrawn; - break; - case 'w': - if ( _T("white") == sValue ) this->m_eValue = bwmodeWhite; - break; - - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case bwmodeAuto: return _T("auto"); - case bwmodeBlack: return _T("black"); - case bwmodeBlackTextAndLines: return _T("blackTextAndLines"); - case bwmodeColor: return _T("color"); - case bwmodeGrayOutline: return _T("grayOutline"); - case bwmodeGrayScale: return _T("grayScale"); - case bwmodeHide: return _T("hide"); - case bwmodeHighContrast: return _T("highContrast"); - case bwmodeInverseGray: return _T("inverseGray"); - case bwmodeLightGrayscale: return _T("lightGrayscale"); - case bwmodeUndrawn: return _T("undrawn"); - case bwmodeWhite: return _T("white"); - default : return _T("auto"); - } - } - - SimpleType_FromString (EBWMode) - SimpleType_Operator_Equal (CBWMode) - }; + }; + DEFINE_SIMPLE_TYPE(CBWMode, EBWMode, bwmodeAuto) //-------------------------------------------------------------------------------- // CalloutDrop 14.2.3.4 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CCalloutDrop { public: - CCalloutDrop() {} + CCalloutDrop(); - std::wstring GetValue() const - { - return m_sValue; - } - - void SetValue(std::wstring &sValue) - { - m_sValue = sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - std::wstring FromString(std::wstring &sValue) - { - m_sValue = sValue; + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; - return m_sValue; - } + SimpleTypes_DefaultS(CCalloutDrop) - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CCalloutDrop) - - private: - - std::wstring m_sValue; + private: + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // ColorMode 14.2.3.6 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EColorMode { colormodeAuto = 0, colormodeCustom = 1, - }; - - template - class CColorMode : public CSimpleType - { - public: - CColorMode() {} - - virtual EColorMode FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( _T("auto") == sValue ) this->m_eValue = colormodeAuto; - break; - case 'c': - if ( _T("custom") == sValue ) this->m_eValue = colormodeCustom; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case colormodeAuto: return _T("auto"); - case colormodeCustom: return _T("custom"); - default : return _T("auto"); - } - } - - SimpleType_FromString (EColorMode) - SimpleType_Operator_Equal (CColorMode) - }; + }; + DEFINE_SIMPLE_TYPE(CColorMode, EColorMode, colormodeAuto) //-------------------------------------------------------------------------------- // ConnectorType 14.2.3.7 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EConnectorType { connectortypeCurved = 0, connectortypeElbow = 1, connectortypeNone = 2, connectortypeStraight = 3, - }; - - template - class CConnectorType : public CSimpleType - { - public: - CConnectorType() {} - - virtual EConnectorType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( _T("curved") == sValue ) this->m_eValue = connectortypeCurved; - break; - case 'e': - if ( _T("elbow") == sValue ) this->m_eValue = connectortypeElbow; - break; - case 'n': - if ( _T("none") == sValue ) this->m_eValue = connectortypeNone; - break; - case 's': - if ( _T("straight") == sValue ) this->m_eValue = connectortypeStraight; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case connectortypeCurved : return _T("curved"); - case connectortypeElbow : return _T("elbow"); - case connectortypeNone : return _T("none"); - case connectortypeStraight: return _T("straight"); - default : return _T("none"); - } - } - - SimpleType_FromString (EConnectorType) - SimpleType_Operator_Equal (CConnectorType) - }; + }; + DEFINE_SIMPLE_TYPE(CConnectorType, EConnectorType, connectortypeNone) //-------------------------------------------------------------------------------- // ConnectType 14.2.3.8 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EConnectType { connecttypeCustom = 0, connecttypeNone = 1, connecttypeRect = 2, connecttypeSegments = 3, - }; - - template - class CConnectType : public CSimpleType - { - public: - CConnectType() {} - - virtual EConnectType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( _T("custom") == sValue ) this->m_eValue = connecttypeCustom; - break; - case 'n': - if ( _T("none") == sValue ) this->m_eValue = connecttypeNone; - break; - case 'r': - if ( _T("rect") == sValue ) this->m_eValue = connecttypeRect; - break; - case 's': - if ( _T("segments") == sValue ) this->m_eValue = connecttypeSegments; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case connecttypeCustom : return _T("custom"); - case connecttypeNone : return _T("none"); - case connecttypeRect : return _T("rect"); - case connecttypeSegments: return _T("segments"); - default : return _T("none"); - } - } - - SimpleType_FromString (EConnectType) - SimpleType_Operator_Equal (CConnectType) - }; + }; + DEFINE_SIMPLE_TYPE(CConnectType, EConnectType, connecttypeNone) //-------------------------------------------------------------------------------- // ContentType 14.2.3.9 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CContentType { public: - CContentType() {} + CContentType(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - void SetValue(std::wstring &sValue) - { - m_sValue = sValue; - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + SimpleTypes_DefaultS(CContentType) - std::wstring FromString(std::wstring &sValue) - { - m_sValue = sValue; - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CContentType) - - private: - - std::wstring m_sValue; + private: + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // DiagramLayout 14.2.3.10 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EDiagramLayout { diagramlayout0 = 0, @@ -1442,59 +585,12 @@ namespace SimpleTypes diagramlayout3 = 3, }; - template - class CDiagramLayout : public CSimpleType - { - public: - CDiagramLayout() {} - - virtual EDiagramLayout FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case '0': - if ( _T("0") == sValue ) this->m_eValue = diagramlayout0; - break; - case '1': - if ( _T("1") == sValue ) this->m_eValue = diagramlayout1; - break; - case '2': - if ( _T("2") == sValue ) this->m_eValue = diagramlayout2; - break; - case '3': - if ( _T("3") == sValue ) this->m_eValue = diagramlayout3; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case diagramlayout0 : return _T("0"); - case diagramlayout1 : return _T("1"); - case diagramlayout2 : return _T("2"); - case diagramlayout3 : return _T("3"); - default : return _T("0"); - } - } - - SimpleType_FromString (EDiagramLayout) - SimpleType_Operator_Equal (CDiagramLayout) - }; - + DEFINE_SIMPLE_TYPE(CDiagramLayout, EDiagramLayout, diagramlayout0) //-------------------------------------------------------------------------------- // ExtrusionPlane 14.2.3.11 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EExtrusionPlane { extrusionplaneXY = 0, @@ -1502,64 +598,12 @@ namespace SimpleTypes extrusionplaneZX = 2, }; - template - class CExtrusionPlane : public CSimpleType - { - public: - CExtrusionPlane() {} - - virtual EExtrusionPlane FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'X': - if ( _T("XY") == sValue ) this->m_eValue = extrusionplaneXY; - break; - case 'Y': - if ( _T("YZ") == sValue ) this->m_eValue = extrusionplaneYZ; - break; - case 'Z': - if ( _T("ZX") == sValue ) this->m_eValue = extrusionplaneZX; - break; - case 'x': - if ( _T("xy") == sValue ) this->m_eValue = extrusionplaneXY; - break; - case 'y': - if ( _T("yz") == sValue ) this->m_eValue = extrusionplaneYZ; - break; - case 'z': - if ( _T("zx") == sValue ) this->m_eValue = extrusionplaneZX; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case extrusionplaneXY: return _T("XY"); - case extrusionplaneYZ: return _T("YZ"); - case extrusionplaneZX: return _T("ZX"); - default : return _T("XY"); - } - } - - SimpleType_FromString (EExtrusionPlane) - SimpleType_Operator_Equal (CExtrusionPlane) - }; - + DEFINE_SIMPLE_TYPE(CExtrusionPlane, EExtrusionPlane, extrusionplaneXY) //-------------------------------------------------------------------------------- // ExtrusionRender 14.2.3.12 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EExtrusionRender { extrusionrenderBoundingCube = 0, @@ -1567,91 +611,24 @@ namespace SimpleTypes extrusionrenderWireFrame = 2, }; - template - class CExtrusionRender : public CSimpleType - { - public: - CExtrusionRender() {} - - virtual EExtrusionRender FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( _T("boundingCube") == sValue ) this->m_eValue = extrusionrenderBoundingCube; - break; - case 's': - if ( _T("solid") == sValue ) this->m_eValue = extrusionrenderSolid; - break; - case 'w': - if ( _T("wireFrame") == sValue ) this->m_eValue = extrusionrenderWireFrame; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case extrusionrenderBoundingCube: return _T("boundingCube"); - case extrusionrenderSolid: return _T("solid"); - case extrusionrenderWireFrame: return _T("wireFrame"); - default : return _T("solid"); - } - } - - SimpleType_FromString (EExtrusionRender) - SimpleType_Operator_Equal (CExtrusionRender) - }; - + DEFINE_SIMPLE_TYPE(CExtrusionRender, EExtrusionRender, extrusionrenderSolid) //-------------------------------------------------------------------------------- // ExtructionType 14.2.3.13 (Part 4) //-------------------------------------------------------------------------------- + enum EExtrusionType { extrusiontypeParallel, extrusiontypePerspective }; - template - class CExtrusionType : public CSimpleType - { - public: - CExtrusionType() {} - virtual EExtrusionType FromString(std::wstring& sValue) - { - if (_T("parallel") == sValue ) this->m_eValue = extrusiontypeParallel; - else if (_T("perspective") == sValue ) this->m_eValue = extrusiontypePerspective; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CExtrusionType, EExtrusionType, extrusiontypeParallel) - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case extrusiontypeParallel : return _T("parallel"); - case extrusiontypePerspective : return _T("perspective"); - default : return _T("parallel"); - } - } - - SimpleType_FromString (EExtrusionType) - SimpleType_Operator_Equal (CExtrusionType) - }; //-------------------------------------------------------------------------------- // How 14.2.3.15 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EHow { howBottom = 0, @@ -1662,67 +639,12 @@ namespace SimpleTypes howTop = 5, }; - template - class CHow : public CSimpleType - { - public: - CHow() {} - - virtual EHow FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( _T("bottom") == sValue ) this->m_eValue = howBottom; - break; - case 'c': - if ( _T("center") == sValue ) this->m_eValue = howCenter; - break; - case 'l': - if ( _T("left") == sValue ) this->m_eValue = howLeft; - break; - case 'm': - if ( _T("middle") == sValue ) this->m_eValue = howMiddle; - break; - case 'r': - if ( _T("right") == sValue ) this->m_eValue = howRight; - break; - case 't': - if ( _T("top") == sValue ) this->m_eValue = howTop; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case howBottom: return _T("bottom"); - case howCenter: return _T("center"); - case howLeft : return _T("left"); - case howMiddle: return _T("middle"); - case howRight : return _T("right"); - case howTop : return _T("top"); - default : return _T("top"); - } - } - - SimpleType_FromString (EHow) - SimpleType_Operator_Equal (CHow) - }; - + DEFINE_SIMPLE_TYPE(CHow, EHow, howTop) //-------------------------------------------------------------------------------- // HrAlign 14.2.3.16 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EHrAlign { hralignCenter = 0, @@ -1730,143 +652,36 @@ namespace SimpleTypes hralignRight = 2, }; - template - class CHrAlign : public CSimpleType - { - public: - CHrAlign() {} - - virtual EHrAlign FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( _T("center") == sValue ) this->m_eValue = hralignCenter; - break; - case 'l': - if ( _T("left") == sValue ) this->m_eValue = hralignLeft; - break; - case 'r': - if ( _T("right") == sValue ) this->m_eValue = hralignRight; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case hralignCenter: return _T("center"); - case hralignLeft : return _T("left"); - case hralignRight : return _T("right"); - default : return _T("left"); - } - } - - SimpleType_FromString (EHrAlign) - SimpleType_Operator_Equal (CHrAlign) - }; - + DEFINE_SIMPLE_TYPE(CHrAlign, EHrAlign, hralignLeft) //-------------------------------------------------------------------------------- // InsetMode 14.2.3.17 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EInsetMode { insetmodeAuto = 0, insetmodeCustom = 1, }; - template - class CInsetMode : public CSimpleType - { - public: - CInsetMode() {} - - virtual EInsetMode FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( _T("auto") == sValue ) this->m_eValue = insetmodeAuto; - break; - case 'c': - if ( _T("custom") == sValue ) this->m_eValue = insetmodeCustom; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case insetmodeAuto : return _T("auto"); - case insetmodeCustom : return _T("custom"); - default : return _T("auto"); - } - } - - SimpleType_FromString (EInsetMode) - SimpleType_Operator_Equal (CInsetMode) - }; - + DEFINE_SIMPLE_TYPE(CInsetMode, EInsetMode, insetmodeAuto) //-------------------------------------------------------------------------------- // OLEDrawAspect 14.2.3.18 (Part 4) //-------------------------------------------------------------------------------- + enum EOLEDrawAspect { oledrawaspectContent = 0, oledrawaspectIcon = 1, }; - template - class COLEDrawAspect : public CSimpleType - { - public: - COLEDrawAspect() {} - virtual EOLEDrawAspect FromString(std::wstring &sValue) - { - if (_T("Content") == sValue) this->m_eValue = oledrawaspectContent; - else if (_T("Icon") == sValue) this->m_eValue = oledrawaspectIcon; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case oledrawaspectContent : return _T("Content"); - case oledrawaspectIcon : return _T("Icon"); - default : return _T("Content"); - } - } - - SimpleType_FromString (EOLEDrawAspect); - SimpleType_Operator_Equal (COLEDrawAspect); - }; + DEFINE_SIMPLE_TYPE(COLEDrawAspect, EOLEDrawAspect, oledrawaspectIcon) //-------------------------------------------------------------------------------- // OLELinkType 14.2.3.19 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EOLELinkType { olelinktypeBitmap = 0, @@ -1876,133 +691,36 @@ namespace SimpleTypes olelinktypePng = 4, }; - template - class COLELinkType : public CSimpleType - { - public: - COLELinkType() {} - - virtual EOLELinkType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'B': - if ( _T("Bitmap") == sValue ) this->m_eValue = olelinktypeBitmap; - break; - case 'E': - if ( _T("EnhancedMetaFile") == sValue ) this->m_eValue = olelinktypeEmf; - break; - case 'J': - if ( _T("Jpeg") == sValue ) this->m_eValue = olelinktypeJpeg; - break; - case 'P': - if ( _T("Picture") == sValue ) this->m_eValue = olelinktypePicture; - else if ( _T("Png") == sValue ) this->m_eValue = olelinktypePng; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case olelinktypeBitmap: return _T("Bitmap"); - case olelinktypeEmf: return _T("EnhancedMetaFile"); - case olelinktypeJpeg: return _T("Jpeg"); - case olelinktypePicture: return _T("Picture"); - case olelinktypePng: return _T("Png"); - default : return _T("Bitmap"); - } - } - - SimpleType_FromString (EOLELinkType) - SimpleType_Operator_Equal (COLELinkType) - }; - + DEFINE_SIMPLE_TYPE(COLELinkType, EOLELinkType, olelinktypeBitmap) //-------------------------------------------------------------------------------- // OleType 14.2.3.20 (Part 4) //-------------------------------------------------------------------------------- + enum EOLEType { oletypeEmbed = 0, oletypeLink = 1, }; - template - class COLEType : public CSimpleType - { - public: - COLEType() {} - virtual EOLEType FromString(std::wstring &sValue) - { - if (_T("embed") == sValue) this->m_eValue = oletypeEmbed; - else if (_T("link") == sValue) this->m_eValue = oletypeLink; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(COLEType, EOLEType, oletypeEmbed) - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case oletypeEmbed : return _T("embed"); - case oletypeLink : return _T("link"); - default : return _T("embed"); - } - } - - SimpleType_FromString (EOLEType); - SimpleType_Operator_Equal (COLEType); - }; //-------------------------------------------------------------------------------- // OLEUpdateMode 14.2.3.21 (Part 4) //-------------------------------------------------------------------------------- + enum EOLEUpdateMode { oleupdatemodeAlways = 0, oleupdatemodeOnCall = 1, }; - template - class COLEUpdateMode : public CSimpleType - { - public: - COLEUpdateMode() {} - virtual EOLEUpdateMode FromString(std::wstring &sValue) - { - if (_T("Always") == sValue) this->m_eValue = oleupdatemodeAlways; - else if (_T("OnCall") == sValue) this->m_eValue = oleupdatemodeOnCall; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(COLEUpdateMode, EOLEUpdateMode, oleupdatemodeAlways) - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case oleupdatemodeAlways : return _T("Always"); - case oleupdatemodeOnCall : return _T("OnCall"); - default : return _T("Always"); - } - } - - SimpleType_FromString (EOLEUpdateMode); - SimpleType_Operator_Equal (COLEUpdateMode); - }; //-------------------------------------------------------------------------------- // RType 14.2.3.22 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum ERType { rtypeAlign = 0, @@ -2011,55 +729,12 @@ namespace SimpleTypes rtypeConnector = 3, }; - template - class CRType : public CSimpleType - { - public: - CRType() {} - - virtual ERType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'a': - if ( _T("align") == sValue ) this->m_eValue = rtypeAlign; - else if ( _T("arc") == sValue ) this->m_eValue = rtypeArc; - break; - case 'c': - if ( _T("callout") == sValue ) this->m_eValue = rtypeCallout; - else if ( _T("connector") == sValue ) this->m_eValue = rtypeConnector; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case rtypeAlign : return _T("align"); - case rtypeArc : return _T("arc"); - case rtypeCallout : return _T("callout"); - case rtypeConnector: return _T("connector"); - default : return _T("align"); - } - } - - SimpleType_FromString (ERType) - SimpleType_Operator_Equal (CRType) - }; - + DEFINE_SIMPLE_TYPE(CRType, ERType, rtypeAlign) //-------------------------------------------------------------------------------- // ScreenSize 14.2.3.23 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EScreenSize { screensize1024x768 = 0, @@ -2070,60 +745,7 @@ namespace SimpleTypes screensize800x600 = 5, }; - template - class CScreenSize : public CSimpleType - { - public: - CScreenSize() {} - virtual EScreenSize FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case '1': - if ( _T("1024,768") == sValue ) this->m_eValue = screensize1024x768; - else if ( _T("1152,862") == sValue ) this->m_eValue = screensize1152x862; - break; - case '5': - if ( _T("544,376") == sValue ) this->m_eValue = screensize544x376; - break; - case '6': - if ( _T("640,480") == sValue ) this->m_eValue = screensize640x480; - break; - case '7': - if ( _T("720,512") == sValue ) this->m_eValue = screensize720x512; - break; - case '8': - if ( _T("800,600") == sValue ) this->m_eValue = screensize800x600; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case screensize1024x768: return _T("1024,768"); - case screensize1152x862: return _T("1152,862"); - case screensize544x376 : return _T("544,376"); - case screensize640x480 : return _T("640,480"); - case screensize720x512 : return _T("720,512"); - case screensize800x600 : return _T("800,600"); - default : return _T("640,480"); - } - } - - SimpleType_FromString (EScreenSize) - SimpleType_Operator_Equal (CScreenSize) - }; - + DEFINE_SIMPLE_TYPE(CScreenSize, EScreenSize, screensize640x480) } // SimpleTypes @@ -2132,199 +754,57 @@ namespace SimpleTypes { //-------------------------------------------------------------------------------- // BorderShadow 14.3.3.1 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EBorderShadow { bordershadowFalse = 0, bordershadowTrue = 1, }; - template - class CBorderShadow : public CSimpleType - { - public: - CBorderShadow() {} - - virtual EBorderShadow FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'f': - if ( _T("f") == sValue || _T("false") == sValue ) this->m_eValue = bordershadowFalse; - break; - case 't': - if ( _T("t") == sValue || _T("true") == sValue ) this->m_eValue = bordershadowTrue; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case bordershadowTrue: return _T("t"); - case bordershadowFalse: return _T("f"); - default : return _T("f"); - } - } - - SimpleType_FromString (EBorderShadow) - SimpleType_Operator_Equal (CBorderShadow) - }; - + DEFINE_SIMPLE_TYPE(CBorderShadow, EBorderShadow, bordershadowFalse) //-------------------------------------------------------------------------------- // BorderType 14.3.3.2 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EBorderType { - bordertypeDash = 0, // (pecifies a line border consisting of a dashed line around the parent object.) - bordertypeDashDotDot, // (Dash Dot Dot Border) - bordertypeDashDotStroked, // (Stroked Dash Dot Border) - bordertypeDashedSmall, // (Small Dash Border) - bordertypeDot, // (Dotted Border) - bordertypeDotDash, // (Dot Dash Border) - bordertypeDouble, // (Double Line Border) - bordertypeDoubleWave, // (Double Wavy Lines Border) - bordertypeHairline, // (Hairline Border) - bordertypeHTMLInset, // (Inset Border) - bordertypeHTMLOutset, // (Outset Border) - bordertypeNone, // (No Border) - bordertypeSingle, // (Single Line Border) - bordertypeThick, // (Thick Line Border) - bordertypeThickBetweenThin, // (Thin-thick-thin Border) + bordertypeDash = 0, // (pecifies a line border consisting of a dashed line around the parent object.) + bordertypeDashDotDot, // (Dash Dot Dot Border) + bordertypeDashDotStroked, // (Stroked Dash Dot Border) + bordertypeDashedSmall, // (Small Dash Border) + bordertypeDot, // (Dotted Border) + bordertypeDotDash, // (Dot Dash Border) + bordertypeDouble, // (Double Line Border) + bordertypeDoubleWave, // (Double Wavy Lines Border) + bordertypeHairline, // (Hairline Border) + bordertypeHTMLInset, // (Inset Border) + bordertypeHTMLOutset, // (Outset Border) + bordertypeNone, // (No Border) + bordertypeSingle, // (Single Line Border) + bordertypeThick, // (Thick Line Border) + bordertypeThickBetweenThin, // (Thin-thick-thin Border) bordertypeThickBetweenThinLarge, // (Large thin-thick-thin Border) - bordertypeThickBetweenThinSmall, // (Small thin-thick-thin Lines Border) - bordertypeThickThin, // (Thick Thin Line Border) - bordertypeThickThinLarge, // (Thick Thin Large Gap Border) - bordertypeThickThinSmall, // (Small thick-thin lines border) - bordertypeThinThick, // (Thin Thick Line Border) - bordertypeThinThickLarge, // (Thin Thick Large Gap Border) - bordertypeThinThickSmall, // (Thin Thick Small Gap Border) - bordertypeThreeDEmboss, // (3D Embossed Border) - bordertypeThreeDEngrave, // (3D Engraved Border) - bordertypeTriple, // (Triple Line Border) - bordertypeWave, // (Wavy Border) - }; - - template - class CBorderType : public CSimpleType - { - public: - CBorderType() {} - - virtual EBorderType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'd': - if ( _T("dash") == sValue ) this->m_eValue = bordertypeDash; - else if ( _T("dashDotDot") == sValue ) this->m_eValue = bordertypeDashDotDot; - else if ( _T("dashDotStroked") == sValue ) this->m_eValue = bordertypeDashDotStroked; - else if ( _T("dashedSmall") == sValue ) this->m_eValue = bordertypeDashedSmall; - else if ( _T("dot") == sValue ) this->m_eValue = bordertypeDot; - else if ( _T("dotDash") == sValue ) this->m_eValue = bordertypeDotDash; - else if ( _T("double") == sValue ) this->m_eValue = bordertypeDouble; - else if ( _T("doubleWave") == sValue ) this->m_eValue = bordertypeDoubleWave; - break; - case 'h': - if ( _T("hairline") == sValue ) this->m_eValue = bordertypeHairline; - break; - - case 'H': - if ( _T("HTMLInset") == sValue ) this->m_eValue = bordertypeHTMLInset; - else if ( _T("HTMLOutset") == sValue ) this->m_eValue = bordertypeHTMLOutset; - break; - - case 'n': - if ( _T("none") == sValue ) this->m_eValue = bordertypeNone; - break; - - case 's': - if ( _T("single") == sValue ) this->m_eValue = bordertypeSingle; - break; - - case 't': - if ( _T("thick") == sValue ) this->m_eValue = bordertypeThick; - else if ( _T("thickBetweenThin") == sValue ) this->m_eValue = bordertypeThickBetweenThin; - else if ( _T("thickBetweenThinLarge") == sValue ) this->m_eValue = bordertypeThickBetweenThinLarge; - else if ( _T("thickBetweenThinSmall") == sValue ) this->m_eValue = bordertypeThickBetweenThinSmall; - else if ( _T("thickThin") == sValue ) this->m_eValue = bordertypeThickThin; - else if ( _T("thickThinLarge") == sValue ) this->m_eValue = bordertypeThickThinLarge; - else if ( _T("thickThinSmall") == sValue ) this->m_eValue = bordertypeThickThinSmall; - else if ( _T("thinThick") == sValue ) this->m_eValue = bordertypeThinThick; - else if ( _T("thinThickLarge") == sValue ) this->m_eValue = bordertypeThinThickLarge; - else if ( _T("thinThickSmall") == sValue ) this->m_eValue = bordertypeThinThickSmall; - else if ( _T("threeDEmboss") == sValue ) this->m_eValue = bordertypeThreeDEmboss; - else if ( _T("threeDEngrave") == sValue ) this->m_eValue = bordertypeThreeDEngrave; - else if ( _T("triple") == sValue ) this->m_eValue = bordertypeTriple; - break; - - case 'w': - if ( _T("wave") == sValue ) this->m_eValue = bordertypeWave; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case bordertypeDash: return _T("dash"); - case bordertypeDashDotDot: return _T("dashDotDot"); - case bordertypeDashDotStroked: return _T("dashDotStroked"); - case bordertypeDashedSmall: return _T("dashedSmall"); - case bordertypeDot: return _T("dot"); - case bordertypeDotDash: return _T("dotDash"); - case bordertypeDouble: return _T("double"); - case bordertypeDoubleWave: return _T("doubleWave"); - case bordertypeHairline: return _T("hairline"); - case bordertypeHTMLInset: return _T("HTMLInset"); - case bordertypeHTMLOutset: return _T("HTMLOutset"); - case bordertypeNone: return _T("none"); - case bordertypeSingle: return _T("single"); - case bordertypeThick: return _T("thick"); - case bordertypeThickBetweenThin: return _T("thickBetweenThin"); - case bordertypeThickBetweenThinLarge: return _T("thickBetweenThinLarge"); - case bordertypeThickBetweenThinSmall: return _T("thickBetweenThinSmall"); - case bordertypeThickThin: return _T("thickThin"); - case bordertypeThickThinLarge: return _T("thickThinLarge"); - case bordertypeThickThinSmall: return _T("thickThinSmall"); - case bordertypeThinThick: return _T("thinThick"); - case bordertypeThinThickLarge: return _T("thinThickLarge"); - case bordertypeThinThickSmall: return _T("thinThickSmall"); - case bordertypeThreeDEmboss: return _T("threeDEmboss"); - case bordertypeThreeDEngrave: return _T("threeDEngrave"); - case bordertypeTriple: return _T("triple"); - case bordertypeWave: return _T("wave"); - default : return _T("none"); - } - } - - SimpleType_FromString (EBorderType) - SimpleType_Operator_Equal (CBorderType) + bordertypeThickBetweenThinSmall, // (Small thin-thick-thin Lines Border) + bordertypeThickThin, // (Thick Thin Line Border) + bordertypeThickThinLarge, // (Thick Thin Large Gap Border) + bordertypeThickThinSmall, // (Small thick-thin lines border) + bordertypeThinThick, // (Thin Thick Line Border) + bordertypeThinThickLarge, // (Thin Thick Large Gap Border) + bordertypeThinThickSmall, // (Thin Thick Small Gap Border) + bordertypeThreeDEmboss, // (3D Embossed Border) + bordertypeThreeDEngrave, // (3D Engraved Border) + bordertypeTriple, // (Triple Line Border) + bordertypeWave, // (Wavy Border) }; + DEFINE_SIMPLE_TYPE(CBorderType, EBorderType, bordertypeNone) //-------------------------------------------------------------------------------- // HorizontalAnchor 14.3.3.3 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EHorizontalAnchor { horizontalanchorChar = 0, @@ -2333,61 +813,12 @@ namespace SimpleTypes horizontalanchorText = 3, }; - template - class CHorizontalAnchor : public CSimpleType - { - public: - CHorizontalAnchor() {} - - virtual EHorizontalAnchor FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'c': - if ( _T("char") == sValue ) this->m_eValue = horizontalanchorChar; - break; - case 'm': - if ( _T("margin") == sValue ) this->m_eValue = horizontalanchorMargin; - break; - - case 'p': - if ( _T("page") == sValue ) this->m_eValue = horizontalanchorPage; - break; - - case 't': - if ( _T("text") == sValue ) this->m_eValue = horizontalanchorText; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case horizontalanchorChar: return _T("char"); - case horizontalanchorMargin: return _T("margin"); - case horizontalanchorPage: return _T("page"); - case horizontalanchorText: return _T("text"); - default : return _T("char"); - } - } - - SimpleType_FromString (EHorizontalAnchor) - SimpleType_Operator_Equal (CHorizontalAnchor) - }; - + DEFINE_SIMPLE_TYPE(CHorizontalAnchor, EHorizontalAnchor, horizontalanchorChar) //-------------------------------------------------------------------------------- // VerticalAnchor 14.3.3.4 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EVerticalAnchor { verticalanchorLine = 0, @@ -2396,61 +827,12 @@ namespace SimpleTypes verticalanchorText = 3, }; - template - class CVerticalAnchor : public CSimpleType - { - public: - CVerticalAnchor() {} - - virtual EVerticalAnchor FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'l': - if ( _T("line") == sValue ) this->m_eValue = verticalanchorLine; - break; - case 'm': - if ( _T("margin") == sValue ) this->m_eValue = verticalanchorMargin; - break; - - case 'p': - if ( _T("page") == sValue ) this->m_eValue = verticalanchorPage; - break; - - case 't': - if ( _T("text") == sValue ) this->m_eValue = verticalanchorText; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case verticalanchorLine: return _T("line"); - case verticalanchorMargin: return _T("margin"); - case verticalanchorPage: return _T("page"); - case verticalanchorText: return _T("text"); - default : return _T("line"); - } - } - - SimpleType_FromString (EVerticalAnchor) - SimpleType_Operator_Equal (CVerticalAnchor) - }; - + DEFINE_SIMPLE_TYPE(CVerticalAnchor, EVerticalAnchor, verticalanchorLine) //-------------------------------------------------------------------------------- // WrapSide 14.3.3.5 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EWrapSide { wrapsideBoth = 0, @@ -2459,59 +841,12 @@ namespace SimpleTypes wrapsideRight = 3, }; - template - class CWrapSide : public CSimpleType - { - public: - CWrapSide() {} - - virtual EWrapSide FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'b': - if ( _T("both") == sValue ) this->m_eValue = wrapsideBoth; - break; - case 'l': - if ( _T("largest") == sValue ) this->m_eValue = wrapsideLargest; - else if ( _T("left") == sValue ) this->m_eValue = wrapsideLeft; - break; - - case 'r': - if ( _T("right") == sValue ) this->m_eValue = wrapsideRight; - break; - - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case wrapsideBoth: return _T("both"); - case wrapsideLargest: return _T("largest"); - case wrapsideLeft: return _T("left"); - case wrapsideRight: return _T("right"); - default : return _T("both"); - } - } - - SimpleType_FromString (EWrapSide) - SimpleType_Operator_Equal (CWrapSide) - }; - + DEFINE_SIMPLE_TYPE(CWrapSide, EWrapSide, wrapsideBoth) //-------------------------------------------------------------------------------- // WrapType 14.3.3.6 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EWrapType { wraptypeNone = 0, @@ -2521,65 +856,20 @@ namespace SimpleTypes wraptypeTopAndBottom = 4, }; - template - class CWrapType : public CSimpleType - { - public: - CWrapType() {} - - virtual EWrapType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'n': - if ( _T("none") == sValue ) this->m_eValue = wraptypeNone; - break; - case 's': - if ( _T("square") == sValue ) this->m_eValue = wraptypeSquare; - break; - - case 't': - if ( _T("through") == sValue ) this->m_eValue = wraptypeThrough; - else if ( _T("tight") == sValue ) this->m_eValue = wraptypeTight; - else if ( _T("topAndBottom") == sValue ) this->m_eValue = wraptypeTopAndBottom; - break; - - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case wraptypeNone: return _T("none"); - case wraptypeSquare: return _T("square"); - case wraptypeThrough: return _T("through"); - case wraptypeTight: return _T("tight"); - case wraptypeTopAndBottom: return _T("topAndBottom"); - default : return _T("none"); - } - } - - SimpleType_FromString (EWrapType) - SimpleType_Operator_Equal (CWrapType) - }; - + DEFINE_SIMPLE_TYPE(CWrapType, EWrapType, wraptypeNone) } // SimpleTypes -// Дополнительные простые типы, не входящие в спецификацю +// Дополнительные простые типы, не входящие в спецификацию namespace SimpleTypes { namespace Vml { + + //-------------------------------------------------------------------------------- + // VmlClientDataObjectType + //-------------------------------------------------------------------------------- + enum EVmlClientDataObjectType { vmlclientdataobjecttypeButton = 0, @@ -2602,74 +892,13 @@ namespace SimpleTypes vmlclientdataobjecttypeShape = 17, vmlclientdataobjecttypeSpin = 18 }; - template - class CVmlClientDataObjectType : public CSimpleType - { - public: - CVmlClientDataObjectType() {} - virtual EVmlClientDataObjectType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CVmlClientDataObjectType, EVmlClientDataObjectType, vmlclientdataobjecttypeButton) - if ( sValue.empty() ) - return this->m_eValue; - - if ( _T("Button") == sValue ) this->m_eValue = vmlclientdataobjecttypeButton; - else if ( _T("Checkbox") == sValue ) this->m_eValue = vmlclientdataobjecttypeCheckbox; - else if ( _T("Dialog") == sValue ) this->m_eValue = vmlclientdataobjecttypeDialog; - else if ( _T("Drop") == sValue ) this->m_eValue = vmlclientdataobjecttypeDrop; - else if ( _T("Edit") == sValue ) this->m_eValue = vmlclientdataobjecttypeEdit; - else if ( _T("GBox") == sValue ) this->m_eValue = vmlclientdataobjecttypeGBox; - else if ( _T("Group") == sValue ) this->m_eValue = vmlclientdataobjecttypeGroup; - else if ( _T("Label") == sValue ) this->m_eValue = vmlclientdataobjecttypeLabel; - else if ( _T("LineA") == sValue ) this->m_eValue = vmlclientdataobjecttypeLineA; - else if ( _T("List") == sValue ) this->m_eValue = vmlclientdataobjecttypeList; - else if ( _T("Movie") == sValue ) this->m_eValue = vmlclientdataobjecttypeMovie; - else if ( _T("Note") == sValue ) this->m_eValue = vmlclientdataobjecttypeNote; - else if ( _T("Pict") == sValue ) this->m_eValue = vmlclientdataobjecttypePict; - else if ( _T("Radio") == sValue ) this->m_eValue = vmlclientdataobjecttypeRadio; - else if ( _T("Rect") == sValue ) this->m_eValue = vmlclientdataobjecttypeRect; - else if ( _T("RectA") == sValue ) this->m_eValue = vmlclientdataobjecttypeRectA; - else if ( _T("Scroll") == sValue ) this->m_eValue = vmlclientdataobjecttypeScroll; - else if ( _T("Shape") == sValue ) this->m_eValue = vmlclientdataobjecttypeShape; - else if ( _T("Spin") == sValue ) this->m_eValue = vmlclientdataobjecttypeSpin; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case vmlclientdataobjecttypeButton: return _T("Button"); - case vmlclientdataobjecttypeCheckbox: return _T("Checkbox"); - case vmlclientdataobjecttypeDialog: return _T("Dialog"); - case vmlclientdataobjecttypeDrop: return _T("Drop"); - case vmlclientdataobjecttypeEdit: return _T("Edit"); - case vmlclientdataobjecttypeGBox: return _T("GBox"); - case vmlclientdataobjecttypeGroup: return _T("Group"); - case vmlclientdataobjecttypeLabel: return _T("Label"); - case vmlclientdataobjecttypeLineA: return _T("LineA"); - case vmlclientdataobjecttypeList: return _T("List"); - case vmlclientdataobjecttypeMovie: return _T("Movie"); - case vmlclientdataobjecttypeNote: return _T("Note"); - case vmlclientdataobjecttypePict: return _T("Pict"); - case vmlclientdataobjecttypeRadio: return _T("Radio"); - case vmlclientdataobjecttypeRect: return _T("Rect"); - case vmlclientdataobjecttypeRectA: return _T("RectA"); - case vmlclientdataobjecttypeScroll: return _T("Scroll"); - case vmlclientdataobjecttypeShape: return _T("Shape"); - case vmlclientdataobjecttypeSpin: return _T("Spin"); - default : return _T("Button"); - } - } - - SimpleType_FromString (EVmlClientDataObjectType) - SimpleType_Operator_Equal (CVmlClientDataObjectType) - }; //-------------------------------------------------------------------------------- // VmlCalloutType 14.2.2.2 (type) (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EVmlCalloutType { vmlcallouttypeRectangle = 0, @@ -2678,96 +907,33 @@ namespace SimpleTypes vmlcallouttypeCloud = 3, }; - template - class CVmlCalloutType : public CSimpleType - { - public: - CVmlCalloutType() {} - - virtual EVmlCalloutType FromString(std::wstring &sValue) - { - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 'r': - if ( _T("rectangle") == sValue ) this->m_eValue = vmlcallouttypeRectangle; - else if ( _T("roundedrectangle") == sValue ) this->m_eValue = vmlcallouttypeRoundRectangle; - break; - case 'o': - if ( _T("oval") == sValue ) this->m_eValue = vmlcallouttypeOval; - break; - case 'c': - if ( _T("cloud") == sValue ) this->m_eValue = vmlcallouttypeCloud; - break; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case vmlcallouttypeRectangle: return _T("rectangle"); - case vmlcallouttypeRoundRectangle: return _T("roundedrectangle"); - case vmlcallouttypeOval: return _T("oval"); - case vmlcallouttypeCloud: return _T("cloud"); - default : return _T("rectangle"); - } - } - - SimpleType_FromString (EVmlCalloutType) - SimpleType_Operator_Equal (CVmlCalloutType) - }; + DEFINE_SIMPLE_TYPE(CVmlCalloutType, EVmlCalloutType, vmlcallouttypeRectangle) //-------------------------------------------------------------------------------- // VmlPath 14.2.2.3 (v) (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + class CVmlPath { public: - CVmlPath() {} + CVmlPath(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - void SetValue(std::wstring &sValue) - { - m_sValue = sValue; - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + SimpleTypes_DefaultS(CVmlPath) - std::wstring FromString(std::wstring &sValue) - { - // TO DO: Сделать парсер пата Part4. 14.2.2.3 - m_sValue = sValue; - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CVmlPath) - - private: - - std::wstring m_sValue; + private: + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // VmlDashStyle 14.2.2.1 (dashstyle) (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EVmlDashStyle { vmldashstyleSolid = 0, @@ -2784,2758 +950,852 @@ namespace SimpleTypes vmldashstyleCustom = 11, }; - template - class CVmlDashStyle : public CSimpleType - { - public: - CVmlDashStyle() - { - m_nCount = 0; - } - virtual ~CVmlDashStyle() - { - } - - virtual EVmlDashStyle FromString(std::wstring &sValue) - { - m_nCount = 0; - - this->m_eValue = eDefValue; - - if ( sValue.empty() ) - return this->m_eValue; - - sValue = XmlUtils::GetLower(sValue); - - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case 's': - if ( _T("solid") == sValue ) this->m_eValue = vmldashstyleSolid; - else if ( _T("shortdash") == sValue ) this->m_eValue = vmldashstyleShortDash; - else if ( _T("shortdot") == sValue ) this->m_eValue = vmldashstyleShortDot; - else if ( _T("shortdashdot") == sValue ) this->m_eValue = vmldashstyleShortDashDot; - else if ( _T("shortdashdotdot") == sValue ) this->m_eValue = vmldashstyleShortDashDotDot; - break; - case 'd': - if ( _T("dot") == sValue ) this->m_eValue = vmldashstyleDot; - else if ( _T("dash") == sValue ) this->m_eValue = vmldashstyleDash; - else if ( _T("dashdot") == sValue ) this->m_eValue = vmldashstyleDashDot; - break; - case 'l': - if ( _T("longdash") == sValue ) this->m_eValue = vmldashstyleLongDash; - else if ( _T("longdashdot") == sValue ) this->m_eValue = vmldashstyleLongDashDot; - else if ( _T("longdashdotdot") == sValue ) this->m_eValue = vmldashstyleLongDashDotDot; - break; - - default: - { - this->m_eValue = vmldashstyleCustom; - - std::wstring sTemp = sValue; - for ( size_t nIndex = 0; nIndex < sValue.length(); nIndex++ ) - { - int nChar = sValue[nIndex ]; - if ( ' ' == nChar ) - continue; - - int nEndPos = (int)sValue.find( _T(" "), nIndex ); - if ( -1 == nEndPos ) - nEndPos = (int)sValue.length(); - - int nLen = (int)(nEndPos - nIndex); - - if ( nLen <= 0 ) - continue; - - std::wstring sTemp = sValue.substr( nIndex, nLen ); - double dVal = XmlUtils::GetDouble( sTemp); - - if ( m_nCount >= 32 ) - break; - - m_arrValues[m_nCount++] = dVal; - } - } - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case vmldashstyleSolid : return _T("solid"); - case vmldashstyleShortDash : return _T("shortdash"); - case vmldashstyleShortDot : return _T("shortdot"); - case vmldashstyleShortDashDot : return _T("shortdashdot"); - case vmldashstyleShortDashDotDot: return _T("shortdashdotdot"); - case vmldashstyleDot : return _T("dot"); - case vmldashstyleDash : return _T("dash"); - case vmldashstyleLongDash : return _T("longdash"); - case vmldashstyleDashDot : return _T("dashdot"); - case vmldashstyleLongDashDot : return _T("longdashdot"); - case vmldashstyleLongDashDotDot : return _T("longdashdotdot"); - case vmldashstyleCustom : - { - std::wstring sResult; - - for (int nIndex = 0; nIndex < m_nCount; nIndex++) - { - sResult += XmlUtils::DoubleToString( m_arrValues[nIndex] ); - sResult += _T(" "); - } - return sResult; - } - default: return _T("solid"); - } - } - - SimpleType_FromString (EVmlDashStyle) - SimpleType_Operator_Equal (CVmlDashStyle) - + DEFINE_SIMPLE_TYPE_START(CVmlDashStyle, EVmlDashStyle, vmldashstyleSolid) private: double m_arrValues[32]; - int m_nCount; - + int m_nCount = 0; }; + //-------------------------------------------------------------------------------- + // Vml_1_65536 14.2.2.11 (brightness) + //-------------------------------------------------------------------------------- - //-------------------------------------------------------------------------------- - // Vml_1_65536 14.2.2.11 (brightness) - //-------------------------------------------------------------------------------- class CVml_1_65536 { public: - CVml_1_65536() - { - m_dValue = 0; - } + CVml_1_65536(); - double GetValue() const - { - return m_dValue; - } + double GetValue() const; - void SetValue(double dValue) - { - m_dValue = (std::max)( 0.0, (std::min)( 1.0, dValue) ); - } + void SetValue(double dValue); - void SetValue(int nValue) - { - m_dValue = (std::max)( 0.0, (std::min)( 65536.0, (double) nValue) ) / 65536.0; - } + void SetValue(int nValue); - virtual double FromString(std::wstring &sValue) - { - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + virtual double FromString(const std::wstring &sValue); - bool bFraction = ( 'f' == sValue[ nLen - 1 ] ); + virtual std::wstring ToString () const; - if ( bFraction ) - { - std::wstring strValue = sValue.substr( 0, nLen - 1 ); - int nValue = strValue.empty() ? 0 : _wtoi(strValue.c_str() ); + SimpleTypes_DefaultD(CVml_1_65536) - SetValue( nValue ); - } - else - { - double dValue = XmlUtils::GetDouble( sValue); - SetValue( dValue ); - } - - return m_dValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = boost::lexical_cast( m_dValue ); - - return sResult; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_1_65536) - - private: - - double m_dValue; + private: + double m_dValue; }; + //-------------------------------------------------------------------------------- - // Vml_Vector3D_65536 14.2.2.11 (lightposition) + // Vml_Vector3D_65536 14.2.2.11 (lightposition) //-------------------------------------------------------------------------------- + class CVml_Vector3D_65536 { public: - CVml_Vector3D_65536() - { - m_nX = 0; - m_nY = 0; - m_nZ = 0; - } + CVml_Vector3D_65536(); - double GetX() const - { - return (double)(m_nX / 65536.0); - } - double GetY() const - { - return (double)(m_nY / 65536.0); - } - double GetZ() const - { - return (double)(m_nZ / 65536.0); - } + double GetX() const; + double GetY() const; + double GetZ() const; - void SetValue(int nX, int nY, int nZ) - { - m_nX = nX; - m_nY = nY; - m_nZ = nZ; - } + void SetValue(int nX, int nY, int nZ); + void SetValue(double dX, double dY, double dZ); - void SetValue(double dX, double dY, double dZ) - { - m_nX = (int)(dX * 65536); - m_nY = (int)(dY * 65536); - m_nZ = (int)(dZ * 65536); - } + virtual double FromString(const std::wstring &sValue); - virtual double FromString(std::wstring &sValue) - { - m_nX = 0; - m_nY = 0; - m_nZ = 0; + virtual std::wstring ToString () const; - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + SimpleTypes_DefaultString(CVml_Vector3D_65536) - int nPos = (int)sValue.find( _T(",") ); - if ( -1 == nPos ) - return 0; + private: - std::wstring strX = sValue.substr( 0, nPos ); - XmlUtils::replace_all(strX, L"@", L""); - - m_nX = strX.empty() ? 0 : _wtoi(strX.c_str() ); - - int nPos2 = (int)sValue.find( _T(","), nPos + 1 ); - if ( -1 == nPos2 ) - return 0; - - std::wstring strY = sValue.substr( nPos + 1, nPos2 - nPos - 1) ; - std::wstring strZ = sValue.substr( nPos2 + 1, nLen - nPos2 - 1 ); - - XmlUtils::replace_all(strY, L"@", L""); - XmlUtils::replace_all(strZ, L"@", L""); - - m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() ); - m_nZ = strZ.empty() ? 0 : _wtoi(strZ.c_str() ); - - return 0; - } - - virtual std::wstring ToString () const - { - return std::to_wstring(m_nX) + L"," + std::to_wstring(m_nX) + std::to_wstring(m_nY) + L"," + std::to_wstring(m_nZ); - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector3D_65536) - - private: - - int m_nX; + int m_nX; int m_nY; int m_nZ; }; + //-------------------------------------------------------------------------------- // Vml_Vector3D 14.2.2.11 (orientation) //-------------------------------------------------------------------------------- + class CVml_Vector3D { public: - CVml_Vector3D() - { - m_nX = 0; - m_nY = 0; - m_nZ = 0; - } + CVml_Vector3D(); - int GetX() const - { - return m_nX; - } - int GetY() const - { - return m_nY; - } - int GetZ() const - { - return m_nZ; - } + int GetX() const; + int GetY() const; + int GetZ() const; - void SetValue(int nX, int nY, int nZ) - { - m_nX = nX; - m_nY = nY; - m_nZ = nZ; - } + void SetValue(int nX, int nY, int nZ); - virtual double FromString(std::wstring &sValue) - { - m_nX = 0; - m_nY = 0; - m_nZ = 0; + virtual double FromString(const std::wstring &sValue); - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + virtual std::wstring ToString () const; - int nPos = (int)sValue.find( _T(",") ); - if ( -1 == nPos ) - {//only x position - std::wstring strX = sValue; - XmlUtils::replace_all(strX, L"@", L""); + SimpleTypes_DefaultString(CVml_Vector3D) - m_nX = strX.empty() ? 0 : _wtoi(strX.c_str() ); - return 0; - } - std::wstring strX = sValue.substr( 0, nPos ); - XmlUtils::replace_all(strX, L"@", L""); - - m_nX = strX.empty() ? 0 : _wtoi(strX.c_str() ); - - int nPos2 = (int)sValue.find( _T(","), nPos + 1 ); - if ( -1 == nPos2 ) - {// only x, y position - std::wstring strY = sValue.substr( nPos + 1); - XmlUtils::replace_all(strY, L"@", L""); - m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() ); - return 0; - } - - std::wstring strY = sValue.substr( nPos + 1, nPos2 - nPos - 1); - std::wstring strZ = sValue.substr( nPos2 + 1, nLen - nPos2 - 1 ) ; - - XmlUtils::replace_all(strY, L"@", L""); - XmlUtils::replace_all(strZ, L"@", L""); - - m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() ); - m_nZ = strZ.empty() ? 0 : _wtoi(strZ.c_str() ); - - return 0; - } - - virtual std::wstring ToString () const - { - return std::to_wstring(m_nX) + L"," + std::to_wstring(m_nY) + L"," + std::to_wstring(m_nZ); - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector3D) - - private: - - int m_nX; + private: + int m_nX; int m_nY; int m_nZ; }; + //-------------------------------------------------------------------------------- // Vml_Vector2D 14.2.2.11 (rotationangle) //-------------------------------------------------------------------------------- + class CVml_Vector2D { public: - CVml_Vector2D() - { - m_nX = 0; - m_nY = 0; - } + CVml_Vector2D(); - int GetX() const - { - return m_nX; - } - int GetY() const - { - return m_nY; - } + int GetX() const; + int GetY() const; - void SetValue(int nX, int nY) - { - m_nX = nX; - m_nY = nY; - } + void SetValue(int nX, int nY); - virtual double FromString(std::wstring &sValue) - { - m_nX = 0; - m_nY = 0; + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + SimpleTypes_DefaultString(CVml_Vector2D) - int nPos = (int)sValue.find( _T(",") ); - - std::wstring strX, strY; - if ( -1 == nPos ) - {//only x coord - strX = sValue; - } - else - { - strX = sValue.substr( 0, nPos ); - strY = sValue.substr( nPos + 1, nLen - nPos - 1 ) ; - } - XmlUtils::replace_all(strY, L"@", L""); - XmlUtils::replace_all(strX, L"@", L""); - - m_nX = strX.empty() ? 0 : _wtoi(strX.c_str() ); - m_nY = strY.empty() ? 0 : _wtoi(strY.c_str() ); - - return 0; - } - - virtual std::wstring ToString () const - { - return std::to_wstring(m_nX) + L"," + std::to_wstring(m_nY); - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector2D) - - private: - - int m_nX; + private: + int m_nX; int m_nY; }; + //-------------------------------------------------------------------------------- - // Vml_Vector2D_F 14.2.2.11 (viewpointorigin) + // Vml_Vector2D_F 14.2.2.11 (viewpointorigin) //-------------------------------------------------------------------------------- + class CVml_Vector2D_F { public: - CVml_Vector2D_F() - { - m_dX = 0; - m_dY = 0; - } + CVml_Vector2D_F(); - double GetX() const - { - return m_dX; - } - double GetY() const - { - return m_dY; - } + double GetX() const; + double GetY() const; - void SetValue(double dX, double dY) - { - m_dX = dX; - m_dY = dY; - } + void SetValue(double dX, double dY); - virtual double FromString(std::wstring &sValue) - { - m_dX = 0; - m_dY = 0; + virtual double FromString(const std::wstring &sValue); - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + virtual std::wstring ToString () const; - size_t nPos = sValue.find( _T(",") ); + SimpleTypes_DefaultString(CVml_Vector2D_F) - std::wstring strX, strY; - if (std::wstring::npos == nPos) - { - strX = sValue;// .substr(0, nPos); - } - else - { - strX = sValue.substr( 0, nPos ); - strY = sValue.substr( nPos + 1, nLen - nPos - 1 ) ; - } - - m_dX = XmlUtils::GetDouble(strX); - m_dY = XmlUtils::GetDouble(strY); - - return 0; - } - - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dX) + L"," + boost::lexical_cast(m_dY); - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector2D_F) - - private: - - double m_dX; + private: + double m_dX; double m_dY; }; + //-------------------------------------------------------------------------------- - // Vml_Polygon2D 14.1.2.1 (wrapcoords) + // Vml_Polygon2D 14.1.2.1 (wrapcoords) //-------------------------------------------------------------------------------- + class CVml_Polygon2D { public: - CVml_Polygon2D() + CVml_Polygon2D(); + int GetSize() const; + + int GetX(int nIndex) const; + int GetY(int nIndex) const; + + void AddPoint(int nX, int nY); + + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; + + SimpleTypes_DefaultString(CVml_Polygon2D) + + private: + + struct TPoint { - } - int GetSize() const + int nX; + int nY; + + TPoint( int n_X, int n_Y ) { - return (int)m_arrPoints.size(); + nX = n_X; + nY = n_Y; } + }; - int GetX(int nIndex) const - { - if ( nIndex < 0 || nIndex >= (int)m_arrPoints.size() ) - return 0; + std::vector m_arrPoints; + }; - return m_arrPoints[nIndex].nX; - } - int GetY(int nIndex) const - { - if ( nIndex < 0 || nIndex >= (int)m_arrPoints.size() ) - return 0; + //------------------------------------------------------------------------------------------ + // CCssProperty + //------------------------------------------------------------------------------------------ - return m_arrPoints[nIndex].nY; - } +#define CSS_MAX_NAME_LEN 127 - void AddPoint(int nX, int nY) - { - TPoint oPt( nX, nY ); - m_arrPoints.push_back( oPt ); - } + std::wstring RemoveWhiteSpaces(const std::wstring &sText); - virtual double FromString(std::wstring &sValue) - { - m_arrPoints.clear(); + enum ECssPropertyType + { + cssptUnknown = 0000, - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + cssptFlip = 1000, + cssptHeight = 1001, + cssptLeft = 1002, + cssptMarginBottom = 1003, + cssptMarginLeft = 1004, + cssptMarginRight = 1005, + cssptMarginTop = 1006, + cssptMsoPositionHorizontal = 1007, + cssptMsoPositionHorizontalRelative = 1008, + cssptMsoPositionVertical = 1009, + cssptMsoPositionVerticalRelative = 1010, + cssptMsoWrapDistanceBottom = 1011, + cssptMsoWrapDistanceLeft = 1012, + cssptMsoWrapDistanceRight = 1013, + cssptMsoWrapDistanceTop = 1014, + cssptMsoWrapEdited = 1015, + cssptMsoWrapStyle = 1016, + cssptPosition = 1017, + cssptRotation = 1018, + cssptTop = 1019, + cssptVisibility = 1020, + cssptWidth = 1021, + cssptZIndex = 1022, + csspctMsoWidthPercent = 1023, + csspctMsoHeightPercent = 1024, + csspctMsoTopPercent = 1025, + csspctMsoLeftPercent = 1026, - int nStartPos = 0; - while ( true ) - { - int nMidPos = (int)sValue.find( _T(","), nStartPos ); - int nEndPos = (int)sValue.find( _T(","), nMidPos + 1 ); + // Для элемента Textbox 14.1.2.22 + cssptDirection = 1100, + cssptLayoutFlow = 1101, + cssptMsoDirectionAlt = 1102, + cssptMsoFitShapeToText = 1103, + cssptMsoFitTextToShape = 1104, + cssptMsoLayoutFlowAlt = 1105, + cssptMsoNextTextbox = 1106, + cssptMsoRotate = 1107, + cssptMsoTextScale = 1108, + cssptVTextAnchor = 1109, - if ( -1 == nMidPos ) - break; + // Для элемента Textpath 14.1.2.23 + cssptFont = 1200, + cssptFontFamily = 1201, + cssptFontSize = 1202, + cssptFontStyle = 1203, + cssptFontVariant = 1204, + cssptFontWeight = 1205, + cssptMsoTextShadow = 1206, + cssptTextDecoration = 1207, + cssptVRotateLetters = 1208, + cssptVSameLetterHeights = 1209, + cssptVTextAlign = 1210, + cssptVTextKern = 1211, + cssptVTextReverse = 1212, + cssptVTextSpacingMode = 1213, + cssptVTextSpacing = 1214, + cssptHTextAlign = 1215, + }; - if ( -1 == nEndPos ) - nEndPos = nLen; + enum ECssFlip + { + cssflipX = 0, + cssflipY = 1, + cssflipXY = 2, + cssflipYX = 3, + }; + enum ECssUnitsType + { + cssunitstypeAuto = 0, + cssunitstypeUnits = 1, + cssunitstypePerc = 2, + cssunitstypeAbsolute = 3 + }; + struct TCssUnitsValue + { + ECssUnitsType eType; + double dValue; // значение в пунктах + }; + enum ECssMsoPosHor + { + cssmsoposhorAbsolute = 0, + cssmsoposhorLeft = 1, + cssmsoposhorCenter = 2, + cssmsoposhorRight = 3, + cssmsoposhorInside = 4, + cssmsoposhorOutside = 5, + }; + enum ECssMsoPosHorRel + { + cssmsoposhorrelMargin = 0, + cssmsoposhorrelPage = 1, + cssmsoposhorrelText = 2, + cssmsoposhorrelChar = 3, + cssmsoposhorrelLeftMargin = 4, + cssmsoposhorrelRightMargin = 5 + }; + enum ECssMsoPosVer + { + cssmsoposverAbsolute = 0, + cssmsoposverTop = 1, + cssmsoposverCenter = 2, + cssmsoposverBottom = 3, + cssmsoposverInside = 4, + cssmsoposverOutside = 5, + }; + enum ECssMsoPosVerRel + { + cssmsoposverrelMargin = 0, + cssmsoposverrelPage = 1, + cssmsoposverrelText = 2, + cssmsoposverrelLine = 3, + cssmsoposverrelTopMargin = 4, + cssmsoposverrelBottomMargin = 5 + }; + enum ECssMsoWrapStyle + { + cssmsowrapstyleSqaure = 0, + cssmsowrapstyleNone = 1, + }; + enum ECssPosition + { + csspositionStatic = 0, + csspositionAbsolute = 1, + csspositionRelative = 2, + }; + enum ECssVisibility + { + cssvisibilityHidden = 0, + cssvisibilityInherit = 1, + }; + enum ECssZIndexType + { + csszindextypeAuto = 0, + csszindextypeOrder = 1, + }; + struct TCssZIndexValue + { + ECssZIndexType eType; + int nOrder; + }; + enum ECssDirection + { + cssdirectionLTR = 0, + cssdirectionRTL = 1, + }; + enum ECssLayoutFlow + { + csslayoutflowHorizontal = 0, + csslayoutflowVertical = 1, + csslayoutflowVerticalIdeographic = 2, + csslayoutflowHorizontalIdeographic = 3, + }; + enum ECssDirectionAlt + { + cssdirectionaltContext = 0, + }; + enum ECssLayoutFlowAlt + { + csslayoutflowaltBottomToTop = 0, + }; - std::wstring strX = sValue.substr( nStartPos, nMidPos - nStartPos ); - std::wstring strY = sValue.substr( nStartPos, nMidPos - nStartPos ); - - XmlUtils::replace_all(strX, L"@", L""); - XmlUtils::replace_all(strY, L"@", L""); - - int nX = strX.empty() ? 0 : _wtoi(strX.c_str() ); - int nY = strY.empty() ? 0 : _wtoi(strY.c_str() ); - - m_arrPoints.push_back( TPoint( nX, nY ) ); - - nStartPos = nEndPos + 1; - } + enum ECssMsoRotate + { + cssmsorotate0 = 0, + cssmsorotate90 = 90, + cssmsorotate180 = 180, + cssmsorotate270 = -90, + }; + enum ECssVTextAnchor + { + cssvtextanchorTop = 0, + cssvtextanchorMiddle = 1, + cssvtextanchorBottom = 2, + cssvtextanchorTopCenter = 3, + cssvtextanchorMiddleCenter = 4, + cssvtextanchorBottomCenter = 5, + cssvtextanchorTopBaseline = 6, + cssvtextanchorBottomBaseline = 7, + cssvtextanchorTopCenterBaseline = 8, + cssvtextanchorBottomCenterBaseline = 9, + }; + enum ECssFontStyle + { + cssfontstyleNormal = 0, + cssfontstyleItalic = 1, + cssfontstyleOblique = 2, + }; + enum ECssFontVarian + { + cssfontvariantNormal = 0, + cssfontvariantSmallCaps = 1, + }; + enum ECssFontWeight + { + cssfontweightNormal = 0, + cssfontweightLighter = 1, + cssfontweight100 = 100, + cssfontweight200 = 200, + cssfontweight300 = 300, + cssfontweight400 = 400, + cssfontweightBold = 550, + cssfontweightBolder = 750, + cssfontweight500 = 500, + cssfontweight600 = 600, + cssfontweight700 = 700, + cssfontweight800 = 800, + cssfontweight900 = 900 + }; + enum ECssTextDecoration + { + csstextdecorationNone = 0, + csstextdecorationUnderline = 1, + csstextdecorationOverline = 2, + csstextdecorationLineThrough = 3, + csstextdecorationBlink = 4, + }; + enum ECssVTextAlign + { + cssvtextalignLeft = 0, + cssvtextalignRight = 1, + cssvtextalignCenter = 2, + cssvtextalignJustify = 3, + cssvtextalignLetterJustify = 4, + cssvtextalignStretchJustify = 5, + }; + enum ECssVTextSpacingMode + { + cssvtextspacingmodeTightening = 0, + cssvtextspacingmodeTracking = 1 + }; - return 0; - } + union UCssValue + { + ECssFlip eFlip; + TCssUnitsValue oValue; + ECssMsoPosHor eMsoPosHor; + ECssMsoPosHorRel eMsoPosHorRel; + ECssMsoPosVer eMsoPosVer; + ECssMsoPosVerRel eMsoPosVerRel; + bool bValue; + ECssMsoWrapStyle eMsoWrapStyle; + ECssPosition ePosition; + ECssVisibility eVisibility; + TCssZIndexValue oZIndex; + ECssDirection eDirection; + ECssLayoutFlow eLayoutFlow; + ECssDirectionAlt eDirectionAlt; + ECssLayoutFlowAlt eLayoutFlowAlt; + wchar_t wsValue[CSS_MAX_NAME_LEN + 1]; + ECssMsoRotate eRotate; + ECssVTextAnchor eVTextAnchor; + ECssFontStyle eFontStyle; + ECssFontVarian eFontVariant; + ECssFontWeight eFontWeight; + ECssTextDecoration eTextDecoration; + ECssVTextAlign eVTextAlign; + ECssVTextSpacingMode eVTextSpacingMode; + ECssVTextAlign eHTextAlign; + }; - virtual std::wstring ToString () const - { - std::wstring sResult; + class CCssProperty + { + public: - for ( size_t nIndex = 0; nIndex < m_arrPoints.size(); nIndex++ ) - { - std::wstring sTemp = std::to_wstring(m_arrPoints[nIndex].nX) + L"," + std::to_wstring(m_arrPoints[nIndex].nY); - if ( nIndex < m_arrPoints.size() - 1 ) sTemp += L","; - sResult += sTemp; - } + CCssProperty(); - return sResult; - } + CCssProperty(std::wstring sBuffer); + ~CCssProperty(); - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Polygon2D) + + const UCssValue &get_Value() const; + + const ECssPropertyType &get_Type() const; + + private: + + void Parse(const std::wstring &sBuffer); + + private: + + void ReadValue_Unknown(std::wstring& sValue); + void ReadValue_Flip(std::wstring& sValue); + void ReadValue_Units(std::wstring& sValue); + + void ReadValue_MsoPosHor(std::wstring& sValue); + void ReadValue_MsoPosHorRel(std::wstring& sValue); + void ReadValue_MsoPosVer(std::wstring& sValue); + void ReadValue_MsoPosVerRel(std::wstring& sValue); + + void ReadValue_Rotation(std::wstring& sValue); + void ReadValue_Boolean(std::wstring& sValue); + void ReadValue_MsoWrapStyle(std::wstring& sValue); + void ReadValue_Position(std::wstring& sValue); + void ReadValue_Visibility(std::wstring& sValue); + void ReadValue_ZIndex(std::wstring& sValue); + void ReadValue_Direction(std::wstring& sValue); + void ReadValue_LayoutFlow(std::wstring& sValue); + void ReadValue_DirectionAlt(std::wstring& sValue); + void ReadValue_LayoutFlowAlt(std::wstring& sValue); + void ReadValue_String(std::wstring& sValue); + + void ReadValue_MsoRotate(std::wstring& sValue); + void ReadValue_VTextAnchor(std::wstring& sValue); + void ReadValue_FontStyle(std::wstring& sValue); + void ReadValue_FontVariant(std::wstring& sValue); + void ReadValue_FontWeight(std::wstring& sValue); + void ReadValue_TextDecoration(std::wstring& sValue); + void ReadValue_VTextAlign(std::wstring& sValue); + void ReadValue_VTextSpacingMode(std::wstring& sValue); + + private: + ECssPropertyType m_eType; + UCssValue m_oValue; + + }; + + //-------------------------------------------------------------------------------- + // CCssStyle 14.1.2.1 (style) (Part 1) + //-------------------------------------------------------------------------------- + + typedef boost::shared_ptr CCssPropertyPtr; + + class CCssStyle + { + public: + CCssStyle(); + ~CCssStyle(); + void Clear(); + + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + + void mergeFrom(CCssStyle* parent); + + SimpleTypes_DefaultString(CCssStyle) private: - struct TPoint - { - int nX; - int nY; + bool ParseProperties(); - TPoint( int n_X, int n_Y ) - { - nX = n_X; - nY = n_Y; - } - }; + public: + std::map m_mapProperties; + std::vector m_arrProperties; + std::wstring m_sCss; + }; - std::vector m_arrPoints; - }; - //------------------------------------------------------------------------------------------ - // CCssProperty - //------------------------------------------------------------------------------------------ + //-------------------------------------------------------------------------------- + // Vml_Vector2D_Units 14.1.2.3 (from, control1, control2, to) + //-------------------------------------------------------------------------------- - #define CSS_MAX_NAME_LEN 127 - - static std::wstring RemoveWhiteSpaces(const std::wstring &sText) - { - std::wstring result; - for (size_t i = 0 ; i < sText.length(); i++) - { - WCHAR wChar = sText[i]; - if (XmlUtils::IsUnicodeSymbol(wChar) == true && wChar > 0x20) - { - result += wChar; - } - } - return result; - } + class CVml_Vector2D_Units + { + public: + CVml_Vector2D_Units(); - enum ECssPropertyType - { - cssptUnknown = 0000, + double GetX() const; + double GetY() const; - cssptFlip = 1000, - cssptHeight = 1001, - cssptLeft = 1002, - cssptMarginBottom = 1003, - cssptMarginLeft = 1004, - cssptMarginRight = 1005, - cssptMarginTop = 1006, - cssptMsoPositionHorizontal = 1007, - cssptMsoPositionHorizontalRelative = 1008, - cssptMsoPositionVertical = 1009, - cssptMsoPositionVerticalRelative = 1010, - cssptMsoWrapDistanceBottom = 1011, - cssptMsoWrapDistanceLeft = 1012, - cssptMsoWrapDistanceRight = 1013, - cssptMsoWrapDistanceTop = 1014, - cssptMsoWrapEdited = 1015, - cssptMsoWrapStyle = 1016, - cssptPosition = 1017, - cssptRotation = 1018, - cssptTop = 1019, - cssptVisibility = 1020, - cssptWidth = 1021, - cssptZIndex = 1022, - csspctMsoWidthPercent = 1023, - csspctMsoHeightPercent = 1024, - csspctMsoTopPercent = 1025, - csspctMsoLeftPercent = 1026, + void SetValue(double dX, double dY); -// Для элемента Textbox 14.1.2.22 - cssptDirection = 1100, - cssptLayoutFlow = 1101, - cssptMsoDirectionAlt = 1102, - cssptMsoFitShapeToText = 1103, - cssptMsoFitTextToShape = 1104, - cssptMsoLayoutFlowAlt = 1105, - cssptMsoNextTextbox = 1106, - cssptMsoRotate = 1107, - cssptMsoTextScale = 1108, - cssptVTextAnchor = 1109, - -// Для элемента Textpath 14.1.2.23 - cssptFont = 1200, - cssptFontFamily = 1201, - cssptFontSize = 1202, - cssptFontStyle = 1203, - cssptFontVariant = 1204, - cssptFontWeight = 1205, - cssptMsoTextShadow = 1206, - cssptTextDecoration = 1207, - cssptVRotateLetters = 1208, - cssptVSameLetterHeights = 1209, - cssptVTextAlign = 1210, - cssptVTextKern = 1211, - cssptVTextReverse = 1212, - cssptVTextSpacingMode = 1213, - cssptVTextSpacing = 1214, - cssptHTextAlign = 1215, - }; + virtual double FromString(const std::wstring &sValue); - enum ECssFlip - { - cssflipX = 0, - cssflipY = 1, - cssflipXY = 2, - cssflipYX = 3, - }; - enum ECssUnitsType - { - cssunitstypeAuto = 0, - cssunitstypeUnits = 1, - cssunitstypePerc = 2, - cssunitstypeAbsolute = 3 - }; - struct TCssUnitsValue - { - ECssUnitsType eType; - double dValue; // значение в пунктах - }; - enum ECssMsoPosHor - { - cssmsoposhorAbsolute = 0, - cssmsoposhorLeft = 1, - cssmsoposhorCenter = 2, - cssmsoposhorRight = 3, - cssmsoposhorInside = 4, - cssmsoposhorOutside = 5, - }; - enum ECssMsoPosHorRel - { - cssmsoposhorrelMargin = 0, - cssmsoposhorrelPage = 1, - cssmsoposhorrelText = 2, - cssmsoposhorrelChar = 3, - cssmsoposhorrelLeftMargin = 4, - cssmsoposhorrelRightMargin = 5 - }; - enum ECssMsoPosVer - { - cssmsoposverAbsolute = 0, - cssmsoposverTop = 1, - cssmsoposverCenter = 2, - cssmsoposverBottom = 3, - cssmsoposverInside = 4, - cssmsoposverOutside = 5, - }; - enum ECssMsoPosVerRel - { - cssmsoposverrelMargin = 0, - cssmsoposverrelPage = 1, - cssmsoposverrelText = 2, - cssmsoposverrelLine = 3, - cssmsoposverrelTopMargin = 4, - cssmsoposverrelBottomMargin = 5 - }; - enum ECssMsoWrapStyle - { - cssmsowrapstyleSqaure = 0, - cssmsowrapstyleNone = 1, - }; - enum ECssPosition - { - csspositionStatic = 0, - csspositionAbsolute = 1, - csspositionRelative = 2, - }; - enum ECssVisibility - { - cssvisibilityHidden = 0, - cssvisibilityInherit = 1, - }; - enum ECssZIndexType - { - csszindextypeAuto = 0, - csszindextypeOrder = 1, - }; - struct TCssZIndexValue - { - ECssZIndexType eType; - int nOrder; - }; - enum ECssDirection - { - cssdirectionLTR = 0, - cssdirectionRTL = 1, - }; - enum ECssLayoutFlow - { - csslayoutflowHorizontal = 0, - csslayoutflowVertical = 1, - csslayoutflowVerticalIdeographic = 2, - csslayoutflowHorizontalIdeographic = 3, - }; - enum ECssDirectionAlt - { - cssdirectionaltContext = 0, - }; - enum ECssLayoutFlowAlt - { - csslayoutflowaltBottomToTop = 0, - }; + virtual std::wstring ToString () const; - enum ECssMsoRotate - { - cssmsorotate0 = 0, - cssmsorotate90 = 90, - cssmsorotate180 = 180, - cssmsorotate270 = -90, - }; - enum ECssVTextAnchor - { - cssvtextanchorTop = 0, - cssvtextanchorMiddle = 1, - cssvtextanchorBottom = 2, - cssvtextanchorTopCenter = 3, - cssvtextanchorMiddleCenter = 4, - cssvtextanchorBottomCenter = 5, - cssvtextanchorTopBaseline = 6, - cssvtextanchorBottomBaseline = 7, - cssvtextanchorTopCenterBaseline = 8, - cssvtextanchorBottomCenterBaseline = 9, - }; - enum ECssFontStyle - { - cssfontstyleNormal = 0, - cssfontstyleItalic = 1, - cssfontstyleOblique = 2, - }; - enum ECssFontVarian - { - cssfontvariantNormal = 0, - cssfontvariantSmallCaps = 1, - }; - enum ECssFontWeight - { - cssfontweightNormal = 0, - cssfontweightLighter = 1, - cssfontweight100 = 100, - cssfontweight200 = 200, - cssfontweight300 = 300, - cssfontweight400 = 400, - cssfontweightBold = 550, - cssfontweightBolder = 750, - cssfontweight500 = 500, - cssfontweight600 = 600, - cssfontweight700 = 700, - cssfontweight800 = 800, - cssfontweight900 = 900 - }; - enum ECssTextDecoration - { - csstextdecorationNone = 0, - csstextdecorationUnderline = 1, - csstextdecorationOverline = 2, - csstextdecorationLineThrough = 3, - csstextdecorationBlink = 4, - }; - enum ECssVTextAlign - { - cssvtextalignLeft = 0, - cssvtextalignRight = 1, - cssvtextalignCenter = 2, - cssvtextalignJustify = 3, - cssvtextalignLetterJustify = 4, - cssvtextalignStretchJustify = 5, - }; - enum ECssVTextSpacingMode - { - cssvtextspacingmodeTightening = 0, - cssvtextspacingmodeTracking = 1 - }; - - - union UCssValue - { - ECssFlip eFlip; - TCssUnitsValue oValue; - ECssMsoPosHor eMsoPosHor; - ECssMsoPosHorRel eMsoPosHorRel; - ECssMsoPosVer eMsoPosVer; - ECssMsoPosVerRel eMsoPosVerRel; - bool bValue; - ECssMsoWrapStyle eMsoWrapStyle; - ECssPosition ePosition; - ECssVisibility eVisibility; - TCssZIndexValue oZIndex; - ECssDirection eDirection; - ECssLayoutFlow eLayoutFlow; - ECssDirectionAlt eDirectionAlt; - ECssLayoutFlowAlt eLayoutFlowAlt; - wchar_t wsValue[CSS_MAX_NAME_LEN + 1]; - ECssMsoRotate eRotate; - ECssVTextAnchor eVTextAnchor; - ECssFontStyle eFontStyle; - ECssFontVarian eFontVariant; - ECssFontWeight eFontWeight; - ECssTextDecoration eTextDecoration; - ECssVTextAlign eVTextAlign; - ECssVTextSpacingMode eVTextSpacingMode; - ECssVTextAlign eHTextAlign; - }; - class CCssProperty - { - public: - - CCssProperty() - { - m_eType = cssptUnknown; - } - - CCssProperty(std::wstring sBuffer) - { - Parse(sBuffer); - } - ~CCssProperty() - { - } - - - const UCssValue &get_Value() const - { - return m_oValue; - } - - const ECssPropertyType &get_Type() const - { - return m_eType; - } - - private: - - void Parse(std::wstring &sBuffer) - { - int nPos = (int)sBuffer.find( ':' ); - std::wstring sValue; - - if ( -1 == nPos ) - { - m_eType = cssptUnknown; - } - else - { - std::wstring sProperty = sBuffer.substr( 0, nPos ); - sValue = sBuffer.substr( nPos + 1, sBuffer.length() - (nPos + 1) ); - - sProperty = RemoveWhiteSpaces( sProperty ); - - if ( sProperty.length() <= 2 ) - { - m_eType = cssptUnknown; - return; - } - - // Чтобы избежать большого количества сравнения строк проверим для начала по первым двум символам - int nChar1 = sProperty[ 0 ]; - int nChar2 = sProperty[ 1 ]; - - switch( nChar1 ) - { - case 'd': - { - if ( _T("direction") == sProperty ) m_eType = cssptDirection; - else m_eType = cssptUnknown; - - break; - } - case 'f': - { - switch( nChar2 ) - { - case 'l': - { - if ( _T("flip") == sProperty ) m_eType = cssptFlip; - else m_eType = cssptUnknown; - - break; - } - case 'o': - { - if ( _T("font") == sProperty ) m_eType = cssptFont; - else if ( _T("font-family") == sProperty ) m_eType = cssptFontFamily; - else if ( _T("font-size") == sProperty ) m_eType = cssptFontSize; - else if ( _T("font-style") == sProperty ) m_eType = cssptFontStyle; - else if ( _T("font-variant") == sProperty ) m_eType = cssptFontVariant; - else if ( _T("font-weight") == sProperty ) m_eType = cssptFontWeight; - else m_eType = cssptUnknown; - - break; - } - default: - { - m_eType = cssptUnknown; - break; - } - } - break; - } - case 'h': - { - if ( _T("height") == sProperty ) m_eType = cssptHeight; - else m_eType = cssptUnknown; - - break; - } - case 'l': - { - if ( _T("layout-flow") == sProperty ) m_eType = cssptLayoutFlow; - else if ( _T("left") == sProperty ) m_eType = cssptLeft; - else m_eType = cssptUnknown; - - break; - } - case 'm': - { - switch( nChar2 ) - { - case 'a': - { - if ( _T("margin-bottom") == sProperty ) m_eType = cssptMarginBottom; - else if ( _T("margin-left") == sProperty ) m_eType = cssptMarginLeft; - else if ( _T("margin-right") == sProperty ) m_eType = cssptMarginRight; - else if ( _T("margin-top") == sProperty ) m_eType = cssptMarginTop; - else m_eType = cssptUnknown; - - break; - } - case 's': - { - if ( _T("mso-direction-alt") == sProperty ) m_eType = cssptMsoDirectionAlt; - else if ( _T("mso-fit-shape-to-text") == sProperty ) m_eType = cssptMsoFitShapeToText; - else if ( _T("mso-fit-text-to-shape") == sProperty ) m_eType = cssptMsoFitTextToShape; - else if ( _T("mso-layout-flow-alt") == sProperty ) m_eType = cssptMsoLayoutFlowAlt; - else if ( _T("mso-next-textbox") == sProperty ) m_eType = cssptMsoNextTextbox; - else if ( _T("mso-position-horizontal") == sProperty ) m_eType = cssptMsoPositionHorizontal; - else if ( _T("mso-position-horizontal-relative") == sProperty ) m_eType = cssptMsoPositionHorizontalRelative; - else if ( _T("mso-position-vertical") == sProperty ) m_eType = cssptMsoPositionVertical; - else if ( _T("mso-position-vertical-relative") == sProperty ) m_eType = cssptMsoPositionVerticalRelative; - else if ( _T("mso-rotate") == sProperty ) m_eType = cssptMsoRotate; - else if ( _T("mso-text-scale") == sProperty ) m_eType = cssptMsoTextScale; - else if ( _T("mso-text-shadow") == sProperty ) m_eType = cssptMsoTextShadow; - else if ( _T("mso-wrap-distance-bottom") == sProperty ) m_eType = cssptMsoWrapDistanceBottom; - else if ( _T("mso-wrap-distance-left") == sProperty ) m_eType = cssptMsoWrapDistanceLeft; - else if ( _T("mso-wrap-distance-right") == sProperty ) m_eType = cssptMsoWrapDistanceRight; - else if ( _T("mso-wrap-distance-top") == sProperty ) m_eType = cssptMsoWrapDistanceTop; - else if ( _T("mso-wrap-edited") == sProperty ) m_eType = cssptMsoWrapEdited; - else if ( _T("mso-wrap-style") == sProperty ) m_eType = cssptMsoWrapStyle; - else if ( _T("mso-height-percent") == sProperty ) m_eType = csspctMsoHeightPercent; - else if ( _T("mso-width-percent") == sProperty ) m_eType = csspctMsoWidthPercent; - else if ( _T("mso-top-percent") == sProperty ) m_eType = csspctMsoTopPercent; - else if (_T( "mso-left-percent") == sProperty ) m_eType = csspctMsoLeftPercent; - - else m_eType = cssptUnknown; - - break; - } - default: - { - m_eType = cssptUnknown; - break; - } - } - break; - } - case 'p': - { - if ( _T("position") == sProperty ) m_eType = cssptPosition; - else m_eType = cssptUnknown; - - break; - } - case 'r': - { - if ( _T("rotation") == sProperty ) m_eType = cssptRotation; - else m_eType = cssptUnknown; - - break; - } - case 't': - { - if ( _T("text-decoration") == sProperty ) m_eType = cssptTextDecoration; - else if ( _T("top") == sProperty ) m_eType = cssptTop; - else if ( _T("text-align") == sProperty ) m_eType = cssptHTextAlign; - else m_eType = cssptUnknown; - - break; - } - case 'v': - { - if ( _T("visibility") == sProperty ) m_eType = cssptVisibility; - else if ( _T("v-rotate-letters") == sProperty ) m_eType = cssptVRotateLetters; - else if ( _T("v-same-letter-heights") == sProperty ) m_eType = cssptVSameLetterHeights; - else if ( _T("v-text-align") == sProperty ) m_eType = cssptVTextAlign; - else if ( _T("v-text-anchor") == sProperty ) m_eType = cssptVTextAnchor; - else if ( _T("v-text-kern") == sProperty ) m_eType = cssptVTextKern; - else if ( _T("v-text-reverse") == sProperty ) m_eType = cssptVTextReverse; - else if ( _T("v-text-spacing-mode") == sProperty ) m_eType = cssptVTextSpacingMode; - else if ( _T("v-text-spacing") == sProperty ) m_eType = cssptVTextSpacing; - else m_eType = cssptUnknown; - - break; - } - case 'w': - { - if ( _T("width") == sProperty ) m_eType = cssptWidth; - else m_eType = cssptUnknown; - - break; - } - case 'z': - { - if ( _T("z-index") == sProperty ) m_eType = cssptZIndex; - else m_eType = cssptUnknown; - - break; - } - default: - { - m_eType = cssptUnknown; - break; - } - } - } - - switch ( m_eType ) - { - case cssptUnknown : ReadValue_Unknown( sValue ); break; - - case cssptFlip : ReadValue_Flip( sValue ); break; - case cssptHeight : ReadValue_Units( sValue ); break; - case cssptLeft : ReadValue_Units( sValue ); break; - case cssptMarginBottom : ReadValue_Units( sValue ); break; - case cssptMarginLeft : ReadValue_Units( sValue ); break; - case cssptMarginRight : ReadValue_Units( sValue ); break; - case cssptMarginTop : ReadValue_Units( sValue ); break; - case cssptMsoPositionHorizontal : ReadValue_MsoPosHor( sValue ); break; - case cssptMsoPositionHorizontalRelative : ReadValue_MsoPosHorRel( sValue ); break; - case cssptMsoPositionVertical : ReadValue_MsoPosVer( sValue ); break; - case cssptMsoPositionVerticalRelative : ReadValue_MsoPosVerRel( sValue ); break; - case cssptMsoWrapDistanceBottom : ReadValue_Units( sValue ); break; - case cssptMsoWrapDistanceLeft : ReadValue_Units( sValue ); break; - case cssptMsoWrapDistanceRight : ReadValue_Units( sValue ); break; - case cssptMsoWrapDistanceTop : ReadValue_Units( sValue ); break; - case cssptMsoWrapEdited : ReadValue_Boolean( sValue ); break; - case cssptMsoWrapStyle : ReadValue_MsoWrapStyle( sValue ); break; - case cssptPosition : ReadValue_Position( sValue ); break; - case cssptRotation : ReadValue_Rotation( sValue ); break; - case cssptTop : ReadValue_Units( sValue ); break; - case cssptVisibility : ReadValue_Visibility( sValue ); break; - case cssptWidth : ReadValue_Units( sValue ); break; - case cssptZIndex : ReadValue_ZIndex( sValue ); break; - - case cssptDirection : ReadValue_Direction( sValue ); break; - case cssptLayoutFlow : ReadValue_LayoutFlow( sValue ); break; - case cssptMsoDirectionAlt : ReadValue_DirectionAlt( sValue ); break; - case cssptMsoFitShapeToText : ReadValue_Boolean( sValue ); break; - case cssptMsoFitTextToShape : ReadValue_Boolean( sValue ); break; - case cssptMsoLayoutFlowAlt : ReadValue_LayoutFlowAlt( sValue ); break; - case cssptMsoNextTextbox : ReadValue_String( sValue ); break; - case cssptMsoRotate : ReadValue_MsoRotate( sValue ); break; - case cssptMsoTextScale : ReadValue_Units( sValue ); break; - case cssptVTextAnchor : ReadValue_VTextAnchor( sValue ); break; - - case cssptFont : ReadValue_String( sValue ); break; - case cssptFontFamily : ReadValue_String( sValue ); break; - case cssptFontSize : ReadValue_Units( sValue ); break; - case cssptFontStyle : ReadValue_FontStyle( sValue ); break; - case cssptFontVariant : ReadValue_FontVariant( sValue ); break; - case cssptFontWeight : ReadValue_FontWeight( sValue ); break; - case cssptMsoTextShadow : ReadValue_Boolean( sValue ); break; - case cssptTextDecoration : ReadValue_TextDecoration( sValue ); break; - case cssptVRotateLetters : ReadValue_Boolean( sValue ); break; - case cssptVSameLetterHeights : ReadValue_Boolean( sValue ); break; - case cssptVTextAlign : ReadValue_VTextAlign( sValue ); break; - case cssptVTextKern : ReadValue_Boolean( sValue ); break; - case cssptVTextReverse : ReadValue_Boolean( sValue ); break; - case cssptVTextSpacingMode : ReadValue_VTextSpacingMode( sValue ); break; - case cssptVTextSpacing : ReadValue_Units( sValue ); break; - case csspctMsoWidthPercent : ReadValue_Units( sValue ); break; - case csspctMsoHeightPercent : ReadValue_Units( sValue ); break; - case csspctMsoLeftPercent : ReadValue_Units( sValue); break; - case csspctMsoTopPercent : ReadValue_Units( sValue); break; - case cssptHTextAlign : ReadValue_VTextAlign( sValue ); break; - }; - } - - private: - - void ReadValue_Unknown(std::wstring& sValue) - { - // Ничего не делаем - } - void ReadValue_Flip(std::wstring& sValue) - { - if ( _T("x") == sValue ) m_oValue.eFlip = cssflipX; - else if ( _T("y") == sValue ) m_oValue.eFlip = cssflipY; - else if ( _T("xy") == sValue ) m_oValue.eFlip = cssflipXY; - else if ( _T("yx") == sValue ) m_oValue.eFlip = cssflipYX; - else - m_eType = cssptUnknown; - } - void ReadValue_Units(std::wstring& sValue) - { - int nPos = -1; - if ( -1 != ( nPos = (int)sValue.find(_T("auto" ) ) ) ) - { - m_oValue.oValue.eType = cssunitstypeAuto; - } - else if ( -1 != ( nPos = (int)sValue.find( _T("in") ) ) ) - { - m_oValue.oValue.eType = cssunitstypeUnits; - - std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = XmlUtils::GetDouble(sValue); - - m_oValue.oValue.dValue = Inch_To_Pt(dValue); - } - else if ( -1 != ( nPos = (int)sValue.find( _T("cm") ) ) ) - { - m_oValue.oValue.eType = cssunitstypeUnits; - - std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = XmlUtils::GetDouble(sValue); - - m_oValue.oValue.dValue = Cm_To_Pt(dValue); - } - else if ( -1 != ( nPos = (int)sValue.find( _T("mm") ) ) ) - { - m_oValue.oValue.eType = cssunitstypeUnits; - - std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = XmlUtils::GetDouble(sValue); - - m_oValue.oValue.dValue = Mm_To_Pt(dValue); - } - else if ( -1 != ( nPos = (int)sValue.find( _T("em") ) ) ) - { - // TO DO: Реализовать единицы 'em' - } - else if ( -1 != ( nPos = (int)sValue.find( _T("ex") ) ) ) - { - // TO DO: Реализовать единицы 'ex' - } - else if ( -1 != ( nPos = (int)sValue.find( _T("pt") ) ) ) - { - m_oValue.oValue.eType = cssunitstypeUnits; - - std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = XmlUtils::GetDouble(sValue); - - m_oValue.oValue.dValue = dValue; - } - else if ( -1 != ( nPos = (int)sValue.find( _T("pc") ) ) ) - { - m_oValue.oValue.eType = cssunitstypeUnits; - - std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = XmlUtils::GetDouble(sValue); - - m_oValue.oValue.dValue = dValue * 12; - } - else if ( -1 != ( nPos = (int)sValue.find( _T("%") ) ) ) - { - m_oValue.oValue.eType = cssunitstypePerc; - - std::wstring strValue = sValue.substr( 0, nPos ); - m_oValue.oValue.dValue = XmlUtils::GetDouble(strValue); - } - else if ( -1 != ( nPos = (int)sValue.find( _T("px") ) ) ) - { - m_oValue.oValue.eType = cssunitstypeUnits; - - std::wstring strValue = sValue.substr( 0, nPos ); - double dValue = XmlUtils::GetDouble(sValue); - - m_oValue.oValue.dValue = Px_To_Pt(dValue); - } - else - { - m_oValue.oValue.eType = cssunitstypeAbsolute; - try - { - m_oValue.oValue.dValue = XmlUtils::GetDouble(sValue); - } - catch(...) - { - m_oValue.oValue.dValue = 0; - } - } - } - - void ReadValue_MsoPosHor(std::wstring& sValue) - { - if ( _T("absolute") == sValue ) m_oValue.eMsoPosHor = cssmsoposhorAbsolute; - else if ( _T("left") == sValue ) m_oValue.eMsoPosHor = cssmsoposhorLeft; - else if ( _T("center") == sValue ) m_oValue.eMsoPosHor = cssmsoposhorCenter; - else if ( _T("right") == sValue ) m_oValue.eMsoPosHor = cssmsoposhorRight; - else if ( _T("inside") == sValue ) m_oValue.eMsoPosHor = cssmsoposhorInside; - else if ( _T("outside") == sValue ) m_oValue.eMsoPosHor = cssmsoposhorOutside; - else - m_oValue.eMsoPosHor = cssmsoposhorAbsolute; - } - void ReadValue_MsoPosHorRel(std::wstring& sValue) - { - if ( _T("left-margin-area") == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelLeftMargin; - else if ( _T("right-margin-area") == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelRightMargin; - else if ( _T("margin") == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelMargin; - else if ( _T("page") == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelPage; - else if ( _T("text") == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelText; - else if ( _T("char") == sValue ) m_oValue.eMsoPosHorRel = cssmsoposhorrelChar; - else - m_oValue.eMsoPosHorRel = cssmsoposhorrelText; - } - void ReadValue_MsoPosVer(std::wstring& sValue) - { - if ( _T("absolute") == sValue ) m_oValue.eMsoPosVer = cssmsoposverAbsolute; - else if ( _T("top") == sValue ) m_oValue.eMsoPosVer = cssmsoposverTop; - else if ( _T("center") == sValue ) m_oValue.eMsoPosVer = cssmsoposverCenter; - else if ( _T("bottom") == sValue ) m_oValue.eMsoPosVer = cssmsoposverBottom; - else if ( _T("inside") == sValue ) m_oValue.eMsoPosVer = cssmsoposverInside; - else if ( _T("outside") == sValue ) m_oValue.eMsoPosVer = cssmsoposverOutside; - else - m_oValue.eMsoPosVer = cssmsoposverAbsolute; - } - void ReadValue_MsoPosVerRel(std::wstring& sValue) - { - if ( _T("bottom-margin-area") == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelBottomMargin; - else if ( _T("top-margin-area") == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelTopMargin; - else if ( _T("margin") == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelMargin; - else if ( _T("page") == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelPage; - else if ( _T("text") == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelText; - else if ( _T("line") == sValue ) m_oValue.eMsoPosVerRel = cssmsoposverrelLine; - else - m_oValue.eMsoPosVerRel = cssmsoposverrelText; - } - - void ReadValue_Rotation(std::wstring& sValue) - { - m_oValue.oValue.eType = cssunitstypeAbsolute; - m_oValue.oValue.dValue = XmlUtils::GetDouble( sValue ); - - if (sValue.find(_T("fd")) != std::wstring::npos) - { - m_oValue.oValue.dValue /= 6000.; - } - else if (sValue.find(_T("f")) == sValue.length() - 1) - { - m_oValue.oValue.dValue /= 65536.; - } - } - void ReadValue_Boolean(std::wstring& sValue) - { - if ( _T("true") == sValue || _T("t") == sValue || _T("1") == sValue ) - m_oValue.bValue = true; - else - m_oValue.bValue = false; - } - void ReadValue_MsoWrapStyle(std::wstring& sValue) - { - if ( _T("square") == sValue ) m_oValue.eMsoWrapStyle = cssmsowrapstyleSqaure; - else if ( _T("none") == sValue ) m_oValue.eMsoWrapStyle = cssmsowrapstyleNone; - else - m_oValue.eMsoWrapStyle = cssmsowrapstyleSqaure; - } - void ReadValue_Position(std::wstring& sValue) - { - if ( _T("static") == sValue ) m_oValue.ePosition = csspositionStatic; - else if ( _T("absolute") == sValue ) m_oValue.ePosition = csspositionAbsolute; - else if ( _T("relative") == sValue ) m_oValue.ePosition = csspositionRelative; - else - m_oValue.ePosition = csspositionAbsolute; - } - void ReadValue_Visibility(std::wstring& sValue) - { - if ( _T("hidden") == sValue ) m_oValue.eVisibility = cssvisibilityHidden; - else if ( _T("inherit") == sValue ) m_oValue.eVisibility = cssvisibilityInherit; - else - m_oValue.eVisibility = cssvisibilityInherit; - } - void ReadValue_ZIndex(std::wstring& sValue) - { - if ( _T("auto") == sValue ) m_oValue.oZIndex.eType = csszindextypeAuto; - else - { - m_oValue.oZIndex.eType = csszindextypeOrder; - m_oValue.oZIndex.nOrder = _wtoi( sValue.c_str() ); - - } - } - void ReadValue_Direction(std::wstring& sValue) - { - if ( _T("ltr") == sValue ) m_oValue.eDirection = cssdirectionLTR; - else if ( _T("rtl") == sValue ) m_oValue.eDirection = cssdirectionRTL; - else - m_oValue.eDirection = cssdirectionLTR; - } - void ReadValue_LayoutFlow(std::wstring& sValue) - { - if ( _T("horizontal") == sValue ) m_oValue.eLayoutFlow = csslayoutflowHorizontal; - else if ( _T("vertical") == sValue ) m_oValue.eLayoutFlow = csslayoutflowVertical; - else if ( _T("vertical-ideographic") == sValue ) m_oValue.eLayoutFlow = csslayoutflowVerticalIdeographic; - else if ( _T("horizontal-ideographic") == sValue ) m_oValue.eLayoutFlow = csslayoutflowHorizontalIdeographic; - else - m_oValue.eLayoutFlow = csslayoutflowHorizontal; - } - void ReadValue_DirectionAlt(std::wstring& sValue) - { - m_oValue.eDirectionAlt = cssdirectionaltContext; - } - void ReadValue_LayoutFlowAlt(std::wstring& sValue) - { - m_oValue.eLayoutFlowAlt = csslayoutflowaltBottomToTop; - } - void ReadValue_String(std::wstring& sValue) - { - int nLen = (int)sValue.length(); - if ( nLen > 127 ) - return; - - ::memcpy( m_oValue.wsValue, sValue.c_str(), nLen * sizeof( wchar_t ) ); - m_oValue.wsValue[nLen] = '\0'; - } - - void ReadValue_MsoRotate(std::wstring& sValue) - { - if ( _T("0") == sValue ) m_oValue.eRotate = cssmsorotate0; - else if ( _T("90") == sValue ) m_oValue.eRotate = cssmsorotate90; - else if ( _T("180") == sValue ) m_oValue.eRotate = cssmsorotate180; - else if ( _T("-90") == sValue ) m_oValue.eRotate = cssmsorotate270; - else - m_oValue.eRotate = cssmsorotate0; - } - void ReadValue_VTextAnchor(std::wstring& sValue) - { - if ( _T("top") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorTop; - else if ( _T("middle") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorMiddle; - else if ( _T("bottom") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorBottom; - else if ( _T("top-center") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorTopCenter; - else if ( _T("middle-center") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorMiddleCenter; - else if ( _T("bottom-center") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorBottomCenter; - else if ( _T("top-baseline") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorTopBaseline; - else if ( _T("bottom-baseline") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorBottomBaseline; - else if ( _T("top-center-baseline") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorTopCenterBaseline; - else if ( _T("bottom-center-baseline") == sValue ) m_oValue.eVTextAnchor = cssvtextanchorBottomCenterBaseline; - else - m_oValue.eVTextAnchor = cssvtextanchorTop; - } - void ReadValue_FontStyle(std::wstring& sValue) - { - if ( _T("normal") == sValue ) m_oValue.eFontStyle = cssfontstyleNormal; - else if ( _T("italic") == sValue ) m_oValue.eFontStyle = cssfontstyleItalic; - else if ( _T("oblique") == sValue ) m_oValue.eFontStyle = cssfontstyleOblique; - else - m_oValue.eFontStyle = cssfontstyleNormal; - } - void ReadValue_FontVariant(std::wstring& sValue) - { - if ( _T("normal") == sValue ) m_oValue.eFontVariant = cssfontvariantNormal; - else if ( _T("small-caps") == sValue ) m_oValue.eFontVariant = cssfontvariantSmallCaps; - else - m_oValue.eFontVariant = cssfontvariantNormal; - } - void ReadValue_FontWeight(std::wstring& sValue) - { - if ( _T("normal") == sValue ) m_oValue.eFontWeight = cssfontweightNormal; - else if ( _T("lighter") == sValue ) m_oValue.eFontWeight = cssfontweightLighter; - else if ( _T("100") == sValue ) m_oValue.eFontWeight = cssfontweight100; - else if ( _T("200") == sValue ) m_oValue.eFontWeight = cssfontweight200; - else if ( _T("300") == sValue ) m_oValue.eFontWeight = cssfontweight300; - else if ( _T("400") == sValue ) m_oValue.eFontWeight = cssfontweight400; - else if ( _T("bold") == sValue ) m_oValue.eFontWeight = cssfontweightBold; - else if ( _T("bolder") == sValue ) m_oValue.eFontWeight = cssfontweightBolder; - else if ( _T("500") == sValue ) m_oValue.eFontWeight = cssfontweight500; - else if ( _T("600") == sValue ) m_oValue.eFontWeight = cssfontweight600; - else if ( _T("700") == sValue ) m_oValue.eFontWeight = cssfontweight700; - else if ( _T("800") == sValue ) m_oValue.eFontWeight = cssfontweight800; - else if ( _T("900") == sValue ) m_oValue.eFontWeight = cssfontweight900; - else - m_oValue.eFontWeight = cssfontweightNormal; - } - void ReadValue_TextDecoration(std::wstring& sValue) - { - if ( _T("none") == sValue ) m_oValue.eTextDecoration = csstextdecorationNone; - else if ( _T("underline") == sValue ) m_oValue.eTextDecoration = csstextdecorationUnderline; - else if ( _T("overline") == sValue ) m_oValue.eTextDecoration = csstextdecorationOverline; - else if ( _T("line-through") == sValue ) m_oValue.eTextDecoration = csstextdecorationLineThrough; - else if ( _T("blink") == sValue ) m_oValue.eTextDecoration = csstextdecorationBlink; - else - m_oValue.eTextDecoration = csstextdecorationNone; - } - void ReadValue_VTextAlign(std::wstring& sValue) - { - if ( _T("left") == sValue ) m_oValue.eVTextAlign = cssvtextalignLeft; - else if ( _T("right") == sValue ) m_oValue.eVTextAlign = cssvtextalignRight; - else if ( _T("center") == sValue ) m_oValue.eVTextAlign = cssvtextalignCenter; - else if ( _T("justify") == sValue ) m_oValue.eVTextAlign = cssvtextalignJustify; - else if ( _T("letter-justify") == sValue ) m_oValue.eVTextAlign = cssvtextalignLetterJustify; - else if ( _T("stretch-justify") == sValue ) m_oValue.eVTextAlign = cssvtextalignStretchJustify; - else - m_oValue.eVTextAlign = cssvtextalignLeft; - } - void ReadValue_VTextSpacingMode(std::wstring& sValue) - { - if ( _T("tightening") == sValue ) m_oValue.eVTextSpacingMode = cssvtextspacingmodeTightening; - else if ( _T("tracking") == sValue ) m_oValue.eVTextSpacingMode = cssvtextspacingmodeTracking; - else - m_oValue.eVTextSpacingMode = cssvtextspacingmodeTightening; - } - private: - - - ECssPropertyType m_eType; - UCssValue m_oValue; - - }; - - - - //-------------------------------------------------------------------------------- - // CCssStyle 14.1.2.1 (style) (Part 1) - //-------------------------------------------------------------------------------- - - typedef boost::shared_ptr CCssPropertyPtr; - - class CCssStyle - { - public: - CCssStyle() - { - } - ~CCssStyle() - { - Clear(); - } - void Clear() - { - m_arrProperties.clear(); - } - - std::wstring FromString(std::wstring &sValue) - { - Clear(); - - m_sCss = sValue; - ParseProperties(); - - return m_sCss; - } - - std::wstring ToString () const - { - return m_sCss; - } - - void mergeFrom(CCssStyle* parent) - { - if (!parent) return; - - for (std::map::iterator it = parent->m_mapProperties.begin(); it != parent->m_mapProperties.end(); ++it) - { - std::map::iterator pFind = m_mapProperties.find(it->first); - if (pFind == m_mapProperties.end()) - { - m_arrProperties.push_back(parent->m_arrProperties[it->second]); - m_mapProperties.insert(std::make_pair(it->first, m_arrProperties.size() - 1)); - } - } - } - - SimpleType_FromString2(std::wstring) - SimpleType_Operator_Equal(CCssStyle) - - private: - - bool ParseProperties() - { - std::wstring sTemp = m_sCss; - while ( false == sTemp.empty() ) - { - size_t nPos = (int)sTemp.find( ';' ); - if ( std::wstring::npos == nPos ) - { - CCssPropertyPtr pProperty = CCssPropertyPtr(new CCssProperty(sTemp)); - if ((pProperty) && (cssptUnknown != pProperty->get_Type()) ) - { - std::map::iterator pFind = m_mapProperties.find(pProperty->get_Type()); - if (pFind != m_mapProperties.end()) - { - m_arrProperties[pFind->second] = pProperty; - } - else - { - m_arrProperties.push_back(pProperty); - m_mapProperties.insert(std::make_pair(pProperty->get_Type(), m_arrProperties.size() - 1)); - } - } - - sTemp.clear(); - continue; - } - else - { - CCssPropertyPtr pProperty = CCssPropertyPtr(new CCssProperty( sTemp.substr( 0, nPos ))); - - if ((pProperty) && (cssptUnknown != pProperty->get_Type()) ) - { - std::map::iterator pFind = m_mapProperties.find(pProperty->get_Type()); - if (pFind != m_mapProperties.end()) - { - m_arrProperties[pFind->second] = pProperty; - } - else - { - m_arrProperties.push_back(pProperty); - m_mapProperties.insert(std::make_pair(pProperty->get_Type(), m_arrProperties.size() - 1)); - } - } - - sTemp = sTemp.substr( nPos + 1, sTemp.length() - nPos - 1 ); - } - } - - return true; - } - - public: - std::map m_mapProperties; - std::vector m_arrProperties; - std::wstring m_sCss; - }; - //-------------------------------------------------------------------------------- - // Vml_Vector2D_Units 14.1.2.3 (from, control1, control2, to) - //-------------------------------------------------------------------------------- - class CVml_Vector2D_Units - { - public: - CVml_Vector2D_Units() - { - m_dX = 0; - m_dY = 0; - } - - double GetX() const - { - return m_dX; - } - double GetY() const - { - return m_dY; - } - - void SetValue(double dX, double dY) - { - m_dX = dX; - m_dY = dY; - } - - virtual double FromString(std::wstring &sValue) - { - m_dX = 0; - m_dY = 0; - - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; - - int nPos = (int)sValue.find( _T(",") ); - if ( -1 == nPos ) - {//only x position - SimpleTypes::CPoint oPt1 = sValue; - m_dX = oPt1.GetValue(); - return 0; - } - - SimpleTypes::CPoint oPt1 = sValue.substr( 0, nPos ); - m_dX = oPt1.GetValue(); - - SimpleTypes::CPoint oPt2 = sValue.substr( nPos + 1, nLen - nPos - 1 ); - m_dY = oPt2.GetValue(); - - return 0; - } - - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dX) + L"," + boost::lexical_cast(m_dY); - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector2D_Units) + SimpleTypes_DefaultString(CVml_Vector2D_Units) private: double m_dX; // В пунктах - double m_dY; // В пунктах - }; - //-------------------------------------------------------------------------------- - // Vml_Vector2D_Percentage - //-------------------------------------------------------------------------------- - class CVml_Vector2D_Percentage - { - public: - CVml_Vector2D_Percentage() - { - m_dX = 0; - m_dY = 0; - } + double m_dY; // В пунктах + }; - double GetX() const - { - return m_dX; - } - double GetY() const - { - return m_dY; - } + //-------------------------------------------------------------------------------- + // Vml_Vector2D_Percentage + //-------------------------------------------------------------------------------- - void SetValue(double dX, double dY) - { - m_dX = dX; - m_dY = dY; - } + class CVml_Vector2D_Percentage + { + public: + CVml_Vector2D_Percentage(); - virtual double FromString(std::wstring &sValue) - { - m_dX = 0; - m_dY = 0; + double GetX() const; + double GetY() const; - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + void SetValue(double dX, double dY); - int nPos = (int)sValue.find( _T(",") ); - if ( -1 == nPos ) - {//only x position - SimpleTypes::CPercentage oPerc1 = sValue; - m_dX = oPerc1.GetValue(); - return 0; - } + virtual double FromString(const std::wstring &sValue); - SimpleTypes::CPercentage oPerc1 = sValue.substr( 0, nPos ); - m_dX = oPerc1.GetValue(); + virtual std::wstring ToString () const; - SimpleTypes::CPercentage oPerc2 = sValue.substr( nPos + 1, nLen - nPos - 1 ); - m_dY = oPerc2.GetValue(); - - return 0; - } - - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dX) + L"%," + boost::lexical_cast(m_dY) + L"%"; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector2D_Percentage) + SimpleTypes_DefaultString(CVml_Vector2D_Percentage) private: - double m_dX; // - double m_dY; // - }; - //-------------------------------------------------------------------------------- - // Vml_Vector2D_1_65536 - //-------------------------------------------------------------------------------- - class CVml_Vector2D_1_65536 - { - public: - CVml_Vector2D_1_65536() - { - m_dX = 0; - m_dY = 0; - } + double m_dY; // + }; - double GetX() const - { - return m_dX; - } - double GetY() const - { - return m_dY; - } + //-------------------------------------------------------------------------------- + // Vml_Vector2D_1_65536 + //-------------------------------------------------------------------------------- - void SetValue(double dX, double dY) - { - m_dX = dX; - m_dY = dY; - } + class CVml_Vector2D_1_65536 + { + public: + CVml_Vector2D_1_65536(); - virtual double FromString(std::wstring &sValue) - { - m_dX = 0; - m_dY = 0; + double GetX() const; + double GetY() const; - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + void SetValue(double dX, double dY); - int nPos = (int)sValue.find( _T(",") ); - if ( -1 == nPos ) - {//only x position - SimpleTypes::Vml::CVml_1_65536 oFraction1 = sValue; - m_dX = oFraction1.GetValue(); - return 0; - } + virtual double FromString(const std::wstring &sValue); - SimpleTypes::Vml::CVml_1_65536 oFraction1 = sValue.substr( 0, nPos ); - m_dX = oFraction1.GetValue(); + virtual std::wstring ToString () const; - SimpleTypes::Vml::CVml_1_65536 oFraction2 = sValue.substr( nPos + 1, nLen - nPos - 1 ); - m_dY = oFraction2.GetValue(); - - return 0; - } - - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dX) + L"," + boost::lexical_cast(m_dY); - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector2D_1_65536) + SimpleTypes_DefaultString(CVml_Vector2D_1_65536) private: - double m_dX; // - double m_dY; // - }; - //-------------------------------------------------------------------------------- - // CVml_TableLimits - //-------------------------------------------------------------------------------- - class CVml_TableLimits - { - public: - CVml_TableLimits() - { - } + double m_dY; // + }; - unsigned int GetSize() const - { - return (unsigned int)m_arrLimits.size(); - } - double GetAt(int nIndex) const - { - if ( nIndex < 0 || nIndex >= (int)m_arrLimits.size() ) - return 0; + //-------------------------------------------------------------------------------- + // CVml_TableLimits + //-------------------------------------------------------------------------------- - return m_arrLimits[nIndex]; - } + class CVml_TableLimits + { + public: + CVml_TableLimits(); - void AddValue(double dValue) - { - m_arrLimits.push_back( dValue ); - } + unsigned int GetSize() const; + double GetAt(int nIndex) const; - int FromString(std::wstring &sValue) - { - int nPos = 0; - int nLen = (int)sValue.length(); + void AddValue(double dValue); - int nSpacePos = 0; - wchar_t wChar; - while ( nPos < nLen ) - { - while ( ' ' == ( wChar = sValue[nPos] ) ) - { - nPos++; - if ( nPos >= nLen ) - return 0; - } + int FromString(const std::wstring &sValue); - nSpacePos = (int)sValue.find( _T(" "), nPos ); - if ( -1 == nSpacePos ) - nSpacePos = nLen; + std::wstring ToString () const; - SimpleTypes::CPoint oPoint = sValue.substr( nPos, nSpacePos - nPos ); - nPos = nSpacePos + 1; - - m_arrLimits.push_back( oPoint.ToPoints() ); - } - - return 0; - } - - std::wstring ToString () const - { - std::wstring sResult; - - for ( unsigned int nIndex = 0; nIndex < m_arrLimits.size(); nIndex++ ) - { - sResult += boost::lexical_cast(m_arrLimits[nIndex]) + L"pt "; - } - - return sResult; - } - - SimpleType_FromString2 (int) - SimpleType_Operator_Equal (CVml_TableLimits) + SimpleTypes_DefaultString(CVml_TableLimits) private: - std::vector m_arrLimits; - }; + }; - //-------------------------------------------------------------------------------- - // CVml_TableProperties - //-------------------------------------------------------------------------------- - template - class CVml_TableProperties : public CSimpleType - { - public: - CVml_TableProperties() {} + //-------------------------------------------------------------------------------- + // CVml_TableProperties + //-------------------------------------------------------------------------------- - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); + DEFINE_SIMPLE_TYPE_START(CVml_TableProperties, int, 0) + public: + bool IsTable() const; + bool IsPlaceholder() const; + bool IsBiDirectionalText() const; + }; - return this->m_eValue; - } + //-------------------------------------------------------------------------------- + // Vml_Vector2D_Position 14.1.2.8 (position) + //-------------------------------------------------------------------------------- - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); + enum EVml_Vector2D_Position + { + vmlvector2dposConstant = 0, + vmlvector2dposFormula = 1, + vmlvector2dposAdjValue = 2, + vmlvector2dposCenter = 3, + vmlvector2dposTopLeft = 4, + vmlvector2dposBottomRight = 5, + }; - return sResult; - } + class CVml_Vector2D_Position + { + public: + CVml_Vector2D_Position(); - bool IsTable() const - { - return ( this->m_eValue & 1 ? true : false ); - } + EVml_Vector2D_Position GetTypeX() const; + EVml_Vector2D_Position GetTypeY() const; + std::wstring GetIdX() const; + std::wstring GetIdY() const; + double GetX() const; + double GetY() const; + void SetConstantX(double dX); + void SetConstantY(double dY); - bool IsPlaceholder() const - { - return ( this->m_eValue & 2 ? true : false ); - } + double FromString(const std::wstring &sValue); - bool IsBiDirectionalText() const - { - return ( this->m_eValue & 4 ? true : false ); - } + std::wstring ToString () const; - SimpleType_FromString (int) - SimpleType_Operator_Equal (CVml_TableProperties) - SimpleTypes_AdditionalOpearators(CVml_TableProperties) - - }; - //-------------------------------------------------------------------------------- - // Vml_Vector2D_Position 14.1.2.8 (position) - //-------------------------------------------------------------------------------- - enum EVml_Vector2D_Position - { - vmlvector2dposConstant = 0, - vmlvector2dposFormula = 1, - vmlvector2dposAdjValue = 2, - vmlvector2dposCenter = 3, - vmlvector2dposTopLeft = 4, - vmlvector2dposBottomRight = 5, - }; - - class CVml_Vector2D_Position - { - public: - CVml_Vector2D_Position() - { - - } - - EVml_Vector2D_Position GetTypeX() const - { - return m_eTypeX; - } - EVml_Vector2D_Position GetTypeY() const - { - return m_eTypeY; - } - std::wstring GetIdX() const - { - return m_sIdX; - } - std::wstring GetIdY() const - { - return m_sIdY; - } - double GetX() const - { - return m_dX; - } - double GetY() const - { - return m_dY; - } - void SetConstantX(double dX) - { - m_eTypeX = vmlvector2dposConstant; - m_dX = dX; - } - - void SetConstantY(double dY) - { - m_eTypeY = vmlvector2dposConstant; - m_dY = dY; - } - - double FromString(std::wstring &sValue) - { - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; - - int nPos = (int)sValue.find( _T(",") ); - if ( -1 == nPos ) - return 0; - - std::wstring sFirst = sValue.substr( 0, nPos ); - std::wstring sSecond = sValue.substr( nPos + 1, nLen - nPos - 1 ); - - Parse( sFirst, true ); - Parse( sSecond, false ); - - return 0; - } - - std::wstring ToString () const - { - std::wstring sResult; - - switch ( m_eTypeX ) - { - case vmlvector2dposConstant : sResult = boost::lexical_cast( m_dX ); break; - case vmlvector2dposFormula : sResult = _T("@") + m_sIdX; break; - case vmlvector2dposAdjValue : sResult = _T("#") + m_sIdX; break; - case vmlvector2dposCenter : sResult = _T("center"); break; - case vmlvector2dposTopLeft : sResult = _T("topleft"); break; - case vmlvector2dposBottomRight : sResult = _T("bottomright"); break; - }; - - sResult += _T(","); - - switch ( m_eTypeY ) - { - case vmlvector2dposConstant : - { - std::wstring sTemp = boost::lexical_cast( m_dY ); - sResult += sTemp; - break; - } - case vmlvector2dposFormula : sResult += _T("@") + m_sIdY; break; - case vmlvector2dposAdjValue : sResult += _T("#") + m_sIdY; break; - case vmlvector2dposCenter : sResult += _T("center"); break; - case vmlvector2dposTopLeft : sResult += _T("topleft"); break; - case vmlvector2dposBottomRight : sResult += _T("bottomright"); break; - }; - - return sResult; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector2D_Position) + SimpleTypes_DefaultString(CVml_Vector2D_Position) private: + void Parse(std::wstring &sValue, bool bFirst); - void Parse(std::wstring &sValue, bool bFirst) - { - EVml_Vector2D_Position eValue = vmlvector2dposConstant; - double dValue = 0.0; - std::wstring sId; + private: - XmlUtils::replace_all( sValue, _T(" "), _T("") ); + EVml_Vector2D_Position m_eTypeX; + EVml_Vector2D_Position m_eTypeY; - int nLen = (int)sValue.length(); - if ( nLen > 0 ) - { + std::wstring m_sIdX; // Значение для типа Formula иди AdjValue + std::wstring m_sIdY; // - wchar_t wChar = sValue[0]; - switch ( wChar ) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '.': + double m_dX; // Значение для типа Constant + double m_dY; // + }; - eValue = vmlvector2dposConstant; - dValue = XmlUtils::GetDouble(sValue); - break; + //-------------------------------------------------------------------------------- + // Vml_Polygon2D_Units 14.1.2.15 (points) + //-------------------------------------------------------------------------------- - case 'c': + class CVml_Polygon2D_Units + { + public: + CVml_Polygon2D_Units(); + CVml_Polygon2D_Units(const CVml_Polygon2D_Units &oOther); + CVml_Polygon2D_Units(const std::wstring& wsStr); + CVml_Polygon2D_Units &operator =(const std::wstring& wsStr); - if ( _T("center") == sValue ) - eValue = vmlvector2dposCenter; + void SetDelimiter(wchar_t wcNew); + double GetX(int nIndex) const; + double GetY(int nIndex) const; - break; + void AddPoint(double dX, double dY); - case 't': + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - if ( _T("topleft") == sValue ) - eValue = vmlvector2dposTopLeft; + private: - break; - - case 'b': - - if ( _T("bottomright") == sValue ) - eValue = vmlvector2dposBottomRight; - - break; - - case '@': - - eValue = vmlvector2dposFormula; - sId = sValue.substr( 1, nLen - 1 ); - break; - - case '#': - - eValue = vmlvector2dposAdjValue; - sId = sValue.substr( 1, nLen - 1 ); - break; - } - - } - - if ( bFirst ) - { - m_eTypeX = eValue; - m_sIdX = sId; - m_dX = dValue; - } - else - { - m_eTypeY = eValue; - m_sIdY = sId; - m_dY = dValue; - } - } - - private: - - EVml_Vector2D_Position m_eTypeX; - EVml_Vector2D_Position m_eTypeY; - - std::wstring m_sIdX; // Значение для типа Formula иди AdjValue - std::wstring m_sIdY; // - - double m_dX; // Значение для типа Constant - double m_dY; // - }; - //-------------------------------------------------------------------------------- - // Vml_Polygon2D_Units 14.1.2.15 (points) - //-------------------------------------------------------------------------------- - class CVml_Polygon2D_Units + struct TPoint { - public: - CVml_Polygon2D_Units() + double dX; + double dY; + + TPoint(double d_X, double d_Y ) { - m_wcDelimiter = 0x20; + dX = d_X; + dY = d_Y; } - CVml_Polygon2D_Units(const CVml_Polygon2D_Units &oOther)\ - { - m_wcDelimiter = 0x20; - FromString( oOther.ToString() ); - } - CVml_Polygon2D_Units(std::wstring &sValue) - { - m_wcDelimiter = 0x20; - FromString( sValue ); - } - CVml_Polygon2D_Units(const wchar_t* cwsValue) - { - m_wcDelimiter = 0x20; - FromString( cwsValue ); - } - CVml_Polygon2D_Units(const std::wstring& wsStr) - { - m_wcDelimiter = 0x20; - FromString( wsStr ); - } - const CVml_Polygon2D_Units &operator =(std::wstring &sValue) - { - FromString( sValue ); - return *this; - } - const CVml_Polygon2D_Units &operator =(const wchar_t* cwsString) - { - FromString( cwsString ); - return *this; - } - const CVml_Polygon2D_Units &operator =(const std::wstring& wsStr) - { - FromString( wsStr ); - return *this; - } - - void SetDelimiter(wchar_t wcNew) - { - m_wcDelimiter = wcNew; - } - double GetX(int nIndex) const - { - if ( nIndex < 0 || nIndex >= (int)m_arrPoints.size() ) - return 0; - - return m_arrPoints[nIndex].dX; - } - double GetY(int nIndex) const - { - if ( nIndex < 0 || nIndex >= (int)m_arrPoints.size() ) - return 0; - - return m_arrPoints[nIndex].dY; - } - - void AddPoint(double dX, double dY) - { - TPoint oPt( dX, dY ); - m_arrPoints.push_back( oPt ); - } - - virtual double FromString(std::wstring &sValue) - { - m_arrPoints.clear(); - - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; - - int nStartPos = 0; - while ( true ) - { - int nMidPos = (int)sValue.find( _T(","), nStartPos ); - int nEndPos = (int)sValue.find( m_wcDelimiter, nMidPos + 1 ); - - if ( -1 == nMidPos ) - break; - - if ( -1 == nEndPos ) - nEndPos = nLen; - - std::wstring strX = sValue.substr( nStartPos, nMidPos - nStartPos ) ; - std::wstring strY = sValue.substr( nMidPos + 1, nEndPos - nMidPos - 1 ); - - XmlUtils::replace_all(strX, L"@", L""); - XmlUtils::replace_all(strY, L"@", L""); - - int nX = XmlUtils::GetDouble(strX); - int nY = XmlUtils::GetDouble(strY ); - - m_arrPoints.push_back( TPoint( nX, nY ) ); - - nStartPos = nEndPos + 1; - } - - - return 0; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - - for ( size_t nIndex = 0; nIndex < m_arrPoints.size(); nIndex++ ) - { - sResult += boost::lexical_cast(m_arrPoints[nIndex].dX) + L"," + boost::lexical_cast(m_arrPoints[nIndex].dY); - if ( nIndex < m_arrPoints.size() - 1 ) - sResult += m_wcDelimiter; - } - - return sResult; - } - - SimpleType_FromString2 (double) - - private: - - struct TPoint - { - double dX; - double dY; - - TPoint(double d_X, double d_Y ) - { - dX = d_X; - dY = d_Y; - } - }; - - std::vector m_arrPoints; - wchar_t m_wcDelimiter; // Разделитель, по умолчнию пробел ' ' }; - //-------------------------------------------------------------------------------- - // Vml_1_65536_Or_Percentage 14.2.2.11 (brightness) - //-------------------------------------------------------------------------------- - class CVml_1_65536_Or_Percentage - { - public: - CVml_1_65536_Or_Percentage() - { - m_dValue = 0; - } - double GetValue() const - { - return m_dValue; - } + std::vector m_arrPoints; + wchar_t m_wcDelimiter; // Разделитель, по умолчнию пробел ' ' + }; - void SetValue(double dValue) - { - m_dValue = (std::max)( 0.0, (std::min)( 1.0, dValue) ); - } + //-------------------------------------------------------------------------------- + // Vml_1_65536_Or_Percentage 14.2.2.11 (brightness) + //-------------------------------------------------------------------------------- - void SetValue(int nValue) - { - m_dValue = (std::max)( 0.0, (std::min)( 65536.0, (double) nValue) ) / 65536.0; - } - void SetPercentage(double dValue) - { - m_dValue = (std::max)( 0.0, (std::min)( 100.0, dValue ) ) / 100.0; - } + class CVml_1_65536_Or_Percentage + { + public: + CVml_1_65536_Or_Percentage(); - virtual double FromString(std::wstring &sValue) - { - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + double GetValue() const; - bool bFraction = ( 'f' == sValue[ nLen - 1] ); - bool bPercentage = ( '%' == sValue[ nLen - 1] ); + void SetValue(double dValue); + void SetValue(int nValue); + void SetPercentage(double dValue); - if ( bFraction ) - { - std::wstring strValue = sValue.substr( 0, nLen - 1 ); - int nValue = strValue.empty() ? 0 : _wtoi(strValue.c_str() ); + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - SetValue( nValue ); - } - else if ( bPercentage ) - { - std::wstring strValue = sValue.substr( 0, nLen - 1 ); - double dValue = XmlUtils::GetDouble(strValue); - - SetPercentage( dValue ); - } - else - { - double dValue = XmlUtils::GetDouble(sValue); - SetValue( dValue ); - } - - return m_dValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = boost::lexical_cast( m_dValue ); - - return sResult; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_1_65536_Or_Percentage) + SimpleTypes_DefaultD(CVml_1_65536_Or_Percentage) private: - double m_dValue; - }; - //-------------------------------------------------------------------------------- - // Vml_Matrix 14.1.2.18 (matrix) - //-------------------------------------------------------------------------------- - class CVml_Matrix - { - public: - CVml_Matrix() - { - ResetMatrix(); - } - CVml_Matrix(const CVml_Matrix &oOther)\ - { - ResetMatrix(); - FromString( oOther.ToString() ); - } - CVml_Matrix(std::wstring &sValue) - { - ResetMatrix(); - FromString( sValue ); - } - CVml_Matrix(const wchar_t* cwsValue) - { - ResetMatrix(); - FromString( cwsValue ); - } - CVml_Matrix(const std::wstring& wsStr) - { - ResetMatrix(); - FromString( wsStr ); - } - const CVml_Matrix &operator =(std::wstring &sValue) - { - FromString( sValue ); - return *this; - } - const CVml_Matrix &operator =(const wchar_t* cwsString) - { - FromString( cwsString ); - return *this; - } - const CVml_Matrix &operator =(const std::wstring& wsStr) - { - FromString( wsStr ); - return *this; - } + }; - void ResetMatrix() - { - m_dSxx = 1; m_dSxy = 0; - m_dSyx = 0; m_dSyy = 1; - m_dPx = 0; m_dPy = 0; - } - void SetMatrix(double dSxx, double dSxy, double dSyx, double dSyy, double dPx, double dPy) - { - m_dSxx = dSxx; m_dSxy = dSxy; - m_dSyx = dSyx; m_dSyy = dSyy; - m_dPx = dPx; m_dPy = dPy; - } + //-------------------------------------------------------------------------------- + // Vml_Matrix 14.1.2.18 (matrix) + //-------------------------------------------------------------------------------- - double Get_Sxx() const - { - return m_dSxx; - } - double Get_Sxy() const - { - return m_dSxy; - } - double Get_Syx() const - { - return m_dSyx; - } - double Get_Syy() const - { - return m_dSyy; - } + class CVml_Matrix + { + public: + CVml_Matrix(); + CVml_Matrix(const CVml_Matrix &oOther); + CVml_Matrix(const std::wstring& wsStr); + CVml_Matrix &operator =(const std::wstring& wsStr); - double Get_Px() const - { - return m_dPx; - } - double Get_Py() const - { - return m_dPy; - } + void ResetMatrix(); + void SetMatrix(double dSxx, double dSxy, double dSyx, double dSyy, double dPx, double dPy); - virtual double FromString(std::wstring &sValue) - { - ResetMatrix(); + double Get_Sxx() const; + double Get_Sxy() const; + double Get_Syx() const; + double Get_Syy() const; - int nLen = (int)sValue.length(); - if ( nLen <= 0 ) - return 0; + double Get_Px() const; + double Get_Py() const; - // Sxx - int nStartPos = 0; - int nEndPos = (int)sValue.find( _T(","), nStartPos ); - if ( -1 == nEndPos ) - nEndPos = nLen; + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - if ( nEndPos - nStartPos > 0 ) - { - std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); - m_dSxx = XmlUtils::GetDouble(strValue); - } + private: + double m_dSxx; + double m_dSxy; + double m_dSyx; + double m_dSyy; + double m_dPx; + double m_dPy; + }; - // Sxy - nStartPos = nEndPos + 1; - nEndPos = (int)sValue.find( _T(","), nStartPos ); - if ( -1 == nEndPos ) - nEndPos = nLen; + //-------------------------------------------------------------------------------- + // Vml_Vector2D_Units_Or_Percentage + //-------------------------------------------------------------------------------- - if ( nEndPos - nStartPos > 0 ) - { - std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); - m_dSxy = XmlUtils::GetDouble(strValue); - } + class CVml_Vector2D_Units_Or_Percentage + { + public: + CVml_Vector2D_Units_Or_Percentage(); - // Syx - nStartPos = nEndPos + 1; - nEndPos = (int)sValue.find( _T(","), nStartPos ); - if ( -1 == nEndPos ) - nEndPos = nLen; + double GetX() const; + double GetY() const; + bool IsXinPoints() const; + bool IsYinPoints() const; + void SetValue_Points(double dX, double dY); - if ( nEndPos - nStartPos > 0 ) - { - std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); - m_dSyx = XmlUtils::GetDouble(strValue); - } + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - // Syy - nStartPos = nEndPos + 1; - nEndPos = (int)sValue.find( _T(","), nStartPos ); - if ( -1 == nEndPos ) - nEndPos = nLen; - - if ( nEndPos - nStartPos > 0 ) - { - std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); - m_dSyy = XmlUtils::GetDouble(strValue); - } - - // Px - nStartPos = nEndPos + 1; - nEndPos = (int)sValue.find( _T(","), nStartPos ); - if ( -1 == nEndPos ) - nEndPos = nLen; - - if ( nEndPos - nStartPos > 0 ) - { - std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); - m_dPx = XmlUtils::GetDouble(strValue); - } - - // Py - nStartPos = nEndPos + 1; - nEndPos = (int)sValue.find( _T(","), nStartPos ); - if ( -1 == nEndPos ) - nEndPos = nLen; - - if ( nEndPos - nStartPos > 0 ) - { - std::wstring strValue = sValue.substr( nStartPos, nEndPos - nStartPos ); - m_dPy = XmlUtils::GetDouble(strValue); - } - - nStartPos = nEndPos + 1; - return 0; - } - - virtual std::wstring ToString () const - { - return boost::lexical_cast(m_dSxx) + L"," + boost::lexical_cast(m_dSxy) + L"," + - boost::lexical_cast(m_dSyx) + L"," + boost::lexical_cast(m_dSyy) + L"," + - boost::lexical_cast(m_dPx) + L"," + boost::lexical_cast(m_dPy); - } - - SimpleType_FromString2 (double) + SimpleTypes_DefaultString(CVml_Vector2D_Units_Or_Percentage) private: - - double m_dSxx; - double m_dSxy; - double m_dSyx; - double m_dSyy; - double m_dPx; - double m_dPy; - - }; - //-------------------------------------------------------------------------------- - // Vml_Vector2D_Units_Or_Percentage - //-------------------------------------------------------------------------------- - class CVml_Vector2D_Units_Or_Percentage - { - public: - CVml_Vector2D_Units_Or_Percentage() - { - m_dX = 0; - m_dY = 0; - m_bUnitsX = true; - m_bUnitsY = true; - } - - double GetX() const - { - return m_dX; - } - double GetY() const - { - return m_dY; - } - bool IsXinPoints() const - { - return m_bUnitsX; - } - bool IsYinPoints() const - { - return m_bUnitsY; - } - void SetValue_Points(double dX, double dY) - { - m_dX = dX; - m_dY = dY; - - m_bUnitsX = true; - m_bUnitsY = true; - } - - virtual double FromString(std::wstring &sValue) - { - m_dX = 0; - m_dY = 0; - m_bUnitsX = true; - m_bUnitsY = true; - - int nLen = (int)sValue.length(); - if ( nLen < 1) - return 0; - - int nPos = (int)sValue.find( _T(",") ); - if ( -1 == nPos ) - return 0; - - std::wstring sTemp = sValue.substr( 0, nPos ); - if ( -1 != sTemp.find( '%' ) ) - { - SimpleTypes::CPercentage oPerc = sTemp; - m_dX = oPerc.GetValue(); - m_bUnitsX = false; - } - else - { - SimpleTypes::CPoint oPt = sTemp; - m_dX = oPt.GetValue(); - m_bUnitsX = true; - } - - sTemp = sValue.substr( nPos + 1, nLen - nPos - 1 ); - if ( -1 != sTemp.find( '%' ) ) - { - SimpleTypes::CPercentage oPerc = sTemp; - m_dY = oPerc.GetValue(); - m_bUnitsY = false; - } - else - { - SimpleTypes::CPoint oPt = sTemp; - m_dY = oPt.GetValue(); - m_bUnitsY = true; - } - - return 0; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = boost::lexical_cast(m_dX); - - if ( m_bUnitsX ) sResult += L"pt,"; - else sResult += L"%,"; - - sResult += boost::lexical_cast(m_dY); - - if ( m_bUnitsY ) sResult += L"pt"; - else sResult += L"%"; - - return sResult; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_Vector2D_Units_Or_Percentage) - - private: - double m_dX; // - double m_dY; // + double m_dY; // - bool m_bUnitsX; - bool m_bUnitsY; - }; - //-------------------------------------------------------------------------------- - // Vml_TextBoxInset 14.1.2.22 (inset) - //-------------------------------------------------------------------------------- - class CVml_TextBoxInset - { - public: - CVml_TextBoxInset() - { - Set( 0, 0, 0, 0 ); - } + bool m_bUnitsX; + bool m_bUnitsY; + }; - double GetLeft(int nIndex) const - { - return m_dLeft; - } - double GetTop(int nIndex) const - { - return m_dTop; - } - double GetRight(int nIndex) const - { - return m_dRight; - } - double GetBottom(int nIndex) const - { - return m_dBottom; - } + //-------------------------------------------------------------------------------- + // Vml_TextBoxInset 14.1.2.22 (inset) + //-------------------------------------------------------------------------------- - void Set(double dL, double dT, double dR, double dB) - { - m_dLeft = dL; - m_dTop = dT; - m_dRight = dR; - m_dBottom = dB; - } + class CVml_TextBoxInset + { + public: + CVml_TextBoxInset(); + double GetLeft(int nIndex) const; + double GetTop(int nIndex) const; + double GetRight(int nIndex) const; + double GetBottom(int nIndex) const; - double FromString(std::wstring &sValue) - { - Set( 0, 0, 0, 0 ); + void Set(double dL, double dT, double dR, double dB); - if ( sValue.empty()) - return 0; + double FromString(const std::wstring &sValue); + std::wstring ToString () const; - std::vector arSplit; - - // Разделителями могут быть запятые и пробелы - XmlUtils::replace_all(sValue, L"@", L""); - boost::algorithm::split(arSplit, sValue, boost::algorithm::is_any_of(L", "), boost::algorithm::token_compress_on); - - if (arSplit.size() > 0) - { - SimpleTypes::CPoint oPt = arSplit[0]; - m_dLeft = oPt.GetValue(); - } - - if (arSplit.size() > 1) - { - SimpleTypes::CPoint oPt = arSplit[1]; - m_dTop = oPt.GetValue(); - } - - if (arSplit.size() > 2) - { - SimpleTypes::CPoint oPt = arSplit[2]; - m_dRight = oPt.GetValue(); - } - - if (arSplit.size() > 3) - { - SimpleTypes::CPoint oPt = arSplit[3]; - m_dBottom = oPt.GetValue(); - } - - return 0; - } - - std::wstring ToString () const - { - return boost::lexical_cast(m_dLeft) + L"pt," + boost::lexical_cast(m_dTop) + L"pt," + boost::lexical_cast(m_dRight) + L"pt,"+ boost::lexical_cast(m_dBottom) + L"pt"; - } - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CVml_TextBoxInset) + SimpleTypes_DefaultString(CVml_TextBoxInset) private: - double m_dLeft; - double m_dTop; - double m_dRight; - double m_dBottom; - }; - } // Vml + double m_dTop; + double m_dRight; + double m_dBottom; + }; + +} // Vml } // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Word.cpp b/Common/DocxFormat/Source/Common/SimpleTypes_Word.cpp index 8c9857ce0b..c52319443c 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Word.cpp +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Word.cpp @@ -32,15 +32,1774 @@ #include "SimpleTypes_Word.h" #include "SimpleTypes_Drawing.h" +#include "boost/lexical_cast.hpp" +#include "boost/format.hpp" +#include "../Base/Unit.h" + namespace SimpleTypes -{ - template<> - EHexColor CHexColor::FromString (std::wstring &sValue) - { - if ( _T("auto") == sValue || _T("none") == sValue ) - this->m_eValue = hexcolorAuto; - else - { +{ + //-------------------------------------------------------------------------------- + // AnnotationVMerge 17.18.1 (Part 1) + //-------------------------------------------------------------------------------- + + EAnnotationVMerge CAnnotationVMerge::FromString(const std::wstring &sValue) + { + if ( (L"cont") == sValue ) this->m_eValue = annotvmergeCont; + else if ( (L"rest") == sValue ) this->m_eValue = annotvmergeRest; + else this->m_eValue = annotvmergeCont; + + return this->m_eValue; + } + + std::wstring CAnnotationVMerge::ToString() const + { + switch(this->m_eValue) + { + case annotvmergeCont : return (L"cont"); + case annotvmergeRest : return (L"rest"); + default : return (L"cont"); + } + } + + //-------------------------------------------------------------------------------- + // Border 17.18.2 (Part 1) + //-------------------------------------------------------------------------------- + + EBorder CBorder::FromString(const std::wstring &sValue) + { + wchar_t wsFirstChar = 0; + + if ( sValue.length() > 0 ) + wsFirstChar = sValue[0]; + + EBorder eDefValue = bordervalueNone; + + switch(wsFirstChar) + { + case 'a': + { + if ( (L"apples") == sValue ) this->m_eValue = bordervalueApples; + else if ( (L"archedScallops") == sValue ) this->m_eValue = bordervalueArchedScallops; + else this->m_eValue = eDefValue; + break; + } + case 'b': + { + if ( (L"babyPacifier") == sValue ) this->m_eValue = bordervalueBabyPacifier; + else if ( (L"babyRattle") == sValue ) this->m_eValue = bordervalueBabyRattle; + else if ( (L"balloons3Colors") == sValue ) this->m_eValue = bordervalueBalloons3Colors; + else if ( (L"balloonsHotAir") == sValue ) this->m_eValue = bordervalueBalloonsHotAir; + else if ( (L"basicBlackDashes") == sValue ) this->m_eValue = bordervalueBasicBlackDashes; + else if ( (L"basicBlackDots") == sValue ) this->m_eValue = bordervalueBasicBlackDots; + else if ( (L"basicBlackSquares") == sValue ) this->m_eValue = bordervalueBasicBlackSquares; + else if ( (L"basicThinLines") == sValue ) this->m_eValue = bordervalueBasicThinLines; + else if ( (L"basicWhiteDashes") == sValue ) this->m_eValue = bordervalueBasicWhiteDashes; + else if ( (L"basicWhiteDots") == sValue ) this->m_eValue = bordervalueBasicWhiteDots; + else if ( (L"basicWhiteSquares") == sValue ) this->m_eValue = bordervalueBasicWhiteSquares; + else if ( (L"basicWideInline") == sValue ) this->m_eValue = bordervalueBasicWideInline; + else if ( (L"basicWideMidline") == sValue ) this->m_eValue = bordervalueBasicWideMidline; + else if ( (L"basicWideOutline") == sValue ) this->m_eValue = bordervalueBasicWideOutline; + else if ( (L"bats") == sValue ) this->m_eValue = bordervalueBats; + else if ( (L"birds") == sValue ) this->m_eValue = bordervalueBirds; + else if ( (L"birdsFlight") == sValue ) this->m_eValue = bordervalueBirdsFlight; + else this->m_eValue = eDefValue; + break; + } + case 'c': + { + if ( (L"cabins") == sValue ) this->m_eValue = bordervalueCabins; + else if ( (L"cakeSlice") == sValue ) this->m_eValue = bordervalueCakeSlice; + else if ( (L"candyCorn") == sValue ) this->m_eValue = bordervalueCandyCorn; + else if ( (L"celticKnotwork") == sValue ) this->m_eValue = bordervalueCelticKnotwork; + else if ( (L"certificateBanner") == sValue ) this->m_eValue = bordervalueCertificateBanner; + else if ( (L"chainLink") == sValue ) this->m_eValue = bordervalueChainLink; + else if ( (L"champagneBottle") == sValue ) this->m_eValue = bordervalueChampagneBottle; + else if ( (L"checkedBarBlack") == sValue ) this->m_eValue = bordervalueCheckedBarBlack; + else if ( (L"checkedBarColor") == sValue ) this->m_eValue = bordervalueCheckedBarColor; + else if ( (L"checkered") == sValue ) this->m_eValue = bordervalueCheckered; + else if ( (L"christmasTree") == sValue ) this->m_eValue = bordervalueChristmasTree; + else if ( (L"circlesLines") == sValue ) this->m_eValue = bordervalueCirclesLines; + else if ( (L"circlesRectangles") == sValue ) this->m_eValue = bordervalueCirclesRectangles; + else if ( (L"classicalWave") == sValue ) this->m_eValue = bordervalueClassicalWave; + else if ( (L"clocks") == sValue ) this->m_eValue = bordervalueClocks; + else if ( (L"compass") == sValue ) this->m_eValue = bordervalueCompass; + else if ( (L"confetti") == sValue ) this->m_eValue = bordervalueConfetti; + else if ( (L"confettiGrays") == sValue ) this->m_eValue = bordervalueConfettiGrays; + else if ( (L"confettiOutline") == sValue ) this->m_eValue = bordervalueConfettiOutline; + else if ( (L"confettiStreamers") == sValue ) this->m_eValue = bordervalueConfettiStreamers; + else if ( (L"confettiWhite") == sValue ) this->m_eValue = bordervalueConfettiWhite; + else if ( (L"cornerTriangles") == sValue ) this->m_eValue = bordervalueCornerTriangles; + else if ( (L"couponCutoutDashes") == sValue ) this->m_eValue = bordervalueCouponCutoutDashes; + else if ( (L"couponCutoutDots") == sValue ) this->m_eValue = bordervalueCouponCutoutDots; + else if ( (L"crazyMaze") == sValue ) this->m_eValue = bordervalueCrazyMaze; + else if ( (L"creaturesButterfly") == sValue ) this->m_eValue = bordervalueCreaturesButterfly; + else if ( (L"creaturesFish") == sValue ) this->m_eValue = bordervalueCreaturesFish; + else if ( (L"creaturesInsects") == sValue ) this->m_eValue = bordervalueCreaturesInsects; + else if ( (L"creaturesLadyBug") == sValue ) this->m_eValue = bordervalueCreaturesLadyBug; + else if ( (L"crossStitch") == sValue ) this->m_eValue = bordervalueCrossStitch; + else if ( (L"cup") == sValue ) this->m_eValue = bordervalueCup; + else if ( (L"custom") == sValue ) this->m_eValue = bordervalueCustom; + else this->m_eValue = eDefValue; + break; + } + case 'd': + { + if ( (L"dashDotStroked") == sValue ) this->m_eValue = bordervalueDashDotStroked; + else if ( (L"dashed") == sValue ) this->m_eValue = bordervalueDashed; + else if ( (L"dashSmallGap") == sValue ) this->m_eValue = bordervalueDashSmallGap; + else if ( (L"decoArch") == sValue ) this->m_eValue = bordervalueDecoArch; + else if ( (L"decoArchColor") == sValue ) this->m_eValue = bordervalueDecoArchColor; + else if ( (L"decoBlocks") == sValue ) this->m_eValue = bordervalueDecoBlocks; + else if ( (L"diamondsGray") == sValue ) this->m_eValue = bordervalueDiamondsGray; + else if ( (L"dotDash") == sValue ) this->m_eValue = bordervalueDotDash; + else if ( (L"dotDotDash") == sValue ) this->m_eValue = bordervalueDotDotDash; + else if ( (L"dotted") == sValue ) this->m_eValue = bordervalueDotted; + else if ( (L"double") == sValue ) this->m_eValue = bordervalueDouble; + else if ( (L"doubleD") == sValue ) this->m_eValue = bordervalueDoubleD; + else if ( (L"doubleDiamonds") == sValue ) this->m_eValue = bordervalueDoubleDiamonds; + else if ( (L"doubleWave") == sValue ) this->m_eValue = bordervalueDoubleWave; + else this->m_eValue = eDefValue; + break; + } + case 'e': + { + if ( (L"earth1") == sValue ) this->m_eValue = bordervalueEarth1; + else if ( (L"earth2") == sValue ) this->m_eValue = bordervalueEarth2; + else if ( (L"earth3") == sValue ) this->m_eValue = bordervalueEarth3; + else if ( (L"eclipsingSquares1") == sValue ) this->m_eValue = bordervalueEclipsingSquares1; + else if ( (L"eclipsingSquares2") == sValue ) this->m_eValue = bordervalueEclipsingSquares2; + else if ( (L"eggsBlack") == sValue ) this->m_eValue = bordervalueEggsBlack; + else this->m_eValue = eDefValue; + break; + } + case 'f': + { + if ( (L"fans") == sValue ) this->m_eValue = bordervalueFans; + else if ( (L"film") == sValue ) this->m_eValue = bordervalueFilm; + else if ( (L"firecrackers") == sValue ) this->m_eValue = bordervalueFirecrackers; + else if ( (L"flowersBlockPrint") == sValue ) this->m_eValue = bordervalueFlowersBlockPrint; + else if ( (L"flowersDaisies") == sValue ) this->m_eValue = bordervalueFlowersDaisies; + else if ( (L"flowersModern1") == sValue ) this->m_eValue = bordervalueFlowersModern1; + else if ( (L"flowersModern2") == sValue ) this->m_eValue = bordervalueFlowersModern2; + else if ( (L"flowersPansy") == sValue ) this->m_eValue = bordervalueFlowersPansy; + else if ( (L"flowersRedRose") == sValue ) this->m_eValue = bordervalueFlowersRedRose; + else if ( (L"flowersRoses") == sValue ) this->m_eValue = bordervalueFlowersRoses; + else if ( (L"flowersTeacup") == sValue ) this->m_eValue = bordervalueFlowersTeacup; + else if ( (L"flowersTiny") == sValue ) this->m_eValue = bordervalueFlowersTiny; + else this->m_eValue = eDefValue; + break; + } + case 'g': + { + if ( (L"gems") == sValue ) this->m_eValue = bordervalueGems; + else if ( (L"gingerbreadMan") == sValue ) this->m_eValue = bordervalueGingerbreadMan; + else if ( (L"gradient") == sValue ) this->m_eValue = bordervalueGradient; + else this->m_eValue = eDefValue; + break; + } + case 'h': + { + if ( (L"handmade1") == sValue ) this->m_eValue = bordervalueHandmade1; + else if ( (L"handmade2") == sValue ) this->m_eValue = bordervalueHandmade2; + else if ( (L"heartBalloon") == sValue ) this->m_eValue = bordervalueHeartBalloon; + else if ( (L"heartGray") == sValue ) this->m_eValue = bordervalueHeartGray; + else if ( (L"hearts") == sValue ) this->m_eValue = bordervalueHearts; + else if ( (L"heebieJeebies") == sValue ) this->m_eValue = bordervalueHeebieJeebies; + else if ( (L"holly") == sValue ) this->m_eValue = bordervalueHolly; + else if ( (L"houseFunky") == sValue ) this->m_eValue = bordervalueHouseFunky; + else if ( (L"hypnotic") == sValue ) this->m_eValue = bordervalueHypnotic; + else this->m_eValue = eDefValue; + break; + } + case 'i': + { + if ( (L"iceCreamCones") == sValue ) this->m_eValue = bordervalueIceCreamCones; + else if ( (L"inset") == sValue ) this->m_eValue = bordervalueInset; + else this->m_eValue = eDefValue; + break; + } + case 'l': + { + if ( (L"lightBulb") == sValue ) this->m_eValue = bordervalueLightBulb; + else if ( (L"lightning1") == sValue ) this->m_eValue = bordervalueLightning1; + else if ( (L"lightning2") == sValue ) this->m_eValue = bordervalueLightning2; + else this->m_eValue = eDefValue; + break; + } + case 'm': + { + if ( (L"mapleLeaf") == sValue ) this->m_eValue = bordervalueMapleLeaf; + else if ( (L"mapleMuffins") == sValue ) this->m_eValue = bordervalueMapleMuffins; + else if ( (L"mapPins") == sValue ) this->m_eValue = bordervalueMapPins; + else if ( (L"marquee") == sValue ) this->m_eValue = bordervalueMarquee; + else if ( (L"marqueeToothed") == sValue ) this->m_eValue = bordervalueMarqueeToothed; + else if ( (L"moons") == sValue ) this->m_eValue = bordervalueMoons; + else if ( (L"mosaic") == sValue ) this->m_eValue = bordervalueMosaic; + else if ( (L"musicNotes") == sValue ) this->m_eValue = bordervalueMusicNotes; + else this->m_eValue = eDefValue; + break; + } + case 'n': + { + if ( (L"nil") == sValue ) this->m_eValue = bordervalueNil; + else if ( (L"none") == sValue ) this->m_eValue = bordervalueNone; + else if ( (L"northwest") == sValue ) this->m_eValue = bordervalueNorthwest; + else this->m_eValue = eDefValue; + break; + } + case 'o': + { + if ( (L"outset") == sValue ) this->m_eValue = bordervalueOutset; + else if ( (L"ovals") == sValue ) this->m_eValue = bordervalueOvals; + else this->m_eValue = eDefValue; + break; + } + case 'p': + { + if ( (L"packages") == sValue ) this->m_eValue = bordervaluePackages; + else if ( (L"palmsBlack") == sValue ) this->m_eValue = bordervaluePalmsBlack; + else if ( (L"palmsColor") == sValue ) this->m_eValue = bordervaluePalmsColor; + else if ( (L"paperClips") == sValue ) this->m_eValue = bordervaluePaperClips; + else if ( (L"papyrus") == sValue ) this->m_eValue = bordervaluePapyrus; + else if ( (L"partyFavor") == sValue ) this->m_eValue = bordervaluePartyFavor; + else if ( (L"partyGlass") == sValue ) this->m_eValue = bordervaluePartyGlass; + else if ( (L"pencils") == sValue ) this->m_eValue = bordervaluePencils; + else if ( (L"people") == sValue ) this->m_eValue = bordervaluePeople; + else if ( (L"peopleHats") == sValue ) this->m_eValue = bordervaluePeopleHats; + else if ( (L"peopleWaving") == sValue ) this->m_eValue = bordervaluePeopleWaving; + else if ( (L"poinsettias") == sValue ) this->m_eValue = bordervaluePoinsettias; + else if ( (L"postageStamp") == sValue ) this->m_eValue = bordervaluePostageStamp; + else if ( (L"pumpkin1") == sValue ) this->m_eValue = bordervaluePumpkin1; + else if ( (L"pushPinNote1") == sValue ) this->m_eValue = bordervaluePushPinNote1; + else if ( (L"pushPinNote2") == sValue ) this->m_eValue = bordervaluePushPinNote2; + else if ( (L"pyramids") == sValue ) this->m_eValue = bordervaluePyramids; + else if ( (L"pyramidsAbove") == sValue ) this->m_eValue = bordervaluePyramidsAbove; + else this->m_eValue = eDefValue; + break; + } + case 'q': + { + if ( (L"quadrants") == sValue ) this->m_eValue = bordervalueQuadrants; + else this->m_eValue = eDefValue; + break; + } + case 'r': + { + if ( (L"rings") == sValue ) this->m_eValue = bordervalueRings; + else this->m_eValue = eDefValue; + break; + } + case 's': + { + if ( (L"safari") == sValue ) this->m_eValue = bordervalueSafari; + else if ( (L"sawtooth") == sValue ) this->m_eValue = bordervalueSawtooth; + else if ( (L"sawtoothGray") == sValue ) this->m_eValue = bordervalueSawtoothGray; + else if ( (L"scaredCat") == sValue ) this->m_eValue = bordervalueScaredCat; + else if ( (L"seattle") == sValue ) this->m_eValue = bordervalueSeattle; + else if ( (L"shadowedSquares") == sValue ) this->m_eValue = bordervalueShadowedSquares; + else if ( (L"shapes1") == sValue ) this->m_eValue = bordervalueShapes1; + else if ( (L"shapes2") == sValue ) this->m_eValue = bordervalueShapes2; + else if ( (L"sharksTeeth") == sValue ) this->m_eValue = bordervalueSharksTeeth; + else if ( (L"shorebirdTracks") == sValue ) this->m_eValue = bordervalueShorebirdTracks; + else if ( (L"single") == sValue ) this->m_eValue = bordervalueSingle; + else if ( (L"skyrocket") == sValue ) this->m_eValue = bordervalueSkyrocket; + else if ( (L"snowflakeFancy") == sValue ) this->m_eValue = bordervalueSnowflakeFancy; + else if ( (L"snowflakes") == sValue ) this->m_eValue = bordervalueSnowflakes; + else if ( (L"sombrero") == sValue ) this->m_eValue = bordervalueSombrero; + else if ( (L"southwest") == sValue ) this->m_eValue = bordervalueSouthwest; + else if ( (L"stars") == sValue ) this->m_eValue = bordervalueStars; + else if ( (L"stars3d") == sValue ) this->m_eValue = bordervalueStars3d; + else if ( (L"starsBlack") == sValue ) this->m_eValue = bordervalueStarsBlack; + else if ( (L"starsShadowed") == sValue ) this->m_eValue = bordervalueStarsShadowed; + else if ( (L"starsTop") == sValue ) this->m_eValue = bordervalueStarsTop; + else if ( (L"sun") == sValue ) this->m_eValue = bordervalueSun; + else if ( (L"swirligig") == sValue ) this->m_eValue = bordervalueSwirligig; + else this->m_eValue = eDefValue; + break; + } + case 't': + { + if ( (L"thick") == sValue ) this->m_eValue = bordervalueThick; + else if ( (L"thickThinLargeGap") == sValue ) this->m_eValue = bordervalueThickThinLargeGap; + else if ( (L"thickThinMediumGap") == sValue ) this->m_eValue = bordervalueThickThinMediumGap; + else if ( (L"thickThinSmallGap") == sValue ) this->m_eValue = bordervalueThickThinSmallGap; + else if ( (L"thinThickLargeGap") == sValue ) this->m_eValue = bordervalueThinThickLargeGap; + else if ( (L"thinThickMediumGap") == sValue ) this->m_eValue = bordervalueThinThickMediumGap; + else if ( (L"thinThickSmallGap") == sValue ) this->m_eValue = bordervalueThinThickSmallGap; + else if ( (L"thinThickThinLargeGap") == sValue ) this->m_eValue = bordervalueThinThickThinLargeGap; + else if ( (L"thinThickThinMediumGap") == sValue ) this->m_eValue = bordervalueThinThickThinMediumGap; + else if ( (L"thinThickThinSmallGap") == sValue ) this->m_eValue = bordervalueThinThickThinSmallGap; + else if ( (L"threeDEmboss") == sValue ) this->m_eValue = bordervalueThreeDEmboss; + else if ( (L"threeDEngrave") == sValue ) this->m_eValue = bordervalueThreeDEngrave; + else if ( (L"tornPaper") == sValue ) this->m_eValue = bordervalueTornPaper; + else if ( (L"tornPaperBlack") == sValue ) this->m_eValue = bordervalueTornPaperBlack; + else if ( (L"trees") == sValue ) this->m_eValue = bordervalueTrees; + else if ( (L"triangle1") == sValue ) this->m_eValue = bordervalueTriangle1; + else if ( (L"triangle2") == sValue ) this->m_eValue = bordervalueTriangle2; + else if ( (L"triangleCircle1") == sValue ) this->m_eValue = bordervalueTriangleCircle1; + else if ( (L"triangleCircle2") == sValue ) this->m_eValue = bordervalueTriangleCircle2; + else if ( (L"triangleParty") == sValue ) this->m_eValue = bordervalueTriangleParty; + else if ( (L"triangles") == sValue ) this->m_eValue = bordervalueTriangles; + else if ( (L"triple") == sValue ) this->m_eValue = bordervalueTriple; + else if ( (L"twistedLines1") == sValue ) this->m_eValue = bordervalueTwistedLines1; + else if ( (L"twistedLines2") == sValue ) this->m_eValue = bordervalueTwistedLines2; + else this->m_eValue = eDefValue; + break; + } + case 'v': + { + if ( (L"vine") == sValue ) this->m_eValue = bordervalueVine; + else this->m_eValue = eDefValue; + break; + } + case 'w': + { + if ( (L"wave") == sValue ) this->m_eValue = bordervalueWave; + else if ( (L"waveline") == sValue ) this->m_eValue = bordervalueWaveline; + else if ( (L"weavingAngles") == sValue ) this->m_eValue = bordervalueWeavingAngles; + else if ( (L"weavingBraid") == sValue ) this->m_eValue = bordervalueWeavingBraid; + else if ( (L"weavingRibbon") == sValue ) this->m_eValue = bordervalueWeavingRibbon; + else if ( (L"weavingStrips") == sValue ) this->m_eValue = bordervalueWeavingStrips; + else if ( (L"whiteFlowers") == sValue ) this->m_eValue = bordervalueWhiteFlowers; + else if ( (L"woodwork") == sValue ) this->m_eValue = bordervalueWoodwork; + else this->m_eValue = eDefValue; + break; + } + case 'x': + { + if ( (L"xIllusions") == sValue ) this->m_eValue = bordervalueXIllusions; + else this->m_eValue = eDefValue; + break; + } + case 'z': + { + if ( (L"zanyTriangles") == sValue ) this->m_eValue = bordervalueZanyTriangles; + else if ( (L"zigZag") == sValue ) this->m_eValue = bordervalueZigZag; + else if ( (L"zigZagStitch") == sValue ) this->m_eValue = bordervalueZigZagStitch; + else this->m_eValue = eDefValue; + break; + } + default: + { + this->m_eValue = eDefValue; + break; + } + } + + return this->m_eValue; + } + + std::wstring CBorder::ToString () const + { + switch(this->m_eValue) + { + case bordervalueApples : return (L"apples"); + case bordervalueArchedScallops : return (L"archedScallops"); + case bordervalueBabyPacifier : return (L"babyPacifier"); + case bordervalueBabyRattle : return (L"babyRattle"); + case bordervalueBalloons3Colors : return (L"balloons3Colors"); + case bordervalueBalloonsHotAir : return (L"balloonsHotAir"); + case bordervalueBasicBlackDashes : return (L"basicBlackDashes"); + case bordervalueBasicBlackDots : return (L"basicBlackDots"); + case bordervalueBasicBlackSquares : return (L"basicBlackSquares"); + case bordervalueBasicThinLines : return (L"basicThinLines"); + case bordervalueBasicWhiteDashes : return (L"basicWhiteDashes"); + case bordervalueBasicWhiteDots : return (L"basicWhiteDots"); + case bordervalueBasicWhiteSquares : return (L"basicWhiteSquares"); + case bordervalueBasicWideInline : return (L"basicWideInline"); + case bordervalueBasicWideMidline : return (L"basicWideMidline"); + case bordervalueBasicWideOutline : return (L"basicWideOutline"); + case bordervalueBats : return (L"bats"); + case bordervalueBirds : return (L"birds"); + case bordervalueBirdsFlight : return (L"birdsFlight"); + case bordervalueCabins : return (L"cabins"); + case bordervalueCakeSlice : return (L"cakeSlice"); + case bordervalueCandyCorn : return (L"candyCorn"); + case bordervalueCelticKnotwork : return (L"celticKnotwork"); + case bordervalueCertificateBanner : return (L"certificateBanner"); + case bordervalueChainLink : return (L"chainLink"); + case bordervalueChampagneBottle : return (L"champagneBottle"); + case bordervalueCheckedBarBlack : return (L"checkedBarBlack"); + case bordervalueCheckedBarColor : return (L"checkedBarColor"); + case bordervalueCheckered : return (L"checkered"); + case bordervalueChristmasTree : return (L"christmasTree"); + case bordervalueCirclesLines : return (L"circlesLines"); + case bordervalueCirclesRectangles : return (L"circlesRectangles"); + case bordervalueClassicalWave : return (L"classicalWave"); + case bordervalueClocks : return (L"clocks"); + case bordervalueCompass : return (L"compass"); + case bordervalueConfetti : return (L"confetti"); + case bordervalueConfettiGrays : return (L"confettiGrays"); + case bordervalueConfettiOutline : return (L"confettiOutline"); + case bordervalueConfettiStreamers : return (L"confettiStreamers"); + case bordervalueConfettiWhite : return (L"confettiWhite"); + case bordervalueCornerTriangles : return (L"cornerTriangles"); + case bordervalueCouponCutoutDashes : return (L"couponCutoutDashes"); + case bordervalueCouponCutoutDots : return (L"couponCutoutDots"); + case bordervalueCrazyMaze : return (L"crazyMaze"); + case bordervalueCreaturesButterfly : return (L"creaturesButterfly"); + case bordervalueCreaturesFish : return (L"creaturesFish"); + case bordervalueCreaturesInsects : return (L"creaturesInsects"); + case bordervalueCreaturesLadyBug : return (L"creaturesLadyBug"); + case bordervalueCrossStitch : return (L"crossStitch"); + case bordervalueCup : return (L"cup"); + case bordervalueCustom : return (L"custom"); + case bordervalueDashDotStroked : return (L"dashDotStroked"); + case bordervalueDashed : return (L"dashed"); + case bordervalueDashSmallGap : return (L"dashSmallGap"); + case bordervalueDecoArch : return (L"decoArch"); + case bordervalueDecoArchColor : return (L"decoArchColor"); + case bordervalueDecoBlocks : return (L"decoBlocks"); + case bordervalueDiamondsGray : return (L"diamondsGray"); + case bordervalueDotDash : return (L"dotDash"); + case bordervalueDotDotDash : return (L"dotDotDash"); + case bordervalueDotted : return (L"dotted"); + case bordervalueDouble : return (L"double"); + case bordervalueDoubleD : return (L"doubleD"); + case bordervalueDoubleDiamonds : return (L"doubleDiamonds"); + case bordervalueDoubleWave : return (L"doubleWave"); + case bordervalueEarth1 : return (L"earth1"); + case bordervalueEarth2 : return (L"earth2"); + case bordervalueEarth3 : return (L"earth3"); + case bordervalueEclipsingSquares1 : return (L"eclipsingSquares1"); + case bordervalueEclipsingSquares2 : return (L"eclipsingSquares2"); + case bordervalueEggsBlack : return (L"eggsBlack"); + case bordervalueFans : return (L"fans"); + case bordervalueFilm : return (L"film"); + case bordervalueFirecrackers : return (L"firecrackers"); + case bordervalueFlowersBlockPrint : return (L"flowersBlockPrint"); + case bordervalueFlowersDaisies : return (L"flowersDaisies"); + case bordervalueFlowersModern1 : return (L"flowersModern1"); + case bordervalueFlowersModern2 : return (L"flowersModern2"); + case bordervalueFlowersPansy : return (L"flowersPansy"); + case bordervalueFlowersRedRose : return (L"flowersRedRose"); + case bordervalueFlowersRoses : return (L"flowersRoses"); + case bordervalueFlowersTeacup : return (L"flowersTeacup"); + case bordervalueFlowersTiny : return (L"flowersTiny"); + case bordervalueGems : return (L"gems"); + case bordervalueGingerbreadMan : return (L"gingerbreadMan"); + case bordervalueGradient : return (L"gradient"); + case bordervalueHandmade1 : return (L"handmade1"); + case bordervalueHandmade2 : return (L"handmade2"); + case bordervalueHeartBalloon : return (L"heartBalloon"); + case bordervalueHeartGray : return (L"heartGray"); + case bordervalueHearts : return (L"hearts"); + case bordervalueHeebieJeebies : return (L"heebieJeebies"); + case bordervalueHolly : return (L"holly"); + case bordervalueHouseFunky : return (L"houseFunky"); + case bordervalueHypnotic : return (L"hypnotic"); + case bordervalueIceCreamCones : return (L"iceCreamCones"); + case bordervalueInset : return (L"inset"); + case bordervalueLightBulb : return (L"lightBulb"); + case bordervalueLightning1 : return (L"lightning1"); + case bordervalueLightning2 : return (L"lightning2"); + case bordervalueMapleLeaf : return (L"mapleLeaf"); + case bordervalueMapleMuffins : return (L"mapleMuffins"); + case bordervalueMapPins : return (L"mapPins"); + case bordervalueMarquee : return (L"marquee"); + case bordervalueMarqueeToothed : return (L"marqueeToothed"); + case bordervalueMoons : return (L"moons"); + case bordervalueMosaic : return (L"mosaic"); + case bordervalueMusicNotes : return (L"musicNotes"); + case bordervalueNil : return (L"nil"); + case bordervalueNone : return (L"none"); + case bordervalueNorthwest : return (L"northwest"); + case bordervalueOutset : return (L"outset"); + case bordervalueOvals : return (L"ovals"); + case bordervaluePackages : return (L"packages"); + case bordervaluePalmsBlack : return (L"palmsBlack"); + case bordervaluePalmsColor : return (L"palmsColor"); + case bordervaluePaperClips : return (L"paperClips"); + case bordervaluePapyrus : return (L"papyrus"); + case bordervaluePartyFavor : return (L"partyFavor"); + case bordervaluePartyGlass : return (L"partyGlass"); + case bordervaluePencils : return (L"pencils"); + case bordervaluePeople : return (L"people"); + case bordervaluePeopleHats : return (L"peopleHats"); + case bordervaluePeopleWaving : return (L"peopleWaving"); + case bordervaluePoinsettias : return (L"poinsettias"); + case bordervaluePostageStamp : return (L"postageStamp"); + case bordervaluePumpkin1 : return (L"pumpkin1"); + case bordervaluePushPinNote1 : return (L"pushPinNote1"); + case bordervaluePushPinNote2 : return (L"pushPinNote2"); + case bordervaluePyramids : return (L"pyramids"); + case bordervaluePyramidsAbove : return (L"pyramidsAbove"); + case bordervalueQuadrants : return (L"quadrants"); + case bordervalueRings : return (L"rings"); + case bordervalueSafari : return (L"safari"); + case bordervalueSawtooth : return (L"sawtooth"); + case bordervalueSawtoothGray : return (L"sawtoothGray"); + case bordervalueScaredCat : return (L"scaredCat"); + case bordervalueSeattle : return (L"seattle"); + case bordervalueShadowedSquares : return (L"shadowedSquares"); + case bordervalueShapes1 : return (L"shapes1"); + case bordervalueShapes2 : return (L"shapes2"); + case bordervalueSharksTeeth : return (L"sharksTeeth"); + case bordervalueShorebirdTracks : return (L"shorebirdTracks"); + case bordervalueSingle : return (L"single"); + case bordervalueSkyrocket : return (L"skyrocket"); + case bordervalueSnowflakeFancy : return (L"snowflakeFancy"); + case bordervalueSnowflakes : return (L"snowflakes"); + case bordervalueSombrero : return (L"sombrero"); + case bordervalueSouthwest : return (L"southwest"); + case bordervalueStars : return (L"stars"); + case bordervalueStars3d : return (L"stars3d"); + case bordervalueStarsBlack : return (L"starsBlack"); + case bordervalueStarsShadowed : return (L"starsShadowed"); + case bordervalueStarsTop : return (L"starsTop"); + case bordervalueSun : return (L"sun"); + case bordervalueSwirligig : return (L"swirligig"); + case bordervalueThick : return (L"thick"); + case bordervalueThickThinLargeGap : return (L"thickThinLargeGap"); + case bordervalueThickThinMediumGap : return (L"thickThinMediumGap"); + case bordervalueThickThinSmallGap : return (L"thickThinSmallGap"); + case bordervalueThinThickLargeGap : return (L"thinThickLargeGap"); + case bordervalueThinThickMediumGap : return (L"thinThickMediumGap"); + case bordervalueThinThickSmallGap : return (L"thinThickSmallGap"); + case bordervalueThinThickThinLargeGap : return (L"thinThickThinLargeGap"); + case bordervalueThinThickThinMediumGap: return (L"thinThickThinMediumGap"); + case bordervalueThinThickThinSmallGap : return (L"thinThickThinSmallGap"); + case bordervalueThreeDEmboss : return (L"threeDEmboss"); + case bordervalueThreeDEngrave : return (L"threeDEngrave"); + case bordervalueTornPaper : return (L"tornPaper"); + case bordervalueTornPaperBlack : return (L"tornPaperBlack"); + case bordervalueTrees : return (L"trees"); + case bordervalueTriangle1 : return (L"triangle1"); + case bordervalueTriangle2 : return (L"triangle2"); + case bordervalueTriangleCircle1 : return (L"triangleCircle1"); + case bordervalueTriangleCircle2 : return (L"triangleCircle2"); + case bordervalueTriangleParty : return (L"triangleParty"); + case bordervalueTriangles : return (L"triangles"); + case bordervalueTriple : return (L"triple"); + case bordervalueTwistedLines1 : return (L"twistedLines1"); + case bordervalueTwistedLines2 : return (L"twistedLines2"); + case bordervalueVine : return (L"vine"); + case bordervalueWave : return (L"wave"); + case bordervalueWaveline : return (L"waveline"); + case bordervalueWeavingAngles : return (L"weavingAngles"); + case bordervalueWeavingBraid : return (L"weavingBraid"); + case bordervalueWeavingRibbon : return (L"weavingRibbon"); + case bordervalueWeavingStrips : return (L"weavingStrips"); + case bordervalueWhiteFlowers : return (L"whiteFlowers"); + case bordervalueWoodwork : return (L"woodwork"); + case bordervalueXIllusions : return (L"xIllusions"); + case bordervalueZanyTriangles : return (L"zanyTriangles"); + case bordervalueZigZag : return (L"zigZag"); + case bordervalueZigZagStitch : return (L"zigZagStitch"); + + default : return (L"none"); + } + } + + bool CBorder::IsArtBorder () const + { + return ((int)this->m_eValue > 100); + } + + bool CBorder::IsLineBorder() const + { + return ( (int)this->m_eValue <= 25 && (int)this->m_eValue >= 1 ); + } + + bool CBorder::IsNoBorder () const + { + return ( (int)this->m_eValue <= 0 ); + } + + //-------------------------------------------------------------------------------- + // BrClear 17.18.3 (Part 1) + //-------------------------------------------------------------------------------- + + EBrClear CBrClear::FromString(const std::wstring &sValue) + { + if ( (L"all") == sValue ) this->m_eValue = brclearAll; + else if ( (L"left") == sValue ) this->m_eValue = brclearLeft; + else if ( (L"none") == sValue ) this->m_eValue = brclearNone; + else if ( (L"right") == sValue ) this->m_eValue = brclearRight; + else this->m_eValue = brclearAll; + + return this->m_eValue; + } + + std::wstring CBrClear::ToString () const + { + switch(this->m_eValue) + { + case brclearAll : return (L"all"); + case brclearLeft : return (L"left"); + case brclearNone : return (L"none"); + case brclearRight : return (L"right"); + default : return (L"all"); + } + } + + //-------------------------------------------------------------------------------- + // BrType 17.18.4 (Part 1) + //-------------------------------------------------------------------------------- + + + EBrType CBrType::FromString(const std::wstring &sValue) + { + if ( (L"column") == sValue ) this->m_eValue = brtypeColumn; + else if ( (L"page") == sValue ) this->m_eValue = brtypePage; + else if ( (L"textWrapping") == sValue ) this->m_eValue = brtypeTextWrapping; + else this->m_eValue = brtypePage; + + return this->m_eValue; + } + + std::wstring CBrType::ToString () const + { + switch(this->m_eValue) + { + case brtypeColumn : return (L"column"); + case brtypePage : return (L"page"); + case brtypeTextWrapping : return (L"textWrapping"); + default : return (L"page"); + } + } + + //-------------------------------------------------------------------------------- + // CaptionPos 17.18.5 (Part 1) + //-------------------------------------------------------------------------------- + + ECaptionPos CCaptionPos::FromString(const std::wstring &sValue) + { + if ( (L"above") == sValue ) this->m_eValue = captionposAbove; + else if ( (L"below") == sValue ) this->m_eValue = captionposBelow; + else if ( (L"left") == sValue ) this->m_eValue = captionposLeft; + else if ( (L"right") == sValue ) this->m_eValue = captionposRight; + else this->m_eValue = captionposAbove; + + return this->m_eValue; + } + + std::wstring CCaptionPos::ToString () const + { + switch(this->m_eValue) + { + case captionposAbove : return (L"above"); + case captionposBelow : return (L"below"); + case captionposLeft : return (L"left"); + case captionposRight : return (L"right"); + default : return (L"above"); + } + } + + //-------------------------------------------------------------------------------- + // ChapterSep 17.18.6 (Part 1) + //-------------------------------------------------------------------------------- + + EChapterSep CChapterSep::FromString(const std::wstring &sValue) + { + if ( (L"colon") == sValue ) this->m_eValue = chaptersepColon; + else if ( (L"emDash") == sValue ) this->m_eValue = chaptersepEmDash; + else if ( (L"enDash") == sValue ) this->m_eValue = chaptersepEnDash; + else if ( (L"hyphen") == sValue ) this->m_eValue = chaptersepHyphen; + else if ( (L"period") == sValue ) this->m_eValue = chaptersepPeriod; + else this->m_eValue = chaptersepColon; + + return this->m_eValue; + } + + std::wstring CChapterSep::ToString () const + { + switch(this->m_eValue) + { + case chaptersepColon : return (L"colon"); + case chaptersepEmDash : return (L"emDash"); + case chaptersepEnDash : return (L"enDash"); + case chaptersepHyphen : return (L"hyphen"); + case chaptersepPeriod : return (L"period"); + default : return (L"colon"); + } + } + + //-------------------------------------------------------------------------------- + // CharacterSpacing 17.18.7 (Part 1) + //-------------------------------------------------------------------------------- + + ECharacterSpacing CCharacterSpacing::FromString(const std::wstring &sValue) + { + if ( (L"compressPunctuation") == sValue ) this->m_eValue = charspacingCompressPunctuation; + else if ( (L"compressPunctuationAndJapaneseKana") == sValue ) this->m_eValue = charspacingCompressPunctuationAndJapaneseKana; + else if ( (L"doNotCompress") == sValue ) this->m_eValue = charspacingDoNotCompress; + else this->m_eValue = charspacingDoNotCompress; + + return this->m_eValue; + } + + std::wstring CCharacterSpacing::ToString () const + { + switch(this->m_eValue) + { + case charspacingCompressPunctuation : return (L"compressPunctuation"); + case charspacingCompressPunctuationAndJapaneseKana : return (L"compressPunctuationAndJapaneseKana"); + case charspacingDoNotCompress : return (L"doNotCompress"); + default : return (L"doNotCompress"); + } + } + + //-------------------------------------------------------------------------------- + // CombineBrackets 17.18.8 (Part 1) + //-------------------------------------------------------------------------------- + + + ECombineBrackets CCombineBrackets::FromString(const std::wstring &sValue) + { + if ( (L"angle") == sValue ) this->m_eValue = combinebracketsAngle; + else if ( (L"curly") == sValue ) this->m_eValue = combinebracketsCurly; + else if ( (L"none") == sValue ) this->m_eValue = combinebracketsNone; + else if ( (L"round") == sValue ) this->m_eValue = combinebracketsRound; + else if ( (L"square") == sValue ) this->m_eValue = combinebracketsSquare; + else this->m_eValue = combinebracketsNone; + + return this->m_eValue; + } + + std::wstring CCombineBrackets::ToString () const + { + switch(this->m_eValue) + { + case combinebracketsAngle : return (L"angle"); + case combinebracketsCurly : return (L"curly"); + case combinebracketsNone : return (L"none"); + case combinebracketsRound : return (L"round"); + case combinebracketsSquare : return (L"square"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // DateTime 17.18.9 (Part 1) + //-------------------------------------------------------------------------------- + + CDateTime::CDateTime() {} + + std::wstring CDateTime::GetValue() const + { + return m_sValue; + } + + void CDateTime::SetValue(const std::wstring &sValue) + { + m_sValue = sValue; + } + + std::wstring CDateTime::FromString(const std::wstring &sValue) + { + m_sValue = sValue; + + return m_sValue; + } + + std::wstring CDateTime::ToString () const + { + return m_sValue; + } + + //-------------------------------------------------------------------------------- + // DecimalNumberOrPercent 17.18.11 (Part 1) + //-------------------------------------------------------------------------------- + + CDecimalNumberOrPercent::CDecimalNumberOrPercent() + { + m_dValue = 0; + m_bTrailingPercentSign = false; + } + + double CDecimalNumberOrPercent::GetValue() const + { + return m_dValue; + } + + int CDecimalNumberOrPercent::GetValueIntegerPercent() const + { + if(m_bTrailingPercentSign) + { + return (int)((m_dValue / 2) * 100); + } + else + { + return (int)m_dValue; + } + } + + void CDecimalNumberOrPercent::SetValue(double dValue) + { + m_dValue = dValue; + } + + double CDecimalNumberOrPercent::FromString(const std::wstring &sValue, double dDefValue) + { + if ( sValue.empty() ) + { + m_dValue = dDefValue; + return m_dValue; + } + + int nLen = (int)sValue.length(); + wchar_t wsLastChar = sValue[nLen - 1 ]; + if ( wsLastChar == '%' ) + { + nLen--; + m_bTrailingPercentSign = true; + } + else + m_bTrailingPercentSign = false; + + m_dValue = XmlUtils::GetDouble(sValue.substr(0, nLen)); + + return m_dValue; + } + + std::wstring CDecimalNumberOrPercent::ToString () const + { + std::wstring sResult; + + if ( !m_bTrailingPercentSign ) + sResult = std::to_wstring( (int)m_dValue); + else + sResult = boost::lexical_cast(m_dValue) + L"%"; + + return sResult; + } + + bool CDecimalNumberOrPercent::IsPercent() const + { + return m_bTrailingPercentSign; + } + + void CDecimalNumberOrPercent::SetPercent(bool bPercent) + { + m_bTrailingPercentSign = bPercent; + } + + //-------------------------------------------------------------------------------- + // Direction 17.18.12 (Part 1) + //-------------------------------------------------------------------------------- + + EDirection CDirection::FromString(const std::wstring &sValue) + { + if ( (L"ltr") == sValue ) this->m_eValue = directionLTR; + else if ( (L"rtl") == sValue ) this->m_eValue = directionRTL; + else this->m_eValue = directionLTR; + + return this->m_eValue; + } + + std::wstring CDirection::ToString () const + { + switch(this->m_eValue) + { + case directionLTR : return (L"ltr"); + case directionRTL : return (L"rtl"); + default : return (L"ltr"); + } + } + + //-------------------------------------------------------------------------------- + // DisplacedByCustomXml 17.18.13 (Part 1) + //-------------------------------------------------------------------------------- + + EDisplacedByCustomXml CDisplacedByCustomXml::FromString(const std::wstring &sValue) + { + if ( (L"next") == sValue ) this->m_eValue = displacedbycustomxmlNext; + else if ( (L"prev") == sValue ) this->m_eValue = displacedbycustomxmlPrev; + else this->m_eValue = displacedbycustomxmlNext; + + return this->m_eValue; + } + + std::wstring CDisplacedByCustomXml::ToString () const + { + switch(this->m_eValue) + { + case displacedbycustomxmlNext : return (L"next"); + case displacedbycustomxmlPrev : return (L"prev"); + default : return (L"next"); + } + } + + //-------------------------------------------------------------------------------- + // DocGrid 17.18.14 (Part 1) + //-------------------------------------------------------------------------------- + + EDocGrid CDocGrid::FromString(const std::wstring &sValue) + { + if ( (L"default") == sValue ) this->m_eValue = docgridDefault; + else if ( (L"lines") == sValue ) this->m_eValue = docgridLines; + else if ( (L"linesAndChars") == sValue ) this->m_eValue = docgridLinesAndChars; + else if ( (L"snapToChars") == sValue ) this->m_eValue = docgridSnapToChars; + else this->m_eValue = docgridDefault; + + return this->m_eValue; + } + + std::wstring CDocGrid::ToString () const + { + switch(this->m_eValue) + { + case docgridDefault : return (L"default"); + case docgridLines : return (L"lines"); + case docgridLinesAndChars : return (L"linesAndChars"); + case docgridSnapToChars : return (L"snapToChars"); + default : return (L"default"); + } + } + + //-------------------------------------------------------------------------------- + // DocPartBehavior 17.18.15 (Part 1) + //-------------------------------------------------------------------------------- + + EDocPartBehavior CDocPartBehavior::FromString(const std::wstring &sValue) + { + if ( (L"content") == sValue ) this->m_eValue = docpartbehaviorContent; + else if ( (L"p") == sValue ) this->m_eValue = docpartbehaviorP; + else if ( (L"pg") == sValue ) this->m_eValue = docpartbehaviorPg; + else this->m_eValue = docpartbehaviorContent; + + return this->m_eValue; + } + + std::wstring CDocPartBehavior::ToString () const + { + switch(this->m_eValue) + { + case docpartbehaviorContent : return (L"content"); + case docpartbehaviorP : return (L"p"); + case docpartbehaviorPg : return (L"pg"); + default : return (L"content"); + } + } + + //-------------------------------------------------------------------------------- + // DocPartGallery 17.18.16 (Part 1) + //-------------------------------------------------------------------------------- + + EDocPartGallery CDocPartGallery::FromString(const std::wstring &sValue) + { + if ( (L"any") == sValue ) this->m_eValue = docpartgalleryAny; + else if ( (L"autoTxt") == sValue ) this->m_eValue = docpartgalleryAutoTxt; + else if ( (L"bib") == sValue ) this->m_eValue = docpartgalleryBib; + else if ( (L"coverPg") == sValue ) this->m_eValue = docpartgalleryCoverPg; + else if ( (L"custAutoTxt") == sValue ) this->m_eValue = docpartgalleryCustAutoTxt; + else if ( (L"custBib") == sValue ) this->m_eValue = docpartgalleryCustBib; + else if ( (L"custCoverPg") == sValue ) this->m_eValue = docpartgalleryCustCoverPg; + else if ( (L"custEq") == sValue ) this->m_eValue = docpartgalleryCustEq; + else if ( (L"custFtrs") == sValue ) this->m_eValue = docpartgalleryCustFtrs; + else if ( (L"custHdrs") == sValue ) this->m_eValue = docpartgalleryCustHdrs; + else if ( (L"custom1") == sValue ) this->m_eValue = docpartgalleryCustom1; + else if ( (L"custom2") == sValue ) this->m_eValue = docpartgalleryCustom2; + else if ( (L"custom3") == sValue ) this->m_eValue = docpartgalleryCustom3; + else if ( (L"custom4") == sValue ) this->m_eValue = docpartgalleryCustom4; + else if ( (L"custom5") == sValue ) this->m_eValue = docpartgalleryCustom5; + else if ( (L"custPgNum") == sValue ) this->m_eValue = docpartgalleryCustPgNum; + else if ( (L"custPgNumB") == sValue ) this->m_eValue = docpartgalleryCustPgNumB; + else if ( (L"custPgNumMargins") == sValue ) this->m_eValue = docpartgalleryCustPgNumMargins; + else if ( (L"custPgNumT") == sValue ) this->m_eValue = docpartgalleryCustPgNumT; + else if ( (L"custQuickParts") == sValue ) this->m_eValue = docpartgalleryCustQuickParts; + else if ( (L"custTblOfContents") == sValue ) this->m_eValue = docpartgalleryCustTblOfContents; + else if ( (L"custTbls") == sValue ) this->m_eValue = docpartgalleryCustTbls; + else if ( (L"custTxtBox") == sValue ) this->m_eValue = docpartgalleryCustTxtBox; + else if ( (L"custWatermarks") == sValue ) this->m_eValue = docpartgalleryCustWatermarks; + else if ( (L"default") == sValue ) this->m_eValue = docpartgalleryDefault; + else if ( (L"docParts") == sValue ) this->m_eValue = docpartgalleryDocParts; + else if ( (L"eq") == sValue ) this->m_eValue = docpartgalleryEq; + else if ( (L"ftrs") == sValue ) this->m_eValue = docpartgalleryFtrs; + else if ( (L"hdrs") == sValue ) this->m_eValue = docpartgalleryHdrs; + else if ( (L"pgNum") == sValue ) this->m_eValue = docpartgalleryPgNum; + else if ( (L"pgNumB") == sValue ) this->m_eValue = docpartgalleryPgNumB; + else if ( (L"pgNumMargins") == sValue ) this->m_eValue = docpartgalleryPgNumMargins; + else if ( (L"pgNumT") == sValue ) this->m_eValue = docpartgalleryPgNumT; + else if ( (L"placeholder") == sValue ) this->m_eValue = docpartgalleryPlaceHolder; + else if ( (L"tblOfContents") == sValue ) this->m_eValue = docpartgalleryTblOfContents; + else if ( (L"tbls") == sValue ) this->m_eValue = docpartgalleryTbls; + else if ( (L"txtBox") == sValue ) this->m_eValue = docpartgalleryTxtBox; + else if ( (L"watermarks") == sValue ) this->m_eValue = docpartgalleryWatermarks; + else this->m_eValue = docpartgalleryDefault; + + return this->m_eValue; + } + + std::wstring CDocPartGallery::ToString () const + { + switch(this->m_eValue) + { + case docpartgalleryAny : return (L"any"); + case docpartgalleryAutoTxt : return (L"autoTxt"); + case docpartgalleryBib : return (L"bib"); + case docpartgalleryCoverPg : return (L"coverPg"); + case docpartgalleryCustAutoTxt : return (L"custAutoTxt"); + case docpartgalleryCustBib : return (L"custBib"); + case docpartgalleryCustCoverPg : return (L"custCoverPg"); + case docpartgalleryCustEq : return (L"custEq"); + case docpartgalleryCustFtrs : return (L"custFtrs"); + case docpartgalleryCustHdrs : return (L"custHdrs"); + case docpartgalleryCustom1 : return (L"custom1"); + case docpartgalleryCustom2 : return (L"custom2"); + case docpartgalleryCustom3 : return (L"custom3"); + case docpartgalleryCustom4 : return (L"custom4"); + case docpartgalleryCustom5 : return (L"custom5"); + case docpartgalleryCustPgNum : return (L"custPgNum"); + case docpartgalleryCustPgNumB : return (L"custPgNumB"); + case docpartgalleryCustPgNumMargins : return (L"custPgNumMargins"); + case docpartgalleryCustPgNumT : return (L"custPgNumT"); + case docpartgalleryCustQuickParts : return (L"custQuickParts"); + case docpartgalleryCustTblOfContents : return (L"custTblOfContents"); + case docpartgalleryCustTbls : return (L"custTbls"); + case docpartgalleryCustTxtBox : return (L"custTxtBox"); + case docpartgalleryCustWatermarks : return (L"custWatermarks"); + case docpartgalleryDefault : return (L"default"); + case docpartgalleryDocParts : return (L"docParts"); + case docpartgalleryEq : return (L"eq"); + case docpartgalleryFtrs : return (L"ftrs"); + case docpartgalleryHdrs : return (L"hdrs"); + case docpartgalleryPgNum : return (L"pgNum"); + case docpartgalleryPgNumB : return (L"pgNumB"); + case docpartgalleryPgNumMargins : return (L"pgNumMargins"); + case docpartgalleryPgNumT : return (L"pgNumT"); + case docpartgalleryPlaceHolder : return (L"placeholder"); + case docpartgalleryTblOfContents : return (L"tblOfContents"); + case docpartgalleryTbls : return (L"tbls"); + case docpartgalleryTxtBox : return (L"txtBox"); + case docpartgalleryWatermarks : return (L"watermarks"); + default : return (L"default"); + } + } + + //-------------------------------------------------------------------------------- + // DocPartType 17.18.17 (Part 1) + //-------------------------------------------------------------------------------- + + EDocPartType CDocPartType::FromString(const std::wstring &sValue) + { + if ( (L"autoExp") == sValue ) this->m_eValue = docparttypeAutoExp; + else if ( (L"bbPlcHdr") == sValue ) this->m_eValue = docparttypeBBPlcHdr; + else if ( (L"formFld") == sValue ) this->m_eValue = docparttypeFormFld; + else if ( (L"none") == sValue ) this->m_eValue = docparttypeNone; + else if ( (L"normal") == sValue ) this->m_eValue = docparttypeNormal; + else if ( (L"speller") == sValue ) this->m_eValue = docparttypeSpeller; + else if ( (L"toolbar") == sValue ) this->m_eValue = docparttypeToolbar; + else this->m_eValue = docparttypeNone; + + return this->m_eValue; + } + + std::wstring CDocPartType::ToString () const + { + switch(this->m_eValue) + { + case docparttypeAutoExp : return (L"autoExp"); + case docparttypeBBPlcHdr : return (L"bbPlcHdr"); + case docparttypeFormFld : return (L"formFld"); + case docparttypeNone : return (L"none"); + case docparttypeNormal : return (L"normal"); + case docparttypeSpeller : return (L"speller"); + case docparttypeToolbar : return (L"toolbar"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // DocProtect 17.18.18 (Part 1) + //-------------------------------------------------------------------------------- + + EDocProtect CDocProtect::FromString(const std::wstring &sValue) + { + if ( (L"comments") == sValue ) this->m_eValue = docprotectComments; + else if ( (L"forms") == sValue ) this->m_eValue = docprotectForms; + else if ( (L"none") == sValue ) this->m_eValue = docprotectNone; + else if ( (L"readOnly") == sValue ) this->m_eValue = docprotectReadOnly; + else if ( (L"trackedChanges" )== sValue ) this->m_eValue = docprotectTrackedChanges; + else this->m_eValue = docprotectNone; + + return this->m_eValue; + } + + std::wstring CDocProtect::ToString () const + { + switch(this->m_eValue) + { + case docprotectComments : return (L"comments"); + case docprotectForms : return (L"forms"); + case docprotectNone : return (L"none"); + case docprotectReadOnly : return (L"readOnly"); + case docprotectTrackedChanges : return (L"trackedChanges"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // DocType 17.18.19 (Part 1) + //-------------------------------------------------------------------------------- + + EDocType CDocType::FromString(const std::wstring &sValue) + { + if ( (L"eMail") == sValue ) this->m_eValue = doctypeEMail; + else if ( (L"letter") == sValue ) this->m_eValue = doctypeLetter; + else if ( (L"notSpecified") == sValue ) this->m_eValue = doctypeNotSpecified; + else this->m_eValue = doctypeNotSpecified; + + return this->m_eValue; + } + + std::wstring CDocType::ToString () const + { + switch(this->m_eValue) + { + case doctypeEMail : return (L"eMail"); + case doctypeLetter : return (L"letter"); + case doctypeNotSpecified : return (L"notSpecified"); + default : return (L"notSpecified"); + } + } + + //-------------------------------------------------------------------------------- + // DropCap 17.18.20 (Part 1) + //-------------------------------------------------------------------------------- + + EDropCap CDropCap::FromString(const std::wstring &sValue) + { + if ( (L"drop") == sValue ) this->m_eValue = dropcapDrop; + else if ( (L"margin") == sValue ) this->m_eValue = dropcapMargin; + else if ( (L"none") == sValue ) this->m_eValue = dropcapNone; + else this->m_eValue = dropcapNone; + + return this->m_eValue; + } + + std::wstring CDropCap::ToString () const + { + switch(this->m_eValue) + { + case dropcapDrop : return (L"drop"); + case dropcapMargin : return (L"margin"); + case dropcapNone : return (L"none"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // EdGrp 17.18.21 (Part 1) + //-------------------------------------------------------------------------------- + + EEdGrp CEdGrp::FromString(const std::wstring &sValue) + { + if ( (L"administrators") == sValue ) this->m_eValue = edgrpAdministrators; + else if ( (L"contributors") == sValue ) this->m_eValue = edgrpContributors; + else if ( (L"current") == sValue ) this->m_eValue = edgrpCurrent; + else if ( (L"editors") == sValue ) this->m_eValue = edgrpEditors; + else if ( (L"everyone") == sValue ) this->m_eValue = edgrpEveryone; + else if ( (L"none") == sValue ) this->m_eValue = edgrpNone; + else if ( (L"owners") == sValue ) this->m_eValue = edgrpOwners; + else this->m_eValue = edgrpEveryone; + + return this->m_eValue; + } + + std::wstring CEdGrp::ToString () const + { + switch(this->m_eValue) + { + case edgrpAdministrators : return (L"administrators"); + case edgrpContributors : return (L"contributors"); + case edgrpCurrent : return (L"current"); + case edgrpEditors : return (L"editors"); + case edgrpEveryone : return (L"everyone"); + case edgrpNone : return (L"none"); + case edgrpOwners : return (L"owners"); + default : return (L"everyone"); + } + } + + //-------------------------------------------------------------------------------- + // EdnPos 17.18.22 (Part 1) + //-------------------------------------------------------------------------------- + + EEdnPos CEdnPos::FromString(const std::wstring &sValue) + { + if ( (L"docEnd") == sValue ) this->m_eValue = ednposDocEnd; + else if ( (L"sectEnd") == sValue ) this->m_eValue = ednposSectEnd; + else this->m_eValue = ednposSectEnd; + + return this->m_eValue; + } + + std::wstring CEdnPos::ToString () const + { + switch(this->m_eValue) + { + case ednposDocEnd : return (L"docEnd"); + case ednposSectEnd : return (L"sectEnd"); + default : return (L"sectEnd"); + } + } + + //-------------------------------------------------------------------------------- + // EighthPointMeasure 17.18.23 (Part 1) + //-------------------------------------------------------------------------------- + + int CEighthPointMeasure::FromString(const std::wstring &sValue) + { + if (sValue == (L"auto")) + { + + } + else + { + this->m_eValue = sValue.empty() ? 0 : XmlUtils::GetInteger(sValue); + } + + return this->m_eValue; + } + + std::wstring CEighthPointMeasure::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + double CEighthPointMeasure::ToPoints() + { + return this->m_eValue / 8.0; + } + + double CEighthPointMeasure::ToMM() + { + return Pt_To_Mm(this->m_eValue / 8.0); + } + + double CEighthPointMeasure::ToInches() + { + return this->m_eValue / 576.0; + } + + int CEighthPointMeasure::FromPoints(double dValue) + { + this->m_eValue = (int)(dValue * 8); + return this->m_eValue; + } + + int CEighthPointMeasure::FromInches(double dValue) + { + this->m_eValue = (int)(dValue * 576); + return this->m_eValue; + } + + //-------------------------------------------------------------------------------- + // Em 17.18.24 (Part 1) + //-------------------------------------------------------------------------------- + + EEm CEm::FromString(const std::wstring &sValue) + { + if ( (L"circle") == sValue ) this->m_eValue = emCircle; + else if ( (L"comma") == sValue ) this->m_eValue = emComma; + else if ( (L"dot") == sValue ) this->m_eValue = emDot; + else if ( (L"none") == sValue ) this->m_eValue = emNone; + else if ( (L"underDot") == sValue ) this->m_eValue = emUnderDot; + else this->m_eValue = emNone; + + return this->m_eValue; + } + + std::wstring CEm::ToString () const + { + switch(this->m_eValue) + { + case emCircle : return (L"circle"); + case emComma : return (L"comma"); + case emDot : return (L"dot"); + case emNone : return (L"none"); + case emUnderDot : return (L"underDot"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // FFHelpTextVal 17.18.25 (Part 1) + //-------------------------------------------------------------------------------- + + CFFHelpTextVal::CFFHelpTextVal() {} + + std::wstring CFFHelpTextVal::GetValue() const + { + return m_sValue; + } + + void CFFHelpTextVal::SetValue(std::wstring &sValue) + { + if ( sValue.length() <= 256 ) + m_sValue = sValue; + else + m_sValue = sValue.substr( 0, 256 ); + } + + std::wstring CFFHelpTextVal::FromString(const std::wstring &sValue) + { + if ( sValue.length() <= 256 ) + m_sValue = sValue; + else + m_sValue = sValue.substr( 0, 256 ); + + return m_sValue; + } + + std::wstring CFFHelpTextVal::ToString () const + { + return m_sValue; + } + std::wstring CFFHelpTextVal::ToXmlString() const + { + return XmlUtils::EncodeXmlString(m_sValue); + } + + //-------------------------------------------------------------------------------- + // FFName 17.18.26 (Part 1) + //-------------------------------------------------------------------------------- + + CFFName::CFFName() {} + + std::wstring CFFName::GetValue() const + { + return m_sValue; + } + + void CFFName::SetValue(std::wstring &sValue) + { + if ( sValue.length() <= 65 ) + m_sValue = sValue; + else + m_sValue = sValue.substr( 0, 65 ); + } + + std::wstring CFFName::FromString(const std::wstring &sValue) + { + if ( sValue.length() <= 65 ) + m_sValue = sValue; + else + m_sValue = sValue.substr( 0, 65 ); + + return m_sValue; + } + + std::wstring CFFName::ToString () const + { + return m_sValue; + } + std::wstring CFFName::ToXmlString() const + { + return XmlUtils::EncodeXmlString(m_sValue); + } + + //-------------------------------------------------------------------------------- + // FFStatusTextVal 17.18.27 (Part 1) + //-------------------------------------------------------------------------------- + + CFFStatusTextVal::CFFStatusTextVal() {} + + std::wstring CFFStatusTextVal::GetValue() const + { + return m_sValue; + } + + void CFFStatusTextVal::SetValue(std::wstring &sValue) + { + if ( sValue.length() <= 140 ) + m_sValue = sValue; + else + m_sValue = sValue.substr( 0, 140 ); + } + + std::wstring CFFStatusTextVal::FromString(const std::wstring &sValue) + { + if ( sValue.length() <= 140 ) + m_sValue = sValue; + else + m_sValue = sValue.substr( 0, 140 ); + + return m_sValue; + } + + std::wstring CFFStatusTextVal::ToString () const + { + return m_sValue; + } + std::wstring CFFStatusTextVal::ToXmlString() const + { + return XmlUtils::EncodeXmlString(m_sValue); + } + + //-------------------------------------------------------------------------------- + // FFTextType 17.18.28 (Part 1) + //-------------------------------------------------------------------------------- + + EFFTextType CFFTextType::FromString(const std::wstring &sValue) + { + if ( (L"calculated") == sValue ) this->m_eValue = fftexttypeCalculated; + else if ( (L"currentDate") == sValue ) this->m_eValue = fftexttypeCurrentDate; + else if ( (L"currentTime") == sValue ) this->m_eValue = fftexttypeCurrentTime; + else if ( (L"date") == sValue ) this->m_eValue = fftexttypeDate; + else if ( (L"number") == sValue ) this->m_eValue = fftexttypeNumber; + else if ( (L"regular") == sValue ) this->m_eValue = fftexttypeRegular; + else this->m_eValue = fftexttypeRegular; + + return this->m_eValue; + } + + std::wstring CFFTextType::ToString () const + { + switch(this->m_eValue) + { + case fftexttypeCalculated : return (L"calculated"); + case fftexttypeCurrentDate : return (L"currentDate"); + case fftexttypeCurrentTime : return (L"currentTime"); + case fftexttypeDate : return (L"date"); + case fftexttypeNumber : return (L"number"); + case fftexttypeRegular : return (L"regular"); + default : return (L"regular"); + } + } + + //-------------------------------------------------------------------------------- + // FldCharType 17.18.29 (Part 1) + //-------------------------------------------------------------------------------- + + EFldCharType CFldCharType::FromString(const std::wstring &sValue) + { + if ( (L"begin") == sValue ) this->m_eValue = fldchartypeBegin; + else if ( (L"end") == sValue ) this->m_eValue = fldchartypeEnd; + else if ( (L"separate") == sValue ) this->m_eValue = fldchartypeSeparate; + else this->m_eValue = fldchartypeBegin; + + return this->m_eValue; + } + + std::wstring CFldCharType::ToString () const + { + switch(this->m_eValue) + { + case fldchartypeBegin : return (L"begin"); + case fldchartypeEnd : return (L"end"); + case fldchartypeSeparate : return (L"separate"); + default : return (L"begin"); + } + } + + //-------------------------------------------------------------------------------- + // FontFamily 17.18.30 (Part 1) + //-------------------------------------------------------------------------------- + + EFontFamily CFontFamily::FromString(const std::wstring &sValue) + { + if ( (L"auto") == sValue ) this->m_eValue = fontfamilyAuto; + else if ( (L"decorative") == sValue ) this->m_eValue = fontfamilyDecorative; + else if ( (L"modern") == sValue ) this->m_eValue = fontfamilyModern; + else if ( (L"roman") == sValue ) this->m_eValue = fontfamilyRoman; + else if ( (L"script") == sValue ) this->m_eValue = fontfamilyScript; + else if ( (L"swiss") == sValue ) this->m_eValue = fontfamilySwiss; + else this->m_eValue = fontfamilyAuto; + + return this->m_eValue; + } + + std::wstring CFontFamily::ToString () const + { + switch(this->m_eValue) + { + case fontfamilyAuto : return (L"auto"); + case fontfamilyDecorative : return (L"decorative"); + case fontfamilyModern : return (L"modern"); + case fontfamilyRoman : return (L"roman"); + case fontfamilyScript : return (L"script"); + case fontfamilySwiss : return (L"swiss"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // FrameLayout 17.18.31 (Part 1) + //-------------------------------------------------------------------------------- + + EFrameLayout CFrameLayout::FromString(const std::wstring &sValue) + { + if ( (L"cols") == sValue ) this->m_eValue = framelayoutCols; + else if ( (L"none") == sValue ) this->m_eValue = framelayoutNone; + else if ( (L"rows") == sValue ) this->m_eValue = framelayoutRows; + else this->m_eValue = framelayoutNone; + + return this->m_eValue; + } + + std::wstring CFrameLayout::ToString () const + { + switch(this->m_eValue) + { + case framelayoutCols : return (L"cols"); + case framelayoutNone : return (L"none"); + case framelayoutRows : return (L"rows"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // FrameScrollbar 17.18.32 (Part 1) + //-------------------------------------------------------------------------------- + + EFrameScrollbar CFrameScrollbar::FromString(const std::wstring &sValue) + { + if ( (L"auto") == sValue ) this->m_eValue = framescrollbarAuto; + else if ( (L"off") == sValue ) this->m_eValue = framescrollbarOff; + else if ( (L"on") == sValue ) this->m_eValue = framescrollbarOn; + else this->m_eValue = framescrollbarAuto; + + return this->m_eValue; + } + + std::wstring CFrameScrollbar::ToString () const + { + switch(this->m_eValue) + { + case framescrollbarAuto : return (L"auto"); + case framescrollbarOff : return (L"off"); + case framescrollbarOn : return (L"on"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // FtnEdn 17.18.33 (Part 1) + //-------------------------------------------------------------------------------- + + EFtnEdn CFtnEdn::FromString(const std::wstring &sValue) + { + if (L"continuationNotice" == sValue ) this->m_eValue = ftnednContinuationNotice; + else if (L"continuationSeparator" == sValue || + L"continuation-separator" == sValue) this->m_eValue = ftnednContinuationSeparator; + else if (L"normal" == sValue ) this->m_eValue = ftnednNormal; + else if (L"separator" == sValue ) this->m_eValue = ftnednSeparator; + else this->m_eValue = ftnednNormal; + + return this->m_eValue; + } + + std::wstring CFtnEdn::ToString () const + { + switch(this->m_eValue) + { + case ftnednContinuationNotice : return (L"continuationNotice"); + case ftnednContinuationSeparator : return (L"continuationSeparator"); + case ftnednNormal : return (L"normal"); + case ftnednSeparator : return (L"separator"); + default : return (L"normal"); + } + } + + //-------------------------------------------------------------------------------- + // FtnPos 17.18.34 (Part 1) + //-------------------------------------------------------------------------------- + + EFtnPos CFtnPos::FromString(const std::wstring &sValue) + { + if ( (L"beneathText") == sValue ) this->m_eValue = ftnposBeneathText; + else if ( (L"docEnd") == sValue ) this->m_eValue = ftnposDocEnd; + else if ( (L"pageBottom") == sValue ) this->m_eValue = ftnposPageBottom; + else if ( (L"sectEnd") == sValue ) this->m_eValue = ftnposSectEnd; + else this->m_eValue = ftnposSectEnd; + + return this->m_eValue; + } + + std::wstring CFtnPos::ToString () const + { + switch(this->m_eValue) + { + case ftnposBeneathText : return (L"beneathText"); + case ftnposDocEnd : return (L"docEnd"); + case ftnposPageBottom : return (L"pageBottom"); + case ftnposSectEnd : return (L"sectEnd"); + default : return (L"sectEnd"); + } + } + + //-------------------------------------------------------------------------------- + // HAnchor 17.18.35 (Part 1) + //-------------------------------------------------------------------------------- + + EHAnchor CHAnchor::FromString(const std::wstring &sValue) + { + if ( (L"margin") == sValue ) this->m_eValue = hanchorMargin; + else if ( (L"page") == sValue ) this->m_eValue = hanchorPage; + else if ( (L"text") == sValue ) this->m_eValue = hanchorText; + else this->m_eValue = hanchorText; + + return this->m_eValue; + } + + std::wstring CHAnchor::ToString () const + { + switch(this->m_eValue) + { + case hanchorMargin : return (L"margin"); + case hanchorPage : return (L"page"); + case hanchorText : return (L"text"); + default : return (L"text"); + } + } + + //-------------------------------------------------------------------------------- + // HdrFtr 17.18.36 (Part 1) + //-------------------------------------------------------------------------------- + + EHdrFtr CHdrFtr::FromString(const std::wstring &sValue) + { + if ( L"default" == sValue || + L"odd" == sValue ) this->m_eValue = hdrftrDefault; + else if ( L"even" == sValue ) this->m_eValue = hdrftrEven; + else if ( L"first" == sValue ) this->m_eValue = hdrftrFirst; + else this->m_eValue = hdrftrDefault; + + return this->m_eValue; + } + + std::wstring CHdrFtr::ToString() const + { + switch(this->m_eValue) + { + case hdrftrDefault : return L"default"; + case hdrftrEven : return L"even"; + case hdrftrFirst : return L"first"; + default : return L"default"; + } + } + + //-------------------------------------------------------------------------------- + // HeightRule 17.18.37 (Part 1) + //-------------------------------------------------------------------------------- + + EHeightRule CHeightRule::FromString(const std::wstring &sValue) + { + if ( (L"atLeast") == sValue ) this->m_eValue = heightruleAtLeast; + else if ( (L"auto") == sValue ) this->m_eValue = heightruleAuto; + else if ( (L"exact") == sValue ) this->m_eValue = heightruleExact; + else this->m_eValue = heightruleAuto; + + return this->m_eValue; + } + + std::wstring CHeightRule::ToString () const + { + switch(this->m_eValue) + { + case heightruleAtLeast : return (L"atLeast"); + case heightruleAuto : return (L"auto"); + case heightruleExact : return (L"exact"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // TextFormFormatType + //-------------------------------------------------------------------------------- + + ETextFormFormatType CTextFormFormatType::FromString(const std::wstring &sValue) + { + if (L"none" == sValue) this->m_eValue = textFormFormatTypeNone; + else if (L"digit" == sValue) this->m_eValue = textFormFormatTypeDigit; + else if (L"letter" == sValue) this->m_eValue = textFormFormatTypeLetter; + else if (L"mask" == sValue) this->m_eValue = textFormFormatTypeMask; + else if (L"regExp" == sValue) this->m_eValue = textFormFormatTypeRegExp; + else this->m_eValue = textFormFormatTypeNone; + + return this->m_eValue; + } + + std::wstring CTextFormFormatType::ToString() const + { + switch (this->m_eValue) + { + case textFormFormatTypeNone: return L"none"; + case textFormFormatTypeDigit: return L"digit"; + case textFormFormatTypeLetter: return L"letter"; + case textFormFormatTypeMask: return L"mask"; + case textFormFormatTypeRegExp: return L"regExp"; + default: return (L"none"); + } + } + + EComplexFormType CComplexFormType::FromString(const std::wstring &sValue) + { + if (L"custom" == sValue || L"none" == sValue) this->m_eValue = complexFormTypeCustom; + else if (L"telephone" == sValue || L"phone" == sValue) this->m_eValue = complexFormTypeTelephone; + else if (L"email" == sValue) this->m_eValue = complexFormTypeEmail; + else this->m_eValue = complexFormTypeCustom; + + return this->m_eValue; + } + + std::wstring CComplexFormType::ToString() const + { + switch (this->m_eValue) + { + case complexFormTypeCustom: return L"custom"; + case complexFormTypeTelephone: return L"telephone"; + case complexFormTypeEmail: return L"email"; + default: return (L"custom"); + } + } + + bool CComplexFormType::IsDefaultValue() const + { + return (this->m_eValue == complexFormTypeCustom); + } + + /// + + CHexColor::CHexColor(unsigned char r, unsigned char g, unsigned char b) + { + this->m_eValue = hexcolorRGB; + m_unR = r; + m_unG = g; + m_unB = b; + } + + int CHexColor::HexToInt(int nHex) + { + if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); + if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); + if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); + + return 0; + } + + void CHexColor::Parse() + { + if ( m_sValue.length() < 6 ) + return; + + m_unR = HexToInt( (int)m_sValue[1] ) + (unsigned char)(HexToInt( (int)m_sValue[0] ) << 4); + m_unG = HexToInt( (int)m_sValue[3] ) + (unsigned char)(HexToInt( (int)m_sValue[2] ) << 4); + m_unB = HexToInt( (int)m_sValue[5] ) + (unsigned char)(HexToInt( (int)m_sValue[4] ) << 4); + } + + void CHexColor::Parse3() + { + if ( m_sValue.length() < 3 ) + return; + + m_unR = HexToInt( (int)m_sValue[0] ) + (unsigned char)(HexToInt( (int)m_sValue[0]) << 4); + m_unG = HexToInt( (int)m_sValue[1] ) + (unsigned char)(HexToInt( (int)m_sValue[1]) << 4); + m_unB = HexToInt( (int)m_sValue[2] ) + (unsigned char)(HexToInt( (int)m_sValue[2]) << 4); + } + + EHexColor CHexColor::FromString(const std::wstring &sValueSrc) + { + if ( L"auto" == sValueSrc || L"none" == sValueSrc ) + this->m_eValue = hexcolorAuto; + else + { + std::wstring sValue = sValueSrc; size_t split = sValue.find(L" ["); //index ala #ff9 [43] if (std::wstring::npos != split) { @@ -51,67 +1810,3083 @@ namespace SimpleTypes { sValue = sValue.substr(1); } - //В документации не написано, что цвет может приходить строкой, но в реальных докуентах встречается и word это разруливает. - CPresetColorVal<> oPresetColorVal; - if(oPresetColorVal.FromStringIgnoreCase(sValue)) - { - this->m_eValue = hexcolorRGB; - m_unR = oPresetColorVal.Get_R(); - m_unG = oPresetColorVal.Get_G(); - m_unB = oPresetColorVal.Get_B(); - } - else if ( 6 <= sValue.length() ) - { - this->m_eValue = hexcolorRGB; - m_sValue = sValue.substr( 0, 6 ); - Parse(); - } - else if ( 3 == sValue.length() )// a la #339 (Compo 3AP.docx) - { - this->m_eValue = hexcolorRGB; - m_sValue = sValue; - Parse3(); - } - else this->m_eValue = EHexColor::hexcolorAuto;//eDefValue; - } + //В документации не написано, что цвет может приходить строкой, но в реальных документах встречается и word это разруливает. + CPresetColorVal oPresetColorVal; + if(oPresetColorVal.FromStringIgnoreCase(sValue)) + { + this->m_eValue = hexcolorRGB; + m_unR = oPresetColorVal.Get_R(); + m_unG = oPresetColorVal.Get_G(); + m_unB = oPresetColorVal.Get_B(); + } + else if ( 6 <= sValue.length() ) + { + this->m_eValue = hexcolorRGB; + m_sValue = sValue.substr( 0, 6 ); + Parse(); + } + else if ( 3 == sValue.length() )// a la #339 (Compo 3AP.docx) + { + this->m_eValue = hexcolorRGB; + m_sValue = sValue; + Parse3(); + } + else this->m_eValue = EHexColor::hexcolorAuto;//eDefValue; - return this->m_eValue; - } - template<> - EHexColor CHexColor::FromString (std::wstring &sValue) - { - if ( _T("auto") == sValue || _T("none") == sValue ) - this->m_eValue = hexcolorAuto; - else - { - //В документации не написано, что цвет может приходить строкой, но в реальных докуентах встречается и word это разруливает. - //CHighlightColor oHighlightColor(sValue); - CPresetColorVal<> oPresetColorVal; - if(oPresetColorVal.FromStringIgnoreCase(sValue)) - { - this->m_eValue = hexcolorRGB; - m_unR = oPresetColorVal.Get_R(); - m_unG = oPresetColorVal.Get_G(); - m_unB = oPresetColorVal.Get_B(); - } - else if ( 6 <= sValue.length() ) - { - this->m_eValue = hexcolorRGB; - m_sValue = sValue.substr( 0, 6 ); - Parse(); - } - else if ( 3 == sValue.length() )// a la #339 (Compo 3AP.docx) - { - this->m_eValue = hexcolorRGB; - m_sValue = sValue; - Parse3(); - } - else this->m_eValue = EHexColor::hexcolorAuto;//eDefValue; + } - } + return this->m_eValue; + } - return this->m_eValue; + /* + template<> + EHexColor CHexColor::FromString(const std::wstring &sValue) + { + if ( _T("auto") == sValue || _T("none") == sValue ) + this->m_eValue = hexcolorAuto; + else + { + //В документации не написано, что цвет может приходить строкой, но в реальных докуентах встречается и word это разруливает. + //CHighlightColor oHighlightColor(sValue); + CPresetColorVal<> oPresetColorVal; + if(oPresetColorVal.FromStringIgnoreCase(sValue)) + { + this->m_eValue = hexcolorRGB; + m_unR = oPresetColorVal.Get_R(); + m_unG = oPresetColorVal.Get_G(); + m_unB = oPresetColorVal.Get_B(); + } + else if ( 6 <= sValue.length() ) + { + this->m_eValue = hexcolorRGB; + m_sValue = sValue.substr( 0, 6 ); + Parse(); + } + else if ( 3 == sValue.length() )// a la #339 (Compo 3AP.docx) + { + this->m_eValue = hexcolorRGB; + m_sValue = sValue; + Parse3(); + } + else this->m_eValue = EHexColor::hexcolorAuto;//eDefValue; + + } + + return this->m_eValue; + } + */ + + std::wstring CHexColor::ToString () const + { + switch(this->m_eValue) + { + case hexcolorRGB : + { + std::wstringstream sstream; + sstream << L"00" << boost::wformat( L"%02x%02x%02x" ) % m_unR % m_unG % m_unB; + + return sstream.str(); + } + case hexcolorAuto : + default : + return (L"auto"); + } + } + + std::wstring CHexColor::ToStringNoAlpha () const + { + switch(this->m_eValue) + { + case hexcolorRGB : + { + std::wstringstream sstream; + sstream << boost::wformat( L"%02x%02x%02x" ) % m_unR % m_unG % m_unB; + + return sstream.str(); + } + case hexcolorAuto : + default : + return (L"auto"); } + } + + void CHexColor::Set_R(unsigned char R) + { + m_unR = R; + } + + void CHexColor::Set_G(unsigned char G) + { + m_unG = G; + } + + void CHexColor::Set_B(unsigned char B) + { + m_unB = B; + } + + unsigned char CHexColor::Get_R() const + { + return m_unR; + } + + unsigned char CHexColor::Get_G() const + { + return m_unG; + } + + unsigned char CHexColor::Get_B() const + { + return m_unB; + } + + unsigned char CHexColor::Get_A() const + { + return 255; + } + + //-------------------------------------------------------------------------------- + // HexColorAuto 17.18.39 (Part 1) + //-------------------------------------------------------------------------------- + + EHexColorAuto CHexColorAuto::FromString(const std::wstring &sValue) + { + this->m_eValue = hexcolorautoAuto; + + return this->m_eValue; + } + + std::wstring CHexColorAuto::ToString () const + { + return (L"auto"); + } + + //-------------------------------------------------------------------------------- + // HighlightColor 17.18.40 (Part 1) + //-------------------------------------------------------------------------------- + + CHighlightColor::CHighlightColor(const CHexColor& color) + : m_unR(color.Get_R()), m_unG(color.Get_G()), m_unB(color.Get_B()), m_unA(255) {} + + std::wstring CHighlightColor::ToString() const + { + switch(this->m_eValue) + { + case highlightcolorBlack : return (L"black"); + case highlightcolorBlue : return (L"blue"); + case highlightcolorCyan : return (L"cyan"); + case highlightcolorDarkBlue : return (L"darkBlue"); + case highlightcolorDarkCyan : return (L"darkCyan"); + case highlightcolorDarkGray : return (L"darkGray"); + case highlightcolorDarkGreen : return (L"darkGreen"); + case highlightcolorDarkMagenta : return (L"darkMagenta"); + case highlightcolorDarkRed : return (L"darkRed"); + case highlightcolorDarkYellow : return (L"darkYellow"); + case highlightcolorGreen : return (L"green"); + case highlightcolorLightGray : return (L"lightGray"); + case highlightcolorMagenta : return (L"magenta"); + case highlightcolorNone : return (L"none"); + case highlightcolorRed : return (L"red"); + case highlightcolorWhite : return (L"white"); + case highlightcolorYellow : return (L"yellow"); + default : return (L"none"); + } + } + + EHighlightColor CHighlightColor::FromString(const std::wstring &sValue) + { + if ( (L"black") == sValue ) + { + this->m_eValue = highlightcolorBlack; + + m_unR = 0x00; + m_unG = 0x00; + m_unB = 0x00; + m_unA = 0xFF; + } + else if ( (L"blue") == sValue ) + { + this->m_eValue = highlightcolorBlue; + m_unR = 0x00; + m_unG = 0x00; + m_unB = 0xFF; + m_unA = 0xFF; + } + else if ( (L"cyan") == sValue ) + { + this->m_eValue = highlightcolorCyan; + m_unR = 0x00; + m_unG = 0xFF; + m_unB = 0xFF; + m_unA = 0xFF; + } + else if ( (L"darkBlue") == sValue ) + { + this->m_eValue = highlightcolorDarkBlue; + m_unR = 0x00; + m_unG = 0x00; + m_unB = 0x8B; + m_unA = 0xFF; + } + else if ( (L"darkCyan") == sValue ) + { + this->m_eValue = highlightcolorDarkCyan; + m_unR = 0x00; + m_unG = 0x8B; + m_unB = 0x8B; + m_unA = 0xFF; + } + else if ( (L"darkGray") == sValue ) + { + this->m_eValue = highlightcolorDarkGray; + m_unR = 0xA9; + m_unG = 0xA9; + m_unB = 0xA9; + m_unA = 0xFF; + } + else if ( (L"darkGreen") == sValue ) + { + this->m_eValue = highlightcolorDarkGreen; + m_unR = 0x00; + m_unG = 0x64; + m_unB = 0x00; + m_unA = 0xFF; + } + else if ( (L"darkMagenta") == sValue ) + { + this->m_eValue = highlightcolorDarkMagenta; + m_unR = 0x80; + m_unG = 0x00; + m_unB = 0x80; + m_unA = 0xFF; + } + else if ( (L"darkRed") == sValue ) + { + this->m_eValue = highlightcolorDarkRed; + m_unR = 0x8B; + m_unG = 0x00; + m_unB = 0x00; + m_unA = 0xFF; + } + else if ( (L"darkYellow") == sValue ) + { + this->m_eValue = highlightcolorDarkYellow; + m_unR = 0x80; + m_unG = 0x80; + m_unB = 0x00; + m_unA = 0xFF; + } + else if ( (L"green") == sValue ) + { + this->m_eValue = highlightcolorGreen; + m_unR = 0x00; + m_unG = 0xFF; + m_unB = 0x00; + m_unA = 0xFF; + } + else if ( (L"lightGray") == sValue ) + { + this->m_eValue = highlightcolorLightGray; + m_unR = 0xD3; + m_unG = 0xD3; + m_unB = 0xD3; + m_unA = 0xFF; + } + else if ( (L"magenta") == sValue ) + { + this->m_eValue = highlightcolorMagenta; + m_unR = 0xFF; + m_unG = 0x00; + m_unB = 0xFF; + m_unA = 0xFF; + } + else if ( (L"none") == sValue ) + { + this->m_eValue = highlightcolorNone; + m_unR = 0x00; + m_unG = 0x00; + m_unB = 0x00; + m_unA = 0x00; + } + else if ( (L"red") == sValue ) + { + this->m_eValue = highlightcolorRed; + m_unR = 0xFF; + m_unG = 0x00; + m_unB = 0x00; + m_unA = 0xFF; + } + else if ( (L"white") == sValue ) + { + this->m_eValue = highlightcolorWhite; + m_unR = 0xFF; + m_unG = 0xFF; + m_unB = 0xFF; + m_unA = 0xFF; + } + else if ( (L"yellow") == sValue ) + { + this->m_eValue = highlightcolorYellow; + m_unR = 0xFF; + m_unG = 0xFF; + m_unB = 0x00; + m_unA = 0xFF; + } + else + { + this->m_eValue = highlightcolorNone; + + // Инициализируем цвет + FromString( ToString() ); + } + + return this->m_eValue; + } + + unsigned char CHighlightColor::Get_R() const + { + return m_unR; + } + + unsigned char CHighlightColor::Get_G() const + { + return m_unG; + } + + unsigned char CHighlightColor::Get_B() const + { + return m_unB; + } + + unsigned char CHighlightColor::Get_A() const + { + return m_unA; + } + + //-------------------------------------------------------------------------------- + // Hint 17.18.41 (Part 1) + //-------------------------------------------------------------------------------- + + EHint CHint::FromString(const std::wstring &sValue) + { + if ( (L"cs") == sValue ) this->m_eValue = hintCs; + else if ( (L"default") == sValue ) this->m_eValue = hintDefault; + else if ( (L"eastAsia") == sValue ) this->m_eValue = hintEastAsia; + else this->m_eValue = hintDefault; + + return this->m_eValue; + } + + std::wstring CHint::ToString () const + { + switch(this->m_eValue) + { + case hintCs : return (L"cs"); + case hintDefault : return (L"default"); + case hintEastAsia : return (L"eastAsia"); + default : return (L"default"); + } + } + + //-------------------------------------------------------------------------------- + // HpsMeasure 17.18.42 (Part 1) + //-------------------------------------------------------------------------------- + + CHpsMeasure::CHpsMeasure() {} + + double CHpsMeasure::FromString(const std::wstring &sValue) + { + Parse(sValue, 2); + + m_dValue = fabs( m_dValue ); + + return m_dValue; + } + void CHpsMeasure::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = dValue; + } + std::wstring CHpsMeasure::ToString () const + { + std::wstring sResult; + + if (m_bUnit) + { + sResult = boost::lexical_cast( m_dValue ) + L"pt"; + } + else + { + sResult = std::to_wstring( (int)(m_dValue * 2) ); + } + + return sResult; + } + long CHpsMeasure::ToHps() const + { + return (long)(2 * m_dValue); + } + + double CHpsMeasure::FromPoints(double dValue) + { + m_dValue = fabs( dValue ); + return m_dValue; + } + double CHpsMeasure::FromInches(double dValue) + { + m_dValue = fabs( dValue * 72.0 ); + return m_dValue; + } + double CHpsMeasure::FromHps(double dValue) + { + m_dValue = dValue / 2; + return m_dValue; + } + + //-------------------------------------------------------------------------------- + // InfoTextType 17.18.43 (Part 1) + //-------------------------------------------------------------------------------- + + EInfoTextType CInfoTextType::FromString(const std::wstring &sValue) + { + if ( (L"autoText") == sValue ) this->m_eValue = infotexttypeAutoText; + else if ( (L"text") == sValue ) this->m_eValue = infotexttypeText; + else this->m_eValue = infotexttypeText; + + return this->m_eValue; + } + + std::wstring CInfoTextType::ToString () const + { + switch(this->m_eValue) + { + case infotexttypeAutoText : return (L"autoText"); + case infotexttypeText : return (L"text"); + default : return (L"text"); + } + } + + //-------------------------------------------------------------------------------- + // Jc 17.18.44 (Part 1) + 9.10.2 (Part 4) + //-------------------------------------------------------------------------------- + + EJc CJc::FromString(const std::wstring &sValue) + { + if ( (L"both") == sValue ) this->m_eValue = jcBoth; + else if ( (L"center") == sValue ) this->m_eValue = jcCenter; + else if ( (L"distribute") == sValue ) this->m_eValue = jcDistribute; + else if ( (L"end") == sValue ) this->m_eValue = jcEnd; + else if ( (L"highKashida") == sValue ) this->m_eValue = jcHighKashida; + else if ( (L"lowKashida") == sValue ) this->m_eValue = jcLowKashida; + else if ( (L"mediumKashida") == sValue ) this->m_eValue = jcMediumKashida; + else if ( (L"numTab") == sValue ) this->m_eValue = jcNumTab; + else if ( (L"start") == sValue ) this->m_eValue = jcStart; + else if ( (L"thaiDistribute") == sValue ) this->m_eValue = jcThaiDistribute; + else if ( (L"left") == sValue ) this->m_eValue = jcLeft; + else if ( (L"right") == sValue ) this->m_eValue = jcRight; + else this->m_eValue = jcLeft; + + return this->m_eValue; + } + + std::wstring CJc::ToString () const + { + switch(this->m_eValue) + { + case jcBoth : return (L"both"); + case jcCenter : return (L"center"); + case jcDistribute : return (L"distribute"); + case jcEnd : return (L"end"); + case jcHighKashida : return (L"highKashida"); + case jcLowKashida : return (L"lowKashida"); + case jcMediumKashida : return (L"mediumKashida"); + case jcNumTab : return (L"numTab"); + case jcStart : return (L"start"); + case jcThaiDistribute : return (L"thaiDistribute"); + case jcLeft : return (L"left"); + case jcRight : return (L"right"); + default : return (L"left"); + } + } + + //-------------------------------------------------------------------------------- + // JcTable 17.18.45 (Part 1) + 9.10.3 (Part 4) + //-------------------------------------------------------------------------------- + + EJcTable CJcTable::FromString(const std::wstring &sValue) + { + if ( (L"center") == sValue ) this->m_eValue = jctableCenter; + else if ( (L"end") == sValue ) this->m_eValue = jctableEnd; + else if ( (L"start") == sValue ) this->m_eValue = jctableStart; + else if ( (L"left") == sValue ) this->m_eValue = jctableLeft; + else if ( (L"right") == sValue ) this->m_eValue = jctableRight; + else this->m_eValue = jctableLeft; + + return this->m_eValue; + } + + std::wstring CJcTable::ToString () const + { + switch(this->m_eValue) + { + case jctableCenter : return (L"center"); + case jctableEnd : return (L"end"); + case jctableStart : return (L"start"); + case jctableLeft : return (L"left"); + case jctableRight : return (L"right"); + default : return (L"left"); + } + } + + //-------------------------------------------------------------------------------- + // LevelSuffix 17.18.46 (Part 1) + //-------------------------------------------------------------------------------- + + ELevelSuffix CLevelSuffix::FromString(const std::wstring &sValue) + { + if ( (L"nothing") == sValue ) this->m_eValue = levelsuffixNothing; + else if ( (L"space") == sValue ) this->m_eValue = levelsuffixSpace; + else if ( (L"tab") == sValue ) this->m_eValue = levelsuffixTab; + else this->m_eValue = levelsuffixNothing; + + return this->m_eValue; + } + + std::wstring CLevelSuffix::ToString () const + { + switch(this->m_eValue) + { + case levelsuffixNothing : return (L"nothing"); + case levelsuffixSpace : return (L"space"); + case levelsuffixTab : return (L"tab"); + default : return (L"nothing"); + } + } + + //-------------------------------------------------------------------------------- + // LineNumberRestart 17.18.47 (Part 1) + //-------------------------------------------------------------------------------- + + ELineNumberRestart CLineNumberRestart::FromString(const std::wstring &sValue) + { + if ( (L"continuous") == sValue ) this->m_eValue = linenumberrestartContinious; + else if ( (L"newPage") == sValue ) this->m_eValue = linenumberrestartNewPage; + else if ( (L"newSection") == sValue ) this->m_eValue = linenumberrestartNewSection; + else this->m_eValue = linenumberrestartNewPage; + + return this->m_eValue; + } + + std::wstring CLineNumberRestart::ToString () const + { + switch(this->m_eValue) + { + case linenumberrestartContinious : return (L"continuous"); + case linenumberrestartNewPage : return (L"newPage"); + case linenumberrestartNewSection : return (L"newSection"); + default : return (L"newPage"); + } + } + + //-------------------------------------------------------------------------------- + // LineSpacingRule 17.18.48 (Part 1) + //-------------------------------------------------------------------------------- + + ELineSpacingRule CLineSpacingRule::FromString(const std::wstring &sValue) + { + if ( (L"atLeast") == sValue ) this->m_eValue = linespacingruleAtLeast; + else if ( (L"auto") == sValue ) this->m_eValue = linespacingruleAuto; + else if ( (L"exact") == sValue ) this->m_eValue = linespacingruleExact; + else this->m_eValue = linespacingruleAuto; + + return this->m_eValue; + } + + std::wstring CLineSpacingRule::ToString () const + { + switch(this->m_eValue) + { + case linespacingruleAtLeast : return (L"atLeast"); + case linespacingruleAuto : return (L"auto"); + case linespacingruleExact : return (L"exact"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // Lock 17.18.49 (Part 1) + //-------------------------------------------------------------------------------- + + ELock CLock::FromString(const std::wstring &sValue) + { + if ( (L"contentLocked") == sValue ) this->m_eValue = lockContentLocked; + else if ( (L"sdtContentLocked") == sValue ) this->m_eValue = lockSdtContentLocked; + else if ( (L"sdtLocked") == sValue ) this->m_eValue = lockSdtLocked; + else if ( (L"unlocked") == sValue ) this->m_eValue = lockUnlocked; + else this->m_eValue = lockUnlocked; + + return this->m_eValue; + } + + std::wstring CLock::ToString () const + { + switch(this->m_eValue) + { + case lockContentLocked : return (L"contentLocked"); + case lockSdtContentLocked : return (L"sdtContentLocked"); + case lockSdtLocked : return (L"sdtLocked"); + case lockUnlocked : return (L"unlocked"); + default : return (L"unlocked"); + } + } + + //-------------------------------------------------------------------------------- + // LongHexNumber 17.18.50 (Part 1) + //-------------------------------------------------------------------------------- + + int CLongHexNumber::HexToInt(int nHex, bool &bResult) + { + if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); + if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); + if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); + + bResult = false; + + return 0; + } + + bool CLongHexNumber::Parse(const std::wstring &sValue) + { + if ( sValue.length() < 8 ) + return false; + + bool bResult = true; + + this->m_eValue = HexToInt( (int)sValue[7], bResult ); + this->m_eValue += HexToInt( (int)sValue[6], bResult ) << 4; + this->m_eValue += HexToInt( (int)sValue[5], bResult ) << 8; + this->m_eValue += HexToInt( (int)sValue[4], bResult ) << 12; + this->m_eValue += HexToInt( (int)sValue[3], bResult ) << 16; + this->m_eValue += HexToInt( (int)sValue[2], bResult ) << 20; + this->m_eValue += HexToInt( (int)sValue[1], bResult ) << 24; + this->m_eValue += HexToInt( (int)sValue[0], bResult ) << 28; + + return bResult; + } + + unsigned int CLongHexNumber::FromString(const std::wstring &sValue) + { + if ( !Parse(sValue) ) + { + this->m_eValue = 0; + } + + return this->m_eValue; + } + + std::wstring CLongHexNumber::ToString () const + { + return XmlUtils::ToString(this->m_eValue, L"%08X"); + } + + //-------------------------------------------------------------------------------- + // MacroName 17.18.51 (Part 1) + //-------------------------------------------------------------------------------- + + CMacroName::CMacroName() {} + + std::wstring CMacroName::GetValue() const + { + return m_sValue; + } + + void CMacroName::SetValue(std::wstring &sValue) + { + if ( sValue.length() <= 33 ) + m_sValue = sValue; + else + m_sValue = sValue.substr( 0, 33 ); + } + + std::wstring CMacroName::FromString(const std::wstring &sValue) + { + if ( sValue.length() <= 33 ) + m_sValue = sValue; + else + m_sValue = sValue.substr( 0, 33 ); + + return m_sValue; + } + + std::wstring CMacroName::ToString () const + { + return m_sValue; + } + + //-------------------------------------------------------------------------------- + // MailMergeDataType 17.18.52 (Part 1) + //-------------------------------------------------------------------------------- + + EMailMergeDataType CMailMergeDataType::FromString(const std::wstring &sValue) + { + if ( (L"native") == sValue ) this->m_eValue = mailmergeddatatypeNative; + else if ( (L"odbc") == sValue ) this->m_eValue = mailmergeddatatypeODBC; + else if ( (L"query") == sValue ) this->m_eValue = mailmergeddatatypeQuery; + else if ( (L"soap") == sValue ) this->m_eValue = mailmergeddatatypeSoap; + else if ( (L"spreadsheet") == sValue ) this->m_eValue = mailmergeddatatypeSpreadsheet; + else if ( (L"textFile") == sValue ) this->m_eValue = mailmergeddatatypeTextFile; + else if ( (L"xQuery") == sValue ) this->m_eValue = mailmergeddatatypeXQuery; + else if ( (L"xmlFile") == sValue ) this->m_eValue = mailmergeddatatypeXmlFile; + else this->m_eValue = mailmergeddatatypeTextFile; + + return this->m_eValue; + } + + std::wstring CMailMergeDataType::ToString () const + { + switch(this->m_eValue) + { + case mailmergeddatatypeNative : return (L"native"); + case mailmergeddatatypeODBC : return (L"odbc"); + case mailmergeddatatypeQuery : return (L"query"); + case mailmergeddatatypeSoap : return (L"soap"); + case mailmergeddatatypeSpreadsheet : return (L"spreadsheet"); + case mailmergeddatatypeTextFile : return (L"textFile"); + case mailmergeddatatypeXQuery : return (L"xQuery"); + case mailmergeddatatypeXmlFile : return (L"xmlFile"); + default : return (L"textFile"); + } + } + + //-------------------------------------------------------------------------------- + // MailMergeDest 17.18.53 (Part 1) + //-------------------------------------------------------------------------------- + + EMailMergeDest CMailMergeDest::FromString(const std::wstring &sValue) + { + if ( (L"email") == sValue ) this->m_eValue = mailmergeddestEmail; + else if ( (L"fax") == sValue ) this->m_eValue = mailmergeddestFax; + else if ( (L"newDocument") == sValue ) this->m_eValue = mailmergeddestNewDocument; + else if ( (L"printer") == sValue ) this->m_eValue = mailmergeddestPrinter; + else this->m_eValue = mailmergeddestEmail; + + return this->m_eValue; + } + + std::wstring CMailMergeDest::ToString () const + { + switch(this->m_eValue) + { + case mailmergeddestEmail : return (L"email"); + case mailmergeddestFax : return (L"fax"); + case mailmergeddestNewDocument : return (L"newDocument"); + case mailmergeddestPrinter : return (L"printer"); + default : return (L"newDocument"); + } + } + + //-------------------------------------------------------------------------------- + // MailMergeDocType 17.18.54 (Part 1) + //-------------------------------------------------------------------------------- + + EMailMergeDocType CMailMergeDocType::FromString(const std::wstring &sValue) + { + if ( (L"catalog") == sValue ) this->m_eValue = mailmergeddoctypeCatalog; + else if ( (L"email") == sValue ) this->m_eValue = mailmergeddoctypeEmail; + else if ( (L"envelopes") == sValue ) this->m_eValue = mailmergeddoctypeEnvelopes; + else if ( (L"fax") == sValue ) this->m_eValue = mailmergeddoctypeFax; + else if ( (L"formLetters") == sValue ) this->m_eValue = mailmergeddoctypeFormLetters; + else if ( (L"mailingLabels") == sValue ) this->m_eValue = mailmergeddoctypeMailingLabels; + else this->m_eValue = mailmergeddoctypeEmail; + + return this->m_eValue; + } + + std::wstring CMailMergeDocType::ToString () const + { + switch(this->m_eValue) + { + case mailmergeddoctypeCatalog : return (L"catalog"); + case mailmergeddoctypeEmail : return (L"email"); + case mailmergeddoctypeEnvelopes : return (L"envelopes"); + case mailmergeddoctypeFax : return (L"fax"); + case mailmergeddoctypeFormLetters : return (L"formLetters"); + case mailmergeddoctypeMailingLabels : return (L"mailingLabels"); + default : return (L"email"); + } + } + + //-------------------------------------------------------------------------------- + // MailMergeOdsoFMDFieldType 17.18.55 (Part 1) + //-------------------------------------------------------------------------------- + + EMailMergeOdsoFMDFieldType CMailMergeOdsoFMDFieldType::FromString(const std::wstring &sValue) + { + if ( (L"dbColumn") == sValue ) this->m_eValue = mailmergeodsofmdfieldtypeDbColumn; + else if ( (L"null") == sValue ) this->m_eValue = mailmergeodsofmdfieldtypeNull; + else this->m_eValue = mailmergeodsofmdfieldtypeNull; + + return this->m_eValue; + } + + std::wstring CMailMergeOdsoFMDFieldType::ToString () const + { + switch(this->m_eValue) + { + case mailmergeodsofmdfieldtypeDbColumn : return (L"dbColumn"); + case mailmergeodsofmdfieldtypeNull : return (L"null"); + default : return (L"null"); + } + } + + //-------------------------------------------------------------------------------- + // MailMergeSourceType 17.18.56 (Part 1) + //-------------------------------------------------------------------------------- + + EMailMergeSourceType CMailMergeSourceType::FromString(const std::wstring &sValue) + { + if ( (L"addressBook") == sValue ) this->m_eValue = mailmergesourcetypeAddressBook; + else if ( (L"database") == sValue ) this->m_eValue = mailmergesourcetypeDatabase; + else if ( (L"document1") == sValue ) this->m_eValue = mailmergesourcetypeDocument1; + else if ( (L"document2") == sValue ) this->m_eValue = mailmergesourcetypeDocument2; + else if ( (L"email") == sValue ) this->m_eValue = mailmergesourcetypeEmail; + else if ( (L"legacy") == sValue ) this->m_eValue = mailmergesourcetypeLegacy; + else if ( (L"master") == sValue ) this->m_eValue = mailmergesourcetypeMaster; + else if ( (L"native") == sValue ) this->m_eValue = mailmergesourcetypeNative; + else if ( (L"text") == sValue ) this->m_eValue = mailmergesourcetypeText; + else this->m_eValue = mailmergesourcetypeText; + + return this->m_eValue; + } + + std::wstring CMailMergeSourceType::ToString () const + { + switch(this->m_eValue) + { + case mailmergesourcetypeAddressBook : return (L"addressBook"); + case mailmergesourcetypeDatabase : return (L"database"); + case mailmergesourcetypeDocument1 : return (L"document1"); + case mailmergesourcetypeDocument2 : return (L"document2"); + case mailmergesourcetypeEmail : return (L"email"); + case mailmergesourcetypeLegacy : return (L"legacy"); + case mailmergesourcetypeMaster : return (L"master"); + case mailmergesourcetypeNative : return (L"native"); + case mailmergesourcetypeText : return (L"text"); + default : return (L"text"); + } + } + + //-------------------------------------------------------------------------------- + // Merge 17.18.57 (Part 1) + //-------------------------------------------------------------------------------- + + EMerge CMerge::FromString(const std::wstring &sValue) + { + if ( (L"continue") == sValue ) this->m_eValue = mergeContinue; + else if ( (L"restart") == sValue ) this->m_eValue = mergeRestart; + else this->m_eValue = mergeContinue; + + return this->m_eValue; + } + + std::wstring CMerge::ToString () const + { + switch(this->m_eValue) + { + case mergeContinue : return (L"continue"); + case mergeRestart : return (L"restart"); + default : return (L"restart"); + } + } + + //-------------------------------------------------------------------------------- + // MultiLevelType 17.18.58 (Part 1) + //-------------------------------------------------------------------------------- + + EMultiLevelType CMultiLevelType::FromString(const std::wstring &sValue) + { + if ( L"hybridMultilevel" == sValue || + L"HybridMultilevel" == sValue) this->m_eValue = emultileveltypeHybridMultilevel; + else if ( L"multilevel" == sValue || + L"Multilevel" == sValue ) this->m_eValue = emultileveltypeMultilevel; + else if ( L"singleLevel" == sValue || + L"SingleLevel" == sValue) this->m_eValue = emultileveltypeSingleLevel; + else this->m_eValue = emultileveltypeSingleLevel; + + return this->m_eValue; + } + + std::wstring CMultiLevelType::ToString () const + { + switch(this->m_eValue) + { + case emultileveltypeHybridMultilevel : return (L"hybridMultilevel"); + case emultileveltypeMultilevel : return (L"multilevel"); + case emultileveltypeSingleLevel : return (L"singleLevel"); + default : return (L"singleLevel"); + } + } + + //-------------------------------------------------------------------------------- + // NumberFormat 17.18.59 (Part 1) + //-------------------------------------------------------------------------------- + + ENumberFormat CNumberFormat::FromString(const std::wstring &sValue) + { + if ( (L"aiueo") == sValue ) this->m_eValue = numberformatAiueo; + else if ( (L"aiueoFullWidth") == sValue ) this->m_eValue = numberformatAiueoFullWidth; + else if ( (L"arabicAbjad") == sValue ) this->m_eValue = numberformatArabicAbjad; + else if ( (L"arabicAlpha") == sValue ) this->m_eValue = numberformatArabicAlpha; + else if ( (L"bahtText") == sValue ) this->m_eValue = numberformatBahtText; + else if ( (L"bullet") == sValue ) this->m_eValue = numberformatBullet; + else if ( (L"cardinalText") == sValue ) this->m_eValue = numberformatCardinalText; + else if ( (L"chicago") == sValue ) this->m_eValue = numberformatChicago; + else if ( (L"chineseCounting") == sValue ) this->m_eValue = numberformatChineseCounting; + else if ( (L"chineseCountingThousand") == sValue ) this->m_eValue = numberformatChineseCountingThousand; + else if ( (L"chineseLegalSimplified") == sValue ) this->m_eValue = numberformatChineseLegalSimplified; + else if ( (L"chosung") == sValue ) this->m_eValue = numberformatChosung; + else if ( (L"custom") == sValue ) this->m_eValue = numberformatCustom; + else if ( (L"decimal") == sValue ) this->m_eValue = numberformatDecimal; + else if ( (L"decimalEnclosedCircle") == sValue ) this->m_eValue = numberformatDecimalEnclosedCircle; + else if ( (L"decimalEnclosedCircleChinese") == sValue ) this->m_eValue = numberformatDecimalEnclosedCircleChinese; + else if ( (L"decimalEnclosedFullstop") == sValue ) this->m_eValue = numberformatDecimalEnclosedFullstop; + else if ( (L"decimalEnclosedParen") == sValue ) this->m_eValue = numberformatDecimalEnclosedParen; + else if ( (L"decimalFullWidth") == sValue ) this->m_eValue = numberformatDecimalFullWidth; + else if ( (L"decimalFullWidth2") == sValue ) this->m_eValue = numberformatDecimalFullWidth2; + else if ( (L"decimalHalfWidth") == sValue ) this->m_eValue = numberformatDecimalHalfWidth; + else if ( (L"decimalZero") == sValue ) this->m_eValue = numberformatDecimalZero; + else if ( (L"dollarText") == sValue ) this->m_eValue = numberformatDollarText; + else if ( (L"ganada") == sValue ) this->m_eValue = numberformatGanada; + else if ( (L"hebrew1") == sValue ) this->m_eValue = numberformatHebrew1; + else if ( (L"hebrew2") == sValue ) this->m_eValue = numberformatHebrew2; + else if ( (L"hex") == sValue ) this->m_eValue = numberformatHex; + else if ( (L"hindiConsonants") == sValue ) this->m_eValue = numberformatHindiConsonants; + else if ( (L"hindiCounting") == sValue ) this->m_eValue = numberformatHindiCounting; + else if ( (L"hindiNumbers") == sValue ) this->m_eValue = numberformatHindiNumbers; + else if ( (L"hindiVowels") == sValue ) this->m_eValue = numberformatHindiVowels; + else if ( (L"ideographDigital") == sValue ) this->m_eValue = numberformatIdeographDigital; + else if ( (L"ideographEnclosedCircle") == sValue ) this->m_eValue = numberformatIdeographEnclosedCircle; + else if ( (L"ideographLegalTraditional") == sValue ) this->m_eValue = numberformatIdeographLegalTraditional; + else if ( (L"ideographTraditional") == sValue ) this->m_eValue = numberformatIdeographTraditional; + else if ( (L"ideographZodiac") == sValue ) this->m_eValue = numberformatIdeographZodiac; + else if ( (L"ideographZodiacTraditional") == sValue ) this->m_eValue = numberformatIdeographZodiacTraditional; + else if ( (L"iroha") == sValue ) this->m_eValue = numberformatIroha; + else if ( (L"irohaFullWidth") == sValue ) this->m_eValue = numberformatIrohaFullWidth; + else if ( (L"japaneseCounting") == sValue ) this->m_eValue = numberformatJapaneseCounting; + else if ( (L"japaneseDigitalTenThousand") == sValue ) this->m_eValue = numberformatJapaneseDigitalTenThousand; + else if ( (L"japaneseLegal") == sValue ) this->m_eValue = numberformatJapaneseLegal; + else if ( (L"koreanCounting") == sValue ) this->m_eValue = numberformatKoreanCounting; + else if ( (L"koreanDigital") == sValue ) this->m_eValue = numberformatKoreanDigital; + else if ( (L"koreanDigital2") == sValue ) this->m_eValue = numberformatKoreanDigital2; + else if ( (L"koreanLegal") == sValue ) this->m_eValue = numberformatKoreanLegal; + else if ( (L"lowerLetter") == sValue ) this->m_eValue = numberformatLowerLetter; + else if ( (L"lowerRoman") == sValue ) this->m_eValue = numberformatLowerRoman; + else if ( (L"none") == sValue ) this->m_eValue = numberformatNone; + else if ( (L"numberInDash") == sValue ) this->m_eValue = numberformatNumberInDash; + else if ( (L"ordinal") == sValue ) this->m_eValue = numberformatOrdinal; + else if ( (L"ordinalText") == sValue ) this->m_eValue = numberformatOrdinalText; + else if ( (L"russianLower") == sValue ) this->m_eValue = numberformatRussianLower; + else if ( (L"russianUpper") == sValue ) this->m_eValue = numberformatRussianUpper; + else if ( (L"taiwaneseCounting") == sValue ) this->m_eValue = numberformatTaiwaneseCounting; + else if ( (L"taiwaneseCountingThousand") == sValue ) this->m_eValue = numberformatTaiwaneseCountingThousand; + else if ( (L"taiwaneseDigital") == sValue ) this->m_eValue = numberformatTaiwaneseDigital; + else if ( (L"thaiCounting") == sValue ) this->m_eValue = numberformatThaiCounting; + else if ( (L"thaiLetters") == sValue ) this->m_eValue = numberformatThaiLetters; + else if ( (L"thaiNumbers") == sValue ) this->m_eValue = numberformatThaiNumbers; + else if ( (L"upperLetter") == sValue ) this->m_eValue = numberformatUpperLetter; + else if ( (L"upperRoman") == sValue ) this->m_eValue = numberformatUpperRoman; + else if ( (L"vietnameseCounting") == sValue ) this->m_eValue = numberformatVietnameseCounting; + else this->m_eValue = numberformatNone; + + return this->m_eValue; + } + + std::wstring CNumberFormat::ToString () const + { + switch(this->m_eValue) + { + case numberformatAiueo : return (L"aiueo"); + case numberformatAiueoFullWidth : return (L"aiueoFullWidth"); + case numberformatArabicAbjad : return (L"arabicAbjad"); + case numberformatArabicAlpha : return (L"arabicAlpha"); + case numberformatBahtText : return (L"bahtText"); + case numberformatBullet : return (L"bullet"); + case numberformatCardinalText : return (L"cardinalText"); + case numberformatChicago : return (L"chicago"); + case numberformatChineseCounting : return (L"chineseCounting"); + case numberformatChineseCountingThousand : return (L"chineseCountingThousand"); + case numberformatChineseLegalSimplified : return (L"chineseLegalSimplified"); + case numberformatChosung : return (L"chosung"); + case numberformatCustom : return (L"custom"); + case numberformatDecimal : return (L"decimal"); + case numberformatDecimalEnclosedCircle : return (L"decimalEnclosedCircle"); + case numberformatDecimalEnclosedCircleChinese : return (L"decimalEnclosedCircleChinese"); + case numberformatDecimalEnclosedFullstop : return (L"decimalEnclosedFullstop"); + case numberformatDecimalEnclosedParen : return (L"decimalEnclosedParen"); + case numberformatDecimalFullWidth : return (L"decimalFullWidth"); + case numberformatDecimalFullWidth2 : return (L"decimalFullWidth2"); + case numberformatDecimalHalfWidth : return (L"decimalHalfWidth"); + case numberformatDecimalZero : return (L"decimalZero"); + case numberformatDollarText : return (L"dollarText"); + case numberformatGanada : return (L"ganada"); + case numberformatHebrew1 : return (L"hebrew1"); + case numberformatHebrew2 : return (L"hebrew2"); + case numberformatHex : return (L"hex"); + case numberformatHindiConsonants : return (L"hindiConsonants"); + case numberformatHindiCounting : return (L"hindiCounting"); + case numberformatHindiNumbers : return (L"hindiNumbers"); + case numberformatHindiVowels : return (L"hindiVowels"); + case numberformatIdeographDigital : return (L"ideographDigital"); + case numberformatIdeographEnclosedCircle : return (L"ideographEnclosedCircle"); + case numberformatIdeographLegalTraditional : return (L"ideographLegalTraditional"); + case numberformatIdeographTraditional : return (L"ideographTraditional"); + case numberformatIdeographZodiac : return (L"ideographZodiac"); + case numberformatIdeographZodiacTraditional : return (L"ideographZodiacTraditional"); + case numberformatIroha : return (L"iroha"); + case numberformatIrohaFullWidth : return (L"irohaFullWidth"); + case numberformatJapaneseCounting : return (L"japaneseCounting"); + case numberformatJapaneseDigitalTenThousand : return (L"japaneseDigitalTenThousand"); + case numberformatJapaneseLegal : return (L"japaneseLegal"); + case numberformatKoreanCounting : return (L"koreanCounting"); + case numberformatKoreanDigital : return (L"koreanDigital"); + case numberformatKoreanDigital2 : return (L"koreanDigital2"); + case numberformatKoreanLegal : return (L"koreanLegal"); + case numberformatLowerLetter : return (L"lowerLetter"); + case numberformatLowerRoman : return (L"lowerRoman"); + case numberformatNone : return (L"none"); + case numberformatNumberInDash : return (L"numberInDash"); + case numberformatOrdinal : return (L"ordinal"); + case numberformatOrdinalText : return (L"ordinalText"); + case numberformatRussianLower : return (L"russianLower"); + case numberformatRussianUpper : return (L"russianUpper"); + case numberformatTaiwaneseCounting : return (L"taiwaneseCounting"); + case numberformatTaiwaneseCountingThousand : return (L"taiwaneseCountingThousand"); + case numberformatTaiwaneseDigital : return (L"taiwaneseDigital"); + case numberformatThaiCounting : return (L"thaiCounting"); + case numberformatThaiLetters : return (L"thaiLetters"); + case numberformatThaiNumbers : return (L"thaiNumbers"); + case numberformatUpperLetter : return (L"upperLetter"); + case numberformatUpperRoman : return (L"upperRoman"); + case numberformatVietnameseCounting : return (L"vietnameseCounting"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // ObjectDrawAspect 17.18.60 (Part 1) + //-------------------------------------------------------------------------------- + + EObjectDrawAspect CObjectDrawAspect::FromString(const std::wstring &sValue) + { + if ( (L"content") == sValue ) this->m_eValue = objectdrawaspectContent; + else if ( (L"icon") == sValue ) this->m_eValue = objectdrawaspectIcon; + else this->m_eValue = objectdrawaspectContent; + + return this->m_eValue; + } + + std::wstring CObjectDrawAspect::ToString () const + { + switch(this->m_eValue) + { + case objectdrawaspectContent : return (L"content"); + case objectdrawaspectIcon : return (L"icon"); + default : return (L"content"); + } + } + + //-------------------------------------------------------------------------------- + // ObjectUpdateMode 17.18.61 (Part 1) + //-------------------------------------------------------------------------------- + + EObjectUpdateMode CObjectUpdateMode::FromString(const std::wstring &sValue) + { + if ( (L"always") == sValue ) this->m_eValue = objectupdatemodeAlways; + else if ( (L"onCall") == sValue ) this->m_eValue = objectupdatemodeOnCall; + else this->m_eValue = objectupdatemodeAlways; + + return this->m_eValue; + } + + std::wstring CObjectUpdateMode::ToString () const + { + switch(this->m_eValue) + { + case objectupdatemodeAlways : return (L"always"); + case objectupdatemodeOnCall : return (L"onCall"); + default : return (L"always"); + } + } + + //-------------------------------------------------------------------------------- + // PageBorderDisplay 17.18.62 (Part 1) + //-------------------------------------------------------------------------------- + + EPageBorderDisplay CPageBorderDisplay::FromString(const std::wstring &sValue) + { + if ( (L"allPages") == sValue ) this->m_eValue = pageborderdisplayAllPages; + else if ( (L"firstPage") == sValue ) this->m_eValue = pageborderdisplayFirstPage; + else if ( (L"notFirstPage") == sValue ) this->m_eValue = pageborderdisplayNotFirstPage; + else this->m_eValue = pageborderdisplayAllPages; + + return this->m_eValue; + } + + std::wstring CPageBorderDisplay::ToString () const + { + switch(this->m_eValue) + { + case pageborderdisplayAllPages : return (L"allPages"); + case pageborderdisplayFirstPage : return (L"firstPage"); + case pageborderdisplayNotFirstPage : return (L"notFirstPage"); + default : return (L"allPages"); + } + } + + //-------------------------------------------------------------------------------- + // PageBorderOffset 17.18.63 (Part1) + //-------------------------------------------------------------------------------- + + EPageBorderOffset CPageBorderOffset::FromString(const std::wstring &sValue) + { + if ( (L"page") == sValue ) this->m_eValue = pageborderoffsetPage; + else if ( (L"text") == sValue ) this->m_eValue = pageborderoffsetText; + else this->m_eValue = pageborderoffsetPage; + + return this->m_eValue; + } + + std::wstring CPageBorderOffset::ToString () const + { + switch(this->m_eValue) + { + case pageborderoffsetPage : return (L"page"); + case pageborderoffsetText : return (L"text"); + default : return (L"page"); + } + } + + //-------------------------------------------------------------------------------- + // PageBorderZOrder 17.18.64 (Part 1) + //-------------------------------------------------------------------------------- + + EPageBorderZOrder CPageBorderZOrder::FromString(const std::wstring &sValue) + { + if ( (L"back") == sValue ) this->m_eValue = pageborderzorderBack; + else if ( (L"front") == sValue ) this->m_eValue = pageborderzorderFront; + else this->m_eValue = pageborderzorderBack; + + return this->m_eValue; + } + + std::wstring CPageBorderZOrder::ToString () const + { + switch(this->m_eValue) + { + case pageborderzorderBack : return (L"back"); + case pageborderzorderFront : return (L"front"); + default : return (L"back"); + } + } + + //-------------------------------------------------------------------------------- + // PageOrientation 17.18.65 (Part 1) + //-------------------------------------------------------------------------------- + + EPageOrientation CPageOrientation::FromString(const std::wstring &sValue) + { + if ( (L"landscape") == sValue ) this->m_eValue = pageorientLandscape; + else if ( (L"portrait") == sValue ) this->m_eValue = pageorientPortrait; + else this->m_eValue = pageorientPortrait; + + return this->m_eValue; + } + + std::wstring CPageOrientation::ToString () const + { + switch(this->m_eValue) + { + case pageorientLandscape : return (L"landscape"); + case pageorientPortrait : return (L"portrait"); + default : return (L"portrait"); + } + } + + //-------------------------------------------------------------------------------- + // Pitch 17.18.66 (Part 1) + //-------------------------------------------------------------------------------- + + EPitch CPitch::FromString(const std::wstring &sValue) + { + if ( (L"default") == sValue ) this->m_eValue = pitchDefault; + else if ( (L"fixed") == sValue ) this->m_eValue = pitchFixed; + else if ( (L"variable") == sValue ) this->m_eValue = pitchVariable; + else this->m_eValue = pitchDefault; + + return this->m_eValue; + } + + std::wstring CPitch::ToString () const + { + switch(this->m_eValue) + { + case pitchDefault : return (L"default"); + case pitchFixed : return (L"fixed"); + case pitchVariable : return (L"variable"); + default : return (L"default"); + } + } + + //-------------------------------------------------------------------------------- + // PixelsMeasure 17.18.67 (Part 1) + //-------------------------------------------------------------------------------- + + int CPixelsMeasure::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger(sValue); + + return this->m_eValue; + } + + std::wstring CPixelsMeasure::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // PointMeasure 17.18.68 (Part 1) + //-------------------------------------------------------------------------------- + + int CPointMeasure::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger(sValue); + + return this->m_eValue; + } + + std::wstring CPointMeasure::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + double CPointMeasure::ToPoints() const + { + return (double)this->m_eValue; + } + + double CPointMeasure::ToMM() const + { + return (double)Pt_To_Mm(this->m_eValue); + } + + double CPointMeasure::ToInches() const + { + return this->m_eValue / 72.0; + } + + + void CPointMeasure::FromPoints(double dValue) + { + this->m_eValue = (int)dValue; + } + + void CPointMeasure::FromInches(double dValue) + { + this->m_eValue = (int)(dValue * 72.0); + } + + //-------------------------------------------------------------------------------- + // Proof 17.18.69 (Part 1) + //-------------------------------------------------------------------------------- + + EProof CProof::FromString(const std::wstring &sValue) + { + if ( (L"clean") == sValue ) this->m_eValue = proofClean; + else if ( (L"dirty") == sValue ) this->m_eValue = proofDirty; + else this->m_eValue = proofDirty; + + return this->m_eValue; + } + + std::wstring CProof::ToString () const + { + switch(this->m_eValue) + { + case proofClean : return (L"clean"); + case proofDirty : return (L"dirty"); + default : return (L"dirty"); + } + } + + //-------------------------------------------------------------------------------- + // ProofErr 17.18.70 (Part 1) + //-------------------------------------------------------------------------------- + + EProofErr CProofErr::FromString(const std::wstring &sValue) + { + if ( (L"gramEnd") == sValue ) this->m_eValue = prooferrGramEnd; + else if ( (L"gramStart") == sValue ) this->m_eValue = prooferrGramStart; + else if ( (L"spellEnd") == sValue ) this->m_eValue = prooferrSpellEnd; + else if ( (L"spellStart") == sValue ) this->m_eValue = prooferrSpellStart; + else this->m_eValue = prooferrSpellStart; + + return this->m_eValue; + } + + std::wstring CProofErr::ToString () const + { + switch(this->m_eValue) + { + case prooferrGramEnd : return (L"gramEnd"); + case prooferrGramStart : return (L"gramStart"); + case prooferrSpellEnd : return (L"spellEnd"); + case prooferrSpellStart : return (L"spellStart"); + default : return (L"spellStart"); + } + } + + //-------------------------------------------------------------------------------- + // PTabAlignment 17.18.71 (Part 1) + //-------------------------------------------------------------------------------- + + EPTabAlignment CPTabAlignment::FromString(const std::wstring &sValue) + { + if ( (L"center") == sValue ) this->m_eValue = ptabalignmentCenter; + else if ( (L"left") == sValue ) this->m_eValue = ptabalignmentLeft; + else if ( (L"right") == sValue ) this->m_eValue = ptabalignmentRight; + else this->m_eValue = ptabalignmentLeft; + + return this->m_eValue; + } + + std::wstring CPTabAlignment::ToString () const + { + switch(this->m_eValue) + { + case ptabalignmentCenter : return (L"center"); + case ptabalignmentLeft : return (L"left"); + case ptabalignmentRight : return (L"right"); + default : return (L"left"); + } + } + + //-------------------------------------------------------------------------------- + // PTabLeader 17.18.72 (Part 1) + //-------------------------------------------------------------------------------- + + EPTabLeader CPTabLeader::FromString(const std::wstring &sValue) + { + if ( (L"dot") == sValue ) this->m_eValue = ptableaderDot; + else if ( (L"hyphen") == sValue ) this->m_eValue = ptableaderHyphen; + else if ( (L"middleDot") == sValue ) this->m_eValue = ptableaderMiddleDot; + else if ( (L"none") == sValue ) this->m_eValue = ptableaderNone; + else if ( (L"underscore") == sValue ) this->m_eValue = ptableaderUnderscore; + else this->m_eValue = ptableaderNone; + + return this->m_eValue; + } + + std::wstring CPTabLeader::ToString () const + { + switch(this->m_eValue) + { + case ptableaderDot : return (L"dot"); + case ptableaderHyphen : return (L"hyphen"); + case ptableaderMiddleDot : return (L"middleDot"); + case ptableaderNone : return (L"none"); + case ptableaderUnderscore : return (L"underscore"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // PTabRelativeTo 17.18.73 (Part 1) + //-------------------------------------------------------------------------------- + + EPTabRelativeTo CPTabRelativeTo::FromString(const std::wstring &sValue) + { + if ( (L"indent") == sValue ) this->m_eValue = ptabrelativetoIndent; + else if ( (L"margin") == sValue ) this->m_eValue = ptabrelativetoMargin; + else this->m_eValue = ptabrelativetoIndent; + + return this->m_eValue; + } + + std::wstring CPTabRelativeTo::ToString () const + { + switch(this->m_eValue) + { + case ptabrelativetoIndent : return (L"indent"); + case ptabrelativetoMargin : return (L"margin"); + default : return (L"indent"); + } + } + + //-------------------------------------------------------------------------------- + // RestartNumber 17.18.74 (Part 1) + //-------------------------------------------------------------------------------- + + ERestartNumber CRestartNumber::FromString(const std::wstring &sValue) + { + if ( (L"continuous") == sValue ) this->m_eValue = restartnumberContinious; + else if ( (L"eachPage") == sValue ) this->m_eValue = restartnumberEachPage; + else if ( (L"eachSect") == sValue ) this->m_eValue = restartnumberEachSect; + else this->m_eValue = restartnumberContinious; + + return this->m_eValue; + } + + std::wstring CRestartNumber::ToString () const + { + switch(this->m_eValue) + { + case restartnumberContinious : return (L"continuous"); + case restartnumberEachPage : return (L"eachPage"); + case restartnumberEachSect : return (L"eachSect"); + default : return (L"continuous"); + } + } + + //-------------------------------------------------------------------------------- + // RubyAlign 17.18.75 (Part 1) + //-------------------------------------------------------------------------------- + + ERubyAlign CRubyAlign::FromString(const std::wstring &sValue) + { + if ( (L"center") == sValue ) this->m_eValue = erubyalignCenter; + else if ( (L"distributeLetter") == sValue ) this->m_eValue = erubyalignDistributeLetter; + else if ( (L"distributeSpace") == sValue ) this->m_eValue = erubyalignDistributeSpace; + else if ( (L"left") == sValue ) this->m_eValue = erubyalignLeft; + else if ( (L"right") == sValue ) this->m_eValue = erubyalignRight; + else if ( (L"rightVertical") == sValue ) this->m_eValue = erubyalignRightVertical; + else this->m_eValue = erubyalignLeft; + + return this->m_eValue; + } + + std::wstring CRubyAlign::ToString () const + { + switch(this->m_eValue) + { + case erubyalignCenter : return (L"center"); + case erubyalignDistributeLetter : return (L"distributeLetter"); + case erubyalignDistributeSpace : return (L"distributeSpace"); + case erubyalignLeft : return (L"left"); + case erubyalignRight : return (L"right"); + case erubyalignRightVertical : return (L"rightVertical"); + default : return (L"left"); + } + } + + //-------------------------------------------------------------------------------- + // SdtDateMappingType 17.18.76 (Part 1) + //-------------------------------------------------------------------------------- + + ESdtDateMappingType CSdtDateMappingType::FromString(const std::wstring &sValue) + { + if ( (L"date") == sValue ) this->m_eValue = sdtdatemappingtypeDate; + else if ( (L"dateTime") == sValue ) this->m_eValue = sdtdatemappingtypeDateTime; + else if ( (L"text") == sValue ) this->m_eValue = sdtdatemappingtypeText; + else this->m_eValue = sdtdatemappingtypeText; + + return this->m_eValue; + } + + std::wstring CSdtDateMappingType::ToString () const + { + switch(this->m_eValue) + { + case sdtdatemappingtypeDate : return (L"date"); + case sdtdatemappingtypeDateTime : return (L"dateTime"); + case sdtdatemappingtypeText : return (L"text"); + default : return (L"text"); + } + } + + //-------------------------------------------------------------------------------- + // SectionMark 17.18.77 (Part 1) + //-------------------------------------------------------------------------------- + + ESectionMark CSectionMark::FromString(const std::wstring &sValue) + { + if ( (L"continuous") == sValue ) this->m_eValue = sectionmarkContinious; + else if ( (L"evenPage") == sValue ) this->m_eValue = sectionmarkEvenPage; + else if ( (L"nextColumn") == sValue ) this->m_eValue = sectionmarkNextColumn; + else if ( (L"nextPage") == sValue ) this->m_eValue = sectionmarkNextPage; + else if ( (L"oddPage") == sValue ) this->m_eValue = sectionmarkOddPage; + else this->m_eValue = sectionmarkNextPage; + + return this->m_eValue; + } + + std::wstring CSectionMark::ToString () const + { + switch(this->m_eValue) + { + case sectionmarkContinious : return (L"continuous"); + case sectionmarkEvenPage : return (L"evenPage"); + case sectionmarkNextColumn : return (L"nextColumn"); + case sectionmarkNextPage : return (L"nextPage"); + case sectionmarkOddPage : return (L"oddPage"); + default : return (L"nextPage"); + } + } + + //-------------------------------------------------------------------------------- + // Shd 17.18.78 (Part 1) + //-------------------------------------------------------------------------------- + + EShd CShd::FromString(const std::wstring &sValue) + { + if ( (L"clear") == sValue ) this->m_eValue = shdClear; + else if ( (L"diagCross") == sValue ) this->m_eValue = shdDiagCross; + else if ( (L"diagStripe") == sValue ) this->m_eValue = shdDiagStripe; + else if ( (L"horzCross") == sValue ) this->m_eValue = shdHorzCross; + else if ( (L"horzStripe") == sValue ) this->m_eValue = shdHorzStripe; + else if ( (L"nil") == sValue ) this->m_eValue = shdNil; + else if ( (L"pct10") == sValue ) this->m_eValue = shdPct10; + else if ( (L"pct12") == sValue ) this->m_eValue = shdPct12; + else if ( (L"pct15") == sValue ) this->m_eValue = shdPct15; + else if ( (L"pct20") == sValue ) this->m_eValue = shdPct20; + else if ( (L"pct25") == sValue ) this->m_eValue = shdPct25; + else if ( (L"pct30") == sValue ) this->m_eValue = shdPct30; + else if ( (L"pct35") == sValue ) this->m_eValue = shdPct35; + else if ( (L"pct37") == sValue ) this->m_eValue = shdPct37; + else if ( (L"pct40") == sValue ) this->m_eValue = shdPct40; + else if ( (L"pct45") == sValue ) this->m_eValue = shdPct45; + else if ( (L"pct5") == sValue ) this->m_eValue = shdPct5; + else if ( (L"pct50") == sValue ) this->m_eValue = shdPct50; + else if ( (L"pct55") == sValue ) this->m_eValue = shdPct55; + else if ( (L"pct60") == sValue ) this->m_eValue = shdPct60; + else if ( (L"pct62") == sValue ) this->m_eValue = shdPct62; + else if ( (L"pct65") == sValue ) this->m_eValue = shdPct65; + else if ( (L"pct70") == sValue ) this->m_eValue = shdPct70; + else if ( (L"pct75") == sValue ) this->m_eValue = shdPct75; + else if ( (L"pct80") == sValue ) this->m_eValue = shdPct80; + else if ( (L"pct85") == sValue ) this->m_eValue = shdPct85; + else if ( (L"pct87") == sValue ) this->m_eValue = shdPct87; + else if ( (L"pct90") == sValue ) this->m_eValue = shdPct90; + else if ( (L"pct95") == sValue ) this->m_eValue = shdPct95; + else if ( (L"reverseDiagStripe") == sValue ) this->m_eValue = shdReverseDiagStripe; + else if ( (L"solid") == sValue ) this->m_eValue = shdSolid; + else if ( (L"thinDiagCross") == sValue ) this->m_eValue = shdThinDiagCross; + else if ( (L"thinDiagStripe") == sValue ) this->m_eValue = shdThinDiagStripe; + else if ( (L"thinHorzCross") == sValue ) this->m_eValue = shdThinHorzCross; + else if ( (L"thinHorzStripe") == sValue ) this->m_eValue = shdThinHorzStripe; + else if ( (L"thinReverseDiagStripe") == sValue ) this->m_eValue = shdThinReverseDiagStripe; + else if ( (L"thinVertStripe") == sValue ) this->m_eValue = shdThinVertStripe; + else if ( (L"vertStripe") == sValue ) this->m_eValue = shdVertStripe; + else this->m_eValue = shdSolid; + + return this->m_eValue; + } + + std::wstring CShd::ToString () const + { + switch(this->m_eValue) + { + case shdClear : return (L"clear"); + case shdDiagCross : return (L"diagCross"); + case shdDiagStripe : return (L"diagStripe"); + case shdHorzCross : return (L"horzCross"); + case shdHorzStripe : return (L"horzStripe"); + case shdNil : return (L"nil"); + case shdPct10 : return (L"pct10"); + case shdPct12 : return (L"pct12"); + case shdPct15 : return (L"pct15"); + case shdPct20 : return (L"pct20"); + case shdPct25 : return (L"pct25"); + case shdPct30 : return (L"pct30"); + case shdPct35 : return (L"pct35"); + case shdPct37 : return (L"pct37"); + case shdPct40 : return (L"pct40"); + case shdPct45 : return (L"pct45"); + case shdPct5 : return (L"pct5"); + case shdPct50 : return (L"pct50"); + case shdPct55 : return (L"pct55"); + case shdPct60 : return (L"pct60"); + case shdPct62 : return (L"pct62"); + case shdPct65 : return (L"pct65"); + case shdPct70 : return (L"pct70"); + case shdPct75 : return (L"pct75"); + case shdPct80 : return (L"pct80"); + case shdPct85 : return (L"pct85"); + case shdPct87 : return (L"pct87"); + case shdPct90 : return (L"pct90"); + case shdPct95 : return (L"pct95"); + case shdReverseDiagStripe : return (L"reverseDiagStripe"); + case shdSolid : return (L"solid"); + case shdThinDiagCross : return (L"thinDiagCross"); + case shdThinDiagStripe : return (L"thinDiagStripe"); + case shdThinHorzCross : return (L"thinHorzCross"); + case shdThinHorzStripe : return (L"thinHorzStripe"); + case shdThinReverseDiagStripe : return (L"thinReverseDiagStripe"); + case shdThinVertStripe : return (L"thinVertStripe"); + case shdVertStripe : return (L"vertStripe"); + default : return (L"solid"); + } + } + + //-------------------------------------------------------------------------------- + // ShortHexNumber 17.18.79 (Part 1) + //-------------------------------------------------------------------------------- + + int CShortHexNumber::HexToInt(int nHex, bool &bResult) + { + if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); + if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); + if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); + + bResult = false; + + return 0; + } + + bool CShortHexNumber::Parse(const std::wstring &sValue) + { + size_t nLength = sValue.length(); + + bool bResult = true; + if(nLength > 0) + { + this->m_eValue = HexToInt( (int)sValue[nLength - 1], bResult ); + if(nLength > 1) + { + this->m_eValue += HexToInt( (int)sValue[nLength - 2], bResult ) << 4; + if(nLength > 2) + { + this->m_eValue += HexToInt( (int)sValue[nLength - 3], bResult ) << 8; + if(nLength > 3) + { + this->m_eValue += HexToInt( (int)sValue[nLength - 4], bResult ) << 12; + } + } + } + } + else + bResult = false; + + return bResult; + } + + int CShortHexNumber::FromString(const std::wstring &sValue) + { + if ( !Parse(sValue) ) + { + this->m_eValue = 0; + } + + return this->m_eValue; + } + + std::wstring CShortHexNumber::ToString () const + { + return XmlUtils::ToString( this->m_eValue, L"%04X"); + } + + //-------------------------------------------------------------------------------- + // SignedHpsMeasure 17.18.80 (Part 1) + //-------------------------------------------------------------------------------- + + CSignedHpsMeasure::CSignedHpsMeasure() {} + + double CSignedHpsMeasure::FromString(const std::wstring &sValue) + { + Parse(sValue, 2); + + return m_dValue; + } + void CSignedHpsMeasure::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = dValue; + } + std::wstring CSignedHpsMeasure::ToString () const + { + std::wstring sResult; + + if (m_bUnit) + sResult = boost::lexical_cast(m_dValue) + L"pt"; + else + sResult = std::to_wstring((int)(m_dValue * 2)); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // SignedTwipsMeasure 17.18.81 (Part 1) + //-------------------------------------------------------------------------------- + + CSignedTwipsMeasure::CSignedTwipsMeasure() {} + void CSignedTwipsMeasure::SetValue(double dValue) + { + m_bUnit = false; + m_dValue = FromTwips(dValue); + } + double CSignedTwipsMeasure::FromString(const std::wstring &sValue) + { + Parse(sValue, 20); + + return m_dValue; + } + + std::wstring CSignedTwipsMeasure::ToString () const + { + std::wstring sResult; + + if ( m_bUnit ) + sResult = boost::lexical_cast( m_dValue ) + L"pt"; + else + sResult = std::to_wstring( (int)(m_dValue * 20) ); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // StyleSort 17.18.82 (Part 1) + 9.10.4 (Part 4) + //-------------------------------------------------------------------------------- + + EStyleSort CStyleSort::FromString(const std::wstring &sValue) + { + m_bNames = false; + if ( (L"basedOn") == sValue || (L"0004") == sValue ) this->m_eValue = stylesortBasedOn; + else if ( (L"default") == sValue || (L"0002") == sValue ) this->m_eValue = stylesortDefault; + else if ( (L"font") == sValue || (L"0003") == sValue ) this->m_eValue = stylesortFont; + else if ( (L"name") == sValue || (L"0000") == sValue ) this->m_eValue = stylesortName; + else if ( (L"priority") == sValue || (L"0001") == sValue ) this->m_eValue = stylesortPriority; + else if ( (L"type") == sValue || (L"0005") == sValue ) this->m_eValue = stylesortType; + else this->m_eValue = stylesortName; + + return this->m_eValue; + } + + std::wstring CStyleSort::ToString () const + { + if ( m_bNames ) + { + switch(this->m_eValue) + { + case stylesortBasedOn : return (L"basedOn"); + case stylesortDefault : return (L"default"); + case stylesortFont : return (L"font"); + case stylesortName : return (L"name"); + case stylesortPriority : return (L"priority"); + case stylesortType : return (L"type"); + default : return (L"default"); + } + } + else + { + switch(this->m_eValue) + { + case stylesortBasedOn : return (L"0004"); + case stylesortDefault : return (L"0002"); + case stylesortFont : return (L"0003"); + case stylesortName : return (L"0000"); + case stylesortPriority : return (L"0001"); + case stylesortType : return (L"0005"); + default : return (L"0000"); + } + } + } + + void CStyleSort::WriteNames(bool bNames) + { + m_bNames = bNames; + } + + //-------------------------------------------------------------------------------- + // StyleType 17.18.83 (Part 1) + //-------------------------------------------------------------------------------- + + EStyleType CStyleType::FromString(const std::wstring &sValue) + { + if ( (L"character") == sValue ) this->m_eValue = styletypeCharacter; + else if ( (L"numbering") == sValue ) this->m_eValue = styletypeNumbering; + else if ( (L"paragraph") == sValue ) this->m_eValue = styletypeParagraph; + else if ( (L"table") == sValue ) this->m_eValue = styletypeTable; + else if ( (L"list") == sValue) this->m_eValue = styletypeNumbering; + else this->m_eValue = styletypeParagraph; + + return this->m_eValue; + } + + std::wstring CStyleType::ToString () const + { + switch(this->m_eValue) + { + case styletypeCharacter : return (L"character"); + case styletypeNumbering : return (L"numbering"); + case styletypeParagraph : return (L"paragraph"); + case styletypeTable : return (L"table"); + default : return (L"paragraph"); + } + } + + //-------------------------------------------------------------------------------- + // TabJc 17.18.84 (Part 1) + 9.10.5 (Part 4) + //-------------------------------------------------------------------------------- + + ETabJc CTabJc::FromString(const std::wstring &sValue) + { + if ( (L"bar") == sValue ) this->m_eValue = tabjcBar; + else if ( (L"center") == sValue ) this->m_eValue = tabjcCenter; + else if ( (L"clear") == sValue ) this->m_eValue = tabjcClear; + else if ( (L"decimal") == sValue ) this->m_eValue = tabjcDecimal; + else if ( (L"end") == sValue ) this->m_eValue = tabjcEnd; + else if ( (L"num") == sValue ) this->m_eValue = tabjcNum; + else if ( (L"start") == sValue ) this->m_eValue = tabjcStart; + else if ( (L"right") == sValue ) this->m_eValue = tabjcRight; + else if ( (L"left") == sValue ) this->m_eValue = tabjcLeft; + else this->m_eValue = tabjcClear; + + return this->m_eValue; + } + + std::wstring CTabJc::ToString () const + { + switch(this->m_eValue) + { + case tabjcBar : return (L"bar"); + case tabjcCenter : return (L"center"); + case tabjcClear : return (L"clear"); + case tabjcDecimal : return (L"decimal"); + case tabjcEnd : return (L"end"); + case tabjcNum : return (L"num"); + case tabjcStart : return (L"start"); + case tabjcRight : return (L"right"); + case tabjcLeft : return (L"left"); + default : return (L"clear"); + } + } + + //-------------------------------------------------------------------------------- + // TabTlc 17.18.85 (Part 1) + //-------------------------------------------------------------------------------- + + ETabTlc CTabTlc::FromString(const std::wstring &sValue) + { + if ( (L"dot") == sValue ) this->m_eValue = tabtlcDot; + else if ( (L"heavy") == sValue ) this->m_eValue = tabtlcHeavy; + else if ( (L"hyphen") == sValue ) this->m_eValue = tabtlcHyphen; + else if ( (L"middleDot") == sValue ) this->m_eValue = tabtlcMiddleDot; + else if ( (L"none") == sValue ) this->m_eValue = tabtlcNone; + else if ( (L"underscore") == sValue ) this->m_eValue = tabtlcUnderscore; + else this->m_eValue = tabtlcNone; + + return this->m_eValue; + } + + std::wstring CTabTlc::ToString () const + { + switch(this->m_eValue) + { + case tabtlcDot : return (L"dot"); + case tabtlcHeavy : return (L"heavy"); + case tabtlcHyphen : return (L"hyphen"); + case tabtlcMiddleDot : return (L"middleDot"); + case tabtlcNone : return (L"none"); + case tabtlcUnderscore : return (L"underscore"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // TargetScreenSz 17.18.86 (Part 1) + //-------------------------------------------------------------------------------- + + ETargetScreenSz CTargetScreenSz::FromString(const std::wstring &sValue) + { + if ( (L"1024x768") == sValue ) this->m_eValue = targetscreensz1024x768; + else if ( (L"1152x882") == sValue ) this->m_eValue = targetscreensz1152x882; + else if ( (L"1152x900") == sValue ) this->m_eValue = targetscreensz1152x900; + else if ( (L"1280x1024") == sValue ) this->m_eValue = targetscreensz1280x1024; + else if ( (L"1600x1200") == sValue ) this->m_eValue = targetscreensz1600x1200; + else if ( (L"1800x1440") == sValue ) this->m_eValue = targetscreensz1800x1440; + else if ( (L"1920x1200") == sValue ) this->m_eValue = targetscreensz1920x1200; + else if ( (L"544x376") == sValue ) this->m_eValue = targetscreensz544x376; + else if ( (L"640x480") == sValue ) this->m_eValue = targetscreensz640x480; + else if ( (L"720x512") == sValue ) this->m_eValue = targetscreensz720x512; + else if ( (L"800x600") == sValue ) this->m_eValue = targetscreensz800x600; + else this->m_eValue = targetscreensz1280x1024; + + return this->m_eValue; + } + + std::wstring CTargetScreenSz::ToString () const + { + switch(this->m_eValue) + { + case targetscreensz1024x768 : return (L"1024x768"); + case targetscreensz1152x882 : return (L"1152x882"); + case targetscreensz1152x900 : return (L"1152x900"); + case targetscreensz1280x1024 : return (L"1280x1024"); + case targetscreensz1600x1200 : return (L"1600x1200"); + case targetscreensz1800x1440 : return (L"1800x1440"); + case targetscreensz1920x1200 : return (L"1920x1200"); + case targetscreensz544x376 : return (L"544x376"); + case targetscreensz640x480 : return (L"640x480"); + case targetscreensz720x512 : return (L"720x512"); + case targetscreensz800x600 : return (L"800x600"); + default : return (L"1280x1024"); + } + } + + //-------------------------------------------------------------------------------- + // TblLayoutType 17.18.87 (Part 1) + //-------------------------------------------------------------------------------- + + ETblLayoutType CTblLayoutType::FromString(const std::wstring &sValue) + { + if ( (L"autofit") == sValue ) this->m_eValue = tbllayouttypeAutofit; + else if ( (L"fixed") == sValue ) this->m_eValue = tbllayouttypeFixed; + else this->m_eValue = tbllayouttypeAutofit; + + return this->m_eValue; + } + + std::wstring CTblLayoutType::ToString () const + { + switch(this->m_eValue) + { + case tbllayouttypeAutofit : return (L"autofit"); + case tbllayouttypeFixed : return (L"fixed"); + default : return (L"autofit"); + } + } + + //-------------------------------------------------------------------------------- + // TblOverlap 17.18.88 (Part 1) + //-------------------------------------------------------------------------------- + + ETblOverlap CTblOverlap::FromString(const std::wstring &sValue) + { + if ( (L"never") == sValue ) this->m_eValue = tbloverlapNever; + else if ( (L"overlap") == sValue ) this->m_eValue = tbloverlapOverlap; + else this->m_eValue = tbloverlapOverlap; + + return this->m_eValue; + } + + std::wstring CTblOverlap::ToString () const + { + switch(this->m_eValue) + { + case tbloverlapNever : return (L"never"); + case tbloverlapOverlap : return (L"overlap"); + default : return (L"overlap"); + } + } + + //-------------------------------------------------------------------------------- + // TblStyleOverrideType 17.18.89 (Part 1) + //-------------------------------------------------------------------------------- + + ETblStyleOverrideType CTblStyleOverrideType::FromString(const std::wstring &sValue) + { + if ( (L"band1Horz") == sValue ) this->m_eValue = tblstyleoverridetypeBand1Horz; + else if ( (L"band1Vert") == sValue ) this->m_eValue = tblstyleoverridetypeBand1Vert; + else if ( (L"band2Horz") == sValue ) this->m_eValue = tblstyleoverridetypeBand2Horz; + else if ( (L"band2Vert") == sValue ) this->m_eValue = tblstyleoverridetypeBand2Vert; + else if ( (L"firstCol") == sValue ) this->m_eValue = tblstyleoverridetypeFirstCol; + else if ( (L"firstRow") == sValue ) this->m_eValue = tblstyleoverridetypeFirstRow; + else if ( (L"lastCol") == sValue ) this->m_eValue = tblstyleoverridetypeLastCol; + else if ( (L"lastRow") == sValue ) this->m_eValue = tblstyleoverridetypeLastRow; + else if ( (L"neCell") == sValue ) this->m_eValue = tblstyleoverridetypeNeCell; + else if ( (L"nwCell") == sValue ) this->m_eValue = tblstyleoverridetypeNwCell; + else if ( (L"seCell") == sValue ) this->m_eValue = tblstyleoverridetypeSeCell; + else if ( (L"swCell") == sValue ) this->m_eValue = tblstyleoverridetypeSwCell; + else if ( (L"wholeTable") == sValue ) this->m_eValue = tblstyleoverridetypeWholeTable; + else this->m_eValue = tblstyleoverridetypeWholeTable; + + return this->m_eValue; + } + + std::wstring CTblStyleOverrideType::ToString () const + { + switch(this->m_eValue) + { + case tblstyleoverridetypeBand1Horz : return (L"band1Horz"); + case tblstyleoverridetypeBand1Vert : return (L"band1Vert"); + case tblstyleoverridetypeBand2Horz : return (L"band2Horz"); + case tblstyleoverridetypeBand2Vert : return (L"band2Vert"); + case tblstyleoverridetypeFirstCol : return (L"firstCol"); + case tblstyleoverridetypeFirstRow : return (L"firstRow"); + case tblstyleoverridetypeLastCol : return (L"lastCol"); + case tblstyleoverridetypeLastRow : return (L"lastRow"); + case tblstyleoverridetypeNeCell : return (L"neCell"); + case tblstyleoverridetypeNwCell : return (L"nwCell"); + case tblstyleoverridetypeSeCell : return (L"seCell"); + case tblstyleoverridetypeSwCell : return (L"swCell"); + case tblstyleoverridetypeWholeTable : return (L"wholeTable"); + default : return (L"wholeTable"); + } + } + + //-------------------------------------------------------------------------------- + // TblWidth 17.18.90 (Part 1) + //-------------------------------------------------------------------------------- + + ETblWidth CTblWidth::FromString(const std::wstring &sValue) + { + if ( (L"auto") == sValue ) this->m_eValue = tblwidthAuto; + else if ( (L"dxa") == sValue ) this->m_eValue = tblwidthDxa; + else if ( (L"nil") == sValue ) this->m_eValue = tblwidthNil; + else if ( (L"pct") == sValue ) this->m_eValue = tblwidthPct; + else this->m_eValue = tblwidthAuto; + + return this->m_eValue; + } + + std::wstring CTblWidth::ToString () const + { + switch(this->m_eValue) + { + case tblwidthAuto : return (L"auto"); + case tblwidthDxa : return (L"dxa"); + case tblwidthNil : return (L"nil"); + case tblwidthPct : return (L"pct"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // TextAlignment 17.18.91 (Part 1) + //-------------------------------------------------------------------------------- + + ETextAlignment CTextAlignment::FromString(const std::wstring &sValue) + { + if ( (L"auto") == sValue ) this->m_eValue = textalignAuto; + else if ( (L"baseline") == sValue ) this->m_eValue = textalignBaseLine; + else if ( (L"bottom") == sValue ) this->m_eValue = textalignBottom; + else if ( (L"center") == sValue ) this->m_eValue = textalignCenter; + else if ( (L"top") == sValue ) this->m_eValue = textalignTop; + else this->m_eValue = textalignAuto; + + return this->m_eValue; + } + + std::wstring CTextAlignment::ToString () const + { + switch(this->m_eValue) + { + case textalignAuto : return (L"auto"); + case textalignBaseLine : return (L"baseline"); + case textalignBottom : return (L"bottom"); + case textalignCenter : return (L"center"); + case textalignTop : return (L"top"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // TextboxTightWrap 17.18.92 (Part 1) + //-------------------------------------------------------------------------------- + + ETextboxTightWrap CTextboxTightWrap::FromString(const std::wstring &sValue) + { + if ( (L"allLines") == sValue ) this->m_eValue = textboxtightwrapAllLines; + else if ( (L"firstAndLastLine") == sValue ) this->m_eValue = textboxtightwrapFirstAndLastLine; + else if ( (L"firstLineOnly") == sValue ) this->m_eValue = textboxtightwrapFirstLineOnly; + else if ( (L"lastLineOnly") == sValue ) this->m_eValue = textboxtightwrapLastLineOnly; + else if ( (L"none") == sValue ) this->m_eValue = textboxtightwrapNone; + else this->m_eValue = textboxtightwrapNone; + + return this->m_eValue; + } + + std::wstring CTextboxTightWrap::ToString () const + { + switch(this->m_eValue) + { + case textboxtightwrapAllLines : return (L"allLines"); + case textboxtightwrapFirstAndLastLine : return (L"firstAndLastLine"); + case textboxtightwrapFirstLineOnly : return (L"firstLineOnly"); + case textboxtightwrapLastLineOnly : return (L"lastLineOnly"); + case textboxtightwrapNone : return (L"none"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // TextDirection 17.18.93 (Part 1) + 9.10.6 (Part 4) + //-------------------------------------------------------------------------------- + + ETextDirection CTextDirection::FromString(const std::wstring &sValue) + { + if ( (L"lr") == sValue || (L"btLr") == sValue || (L"bt-lr") == sValue) + this->m_eValue = textdirectionLr; + else if ( (L"lrV") == sValue || (L"tbLrV") == sValue ) + this->m_eValue = textdirectionLrV; + else if ( (L"rl") == sValue || (L"tbRl") == sValue || (L"tb-rl") == sValue) + this->m_eValue = textdirectionRl; + else if ( (L"rlV") == sValue || (L"tbRlV") == sValue || (L"tb-rl-v") == sValue) + this->m_eValue = textdirectionRlV; + else if ( (L"tb") == sValue || (L"lrTb") == sValue) + this->m_eValue = textdirectionTb; + else if ( (L"tbV") == sValue || (L"lrTbV") == sValue || (L"lr-tb-v") == sValue) + this->m_eValue = textdirectionTbV; + //tb-rl + else + this->m_eValue = textdirectionTb; + + return this->m_eValue; + } + + std::wstring CTextDirection::ToString () const + { + switch(this->m_eValue) + { + case textdirectionLr : return (L"btLr"); + case textdirectionLrV : return (L"tbLrV"); + case textdirectionRl : return (L"tbRl"); + case textdirectionRlV : return (L"tbRlV"); + case textdirectionTb : return (L"lrTb"); + case textdirectionTbV : return (L"lrTbV"); + default : return (L"lrTb"); + } + } + + //-------------------------------------------------------------------------------- + // TextEffect 17.18.94 (Part 1) + //-------------------------------------------------------------------------------- + + ETextEffect CTextEffect::FromString(const std::wstring &sValue) + { + if ( (L"antsBlack") == sValue ) this->m_eValue = texteffectAntsBlack; + else if ( (L"antsRed") == sValue ) this->m_eValue = texteffectAntsRed; + else if ( (L"blinkBackground") == sValue ) this->m_eValue = texteffectBlinkBackground; + else if ( (L"lights") == sValue ) this->m_eValue = texteffectLights; + else if ( (L"none") == sValue ) this->m_eValue = texteffectNone; + else if ( (L"shimmer") == sValue ) this->m_eValue = texteffectShimmer; + else if ( (L"sparkle") == sValue ) this->m_eValue = texteffectSparkle; + else this->m_eValue = texteffectNone; + + return this->m_eValue; + } + + std::wstring CTextEffect::ToString () const + { + switch(this->m_eValue) + { + case texteffectAntsBlack : return (L"antsBlack"); + case texteffectAntsRed : return (L"antsRed"); + case texteffectBlinkBackground : return (L"blinkBackground"); + case texteffectLights : return (L"lights"); + case texteffectNone : return (L"none"); + case texteffectShimmer : return (L"shimmer"); + case texteffectSparkle : return (L"sparkle"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // TextScale 17.18.95 (Part 1) + //-------------------------------------------------------------------------------- + + void CTextScale::SetValue(int nValue) + { + this->m_eValue = (std::min)( 600, (std::max)( 0, nValue ) ); + } + + int CTextScale::FromString(const std::wstring &sValue) + { + this->m_eValue = XmlUtils::GetInteger(sValue); + + this->m_eValue = (std::min)( 600, (std::max)( 0, this->m_eValue ) ); + + return this->m_eValue; + } + + std::wstring CTextScale::ToString () const + { + std::wstring sResult = std::to_wstring( this->m_eValue); + + return sResult; + } + + //-------------------------------------------------------------------------------- + // Theme 17.18.96 (Part 1) + //-------------------------------------------------------------------------------- + + ETheme CTheme::FromString(const std::wstring &sValue) + { + if ( (L"majorAscii") == sValue ) this->m_eValue = themeMajorAscii; + else if ( (L"majorBidi") == sValue ) this->m_eValue = themeMajorBidi; + else if ( (L"majorEastAsia") == sValue ) this->m_eValue = themeMajorEastAsia; + else if ( (L"majorHAnsi") == sValue ) this->m_eValue = themeMajorHAnsi; + else if ( (L"minorAscii") == sValue ) this->m_eValue = themeMinorAscii; + else if ( (L"minorBidi") == sValue ) this->m_eValue = themeMinorBidi; + else if ( (L"minorEastAsia") == sValue ) this->m_eValue = themeMinorEastAsia; + else if ( (L"minorHAnsi") == sValue ) this->m_eValue = themeMinorHAnsi; + else this->m_eValue = themeMajorAscii; + + return this->m_eValue; + } + + std::wstring CTheme::ToString () const + { + switch(this->m_eValue) + { + case themeMajorAscii : return (L"majorAscii"); + case themeMajorBidi : return (L"majorBidi"); + case themeMajorEastAsia : return (L"majorEastAsia"); + case themeMajorHAnsi : return (L"majorHAnsi"); + case themeMinorAscii : return (L"minorAscii"); + case themeMinorBidi : return (L"minorBidi"); + case themeMinorEastAsia : return (L"minorEastAsia"); + case themeMinorHAnsi : return (L"minorHAnsi"); + default : return (L"majorAscii"); + } + } + + //-------------------------------------------------------------------------------- + // ThemeColor 17.18.97 (Part 1) + //-------------------------------------------------------------------------------- + + EThemeColor CThemeColor::FromString(const std::wstring &sValue) + { + if ( (L"accent1") == sValue ) this->m_eValue = themecolorAccent1; + else if ( (L"accent2") == sValue ) this->m_eValue = themecolorAccent2; + else if ( (L"accent3") == sValue ) this->m_eValue = themecolorAccent3; + else if ( (L"accent4") == sValue ) this->m_eValue = themecolorAccent4; + else if ( (L"accent5") == sValue ) this->m_eValue = themecolorAccent5; + else if ( (L"accent6") == sValue ) this->m_eValue = themecolorAccent6; + else if ( (L"background1") == sValue ) this->m_eValue = themecolorBackground1; + else if ( (L"background2") == sValue ) this->m_eValue = themecolorBackground2; + else if ( (L"dark1") == sValue ) this->m_eValue = themecolorDark1; + else if ( (L"dark2") == sValue ) this->m_eValue = themecolorDark2; + else if ( (L"followedHyperlink") == sValue ) this->m_eValue = themecolorFollowedHyperlink; + else if ( (L"hyperlink") == sValue ) this->m_eValue = themecolorHyperlink; + else if ( (L"light1") == sValue ) this->m_eValue = themecolorLight1; + else if ( (L"light2") == sValue ) this->m_eValue = themecolorLight2; + else if ( (L"none") == sValue ) this->m_eValue = themecolorNone; + else if ( (L"text1") == sValue ) this->m_eValue = themecolorText1; + else if ( (L"text2") == sValue ) this->m_eValue = themecolorText2; + else this->m_eValue = themecolorNone; + + return this->m_eValue; + } + + std::wstring CThemeColor::ToString () const + { + switch(this->m_eValue) + { + case themecolorAccent1 : return (L"accent1"); + case themecolorAccent2 : return (L"accent2"); + case themecolorAccent3 : return (L"accent3"); + case themecolorAccent4 : return (L"accent4"); + case themecolorAccent5 : return (L"accent5"); + case themecolorAccent6 : return (L"accent6"); + case themecolorBackground1 : return (L"background1"); + case themecolorBackground2 : return (L"background2"); + case themecolorDark1 : return (L"dark1"); + case themecolorDark2 : return (L"dark2"); + case themecolorFollowedHyperlink : return (L"followedHyperlink"); + case themecolorHyperlink : return (L"hyperlink"); + case themecolorLight1 : return (L"light1"); + case themecolorLight2 : return (L"light2"); + case themecolorNone : return (L"none"); + case themecolorText1 : return (L"text1"); + case themecolorText2 : return (L"text2"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // UcharHexNumber 17.18.98 (Part 1) + //-------------------------------------------------------------------------------- + + int CUcharHexNumber::HexToInt(int nHex, bool &bResult) + { + if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); + if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); + if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); + + bResult = false; + + return 0; + } + + bool CUcharHexNumber::Parse(const std::wstring &sValue) + { + if ( sValue.length() < 2 ) + return false; + + bool bResult = true; + + this->m_eValue = (unsigned char)HexToInt( (int)sValue[1], bResult ); + this->m_eValue += (unsigned char)HexToInt( (int)sValue[0], bResult ) << 4; + + return bResult; + } + + unsigned char CUcharHexNumber::FromString(const std::wstring &sValue) + { + if ( !Parse(sValue) ) + { + this->m_eValue = 0; + } + + return this->m_eValue; + } + + std::wstring CUcharHexNumber::ToString () const + { + return XmlUtils::ToString(this->m_eValue, L"%02X"); + } + + //-------------------------------------------------------------------------------- + // Underline 17.18.99 (Part 1) 20.1.10.82 + //-------------------------------------------------------------------------------- + + EUnderline CUnderline::FromString(const std::wstring &sValue) + { + if ( (L"dash") == sValue ) this->m_eValue = underlineDash; + else if ( (L"dashDotDotHeavy") == sValue ) this->m_eValue = underlineDashDotDotHeavy; + else if ( (L"dashDotHeavy") == sValue ) this->m_eValue = underlineDashDotHeavy; + else if ( (L"dashedHeavy") == sValue ) this->m_eValue = underlineDashedHeavy; + else if ( (L"dashLong") == sValue ) this->m_eValue = underlineDashLong; + else if ( (L"dashLongHeavy") == sValue ) this->m_eValue = underlineDashLongHeavy; + else if ( (L"dotDash") == sValue ) this->m_eValue = underlineDotDash; + else if ( (L"dotDotDash") == sValue ) this->m_eValue = underlineDotDotDash; + else if ( (L"dotted") == sValue ) this->m_eValue = underlineDotted; + else if ( (L"dottedHeavy") == sValue ) this->m_eValue = underlineDottedHeavy; + else if ( (L"double") == sValue ) this->m_eValue = underlineDouble; + else if ( (L"none") == sValue ) this->m_eValue = underlineNone; + else if ( (L"single") == sValue ) this->m_eValue = underlineSingle; + else if ( (L"thick") == sValue ) this->m_eValue = underlineThick; + else if ( (L"wave") == sValue ) this->m_eValue = underlineWave; + else if ( (L"wavyDouble") == sValue ) this->m_eValue = underlineWavyDouble; + else if ( (L"wavyHeavy") == sValue ) this->m_eValue = underlineWavyHeavy; + else if ( (L"words") == sValue ) this->m_eValue = underlineWords; + else this->m_eValue = underlineNone; + + return this->m_eValue; + } + + std::wstring CUnderline::ToString () const + { + switch(this->m_eValue) + { + case underlineDash : return (L"dash"); + case underlineDashDotDotHeavy : return (L"dashDotDotHeavy"); + case underlineDashDotHeavy : return (L"dashDotHeavy"); + case underlineDashedHeavy : return (L"dashedHeavy"); + case underlineDashLong : return (L"dashLong"); + case underlineDashLongHeavy : return (L"dashLongHeavy"); + case underlineDotDash : return (L"dotDash"); + case underlineDotDotDash : return (L"dotDotDash"); + case underlineDotted : return (L"dotted"); + case underlineDottedHeavy : return (L"dottedHeavy"); + case underlineDouble : return (L"double"); + case underlineNone : return (L"none"); + case underlineSingle : return (L"single"); + case underlineThick : return (L"thick"); + case underlineWave : return (L"wave"); + case underlineWavyDouble : return (L"wavyDouble"); + case underlineWavyHeavy : return (L"wavyHeavy"); + case underlineWords : return (L"words"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // VAnchor 17.18.100 (Part 1) + //-------------------------------------------------------------------------------- + + EVAnchor CVAnchor::FromString(const std::wstring &sValue) + { + if ( (L"margin") == sValue ) this->m_eValue = vanchorMargin; + else if ( (L"page") == sValue ) this->m_eValue = vanchorPage; + else if ( (L"text") == sValue ) this->m_eValue = vanchorText; + else this->m_eValue = vanchorText; + + return this->m_eValue; + } + + std::wstring CVAnchor::ToString () const + { + switch(this->m_eValue) + { + case vanchorMargin : return (L"margin"); + case vanchorPage : return (L"page"); + case vanchorText : return (L"text"); + default : return (L"text"); + } + } + + //-------------------------------------------------------------------------------- + // VerticalJc 17.18.101 (Part 1) + //-------------------------------------------------------------------------------- + + EVerticalJc CVerticalJc::FromString(const std::wstring &sValue) + { + if ( (L"both") == sValue ) this->m_eValue = verticaljcBoth; + else if ( (L"bottom") == sValue ) this->m_eValue = verticaljcBottom; + else if ( (L"center") == sValue ) this->m_eValue = verticaljcCenter; + else if ( (L"top") == sValue ) this->m_eValue = verticaljcTop; + else this->m_eValue = verticaljcTop; + + return this->m_eValue; + } + + std::wstring CVerticalJc::ToString () const + { + switch(this->m_eValue) + { + case verticaljcBoth : return (L"both"); + case verticaljcBottom : return (L"bottom"); + case verticaljcCenter : return (L"center"); + case verticaljcTop : return (L"top"); + default : return (L"top"); + } + } + + //-------------------------------------------------------------------------------- + // View 17.18.102 (Part 1) + //-------------------------------------------------------------------------------- + + EView CView::FromString(const std::wstring &sValue) + { + if ( (L"masterPages") == sValue ) this->m_eValue = viewMasterPages; + else if ( (L"none") == sValue ) this->m_eValue = viewNone; + else if ( (L"normal") == sValue ) this->m_eValue = viewNormal; + else if ( (L"outline") == sValue ) this->m_eValue = viewOutline; + else if ( (L"print") == sValue ) this->m_eValue = viewPrint; + else if ( (L"web") == sValue ) this->m_eValue = viewWeb; + else this->m_eValue = viewNone; + + return this->m_eValue; + } + + std::wstring CView::ToString () const + { + switch(this->m_eValue) + { + case viewMasterPages : return (L"masterPages"); + case viewNone : return (L"none"); + case viewNormal : return (L"normal"); + case viewOutline : return (L"outline"); + case viewPrint : return (L"print"); + case viewWeb : return (L"web"); + default : return (L"none"); + } + } + + //-------------------------------------------------------------------------------- + // WmlColorSchemeIndex 17.18.103 (Part 1) + //-------------------------------------------------------------------------------- + + EWmlColorSchemeIndex CWmlColorSchemeIndex::FromString(const std::wstring &sValue) + { + if ( (L"accent1") == sValue ) this->m_eValue = wmlcolorschemeindexAccent1; + else if ( (L"accent2") == sValue ) this->m_eValue = wmlcolorschemeindexAccent2; + else if ( (L"accent3") == sValue ) this->m_eValue = wmlcolorschemeindexAccent3; + else if ( (L"accent4") == sValue ) this->m_eValue = wmlcolorschemeindexAccent4; + else if ( (L"accent5") == sValue ) this->m_eValue = wmlcolorschemeindexAccent5; + else if ( (L"accent6") == sValue ) this->m_eValue = wmlcolorschemeindexAccent6; + else if ( (L"dark1") == sValue ) this->m_eValue = wmlcolorschemeindexDark1; + else if ( (L"dark2") == sValue ) this->m_eValue = wmlcolorschemeindexDark2; + else if ( (L"followedHyperlink") == sValue ) this->m_eValue = wmlcolorschemeindexFollowedHyperlink; + else if ( (L"hyperlink") == sValue ) this->m_eValue = wmlcolorschemeindexHyperlink; + else if ( (L"light1") == sValue ) this->m_eValue = wmlcolorschemeindexLight1; + else if ( (L"light2") == sValue ) this->m_eValue = wmlcolorschemeindexLight2; + else this->m_eValue = wmlcolorschemeindexAccent1; + + return this->m_eValue; + } + + std::wstring CWmlColorSchemeIndex::ToString () const + { + switch(this->m_eValue) + { + case wmlcolorschemeindexAccent1 : return (L"accent1"); + case wmlcolorschemeindexAccent2 : return (L"accent2"); + case wmlcolorschemeindexAccent3 : return (L"accent3"); + case wmlcolorschemeindexAccent4 : return (L"accent4"); + case wmlcolorschemeindexAccent5 : return (L"accent5"); + case wmlcolorschemeindexAccent6 : return (L"accent6"); + case wmlcolorschemeindexDark1 : return (L"dark1"); + case wmlcolorschemeindexDark2 : return (L"dark2"); + case wmlcolorschemeindexFollowedHyperlink : return (L"followedHyperlink"); + case wmlcolorschemeindexHyperlink : return (L"hyperlink"); + case wmlcolorschemeindexLight1 : return (L"light1"); + case wmlcolorschemeindexLight2 : return (L"light2"); + default : return (L"accent1"); + } + } + + //-------------------------------------------------------------------------------- + // Wrap 17.18.104 (Part 1) + //-------------------------------------------------------------------------------- + + EWrap CWrap::FromString(const std::wstring &sValue) + { + if ( (L"around") == sValue ) this->m_eValue = wrapAround; + else if ( (L"auto") == sValue ) this->m_eValue = wrapAuto; + else if ( (L"none") == sValue ) this->m_eValue = wrapNone; + else if ( (L"notBeside") == sValue ) this->m_eValue = wrapNotBeside; + else if ( (L"through") == sValue ) this->m_eValue = wrapThrough; + else if ( (L"tight") == sValue ) this->m_eValue = wrapTight; + else this->m_eValue = wrapAuto; + + return this->m_eValue; + } + + std::wstring CWrap::ToString () const + { + switch(this->m_eValue) + { + case wrapAround : return (L"around"); + case wrapAuto : return (L"auto"); + case wrapNone : return (L"none"); + case wrapNotBeside : return (L"notBeside"); + case wrapThrough : return (L"through"); + case wrapTight : return (L"tight"); + default : return (L"auto"); + } + } + + //-------------------------------------------------------------------------------- + // Zoom 17.18.105 (Part 1) + //-------------------------------------------------------------------------------- + + EZoom CZoom::FromString(const std::wstring &sValue) + { + if ( (L"bestFit") == sValue ) this->m_eValue = zoomBestFit; + else if ( (L"fullPage") == sValue ) this->m_eValue = zoomFullPage; + else if ( (L"none") == sValue ) this->m_eValue = zoomNone; + else if ( (L"textFit") == sValue ) this->m_eValue = zoomTextFit; + else this->m_eValue = zoomNone; + + return this->m_eValue; + } + + std::wstring CZoom::ToString () const + { + switch(this->m_eValue) + { + case zoomBestFit : return (L"bestFit"); + case zoomFullPage : return (L"fullPage"); + case zoomNone : return (L"none"); + case zoomTextFit : return (L"textFit"); + default : return (L"none"); + } + } + +}; // SimpleTypes + + + +// Дополнительные типы +namespace SimpleTypes +{ + //-------------------------------------------------------------------------------- + // CFontCharset 9.4.1.1 (Part 4) + //-------------------------------------------------------------------------------- + + EFontCharset CFontCharset::FromString(const std::wstring &sValue) + { + if ( (L"00") == sValue ) this->m_eValue = fontcharsetANSI; + else if ( (L"01") == sValue ) this->m_eValue = fontcharsetDefault; + else if ( (L"02") == sValue ) this->m_eValue = fontcharsetSymbol; + else if ( (L"4D") == sValue ) this->m_eValue = fontcharsetMacintosh; + else if ( (L"80") == sValue ) this->m_eValue = fontcharsetShitJIS; + else if ( (L"81") == sValue ) this->m_eValue = fontcharsetHangeul; + else if ( (L"82") == sValue ) this->m_eValue = fontcharsetJohab; + else if ( (L"86") == sValue ) this->m_eValue = fontcharsetGB2313; + else if ( (L"88") == sValue ) this->m_eValue = fontcharsetChineseBig5; + else if ( (L"A1") == sValue ) this->m_eValue = fontcharsetGreek; + else if ( (L"A2") == sValue ) this->m_eValue = fontcharsetTurkish; + else if ( (L"A3") == sValue ) this->m_eValue = fontcharsetVietnamese; + else if ( (L"B1") == sValue ) this->m_eValue = fontcharsetHebrew; + else if ( (L"B2") == sValue ) this->m_eValue = fontcharsetArabic; + else if ( (L"BA") == sValue ) this->m_eValue = fontcharsetBaltic; + else if ( (L"CC") == sValue ) this->m_eValue = fontcharsetRussian; + else if ( (L"DE") == sValue ) this->m_eValue = fontcharsetThai; + else if ( (L"EE") == sValue ) this->m_eValue = fontcharsetEastEurope; + else if ( (L"FF") == sValue ) this->m_eValue = fontcharsetOEM; + else this->m_eValue = fontcharsetANSI; + + return this->m_eValue; + } + + std::wstring CFontCharset::ToString () const + { + switch(this->m_eValue) + { + case fontcharsetANSI : return (L"00"); + case fontcharsetDefault : return (L"01"); + case fontcharsetSymbol : return (L"02"); + case fontcharsetMacintosh : return (L"4D"); + case fontcharsetShitJIS : return (L"80"); + case fontcharsetHangeul : return (L"81"); + case fontcharsetJohab : return (L"82"); + case fontcharsetGB2313 : return (L"86"); + case fontcharsetChineseBig5 : return (L"88"); + case fontcharsetGreek : return (L"A1"); + case fontcharsetTurkish : return (L"A2"); + case fontcharsetVietnamese : return (L"A3"); + case fontcharsetHebrew : return (L"B1"); + case fontcharsetArabic : return (L"B2"); + case fontcharsetBaltic : return (L"BA"); + case fontcharsetRussian : return (L"CC"); + case fontcharsetThai : return (L"DE"); + case fontcharsetEastEurope : return (L"EE"); + case fontcharsetOEM : return (L"FF"); + default : return (L"00"); + } + } + + //-------------------------------------------------------------------------------- + // CCnf 9.10.7 (Part 4) + //-------------------------------------------------------------------------------- + + void CCnf::Parse(const std::wstring &sValue) + { + int nLen = (std::min)( (int)sValue.length(), 12 ); + + for ( int nIndex = 0, nMult = 1; nIndex < nLen; nIndex++, nMult <<= 1 ) + { + wchar_t wsChar = sValue[nIndex]; + + if ( '0' == wsChar ) + { + // Ничего не делаем + } + else if ( '1' == wsChar ) + { + this->m_eValue ^= nMult; + } + else // Неправильный формат + break; + } + } + + unsigned short CCnf::FromString(const std::wstring &sValue) + { + Parse( sValue ); + + return this->m_eValue; + } + + std::wstring CCnf::ToString () const + { + std::wstring sResult; + + for( int nIndex = 0, nMult = 1; nIndex < 12; nIndex++, nMult <<= 1 ) + { + if ( this->m_eValue & nMult ) + sResult += '1'; + else + sResult += '0'; + } + + return sResult; + } + + bool CCnf::IsFirstRow () const + { + return (bool)( (this->m_eValue & 1) != 0 ); + } + + bool CCnf::IsLastRow () const + { + return (bool)( (this->m_eValue & 2) != 0 ); + } + + bool CCnf::IsFirstColumn () const + { + return (bool)( (this->m_eValue & 4) != 0 ); + } + + bool CCnf::IsLastColumn () const + { + return (bool)( (this->m_eValue & 8) != 0 ); + } + + bool CCnf::IsBand1Vertical () const + { + return (bool)( (this->m_eValue & 16) != 0 ); + } + + bool CCnf::IsBand2Vertical () const + { + return (bool)( (this->m_eValue & 32) != 0 ); + } + + bool CCnf::IsBand1Horizontal() const + { + return (bool)( (this->m_eValue & 64) != 0 ); + } + + bool CCnf::IsBand2Horizontal() const + { + return (bool)( (this->m_eValue & 128) != 0 ); + } + + bool CCnf::IsNeCell () const + { + return (bool)( (this->m_eValue & 256) != 0 ); + } + + bool CCnf::IsNwCell () const + { + return (bool)( (this->m_eValue & 512) != 0 ); + } + + bool CCnf::IsSeCell () const + { + return (bool)( (this->m_eValue & 1024) != 0 ); + } + + bool CCnf::IsSwCell () const + { + return (bool)( (this->m_eValue & 2048) != 0 ); + } + + //-------------------------------------------------------------------------------- + // XmlSpace + //-------------------------------------------------------------------------------- + + EXmlSpace CXmlSpace::FromString(const std::wstring &sValue) + { + if ( (L"default") == sValue ) this->m_eValue = xmlspaceDefault; + else if ( (L"preserve") == sValue ) this->m_eValue = xmlspacePreserve; + else this->m_eValue = xmlspaceDefault; + + return this->m_eValue; + } + + EXmlSpace CXmlSpace::FromStringA(const char* pValue) + { + if ( strcmp("default", pValue) == 0 ) this->m_eValue = xmlspaceDefault; + else if ( strcmp("preserve", pValue) == 0 ) this->m_eValue = xmlspacePreserve; + else this->m_eValue = xmlspaceDefault; + + return this->m_eValue; + } + + std::wstring CXmlSpace::ToString () const + { + switch(this->m_eValue) + { + case xmlspaceDefault : return (L"default"); + case xmlspacePreserve : return (L"preserve"); + default : return (L"default"); + } + } + + //--------------------------------------------------------------------------------------------- + + ECryptAlgClass CCryptAlgClass::FromString(const std::wstring &sValue) + { + if (L"custom" == sValue) this->m_eValue = AlgClassCustom; + else if (L"hash" == sValue) this->m_eValue = AlgClassHash; + else this->m_eValue = AlgClassCustom; + + return this->m_eValue; + } + + ECryptAlgClass CCryptAlgClass::FromStringA(const char* pValue) + { + if (strcmp("custom", pValue) == 0) this->m_eValue = AlgClassCustom; + else if (strcmp("hash", pValue) == 0) this->m_eValue = AlgClassHash; + else this->m_eValue = AlgClassCustom; + + return this->m_eValue; + } + + std::wstring CCryptAlgClass::ToString() const + { + switch (this->m_eValue) + { + case AlgClassCustom: return (L"custom"); + case AlgClassHash: return (L"hash"); + default: return (L"custom"); + } + } + + //--------------------------------------------------------------------------------------------- + + ECryptAlgType CCryptAlgType::FromString(const std::wstring &sValue) + { + if (L"custom" == sValue) this->m_eValue = AlgTypeCustom; + else if (L"typeAny" == sValue) this->m_eValue = AlgTypeTypeAny; + else this->m_eValue = AlgTypeCustom; + + return this->m_eValue; + } + + ECryptAlgType CCryptAlgType::FromStringA(const char* pValue) + { + if (strcmp("custom", pValue) == 0) this->m_eValue = AlgTypeCustom; + else if (strcmp("typeAny", pValue) == 0) this->m_eValue = AlgTypeTypeAny; + else this->m_eValue = AlgTypeCustom; + + return this->m_eValue; + } + + std::wstring CCryptAlgType::ToString() const + { + switch (this->m_eValue) + { + case AlgTypeCustom: return (L"custom"); + case AlgTypeTypeAny: return (L"typeAny"); + default: return (L"custom"); + } + } + + //--------------------------------------------------------------------------------------------- + + ECryptProv CCryptProv::FromString(const std::wstring &sValue) + { + if (L"custom" == sValue) this->m_eValue = CryptProvCustom; + else if (L"rsaAES" == sValue) this->m_eValue = CryptProvRsaAES; + else if (L"rsaFull" == sValue) this->m_eValue = CryptProvRsaFull; + else this->m_eValue = CryptProvCustom; + + return this->m_eValue; + } + + ECryptProv CCryptProv::FromStringA(const char* pValue) + { + if (strcmp("custom", pValue) == 0) this->m_eValue = CryptProvCustom; + else if (strcmp("rsaAES", pValue) == 0) this->m_eValue = CryptProvRsaAES; + else if (strcmp("rsaFull", pValue) == 0) this->m_eValue = CryptProvRsaFull; + else this->m_eValue = CryptProvCustom; + + return this->m_eValue; + } + + std::wstring CCryptProv::ToString() const + { + switch (this->m_eValue) + { + case CryptProvCustom: return (L"custom"); + case CryptProvRsaAES: return (L"rsaAES"); + case CryptProvRsaFull: return (L"rsaFull"); + default: return (L"custom"); + } + } + + //-------------------------------------------------------------------------------- + // CryptAlgoritmName + //-------------------------------------------------------------------------------- + + ECryptAlgoritmName CCryptAlgoritmName::FromString(const std::wstring &sValue) + { + if ( L"MD2" == sValue || L"1" == sValue ) this->m_eValue = cryptalgoritmnameMD2; + else if ( L"MD4" == sValue || L"2" == sValue ) this->m_eValue = cryptalgoritmnameMD4; + else if ( L"MD5" == sValue || L"3" == sValue ) this->m_eValue = cryptalgoritmnameMD5; + else if ( L"RIPEMD-128" == sValue || L"6" == sValue ) this->m_eValue = cryptalgoritmnameRIPEMD128; + else if ( L"RIPEMD-160" == sValue || L"7" == sValue ) this->m_eValue = cryptalgoritmnameRIPEMD160; + else if ( L"SHA-1" == sValue || L"4" == sValue ) this->m_eValue = cryptalgoritmnameSHA1; + else if ( L"SHA-256" == sValue || L"12" == sValue ) this->m_eValue = cryptalgoritmnameSHA256; + else if ( L"SHA-384" == sValue || L"13" == sValue ) this->m_eValue = cryptalgoritmnameSHA384; + else if ( L"SHA-512" == sValue || L"14" == sValue ) this->m_eValue = cryptalgoritmnameSHA512; + else if ( L"WHIRLPOOL" == sValue ) this->m_eValue = cryptalgoritmnameWHIRLPOOL; + else + this->m_eValue = cryptalgoritmnameUnknown; + + return this->m_eValue; + } + + std::wstring CCryptAlgoritmName::ToString() const + { + switch(this->m_eValue) + { + case cryptalgoritmnameMD2 : return (L"MD2"); + case cryptalgoritmnameMD4 : return (L"MD4"); + case cryptalgoritmnameMD5 : return (L"MD5"); + case cryptalgoritmnameRIPEMD128 : return (L"RIPEMD-128"); + case cryptalgoritmnameRIPEMD160 : return (L"RIPEMD-160"); + case cryptalgoritmnameSHA1 : return (L"SHA-1"); + case cryptalgoritmnameSHA256 : return (L"SHA-256"); + case cryptalgoritmnameSHA384 : return (L"SHA-384"); + case cryptalgoritmnameSHA512 : return (L"SHA-512"); + case cryptalgoritmnameWHIRLPOOL : return (L"WHIRLPOOL"); + default : return (L""); + } + } + + //-------------------------------------------------------------------------------- + // PitchFamily + //-------------------------------------------------------------------------------- + + EPitchFamily CPitchFamily::FromString(const std::wstring &sValue) + { + CUcharHexNumber oHex = sValue; + int nValue = oHex.GetValue(); + + switch ( nValue ) + { + case 0x00: case 0x01: case 0x02: + case 0x10: case 0x11: case 0x12: + case 0x20: case 0x21: case 0x22: + case 0x30: case 0x31: case 0x32: + case 0x40: case 0x41: case 0x42: + case 0x50: case 0x51: case 0x52: + this->m_eValue = (EPitchFamily)nValue; break; + default: + this->m_eValue = pitchfamilyDefUnk; break; + } + + return this->m_eValue; + } + + std::wstring CPitchFamily::ToString () const + { + switch(this->m_eValue) + { + case pitchfamilyDefUnk: return (L"00"); + case pitchfamilyFixUnk: return (L"01"); + case pitchfamilyVarUnk: return (L"02"); + case pitchfamilyDefRom: return (L"10"); + case pitchfamilyFixRom: return (L"11"); + case pitchfamilyVarRom: return (L"12"); + case pitchfamilyDefSwi: return (L"20"); + case pitchfamilyFixSwi: return (L"21"); + case pitchfamilyVarSwi: return (L"22"); + case pitchfamilyDefMod: return (L"30"); + case pitchfamilyFixMod: return (L"31"); + case pitchfamilyVarMod: return (L"32"); + case pitchfamilyDefScr: return (L"40"); + case pitchfamilyFixScr: return (L"41"); + case pitchfamilyVarScr: return (L"42"); + case pitchfamilyDefDec: return (L"50"); + case pitchfamilyFixDec: return (L"51"); + case pitchfamilyVarDec: return (L"52"); + default : return (L"00"); + } + } + + unsigned char CPitchFamily::GetPitch() + { + int nValue = (int)this->m_eValue; + return nValue & 0x0F; + } + + unsigned char CPitchFamily::GetFamily() + { + int nValue = (int)this->m_eValue; + return nValue >> 4; + } + + //-------------------------------------------------------------------------------- + // DirVal + //-------------------------------------------------------------------------------- + + EDirVal CDirVal::FromString(const std::wstring &sValue) + { + if ( (L"ltr") == sValue ) this->m_eValue = dirLtr; + else if ( (L"rtl") == sValue ) this->m_eValue = dirRtl; + else this->m_eValue = dirLtr; + + return this->m_eValue; + } + + std::wstring CDirVal::ToString () const + { + switch(this->m_eValue) + { + case dirLtr : return (L"ltr"); + case dirRtl : return (L"rtl"); + default : return (L"ltr"); + } + } + + ELigatures CLigatures::FromString(const std::wstring &sValue) + { + if (L"none" == sValue) this->m_eValue = ligatureNone; + else if (L"standard" == sValue) this->m_eValue = ligatureStandard; + else if (L"contextual" == sValue) this->m_eValue = ligatureContextual; + else if (L"historical" == sValue) this->m_eValue = ligatureHistorical; + else if (L"discretional" == sValue) this->m_eValue = ligatureDiscretional; + else if (L"standardContextual" == sValue) this->m_eValue = ligatureStandardContextual; + else if (L"standardHistorical" == sValue) this->m_eValue = ligatureStandardHistorical; + else if (L"contextualHistorical" == sValue) this->m_eValue = ligatureContextualHistorical; + else if (L"standardDiscretional" == sValue) this->m_eValue = ligatureStandardDiscretional; + else if (L"contextualDiscretional" == sValue) this->m_eValue = ligatureContextualDiscretional; + else if (L"historicalDiscretional" == sValue) this->m_eValue = ligatureHistoricalDiscretional; + else if (L"standardContextualHistorical" == sValue) this->m_eValue = ligatureStandardContextualHistorical; + else if (L"standardContextualDiscretional" == sValue) this->m_eValue = ligatureStandardContextualDiscretional; + else if (L"standardHistoricalDiscretional" == sValue) this->m_eValue = ligatureStandardHistoricalDiscretional; + else if (L"contextualHistoricalDiscretional" == sValue) this->m_eValue = ligatureContextualHistoricalDiscretional; + else if (L"all" == sValue) this->m_eValue = ligatureAll; + return this->m_eValue; + } + + + std::wstring CLigatures::ToString() const + { + switch (this->m_eValue) + { + case ligatureNone: return (L"none"); + case ligatureStandard: return (L"standard"); + case ligatureContextual: return (L"contextual"); + case ligatureHistorical: return (L"historical"); + case ligatureDiscretional: return (L"discretional"); + case ligatureStandardContextual: return (L"standardContextual"); + case ligatureStandardHistorical: return (L"standardHistorical"); + case ligatureContextualHistorical: return (L"contextualHistorical"); + case ligatureStandardDiscretional: return (L"standardDiscretional"); + case ligatureContextualDiscretional: return (L"contextualDiscretional"); + case ligatureHistoricalDiscretional: return (L"historicalDiscretional"); + case ligatureStandardContextualHistorical: return (L"standardContextualHistorical"); + case ligatureStandardContextualDiscretional: return (L"standardContextualDiscretional"); + case ligatureStandardHistoricalDiscretional: return (L"standardHistoricalDiscretional"); + case ligatureContextualHistoricalDiscretional: return (L"contextualHistoricalDiscretional"); + case ligatureAll: return (L"all"); + default: return (L"standard"); + } + } + + ENumForm CNumForm::FromString(const std::wstring &sValue) + { + if (L"default" == sValue) this->m_eValue = numFormDefault; + else if (L"lining" == sValue) this->m_eValue = numFormLining; + else if (L"oldStyle" == sValue) this->m_eValue = numFormOldStyle; + else this->m_eValue = numFormDefault; + + return this->m_eValue; + } + + std::wstring CNumForm::ToString() const + { + switch (this->m_eValue) + { + case numFormLining: return L"lining"; + case numFormOldStyle: return L"oldStyle"; + case numFormDefault: + default: return L"default"; + } + } + + ENumSpacing CNumSpacing::FromString(const std::wstring &sValue) + { + if (L"default" == sValue) this->m_eValue = numSpacingDefault; + else if (L"proportional" == sValue) this->m_eValue = numSpacingProportional; + else if (L"tabular" == sValue) this->m_eValue = numSpacingTabular; + else this->m_eValue = numSpacingDefault; + + return this->m_eValue; + } + + std::wstring CNumSpacing::ToString() const + { + switch (this->m_eValue) + { + case numSpacingProportional: return L"proportional"; + case numSpacingTabular: return L"tabular"; + case numSpacingDefault: + default: return L"default"; + } + } - } } // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Word.h b/Common/DocxFormat/Source/Common/SimpleTypes_Word.h index 5714d07237..2e0a813861 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Word.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Word.h @@ -32,7 +32,6 @@ #pragma once #include "SimpleTypes_Base.h" -#include // Здесь представлены все простые типы Word из спецификации Office Open Xml (17.18) namespace SimpleTypes @@ -45,38 +44,9 @@ namespace SimpleTypes { annotvmergeCont = 0, annotvmergeRest = 1 - }; - - template - class CAnnotationVMerge : public CSimpleType - { - public: - - CAnnotationVMerge() {} - - virtual EAnnotationVMerge FromString(std::wstring &sValue) - { - if ( (L"cont") == sValue ) this->m_eValue = annotvmergeCont; - else if ( (L"rest") == sValue ) this->m_eValue = annotvmergeRest; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case annotvmergeCont : return (L"cont"); - case annotvmergeRest : return (L"rest"); - default : return (L"cont"); - } - } - - SimpleType_FromString (EAnnotationVMerge) - SimpleType_Operator_Equal (CAnnotationVMerge) - }; + }; + DEFINE_SIMPLE_TYPE(CAnnotationVMerge, EAnnotationVMerge, annotvmergeCont) //-------------------------------------------------------------------------------- // Border 17.18.2 (Part 1) @@ -285,563 +255,17 @@ namespace SimpleTypes bordervalueZigZagStitch = 266 }; + DEFINE_SIMPLE_TYPE_START(CBorder, EBorder, bordervalueNone) - template - class CBorder : public CSimpleType - { public: - - CBorder() {} - - virtual EBorder FromString(std::wstring &sValue) - { - wchar_t wsFirstChar = 0; - - if ( sValue.length() > 0 ) - wsFirstChar = sValue[0]; - - switch(wsFirstChar) - { - case 'a': - { - if ( (L"apples") == sValue ) this->m_eValue = bordervalueApples; - else if ( (L"archedScallops") == sValue ) this->m_eValue = bordervalueArchedScallops; - else this->m_eValue = eDefValue; - break; - } - case 'b': - { - if ( (L"babyPacifier") == sValue ) this->m_eValue = bordervalueBabyPacifier; - else if ( (L"babyRattle") == sValue ) this->m_eValue = bordervalueBabyRattle; - else if ( (L"balloons3Colors") == sValue ) this->m_eValue = bordervalueBalloons3Colors; - else if ( (L"balloonsHotAir") == sValue ) this->m_eValue = bordervalueBalloonsHotAir; - else if ( (L"basicBlackDashes") == sValue ) this->m_eValue = bordervalueBasicBlackDashes; - else if ( (L"basicBlackDots") == sValue ) this->m_eValue = bordervalueBasicBlackDots; - else if ( (L"basicBlackSquares") == sValue ) this->m_eValue = bordervalueBasicBlackSquares; - else if ( (L"basicThinLines") == sValue ) this->m_eValue = bordervalueBasicThinLines; - else if ( (L"basicWhiteDashes") == sValue ) this->m_eValue = bordervalueBasicWhiteDashes; - else if ( (L"basicWhiteDots") == sValue ) this->m_eValue = bordervalueBasicWhiteDots; - else if ( (L"basicWhiteSquares") == sValue ) this->m_eValue = bordervalueBasicWhiteSquares; - else if ( (L"basicWideInline") == sValue ) this->m_eValue = bordervalueBasicWideInline; - else if ( (L"basicWideMidline") == sValue ) this->m_eValue = bordervalueBasicWideMidline; - else if ( (L"basicWideOutline") == sValue ) this->m_eValue = bordervalueBasicWideOutline; - else if ( (L"bats") == sValue ) this->m_eValue = bordervalueBats; - else if ( (L"birds") == sValue ) this->m_eValue = bordervalueBirds; - else if ( (L"birdsFlight") == sValue ) this->m_eValue = bordervalueBirdsFlight; - else this->m_eValue = eDefValue; - break; - } - case 'c': - { - if ( (L"cabins") == sValue ) this->m_eValue = bordervalueCabins; - else if ( (L"cakeSlice") == sValue ) this->m_eValue = bordervalueCakeSlice; - else if ( (L"candyCorn") == sValue ) this->m_eValue = bordervalueCandyCorn; - else if ( (L"celticKnotwork") == sValue ) this->m_eValue = bordervalueCelticKnotwork; - else if ( (L"certificateBanner") == sValue ) this->m_eValue = bordervalueCertificateBanner; - else if ( (L"chainLink") == sValue ) this->m_eValue = bordervalueChainLink; - else if ( (L"champagneBottle") == sValue ) this->m_eValue = bordervalueChampagneBottle; - else if ( (L"checkedBarBlack") == sValue ) this->m_eValue = bordervalueCheckedBarBlack; - else if ( (L"checkedBarColor") == sValue ) this->m_eValue = bordervalueCheckedBarColor; - else if ( (L"checkered") == sValue ) this->m_eValue = bordervalueCheckered; - else if ( (L"christmasTree") == sValue ) this->m_eValue = bordervalueChristmasTree; - else if ( (L"circlesLines") == sValue ) this->m_eValue = bordervalueCirclesLines; - else if ( (L"circlesRectangles") == sValue ) this->m_eValue = bordervalueCirclesRectangles; - else if ( (L"classicalWave") == sValue ) this->m_eValue = bordervalueClassicalWave; - else if ( (L"clocks") == sValue ) this->m_eValue = bordervalueClocks; - else if ( (L"compass") == sValue ) this->m_eValue = bordervalueCompass; - else if ( (L"confetti") == sValue ) this->m_eValue = bordervalueConfetti; - else if ( (L"confettiGrays") == sValue ) this->m_eValue = bordervalueConfettiGrays; - else if ( (L"confettiOutline") == sValue ) this->m_eValue = bordervalueConfettiOutline; - else if ( (L"confettiStreamers") == sValue ) this->m_eValue = bordervalueConfettiStreamers; - else if ( (L"confettiWhite") == sValue ) this->m_eValue = bordervalueConfettiWhite; - else if ( (L"cornerTriangles") == sValue ) this->m_eValue = bordervalueCornerTriangles; - else if ( (L"couponCutoutDashes") == sValue ) this->m_eValue = bordervalueCouponCutoutDashes; - else if ( (L"couponCutoutDots") == sValue ) this->m_eValue = bordervalueCouponCutoutDots; - else if ( (L"crazyMaze") == sValue ) this->m_eValue = bordervalueCrazyMaze; - else if ( (L"creaturesButterfly") == sValue ) this->m_eValue = bordervalueCreaturesButterfly; - else if ( (L"creaturesFish") == sValue ) this->m_eValue = bordervalueCreaturesFish; - else if ( (L"creaturesInsects") == sValue ) this->m_eValue = bordervalueCreaturesInsects; - else if ( (L"creaturesLadyBug") == sValue ) this->m_eValue = bordervalueCreaturesLadyBug; - else if ( (L"crossStitch") == sValue ) this->m_eValue = bordervalueCrossStitch; - else if ( (L"cup") == sValue ) this->m_eValue = bordervalueCup; - else if ( (L"custom") == sValue ) this->m_eValue = bordervalueCustom; - else this->m_eValue = eDefValue; - break; - } - case 'd': - { - if ( (L"dashDotStroked") == sValue ) this->m_eValue = bordervalueDashDotStroked; - else if ( (L"dashed") == sValue ) this->m_eValue = bordervalueDashed; - else if ( (L"dashSmallGap") == sValue ) this->m_eValue = bordervalueDashSmallGap; - else if ( (L"decoArch") == sValue ) this->m_eValue = bordervalueDecoArch; - else if ( (L"decoArchColor") == sValue ) this->m_eValue = bordervalueDecoArchColor; - else if ( (L"decoBlocks") == sValue ) this->m_eValue = bordervalueDecoBlocks; - else if ( (L"diamondsGray") == sValue ) this->m_eValue = bordervalueDiamondsGray; - else if ( (L"dotDash") == sValue ) this->m_eValue = bordervalueDotDash; - else if ( (L"dotDotDash") == sValue ) this->m_eValue = bordervalueDotDotDash; - else if ( (L"dotted") == sValue ) this->m_eValue = bordervalueDotted; - else if ( (L"double") == sValue ) this->m_eValue = bordervalueDouble; - else if ( (L"doubleD") == sValue ) this->m_eValue = bordervalueDoubleD; - else if ( (L"doubleDiamonds") == sValue ) this->m_eValue = bordervalueDoubleDiamonds; - else if ( (L"doubleWave") == sValue ) this->m_eValue = bordervalueDoubleWave; - else this->m_eValue = eDefValue; - break; - } - case 'e': - { - if ( (L"earth1") == sValue ) this->m_eValue = bordervalueEarth1; - else if ( (L"earth2") == sValue ) this->m_eValue = bordervalueEarth2; - else if ( (L"earth3") == sValue ) this->m_eValue = bordervalueEarth3; - else if ( (L"eclipsingSquares1") == sValue ) this->m_eValue = bordervalueEclipsingSquares1; - else if ( (L"eclipsingSquares2") == sValue ) this->m_eValue = bordervalueEclipsingSquares2; - else if ( (L"eggsBlack") == sValue ) this->m_eValue = bordervalueEggsBlack; - else this->m_eValue = eDefValue; - break; - } - case 'f': - { - if ( (L"fans") == sValue ) this->m_eValue = bordervalueFans; - else if ( (L"film") == sValue ) this->m_eValue = bordervalueFilm; - else if ( (L"firecrackers") == sValue ) this->m_eValue = bordervalueFirecrackers; - else if ( (L"flowersBlockPrint") == sValue ) this->m_eValue = bordervalueFlowersBlockPrint; - else if ( (L"flowersDaisies") == sValue ) this->m_eValue = bordervalueFlowersDaisies; - else if ( (L"flowersModern1") == sValue ) this->m_eValue = bordervalueFlowersModern1; - else if ( (L"flowersModern2") == sValue ) this->m_eValue = bordervalueFlowersModern2; - else if ( (L"flowersPansy") == sValue ) this->m_eValue = bordervalueFlowersPansy; - else if ( (L"flowersRedRose") == sValue ) this->m_eValue = bordervalueFlowersRedRose; - else if ( (L"flowersRoses") == sValue ) this->m_eValue = bordervalueFlowersRoses; - else if ( (L"flowersTeacup") == sValue ) this->m_eValue = bordervalueFlowersTeacup; - else if ( (L"flowersTiny") == sValue ) this->m_eValue = bordervalueFlowersTiny; - else this->m_eValue = eDefValue; - break; - } - case 'g': - { - if ( (L"gems") == sValue ) this->m_eValue = bordervalueGems; - else if ( (L"gingerbreadMan") == sValue ) this->m_eValue = bordervalueGingerbreadMan; - else if ( (L"gradient") == sValue ) this->m_eValue = bordervalueGradient; - else this->m_eValue = eDefValue; - break; - } - case 'h': - { - if ( (L"handmade1") == sValue ) this->m_eValue = bordervalueHandmade1; - else if ( (L"handmade2") == sValue ) this->m_eValue = bordervalueHandmade2; - else if ( (L"heartBalloon") == sValue ) this->m_eValue = bordervalueHeartBalloon; - else if ( (L"heartGray") == sValue ) this->m_eValue = bordervalueHeartGray; - else if ( (L"hearts") == sValue ) this->m_eValue = bordervalueHearts; - else if ( (L"heebieJeebies") == sValue ) this->m_eValue = bordervalueHeebieJeebies; - else if ( (L"holly") == sValue ) this->m_eValue = bordervalueHolly; - else if ( (L"houseFunky") == sValue ) this->m_eValue = bordervalueHouseFunky; - else if ( (L"hypnotic") == sValue ) this->m_eValue = bordervalueHypnotic; - else this->m_eValue = eDefValue; - break; - } - case 'i': - { - if ( (L"iceCreamCones") == sValue ) this->m_eValue = bordervalueIceCreamCones; - else if ( (L"inset") == sValue ) this->m_eValue = bordervalueInset; - else this->m_eValue = eDefValue; - break; - } - case 'l': - { - if ( (L"lightBulb") == sValue ) this->m_eValue = bordervalueLightBulb; - else if ( (L"lightning1") == sValue ) this->m_eValue = bordervalueLightning1; - else if ( (L"lightning2") == sValue ) this->m_eValue = bordervalueLightning2; - else this->m_eValue = eDefValue; - break; - } - case 'm': - { - if ( (L"mapleLeaf") == sValue ) this->m_eValue = bordervalueMapleLeaf; - else if ( (L"mapleMuffins") == sValue ) this->m_eValue = bordervalueMapleMuffins; - else if ( (L"mapPins") == sValue ) this->m_eValue = bordervalueMapPins; - else if ( (L"marquee") == sValue ) this->m_eValue = bordervalueMarquee; - else if ( (L"marqueeToothed") == sValue ) this->m_eValue = bordervalueMarqueeToothed; - else if ( (L"moons") == sValue ) this->m_eValue = bordervalueMoons; - else if ( (L"mosaic") == sValue ) this->m_eValue = bordervalueMosaic; - else if ( (L"musicNotes") == sValue ) this->m_eValue = bordervalueMusicNotes; - else this->m_eValue = eDefValue; - break; - } - case 'n': - { - if ( (L"nil") == sValue ) this->m_eValue = bordervalueNil; - else if ( (L"none") == sValue ) this->m_eValue = bordervalueNone; - else if ( (L"northwest") == sValue ) this->m_eValue = bordervalueNorthwest; - else this->m_eValue = eDefValue; - break; - } - case 'o': - { - if ( (L"outset") == sValue ) this->m_eValue = bordervalueOutset; - else if ( (L"ovals") == sValue ) this->m_eValue = bordervalueOvals; - else this->m_eValue = eDefValue; - break; - } - case 'p': - { - if ( (L"packages") == sValue ) this->m_eValue = bordervaluePackages; - else if ( (L"palmsBlack") == sValue ) this->m_eValue = bordervaluePalmsBlack; - else if ( (L"palmsColor") == sValue ) this->m_eValue = bordervaluePalmsColor; - else if ( (L"paperClips") == sValue ) this->m_eValue = bordervaluePaperClips; - else if ( (L"papyrus") == sValue ) this->m_eValue = bordervaluePapyrus; - else if ( (L"partyFavor") == sValue ) this->m_eValue = bordervaluePartyFavor; - else if ( (L"partyGlass") == sValue ) this->m_eValue = bordervaluePartyGlass; - else if ( (L"pencils") == sValue ) this->m_eValue = bordervaluePencils; - else if ( (L"people") == sValue ) this->m_eValue = bordervaluePeople; - else if ( (L"peopleHats") == sValue ) this->m_eValue = bordervaluePeopleHats; - else if ( (L"peopleWaving") == sValue ) this->m_eValue = bordervaluePeopleWaving; - else if ( (L"poinsettias") == sValue ) this->m_eValue = bordervaluePoinsettias; - else if ( (L"postageStamp") == sValue ) this->m_eValue = bordervaluePostageStamp; - else if ( (L"pumpkin1") == sValue ) this->m_eValue = bordervaluePumpkin1; - else if ( (L"pushPinNote1") == sValue ) this->m_eValue = bordervaluePushPinNote1; - else if ( (L"pushPinNote2") == sValue ) this->m_eValue = bordervaluePushPinNote2; - else if ( (L"pyramids") == sValue ) this->m_eValue = bordervaluePyramids; - else if ( (L"pyramidsAbove") == sValue ) this->m_eValue = bordervaluePyramidsAbove; - else this->m_eValue = eDefValue; - break; - } - case 'q': - { - if ( (L"quadrants") == sValue ) this->m_eValue = bordervalueQuadrants; - else this->m_eValue = eDefValue; - break; - } - case 'r': - { - if ( (L"rings") == sValue ) this->m_eValue = bordervalueRings; - else this->m_eValue = eDefValue; - break; - } - case 's': - { - if ( (L"safari") == sValue ) this->m_eValue = bordervalueSafari; - else if ( (L"sawtooth") == sValue ) this->m_eValue = bordervalueSawtooth; - else if ( (L"sawtoothGray") == sValue ) this->m_eValue = bordervalueSawtoothGray; - else if ( (L"scaredCat") == sValue ) this->m_eValue = bordervalueScaredCat; - else if ( (L"seattle") == sValue ) this->m_eValue = bordervalueSeattle; - else if ( (L"shadowedSquares") == sValue ) this->m_eValue = bordervalueShadowedSquares; - else if ( (L"shapes1") == sValue ) this->m_eValue = bordervalueShapes1; - else if ( (L"shapes2") == sValue ) this->m_eValue = bordervalueShapes2; - else if ( (L"sharksTeeth") == sValue ) this->m_eValue = bordervalueSharksTeeth; - else if ( (L"shorebirdTracks") == sValue ) this->m_eValue = bordervalueShorebirdTracks; - else if ( (L"single") == sValue ) this->m_eValue = bordervalueSingle; - else if ( (L"skyrocket") == sValue ) this->m_eValue = bordervalueSkyrocket; - else if ( (L"snowflakeFancy") == sValue ) this->m_eValue = bordervalueSnowflakeFancy; - else if ( (L"snowflakes") == sValue ) this->m_eValue = bordervalueSnowflakes; - else if ( (L"sombrero") == sValue ) this->m_eValue = bordervalueSombrero; - else if ( (L"southwest") == sValue ) this->m_eValue = bordervalueSouthwest; - else if ( (L"stars") == sValue ) this->m_eValue = bordervalueStars; - else if ( (L"stars3d") == sValue ) this->m_eValue = bordervalueStars3d; - else if ( (L"starsBlack") == sValue ) this->m_eValue = bordervalueStarsBlack; - else if ( (L"starsShadowed") == sValue ) this->m_eValue = bordervalueStarsShadowed; - else if ( (L"starsTop") == sValue ) this->m_eValue = bordervalueStarsTop; - else if ( (L"sun") == sValue ) this->m_eValue = bordervalueSun; - else if ( (L"swirligig") == sValue ) this->m_eValue = bordervalueSwirligig; - else this->m_eValue = eDefValue; - break; - } - case 't': - { - if ( (L"thick") == sValue ) this->m_eValue = bordervalueThick; - else if ( (L"thickThinLargeGap") == sValue ) this->m_eValue = bordervalueThickThinLargeGap; - else if ( (L"thickThinMediumGap") == sValue ) this->m_eValue = bordervalueThickThinMediumGap; - else if ( (L"thickThinSmallGap") == sValue ) this->m_eValue = bordervalueThickThinSmallGap; - else if ( (L"thinThickLargeGap") == sValue ) this->m_eValue = bordervalueThinThickLargeGap; - else if ( (L"thinThickMediumGap") == sValue ) this->m_eValue = bordervalueThinThickMediumGap; - else if ( (L"thinThickSmallGap") == sValue ) this->m_eValue = bordervalueThinThickSmallGap; - else if ( (L"thinThickThinLargeGap") == sValue ) this->m_eValue = bordervalueThinThickThinLargeGap; - else if ( (L"thinThickThinMediumGap") == sValue ) this->m_eValue = bordervalueThinThickThinMediumGap; - else if ( (L"thinThickThinSmallGap") == sValue ) this->m_eValue = bordervalueThinThickThinSmallGap; - else if ( (L"threeDEmboss") == sValue ) this->m_eValue = bordervalueThreeDEmboss; - else if ( (L"threeDEngrave") == sValue ) this->m_eValue = bordervalueThreeDEngrave; - else if ( (L"tornPaper") == sValue ) this->m_eValue = bordervalueTornPaper; - else if ( (L"tornPaperBlack") == sValue ) this->m_eValue = bordervalueTornPaperBlack; - else if ( (L"trees") == sValue ) this->m_eValue = bordervalueTrees; - else if ( (L"triangle1") == sValue ) this->m_eValue = bordervalueTriangle1; - else if ( (L"triangle2") == sValue ) this->m_eValue = bordervalueTriangle2; - else if ( (L"triangleCircle1") == sValue ) this->m_eValue = bordervalueTriangleCircle1; - else if ( (L"triangleCircle2") == sValue ) this->m_eValue = bordervalueTriangleCircle2; - else if ( (L"triangleParty") == sValue ) this->m_eValue = bordervalueTriangleParty; - else if ( (L"triangles") == sValue ) this->m_eValue = bordervalueTriangles; - else if ( (L"triple") == sValue ) this->m_eValue = bordervalueTriple; - else if ( (L"twistedLines1") == sValue ) this->m_eValue = bordervalueTwistedLines1; - else if ( (L"twistedLines2") == sValue ) this->m_eValue = bordervalueTwistedLines2; - else this->m_eValue = eDefValue; - break; - } - case 'v': - { - if ( (L"vine") == sValue ) this->m_eValue = bordervalueVine; - else this->m_eValue = eDefValue; - break; - } - case 'w': - { - if ( (L"wave") == sValue ) this->m_eValue = bordervalueWave; - else if ( (L"waveline") == sValue ) this->m_eValue = bordervalueWaveline; - else if ( (L"weavingAngles") == sValue ) this->m_eValue = bordervalueWeavingAngles; - else if ( (L"weavingBraid") == sValue ) this->m_eValue = bordervalueWeavingBraid; - else if ( (L"weavingRibbon") == sValue ) this->m_eValue = bordervalueWeavingRibbon; - else if ( (L"weavingStrips") == sValue ) this->m_eValue = bordervalueWeavingStrips; - else if ( (L"whiteFlowers") == sValue ) this->m_eValue = bordervalueWhiteFlowers; - else if ( (L"woodwork") == sValue ) this->m_eValue = bordervalueWoodwork; - else this->m_eValue = eDefValue; - break; - } - case 'x': - { - if ( (L"xIllusions") == sValue ) this->m_eValue = bordervalueXIllusions; - else this->m_eValue = eDefValue; - break; - } - case 'z': - { - if ( (L"zanyTriangles") == sValue ) this->m_eValue = bordervalueZanyTriangles; - else if ( (L"zigZag") == sValue ) this->m_eValue = bordervalueZigZag; - else if ( (L"zigZagStitch") == sValue ) this->m_eValue = bordervalueZigZagStitch; - else this->m_eValue = eDefValue; - break; - } - default: - { - this->m_eValue = eDefValue; - break; - } - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case bordervalueApples : return (L"apples"); - case bordervalueArchedScallops : return (L"archedScallops"); - case bordervalueBabyPacifier : return (L"babyPacifier"); - case bordervalueBabyRattle : return (L"babyRattle"); - case bordervalueBalloons3Colors : return (L"balloons3Colors"); - case bordervalueBalloonsHotAir : return (L"balloonsHotAir"); - case bordervalueBasicBlackDashes : return (L"basicBlackDashes"); - case bordervalueBasicBlackDots : return (L"basicBlackDots"); - case bordervalueBasicBlackSquares : return (L"basicBlackSquares"); - case bordervalueBasicThinLines : return (L"basicThinLines"); - case bordervalueBasicWhiteDashes : return (L"basicWhiteDashes"); - case bordervalueBasicWhiteDots : return (L"basicWhiteDots"); - case bordervalueBasicWhiteSquares : return (L"basicWhiteSquares"); - case bordervalueBasicWideInline : return (L"basicWideInline"); - case bordervalueBasicWideMidline : return (L"basicWideMidline"); - case bordervalueBasicWideOutline : return (L"basicWideOutline"); - case bordervalueBats : return (L"bats"); - case bordervalueBirds : return (L"birds"); - case bordervalueBirdsFlight : return (L"birdsFlight"); - case bordervalueCabins : return (L"cabins"); - case bordervalueCakeSlice : return (L"cakeSlice"); - case bordervalueCandyCorn : return (L"candyCorn"); - case bordervalueCelticKnotwork : return (L"celticKnotwork"); - case bordervalueCertificateBanner : return (L"certificateBanner"); - case bordervalueChainLink : return (L"chainLink"); - case bordervalueChampagneBottle : return (L"champagneBottle"); - case bordervalueCheckedBarBlack : return (L"checkedBarBlack"); - case bordervalueCheckedBarColor : return (L"checkedBarColor"); - case bordervalueCheckered : return (L"checkered"); - case bordervalueChristmasTree : return (L"christmasTree"); - case bordervalueCirclesLines : return (L"circlesLines"); - case bordervalueCirclesRectangles : return (L"circlesRectangles"); - case bordervalueClassicalWave : return (L"classicalWave"); - case bordervalueClocks : return (L"clocks"); - case bordervalueCompass : return (L"compass"); - case bordervalueConfetti : return (L"confetti"); - case bordervalueConfettiGrays : return (L"confettiGrays"); - case bordervalueConfettiOutline : return (L"confettiOutline"); - case bordervalueConfettiStreamers : return (L"confettiStreamers"); - case bordervalueConfettiWhite : return (L"confettiWhite"); - case bordervalueCornerTriangles : return (L"cornerTriangles"); - case bordervalueCouponCutoutDashes : return (L"couponCutoutDashes"); - case bordervalueCouponCutoutDots : return (L"couponCutoutDots"); - case bordervalueCrazyMaze : return (L"crazyMaze"); - case bordervalueCreaturesButterfly : return (L"creaturesButterfly"); - case bordervalueCreaturesFish : return (L"creaturesFish"); - case bordervalueCreaturesInsects : return (L"creaturesInsects"); - case bordervalueCreaturesLadyBug : return (L"creaturesLadyBug"); - case bordervalueCrossStitch : return (L"crossStitch"); - case bordervalueCup : return (L"cup"); - case bordervalueCustom : return (L"custom"); - case bordervalueDashDotStroked : return (L"dashDotStroked"); - case bordervalueDashed : return (L"dashed"); - case bordervalueDashSmallGap : return (L"dashSmallGap"); - case bordervalueDecoArch : return (L"decoArch"); - case bordervalueDecoArchColor : return (L"decoArchColor"); - case bordervalueDecoBlocks : return (L"decoBlocks"); - case bordervalueDiamondsGray : return (L"diamondsGray"); - case bordervalueDotDash : return (L"dotDash"); - case bordervalueDotDotDash : return (L"dotDotDash"); - case bordervalueDotted : return (L"dotted"); - case bordervalueDouble : return (L"double"); - case bordervalueDoubleD : return (L"doubleD"); - case bordervalueDoubleDiamonds : return (L"doubleDiamonds"); - case bordervalueDoubleWave : return (L"doubleWave"); - case bordervalueEarth1 : return (L"earth1"); - case bordervalueEarth2 : return (L"earth2"); - case bordervalueEarth3 : return (L"earth3"); - case bordervalueEclipsingSquares1 : return (L"eclipsingSquares1"); - case bordervalueEclipsingSquares2 : return (L"eclipsingSquares2"); - case bordervalueEggsBlack : return (L"eggsBlack"); - case bordervalueFans : return (L"fans"); - case bordervalueFilm : return (L"film"); - case bordervalueFirecrackers : return (L"firecrackers"); - case bordervalueFlowersBlockPrint : return (L"flowersBlockPrint"); - case bordervalueFlowersDaisies : return (L"flowersDaisies"); - case bordervalueFlowersModern1 : return (L"flowersModern1"); - case bordervalueFlowersModern2 : return (L"flowersModern2"); - case bordervalueFlowersPansy : return (L"flowersPansy"); - case bordervalueFlowersRedRose : return (L"flowersRedRose"); - case bordervalueFlowersRoses : return (L"flowersRoses"); - case bordervalueFlowersTeacup : return (L"flowersTeacup"); - case bordervalueFlowersTiny : return (L"flowersTiny"); - case bordervalueGems : return (L"gems"); - case bordervalueGingerbreadMan : return (L"gingerbreadMan"); - case bordervalueGradient : return (L"gradient"); - case bordervalueHandmade1 : return (L"handmade1"); - case bordervalueHandmade2 : return (L"handmade2"); - case bordervalueHeartBalloon : return (L"heartBalloon"); - case bordervalueHeartGray : return (L"heartGray"); - case bordervalueHearts : return (L"hearts"); - case bordervalueHeebieJeebies : return (L"heebieJeebies"); - case bordervalueHolly : return (L"holly"); - case bordervalueHouseFunky : return (L"houseFunky"); - case bordervalueHypnotic : return (L"hypnotic"); - case bordervalueIceCreamCones : return (L"iceCreamCones"); - case bordervalueInset : return (L"inset"); - case bordervalueLightBulb : return (L"lightBulb"); - case bordervalueLightning1 : return (L"lightning1"); - case bordervalueLightning2 : return (L"lightning2"); - case bordervalueMapleLeaf : return (L"mapleLeaf"); - case bordervalueMapleMuffins : return (L"mapleMuffins"); - case bordervalueMapPins : return (L"mapPins"); - case bordervalueMarquee : return (L"marquee"); - case bordervalueMarqueeToothed : return (L"marqueeToothed"); - case bordervalueMoons : return (L"moons"); - case bordervalueMosaic : return (L"mosaic"); - case bordervalueMusicNotes : return (L"musicNotes"); - case bordervalueNil : return (L"nil"); - case bordervalueNone : return (L"none"); - case bordervalueNorthwest : return (L"northwest"); - case bordervalueOutset : return (L"outset"); - case bordervalueOvals : return (L"ovals"); - case bordervaluePackages : return (L"packages"); - case bordervaluePalmsBlack : return (L"palmsBlack"); - case bordervaluePalmsColor : return (L"palmsColor"); - case bordervaluePaperClips : return (L"paperClips"); - case bordervaluePapyrus : return (L"papyrus"); - case bordervaluePartyFavor : return (L"partyFavor"); - case bordervaluePartyGlass : return (L"partyGlass"); - case bordervaluePencils : return (L"pencils"); - case bordervaluePeople : return (L"people"); - case bordervaluePeopleHats : return (L"peopleHats"); - case bordervaluePeopleWaving : return (L"peopleWaving"); - case bordervaluePoinsettias : return (L"poinsettias"); - case bordervaluePostageStamp : return (L"postageStamp"); - case bordervaluePumpkin1 : return (L"pumpkin1"); - case bordervaluePushPinNote1 : return (L"pushPinNote1"); - case bordervaluePushPinNote2 : return (L"pushPinNote2"); - case bordervaluePyramids : return (L"pyramids"); - case bordervaluePyramidsAbove : return (L"pyramidsAbove"); - case bordervalueQuadrants : return (L"quadrants"); - case bordervalueRings : return (L"rings"); - case bordervalueSafari : return (L"safari"); - case bordervalueSawtooth : return (L"sawtooth"); - case bordervalueSawtoothGray : return (L"sawtoothGray"); - case bordervalueScaredCat : return (L"scaredCat"); - case bordervalueSeattle : return (L"seattle"); - case bordervalueShadowedSquares : return (L"shadowedSquares"); - case bordervalueShapes1 : return (L"shapes1"); - case bordervalueShapes2 : return (L"shapes2"); - case bordervalueSharksTeeth : return (L"sharksTeeth"); - case bordervalueShorebirdTracks : return (L"shorebirdTracks"); - case bordervalueSingle : return (L"single"); - case bordervalueSkyrocket : return (L"skyrocket"); - case bordervalueSnowflakeFancy : return (L"snowflakeFancy"); - case bordervalueSnowflakes : return (L"snowflakes"); - case bordervalueSombrero : return (L"sombrero"); - case bordervalueSouthwest : return (L"southwest"); - case bordervalueStars : return (L"stars"); - case bordervalueStars3d : return (L"stars3d"); - case bordervalueStarsBlack : return (L"starsBlack"); - case bordervalueStarsShadowed : return (L"starsShadowed"); - case bordervalueStarsTop : return (L"starsTop"); - case bordervalueSun : return (L"sun"); - case bordervalueSwirligig : return (L"swirligig"); - case bordervalueThick : return (L"thick"); - case bordervalueThickThinLargeGap : return (L"thickThinLargeGap"); - case bordervalueThickThinMediumGap : return (L"thickThinMediumGap"); - case bordervalueThickThinSmallGap : return (L"thickThinSmallGap"); - case bordervalueThinThickLargeGap : return (L"thinThickLargeGap"); - case bordervalueThinThickMediumGap : return (L"thinThickMediumGap"); - case bordervalueThinThickSmallGap : return (L"thinThickSmallGap"); - case bordervalueThinThickThinLargeGap : return (L"thinThickThinLargeGap"); - case bordervalueThinThickThinMediumGap: return (L"thinThickThinMediumGap"); - case bordervalueThinThickThinSmallGap : return (L"thinThickThinSmallGap"); - case bordervalueThreeDEmboss : return (L"threeDEmboss"); - case bordervalueThreeDEngrave : return (L"threeDEngrave"); - case bordervalueTornPaper : return (L"tornPaper"); - case bordervalueTornPaperBlack : return (L"tornPaperBlack"); - case bordervalueTrees : return (L"trees"); - case bordervalueTriangle1 : return (L"triangle1"); - case bordervalueTriangle2 : return (L"triangle2"); - case bordervalueTriangleCircle1 : return (L"triangleCircle1"); - case bordervalueTriangleCircle2 : return (L"triangleCircle2"); - case bordervalueTriangleParty : return (L"triangleParty"); - case bordervalueTriangles : return (L"triangles"); - case bordervalueTriple : return (L"triple"); - case bordervalueTwistedLines1 : return (L"twistedLines1"); - case bordervalueTwistedLines2 : return (L"twistedLines2"); - case bordervalueVine : return (L"vine"); - case bordervalueWave : return (L"wave"); - case bordervalueWaveline : return (L"waveline"); - case bordervalueWeavingAngles : return (L"weavingAngles"); - case bordervalueWeavingBraid : return (L"weavingBraid"); - case bordervalueWeavingRibbon : return (L"weavingRibbon"); - case bordervalueWeavingStrips : return (L"weavingStrips"); - case bordervalueWhiteFlowers : return (L"whiteFlowers"); - case bordervalueWoodwork : return (L"woodwork"); - case bordervalueXIllusions : return (L"xIllusions"); - case bordervalueZanyTriangles : return (L"zanyTriangles"); - case bordervalueZigZag : return (L"zigZag"); - case bordervalueZigZagStitch : return (L"zigZagStitch"); - - default : return (L"none"); - } - } - - - - - SimpleType_FromString (EBorder) - SimpleType_Operator_Equal (CBorder) - - bool IsArtBorder () const - { - return ((int)this->m_eValue > 100); - } - bool IsLineBorder() const - { - return ( (int)this->m_eValue <= 25 && (int)this->m_eValue >= 1 ); - } - bool IsNoBorder () const - { - return ( (int)this->m_eValue <= 0 ); - } - + bool IsArtBorder () const; + bool IsLineBorder() const; + bool IsNoBorder () const; }; - //-------------------------------------------------------------------------------- // BrClear 17.18.3 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EBrClear { @@ -851,41 +275,11 @@ namespace SimpleTypes brclearRight = 3 }; - template - class CBrClear : public CSimpleType - { - public: - CBrClear() {} + DEFINE_SIMPLE_TYPE(CBrClear, EBrClear, brclearAll) - virtual EBrClear FromString(std::wstring &sValue) - { - if ( (L"all") == sValue ) this->m_eValue = brclearAll; - else if ( (L"left") == sValue ) this->m_eValue = brclearLeft; - else if ( (L"none") == sValue ) this->m_eValue = brclearNone; - else if ( (L"right") == sValue ) this->m_eValue = brclearRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case brclearAll : return (L"all"); - case brclearLeft : return (L"left"); - case brclearNone : return (L"none"); - case brclearRight : return (L"right"); - default : return (L"all"); - } - } - - SimpleType_FromString (EBrClear) - SimpleType_Operator_Equal (CBrClear) - }; //-------------------------------------------------------------------------------- // BrType 17.18.4 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EBrType { @@ -894,41 +288,11 @@ namespace SimpleTypes brtypeTextWrapping = 2 }; - template - class CBrType : public CSimpleType - { - public: - CBrType() {} - - virtual EBrType FromString(std::wstring &sValue) - { - if ( (L"column") == sValue ) this->m_eValue = brtypeColumn; - else if ( (L"page") == sValue ) this->m_eValue = brtypePage; - else if ( (L"textWrapping") == sValue ) this->m_eValue = brtypeTextWrapping; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case brtypeColumn : return (L"column"); - case brtypePage : return (L"page"); - case brtypeTextWrapping : return (L"textWrapping"); - default : return (L"page"); - } - } - - - SimpleType_FromString (EBrType) - SimpleType_Operator_Equal (CBrType) - }; + DEFINE_SIMPLE_TYPE(CBrType, EBrType, brtypePage) //-------------------------------------------------------------------------------- // CaptionPos 17.18.5 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ECaptionPos { @@ -938,42 +302,11 @@ namespace SimpleTypes captionposRight = 3 }; - template - class CCaptionPos : public CSimpleType - { - public: - CCaptionPos() {} + DEFINE_SIMPLE_TYPE(CCaptionPos, ECaptionPos, captionposAbove) - virtual ECaptionPos FromString(std::wstring &sValue) - { - if ( (L"above") == sValue ) this->m_eValue = captionposAbove; - else if ( (L"below") == sValue ) this->m_eValue = captionposBelow; - else if ( (L"left") == sValue ) this->m_eValue = captionposLeft; - else if ( (L"right") == sValue ) this->m_eValue = captionposRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case captionposAbove : return (L"above"); - case captionposBelow : return (L"below"); - case captionposLeft : return (L"left"); - case captionposRight : return (L"right"); - default : return (L"above"); - } - } - - - SimpleType_FromString (ECaptionPos) - SimpleType_Operator_Equal (CCaptionPos) - }; //-------------------------------------------------------------------------------- // ChapterSep 17.18.6 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EChapterSep { @@ -984,44 +317,11 @@ namespace SimpleTypes chaptersepPeriod = 4 }; - template - class CChapterSep : public CSimpleType - { - public: - CChapterSep() {} + DEFINE_SIMPLE_TYPE(CChapterSep, EChapterSep, chaptersepColon) - virtual EChapterSep FromString(std::wstring &sValue) - { - if ( (L"colon") == sValue ) this->m_eValue = chaptersepColon; - else if ( (L"emDash") == sValue ) this->m_eValue = chaptersepEmDash; - else if ( (L"enDash") == sValue ) this->m_eValue = chaptersepEnDash; - else if ( (L"hyphen") == sValue ) this->m_eValue = chaptersepHyphen; - else if ( (L"period") == sValue ) this->m_eValue = chaptersepPeriod; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case chaptersepColon : return (L"colon"); - case chaptersepEmDash : return (L"emDash"); - case chaptersepEnDash : return (L"enDash"); - case chaptersepHyphen : return (L"hyphen"); - case chaptersepPeriod : return (L"period"); - default : return (L"colon"); - } - } - - - SimpleType_FromString (EChapterSep) - SimpleType_Operator_Equal (CChapterSep) - }; //-------------------------------------------------------------------------------- // CharacterSpacing 17.18.7 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ECharacterSpacing { @@ -1030,40 +330,11 @@ namespace SimpleTypes charspacingDoNotCompress = 2 }; - template - class CCharacterSpacing : public CSimpleType - { - public: - CCharacterSpacing() {} + DEFINE_SIMPLE_TYPE(CCharacterSpacing, ECharacterSpacing, charspacingDoNotCompress) - virtual ECharacterSpacing FromString(std::wstring &sValue) - { - if ( (L"compressPunctuation") == sValue ) this->m_eValue = charspacingCompressPunctuation; - else if ( (L"compressPunctuationAndJapaneseKana") == sValue ) this->m_eValue = charspacingCompressPunctuationAndJapaneseKana; - else if ( (L"doNotCompress") == sValue ) this->m_eValue = charspacingDoNotCompress; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case charspacingCompressPunctuation : return (L"compressPunctuation"); - case charspacingCompressPunctuationAndJapaneseKana : return (L"compressPunctuationAndJapaneseKana"); - case charspacingDoNotCompress : return (L"doNotCompress"); - default : return (L"doNotCompress"); - } - } - - - SimpleType_FromString (ECharacterSpacing) - SimpleType_Operator_Equal (CCharacterSpacing) - }; //-------------------------------------------------------------------------------- // CombineBrackets 17.18.8 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ECombineBrackets { @@ -1074,178 +345,57 @@ namespace SimpleTypes combinebracketsSquare = 4 }; - template - class CCombineBrackets : public CSimpleType - { - public: - CCombineBrackets() {} - - virtual ECombineBrackets FromString(std::wstring &sValue) - { - if ( (L"angle") == sValue ) this->m_eValue = combinebracketsAngle; - else if ( (L"curly") == sValue ) this->m_eValue = combinebracketsCurly; - else if ( (L"none") == sValue ) this->m_eValue = combinebracketsNone; - else if ( (L"round") == sValue ) this->m_eValue = combinebracketsRound; - else if ( (L"square") == sValue ) this->m_eValue = combinebracketsSquare; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case combinebracketsAngle : return (L"angle"); - case combinebracketsCurly : return (L"curly"); - case combinebracketsNone : return (L"none"); - case combinebracketsRound : return (L"round"); - case combinebracketsSquare : return (L"square"); - default : return (L"none"); - } - } - - - SimpleType_FromString (ECombineBrackets) - SimpleType_Operator_Equal (CCombineBrackets) - }; - + DEFINE_SIMPLE_TYPE(CCombineBrackets, ECombineBrackets, combinebracketsNone) //-------------------------------------------------------------------------------- // DateTime 17.18.9 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CDateTime { public: - CDateTime() {} + CDateTime(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(const std::wstring &sValue); - void SetValue(const std::wstring &sValue) - { - m_sValue = sValue; - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; - - std::wstring FromString(std::wstring &sValue) - { - m_sValue = sValue; - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CDateTime) + SimpleTypes_DefaultS(CDateTime) private: - - std::wstring m_sValue; + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // DecimalNumberOrPercent 17.18.11 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CDecimalNumberOrPercent { public: - CDecimalNumberOrPercent() - { - m_dValue = 0; - m_bTrailingPercentSign = false; - } + CDecimalNumberOrPercent(); + double GetValue() const; - double GetValue() const - { - return m_dValue; - } + int GetValueIntegerPercent() const; + void SetValue(double dValue); + double FromString(const std::wstring &sValue, double dDefValue = 0); + std::wstring ToString () const; - int GetValueIntegerPercent() const - { - if(m_bTrailingPercentSign) - { - return (int)((m_dValue / 2) * 100); - } - else - { - return (int)m_dValue; - } - } + SimpleTypes_DefaultString(CDecimalNumberOrPercent) - void SetValue(double dValue) - { - m_dValue = dValue; - } - - double FromString(std::wstring &sValue, double dDefValue = 0) - { - if ( sValue.empty() ) - { - m_dValue = dDefValue; - return m_dValue; - } - - int nLen = (int)sValue.length(); - wchar_t wsLastChar = sValue[nLen - 1 ]; - if ( wsLastChar == '%' ) - { - nLen--; - m_bTrailingPercentSign = true; - } - else - m_bTrailingPercentSign = false; - - m_dValue = XmlUtils::GetDouble( sValue.substr(0, nLen)); - - return m_dValue; - } - - std::wstring ToString () const - { - std::wstring sResult; - - if ( !m_bTrailingPercentSign ) - sResult = std::to_wstring( (int)m_dValue); - else - sResult = boost::lexical_cast(m_dValue) + L"%"; - - return sResult; - } - - - - SimpleType_FromString2 (double) - SimpleType_Operator_Equal (CDecimalNumberOrPercent) - - bool IsPercent() const - { - return m_bTrailingPercentSign; - } - - void SetPercent(bool bPercent) - { - m_bTrailingPercentSign = bPercent; - } + bool IsPercent() const; + void SetPercent(bool bPercent); private: - double m_dValue; bool m_bTrailingPercentSign; // Есть ли знак процента в конце? - }; //-------------------------------------------------------------------------------- // Direction 17.18.12 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDirection { @@ -1253,38 +403,11 @@ namespace SimpleTypes directionRTL = 1 }; - template - class CDirection : public CSimpleType - { - public: - CDirection() {} - - virtual EDirection FromString(std::wstring &sValue) - { - if ( (L"ltr") == sValue ) this->m_eValue = directionLTR; - else if ( (L"rtl") == sValue ) this->m_eValue = directionRTL; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case directionLTR : return (L"ltr"); - case directionRTL : return (L"rtl"); - default : return (L"ltr"); - } - } - - SimpleType_FromString (EDirection) - SimpleType_Operator_Equal (CDirection) - }; + DEFINE_SIMPLE_TYPE(CDirection, EDirection, directionLTR) //-------------------------------------------------------------------------------- // DisplacedByCustomXml 17.18.13 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDisplacedByCustomXml { @@ -1292,39 +415,11 @@ namespace SimpleTypes displacedbycustomxmlPrev = 1 }; - template - class CDisplacedByCustomXml : public CSimpleType - { - public: - CDisplacedByCustomXml() {} - - virtual EDisplacedByCustomXml FromString(std::wstring &sValue) - { - if ( (L"next") == sValue ) this->m_eValue = displacedbycustomxmlNext; - else if ( (L"prev") == sValue ) this->m_eValue = displacedbycustomxmlPrev; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case displacedbycustomxmlNext : return (L"next"); - case displacedbycustomxmlPrev : return (L"prev"); - default : return (L"next"); - } - } - - SimpleType_FromString (EDisplacedByCustomXml) - SimpleType_Operator_Equal (CDisplacedByCustomXml) - }; - + DEFINE_SIMPLE_TYPE(CDisplacedByCustomXml, EDisplacedByCustomXml, displacedbycustomxmlNext) //-------------------------------------------------------------------------------- // DocGrid 17.18.14 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDocGrid { @@ -1334,43 +429,11 @@ namespace SimpleTypes docgridSnapToChars = 3, }; - template - class CDocGrid : public CSimpleType - { - public: - CDocGrid() {} - - virtual EDocGrid FromString(std::wstring &sValue) - { - if ( (L"default") == sValue ) this->m_eValue = docgridDefault; - else if ( (L"lines") == sValue ) this->m_eValue = docgridLines; - else if ( (L"linesAndChars") == sValue ) this->m_eValue = docgridLinesAndChars; - else if ( (L"snapToChars") == sValue ) this->m_eValue = docgridSnapToChars; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case docgridDefault : return (L"default"); - case docgridLines : return (L"lines"); - case docgridLinesAndChars : return (L"linesAndChars"); - case docgridSnapToChars : return (L"snapToChars"); - default : return (L"default"); - } - } - - SimpleType_FromString (EDocGrid) - SimpleType_Operator_Equal (CDocGrid) - }; - + DEFINE_SIMPLE_TYPE(CDocGrid, EDocGrid, docgridDefault) //-------------------------------------------------------------------------------- // DocPartBehavior 17.18.15 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDocPartBehavior { @@ -1379,41 +442,11 @@ namespace SimpleTypes docpartbehaviorPg = 2 }; - template - class CDocPartBehavior : public CSimpleType - { - public: - CDocPartBehavior() {} - - virtual EDocPartBehavior FromString(std::wstring &sValue) - { - if ( (L"content") == sValue ) this->m_eValue = docpartbehaviorContent; - else if ( (L"p") == sValue ) this->m_eValue = docpartbehaviorP; - else if ( (L"pg") == sValue ) this->m_eValue = docpartbehaviorPg; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case docpartbehaviorContent : return (L"content"); - case docpartbehaviorP : return (L"p"); - case docpartbehaviorPg : return (L"pg"); - default : return (L"content"); - } - } - - SimpleType_FromString (EDocPartBehavior) - SimpleType_Operator_Equal (CDocPartBehavior) - }; - + DEFINE_SIMPLE_TYPE(CDocPartBehavior, EDocPartBehavior, docpartbehaviorContent) //-------------------------------------------------------------------------------- // DocPartGallery 17.18.16 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDocPartGallery { @@ -1429,7 +462,7 @@ namespace SimpleTypes docpartgalleryCustHdrs = 9, docpartgalleryCustom1 = 10, docpartgalleryCustom2 = 11, - docpartgalleryCustom3 = 12, + docpartgalleryCustom3 = 12, docpartgalleryCustom4 = 13, docpartgalleryCustom5 = 14, docpartgalleryCustPgNum = 15, @@ -1457,110 +490,11 @@ namespace SimpleTypes docpartgalleryWatermarks = 37 }; - template - class CDocPartGallery : public CSimpleType - { - public: - CDocPartGallery() {} - - virtual EDocPartGallery FromString(std::wstring &sValue) - { - if ( (L"any") == sValue ) this->m_eValue = docpartgalleryAny; - else if ( (L"autoTxt") == sValue ) this->m_eValue = docpartgalleryAutoTxt; - else if ( (L"bib") == sValue ) this->m_eValue = docpartgalleryBib; - else if ( (L"coverPg") == sValue ) this->m_eValue = docpartgalleryCoverPg; - else if ( (L"custAutoTxt") == sValue ) this->m_eValue = docpartgalleryCustAutoTxt; - else if ( (L"custBib") == sValue ) this->m_eValue = docpartgalleryCustBib; - else if ( (L"custCoverPg") == sValue ) this->m_eValue = docpartgalleryCustCoverPg; - else if ( (L"custEq") == sValue ) this->m_eValue = docpartgalleryCustEq; - else if ( (L"custFtrs") == sValue ) this->m_eValue = docpartgalleryCustFtrs; - else if ( (L"custHdrs") == sValue ) this->m_eValue = docpartgalleryCustHdrs; - else if ( (L"custom1") == sValue ) this->m_eValue = docpartgalleryCustom1; - else if ( (L"custom2") == sValue ) this->m_eValue = docpartgalleryCustom2; - else if ( (L"custom3") == sValue ) this->m_eValue = docpartgalleryCustom3; - else if ( (L"custom4") == sValue ) this->m_eValue = docpartgalleryCustom4; - else if ( (L"custom5") == sValue ) this->m_eValue = docpartgalleryCustom5; - else if ( (L"custPgNum") == sValue ) this->m_eValue = docpartgalleryCustPgNum; - else if ( (L"custPgNumB") == sValue ) this->m_eValue = docpartgalleryCustPgNumB; - else if ( (L"custPgNumMargins") == sValue ) this->m_eValue = docpartgalleryCustPgNumMargins; - else if ( (L"custPgNumT") == sValue ) this->m_eValue = docpartgalleryCustPgNumT; - else if ( (L"custQuickParts") == sValue ) this->m_eValue = docpartgalleryCustQuickParts; - else if ( (L"custTblOfContents") == sValue ) this->m_eValue = docpartgalleryCustTblOfContents; - else if ( (L"custTbls") == sValue ) this->m_eValue = docpartgalleryCustTbls; - else if ( (L"custTxtBox") == sValue ) this->m_eValue = docpartgalleryCustTxtBox; - else if ( (L"custWatermarks") == sValue ) this->m_eValue = docpartgalleryCustWatermarks; - else if ( (L"default") == sValue ) this->m_eValue = docpartgalleryDefault; - else if ( (L"docParts") == sValue ) this->m_eValue = docpartgalleryDocParts; - else if ( (L"eq") == sValue ) this->m_eValue = docpartgalleryEq; - else if ( (L"ftrs") == sValue ) this->m_eValue = docpartgalleryFtrs; - else if ( (L"hdrs") == sValue ) this->m_eValue = docpartgalleryHdrs; - else if ( (L"pgNum") == sValue ) this->m_eValue = docpartgalleryPgNum; - else if ( (L"pgNumB") == sValue ) this->m_eValue = docpartgalleryPgNumB; - else if ( (L"pgNumMargins") == sValue ) this->m_eValue = docpartgalleryPgNumMargins; - else if ( (L"pgNumT") == sValue ) this->m_eValue = docpartgalleryPgNumT; - else if ( (L"placeholder") == sValue ) this->m_eValue = docpartgalleryPlaceHolder; - else if ( (L"tblOfContents") == sValue ) this->m_eValue = docpartgalleryTblOfContents; - else if ( (L"tbls") == sValue ) this->m_eValue = docpartgalleryTbls; - else if ( (L"txtBox") == sValue ) this->m_eValue = docpartgalleryTxtBox; - else if ( (L"watermarks") == sValue ) this->m_eValue = docpartgalleryWatermarks; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case docpartgalleryAny : return (L"any"); - case docpartgalleryAutoTxt : return (L"autoTxt"); - case docpartgalleryBib : return (L"bib"); - case docpartgalleryCoverPg : return (L"coverPg"); - case docpartgalleryCustAutoTxt : return (L"custAutoTxt"); - case docpartgalleryCustBib : return (L"custBib"); - case docpartgalleryCustCoverPg : return (L"custCoverPg"); - case docpartgalleryCustEq : return (L"custEq"); - case docpartgalleryCustFtrs : return (L"custFtrs"); - case docpartgalleryCustHdrs : return (L"custHdrs"); - case docpartgalleryCustom1 : return (L"custom1"); - case docpartgalleryCustom2 : return (L"custom2"); - case docpartgalleryCustom3 : return (L"custom3"); - case docpartgalleryCustom4 : return (L"custom4"); - case docpartgalleryCustom5 : return (L"custom5"); - case docpartgalleryCustPgNum : return (L"custPgNum"); - case docpartgalleryCustPgNumB : return (L"custPgNumB"); - case docpartgalleryCustPgNumMargins : return (L"custPgNumMargins"); - case docpartgalleryCustPgNumT : return (L"custPgNumT"); - case docpartgalleryCustQuickParts : return (L"custQuickParts"); - case docpartgalleryCustTblOfContents : return (L"custTblOfContents"); - case docpartgalleryCustTbls : return (L"custTbls"); - case docpartgalleryCustTxtBox : return (L"custTxtBox"); - case docpartgalleryCustWatermarks : return (L"custWatermarks"); - case docpartgalleryDefault : return (L"default"); - case docpartgalleryDocParts : return (L"docParts"); - case docpartgalleryEq : return (L"eq"); - case docpartgalleryFtrs : return (L"ftrs"); - case docpartgalleryHdrs : return (L"hdrs"); - case docpartgalleryPgNum : return (L"pgNum"); - case docpartgalleryPgNumB : return (L"pgNumB"); - case docpartgalleryPgNumMargins : return (L"pgNumMargins"); - case docpartgalleryPgNumT : return (L"pgNumT"); - case docpartgalleryPlaceHolder : return (L"placeholder"); - case docpartgalleryTblOfContents : return (L"tblOfContents"); - case docpartgalleryTbls : return (L"tbls"); - case docpartgalleryTxtBox : return (L"txtBox"); - case docpartgalleryWatermarks : return (L"watermarks"); - default : return (L"default"); - } - } - - SimpleType_FromString (EDocPartGallery) - SimpleType_Operator_Equal (CDocPartGallery) - }; + DEFINE_SIMPLE_TYPE(CDocPartGallery, EDocPartGallery, docpartgalleryDefault) //-------------------------------------------------------------------------------- // DocPartType 17.18.17 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDocPartType { @@ -1573,48 +507,11 @@ namespace SimpleTypes docparttypeToolbar = 6 }; - template - class CDocPartType : public CSimpleType - { - public: - CDocPartType() {} - - virtual EDocPartType FromString(std::wstring &sValue) - { - if ( (L"autoExp") == sValue ) this->m_eValue = docparttypeAutoExp; - else if ( (L"bbPlcHdr") == sValue ) this->m_eValue = docparttypeBBPlcHdr; - else if ( (L"formFld") == sValue ) this->m_eValue = docparttypeFormFld; - else if ( (L"none") == sValue ) this->m_eValue = docparttypeNone; - else if ( (L"normal") == sValue ) this->m_eValue = docparttypeNormal; - else if ( (L"speller") == sValue ) this->m_eValue = docparttypeSpeller; - else if ( (L"toolbar") == sValue ) this->m_eValue = docparttypeToolbar; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case docparttypeAutoExp : return (L"autoExp"); - case docparttypeBBPlcHdr : return (L"bbPlcHdr"); - case docparttypeFormFld : return (L"formFld"); - case docparttypeNone : return (L"none"); - case docparttypeNormal : return (L"normal"); - case docparttypeSpeller : return (L"speller"); - case docparttypeToolbar : return (L"toolbar"); - default : return (L"none"); - } - } - - SimpleType_FromString (EDocPartType) - SimpleType_Operator_Equal (CDocPartType) - }; + DEFINE_SIMPLE_TYPE(CDocPartType, EDocPartType, docparttypeNone) //-------------------------------------------------------------------------------- // DocProtect 17.18.18 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDocProtect { @@ -1625,44 +522,11 @@ namespace SimpleTypes docprotectTrackedChanges = 4 }; - template - class CDocProtect : public CSimpleType - { - public: - CDocProtect() {} - - virtual EDocProtect FromString(std::wstring &sValue) - { - if ( (L"comments") == sValue ) this->m_eValue = docprotectComments; - else if ( (L"forms") == sValue ) this->m_eValue = docprotectForms; - else if ( (L"none") == sValue ) this->m_eValue = docprotectNone; - else if ( (L"readOnly") == sValue ) this->m_eValue = docprotectReadOnly; - else if ( (L"trackedChanges" )== sValue ) this->m_eValue = docprotectTrackedChanges; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case docprotectComments : return (L"comments"); - case docprotectForms : return (L"forms"); - case docprotectNone : return (L"none"); - case docprotectReadOnly : return (L"readOnly"); - case docprotectTrackedChanges : return (L"trackedChanges"); - default : return (L"none"); - } - } - - SimpleType_FromString (EDocProtect) - SimpleType_Operator_Equal (CDocProtect) - }; + DEFINE_SIMPLE_TYPE(CDocProtect, EDocProtect, docprotectNone) //-------------------------------------------------------------------------------- // DocType 17.18.19 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDocType { @@ -1671,40 +535,11 @@ namespace SimpleTypes doctypeNotSpecified = 2 }; - template - class CDocType : public CSimpleType - { - public: - CDocType() {} - - virtual EDocType FromString(std::wstring &sValue) - { - if ( (L"eMail") == sValue ) this->m_eValue = doctypeEMail; - else if ( (L"letter") == sValue ) this->m_eValue = doctypeLetter; - else if ( (L"notSpecified") == sValue ) this->m_eValue = doctypeNotSpecified; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case doctypeEMail : return (L"eMail"); - case doctypeLetter : return (L"letter"); - case doctypeNotSpecified : return (L"notSpecified"); - default : return (L"notSpecified"); - } - } - - SimpleType_FromString (EDocType) - SimpleType_Operator_Equal (CDocType) - }; + DEFINE_SIMPLE_TYPE(CDocType, EDocType, doctypeNotSpecified) //-------------------------------------------------------------------------------- // DropCap 17.18.20 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EDropCap { @@ -1713,41 +548,11 @@ namespace SimpleTypes dropcapMargin = 2 }; - template - class CDropCap : public CSimpleType - { - public: - CDropCap() {} - - virtual EDropCap FromString(std::wstring &sValue) - { - if ( (L"drop") == sValue ) this->m_eValue = dropcapDrop; - else if ( (L"margin") == sValue ) this->m_eValue = dropcapMargin; - else if ( (L"none") == sValue ) this->m_eValue = dropcapNone; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case dropcapDrop : return (L"drop"); - case dropcapMargin : return (L"margin"); - case dropcapNone : return (L"none"); - default : return (L"none"); - } - } - - SimpleType_FromString (EDropCap) - SimpleType_Operator_Equal (CDropCap) - }; - + DEFINE_SIMPLE_TYPE(CDropCap, EDropCap, dropcapNone) //-------------------------------------------------------------------------------- // EdGrp 17.18.21 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EEdGrp { @@ -1760,49 +565,11 @@ namespace SimpleTypes edgrpOwners = 6 }; - template - class CEdGrp : public CSimpleType - { - public: - CEdGrp() {} - - virtual EEdGrp FromString(std::wstring &sValue) - { - if ( (L"administrators") == sValue ) this->m_eValue = edgrpAdministrators; - else if ( (L"contributors") == sValue ) this->m_eValue = edgrpContributors; - else if ( (L"current") == sValue ) this->m_eValue = edgrpCurrent; - else if ( (L"editors") == sValue ) this->m_eValue = edgrpEditors; - else if ( (L"everyone") == sValue ) this->m_eValue = edgrpEveryone; - else if ( (L"none") == sValue ) this->m_eValue = edgrpNone; - else if ( (L"owners") == sValue ) this->m_eValue = edgrpOwners; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case edgrpAdministrators : return (L"administrators"); - case edgrpContributors : return (L"contributors"); - case edgrpCurrent : return (L"current"); - case edgrpEditors : return (L"editors"); - case edgrpEveryone : return (L"everyone"); - case edgrpNone : return (L"none"); - case edgrpOwners : return (L"owners"); - default : return (L"everyone"); - } - } - - SimpleType_FromString (EEdGrp) - SimpleType_Operator_Equal (CEdGrp) - }; - + DEFINE_SIMPLE_TYPE(CEdGrp, EEdGrp, edgrpEveryone) //-------------------------------------------------------------------------------- // EdnPos 17.18.22 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EEdnPos { @@ -1810,100 +577,25 @@ namespace SimpleTypes ednposSectEnd = 1 }; - template - class CEdnPos : public CSimpleType - { - public: - CEdnPos() {} - - virtual EEdnPos FromString(std::wstring &sValue) - { - if ( (L"docEnd") == sValue ) this->m_eValue = ednposDocEnd; - else if ( (L"sectEnd") == sValue ) this->m_eValue = ednposSectEnd; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case ednposDocEnd : return (L"docEnd"); - case ednposSectEnd : return (L"sectEnd"); - default : return (L"sectEnd"); - } - } - - SimpleType_FromString (EEdnPos) - SimpleType_Operator_Equal (CEdnPos) - }; - + DEFINE_SIMPLE_TYPE(CEdnPos, EEdnPos, ednposSectEnd) //-------------------------------------------------------------------------------- // EighthPointMeasure 17.18.23 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - template - class CEighthPointMeasure : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CEighthPointMeasure, int, 0) public: - CEighthPointMeasure() {} + double ToPoints(); + double ToMM(); + double ToInches(); - virtual int FromString(std::wstring &sValue) - { - if (sValue == (L"auto")) - { - - } - else - { - this->m_eValue = sValue.empty() ? 0 : _wtoi( sValue.c_str() ); - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CEighthPointMeasure) - - double ToPoints() - { - return this->m_eValue / 8.0; - } - double ToMM() - { - return Pt_To_Mm(this->m_eValue / 8.0); - } - double ToInches() - { - return this->m_eValue / 576.0; - } - - int FromPoints(double dValue) - { - this->m_eValue = dValue * 8; - return this->m_eValue; - } - int FromInches(double dValue) - { - this->m_eValue = dValue * 576; - return this->m_eValue; - } + int FromPoints(double dValue); + int FromInches(double dValue); }; - //-------------------------------------------------------------------------------- // Em 17.18.24 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EEm { @@ -1914,191 +606,74 @@ namespace SimpleTypes emUnderDot = 4 }; - template - class CEm : public CSimpleType - { - public: - CEm() {} - - virtual EEm FromString(std::wstring &sValue) - { - if ( (L"circle") == sValue ) this->m_eValue = emCircle; - else if ( (L"comma") == sValue ) this->m_eValue = emComma; - else if ( (L"dot") == sValue ) this->m_eValue = emDot; - else if ( (L"none") == sValue ) this->m_eValue = emNone; - else if ( (L"underDot") == sValue ) this->m_eValue = emUnderDot; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case emCircle : return (L"circle"); - case emComma : return (L"comma"); - case emDot : return (L"dot"); - case emNone : return (L"none"); - case emUnderDot : return (L"underDot"); - default : return (L"none"); - } - } - - SimpleType_FromString (EEm) - SimpleType_Operator_Equal (CEm) - }; - - + DEFINE_SIMPLE_TYPE(CEm, EEm, emNone) //-------------------------------------------------------------------------------- // FFHelpTextVal 17.18.25 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CFFHelpTextVal { public: - CFFHelpTextVal() {} + CFFHelpTextVal(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + std::wstring ToXmlString() const; - void SetValue(std::wstring &sValue) - { - if ( sValue.length() <= 256 ) - m_sValue = sValue; - else - m_sValue = sValue.substr( 0, 256 ); - } + SimpleTypes_DefaultS(CFFHelpTextVal) - - std::wstring FromString(std::wstring &sValue) - { - if ( sValue.length() <= 256 ) - m_sValue = sValue; - else - m_sValue = sValue.substr( 0, 256 ); - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - std::wstring ToXmlString() const - { - return XmlUtils::EncodeXmlString(m_sValue); - } - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CFFHelpTextVal) private: - - std::wstring m_sValue; + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // FFName 17.18.26 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CFFName { public: - CFFName() {} + CFFName(); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - void SetValue(std::wstring &sValue) - { - if ( sValue.length() <= 65 ) - m_sValue = sValue; - else - m_sValue = sValue.substr( 0, 65 ); - } - - - std::wstring FromString(std::wstring &sValue) - { - if ( sValue.length() <= 65 ) - m_sValue = sValue; - else - m_sValue = sValue.substr( 0, 65 ); - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - std::wstring ToXmlString() const - { - return XmlUtils::EncodeXmlString(m_sValue); - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + std::wstring ToXmlString() const; - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CFFName) - private: + SimpleTypes_DefaultS(CFFName) - std::wstring m_sValue; + private: + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // FFStatusTextVal 17.18.27 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CFFStatusTextVal { public: - CFFStatusTextVal() {} + CFFStatusTextVal(); + std::wstring GetValue() const; + void SetValue(std::wstring &sValue); - std::wstring GetValue() const - { - return m_sValue; - } + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; + std::wstring ToXmlString() const; - void SetValue(std::wstring &sValue) - { - if ( sValue.length() <= 140 ) - m_sValue = sValue; - else - m_sValue = sValue.substr( 0, 140 ); - } - - - std::wstring FromString(std::wstring &sValue) - { - if ( sValue.length() <= 140 ) - m_sValue = sValue; - else - m_sValue = sValue.substr( 0, 140 ); - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - std::wstring ToXmlString() const - { - return XmlUtils::EncodeXmlString(m_sValue); - } - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CFFStatusTextVal) + SimpleTypes_DefaultS(CFFStatusTextVal) private: - - std::wstring m_sValue; + std::wstring m_sValue; }; //-------------------------------------------------------------------------------- // FFTextType 17.18.28 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EFFTextType { @@ -2110,48 +685,11 @@ namespace SimpleTypes fftexttypeRegular = 5 }; - template - class CFFTextType : public CSimpleType - { - public: - CFFTextType() {} - - virtual EFFTextType FromString(std::wstring &sValue) - { - if ( (L"calculated") == sValue ) this->m_eValue = fftexttypeCalculated; - else if ( (L"currentDate") == sValue ) this->m_eValue = fftexttypeCurrentDate; - else if ( (L"currentTime") == sValue ) this->m_eValue = fftexttypeCurrentTime; - else if ( (L"date") == sValue ) this->m_eValue = fftexttypeDate; - else if ( (L"number") == sValue ) this->m_eValue = fftexttypeNumber; - else if ( (L"regular") == sValue ) this->m_eValue = fftexttypeRegular; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case fftexttypeCalculated : return (L"calculated"); - case fftexttypeCurrentDate : return (L"currentDate"); - case fftexttypeCurrentTime : return (L"currentTime"); - case fftexttypeDate : return (L"date"); - case fftexttypeNumber : return (L"number"); - case fftexttypeRegular : return (L"regular"); - default : return (L"regular"); - } - } - - SimpleType_FromString (EFFTextType) - SimpleType_Operator_Equal (CFFTextType) - }; - - + DEFINE_SIMPLE_TYPE(CFFTextType, EFFTextType, fftexttypeRegular) //-------------------------------------------------------------------------------- // FldCharType 17.18.29 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EFldCharType { @@ -2160,40 +698,11 @@ namespace SimpleTypes fldchartypeEnd = 2 }; - template - class CFldCharType : public CSimpleType - { - public: - CFldCharType() {} - - virtual EFldCharType FromString(std::wstring &sValue) - { - if ( (L"begin") == sValue ) this->m_eValue = fldchartypeBegin; - else if ( (L"end") == sValue ) this->m_eValue = fldchartypeEnd; - else if ( (L"separate") == sValue ) this->m_eValue = fldchartypeSeparate; - else this->m_eValue = eDefVal; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case fldchartypeBegin : return (L"begin"); - case fldchartypeEnd : return (L"end"); - case fldchartypeSeparate : return (L"separate"); - default : return (L"begin"); - } - } - - SimpleType_FromString (EFldCharType) - SimpleType_Operator_Equal (CFldCharType) - }; + DEFINE_SIMPLE_TYPE(CFldCharType, EFldCharType, fldchartypeBegin) //-------------------------------------------------------------------------------- // FontFamily 17.18.30 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EFontFamily { @@ -2205,45 +714,11 @@ namespace SimpleTypes fontfamilySwiss = 5 }; - template - class CFontFamily : public CSimpleType - { - public: - CFontFamily() {} + DEFINE_SIMPLE_TYPE(CFontFamily, EFontFamily, fontfamilyAuto) - virtual EFontFamily FromString(std::wstring &sValue) - { - if ( (L"auto") == sValue ) this->m_eValue = fontfamilyAuto; - else if ( (L"decorative") == sValue ) this->m_eValue = fontfamilyDecorative; - else if ( (L"modern") == sValue ) this->m_eValue = fontfamilyModern; - else if ( (L"roman") == sValue ) this->m_eValue = fontfamilyRoman; - else if ( (L"script") == sValue ) this->m_eValue = fontfamilyScript; - else if ( (L"swiss") == sValue ) this->m_eValue = fontfamilySwiss; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case fontfamilyAuto : return (L"auto"); - case fontfamilyDecorative : return (L"decorative"); - case fontfamilyModern : return (L"modern"); - case fontfamilyRoman : return (L"roman"); - case fontfamilyScript : return (L"script"); - case fontfamilySwiss : return (L"swiss"); - default : return (L"auto"); - } - } - - SimpleType_FromString (EFontFamily) - SimpleType_Operator_Equal (CFontFamily) - }; //-------------------------------------------------------------------------------- // FrameLayout 17.18.31 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EFrameLayout { @@ -2252,40 +727,11 @@ namespace SimpleTypes framelayoutRows = 2 }; - template - class CFrameLayout : public CSimpleType - { - public: - CFrameLayout() {} - - virtual EFrameLayout FromString(std::wstring &sValue) - { - if ( (L"cols") == sValue ) this->m_eValue = framelayoutCols; - else if ( (L"none") == sValue ) this->m_eValue = framelayoutNone; - else if ( (L"rows") == sValue ) this->m_eValue = framelayoutRows; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case framelayoutCols : return (L"cols"); - case framelayoutNone : return (L"none"); - case framelayoutRows : return (L"rows"); - default : return (L"none"); - } - } - - SimpleType_FromString (EFrameLayout) - SimpleType_Operator_Equal (CFrameLayout) - }; + DEFINE_SIMPLE_TYPE(CFrameLayout, EFrameLayout, framelayoutNone) //-------------------------------------------------------------------------------- // FrameScrollbar 17.18.32 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EFrameScrollbar { @@ -2294,40 +740,11 @@ namespace SimpleTypes framescrollbarOn = 2 }; - template - class CFrameScrollbar : public CSimpleType - { - public: - CFrameScrollbar() {} - - virtual EFrameScrollbar FromString(std::wstring &sValue) - { - if ( (L"auto") == sValue ) this->m_eValue = framescrollbarAuto; - else if ( (L"off") == sValue ) this->m_eValue = framescrollbarOff; - else if ( (L"on") == sValue ) this->m_eValue = framescrollbarOn; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case framescrollbarAuto : return (L"auto"); - case framescrollbarOff : return (L"off"); - case framescrollbarOn : return (L"on"); - default : return (L"auto"); - } - } - - SimpleType_FromString (EFrameScrollbar) - SimpleType_Operator_Equal (CFrameScrollbar) - }; + DEFINE_SIMPLE_TYPE(CFrameScrollbar, EFrameScrollbar, framescrollbarAuto) //-------------------------------------------------------------------------------- // FtnEdn 17.18.33 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EFtnEdn { @@ -2337,45 +754,11 @@ namespace SimpleTypes ftnednSeparator = 3 }; - template - class CFtnEdn : public CSimpleType - { - public: - CFtnEdn() {} - - virtual EFtnEdn FromString(std::wstring &sValue) - { - if (L"continuationNotice" == sValue ) this->m_eValue = ftnednContinuationNotice; - else if (L"continuationSeparator" == sValue || - L"continuation-separator" == sValue) this->m_eValue = ftnednContinuationSeparator; - else if (L"normal" == sValue ) this->m_eValue = ftnednNormal; - else if (L"separator" == sValue ) this->m_eValue = ftnednSeparator; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case ftnednContinuationNotice : return (L"continuationNotice"); - case ftnednContinuationSeparator : return (L"continuationSeparator"); - case ftnednNormal : return (L"normal"); - case ftnednSeparator : return (L"separator"); - default : return (L"normal"); - } - } - - SimpleType_FromString (EFtnEdn) - SimpleType_Operator_Equal (CFtnEdn) - }; - - + DEFINE_SIMPLE_TYPE(CFtnEdn, EFtnEdn, ftnednNormal) //-------------------------------------------------------------------------------- // FtnPos 17.18.34 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EFtnPos { @@ -2385,43 +768,11 @@ namespace SimpleTypes ftnposSectEnd = 3 }; - template - class CFtnPos : public CSimpleType - { - public: - CFtnPos() {} - - virtual EFtnPos FromString(std::wstring &sValue) - { - if ( (L"beneathText") == sValue ) this->m_eValue = ftnposBeneathText; - else if ( (L"docEnd") == sValue ) this->m_eValue = ftnposDocEnd; - else if ( (L"pageBottom") == sValue ) this->m_eValue = ftnposPageBottom; - else if ( (L"sectEnd") == sValue ) this->m_eValue = ftnposSectEnd; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case ftnposBeneathText : return (L"beneathText"); - case ftnposDocEnd : return (L"docEnd"); - case ftnposPageBottom : return (L"pageBottom"); - case ftnposSectEnd : return (L"sectEnd"); - default : return (L"sectEnd"); - } - } - - SimpleType_FromString (EFtnPos) - SimpleType_Operator_Equal (CFtnPos) - }; - + DEFINE_SIMPLE_TYPE(CFtnPos, EFtnPos, ftnposSectEnd) //-------------------------------------------------------------------------------- // HAnchor 17.18.35 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EHAnchor { @@ -2430,40 +781,11 @@ namespace SimpleTypes hanchorText = 2 }; - template - class CHAnchor : public CSimpleType - { - public: - CHAnchor() {} - - virtual EHAnchor FromString(std::wstring &sValue) - { - if ( (L"margin") == sValue ) this->m_eValue = hanchorMargin; - else if ( (L"page") == sValue ) this->m_eValue = hanchorPage; - else if ( (L"text") == sValue ) this->m_eValue = hanchorText; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case hanchorMargin : return (L"margin"); - case hanchorPage : return (L"page"); - case hanchorText : return (L"text"); - default : return (L"text"); - } - } - - SimpleType_FromString (EHAnchor) - SimpleType_Operator_Equal (CHAnchor) - }; + DEFINE_SIMPLE_TYPE(CHAnchor, EHAnchor, hanchorText) //-------------------------------------------------------------------------------- // HdrFtr 17.18.36 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EHdrFtr { @@ -2472,41 +794,11 @@ namespace SimpleTypes hdrftrFirst = 2 }; - template - class CHdrFtr : public CSimpleType - { - public: - CHdrFtr() {} - - virtual EHdrFtr FromString(std::wstring &sValue) - { - if ( L"default" == sValue || - L"odd" == sValue ) this->m_eValue = hdrftrDefault; - else if ( L"even" == sValue ) this->m_eValue = hdrftrEven; - else if ( L"first" == sValue ) this->m_eValue = hdrftrFirst; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case hdrftrDefault : return L"default"; - case hdrftrEven : return L"even"; - case hdrftrFirst : return L"first"; - default : return L"default"; - } - } - - SimpleType_FromString (EHdrFtr) - SimpleType_Operator_Equal (CHdrFtr) - }; + DEFINE_SIMPLE_TYPE(CHdrFtr, EHdrFtr, hdrftrDefault) //-------------------------------------------------------------------------------- // HeightRule 17.18.37 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EHeightRule { @@ -2515,39 +807,11 @@ namespace SimpleTypes heightruleExact = 2 }; - template - class CHeightRule : public CSimpleType - { - public: - CHeightRule() {} + DEFINE_SIMPLE_TYPE(CHeightRule, EHeightRule, heightruleAuto) - virtual EHeightRule FromString(std::wstring &sValue) - { - if ( (L"atLeast") == sValue ) this->m_eValue = heightruleAtLeast; - else if ( (L"auto") == sValue ) this->m_eValue = heightruleAuto; - else if ( (L"exact") == sValue ) this->m_eValue = heightruleExact; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case heightruleAtLeast : return (L"atLeast"); - case heightruleAuto : return (L"auto"); - case heightruleExact : return (L"exact"); - default : return (L"auto"); - } - } - - SimpleType_FromString (EHeightRule) - SimpleType_Operator_Equal (CHeightRule) - }; //-------------------------------------------------------------------------------- - // TextFormFormatType - //-------------------------------------------------------------------------------- + // TextFormFormatType + //-------------------------------------------------------------------------------- enum ETextFormFormatType { @@ -2558,81 +822,27 @@ namespace SimpleTypes textFormFormatTypeRegExp = 4 }; - template - class CTextFormFormatType : public CSimpleType - { - public: - CTextFormFormatType() {} + DEFINE_SIMPLE_TYPE(CTextFormFormatType, ETextFormFormatType, textFormFormatTypeNone) - virtual ETextFormFormatType FromString(std::wstring &sValue) - { - if (L"none" == sValue) this->m_eValue = textFormFormatTypeNone; - else if (L"digit" == sValue) this->m_eValue = textFormFormatTypeDigit; - else if (L"letter" == sValue) this->m_eValue = textFormFormatTypeLetter; - else if (L"mask" == sValue) this->m_eValue = textFormFormatTypeMask; - else if (L"regExp" == sValue) this->m_eValue = textFormFormatTypeRegExp; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case textFormFormatTypeNone: return L"none"; - case textFormFormatTypeDigit: return L"digit"; - case textFormFormatTypeLetter: return L"letter"; - case textFormFormatTypeMask: return L"mask"; - case textFormFormatTypeRegExp: return L"regExp"; - default: return (L"none"); - } - } - SimpleType_FromString(ETextFormFormatType) - SimpleType_Operator_Equal(CTextFormFormatType) - }; + //-------------------------------------------------------------------------------- + // ComplexFormType + //-------------------------------------------------------------------------------- enum EComplexFormType { complexFormTypeCustom = 0, complexFormTypeTelephone = 1, complexFormTypeEmail = 2 - }; + }; - template - class CComplexFormType : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CComplexFormType, EComplexFormType, complexFormTypeCustom) public: - CComplexFormType() {} - - virtual EComplexFormType FromString(std::wstring &sValue) - { - if (L"custom" == sValue || L"none" == sValue) this->m_eValue = complexFormTypeCustom; - else if (L"telephone" == sValue || L"phone" == sValue) this->m_eValue = complexFormTypeTelephone; - else if (L"email" == sValue) this->m_eValue = complexFormTypeEmail; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case complexFormTypeCustom: return L"custom"; - case complexFormTypeTelephone: return L"telephone"; - case complexFormTypeEmail: return L"email"; - default: return (L"custom"); - } - } - bool IsDefaultValue() const - { - return (this->m_eValue == eDefValue); - } - SimpleType_FromString(EComplexFormType) - SimpleType_Operator_Equal(CComplexFormType) + bool IsDefaultValue() const; }; + //-------------------------------------------------------------------------------- // HexColor 17.18.38 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EHexColor { @@ -2640,414 +850,92 @@ namespace SimpleTypes hexcolorRGB = 1 }; - //-------------------------------------------------------------------------------- - // HighlightColor 17.18.40 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + // HighlightColor 17.18.40 (Part 1) + //-------------------------------------------------------------------------------- - enum EHighlightColor - { - highlightcolorBlack = 0, - highlightcolorBlue = 1, - highlightcolorCyan = 2, - highlightcolorDarkBlue = 3, - highlightcolorDarkCyan = 4, - highlightcolorDarkGray = 5, - highlightcolorDarkGreen = 6, - highlightcolorDarkMagenta = 7, - highlightcolorDarkRed = 8, - highlightcolorDarkYellow = 9, - highlightcolorGreen = 10, - highlightcolorLightGray = 11, - highlightcolorMagenta = 12, - highlightcolorNone = 13, - highlightcolorRed = 14, - highlightcolorWhite = 15, - highlightcolorYellow = 16 - }; - - template - class CHexColor : public CSimpleType + enum EHighlightColor { + highlightcolorBlack = 0, + highlightcolorBlue = 1, + highlightcolorCyan = 2, + highlightcolorDarkBlue = 3, + highlightcolorDarkCyan = 4, + highlightcolorDarkGray = 5, + highlightcolorDarkGreen = 6, + highlightcolorDarkMagenta = 7, + highlightcolorDarkRed = 8, + highlightcolorDarkYellow = 9, + highlightcolorGreen = 10, + highlightcolorLightGray = 11, + highlightcolorMagenta = 12, + highlightcolorNone = 13, + highlightcolorRed = 14, + highlightcolorWhite = 15, + highlightcolorYellow = 16 + }; + + DEFINE_SIMPLE_TYPE_START(CHexColor, EHexColor, hexcolorAuto) public: - CHexColor() - { - m_unR = 0; - m_unG = 0; - m_unB = 0; - } - CHexColor(unsigned char r, unsigned char g, unsigned char b) - { - this->m_eValue = hexcolorRGB; - m_unR = r; - m_unG = g; - m_unB = b; - } + CHexColor(unsigned char r, unsigned char g, unsigned char b); - void SetColorByString (); + std::wstring ToStringNoAlpha () const; - virtual EHexColor FromString(std::wstring &sValue); - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case hexcolorRGB : - { - std::wstringstream sstream; - sstream << L"00" << boost::wformat( L"%02x%02x%02x" ) % m_unR % m_unG % m_unB; - - return sstream.str(); - } - case hexcolorAuto : - default : - return (L"auto"); - } - } - virtual std::wstring ToStringNoAlpha () const - { - switch(this->m_eValue) - { - case hexcolorRGB : - { - std::wstringstream sstream; - sstream << boost::wformat( L"%02x%02x%02x" ) % m_unR % m_unG % m_unB; - - return sstream.str(); - } - case hexcolorAuto : - default : - return (L"auto"); } - } - - SimpleType_FromString (EHexColor) - SimpleType_Operator_Equal (CHexColor) - - void Set_R(unsigned char R) - { - m_unR = R; - } - void Set_G(unsigned char G) - { - m_unG = G; - } - void Set_B(unsigned char B) - { - m_unB = B; - } - unsigned char Get_R() const - { - return m_unR; - } - unsigned char Get_G() const - { - return m_unG; - } - - unsigned char Get_B() const - { - return m_unB; - } - unsigned char Get_A() const - { - return 255; - } + void Set_R(unsigned char R); + void Set_G(unsigned char G); + void Set_B(unsigned char B); + unsigned char Get_R() const; + unsigned char Get_G() const; + unsigned char Get_B() const; + unsigned char Get_A() const; private: - - void Parse() - { - if ( m_sValue.length() < 6 ) - return; - - m_unR = HexToInt( (int)m_sValue[1] ) + (unsigned char)(HexToInt( (int)m_sValue[0] ) << 4); - m_unG = HexToInt( (int)m_sValue[3] ) + (unsigned char)(HexToInt( (int)m_sValue[2] ) << 4); - m_unB = HexToInt( (int)m_sValue[5] ) + (unsigned char)(HexToInt( (int)m_sValue[4] ) << 4); - } - void Parse3() - { - if ( m_sValue.length() < 3 ) - return; - - m_unR = HexToInt( (int)m_sValue[0] ) + (unsigned char)(HexToInt( (int)m_sValue[0]) << 4); - m_unG = HexToInt( (int)m_sValue[1] ) + (unsigned char)(HexToInt( (int)m_sValue[1]) << 4); - m_unB = HexToInt( (int)m_sValue[2] ) + (unsigned char)(HexToInt( (int)m_sValue[2]) << 4); - } - int HexToInt(int nHex) - { - if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); - if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); - if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); - - return 0; - } + void Parse(); + void Parse3(); + int HexToInt(int nHex); private: + std::wstring m_sValue; - std::wstring m_sValue; - - unsigned char m_unR; - unsigned char m_unG; - unsigned char m_unB; - }; + unsigned char m_unR = 0; + unsigned char m_unG = 0; + unsigned char m_unB = 0; + }; //-------------------------------------------------------------------------------- // HexColorAuto 17.18.39 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EHexColorAuto { hexcolorautoAuto = 0 }; - template - class CHexColorAuto : public CSimpleType - { - public: - CHexColorAuto() {} + DEFINE_SIMPLE_TYPE(CHexColorAuto, EHexColorAuto, hexcolorautoAuto) - virtual EHexColorAuto FromString(std::wstring &sValue) - { - this->m_eValue = hexcolorautoAuto; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return (L"auto"); - } - SimpleType_FromString (EHexColorAuto) - SimpleType_Operator_Equal (CHexColorAuto) - }; //-------------------------------------------------------------------------------- // HighlightColor 17.18.40 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - - - template - class CHighlightColor : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CHighlightColor, EHighlightColor, highlightcolorNone) public: - CHighlightColor() - { - m_unR = 0; - m_unG = 0; - m_unB = 0; - m_unA = 255; - } - CHighlightColor(const CHexColor<>& color) - : m_unR(color.Get_R()), m_unG(color.Get_G()), m_unB(color.Get_B()), m_unA(255) {} + CHighlightColor(const CHexColor& color); - virtual EHighlightColor FromString(std::wstring &sValue) - { - if ( (L"black") == sValue ) - { - this->m_eValue = highlightcolorBlack; - - m_unR = 0x00; - m_unG = 0x00; - m_unB = 0x00; - m_unA = 0xFF; - } - else if ( (L"blue") == sValue ) - { - this->m_eValue = highlightcolorBlue; - m_unR = 0x00; - m_unG = 0x00; - m_unB = 0xFF; - m_unA = 0xFF; - } - else if ( (L"cyan") == sValue ) - { - this->m_eValue = highlightcolorCyan; - m_unR = 0x00; - m_unG = 0xFF; - m_unB = 0xFF; - m_unA = 0xFF; - } - else if ( (L"darkBlue") == sValue ) - { - this->m_eValue = highlightcolorDarkBlue; - m_unR = 0x00; - m_unG = 0x00; - m_unB = 0x8B; - m_unA = 0xFF; - } - else if ( (L"darkCyan") == sValue ) - { - this->m_eValue = highlightcolorDarkCyan; - m_unR = 0x00; - m_unG = 0x8B; - m_unB = 0x8B; - m_unA = 0xFF; - } - else if ( (L"darkGray") == sValue ) - { - this->m_eValue = highlightcolorDarkGray; - m_unR = 0xA9; - m_unG = 0xA9; - m_unB = 0xA9; - m_unA = 0xFF; - } - else if ( (L"darkGreen") == sValue ) - { - this->m_eValue = highlightcolorDarkGreen; - m_unR = 0x00; - m_unG = 0x64; - m_unB = 0x00; - m_unA = 0xFF; - } - else if ( (L"darkMagenta") == sValue ) - { - this->m_eValue = highlightcolorDarkMagenta; - m_unR = 0x80; - m_unG = 0x00; - m_unB = 0x80; - m_unA = 0xFF; - } - else if ( (L"darkRed") == sValue ) - { - this->m_eValue = highlightcolorDarkRed; - m_unR = 0x8B; - m_unG = 0x00; - m_unB = 0x00; - m_unA = 0xFF; - } - else if ( (L"darkYellow") == sValue ) - { - this->m_eValue = highlightcolorDarkYellow; - m_unR = 0x80; - m_unG = 0x80; - m_unB = 0x00; - m_unA = 0xFF; - } - else if ( (L"green") == sValue ) - { - this->m_eValue = highlightcolorGreen; - m_unR = 0x00; - m_unG = 0xFF; - m_unB = 0x00; - m_unA = 0xFF; - } - else if ( (L"lightGray") == sValue ) - { - this->m_eValue = highlightcolorLightGray; - m_unR = 0xD3; - m_unG = 0xD3; - m_unB = 0xD3; - m_unA = 0xFF; - } - else if ( (L"magenta") == sValue ) - { - this->m_eValue = highlightcolorMagenta; - m_unR = 0xFF; - m_unG = 0x00; - m_unB = 0xFF; - m_unA = 0xFF; - } - else if ( (L"none") == sValue ) - { - this->m_eValue = highlightcolorNone; - m_unR = 0x00; - m_unG = 0x00; - m_unB = 0x00; - m_unA = 0x00; - } - else if ( (L"red") == sValue ) - { - this->m_eValue = highlightcolorRed; - m_unR = 0xFF; - m_unG = 0x00; - m_unB = 0x00; - m_unA = 0xFF; - } - else if ( (L"white") == sValue ) - { - this->m_eValue = highlightcolorWhite; - m_unR = 0xFF; - m_unG = 0xFF; - m_unB = 0xFF; - m_unA = 0xFF; - } - else if ( (L"yellow") == sValue ) - { - this->m_eValue = highlightcolorYellow; - m_unR = 0xFF; - m_unG = 0xFF; - m_unB = 0x00; - m_unA = 0xFF; - } - else - { - this->m_eValue = eDefValue; - - // Инициализируем цвет - FromString( ToString() ); - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case highlightcolorBlack : return (L"black"); - case highlightcolorBlue : return (L"blue"); - case highlightcolorCyan : return (L"cyan"); - case highlightcolorDarkBlue : return (L"darkBlue"); - case highlightcolorDarkCyan : return (L"darkCyan"); - case highlightcolorDarkGray : return (L"darkGray"); - case highlightcolorDarkGreen : return (L"darkGreen"); - case highlightcolorDarkMagenta : return (L"darkMagenta"); - case highlightcolorDarkRed : return (L"darkRed"); - case highlightcolorDarkYellow : return (L"darkYellow"); - case highlightcolorGreen : return (L"green"); - case highlightcolorLightGray : return (L"lightGray"); - case highlightcolorMagenta : return (L"magenta"); - case highlightcolorNone : return (L"none"); - case highlightcolorRed : return (L"red"); - case highlightcolorWhite : return (L"white"); - case highlightcolorYellow : return (L"yellow"); - default : return (L"none"); - } - } - - SimpleType_FromString (EHighlightColor) - SimpleType_Operator_Equal (CHighlightColor) - unsigned char Get_R() const - { - return m_unR; - } - unsigned char Get_G() const - { - return m_unG; - } - - unsigned char Get_B() const - { - return m_unB; - } - - unsigned char Get_A() const - { - return m_unA; - } + unsigned char Get_R() const; + unsigned char Get_G() const; + unsigned char Get_B() const; + unsigned char Get_A() const; private: - - unsigned char m_unR; - unsigned char m_unG; - unsigned char m_unB; - unsigned char m_unA; - + unsigned char m_unR = 0; + unsigned char m_unG = 0; + unsigned char m_unB = 0; + unsigned char m_unA = 255; }; - //-------------------------------------------------------------------------------- // Hint 17.18.41 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EHint { @@ -3056,104 +944,31 @@ namespace SimpleTypes hintEastAsia = 2 }; - template - class CHint : public CSimpleType - { - public: - CHint() {} - - virtual EHint FromString(std::wstring &sValue) - { - if ( (L"cs") == sValue ) this->m_eValue = hintCs; - else if ( (L"default") == sValue ) this->m_eValue = hintDefault; - else if ( (L"eastAsia") == sValue ) this->m_eValue = hintEastAsia; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case hintCs : return (L"cs"); - case hintDefault : return (L"default"); - case hintEastAsia : return (L"eastAsia"); - default : return (L"default"); - } - } - - SimpleType_FromString (EHint) - SimpleType_Operator_Equal (CHint) - }; - - + DEFINE_SIMPLE_TYPE(CHint, EHint, hintDefault) //-------------------------------------------------------------------------------- // HpsMeasure 17.18.42 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CHpsMeasure : public CUniversalMeasure { public: - CHpsMeasure() {} + CHpsMeasure(); - virtual double FromString(std::wstring &sValue) - { - Parse(sValue, 2); + virtual double FromString(const std::wstring &sValue); + virtual void SetValue(double dValue); + virtual std::wstring ToString () const; + long ToHps() const; + virtual double FromPoints(double dValue); + virtual double FromInches(double dValue); + virtual double FromHps(double dValue); - m_dValue = fabs( m_dValue ); - - return m_dValue; - } - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = dValue; - } - virtual std::wstring ToString () const - { - std::wstring sResult; - - if (m_bUnit) - { - sResult = boost::lexical_cast( m_dValue ) + L"pt"; - } - else - { - sResult = std::to_wstring( (int)(m_dValue * 2) ); - } - - return sResult; - } - long ToHps() const - { - return (long)(2 * m_dValue); - } - - virtual double FromPoints(double dValue) - { - m_dValue = fabs( dValue ); - return m_dValue; - } - virtual double FromInches(double dValue) - { - m_dValue = fabs( dValue * 72.0 ); - return m_dValue; - } - virtual double FromHps(double dValue) - { - m_dValue = dValue / 2; - return m_dValue; - } - SimpleType_FromString (double) - SimpleType_Operator_Equal (CHpsMeasure) - UniversalMeasure_AdditionalOpearators(CHpsMeasure) + SimpleTypes_DefaultD(CHpsMeasure) }; //-------------------------------------------------------------------------------- // InfoTextType 17.18.43 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EInfoTextType { @@ -3161,38 +976,11 @@ namespace SimpleTypes infotexttypeText = 1 }; - template - class CInfoTextType : public CSimpleType - { - public: - CInfoTextType() {} - - virtual EInfoTextType FromString(std::wstring &sValue) - { - if ( (L"autoText") == sValue ) this->m_eValue = infotexttypeAutoText; - else if ( (L"text") == sValue ) this->m_eValue = infotexttypeText; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case infotexttypeAutoText : return (L"autoText"); - case infotexttypeText : return (L"text"); - default : return (L"text"); - } - } - - SimpleType_FromString (EInfoTextType) - SimpleType_Operator_Equal (CInfoTextType) - }; + DEFINE_SIMPLE_TYPE(CInfoTextType, EInfoTextType, infotexttypeText) //-------------------------------------------------------------------------------- // Jc 17.18.44 (Part 1) + 9.10.2 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EJc { @@ -3210,57 +998,11 @@ namespace SimpleTypes jcRight = 11 }; - template - class CJc : public CSimpleType - { - public: - CJc() {} + DEFINE_SIMPLE_TYPE(CJc, EJc, jcLeft) - virtual EJc FromString(std::wstring &sValue) - { - if ( (L"both") == sValue ) this->m_eValue = jcBoth; - else if ( (L"center") == sValue ) this->m_eValue = jcCenter; - else if ( (L"distribute") == sValue ) this->m_eValue = jcDistribute; - else if ( (L"end") == sValue ) this->m_eValue = jcEnd; - else if ( (L"highKashida") == sValue ) this->m_eValue = jcHighKashida; - else if ( (L"lowKashida") == sValue ) this->m_eValue = jcLowKashida; - else if ( (L"mediumKashida") == sValue ) this->m_eValue = jcMediumKashida; - else if ( (L"numTab") == sValue ) this->m_eValue = jcNumTab; - else if ( (L"start") == sValue ) this->m_eValue = jcStart; - else if ( (L"thaiDistribute") == sValue ) this->m_eValue = jcThaiDistribute; - else if ( (L"left") == sValue ) this->m_eValue = jcLeft; - else if ( (L"right") == sValue ) this->m_eValue = jcRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case jcBoth : return (L"both"); - case jcCenter : return (L"center"); - case jcDistribute : return (L"distribute"); - case jcEnd : return (L"end"); - case jcHighKashida : return (L"highKashida"); - case jcLowKashida : return (L"lowKashida"); - case jcMediumKashida : return (L"mediumKashida"); - case jcNumTab : return (L"numTab"); - case jcStart : return (L"start"); - case jcThaiDistribute : return (L"thaiDistribute"); - case jcLeft : return (L"left"); - case jcRight : return (L"right"); - default : return (L"left"); - } - } - - SimpleType_FromString (EJc) - SimpleType_Operator_Equal (CJc) - }; //-------------------------------------------------------------------------------- // JcTable 17.18.45 (Part 1) + 9.10.3 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EJcTable { @@ -3271,43 +1013,11 @@ namespace SimpleTypes jctableRight = 4 }; - template - class CJcTable : public CSimpleType - { - public: - CJcTable() {} + DEFINE_SIMPLE_TYPE(CJcTable, EJcTable, jctableLeft) - virtual EJcTable FromString(std::wstring &sValue) - { - if ( (L"center") == sValue ) this->m_eValue = jctableCenter; - else if ( (L"end") == sValue ) this->m_eValue = jctableEnd; - else if ( (L"start") == sValue ) this->m_eValue = jctableStart; - else if ( (L"left") == sValue ) this->m_eValue = jctableLeft; - else if ( (L"right") == sValue ) this->m_eValue = jctableRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case jctableCenter : return (L"center"); - case jctableEnd : return (L"end"); - case jctableStart : return (L"start"); - case jctableLeft : return (L"left"); - case jctableRight : return (L"right"); - default : return (L"left"); - } - } - - SimpleType_FromString (EJcTable) - SimpleType_Operator_Equal (CJcTable) - }; //-------------------------------------------------------------------------------- // LevelSuffix 17.18.46 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ELevelSuffix { @@ -3316,42 +1026,11 @@ namespace SimpleTypes levelsuffixTab = 2 }; - template - class CLevelSuffix : public CSimpleType - { - public: - CLevelSuffix() {} - - virtual ELevelSuffix FromString(std::wstring &sValue) - { - if ( (L"nothing") == sValue ) this->m_eValue = levelsuffixNothing; - else if ( (L"space") == sValue ) this->m_eValue = levelsuffixSpace; - else if ( (L"tab") == sValue ) this->m_eValue = levelsuffixTab; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case levelsuffixNothing : return (L"nothing"); - case levelsuffixSpace : return (L"space"); - case levelsuffixTab : return (L"tab"); - default : return (L"nothing"); - } - } - - SimpleType_FromString (ELevelSuffix) - SimpleType_Operator_Equal (CLevelSuffix) - }; - - + DEFINE_SIMPLE_TYPE(CLevelSuffix, ELevelSuffix, levelsuffixNothing) //-------------------------------------------------------------------------------- // LineNumberRestart 17.18.47 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ELineNumberRestart { @@ -3360,41 +1039,11 @@ namespace SimpleTypes linenumberrestartNewSection = 3 }; - template - class CLineNumberRestart : public CSimpleType - { - public: - CLineNumberRestart() {} - - virtual ELineNumberRestart FromString(std::wstring &sValue) - { - if ( (L"continuous") == sValue ) this->m_eValue = linenumberrestartContinious; - else if ( (L"newPage") == sValue ) this->m_eValue = linenumberrestartNewPage; - else if ( (L"newSection") == sValue ) this->m_eValue = linenumberrestartNewSection; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case linenumberrestartContinious : return (L"continuous"); - case linenumberrestartNewPage : return (L"newPage"); - case linenumberrestartNewSection : return (L"newSection"); - default : return (L"newPage"); - } - } - - SimpleType_FromString (ELineNumberRestart) - SimpleType_Operator_Equal (CLineNumberRestart) - }; - + DEFINE_SIMPLE_TYPE(CLineNumberRestart, ELineNumberRestart, linenumberrestartNewPage) //-------------------------------------------------------------------------------- // LineSpacingRule 17.18.48 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ELineSpacingRule { @@ -3403,40 +1052,11 @@ namespace SimpleTypes linespacingruleExact = 2 }; - template - class CLineSpacingRule : public CSimpleType - { - public: - CLineSpacingRule() {} - - virtual ELineSpacingRule FromString(std::wstring &sValue) - { - if ( (L"atLeast") == sValue ) this->m_eValue = linespacingruleAtLeast; - else if ( (L"auto") == sValue ) this->m_eValue = linespacingruleAuto; - else if ( (L"exact") == sValue ) this->m_eValue = linespacingruleExact; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case linespacingruleAtLeast : return (L"atLeast"); - case linespacingruleAuto : return (L"auto"); - case linespacingruleExact : return (L"exact"); - default : return (L"auto"); - } - } - - SimpleType_FromString (ELineSpacingRule) - SimpleType_Operator_Equal (CLineSpacingRule) - }; + DEFINE_SIMPLE_TYPE(CLineSpacingRule, ELineSpacingRule, linespacingruleAuto) //-------------------------------------------------------------------------------- // Lock 17.18.49 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ELock { @@ -3446,148 +1066,41 @@ namespace SimpleTypes lockUnlocked = 3 }; - template - class CLock : public CSimpleType - { - public: - CLock() {} - - virtual ELock FromString(std::wstring &sValue) - { - if ( (L"contentLocked") == sValue ) this->m_eValue = lockContentLocked; - else if ( (L"sdtContentLocked") == sValue ) this->m_eValue = lockSdtContentLocked; - else if ( (L"sdtLocked") == sValue ) this->m_eValue = lockSdtLocked; - else if ( (L"unlocked") == sValue ) this->m_eValue = lockUnlocked; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case lockContentLocked : return (L"contentLocked"); - case lockSdtContentLocked : return (L"sdtContentLocked"); - case lockSdtLocked : return (L"sdtLocked"); - case lockUnlocked : return (L"unlocked"); - default : return (L"unlocked"); - } - } - - SimpleType_FromString (ELock) - SimpleType_Operator_Equal (CLock) - }; - + DEFINE_SIMPLE_TYPE(CLock, ELock, lockUnlocked) //-------------------------------------------------------------------------------- // LongHexNumber 17.18.50 (Part 1) - //-------------------------------------------------------------------------------- - template - class CLongHexNumber : public CSimpleType - { - public: - CLongHexNumber() {} + //-------------------------------------------------------------------------------- - virtual int FromString(std::wstring &sValue) - { - if ( !Parse(sValue) ) - { - this->m_eValue = nDefValue; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return XmlUtils::IntToString(this->m_eValue, L"%08X"); - } - - SimpleType_FromString (unsigned int) - SimpleType_Operator_Equal (CLongHexNumber) + DEFINE_SIMPLE_TYPE_START(CLongHexNumber, unsigned int, 0) private: - - bool Parse(std::wstring &sValue) - { - if ( sValue.length() < 8 ) - return false; - - bool bResult = true; - - this->m_eValue = HexToInt( (int)sValue[7], bResult ); - this->m_eValue += HexToInt( (int)sValue[6], bResult ) << 4; - this->m_eValue += HexToInt( (int)sValue[5], bResult ) << 8; - this->m_eValue += HexToInt( (int)sValue[4], bResult ) << 12; - this->m_eValue += HexToInt( (int)sValue[3], bResult ) << 16; - this->m_eValue += HexToInt( (int)sValue[2], bResult ) << 20; - this->m_eValue += HexToInt( (int)sValue[1], bResult ) << 24; - this->m_eValue += HexToInt( (int)sValue[0], bResult ) << 28; - - return bResult; - } - - int HexToInt(int nHex, bool &bResult) - { - if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); - if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); - if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); - - bResult = false; - - return 0; - } - + bool Parse(const std::wstring &sValue); + int HexToInt(int nHex, bool &bResult); }; - //-------------------------------------------------------------------------------- // MacroName 17.18.51 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CMacroName { public: - CMacroName() {} + CMacroName(); + std::wstring GetValue() const; - std::wstring GetValue() const - { - return m_sValue; - } + void SetValue(std::wstring &sValue); + std::wstring FromString(const std::wstring &sValue); + std::wstring ToString () const; - void SetValue(std::wstring &sValue) - { - if ( sValue.length() <= 33 ) - m_sValue = sValue; - else - m_sValue = sValue.substr( 0, 33 ); - } + SimpleTypes_DefaultS(CMacroName) - - std::wstring FromString(std::wstring &sValue) - { - if ( sValue.length() <= 33 ) - m_sValue = sValue; - else - m_sValue = sValue.substr( 0, 33 ); - - return m_sValue; - } - - std::wstring ToString () const - { - return m_sValue; - } - - SimpleType_FromString2 (std::wstring) - SimpleType_Operator_Equal (CMacroName) private: - - std::wstring m_sValue; + std::wstring m_sValue; }; + //-------------------------------------------------------------------------------- // MailMergeDataType 17.18.52 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EMailMergeDataType { @@ -3601,52 +1114,11 @@ namespace SimpleTypes mailmergeddatatypeXmlFile = 7 }; - template - class CMailMergeDataType : public CSimpleType - { - public: - CMailMergeDataType() {} - - virtual EMailMergeDataType FromString(std::wstring &sValue) - { - if ( (L"native") == sValue ) this->m_eValue = mailmergeddatatypeNative; - else if ( (L"odbc") == sValue ) this->m_eValue = mailmergeddatatypeODBC; - else if ( (L"query") == sValue ) this->m_eValue = mailmergeddatatypeQuery; - else if ( (L"soap") == sValue ) this->m_eValue = mailmergeddatatypeSoap; - else if ( (L"spreadsheet") == sValue ) this->m_eValue = mailmergeddatatypeSpreadsheet; - else if ( (L"textFile") == sValue ) this->m_eValue = mailmergeddatatypeTextFile; - else if ( (L"xQuery") == sValue ) this->m_eValue = mailmergeddatatypeXQuery; - else if ( (L"xmlFile") == sValue ) this->m_eValue = mailmergeddatatypeXmlFile; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case mailmergeddatatypeNative : return (L"native"); - case mailmergeddatatypeODBC : return (L"odbc"); - case mailmergeddatatypeQuery : return (L"query"); - case mailmergeddatatypeSoap : return (L"soap"); - case mailmergeddatatypeSpreadsheet : return (L"spreadsheet"); - case mailmergeddatatypeTextFile : return (L"textFile"); - case mailmergeddatatypeXQuery : return (L"xQuery"); - case mailmergeddatatypeXmlFile : return (L"xmlFile"); - default : return (L"textFile"); - } - } - - SimpleType_FromString (EMailMergeDataType) - SimpleType_Operator_Equal (CMailMergeDataType) - }; - - + DEFINE_SIMPLE_TYPE(CMailMergeDataType, EMailMergeDataType, mailmergeddatatypeTextFile) //-------------------------------------------------------------------------------- // MailMergeDest 17.18.53 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EMailMergeDest { @@ -3656,44 +1128,11 @@ namespace SimpleTypes mailmergeddestPrinter = 3 }; - template - class CMailMergeDest : public CSimpleType - { - public: - CMailMergeDest() {} - - virtual EMailMergeDest FromString(std::wstring &sValue) - { - if ( (L"email") == sValue ) this->m_eValue = mailmergeddestEmail; - else if ( (L"fax") == sValue ) this->m_eValue = mailmergeddestFax; - else if ( (L"newDocument") == sValue ) this->m_eValue = mailmergeddestNewDocument; - else if ( (L"printer") == sValue ) this->m_eValue = mailmergeddestPrinter; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case mailmergeddestEmail : return (L"email"); - case mailmergeddestFax : return (L"fax"); - case mailmergeddestNewDocument : return (L"newDocument"); - case mailmergeddestPrinter : return (L"printer"); - default : return (L"newDocument"); - } - } - - SimpleType_FromString (EMailMergeDest) - SimpleType_Operator_Equal (CMailMergeDest) - }; - - + DEFINE_SIMPLE_TYPE(CMailMergeDest, EMailMergeDest, mailmergeddestEmail) //-------------------------------------------------------------------------------- // MailMergeDocType 17.18.54 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EMailMergeDocType { @@ -3705,48 +1144,11 @@ namespace SimpleTypes mailmergeddoctypeMailingLabels = 5 }; - template - class CMailMergeDocType : public CSimpleType - { - public: - CMailMergeDocType() {} - - virtual EMailMergeDocType FromString(std::wstring &sValue) - { - if ( (L"catalog") == sValue ) this->m_eValue = mailmergeddoctypeCatalog; - else if ( (L"email") == sValue ) this->m_eValue = mailmergeddoctypeEmail; - else if ( (L"envelopes") == sValue ) this->m_eValue = mailmergeddoctypeEnvelopes; - else if ( (L"fax") == sValue ) this->m_eValue = mailmergeddoctypeFax; - else if ( (L"formLetters") == sValue ) this->m_eValue = mailmergeddoctypeFormLetters; - else if ( (L"mailingLabels") == sValue ) this->m_eValue = mailmergeddoctypeMailingLabels; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case mailmergeddoctypeCatalog : return (L"catalog"); - case mailmergeddoctypeEmail : return (L"email"); - case mailmergeddoctypeEnvelopes : return (L"envelopes"); - case mailmergeddoctypeFax : return (L"fax"); - case mailmergeddoctypeFormLetters : return (L"formLetters"); - case mailmergeddoctypeMailingLabels : return (L"mailingLabels"); - default : return (L"email"); - } - } - - SimpleType_FromString (EMailMergeDocType) - SimpleType_Operator_Equal (CMailMergeDocType) - }; - - + DEFINE_SIMPLE_TYPE(CMailMergeDocType, EMailMergeDocType, mailmergeddoctypeEmail) //-------------------------------------------------------------------------------- // MailMergeOdsoFMDFieldType 17.18.55 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EMailMergeOdsoFMDFieldType { @@ -3754,40 +1156,11 @@ namespace SimpleTypes mailmergeodsofmdfieldtypeNull = 1 }; - template - class CMailMergeOdsoFMDFieldType : public CSimpleType - { - public: - CMailMergeOdsoFMDFieldType() {} - - virtual EMailMergeOdsoFMDFieldType FromString(std::wstring &sValue) - { - if ( (L"dbColumn") == sValue ) this->m_eValue = mailmergeodsofmdfieldtypeDbColumn; - else if ( (L"null") == sValue ) this->m_eValue = mailmergeodsofmdfieldtypeNull; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case mailmergeodsofmdfieldtypeDbColumn : return (L"dbColumn"); - case mailmergeodsofmdfieldtypeNull : return (L"null"); - default : return (L"null"); - } - } - - SimpleType_FromString (EMailMergeOdsoFMDFieldType) - SimpleType_Operator_Equal (CMailMergeOdsoFMDFieldType) - }; - - + DEFINE_SIMPLE_TYPE(CMailMergeOdsoFMDFieldType, EMailMergeOdsoFMDFieldType, mailmergeodsofmdfieldtypeNull) //-------------------------------------------------------------------------------- // MailMergeSourceType 17.18.56 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EMailMergeSourceType { @@ -3802,54 +1175,11 @@ namespace SimpleTypes mailmergesourcetypeText = 8, }; - template - class CMailMergeSourceType : public CSimpleType - { - public: - CMailMergeSourceType() {} - - virtual EMailMergeSourceType FromString(std::wstring &sValue) - { - if ( (L"addressBook") == sValue ) this->m_eValue = mailmergesourcetypeAddressBook; - else if ( (L"database") == sValue ) this->m_eValue = mailmergesourcetypeDatabase; - else if ( (L"document1") == sValue ) this->m_eValue = mailmergesourcetypeDocument1; - else if ( (L"document2") == sValue ) this->m_eValue = mailmergesourcetypeDocument2; - else if ( (L"email") == sValue ) this->m_eValue = mailmergesourcetypeEmail; - else if ( (L"legacy") == sValue ) this->m_eValue = mailmergesourcetypeLegacy; - else if ( (L"master") == sValue ) this->m_eValue = mailmergesourcetypeMaster; - else if ( (L"native") == sValue ) this->m_eValue = mailmergesourcetypeNative; - else if ( (L"text") == sValue ) this->m_eValue = mailmergesourcetypeText; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case mailmergesourcetypeAddressBook : return (L"addressBook"); - case mailmergesourcetypeDatabase : return (L"database"); - case mailmergesourcetypeDocument1 : return (L"document1"); - case mailmergesourcetypeDocument2 : return (L"document2"); - case mailmergesourcetypeEmail : return (L"email"); - case mailmergesourcetypeLegacy : return (L"legacy"); - case mailmergesourcetypeMaster : return (L"master"); - case mailmergesourcetypeNative : return (L"native"); - case mailmergesourcetypeText : return (L"text"); - default : return (L"text"); - } - } - - SimpleType_FromString (EMailMergeSourceType) - SimpleType_Operator_Equal (CMailMergeSourceType) - }; - - + DEFINE_SIMPLE_TYPE(CMailMergeSourceType, EMailMergeSourceType, mailmergesourcetypeText) //-------------------------------------------------------------------------------- // Merge 17.18.57 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EMerge { @@ -3857,39 +1187,11 @@ namespace SimpleTypes mergeRestart = 1 }; - template - class CMerge : public CSimpleType - { - public: - CMerge() {} - - virtual EMerge FromString(std::wstring &sValue) - { - if ( (L"continue") == sValue ) this->m_eValue = mergeContinue; - else if ( (L"restart") == sValue ) this->m_eValue = mergeRestart; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case mergeContinue : return (L"continue"); - case mergeRestart : return (L"restart"); - default : return (L"restart"); - } - } - - SimpleType_FromString (EMerge) - SimpleType_Operator_Equal (CMerge) - }; - + DEFINE_SIMPLE_TYPE(CMerge, EMerge, mergeContinue) //-------------------------------------------------------------------------------- // MultiLevelType 17.18.58 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EMultiLevelType { @@ -3898,46 +1200,11 @@ namespace SimpleTypes emultileveltypeSingleLevel = 2 }; - template - class CMultiLevelType : public CSimpleType - { - public: - CMultiLevelType() {} - - virtual EMultiLevelType FromString(std::wstring &sValue) - { - if ( L"hybridMultilevel" == sValue || - L"HybridMultilevel" == sValue) this->m_eValue = emultileveltypeHybridMultilevel; - else if ( L"multilevel" == sValue || - L"Multilevel" == sValue ) this->m_eValue = emultileveltypeMultilevel; - else if ( L"singleLevel" == sValue || - L"SingleLevel" == sValue) this->m_eValue = emultileveltypeSingleLevel; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case emultileveltypeHybridMultilevel : return (L"hybridMultilevel"); - case emultileveltypeMultilevel : return (L"multilevel"); - case emultileveltypeSingleLevel : return (L"singleLevel"); - default : return (L"singleLevel"); - } - } - - SimpleType_FromString (EMultiLevelType) - SimpleType_Operator_Equal (CMultiLevelType) - }; - - - + DEFINE_SIMPLE_TYPE(CMultiLevelType, EMultiLevelType, emultileveltypeSingleLevel) //-------------------------------------------------------------------------------- // NumberFormat 17.18.59 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ENumberFormat { @@ -3958,7 +1225,7 @@ namespace SimpleTypes numberformatDecimalEnclosedCircle = 14, numberformatDecimalEnclosedCircleChinese = 15, numberformatDecimalEnclosedFullstop = 16, - numberformatDecimalEnclosedParen = 17, + numberformatDecimalEnclosedParen = 17, numberformatDecimalFullWidth = 18, numberformatDecimalFullWidth2 = 19, numberformatDecimalHalfWidth = 20, @@ -4006,169 +1273,11 @@ namespace SimpleTypes numberformatVietnameseCounting = 62 }; - template - class CNumberFormat : public CSimpleType - { - public: - CNumberFormat() {} - - virtual ENumberFormat FromString(std::wstring &sValue) - { - if ( (L"aiueo") == sValue ) this->m_eValue = numberformatAiueo; - else if ( (L"aiueoFullWidth") == sValue ) this->m_eValue = numberformatAiueoFullWidth; - else if ( (L"arabicAbjad") == sValue ) this->m_eValue = numberformatArabicAbjad; - else if ( (L"arabicAlpha") == sValue ) this->m_eValue = numberformatArabicAlpha; - else if ( (L"bahtText") == sValue ) this->m_eValue = numberformatBahtText; - else if ( (L"bullet") == sValue ) this->m_eValue = numberformatBullet; - else if ( (L"cardinalText") == sValue ) this->m_eValue = numberformatCardinalText; - else if ( (L"chicago") == sValue ) this->m_eValue = numberformatChicago; - else if ( (L"chineseCounting") == sValue ) this->m_eValue = numberformatChineseCounting; - else if ( (L"chineseCountingThousand") == sValue ) this->m_eValue = numberformatChineseCountingThousand; - else if ( (L"chineseLegalSimplified") == sValue ) this->m_eValue = numberformatChineseLegalSimplified; - else if ( (L"chosung") == sValue ) this->m_eValue = numberformatChosung; - else if ( (L"custom") == sValue ) this->m_eValue = numberformatCustom; - else if ( (L"decimal") == sValue ) this->m_eValue = numberformatDecimal; - else if ( (L"decimalEnclosedCircle") == sValue ) this->m_eValue = numberformatDecimalEnclosedCircle; - else if ( (L"decimalEnclosedCircleChinese") == sValue ) this->m_eValue = numberformatDecimalEnclosedCircleChinese; - else if ( (L"decimalEnclosedFullstop") == sValue ) this->m_eValue = numberformatDecimalEnclosedFullstop; - else if ( (L"decimalEnclosedParen") == sValue ) this->m_eValue = numberformatDecimalEnclosedParen; - else if ( (L"decimalFullWidth") == sValue ) this->m_eValue = numberformatDecimalFullWidth; - else if ( (L"decimalFullWidth2") == sValue ) this->m_eValue = numberformatDecimalFullWidth2; - else if ( (L"decimalHalfWidth") == sValue ) this->m_eValue = numberformatDecimalHalfWidth; - else if ( (L"decimalZero") == sValue ) this->m_eValue = numberformatDecimalZero; - else if ( (L"dollarText") == sValue ) this->m_eValue = numberformatDollarText; - else if ( (L"ganada") == sValue ) this->m_eValue = numberformatGanada; - else if ( (L"hebrew1") == sValue ) this->m_eValue = numberformatHebrew1; - else if ( (L"hebrew2") == sValue ) this->m_eValue = numberformatHebrew2; - else if ( (L"hex") == sValue ) this->m_eValue = numberformatHex; - else if ( (L"hindiConsonants") == sValue ) this->m_eValue = numberformatHindiConsonants; - else if ( (L"hindiCounting") == sValue ) this->m_eValue = numberformatHindiCounting; - else if ( (L"hindiNumbers") == sValue ) this->m_eValue = numberformatHindiNumbers; - else if ( (L"hindiVowels") == sValue ) this->m_eValue = numberformatHindiVowels; - else if ( (L"ideographDigital") == sValue ) this->m_eValue = numberformatIdeographDigital; - else if ( (L"ideographEnclosedCircle") == sValue ) this->m_eValue = numberformatIdeographEnclosedCircle; - else if ( (L"ideographLegalTraditional") == sValue ) this->m_eValue = numberformatIdeographLegalTraditional; - else if ( (L"ideographTraditional") == sValue ) this->m_eValue = numberformatIdeographTraditional; - else if ( (L"ideographZodiac") == sValue ) this->m_eValue = numberformatIdeographZodiac; - else if ( (L"ideographZodiacTraditional") == sValue ) this->m_eValue = numberformatIdeographZodiacTraditional; - else if ( (L"iroha") == sValue ) this->m_eValue = numberformatIroha; - else if ( (L"irohaFullWidth") == sValue ) this->m_eValue = numberformatIrohaFullWidth; - else if ( (L"japaneseCounting") == sValue ) this->m_eValue = numberformatJapaneseCounting; - else if ( (L"japaneseDigitalTenThousand") == sValue ) this->m_eValue = numberformatJapaneseDigitalTenThousand; - else if ( (L"japaneseLegal") == sValue ) this->m_eValue = numberformatJapaneseLegal; - else if ( (L"koreanCounting") == sValue ) this->m_eValue = numberformatKoreanCounting; - else if ( (L"koreanDigital") == sValue ) this->m_eValue = numberformatKoreanDigital; - else if ( (L"koreanDigital2") == sValue ) this->m_eValue = numberformatKoreanDigital2; - else if ( (L"koreanLegal") == sValue ) this->m_eValue = numberformatKoreanLegal; - else if ( (L"lowerLetter") == sValue ) this->m_eValue = numberformatLowerLetter; - else if ( (L"lowerRoman") == sValue ) this->m_eValue = numberformatLowerRoman; - else if ( (L"none") == sValue ) this->m_eValue = numberformatNone; - else if ( (L"numberInDash") == sValue ) this->m_eValue = numberformatNumberInDash; - else if ( (L"ordinal") == sValue ) this->m_eValue = numberformatOrdinal; - else if ( (L"ordinalText") == sValue ) this->m_eValue = numberformatOrdinalText; - else if ( (L"russianLower") == sValue ) this->m_eValue = numberformatRussianLower; - else if ( (L"russianUpper") == sValue ) this->m_eValue = numberformatRussianUpper; - else if ( (L"taiwaneseCounting") == sValue ) this->m_eValue = numberformatTaiwaneseCounting; - else if ( (L"taiwaneseCountingThousand") == sValue ) this->m_eValue = numberformatTaiwaneseCountingThousand; - else if ( (L"taiwaneseDigital") == sValue ) this->m_eValue = numberformatTaiwaneseDigital; - else if ( (L"thaiCounting") == sValue ) this->m_eValue = numberformatThaiCounting; - else if ( (L"thaiLetters") == sValue ) this->m_eValue = numberformatThaiLetters; - else if ( (L"thaiNumbers") == sValue ) this->m_eValue = numberformatThaiNumbers; - else if ( (L"upperLetter") == sValue ) this->m_eValue = numberformatUpperLetter; - else if ( (L"upperRoman") == sValue ) this->m_eValue = numberformatUpperRoman; - else if ( (L"vietnameseCounting") == sValue ) this->m_eValue = numberformatVietnameseCounting; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case numberformatAiueo : return (L"aiueo"); - case numberformatAiueoFullWidth : return (L"aiueoFullWidth"); - case numberformatArabicAbjad : return (L"arabicAbjad"); - case numberformatArabicAlpha : return (L"arabicAlpha"); - case numberformatBahtText : return (L"bahtText"); - case numberformatBullet : return (L"bullet"); - case numberformatCardinalText : return (L"cardinalText"); - case numberformatChicago : return (L"chicago"); - case numberformatChineseCounting : return (L"chineseCounting"); - case numberformatChineseCountingThousand : return (L"chineseCountingThousand"); - case numberformatChineseLegalSimplified : return (L"chineseLegalSimplified"); - case numberformatChosung : return (L"chosung"); - case numberformatCustom : return (L"custom"); - case numberformatDecimal : return (L"decimal"); - case numberformatDecimalEnclosedCircle : return (L"decimalEnclosedCircle"); - case numberformatDecimalEnclosedCircleChinese : return (L"decimalEnclosedCircleChinese"); - case numberformatDecimalEnclosedFullstop : return (L"decimalEnclosedFullstop"); - case numberformatDecimalEnclosedParen : return (L"decimalEnclosedParen"); - case numberformatDecimalFullWidth : return (L"decimalFullWidth"); - case numberformatDecimalFullWidth2 : return (L"decimalFullWidth2"); - case numberformatDecimalHalfWidth : return (L"decimalHalfWidth"); - case numberformatDecimalZero : return (L"decimalZero"); - case numberformatDollarText : return (L"dollarText"); - case numberformatGanada : return (L"ganada"); - case numberformatHebrew1 : return (L"hebrew1"); - case numberformatHebrew2 : return (L"hebrew2"); - case numberformatHex : return (L"hex"); - case numberformatHindiConsonants : return (L"hindiConsonants"); - case numberformatHindiCounting : return (L"hindiCounting"); - case numberformatHindiNumbers : return (L"hindiNumbers"); - case numberformatHindiVowels : return (L"hindiVowels"); - case numberformatIdeographDigital : return (L"ideographDigital"); - case numberformatIdeographEnclosedCircle : return (L"ideographEnclosedCircle"); - case numberformatIdeographLegalTraditional : return (L"ideographLegalTraditional"); - case numberformatIdeographTraditional : return (L"ideographTraditional"); - case numberformatIdeographZodiac : return (L"ideographZodiac"); - case numberformatIdeographZodiacTraditional : return (L"ideographZodiacTraditional"); - case numberformatIroha : return (L"iroha"); - case numberformatIrohaFullWidth : return (L"irohaFullWidth"); - case numberformatJapaneseCounting : return (L"japaneseCounting"); - case numberformatJapaneseDigitalTenThousand : return (L"japaneseDigitalTenThousand"); - case numberformatJapaneseLegal : return (L"japaneseLegal"); - case numberformatKoreanCounting : return (L"koreanCounting"); - case numberformatKoreanDigital : return (L"koreanDigital"); - case numberformatKoreanDigital2 : return (L"koreanDigital2"); - case numberformatKoreanLegal : return (L"koreanLegal"); - case numberformatLowerLetter : return (L"lowerLetter"); - case numberformatLowerRoman : return (L"lowerRoman"); - case numberformatNone : return (L"none"); - case numberformatNumberInDash : return (L"numberInDash"); - case numberformatOrdinal : return (L"ordinal"); - case numberformatOrdinalText : return (L"ordinalText"); - case numberformatRussianLower : return (L"russianLower"); - case numberformatRussianUpper : return (L"russianUpper"); - case numberformatTaiwaneseCounting : return (L"taiwaneseCounting"); - case numberformatTaiwaneseCountingThousand : return (L"taiwaneseCountingThousand"); - case numberformatTaiwaneseDigital : return (L"taiwaneseDigital"); - case numberformatThaiCounting : return (L"thaiCounting"); - case numberformatThaiLetters : return (L"thaiLetters"); - case numberformatThaiNumbers : return (L"thaiNumbers"); - case numberformatUpperLetter : return (L"upperLetter"); - case numberformatUpperRoman : return (L"upperRoman"); - case numberformatVietnameseCounting : return (L"vietnameseCounting"); - default : return (L"none"); - } - } - - SimpleType_FromString (ENumberFormat) - SimpleType_Operator_Equal (CNumberFormat) - ENumberFormat GetValue() const - { - return this->m_eValue; - } - }; - - - - - + DEFINE_SIMPLE_TYPE(CNumberFormat, ENumberFormat, numberformatNone) //-------------------------------------------------------------------------------- // ObjectDrawAspect 17.18.60 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EObjectDrawAspect { @@ -4176,39 +1285,11 @@ namespace SimpleTypes objectdrawaspectIcon = 1 }; - template - class CObjectDrawAspect : public CSimpleType - { - public: - CObjectDrawAspect() {} - - virtual EObjectDrawAspect FromString(std::wstring &sValue) - { - if ( (L"content") == sValue ) this->m_eValue = objectdrawaspectContent; - else if ( (L"icon") == sValue ) this->m_eValue = objectdrawaspectIcon; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case objectdrawaspectContent : return (L"content"); - case objectdrawaspectIcon : return (L"icon"); - default : return (L"content"); - } - } - - SimpleType_FromString (EObjectDrawAspect) - SimpleType_Operator_Equal (CObjectDrawAspect) - }; - + DEFINE_SIMPLE_TYPE(CObjectDrawAspect, EObjectDrawAspect, objectdrawaspectContent) //-------------------------------------------------------------------------------- // ObjectUpdateMode 17.18.61 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EObjectUpdateMode { @@ -4216,39 +1297,11 @@ namespace SimpleTypes objectupdatemodeOnCall = 1 }; - template - class CObjectUpdateMode : public CSimpleType - { - public: - CObjectUpdateMode() {} - - virtual EObjectUpdateMode FromString(std::wstring &sValue) - { - if ( (L"always") == sValue ) this->m_eValue = objectupdatemodeAlways; - else if ( (L"onCall") == sValue ) this->m_eValue = objectupdatemodeOnCall; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case objectupdatemodeAlways : return (L"always"); - case objectupdatemodeOnCall : return (L"onCall"); - default : return (L"always"); - } - } - - SimpleType_FromString (EObjectUpdateMode) - SimpleType_Operator_Equal (CObjectUpdateMode) - }; - + DEFINE_SIMPLE_TYPE(CObjectUpdateMode, EObjectUpdateMode, objectupdatemodeAlways) //-------------------------------------------------------------------------------- // PageBorderDisplay 17.18.62 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EPageBorderDisplay { @@ -4257,43 +1310,11 @@ namespace SimpleTypes pageborderdisplayNotFirstPage = 2 }; - template - class CPageBorderDisplay : public CSimpleType - { - public: - CPageBorderDisplay() {} - - virtual EPageBorderDisplay FromString(std::wstring &sValue) - { - if ( (L"allPages") == sValue ) this->m_eValue = pageborderdisplayAllPages; - else if ( (L"firstPage") == sValue ) this->m_eValue = pageborderdisplayFirstPage; - else if ( (L"notFirstPage") == sValue ) this->m_eValue = pageborderdisplayNotFirstPage; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pageborderdisplayAllPages : return (L"allPages"); - case pageborderdisplayFirstPage : return (L"firstPage"); - case pageborderdisplayNotFirstPage : return (L"notFirstPage"); - default : return (L"allPages"); - } - } - - SimpleType_FromString (EPageBorderDisplay) - SimpleType_Operator_Equal (CPageBorderDisplay) - }; - - - + DEFINE_SIMPLE_TYPE(CPageBorderDisplay, EPageBorderDisplay, pageborderdisplayAllPages) //-------------------------------------------------------------------------------- // PageBorderOffset 17.18.63 (Part1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EPageBorderOffset { @@ -4301,41 +1322,11 @@ namespace SimpleTypes pageborderoffsetText = 1 }; - template - class CPageBorderOffset : public CSimpleType - { - public: - CPageBorderOffset() {} - - virtual EPageBorderOffset FromString(std::wstring &sValue) - { - if ( (L"page") == sValue ) this->m_eValue = pageborderoffsetPage; - else if ( (L"text") == sValue ) this->m_eValue = pageborderoffsetText; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pageborderoffsetPage : return (L"page"); - case pageborderoffsetText : return (L"text"); - default : return (L"page"); - } - } - - SimpleType_FromString (EPageBorderOffset) - SimpleType_Operator_Equal (CPageBorderOffset) - }; - - - + DEFINE_SIMPLE_TYPE(CPageBorderOffset, EPageBorderOffset, pageborderoffsetPage) //-------------------------------------------------------------------------------- // PageBorderZOrder 17.18.64 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EPageBorderZOrder { @@ -4343,39 +1334,11 @@ namespace SimpleTypes pageborderzorderFront = 1 }; - template - class CPageBorderZOrder : public CSimpleType - { - public: - CPageBorderZOrder() {} - - virtual EPageBorderZOrder FromString(std::wstring &sValue) - { - if ( (L"back") == sValue ) this->m_eValue = pageborderzorderBack; - else if ( (L"front") == sValue ) this->m_eValue = pageborderzorderFront; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pageborderzorderBack : return (L"back"); - case pageborderzorderFront : return (L"front"); - default : return (L"back"); - } - } - - SimpleType_FromString (EPageBorderZOrder) - SimpleType_Operator_Equal (CPageBorderZOrder) - }; - + DEFINE_SIMPLE_TYPE(CPageBorderZOrder, EPageBorderZOrder, pageborderzorderBack) //-------------------------------------------------------------------------------- // PageOrientation 17.18.65 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EPageOrientation { @@ -4383,39 +1346,11 @@ namespace SimpleTypes pageorientPortrait = 1 }; - template - class CPageOrientation : public CSimpleType - { - public: - CPageOrientation() {} - CPageOrientation(const EPageOrientation & val) { this->m_eValue = val; } - virtual EPageOrientation FromString(std::wstring &sValue) - { - if ( (L"landscape") == sValue ) this->m_eValue = pageorientLandscape; - else if ( (L"portrait") == sValue ) this->m_eValue = pageorientPortrait; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pageorientLandscape : return (L"landscape"); - case pageorientPortrait : return (L"portrait"); - default : return (L"portrait"); - } - } - - SimpleType_FromString (EPageOrientation) - SimpleType_Operator_Equal (CPageOrientation) - }; - + DEFINE_SIMPLE_TYPE(CPageOrientation, EPageOrientation, pageorientPortrait) //-------------------------------------------------------------------------------- // Pitch 17.18.66 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EPitch { @@ -4424,122 +1359,31 @@ namespace SimpleTypes pitchVariable = 2 }; - template - class CPitch : public CSimpleType - { - public: - CPitch() {} - - virtual EPitch FromString(std::wstring &sValue) - { - if ( (L"default") == sValue ) this->m_eValue = pitchDefault; - else if ( (L"fixed") == sValue ) this->m_eValue = pitchFixed; - else if ( (L"variable") == sValue ) this->m_eValue = pitchVariable; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pitchDefault : return (L"default"); - case pitchFixed : return (L"fixed"); - case pitchVariable : return (L"variable"); - default : return (L"default"); - } - } - - - SimpleType_FromString (EPitch) - SimpleType_Operator_Equal (CPitch) - }; - - + DEFINE_SIMPLE_TYPE(CPitch, EPitch, pitchDefault) //-------------------------------------------------------------------------------- // PixelsMeasure 17.18.67 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - template - class CPixelsMeasure : public CSimpleType - { - public: - CPixelsMeasure() {} - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CPixelsMeasure) - }; + DEFINE_SIMPLE_TYPE(CPixelsMeasure, int, 0) //-------------------------------------------------------------------------------- // PointMeasure 17.18.68 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - template - class CPointMeasure : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CPointMeasure, int, 0) public: - CPointMeasure() {} - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CPointMeasure) - double ToPoints() const - { - return (double)this->m_eValue; - } - double ToMM() const - { - return (double)Pt_To_Mm(this->m_eValue); - } - double ToInches() const - { - return this->m_eValue / 72.0; - } - - void FromPoints(double dValue) - { - this->m_eValue = dValue; - } - - void FromInches(double dValue) - { - this->m_eValue = dValue * 72.0; - } + double ToPoints() const; + double ToMM() const; + double ToInches() const; + void FromPoints(double dValue); + void FromInches(double dValue); }; //-------------------------------------------------------------------------------- // Proof 17.18.69 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EProof { @@ -4547,39 +1391,11 @@ namespace SimpleTypes proofDirty = 1 }; - template - class CProof : public CSimpleType - { - public: - CProof() {} - - virtual EProof FromString(std::wstring &sValue) - { - if ( (L"clean") == sValue ) this->m_eValue = proofClean; - else if ( (L"dirty") == sValue ) this->m_eValue = proofDirty; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case proofClean : return (L"clean"); - case proofDirty : return (L"dirty"); - default : return (L"dirty"); - } - } - - SimpleType_FromString (EProof) - SimpleType_Operator_Equal (CProof) - }; - + DEFINE_SIMPLE_TYPE(CProof, EProof, proofDirty) //-------------------------------------------------------------------------------- // ProofErr 17.18.70 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EProofErr { @@ -4589,44 +1405,11 @@ namespace SimpleTypes prooferrSpellStart = 3 }; - template - class CProofErr : public CSimpleType - { - public: - CProofErr() {} - - virtual EProofErr FromString(std::wstring &sValue) - { - if ( (L"gramEnd") == sValue ) this->m_eValue = prooferrGramEnd; - else if ( (L"gramStart") == sValue ) this->m_eValue = prooferrGramStart; - else if ( (L"spellEnd") == sValue ) this->m_eValue = prooferrSpellEnd; - else if ( (L"spellStart") == sValue ) this->m_eValue = prooferrSpellStart; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case prooferrGramEnd : return (L"gramEnd"); - case prooferrGramStart : return (L"gramStart"); - case prooferrSpellEnd : return (L"spellEnd"); - case prooferrSpellStart : return (L"spellStart"); - default : return (L"spellStart"); - } - } - - SimpleType_FromString (EProofErr) - SimpleType_Operator_Equal (CProofErr) - }; - - + DEFINE_SIMPLE_TYPE(CProofErr, EProofErr, prooferrSpellStart) //-------------------------------------------------------------------------------- // PTabAlignment 17.18.71 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EPTabAlignment { @@ -4635,40 +1418,11 @@ namespace SimpleTypes ptabalignmentRight = 2 }; - template - class CPTabAlignment : public CSimpleType - { - public: - CPTabAlignment() {} - - virtual EPTabAlignment FromString(std::wstring &sValue) - { - if ( (L"center") == sValue ) this->m_eValue = ptabalignmentCenter; - else if ( (L"left") == sValue ) this->m_eValue = ptabalignmentLeft; - else if ( (L"right") == sValue ) this->m_eValue = ptabalignmentRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case ptabalignmentCenter : return (L"center"); - case ptabalignmentLeft : return (L"left"); - case ptabalignmentRight : return (L"right"); - default : return (L"left"); - } - } - - SimpleType_FromString (EPTabAlignment) - SimpleType_Operator_Equal (CPTabAlignment) - }; + DEFINE_SIMPLE_TYPE(CPTabAlignment, EPTabAlignment, ptabalignmentLeft) //-------------------------------------------------------------------------------- // PTabLeader 17.18.72 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EPTabLeader { @@ -4679,43 +1433,11 @@ namespace SimpleTypes ptableaderUnderscore = 4 }; - template - class CPTabLeader : public CSimpleType - { - public: - CPTabLeader() {} + DEFINE_SIMPLE_TYPE(CPTabLeader, EPTabLeader, ptableaderNone) - virtual EPTabLeader FromString(std::wstring &sValue) - { - if ( (L"dot") == sValue ) this->m_eValue = ptableaderDot; - else if ( (L"hyphen") == sValue ) this->m_eValue = ptableaderHyphen; - else if ( (L"middleDot") == sValue ) this->m_eValue = ptableaderMiddleDot; - else if ( (L"none") == sValue ) this->m_eValue = ptableaderNone; - else if ( (L"underscore") == sValue ) this->m_eValue = ptableaderUnderscore; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case ptableaderDot : return (L"dot"); - case ptableaderHyphen : return (L"hyphen"); - case ptableaderMiddleDot : return (L"middleDot"); - case ptableaderNone : return (L"none"); - case ptableaderUnderscore : return (L"underscore"); - default : return (L"none"); - } - } - - SimpleType_FromString (EPTabLeader) - SimpleType_Operator_Equal (CPTabLeader) - }; //-------------------------------------------------------------------------------- // PTabRelativeTo 17.18.73 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EPTabRelativeTo { @@ -4723,39 +1445,11 @@ namespace SimpleTypes ptabrelativetoMargin = 1 }; - template - class CPTabRelativeTo : public CSimpleType - { - public: - CPTabRelativeTo() {} - - virtual EPTabRelativeTo FromString(std::wstring &sValue) - { - if ( (L"indent") == sValue ) this->m_eValue = ptabrelativetoIndent; - else if ( (L"margin") == sValue ) this->m_eValue = ptabrelativetoMargin; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case ptabrelativetoIndent : return (L"indent"); - case ptabrelativetoMargin : return (L"margin"); - default : return (L"indent"); - } - } - - SimpleType_FromString (EPTabRelativeTo) - SimpleType_Operator_Equal (CPTabRelativeTo) - }; - + DEFINE_SIMPLE_TYPE(CPTabRelativeTo, EPTabRelativeTo, ptabrelativetoIndent) //-------------------------------------------------------------------------------- // RestartNumber 17.18.74 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ERestartNumber { @@ -4764,40 +1458,11 @@ namespace SimpleTypes restartnumberEachPage = 2 }; - template - class CRestartNumber : public CSimpleType - { - public: - CRestartNumber() {} - - virtual ERestartNumber FromString(std::wstring &sValue) - { - if ( (L"continuous") == sValue ) this->m_eValue = restartnumberContinious; - else if ( (L"eachPage") == sValue ) this->m_eValue = restartnumberEachPage; - else if ( (L"eachSect") == sValue ) this->m_eValue = restartnumberEachSect; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case restartnumberContinious : return (L"continuous"); - case restartnumberEachPage : return (L"eachPage"); - case restartnumberEachSect : return (L"eachSect"); - default : return (L"continuous"); - } - } - - SimpleType_FromString (ERestartNumber) - SimpleType_Operator_Equal (CRestartNumber) - }; + DEFINE_SIMPLE_TYPE(CRestartNumber, ERestartNumber, restartnumberContinious) //-------------------------------------------------------------------------------- // RubyAlign 17.18.75 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ERubyAlign { @@ -4809,46 +1474,11 @@ namespace SimpleTypes erubyalignRightVertical = 5 }; - template - class CRubyAlign : public CSimpleType - { - public: - CRubyAlign() {} - - virtual ERubyAlign FromString(std::wstring &sValue) - { - if ( (L"center") == sValue ) this->m_eValue = erubyalignCenter; - else if ( (L"distributeLetter") == sValue ) this->m_eValue = erubyalignDistributeLetter; - else if ( (L"distributeSpace") == sValue ) this->m_eValue = erubyalignDistributeSpace; - else if ( (L"left") == sValue ) this->m_eValue = erubyalignLeft; - else if ( (L"right") == sValue ) this->m_eValue = erubyalignRight; - else if ( (L"rightVertical") == sValue ) this->m_eValue = erubyalignRightVertical; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case erubyalignCenter : return (L"center"); - case erubyalignDistributeLetter : return (L"distributeLetter"); - case erubyalignDistributeSpace : return (L"distributeSpace"); - case erubyalignLeft : return (L"left"); - case erubyalignRight : return (L"right"); - case erubyalignRightVertical : return (L"rightVertical"); - default : return (L"left"); - } - } - - SimpleType_FromString (ERubyAlign) - SimpleType_Operator_Equal (CRubyAlign) - }; + DEFINE_SIMPLE_TYPE(CRubyAlign, ERubyAlign, erubyalignLeft) //-------------------------------------------------------------------------------- // SdtDateMappingType 17.18.76 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ESdtDateMappingType { @@ -4857,40 +1487,11 @@ namespace SimpleTypes sdtdatemappingtypeText = 2 }; - template - class CSdtDateMappingType : public CSimpleType - { - public: - CSdtDateMappingType() {} - - virtual ESdtDateMappingType FromString(std::wstring &sValue) - { - if ( (L"date") == sValue ) this->m_eValue = sdtdatemappingtypeDate; - else if ( (L"dateTime") == sValue ) this->m_eValue = sdtdatemappingtypeDateTime; - else if ( (L"text") == sValue ) this->m_eValue = sdtdatemappingtypeText; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case sdtdatemappingtypeDate : return (L"date"); - case sdtdatemappingtypeDateTime : return (L"dateTime"); - case sdtdatemappingtypeText : return (L"text"); - default : return (L"text"); - } - } - - SimpleType_FromString (ESdtDateMappingType) - SimpleType_Operator_Equal (CSdtDateMappingType) - }; + DEFINE_SIMPLE_TYPE(CSdtDateMappingType, ESdtDateMappingType, sdtdatemappingtypeText) //-------------------------------------------------------------------------------- // SectionMark 17.18.77 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ESectionMark { @@ -4901,44 +1502,11 @@ namespace SimpleTypes sectionmarkOddPage = 4 }; - template - class CSectionMark : public CSimpleType - { - public: - CSectionMark() {} - - virtual ESectionMark FromString(std::wstring &sValue) - { - if ( (L"continuous") == sValue ) this->m_eValue = sectionmarkContinious; - else if ( (L"evenPage") == sValue ) this->m_eValue = sectionmarkEvenPage; - else if ( (L"nextColumn") == sValue ) this->m_eValue = sectionmarkNextColumn; - else if ( (L"nextPage") == sValue ) this->m_eValue = sectionmarkNextPage; - else if ( (L"oddPage") == sValue ) this->m_eValue = sectionmarkOddPage; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case sectionmarkContinious : return (L"continuous"); - case sectionmarkEvenPage : return (L"evenPage"); - case sectionmarkNextColumn : return (L"nextColumn"); - case sectionmarkNextPage : return (L"nextPage"); - case sectionmarkOddPage : return (L"oddPage"); - default : return (L"nextPage"); - } - } - - SimpleType_FromString (ESectionMark) - SimpleType_Operator_Equal (CSectionMark) - }; + DEFINE_SIMPLE_TYPE(CSectionMark, ESectionMark, sectionmarkNextPage) //-------------------------------------------------------------------------------- // Shd 17.18.78 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EShd { @@ -4982,251 +1550,52 @@ namespace SimpleTypes shdVertStripe = 37 }; - template - class CShd : public CSimpleType - { - public: - CShd() {} + DEFINE_SIMPLE_TYPE(CShd, EShd, shdSolid) - virtual EShd FromString(std::wstring &sValue) - { - if ( (L"clear") == sValue ) this->m_eValue = shdClear; - else if ( (L"diagCross") == sValue ) this->m_eValue = shdDiagCross; - else if ( (L"diagStripe") == sValue ) this->m_eValue = shdDiagStripe; - else if ( (L"horzCross") == sValue ) this->m_eValue = shdHorzCross; - else if ( (L"horzStripe") == sValue ) this->m_eValue = shdHorzStripe; - else if ( (L"nil") == sValue ) this->m_eValue = shdNil; - else if ( (L"pct10") == sValue ) this->m_eValue = shdPct10; - else if ( (L"pct12") == sValue ) this->m_eValue = shdPct12; - else if ( (L"pct15") == sValue ) this->m_eValue = shdPct15; - else if ( (L"pct20") == sValue ) this->m_eValue = shdPct20; - else if ( (L"pct25") == sValue ) this->m_eValue = shdPct25; - else if ( (L"pct30") == sValue ) this->m_eValue = shdPct30; - else if ( (L"pct35") == sValue ) this->m_eValue = shdPct35; - else if ( (L"pct37") == sValue ) this->m_eValue = shdPct37; - else if ( (L"pct40") == sValue ) this->m_eValue = shdPct40; - else if ( (L"pct45") == sValue ) this->m_eValue = shdPct45; - else if ( (L"pct5") == sValue ) this->m_eValue = shdPct5; - else if ( (L"pct50") == sValue ) this->m_eValue = shdPct50; - else if ( (L"pct55") == sValue ) this->m_eValue = shdPct55; - else if ( (L"pct60") == sValue ) this->m_eValue = shdPct60; - else if ( (L"pct62") == sValue ) this->m_eValue = shdPct62; - else if ( (L"pct65") == sValue ) this->m_eValue = shdPct65; - else if ( (L"pct70") == sValue ) this->m_eValue = shdPct70; - else if ( (L"pct75") == sValue ) this->m_eValue = shdPct75; - else if ( (L"pct80") == sValue ) this->m_eValue = shdPct80; - else if ( (L"pct85") == sValue ) this->m_eValue = shdPct85; - else if ( (L"pct87") == sValue ) this->m_eValue = shdPct87; - else if ( (L"pct90") == sValue ) this->m_eValue = shdPct90; - else if ( (L"pct95") == sValue ) this->m_eValue = shdPct95; - else if ( (L"reverseDiagStripe") == sValue ) this->m_eValue = shdReverseDiagStripe; - else if ( (L"solid") == sValue ) this->m_eValue = shdSolid; - else if ( (L"thinDiagCross") == sValue ) this->m_eValue = shdThinDiagCross; - else if ( (L"thinDiagStripe") == sValue ) this->m_eValue = shdThinDiagStripe; - else if ( (L"thinHorzCross") == sValue ) this->m_eValue = shdThinHorzCross; - else if ( (L"thinHorzStripe") == sValue ) this->m_eValue = shdThinHorzStripe; - else if ( (L"thinReverseDiagStripe") == sValue ) this->m_eValue = shdThinReverseDiagStripe; - else if ( (L"thinVertStripe") == sValue ) this->m_eValue = shdThinVertStripe; - else if ( (L"vertStripe") == sValue ) this->m_eValue = shdVertStripe; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case shdClear : return (L"clear"); - case shdDiagCross : return (L"diagCross"); - case shdDiagStripe : return (L"diagStripe"); - case shdHorzCross : return (L"horzCross"); - case shdHorzStripe : return (L"horzStripe"); - case shdNil : return (L"nil"); - case shdPct10 : return (L"pct10"); - case shdPct12 : return (L"pct12"); - case shdPct15 : return (L"pct15"); - case shdPct20 : return (L"pct20"); - case shdPct25 : return (L"pct25"); - case shdPct30 : return (L"pct30"); - case shdPct35 : return (L"pct35"); - case shdPct37 : return (L"pct37"); - case shdPct40 : return (L"pct40"); - case shdPct45 : return (L"pct45"); - case shdPct5 : return (L"pct5"); - case shdPct50 : return (L"pct50"); - case shdPct55 : return (L"pct55"); - case shdPct60 : return (L"pct60"); - case shdPct62 : return (L"pct62"); - case shdPct65 : return (L"pct65"); - case shdPct70 : return (L"pct70"); - case shdPct75 : return (L"pct75"); - case shdPct80 : return (L"pct80"); - case shdPct85 : return (L"pct85"); - case shdPct87 : return (L"pct87"); - case shdPct90 : return (L"pct90"); - case shdPct95 : return (L"pct95"); - case shdReverseDiagStripe : return (L"reverseDiagStripe"); - case shdSolid : return (L"solid"); - case shdThinDiagCross : return (L"thinDiagCross"); - case shdThinDiagStripe : return (L"thinDiagStripe"); - case shdThinHorzCross : return (L"thinHorzCross"); - case shdThinHorzStripe : return (L"thinHorzStripe"); - case shdThinReverseDiagStripe : return (L"thinReverseDiagStripe"); - case shdThinVertStripe : return (L"thinVertStripe"); - case shdVertStripe : return (L"vertStripe"); - default : return (L"solid"); - } - } - - SimpleType_FromString (EShd) - SimpleType_Operator_Equal (CShd) - }; //-------------------------------------------------------------------------------- // ShortHexNumber 17.18.79 (Part 1) - //-------------------------------------------------------------------------------- - template - class CShortHexNumber : public CSimpleType - { - public: - CShortHexNumber() {} + //-------------------------------------------------------------------------------- - virtual int FromString(std::wstring &sValue) - { - if ( !Parse(sValue) ) - { - this->m_eValue = nDefValue; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return XmlUtils::IntToString( this->m_eValue, L"%04X"); - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CShortHexNumber) + DEFINE_SIMPLE_TYPE_START(CShortHexNumber, int, 0) private: - - bool Parse(std::wstring &sValue) - { - size_t nLength = sValue.length(); - - bool bResult = true; - if(nLength > 0) - { - this->m_eValue = HexToInt( (int)sValue[nLength - 1], bResult ); - if(nLength > 1) - { - this->m_eValue += HexToInt( (int)sValue[nLength - 2], bResult ) << 4; - if(nLength > 2) - { - this->m_eValue += HexToInt( (int)sValue[nLength - 3], bResult ) << 8; - if(nLength > 3) - { - this->m_eValue += HexToInt( (int)sValue[nLength - 4], bResult ) << 12; - } - } - } - } - else - bResult = false; - - return bResult; - } - - int HexToInt(int nHex, bool &bResult) - { - if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); - if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); - if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); - - bResult = false; - - return 0; - } - + bool Parse(const std::wstring &sValue); + int HexToInt(int nHex, bool &bResult); }; //-------------------------------------------------------------------------------- // SignedHpsMeasure 17.18.80 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CSignedHpsMeasure : public CUniversalMeasure { public: - CSignedHpsMeasure() {} + CSignedHpsMeasure(); - virtual double FromString(std::wstring &sValue) - { - Parse(sValue, 2); + virtual double FromString(const std::wstring &sValue); + virtual void SetValue(double dValue); + virtual std::wstring ToString () const; - return m_dValue; - } - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = dValue; - } - virtual std::wstring ToString () const - { - std::wstring sResult; - - if (m_bUnit) - sResult = boost::lexical_cast(m_dValue) + L"pt"; - else - sResult = std::to_wstring((int)(m_dValue * 2)); - - return sResult; - } - - SimpleType_FromString (double) - SimpleType_Operator_Equal (CSignedHpsMeasure) - UniversalMeasure_AdditionalOpearators(CSignedHpsMeasure) + SimpleTypes_DefaultD(CSignedHpsMeasure) }; //-------------------------------------------------------------------------------- // SignedTwipsMeasure 17.18.81 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- class CSignedTwipsMeasure : public CUniversalMeasure { public: - CSignedTwipsMeasure() {} - virtual void SetValue(double dValue) - { - m_bUnit = false; - m_dValue = FromTwips(dValue); - } - virtual double FromString(std::wstring &sValue) - { - Parse(sValue, 20); + CSignedTwipsMeasure(); + virtual void SetValue(double dValue); + virtual double FromString(const std::wstring &sValue); + virtual std::wstring ToString () const; - return m_dValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - - if ( m_bUnit ) - sResult = boost::lexical_cast( m_dValue ) + L"pt"; - else - sResult = std::to_wstring( (int)(m_dValue * 20) ); - - return sResult; - } - SimpleType_FromString (double) - SimpleType_Operator_Equal (CSignedTwipsMeasure) - UniversalMeasure_AdditionalOpearators(CSignedTwipsMeasure) + SimpleTypes_DefaultD(CSignedTwipsMeasure) }; - //-------------------------------------------------------------------------------- // StyleSort 17.18.82 (Part 1) + 9.10.4 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EStyleSort { @@ -5238,73 +1607,16 @@ namespace SimpleTypes stylesortType = 5 }; - template - class CStyleSort : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CStyleSort, EStyleSort, stylesortName) public: - CStyleSort() - { - m_bNames = false; - } - - virtual EStyleSort FromString(std::wstring &sValue) - { - m_bNames = false; - if ( (L"basedOn") == sValue || (L"0004") == sValue ) this->m_eValue = stylesortBasedOn; - else if ( (L"default") == sValue || (L"0002") == sValue ) this->m_eValue = stylesortDefault; - else if ( (L"font") == sValue || (L"0003") == sValue ) this->m_eValue = stylesortFont; - else if ( (L"name") == sValue || (L"0000") == sValue ) this->m_eValue = stylesortName; - else if ( (L"priority") == sValue || (L"0001") == sValue ) this->m_eValue = stylesortPriority; - else if ( (L"type") == sValue || (L"0005") == sValue ) this->m_eValue = stylesortType; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - if ( m_bNames ) - { - switch(this->m_eValue) - { - case stylesortBasedOn : return (L"basedOn"); - case stylesortDefault : return (L"default"); - case stylesortFont : return (L"font"); - case stylesortName : return (L"name"); - case stylesortPriority : return (L"priority"); - case stylesortType : return (L"type"); - default : return (L"default"); - } - } - else - { - switch(this->m_eValue) - { - case stylesortBasedOn : return (L"0004"); - case stylesortDefault : return (L"0002"); - case stylesortFont : return (L"0003"); - case stylesortName : return (L"0000"); - case stylesortPriority : return (L"0001"); - case stylesortType : return (L"0005"); - default : return (L"0000"); - } - } - } - SimpleType_FromString (EStyleSort) - SimpleType_Operator_Equal (CStyleSort) - - void WriteNames(bool bNames) - { - m_bNames = bNames; - } - + void WriteNames(bool bNames); private: - bool m_bNames; }; + //-------------------------------------------------------------------------------- // StyleType 17.18.83 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EStyleType { @@ -5314,45 +1626,11 @@ namespace SimpleTypes styletypeTable = 3 }; - template - class CStyleType : public CSimpleType - { - public: - CStyleType() {} - - virtual EStyleType FromString(std::wstring &sValue) - { - if ( (L"character") == sValue ) this->m_eValue = styletypeCharacter; - else if ( (L"numbering") == sValue ) this->m_eValue = styletypeNumbering; - else if ( (L"paragraph") == sValue ) this->m_eValue = styletypeParagraph; - else if ( (L"table") == sValue ) this->m_eValue = styletypeTable; - else if ( (L"list") == sValue) this->m_eValue = styletypeNumbering; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case styletypeCharacter : return (L"character"); - case styletypeNumbering : return (L"numbering"); - case styletypeParagraph : return (L"paragraph"); - case styletypeTable : return (L"table"); - default : return (L"paragraph"); - } - } - - SimpleType_FromString (EStyleType) - SimpleType_Operator_Equal (CStyleType) - }; - - + DEFINE_SIMPLE_TYPE(CStyleType, EStyleType, styletypeParagraph) //-------------------------------------------------------------------------------- // TabJc 17.18.84 (Part 1) + 9.10.5 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETabJc { @@ -5367,58 +1645,11 @@ namespace SimpleTypes tabjcLeft = 8 }; - template - class CTabJc : public CSimpleType - { - public: - CTabJc() {} - - virtual ETabJc FromString(std::wstring &sValue) - { - if ( (L"bar") == sValue ) this->m_eValue = tabjcBar; - else if ( (L"center") == sValue ) this->m_eValue = tabjcCenter; - else if ( (L"clear") == sValue ) this->m_eValue = tabjcClear; - else if ( (L"decimal") == sValue ) this->m_eValue = tabjcDecimal; - else if ( (L"end") == sValue ) this->m_eValue = tabjcEnd; - else if ( (L"num") == sValue ) this->m_eValue = tabjcNum; - else if ( (L"start") == sValue ) this->m_eValue = tabjcStart; - else if ( (L"right") == sValue ) this->m_eValue = tabjcRight; - else if ( (L"left") == sValue ) this->m_eValue = tabjcLeft; - else this->m_eValue = tabjcClear; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case tabjcBar : return (L"bar"); - case tabjcCenter : return (L"center"); - case tabjcClear : return (L"clear"); - case tabjcDecimal : return (L"decimal"); - case tabjcEnd : return (L"end"); - case tabjcNum : return (L"num"); - case tabjcStart : return (L"start"); - case tabjcRight : return (L"right"); - case tabjcLeft : return (L"left"); - default : return (L"clear"); - } - } - - SimpleType_FromString (ETabJc) - SimpleType_Operator_Equal (CTabJc) - - ETabJc GetValue() const - { - return this->m_eValue; - } - }; - + DEFINE_SIMPLE_TYPE(CTabJc, ETabJc, tabjcLeft) //-------------------------------------------------------------------------------- // TabTlc 17.18.85 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETabTlc { @@ -5430,46 +1661,11 @@ namespace SimpleTypes tabtlcUnderscore = 5 }; - template - class CTabTlc : public CSimpleType - { - public: - CTabTlc() {} - - virtual ETabTlc FromString(std::wstring &sValue) - { - if ( (L"dot") == sValue ) this->m_eValue = tabtlcDot; - else if ( (L"heavy") == sValue ) this->m_eValue = tabtlcHeavy; - else if ( (L"hyphen") == sValue ) this->m_eValue = tabtlcHyphen; - else if ( (L"middleDot") == sValue ) this->m_eValue = tabtlcMiddleDot; - else if ( (L"none") == sValue ) this->m_eValue = tabtlcNone; - else if ( (L"underscore") == sValue ) this->m_eValue = tabtlcUnderscore; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case tabtlcDot : return (L"dot"); - case tabtlcHeavy : return (L"heavy"); - case tabtlcHyphen : return (L"hyphen"); - case tabtlcMiddleDot : return (L"middleDot"); - case tabtlcNone : return (L"none"); - case tabtlcUnderscore : return (L"underscore"); - default : return (L"none"); - } - } - - SimpleType_FromString (ETabTlc) - SimpleType_Operator_Equal (CTabTlc) - }; + DEFINE_SIMPLE_TYPE(CTabTlc, ETabTlc, tabtlcNone) //-------------------------------------------------------------------------------- // TargetScreenSz 17.18.86 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETargetScreenSz { @@ -5486,58 +1682,11 @@ namespace SimpleTypes targetscreensz800x600 = 11 }; - template - class CTargetScreenSz : public CSimpleType - { - public: - CTargetScreenSz() {} - - virtual ETargetScreenSz FromString(std::wstring &sValue) - { - if ( (L"1024x768") == sValue ) this->m_eValue = targetscreensz1024x768; - else if ( (L"1152x882") == sValue ) this->m_eValue = targetscreensz1152x882; - else if ( (L"1152x900") == sValue ) this->m_eValue = targetscreensz1152x900; - else if ( (L"1280x1024") == sValue ) this->m_eValue = targetscreensz1280x1024; - else if ( (L"1600x1200") == sValue ) this->m_eValue = targetscreensz1600x1200; - else if ( (L"1800x1440") == sValue ) this->m_eValue = targetscreensz1800x1440; - else if ( (L"1920x1200") == sValue ) this->m_eValue = targetscreensz1920x1200; - else if ( (L"544x376") == sValue ) this->m_eValue = targetscreensz544x376; - else if ( (L"640x480") == sValue ) this->m_eValue = targetscreensz640x480; - else if ( (L"720x512") == sValue ) this->m_eValue = targetscreensz720x512; - else if ( (L"800x600") == sValue ) this->m_eValue = targetscreensz800x600; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case targetscreensz1024x768 : return (L"1024x768"); - case targetscreensz1152x882 : return (L"1152x882"); - case targetscreensz1152x900 : return (L"1152x900"); - case targetscreensz1280x1024 : return (L"1280x1024"); - case targetscreensz1600x1200 : return (L"1600x1200"); - case targetscreensz1800x1440 : return (L"1800x1440"); - case targetscreensz1920x1200 : return (L"1920x1200"); - case targetscreensz544x376 : return (L"544x376"); - case targetscreensz640x480 : return (L"640x480"); - case targetscreensz720x512 : return (L"720x512"); - case targetscreensz800x600 : return (L"800x600"); - default : return (L"1280x1024"); - } - } - - SimpleType_FromString (ETargetScreenSz) - SimpleType_Operator_Equal (CTargetScreenSz) - }; - - + DEFINE_SIMPLE_TYPE(CTargetScreenSz, ETargetScreenSz, targetscreensz1280x1024) //-------------------------------------------------------------------------------- // TblLayoutType 17.18.87 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETblLayoutType { @@ -5545,38 +1694,11 @@ namespace SimpleTypes tbllayouttypeFixed = 2 }; - template - class CTblLayoutType : public CSimpleType - { - public: - CTblLayoutType() {} - - virtual ETblLayoutType FromString(std::wstring &sValue) - { - if ( (L"autofit") == sValue ) this->m_eValue = tbllayouttypeAutofit; - else if ( (L"fixed") == sValue ) this->m_eValue = tbllayouttypeFixed; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case tbllayouttypeAutofit : return (L"autofit"); - case tbllayouttypeFixed : return (L"fixed"); - default : return (L"autofit"); - } - } - - SimpleType_FromString (ETblLayoutType) - SimpleType_Operator_Equal (CTblLayoutType) - }; + DEFINE_SIMPLE_TYPE(CTblLayoutType, ETblLayoutType, tbllayouttypeAutofit) //-------------------------------------------------------------------------------- // TblOverlap 17.18.88 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETblOverlap { @@ -5584,38 +1706,11 @@ namespace SimpleTypes tbloverlapOverlap = 2 }; - template - class CTblOverlap : public CSimpleType - { - public: - CTblOverlap() {} - - virtual ETblOverlap FromString(std::wstring &sValue) - { - if ( (L"never") == sValue ) this->m_eValue = tbloverlapNever; - else if ( (L"overlap") == sValue ) this->m_eValue = tbloverlapOverlap; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case tbloverlapNever : return (L"never"); - case tbloverlapOverlap : return (L"overlap"); - default : return (L"overlap"); - } - } - - SimpleType_FromString (ETblOverlap) - SimpleType_Operator_Equal (CTblOverlap) - }; + DEFINE_SIMPLE_TYPE(CTblOverlap, ETblOverlap, tbloverlapOverlap) //-------------------------------------------------------------------------------- // TblStyleOverrideType 17.18.89 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETblStyleOverrideType { @@ -5634,63 +1729,11 @@ namespace SimpleTypes tblstyleoverridetypeWholeTable = 12 }; - template - class CTblStyleOverrideType : public CSimpleType - { - public: - CTblStyleOverrideType() {} - - virtual ETblStyleOverrideType FromString(std::wstring &sValue) - { - if ( (L"band1Horz") == sValue ) this->m_eValue = tblstyleoverridetypeBand1Horz; - else if ( (L"band1Vert") == sValue ) this->m_eValue = tblstyleoverridetypeBand1Vert; - else if ( (L"band2Horz") == sValue ) this->m_eValue = tblstyleoverridetypeBand2Horz; - else if ( (L"band2Vert") == sValue ) this->m_eValue = tblstyleoverridetypeBand2Vert; - else if ( (L"firstCol") == sValue ) this->m_eValue = tblstyleoverridetypeFirstCol; - else if ( (L"firstRow") == sValue ) this->m_eValue = tblstyleoverridetypeFirstRow; - else if ( (L"lastCol") == sValue ) this->m_eValue = tblstyleoverridetypeLastCol; - else if ( (L"lastRow") == sValue ) this->m_eValue = tblstyleoverridetypeLastRow; - else if ( (L"neCell") == sValue ) this->m_eValue = tblstyleoverridetypeNeCell; - else if ( (L"nwCell") == sValue ) this->m_eValue = tblstyleoverridetypeNwCell; - else if ( (L"seCell") == sValue ) this->m_eValue = tblstyleoverridetypeSeCell; - else if ( (L"swCell") == sValue ) this->m_eValue = tblstyleoverridetypeSwCell; - else if ( (L"wholeTable") == sValue ) this->m_eValue = tblstyleoverridetypeWholeTable; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case tblstyleoverridetypeBand1Horz : return (L"band1Horz"); - case tblstyleoverridetypeBand1Vert : return (L"band1Vert"); - case tblstyleoverridetypeBand2Horz : return (L"band2Horz"); - case tblstyleoverridetypeBand2Vert : return (L"band2Vert"); - case tblstyleoverridetypeFirstCol : return (L"firstCol"); - case tblstyleoverridetypeFirstRow : return (L"firstRow"); - case tblstyleoverridetypeLastCol : return (L"lastCol"); - case tblstyleoverridetypeLastRow : return (L"lastRow"); - case tblstyleoverridetypeNeCell : return (L"neCell"); - case tblstyleoverridetypeNwCell : return (L"nwCell"); - case tblstyleoverridetypeSeCell : return (L"seCell"); - case tblstyleoverridetypeSwCell : return (L"swCell"); - case tblstyleoverridetypeWholeTable : return (L"wholeTable"); - default : return (L"wholeTable"); - } - } - - SimpleType_FromString (ETblStyleOverrideType) - SimpleType_Operator_Equal (CTblStyleOverrideType) - }; - - - + DEFINE_SIMPLE_TYPE(CTblStyleOverrideType, ETblStyleOverrideType, tblstyleoverridetypeWholeTable) //-------------------------------------------------------------------------------- // TblWidth 17.18.90 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETblWidth { @@ -5700,43 +1743,11 @@ namespace SimpleTypes tblwidthPct = 3 }; - template - class CTblWidth : public CSimpleType - { - public: - CTblWidth() {} - - virtual ETblWidth FromString(std::wstring &sValue) - { - if ( (L"auto") == sValue ) this->m_eValue = tblwidthAuto; - else if ( (L"dxa") == sValue ) this->m_eValue = tblwidthDxa; - else if ( (L"nil") == sValue ) this->m_eValue = tblwidthNil; - else if ( (L"pct") == sValue ) this->m_eValue = tblwidthPct; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case tblwidthAuto : return (L"auto"); - case tblwidthDxa : return (L"dxa"); - case tblwidthNil : return (L"nil"); - case tblwidthPct : return (L"pct"); - default : return (L"auto"); - } - } - - SimpleType_FromString (ETblWidth) - SimpleType_Operator_Equal (CTblWidth) - }; - + DEFINE_SIMPLE_TYPE(CTblWidth, ETblWidth, tblwidthAuto) //-------------------------------------------------------------------------------- // TextAlignment 17.18.91 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETextAlignment { @@ -5747,44 +1758,11 @@ namespace SimpleTypes textalignTop = 4, }; - template - class CTextAlignment : public CSimpleType - { - public: - CTextAlignment() {} - - virtual ETextAlignment FromString(std::wstring &sValue) - { - if ( (L"auto") == sValue ) this->m_eValue = textalignAuto; - else if ( (L"baseline") == sValue ) this->m_eValue = textalignBaseLine; - else if ( (L"bottom") == sValue ) this->m_eValue = textalignBottom; - else if ( (L"center") == sValue ) this->m_eValue = textalignCenter; - else if ( (L"top") == sValue ) this->m_eValue = textalignTop; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textalignAuto : return (L"auto"); - case textalignBaseLine : return (L"baseline"); - case textalignBottom : return (L"bottom"); - case textalignCenter : return (L"center"); - case textalignTop : return (L"top"); - default : return (L"auto"); - } - } - - SimpleType_FromString (ETextAlignment) - SimpleType_Operator_Equal (CTextAlignment) - }; + DEFINE_SIMPLE_TYPE(CTextAlignment, ETextAlignment, textalignAuto) //-------------------------------------------------------------------------------- // TextboxTightWrap 17.18.92 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETextboxTightWrap { @@ -5795,43 +1773,11 @@ namespace SimpleTypes textboxtightwrapNone = 4 }; - template - class CTextboxTightWrap : public CSimpleType - { - public: - CTextboxTightWrap() {} + DEFINE_SIMPLE_TYPE(CTextboxTightWrap, ETextboxTightWrap, textboxtightwrapNone) - virtual ETextboxTightWrap FromString(std::wstring &sValue) - { - if ( (L"allLines") == sValue ) this->m_eValue = textboxtightwrapAllLines; - else if ( (L"firstAndLastLine") == sValue ) this->m_eValue = textboxtightwrapFirstAndLastLine; - else if ( (L"firstLineOnly") == sValue ) this->m_eValue = textboxtightwrapFirstLineOnly; - else if ( (L"lastLineOnly") == sValue ) this->m_eValue = textboxtightwrapLastLineOnly; - else if ( (L"none") == sValue ) this->m_eValue = textboxtightwrapNone; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textboxtightwrapAllLines : return (L"allLines"); - case textboxtightwrapFirstAndLastLine : return (L"firstAndLastLine"); - case textboxtightwrapFirstLineOnly : return (L"firstLineOnly"); - case textboxtightwrapLastLineOnly : return (L"lastLineOnly"); - case textboxtightwrapNone : return (L"none"); - default : return (L"none"); - } - } - - SimpleType_FromString (ETextboxTightWrap) - SimpleType_Operator_Equal (CTextboxTightWrap) - }; //-------------------------------------------------------------------------------- // TextDirection 17.18.93 (Part 1) + 9.10.6 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETextDirection { @@ -5843,54 +1789,11 @@ namespace SimpleTypes textdirectionLrV = 5 }; - template - class CTextDirection : public CSimpleType - { - public: - CTextDirection() {} - - virtual ETextDirection FromString(std::wstring &sValue) - { - if ( (L"lr") == sValue || (L"btLr") == sValue || (L"bt-lr") == sValue) - this->m_eValue = textdirectionLr; - else if ( (L"lrV") == sValue || (L"tbLrV") == sValue ) - this->m_eValue = textdirectionLrV; - else if ( (L"rl") == sValue || (L"tbRl") == sValue || (L"tb-rl") == sValue) - this->m_eValue = textdirectionRl; - else if ( (L"rlV") == sValue || (L"tbRlV") == sValue || (L"tb-rl-v") == sValue) - this->m_eValue = textdirectionRlV; - else if ( (L"tb") == sValue || (L"lrTb") == sValue) - this->m_eValue = textdirectionTb; - else if ( (L"tbV") == sValue || (L"lrTbV") == sValue || (L"lr-tb-v") == sValue) - this->m_eValue = textdirectionTbV; - //tb-rl - else - this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case textdirectionLr : return (L"btLr"); - case textdirectionLrV : return (L"tbLrV"); - case textdirectionRl : return (L"tbRl"); - case textdirectionRlV : return (L"tbRlV"); - case textdirectionTb : return (L"lrTb"); - case textdirectionTbV : return (L"lrTbV"); - default : return (L"lrTb"); - } - } - - SimpleType_FromString (ETextDirection) - SimpleType_Operator_Equal (CTextDirection) - }; + DEFINE_SIMPLE_TYPE(CTextDirection, ETextDirection, textdirectionTb) //-------------------------------------------------------------------------------- // TextEffect 17.18.94 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETextEffect { @@ -5903,84 +1806,17 @@ namespace SimpleTypes texteffectSparkle = 6 }; - template - class CTextEffect : public CSimpleType - { - public: - CTextEffect() {} - - virtual ETextEffect FromString(std::wstring &sValue) - { - if ( (L"antsBlack") == sValue ) this->m_eValue = texteffectAntsBlack; - else if ( (L"antsRed") == sValue ) this->m_eValue = texteffectAntsRed; - else if ( (L"blinkBackground") == sValue ) this->m_eValue = texteffectBlinkBackground; - else if ( (L"lights") == sValue ) this->m_eValue = texteffectLights; - else if ( (L"none") == sValue ) this->m_eValue = texteffectNone; - else if ( (L"shimmer") == sValue ) this->m_eValue = texteffectShimmer; - else if ( (L"sparkle") == sValue ) this->m_eValue = texteffectSparkle; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case texteffectAntsBlack : return (L"antsBlack"); - case texteffectAntsRed : return (L"antsRed"); - case texteffectBlinkBackground : return (L"blinkBackground"); - case texteffectLights : return (L"lights"); - case texteffectNone : return (L"none"); - case texteffectShimmer : return (L"shimmer"); - case texteffectSparkle : return (L"sparkle"); - default : return (L"none"); - } - } - - SimpleType_FromString (ETextEffect) - SimpleType_Operator_Equal (CTextEffect) - }; - + DEFINE_SIMPLE_TYPE(CTextEffect, ETextEffect, texteffectNone) //-------------------------------------------------------------------------------- // TextScale 17.18.95 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - template - class CTextScale : public CSimpleType - { - public: - CTextScale() {} - - virtual void SetValue(int nValue) - { - this->m_eValue = (std::min)( 600, (std::max)( 0, nValue ) ); - } - - virtual int FromString(std::wstring &sValue) - { - this->m_eValue = _wtoi( sValue.c_str() ); - - this->m_eValue = (std::min)( 600, (std::max)( 0, this->m_eValue ) ); - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult = std::to_wstring( this->m_eValue); - - return sResult; - } - - SimpleType_FromString (int) - SimpleType_Operator_Equal (CTextScale) - }; + DEFINE_SIMPLE_TYPE_NSV(CTextScale, int, 100) //-------------------------------------------------------------------------------- // Theme 17.18.96 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum ETheme { @@ -5994,50 +1830,11 @@ namespace SimpleTypes themeMinorHAnsi = 7 }; - template - class CTheme : public CSimpleType - { - public: - CTheme() {} - - virtual ETheme FromString(std::wstring &sValue) - { - if ( (L"majorAscii") == sValue ) this->m_eValue = themeMajorAscii; - else if ( (L"majorBidi") == sValue ) this->m_eValue = themeMajorBidi; - else if ( (L"majorEastAsia") == sValue ) this->m_eValue = themeMajorEastAsia; - else if ( (L"majorHAnsi") == sValue ) this->m_eValue = themeMajorHAnsi; - else if ( (L"minorAscii") == sValue ) this->m_eValue = themeMinorAscii; - else if ( (L"minorBidi") == sValue ) this->m_eValue = themeMinorBidi; - else if ( (L"minorEastAsia") == sValue ) this->m_eValue = themeMinorEastAsia; - else if ( (L"minorHAnsi") == sValue ) this->m_eValue = themeMinorHAnsi; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case themeMajorAscii : return (L"majorAscii"); - case themeMajorBidi : return (L"majorBidi"); - case themeMajorEastAsia : return (L"majorEastAsia"); - case themeMajorHAnsi : return (L"majorHAnsi"); - case themeMinorAscii : return (L"minorAscii"); - case themeMinorBidi : return (L"minorBidi"); - case themeMinorEastAsia : return (L"minorEastAsia"); - case themeMinorHAnsi : return (L"minorHAnsi"); - default : return (L"majorAscii"); - } - } - - SimpleType_FromString (ETheme) - SimpleType_Operator_Equal (CTheme) - }; + DEFINE_SIMPLE_TYPE(CTheme, ETheme, themeMajorAscii) //-------------------------------------------------------------------------------- // ThemeColor 17.18.97 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EThemeColor { @@ -6060,125 +1857,21 @@ namespace SimpleTypes themecolorText2 = 16 }; - template - class CThemeColor : public CSimpleType - { - public: - CThemeColor() {} - - virtual EThemeColor FromString(std::wstring &sValue) - { - if ( (L"accent1") == sValue ) this->m_eValue = themecolorAccent1; - else if ( (L"accent2") == sValue ) this->m_eValue = themecolorAccent2; - else if ( (L"accent3") == sValue ) this->m_eValue = themecolorAccent3; - else if ( (L"accent4") == sValue ) this->m_eValue = themecolorAccent4; - else if ( (L"accent5") == sValue ) this->m_eValue = themecolorAccent5; - else if ( (L"accent6") == sValue ) this->m_eValue = themecolorAccent6; - else if ( (L"background1") == sValue ) this->m_eValue = themecolorBackground1; - else if ( (L"background2") == sValue ) this->m_eValue = themecolorBackground2; - else if ( (L"dark1") == sValue ) this->m_eValue = themecolorDark1; - else if ( (L"dark2") == sValue ) this->m_eValue = themecolorDark2; - else if ( (L"followedHyperlink") == sValue ) this->m_eValue = themecolorFollowedHyperlink; - else if ( (L"hyperlink") == sValue ) this->m_eValue = themecolorHyperlink; - else if ( (L"light1") == sValue ) this->m_eValue = themecolorLight1; - else if ( (L"light2") == sValue ) this->m_eValue = themecolorLight2; - else if ( (L"none") == sValue ) this->m_eValue = themecolorNone; - else if ( (L"text1") == sValue ) this->m_eValue = themecolorText1; - else if ( (L"text2") == sValue ) this->m_eValue = themecolorText2; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case themecolorAccent1 : return (L"accent1"); - case themecolorAccent2 : return (L"accent2"); - case themecolorAccent3 : return (L"accent3"); - case themecolorAccent4 : return (L"accent4"); - case themecolorAccent5 : return (L"accent5"); - case themecolorAccent6 : return (L"accent6"); - case themecolorBackground1 : return (L"background1"); - case themecolorBackground2 : return (L"background2"); - case themecolorDark1 : return (L"dark1"); - case themecolorDark2 : return (L"dark2"); - case themecolorFollowedHyperlink : return (L"followedHyperlink"); - case themecolorHyperlink : return (L"hyperlink"); - case themecolorLight1 : return (L"light1"); - case themecolorLight2 : return (L"light2"); - case themecolorNone : return (L"none"); - case themecolorText1 : return (L"text1"); - case themecolorText2 : return (L"text2"); - default : return (L"none"); - } - } - - SimpleType_FromString (EThemeColor) - SimpleType_Operator_Equal (CThemeColor) - }; - + DEFINE_SIMPLE_TYPE(CThemeColor, EThemeColor, themecolorNone) //-------------------------------------------------------------------------------- // UcharHexNumber 17.18.98 (Part 1) - //-------------------------------------------------------------------------------- - template - class CUcharHexNumber : public CSimpleType - { - public: - CUcharHexNumber() {} + //-------------------------------------------------------------------------------- - virtual unsigned char FromString(std::wstring &sValue) - { - if ( !Parse(sValue) ) - { - this->m_eValue = unDefValue; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return XmlUtils::IntToString(this->m_eValue, L"%02X"); - } - - SimpleType_FromString (unsigned char) - SimpleType_Operator_Equal (CUcharHexNumber) + DEFINE_SIMPLE_TYPE_START(CUcharHexNumber, unsigned char, 0) private: - - bool Parse(std::wstring &sValue) - { - if ( sValue.length() < 2 ) - return false; - - bool bResult = true; - - this->m_eValue = (unsigned char)HexToInt( (int)sValue[1], bResult ); - this->m_eValue += (unsigned char)HexToInt( (int)sValue[0], bResult ) << 4; - - return bResult; - } - - int HexToInt(int nHex, bool &bResult) - { - if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); - if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); - if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); - - bResult = false; - - return 0; - } - + bool Parse(const std::wstring &sValue); + int HexToInt(int nHex, bool &bResult); }; - - //-------------------------------------------------------------------------------- // Underline 17.18.99 (Part 1) 20.1.10.82 - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EUnderline { @@ -6202,73 +1895,11 @@ namespace SimpleTypes underlineWords = 17 }; - template - class CUnderline : public CSimpleType - { - public: - CUnderline() {} - - virtual EUnderline FromString(std::wstring &sValue) - { - if ( (L"dash") == sValue ) this->m_eValue = underlineDash; - else if ( (L"dashDotDotHeavy") == sValue ) this->m_eValue = underlineDashDotDotHeavy; - else if ( (L"dashDotHeavy") == sValue ) this->m_eValue = underlineDashDotHeavy; - else if ( (L"dashedHeavy") == sValue ) this->m_eValue = underlineDashedHeavy; - else if ( (L"dashLong") == sValue ) this->m_eValue = underlineDashLong; - else if ( (L"dashLongHeavy") == sValue ) this->m_eValue = underlineDashLongHeavy; - else if ( (L"dotDash") == sValue ) this->m_eValue = underlineDotDash; - else if ( (L"dotDotDash") == sValue ) this->m_eValue = underlineDotDotDash; - else if ( (L"dotted") == sValue ) this->m_eValue = underlineDotted; - else if ( (L"dottedHeavy") == sValue ) this->m_eValue = underlineDottedHeavy; - else if ( (L"double") == sValue ) this->m_eValue = underlineDouble; - else if ( (L"none") == sValue ) this->m_eValue = underlineNone; - else if ( (L"single") == sValue ) this->m_eValue = underlineSingle; - else if ( (L"thick") == sValue ) this->m_eValue = underlineThick; - else if ( (L"wave") == sValue ) this->m_eValue = underlineWave; - else if ( (L"wavyDouble") == sValue ) this->m_eValue = underlineWavyDouble; - else if ( (L"wavyHeavy") == sValue ) this->m_eValue = underlineWavyHeavy; - else if ( (L"words") == sValue ) this->m_eValue = underlineWords; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case underlineDash : return (L"dash"); - case underlineDashDotDotHeavy : return (L"dashDotDotHeavy"); - case underlineDashDotHeavy : return (L"dashDotHeavy"); - case underlineDashedHeavy : return (L"dashedHeavy"); - case underlineDashLong : return (L"dashLong"); - case underlineDashLongHeavy : return (L"dashLongHeavy"); - case underlineDotDash : return (L"dotDash"); - case underlineDotDotDash : return (L"dotDotDash"); - case underlineDotted : return (L"dotted"); - case underlineDottedHeavy : return (L"dottedHeavy"); - case underlineDouble : return (L"double"); - case underlineNone : return (L"none"); - case underlineSingle : return (L"single"); - case underlineThick : return (L"thick"); - case underlineWave : return (L"wave"); - case underlineWavyDouble : return (L"wavyDouble"); - case underlineWavyHeavy : return (L"wavyHeavy"); - case underlineWords : return (L"words"); - default : return (L"none"); - } - } - - SimpleType_FromString (EUnderline) - SimpleType_Operator_Equal (CUnderline) - }; - - - + DEFINE_SIMPLE_TYPE(CUnderline, EUnderline, underlineNone) //-------------------------------------------------------------------------------- // VAnchor 17.18.100 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EVAnchor { @@ -6277,45 +1908,11 @@ namespace SimpleTypes vanchorText = 2 }; - template - class CVAnchor : public CSimpleType - { - public: - CVAnchor() {} - - virtual EVAnchor FromString(std::wstring &sValue) - { - if ( (L"margin") == sValue ) this->m_eValue = vanchorMargin; - else if ( (L"page") == sValue ) this->m_eValue = vanchorPage; - else if ( (L"text") == sValue ) this->m_eValue = vanchorText; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case vanchorMargin : return (L"margin"); - case vanchorPage : return (L"page"); - case vanchorText : return (L"text"); - default : return (L"text"); - } - } - - SimpleType_FromString (EVAnchor) - SimpleType_Operator_Equal (CVAnchor) - }; - - - - - + DEFINE_SIMPLE_TYPE(CVAnchor, EVAnchor, vanchorText) //-------------------------------------------------------------------------------- // VerticalJc 17.18.101 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EVerticalJc { @@ -6325,46 +1922,11 @@ namespace SimpleTypes verticaljcTop = 3 }; - template - class CVerticalJc : public CSimpleType - { - public: - CVerticalJc() {} - - virtual EVerticalJc FromString(std::wstring &sValue) - { - if ( (L"both") == sValue ) this->m_eValue = verticaljcBoth; - else if ( (L"bottom") == sValue ) this->m_eValue = verticaljcBottom; - else if ( (L"center") == sValue ) this->m_eValue = verticaljcCenter; - else if ( (L"top") == sValue ) this->m_eValue = verticaljcTop; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case verticaljcBoth : return (L"both"); - case verticaljcBottom : return (L"bottom"); - case verticaljcCenter : return (L"center"); - case verticaljcTop : return (L"top"); - default : return (L"top"); - } - } - - SimpleType_FromString (EVerticalJc) - SimpleType_Operator_Equal (CVerticalJc) - }; - - - - + DEFINE_SIMPLE_TYPE(CVerticalJc, EVerticalJc, verticaljcTop) //-------------------------------------------------------------------------------- // View 17.18.102 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EView { @@ -6376,50 +1938,11 @@ namespace SimpleTypes viewWeb = 5 }; - template - class CView : public CSimpleType - { - public: - CView() {} - - virtual EView FromString(std::wstring &sValue) - { - if ( (L"masterPages") == sValue ) this->m_eValue = viewMasterPages; - else if ( (L"none") == sValue ) this->m_eValue = viewNone; - else if ( (L"normal") == sValue ) this->m_eValue = viewNormal; - else if ( (L"outline") == sValue ) this->m_eValue = viewOutline; - else if ( (L"print") == sValue ) this->m_eValue = viewPrint; - else if ( (L"web") == sValue ) this->m_eValue = viewWeb; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case viewMasterPages : return (L"masterPages"); - case viewNone : return (L"none"); - case viewNormal : return (L"normal"); - case viewOutline : return (L"outline"); - case viewPrint : return (L"print"); - case viewWeb : return (L"web"); - default : return (L"none"); - } - } - - SimpleType_FromString (EView) - SimpleType_Operator_Equal (CView) - }; - - - - + DEFINE_SIMPLE_TYPE(CView, EView, viewNone) //-------------------------------------------------------------------------------- // WmlColorSchemeIndex 17.18.103 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EWmlColorSchemeIndex { @@ -6437,64 +1960,11 @@ namespace SimpleTypes wmlcolorschemeindexLight2 = 11 }; - template - class CWmlColorSchemeIndex : public CSimpleType - { - public: - CWmlColorSchemeIndex() {} - - virtual EWmlColorSchemeIndex FromString(std::wstring &sValue) - { - if ( (L"accent1") == sValue ) this->m_eValue = wmlcolorschemeindexAccent1; - else if ( (L"accent2") == sValue ) this->m_eValue = wmlcolorschemeindexAccent2; - else if ( (L"accent3") == sValue ) this->m_eValue = wmlcolorschemeindexAccent3; - else if ( (L"accent4") == sValue ) this->m_eValue = wmlcolorschemeindexAccent4; - else if ( (L"accent5") == sValue ) this->m_eValue = wmlcolorschemeindexAccent5; - else if ( (L"accent6") == sValue ) this->m_eValue = wmlcolorschemeindexAccent6; - else if ( (L"dark1") == sValue ) this->m_eValue = wmlcolorschemeindexDark1; - else if ( (L"dark2") == sValue ) this->m_eValue = wmlcolorschemeindexDark2; - else if ( (L"followedHyperlink") == sValue ) this->m_eValue = wmlcolorschemeindexFollowedHyperlink; - else if ( (L"hyperlink") == sValue ) this->m_eValue = wmlcolorschemeindexHyperlink; - else if ( (L"light1") == sValue ) this->m_eValue = wmlcolorschemeindexLight1; - else if ( (L"light2") == sValue ) this->m_eValue = wmlcolorschemeindexLight2; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case wmlcolorschemeindexAccent1 : return (L"accent1"); - case wmlcolorschemeindexAccent2 : return (L"accent2"); - case wmlcolorschemeindexAccent3 : return (L"accent3"); - case wmlcolorschemeindexAccent4 : return (L"accent4"); - case wmlcolorschemeindexAccent5 : return (L"accent5"); - case wmlcolorschemeindexAccent6 : return (L"accent6"); - case wmlcolorschemeindexDark1 : return (L"dark1"); - case wmlcolorschemeindexDark2 : return (L"dark2"); - case wmlcolorschemeindexFollowedHyperlink : return (L"followedHyperlink"); - case wmlcolorschemeindexHyperlink : return (L"hyperlink"); - case wmlcolorschemeindexLight1 : return (L"light1"); - case wmlcolorschemeindexLight2 : return (L"light2"); - default : return (L"accent1"); - } - } - - SimpleType_FromString (EWmlColorSchemeIndex) - SimpleType_Operator_Equal (CWmlColorSchemeIndex) - }; - - - - - - + DEFINE_SIMPLE_TYPE(CWmlColorSchemeIndex, EWmlColorSchemeIndex, wmlcolorschemeindexAccent1) //-------------------------------------------------------------------------------- // Wrap 17.18.104 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EWrap { @@ -6506,47 +1976,11 @@ namespace SimpleTypes wrapTight = 5 }; - template - class CWrap : public CSimpleType - { - public: - CWrap() {} - - virtual EWrap FromString(std::wstring &sValue) - { - if ( (L"around") == sValue ) this->m_eValue = wrapAround; - else if ( (L"auto") == sValue ) this->m_eValue = wrapAuto; - else if ( (L"none") == sValue ) this->m_eValue = wrapNone; - else if ( (L"notBeside") == sValue ) this->m_eValue = wrapNotBeside; - else if ( (L"through") == sValue ) this->m_eValue = wrapThrough; - else if ( (L"tight") == sValue ) this->m_eValue = wrapTight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case wrapAround : return (L"around"); - case wrapAuto : return (L"auto"); - case wrapNone : return (L"none"); - case wrapNotBeside : return (L"notBeside"); - case wrapThrough : return (L"through"); - case wrapTight : return (L"tight"); - default : return (L"auto"); - } - } - - SimpleType_FromString (EWrap) - SimpleType_Operator_Equal (CWrap) - }; - + DEFINE_SIMPLE_TYPE(CWrap, EWrap, wrapAuto) //-------------------------------------------------------------------------------- // Zoom 17.18.105 (Part 1) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EZoom { @@ -6554,51 +1988,18 @@ namespace SimpleTypes zoomFullPage = 1, zoomNone = 2, zoomTextFit = 3 - }; + }; - template - class CZoom : public CSimpleType - { - public: - CZoom() {} - - virtual EZoom FromString(std::wstring &sValue) - { - if ( (L"bestFit") == sValue ) this->m_eValue = zoomBestFit; - else if ( (L"fullPage") == sValue ) this->m_eValue = zoomFullPage; - else if ( (L"none") == sValue ) this->m_eValue = zoomNone; - else if ( (L"textFit") == sValue ) this->m_eValue = zoomTextFit; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case zoomBestFit : return (L"bestFit"); - case zoomFullPage : return (L"fullPage"); - case zoomNone : return (L"none"); - case zoomTextFit : return (L"textFit"); - default : return (L"none"); - } - } - - SimpleType_FromString (EZoom) - SimpleType_Operator_Equal (CZoom) - }; + DEFINE_SIMPLE_TYPE(CZoom, EZoom, zoomNone) }; // SimpleTypes - - // Дополнительные типы namespace SimpleTypes { //-------------------------------------------------------------------------------- // CFontCharset 9.4.1.1 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EFontCharset { @@ -6620,348 +2021,87 @@ namespace SimpleTypes fontcharsetRussian = 204, // CC fontcharsetThai = 222, // DE fontcharsetEastEurope = 238, // EE - fontcharsetOEM = 255, // FF + fontcharsetOEM = 255, // FF }; - template - class CFontCharset : public CSimpleType - { - public: - CFontCharset() {} - - virtual EFontCharset FromString(std::wstring &sValue) - { - if ( (L"00") == sValue ) this->m_eValue = fontcharsetANSI; - else if ( (L"01") == sValue ) this->m_eValue = fontcharsetDefault; - else if ( (L"02") == sValue ) this->m_eValue = fontcharsetSymbol; - else if ( (L"4D") == sValue ) this->m_eValue = fontcharsetMacintosh; - else if ( (L"80") == sValue ) this->m_eValue = fontcharsetShitJIS; - else if ( (L"81") == sValue ) this->m_eValue = fontcharsetHangeul; - else if ( (L"82") == sValue ) this->m_eValue = fontcharsetJohab; - else if ( (L"86") == sValue ) this->m_eValue = fontcharsetGB2313; - else if ( (L"88") == sValue ) this->m_eValue = fontcharsetChineseBig5; - else if ( (L"A1") == sValue ) this->m_eValue = fontcharsetGreek; - else if ( (L"A2") == sValue ) this->m_eValue = fontcharsetTurkish; - else if ( (L"A3") == sValue ) this->m_eValue = fontcharsetVietnamese; - else if ( (L"B1") == sValue ) this->m_eValue = fontcharsetHebrew; - else if ( (L"B2") == sValue ) this->m_eValue = fontcharsetArabic; - else if ( (L"BA") == sValue ) this->m_eValue = fontcharsetBaltic; - else if ( (L"CC") == sValue ) this->m_eValue = fontcharsetRussian; - else if ( (L"DE") == sValue ) this->m_eValue = fontcharsetThai; - else if ( (L"EE") == sValue ) this->m_eValue = fontcharsetEastEurope; - else if ( (L"FF") == sValue ) this->m_eValue = fontcharsetOEM; - else this->m_eValue = fontcharsetANSI; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case fontcharsetANSI : return (L"00"); - case fontcharsetDefault : return (L"01"); - case fontcharsetSymbol : return (L"02"); - case fontcharsetMacintosh : return (L"4D"); - case fontcharsetShitJIS : return (L"80"); - case fontcharsetHangeul : return (L"81"); - case fontcharsetJohab : return (L"82"); - case fontcharsetGB2313 : return (L"86"); - case fontcharsetChineseBig5 : return (L"88"); - case fontcharsetGreek : return (L"A1"); - case fontcharsetTurkish : return (L"A2"); - case fontcharsetVietnamese : return (L"A3"); - case fontcharsetHebrew : return (L"B1"); - case fontcharsetArabic : return (L"B2"); - case fontcharsetBaltic : return (L"BA"); - case fontcharsetRussian : return (L"CC"); - case fontcharsetThai : return (L"DE"); - case fontcharsetEastEurope : return (L"EE"); - case fontcharsetOEM : return (L"FF"); - default : return (L"00"); - } - } - - SimpleType_FromString (EFontCharset) - SimpleType_Operator_Equal (CFontCharset) - }; + DEFINE_SIMPLE_TYPE(CFontCharset, EFontCharset, fontcharsetANSI) //-------------------------------------------------------------------------------- // CCnf 9.10.7 (Part 4) - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- - template - class CCnf : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CCnf, unsigned short, 0) public: - CCnf() {} - - virtual unsigned short FromString(std::wstring &sValue) - { - Parse( sValue ); - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - - for( int nIndex = 0, nMult = 1; nIndex < 12; nIndex++, nMult <<= 1 ) - { - if ( this->m_eValue & nMult ) - sResult += '1'; - else - sResult += '0'; - } - - return sResult; - } - - SimpleType_FromString (unsigned short) - SimpleType_Operator_Equal (CCnf) - - inline bool IsFirstRow () const - { - return (bool)( (this->m_eValue & 1) != 0 ); - } - inline bool IsLastRow () const - { - return (bool)( (this->m_eValue & 2) != 0 ); - } - inline bool IsFirstColumn () const - { - return (bool)( (this->m_eValue & 4) != 0 ); - } - inline bool IsLastColumn () const - { - return (bool)( (this->m_eValue & 8) != 0 ); - } - inline bool IsBand1Vertical () const - { - return (bool)( (this->m_eValue & 16) != 0 ); - } - inline bool IsBand2Vertical () const - { - return (bool)( (this->m_eValue & 32) != 0 ); - } - inline bool IsBand1Horizontal() const - { - return (bool)( (this->m_eValue & 64) != 0 ); - } - inline bool IsBand2Horizontal() const - { - return (bool)( (this->m_eValue & 128) != 0 ); - } - inline bool IsNeCell () const - { - return (bool)( (this->m_eValue & 256) != 0 ); - } - inline bool IsNwCell () const - { - return (bool)( (this->m_eValue & 512) != 0 ); - } - inline bool IsSeCell () const - { - return (bool)( (this->m_eValue & 1024) != 0 ); - } - inline bool IsSwCell () const - { - return (bool)( (this->m_eValue & 2048) != 0 ); - } + bool IsFirstRow () const; + bool IsLastRow () const; + bool IsFirstColumn () const; + bool IsLastColumn () const; + bool IsBand1Vertical () const; + bool IsBand2Vertical () const; + bool IsBand1Horizontal() const; + bool IsBand2Horizontal() const; + bool IsNeCell () const; + bool IsNwCell () const; + bool IsSeCell () const; + bool IsSwCell () const; private: - - void Parse(std::wstring &sValue) - { - int nLen = (std::min)( (int)sValue.length(), 12 ); - - for ( int nIndex = 0, nMult = 1; nIndex < nLen; nIndex++, nMult <<= 1 ) - { - wchar_t wsChar = sValue[nIndex]; - - if ( '0' == wsChar ) - { - // Ничего не делаем - } - else if ( '1' == wsChar ) - { - this->m_eValue ^= nMult; - } - else // Неправильный формат - break; - } - } + void Parse(const std::wstring &sValue); }; - //-------------------------------------------------------------------------------- // XmlSpace - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- enum EXmlSpace { xmlspaceDefault = 0, xmlspacePreserve = 1 }; - template - class CXmlSpace : public CSimpleType - { - public: - CXmlSpace() {} - virtual EXmlSpace FromString(std::wstring &sValue) - { - if ( (L"default") == sValue ) this->m_eValue = xmlspaceDefault; - else if ( (L"preserve") == sValue ) this->m_eValue = xmlspacePreserve; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - EXmlSpace FromStringA(const char* pValue) - { - if ( strcmp("default", pValue) == 0 ) this->m_eValue = xmlspaceDefault; - else if ( strcmp("preserve", pValue) == 0 ) this->m_eValue = xmlspacePreserve; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CXmlSpace, EXmlSpace, xmlspaceDefault) + + //-------------------------------------------------------------------------------- + // CryptAlgClass + //-------------------------------------------------------------------------------- - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case xmlspaceDefault : return (L"default"); - case xmlspacePreserve : return (L"preserve"); - default : return (L"default"); - } - } - SimpleType_FromString (EXmlSpace) - SimpleType_Operator_Equal (CXmlSpace) - }; -//--------------------------------------------------------------------------------------------- enum ECryptAlgClass { AlgClassCustom = 0, AlgClassHash = 1 }; - template - class CCryptAlgClass : public CSimpleType - { - public: - CCryptAlgClass() {} - virtual ECryptAlgClass FromString(std::wstring &sValue) - { - if (L"custom" == sValue) this->m_eValue = AlgClassCustom; - else if (L"hash" == sValue) this->m_eValue = AlgClassHash; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - ECryptAlgClass FromStringA(const char* pValue) - { - if (strcmp("custom", pValue) == 0) this->m_eValue = AlgClassCustom; - else if (strcmp("hash", pValue) == 0) this->m_eValue = AlgClassHash; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CCryptAlgClass, ECryptAlgClass, AlgClassCustom) + + //-------------------------------------------------------------------------------- + // CryptAlgType + //-------------------------------------------------------------------------------- - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case AlgClassCustom: return (L"custom"); - case AlgClassHash: return (L"hash"); - default: return (L"custom"); - } - } - SimpleType_FromString(ECryptAlgClass) - SimpleType_Operator_Equal(CCryptAlgClass) - }; -//--------------------------------------------------------------------------------------------- enum ECryptAlgType { AlgTypeCustom = 0, AlgTypeTypeAny = 1 }; - template - class CCryptAlgType : public CSimpleType - { - public: - CCryptAlgType() {} - virtual ECryptAlgType FromString(std::wstring &sValue) - { - if (L"custom" == sValue) this->m_eValue = AlgTypeCustom; - else if (L"typeAny" == sValue) this->m_eValue = AlgTypeTypeAny; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CCryptAlgType, ECryptAlgType, AlgTypeCustom) - return this->m_eValue; - } - ECryptAlgType FromStringA(const char* pValue) - { - if (strcmp("custom", pValue) == 0) this->m_eValue = AlgTypeCustom; - else if (strcmp("typeAny", pValue) == 0) this->m_eValue = AlgTypeTypeAny; - else this->m_eValue = eDefValue; + //-------------------------------------------------------------------------------- + // CryptProv + //-------------------------------------------------------------------------------- - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case AlgTypeCustom: return (L"custom"); - case AlgTypeTypeAny: return (L"typeAny"); - default: return (L"custom"); - } - } - SimpleType_FromString(ECryptAlgType) - SimpleType_Operator_Equal(CCryptAlgType) - }; -//--------------------------------------------------------------------------------------------- enum ECryptProv { CryptProvCustom = 0, CryptProvRsaAES = 1, CryptProvRsaFull = 2 }; - template - class CCryptProv : public CSimpleType - { - public: - CCryptProv() {} - virtual ECryptProv FromString(std::wstring &sValue) - { - if (L"custom" == sValue) this->m_eValue = CryptProvCustom; - else if (L"rsaAES" == sValue) this->m_eValue = CryptProvRsaAES; - else if (L"rsaFull" == sValue) this->m_eValue = CryptProvRsaFull; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - ECryptProv FromStringA(const char* pValue) - { - if (strcmp("custom", pValue) == 0) this->m_eValue = CryptProvCustom; - else if (strcmp("rsaAES", pValue) == 0) this->m_eValue = CryptProvRsaAES; - else if (strcmp("rsaFull", pValue) == 0) this->m_eValue = CryptProvRsaFull; - else this->m_eValue = eDefValue; + DEFINE_SIMPLE_TYPE(CCryptProv, ECryptProv, CryptProvCustom) + + //-------------------------------------------------------------------------------- + // CryptAlgoritmName + //-------------------------------------------------------------------------------- - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case CryptProvCustom: return (L"custom"); - case CryptProvRsaAES: return (L"rsaAES"); - case CryptProvRsaFull: return (L"rsaFull"); - default: return (L"custom"); - } - } - SimpleType_FromString(ECryptProv) - SimpleType_Operator_Equal(CCryptProv) - }; -//-------------------------------------------------------------------------------- -// CryptAlgoritmName -//-------------------------------------------------------------------------------- enum ECryptAlgoritmName { cryptalgoritmnameUnknown = 0, @@ -6976,53 +2116,13 @@ namespace SimpleTypes cryptalgoritmnameSHA512 = 9, cryptalgoritmnameWHIRLPOOL = 10, }; - template - class CCryptAlgoritmName : public CSimpleType - { - public: - CCryptAlgoritmName() {} - virtual ECryptAlgoritmName FromString(std::wstring &sValue) - { - if ( L"MD2" == sValue || L"1" == sValue ) this->m_eValue = cryptalgoritmnameMD2; - else if ( L"MD4" == sValue || L"2" == sValue ) this->m_eValue = cryptalgoritmnameMD4; - else if ( L"MD5" == sValue || L"3" == sValue ) this->m_eValue = cryptalgoritmnameMD5; - else if ( L"RIPEMD-128" == sValue || L"6" == sValue ) this->m_eValue = cryptalgoritmnameRIPEMD128; - else if ( L"RIPEMD-160" == sValue || L"7" == sValue ) this->m_eValue = cryptalgoritmnameRIPEMD160; - else if ( L"SHA-1" == sValue || L"4" == sValue ) this->m_eValue = cryptalgoritmnameSHA1; - else if ( L"SHA-256" == sValue || L"12" == sValue ) this->m_eValue = cryptalgoritmnameSHA256; - else if ( L"SHA-384" == sValue || L"13" == sValue ) this->m_eValue = cryptalgoritmnameSHA384; - else if ( L"SHA-512" == sValue || L"14" == sValue ) this->m_eValue = cryptalgoritmnameSHA512; - else if ( L"WHIRLPOOL" == sValue ) this->m_eValue = cryptalgoritmnameWHIRLPOOL; - else - this->m_eValue = eDefValue; - - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case cryptalgoritmnameMD2 : return (L"MD2"); - case cryptalgoritmnameMD4 : return (L"MD4"); - case cryptalgoritmnameMD5 : return (L"MD5"); - case cryptalgoritmnameRIPEMD128 : return (L"RIPEMD-128"); - case cryptalgoritmnameRIPEMD160 : return (L"RIPEMD-160"); - case cryptalgoritmnameSHA1 : return (L"SHA-1"); - case cryptalgoritmnameSHA256 : return (L"SHA-256"); - case cryptalgoritmnameSHA384 : return (L"SHA-384"); - case cryptalgoritmnameSHA512 : return (L"SHA-512"); - case cryptalgoritmnameWHIRLPOOL : return (L"WHIRLPOOL"); - default : return (L""); - } - } - SimpleType_FromString (ECryptAlgoritmName) - SimpleType_Operator_Equal (CCryptAlgoritmName) - }; + DEFINE_SIMPLE_TYPE(CCryptAlgoritmName, ECryptAlgoritmName, cryptalgoritmnameUnknown) //-------------------------------------------------------------------------------- // PitchFamily - //-------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------- + enum EPitchFamily { pitchfamilyDefUnk = 0x00, @@ -7045,104 +2145,27 @@ namespace SimpleTypes pitchfamilyVarDec = 0x52, }; - template - class CPitchFamily : public CSimpleType - { + DEFINE_SIMPLE_TYPE_START(CPitchFamily, EPitchFamily, pitchfamilyDefUnk) public: - CPitchFamily() {} - - virtual EPitchFamily FromString(std::wstring &sValue) - { - CUcharHexNumber<> oHex = sValue; - int nValue = oHex.GetValue(); - - switch ( nValue ) - { - case 0x00: case 0x01: case 0x02: - case 0x10: case 0x11: case 0x12: - case 0x20: case 0x21: case 0x22: - case 0x30: case 0x31: case 0x32: - case 0x40: case 0x41: case 0x42: - case 0x50: case 0x51: case 0x52: - this->m_eValue = (EPitchFamily)nValue; break; - default: - this->m_eValue = eDefValue; break; - } - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pitchfamilyDefUnk: return (L"00"); - case pitchfamilyFixUnk: return (L"01"); - case pitchfamilyVarUnk: return (L"02"); - case pitchfamilyDefRom: return (L"10"); - case pitchfamilyFixRom: return (L"11"); - case pitchfamilyVarRom: return (L"12"); - case pitchfamilyDefSwi: return (L"20"); - case pitchfamilyFixSwi: return (L"21"); - case pitchfamilyVarSwi: return (L"22"); - case pitchfamilyDefMod: return (L"30"); - case pitchfamilyFixMod: return (L"31"); - case pitchfamilyVarMod: return (L"32"); - case pitchfamilyDefScr: return (L"40"); - case pitchfamilyFixScr: return (L"41"); - case pitchfamilyVarScr: return (L"42"); - case pitchfamilyDefDec: return (L"50"); - case pitchfamilyFixDec: return (L"51"); - case pitchfamilyVarDec: return (L"52"); - default : return (L"00"); - } - } - SimpleType_FromString (EPitchFamily) - SimpleType_Operator_Equal (CPitchFamily) - - unsigned char GetPitch() - { - int nValue = (int)this->m_eValue; - return nValue & 0x0F; - } - unsigned char GetFamily() - { - int nValue = (int)this->m_eValue; - return nValue >> 4; - } + unsigned char GetPitch(); + unsigned char GetFamily(); }; + //-------------------------------------------------------------------------------- - // CryptAlgoritmName - //-------------------------------------------------------------------------------- + // DirVal + //-------------------------------------------------------------------------------- + enum EDirVal { dirLtr = 0, dirRtl = 1 }; - template - class CDirVal : public CSimpleType - { - public: - CDirVal() {} - virtual EDirVal FromString(std::wstring &sValue) - { - if ( (L"ltr") == sValue ) this->m_eValue = dirLtr; - else if ( (L"rtl") == sValue ) this->m_eValue = dirRtl; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case cryptalgoritmnameMD2 : return (L"ltr"); - case cryptalgoritmnameMD4 : return (L"rtl"); - default : return (L"ltr"); - } - } - SimpleType_FromString (EDirVal) - SimpleType_Operator_Equal (CDirVal) - }; + DEFINE_SIMPLE_TYPE(CDirVal, EDirVal, dirLtr) + + //-------------------------------------------------------------------------------- + // Ligatures + //-------------------------------------------------------------------------------- enum ELigaturesFlags { @@ -7172,121 +2195,32 @@ namespace SimpleTypes ligatureAll = ligaturesFlagStandard | ligaturesFlagContextual | ligaturesFlagHistorical | ligaturesFlagDiscretional }; - template - class CLigatures : public CSimpleType - { - public: - CLigatures() {} - virtual ELigatures FromString(std::wstring &sValue) - { - if (L"none" == sValue) this->m_eValue = ligatureNone; - else if (L"standard" == sValue) this->m_eValue = ligatureStandard; - else if (L"contextual" == sValue) this->m_eValue = ligatureContextual; - else if (L"historical" == sValue) this->m_eValue = ligatureHistorical; - else if (L"discretional" == sValue) this->m_eValue = ligatureDiscretional; - else if (L"standardContextual" == sValue) this->m_eValue = ligatureStandardContextual; - else if (L"standardHistorical" == sValue) this->m_eValue = ligatureStandardHistorical; - else if (L"contextualHistorical" == sValue) this->m_eValue = ligatureContextualHistorical; - else if (L"standardDiscretional" == sValue) this->m_eValue = ligatureStandardDiscretional; - else if (L"contextualDiscretional" == sValue) this->m_eValue = ligatureContextualDiscretional; - else if (L"historicalDiscretional" == sValue) this->m_eValue = ligatureHistoricalDiscretional; - else if (L"standardContextualHistorical" == sValue) this->m_eValue = ligatureStandardContextualHistorical; - else if (L"standardContextualDiscretional" == sValue) this->m_eValue = ligatureStandardContextualDiscretional; - else if (L"standardHistoricalDiscretional" == sValue) this->m_eValue = ligatureStandardHistoricalDiscretional; - else if (L"contextualHistoricalDiscretional" == sValue) this->m_eValue = ligatureContextualHistoricalDiscretional; - else if (L"all" == sValue) this->m_eValue = ligatureAll; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case ligatureNone: return (L"none"); - case ligatureStandard: return (L"standard"); - case ligatureContextual: return (L"contextual"); - case ligatureHistorical: return (L"historical"); - case ligatureDiscretional: return (L"discretional"); - case ligatureStandardContextual: return (L"standardContextual"); - case ligatureStandardHistorical: return (L"standardHistorical"); - case ligatureContextualHistorical: return (L"contextualHistorical"); - case ligatureStandardDiscretional: return (L"standardDiscretional"); - case ligatureContextualDiscretional: return (L"contextualDiscretional"); - case ligatureHistoricalDiscretional: return (L"historicalDiscretional"); - case ligatureStandardContextualHistorical: return (L"standardContextualHistorical"); - case ligatureStandardContextualDiscretional: return (L"standardContextualDiscretional"); - case ligatureStandardHistoricalDiscretional: return (L"standardHistoricalDiscretional"); - case ligatureContextualHistoricalDiscretional: return (L"contextualHistoricalDiscretional"); - case ligatureAll: return (L"all"); - default: return (L"standard"); - } - } - SimpleType_FromString(ELigatures) - SimpleType_Operator_Equal(CLigatures) - }; + DEFINE_SIMPLE_TYPE(CLigatures, ELigatures, ligatureStandard) + + //-------------------------------------------------------------------------------- + // NumForm + //-------------------------------------------------------------------------------- + enum ENumForm { numFormDefault = 0, numFormLining = 1, numFormOldStyle = 2 }; - template - class CNumForm : public CSimpleType - { - public: - CNumForm() {} - virtual ENumForm FromString(std::wstring &sValue) - { - if (L"default" == sValue) this->m_eValue = numFormDefault; - else if (L"lining" == sValue) this->m_eValue = numFormLining; - else if (L"oldStyle" == sValue) this->m_eValue = numFormOldStyle; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case numFormLining: return L"lining"; - case numFormOldStyle: return L"oldStyle"; - case numFormDefault: - default: return L"default"; - } - } - SimpleType_FromString(ENumForm) - SimpleType_Operator_Equal(CNumForm) - }; + DEFINE_SIMPLE_TYPE(CNumForm, ENumForm, numFormDefault) + + //-------------------------------------------------------------------------------- + // NumSpacing + //-------------------------------------------------------------------------------- + enum ENumSpacing { numSpacingDefault = 0, numSpacingProportional = 1, numSpacingTabular = 2 }; - template - class CNumSpacing : public CSimpleType - { - public: - CNumSpacing() {} - virtual ENumSpacing FromString(std::wstring &sValue) - { - if (L"default" == sValue) this->m_eValue = numSpacingDefault; - else if (L"proportional" == sValue) this->m_eValue = numSpacingProportional; - else if (L"tabular" == sValue) this->m_eValue = numSpacingTabular; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch (this->m_eValue) - { - case numSpacingProportional: return L"proportional"; - case numSpacingTabular: return L"tabular"; - case numSpacingDefault: - default: return L"default"; - } - } - SimpleType_FromString(ENumSpacing) - SimpleType_Operator_Equal(CNumSpacing) - }; + DEFINE_SIMPLE_TYPE(CNumSpacing, ENumSpacing, numSpacingDefault) + } // SimpleTypes diff --git a/Common/DocxFormat/Source/Common/Unit.h b/Common/DocxFormat/Source/Common/Unit.h deleted file mode 100644 index 10a435e31a..0000000000 --- a/Common/DocxFormat/Source/Common/Unit.h +++ /dev/null @@ -1,400 +0,0 @@ -/* - * (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 -#ifndef _UNIT_INCLUDE_H_ -#define _UNIT_INCLUDE_H_ - -#include "../Base/Base.h" - -static double Cm_To_Mm (const double &dValue) -{ - return dValue * 10; -} - -static double Cm_To_Pt (const double &dValue) -{ - return dValue * 72 / 2.54; -} - -static double Cm_To_Px (const double &dValue) -{ - return dValue * 72 * 4 / 3 / 2.54; -} - -static double Cm_To_Inch (const double &dValue) -{ - return dValue / 2.54; -} - -static double Cm_To_Dx (const double &dValue) -{ - return dValue * 72 * 20 / 2.54; -} - -static double Cm_To_Sx (const double &dValue) -{ - return dValue * 72 * 100 * 1000 / 20; -} - -static double Cm_To_Multi (const double &dValue) -{ - return dValue * 72 * 20 / 2.54; -} -static double Cm_To_Emu (const double &dValue) -{ - return dValue * 360000; -} - -static double Mm_To_Cm (const double &dValue) -{ - return dValue / 10; -} - -static double Mm_To_Pt (const double &dValue) -{ - return dValue * 72 / 10 / 2.54; -} - -static double Mm_To_Px (const double &dValue) -{ - return dValue * 72 * 4 / 3 / 10 / 2.54; -} - -static double Mm_To_Inch (const double &dValue) -{ - return dValue / 2.54 / 10; -} - -static double Mm_To_Dx (const double &dValue) -{ - return dValue * 72 * 20 / 10 / 2.54; -} - -static double Mm_To_Sx (const double &dValue) -{ - return dValue * 72 * 100 * 1000 / 10 / 20; -} - -static double Mm_To_Multi (const double &dValue) -{ - return dValue * 72 * 20 / 10 / 2.54; -} - -static double Mm_To_Emu (const double &dValue) -{ - return dValue * 36000; -} - -static double Pt_To_Cm (const double &dValue) -{ - return dValue * 2.54 / 72; -} - -static double Pt_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10 / 72; -} - -static double Pt_To_Px (const double &dValue) -{ - return dValue * 4 / 3; -} - -static double Pt_To_Inch (const double &dValue) -{ - return dValue / 72; -} - -static double Pt_To_Dx (const double &dValue) -{ - return dValue * 20; -} - -static double Pt_To_Sx (const double &dValue) -{ - return dValue * 2.54 * 100 * 1000 / 20; -} - -static double Pt_To_Multi (const double &dValue) -{ - return dValue * 20; -} - -static double Pt_To_Emu (const double &dValue) -{ - return dValue * 12700; -} - -static double Px_To_Cm (const double &dValue) -{ - return dValue * 2.54 * 3/ 72 / 4; -} - -static double Px_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10 * 3/ 72 /4; -} - -static double Px_To_Pt (const double &dValue) -{ - return dValue * 3 / 4; -} - -static double Px_To_Inch (const double &dValue) -{ - return dValue * 3 / 72 / 4; -} - -static double Px_To_Dx (const double &dValue) -{ - return dValue * 20 * 3 / 4; -} -static double Px_To_Sx (const double &dValue) -{ - return dValue * 2.54 * 100 * 1000 * 3/ 20 / 4; -} - -static double Px_To_Multi (const double &dValue) -{ - return dValue * 20 * 3 / 4; -} - -static double Px_To_Emu (const double &dValue) -{ - return dValue * 9525; -} - -static double Inch_To_Cm (const double &dValue) -{ - return dValue * 2.54; -} - -static double Inch_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10; -} - -static double Inch_To_Pt (const double &dValue) -{ - return dValue * 72; -} - -static double Inch_To_Px (const double &dValue) -{ - return dValue * 72 * 4 / 3; -} - -static double Inch_To_Dx (const double &dValue) -{ - return dValue * 72 * 20; -} - -static double Inch_To_Sx (const double &dValue) -{ - return dValue * 1000 * 100 * 2.54 * 72 / 20; -} - -static double Inch_To_Multi(const double &dValue) -{ - return dValue * 72 * 20; -} -static double Inch_To_Emu (const double &dValue) -{ - return dValue * 914400; -} - -static double Dx_To_Cm (const double &dValue) -{ - return dValue * 2.54 / 72 / 20; -} - -static double Dx_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10 / 72 / 20; -} - -static double Dx_To_Pt (const double &dValue) -{ - return dValue / 20; -} - - -static double Dx_To_Px (const double &dValue) -{ - return dValue * 4 / 3 / 20; -} - -static double Dx_To_Inch (const double &dValue) -{ - return dValue / 20 / 72; -} - -static double Dx_To_Sx (const double &dValue) -{ - return dValue * 635; -} - -static double Dx_To_Multi (const double &dValue) -{ - return dValue; -} - -static double Dx_To_Emu (const double &dValue) -{ - return dValue * 635; -} - -static double Sx_To_Cm (const double &dValue) -{ - return dValue * 20 / 72 / 100 / 1000; -} - -static double Sx_To_Mm (const double &dValue) -{ - return dValue * 20 / 72 / 100 / 1000 * 10; -} - -static double Sx_To_Pt (const double &dValue) -{ - return dValue * 20 / 100 / 1000 / 2.54; -} - -static double Sx_To_Px (const double &dValue) -{ - return dValue * 20 * 4 / 3 / 100 / 1000 / 2.54; -} - -static double Sx_To_Inch (const double &dValue) -{ - return dValue * 20 / 2.54 / 72 / 100 / 1000; -} - -static double Sx_To_Dx (const double &dValue) -{ - return dValue * 20 * 20 / 2.54 / 100 / 1000; -} - -static double Sx_To_Multi (const double &dValue) -{ - return dValue * 20 * 20 / 2.54 / 100 / 1000; -} - -static double Sx_To_Emu (const double &dValue) -{ - return dValue; -} - -static double Multi_To_Cm (const double &dValue) -{ - return dValue * 2.54 / 72 / 20; -} - -static double Multi_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10 / 72 / 20; -} - -static double Multi_To_Pt (const double &dValue) -{ - return dValue / 20; -} - -static double Multi_To_Px (const double &dValue) -{ - return dValue * 4 / 3 / 20; -} - -static double Multi_To_Inch(const double &dValue) -{ - return dValue / 20 / 72; -} - -static double Multi_To_Sx (const double &dValue) -{ - return dValue * 635; -} - -static double Multi_To_Dx (const double &dValue) -{ - return dValue; -} - -static double Multi_To_Emu (const double &dValue) -{ - return dValue * 635; -} - -static double Emu_To_Cm (const double &dValue) -{ - return dValue / 360000; -} -static double Emu_To_Mm (const double &dValue) -{ - return dValue / 36000; -} - -static double Emu_To_Pt (const double &dValue) -{ - return dValue / 12700; -} - -static double Emu_To_Twips (const double &dValue) -{ - return dValue / 635; -} - -static double Emu_To_Px (const double &dValue) -{ - return dValue / 9525; -} - -static double Emu_To_Inch (const double &dValue) -{ - return dValue / 914400; -} - -static double Emu_To_Sx (const double &dValue) -{ - return dValue; -} - -static double Emu_To_Dx (const double &dValue) -{ - return dValue / 635; -} - -static double Emu_To_Multi (const double &dValue) -{ - return dValue / 635; -} - -#endif // _UNIT_INCLUDE_H_ diff --git a/Common/DocxFormat/Source/DocxFormat/App.h b/Common/DocxFormat/Source/DocxFormat/App.h index 68b5952ff2..4ccb7a7e18 100644 --- a/Common/DocxFormat/Source/DocxFormat/App.h +++ b/Common/DocxFormat/Source/DocxFormat/App.h @@ -266,7 +266,7 @@ namespace OOX if ( m_nSlides.IsInit() ) { - SimpleTypes::CDecimalNumber<> oNum; + SimpleTypes::CDecimalNumber oNum; oNum.SetValue( m_nSlides.get() ); sXml += _T(""); diff --git a/Common/DocxFormat/Source/DocxFormat/Comments.h b/Common/DocxFormat/Source/DocxFormat/Comments.h index fce97770f4..51c598a792 100644 --- a/Common/DocxFormat/Source/DocxFormat/Comments.h +++ b/Common/DocxFormat/Source/DocxFormat/Comments.h @@ -83,7 +83,7 @@ namespace OOX nullable m_oAuthor; nullable m_oDate; - nullable > m_oId; + nullable m_oId; nullable m_oInitials; //teamlab editor information!!! @@ -169,9 +169,9 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable > m_oParaId; - nullable > m_oParaIdParent; - nullable > m_oDone; + nullable m_oParaId; + nullable m_oParaIdParent; + nullable m_oDone; }; class CCommentsExt : public OOX::File//, public OOX::IFileContainer @@ -244,9 +244,9 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable > m_oDurableId; + nullable m_oDurableId; nullable m_oDateUtc; - nullable > m_oIntelligentPlaceholder; + nullable m_oIntelligentPlaceholder; nullable m_oExtLst; }; @@ -331,8 +331,8 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable > m_oParaId; - nullable > m_oDurableId; + nullable m_oParaId; + nullable m_oDurableId; }; class CCommentsIds : public OOX::File 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/Document.h b/Common/DocxFormat/Source/DocxFormat/Document.h index 4cc1d6840c..d7d53517ab 100644 --- a/Common/DocxFormat/Source/DocxFormat/Document.h +++ b/Common/DocxFormat/Source/DocxFormat/Document.h @@ -84,10 +84,10 @@ namespace OOX public: - nullable > m_oColor; - nullable > m_oThemeColor; - nullable > m_oThemeShade; - nullable > m_oThemeTint; + nullable m_oColor; + nullable m_oThemeColor; + nullable m_oThemeShade; + nullable m_oThemeTint; nullable m_oDrawing; nullable m_oBackground; @@ -121,7 +121,7 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: nullable m_oBinData; - nullable> m_oColor; + nullable m_oColor; nullable_string m_oBackgroundType; nullable m_oBackground; }; @@ -194,9 +194,9 @@ namespace OOX CPath m_oReadPath; unsigned int m_nDrawingMaxZIndex = 0; - SimpleTypes::CConformanceClass m_oConformance; + SimpleTypes::CConformanceClass m_oConformance; - nullable> m_oSpace; + nullable m_oSpace; nullable m_oSectPr; nullable m_oBackground; diff --git a/Common/DocxFormat/Source/DocxFormat/Docx.h b/Common/DocxFormat/Source/DocxFormat/Docx.h index c386938be3..476e5ad22a 100644 --- a/Common/DocxFormat/Source/DocxFormat/Docx.h +++ b/Common/DocxFormat/Source/DocxFormat/Docx.h @@ -31,8 +31,6 @@ */ #pragma once -#include "../Base/SmartPtr.h" - #include "Rels.h" #include "IFileContainer.h" #include "FileTypes.h" diff --git a/Common/DocxFormat/Source/DocxFormat/DocxFlat.h b/Common/DocxFormat/Source/DocxFormat/DocxFlat.h index a1921ec33f..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 { @@ -114,7 +115,7 @@ namespace OOX OOX::CHdrFtr *GetHeaderOrFooter(const OOX::RId& rId) const; void ReadDocumentProperties(XmlUtils::CXmlLiteReader& oReader); //----------------------------------------------------------------------- - nullable> m_oSpace; + nullable m_oSpace; nullable m_pDocument; nullable m_pStyles; diff --git a/Common/DocxFormat/Source/DocxFormat/Drawing/Drawing.h b/Common/DocxFormat/Source/DocxFormat/Drawing/Drawing.h index 830e8a8bee..36922a077b 100644 --- a/Common/DocxFormat/Source/DocxFormat/Drawing/Drawing.h +++ b/Common/DocxFormat/Source/DocxFormat/Drawing/Drawing.h @@ -220,10 +220,10 @@ namespace OOX bool m_bAlign; // используем Align или (PosOffset или PctOffset) - nullable> m_oRelativeFrom; + nullable m_oRelativeFrom; - nullable> m_oAlign; - nullable> m_oPosOffset; + nullable m_oAlign; + nullable m_oPosOffset; nullable m_oPctOffset; }; //-------------------------------------------------------------------------------- @@ -341,10 +341,10 @@ namespace OOX bool m_bAlign; // используем Align или PosOffset - nullable> m_oRelativeFrom; + nullable m_oRelativeFrom; - nullable> m_oAlign; - nullable> m_oPosOffset; + nullable m_oAlign; + nullable m_oPosOffset; nullable m_oPctOffset; }; @@ -429,7 +429,7 @@ namespace OOX } public: // Attributes - nullable> m_oRelativeFrom; + nullable m_oRelativeFrom; // Childs nullable m_oPctWidth; }; @@ -512,7 +512,7 @@ namespace OOX } public: // Attributes - nullable> m_oRelativeFrom; + nullable m_oRelativeFrom; // Childs nullable m_oPctHeight; }; @@ -570,13 +570,13 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oDistB; - nullable> m_oDistL; - nullable> m_oDistR; - nullable> m_oDistT; - nullable> m_oWrapText; + nullable m_oDistB; + nullable m_oDistL; + nullable m_oDistR; + nullable m_oDistT; + nullable m_oWrapText; - nullable m_oEffectExtent; + nullable m_oEffectExtent; }; //-------------------------------------------------------------------------------- // CWrapPath 20.4.2.16 (Part 1) @@ -607,7 +607,7 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable > m_oEdited; + nullable m_oEdited; nullable m_oStart; std::vector m_arrLineTo; @@ -635,9 +635,9 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oDistL; - nullable> m_oDistR; - nullable> m_oWrapText; + nullable m_oDistL; + nullable m_oDistR; + nullable m_oWrapText; nullable m_oWrapPolygon; }; @@ -664,9 +664,9 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oDistL; - nullable> m_oDistR; - nullable> m_oWrapText; + nullable m_oDistL; + nullable m_oDistR; + nullable m_oWrapText; nullable m_oWrapPolygon; }; @@ -693,8 +693,8 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oDistB; - nullable> m_oDistT; + nullable m_oDistB; + nullable m_oDistT; nullable m_oEffectExtent; }; @@ -734,17 +734,17 @@ namespace OOX public: nullable m_eWrapType; - nullable> m_oAllowOverlap; - nullable> m_oBehindDoc; - nullable> m_oDistB; - nullable> m_oDistL; - nullable> m_oDistR; - nullable> m_oDistT; - nullable> m_oHidden; - nullable> m_oLayoutInCell; - nullable> m_oLocked; - nullable > m_oRelativeHeight; - nullable> m_bSimplePos; + nullable m_oAllowOverlap; + nullable m_oBehindDoc; + nullable m_oDistB; + nullable m_oDistL; + nullable m_oDistR; + nullable m_oDistT; + nullable m_oHidden; + nullable m_oLayoutInCell; + nullable m_oLocked; + nullable m_oRelativeHeight; + nullable m_bSimplePos; nullable m_oDocPr; nullable m_oEffectExtent; @@ -787,10 +787,10 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: // Attributes - nullable> m_oDistB; - nullable> m_oDistL; - nullable> m_oDistR; - nullable> m_oDistT; + nullable m_oDistB; + nullable m_oDistL; + nullable m_oDistR; + nullable m_oDistT; // Childs nullable m_oDocPr; nullable m_oEffectExtent; diff --git a/Common/DocxFormat/Source/DocxFormat/FileTypes.cpp b/Common/DocxFormat/Source/DocxFormat/FileTypes.cpp new file mode 100644 index 0000000000..72f7a3fd5c --- /dev/null +++ b/Common/DocxFormat/Source/DocxFormat/FileTypes.cpp @@ -0,0 +1,383 @@ +/* + * (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 "FileTypes.h" + +namespace OOX +{ + namespace FileTypes + { + const FileType App (L"docProps", L"app.xml", + L"application/vnd.openxmlformats-officedocument.extended-properties+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"); + + const FileType Core (L"docProps", L"core.xml", + L"application/vnd.openxmlformats-package.core-properties+xml", + L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"); + + const FileType CustomProperties (L"docProps", L"custom.xml", + L"application/vnd.openxmlformats-officedocument.custom-properties+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"); + + const FileType Document (L"word", L"document.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + + const FileType DocumentMacro (L"word", L"document.xml", + L"application/vnd.ms-word.document.macroEnabled.main+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + + const FileType DocumentFlat (L"", L"", L"", L""); + + const FileType Theme (L"theme", L"theme.xml", + L"application/vnd.openxmlformats-officedocument.theme+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", + L"theme", true); + + const FileType ThemeOverride (L"themeOverride", L"themeOverride.xml", + L"application/vnd.openxmlformats-officedocument.theme+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride", + L"themeOverride", true); + + const FileType Setting (L"", L"settings.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"); + + const FileType FontTable (L"", L"fontTable.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"); + + const FileType Style (L"", L"styles.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"); + + const FileType Bibliography (L"customXml", L"item.xml", + L"WARNING not implement", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography"); + + const FileType FootNote (L"", L"footnotes.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"); + + const FileType EndNote (L"", L"endnotes.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"); + + const FileType WebSetting (L"", L"webSettings.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"); + + const FileType Header (L"", L"header.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", L"header", true); + + const FileType Footer (L"", L"footer.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", L"footer", true); + + const FileType Numbering (L"", L"numbering.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"); + + const FileType Comments (L"", L"comments.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"); + + const FileType DocumentComments (L"", L"commentsDocument.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", + L"http://schemas.onlyoffice.com/commentsDocument"); + + const FileType CommentsExt (L"", L"commentsExtended.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", + L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended"); + + const FileType DocumentCommentsExt (L"", L"commentsExtendedDocument.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", + L"http://schemas.onlyoffice.com/commentsExtendedDocument"); + + const FileType CommentsExtensible (L"", L"commentsExtensible.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml", + L"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"); + + const FileType DocumentCommentsExtensible (L"", L"commentsExtensibleDocument.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml", + L"http://schemas.onlyoffice.com/commentsExtensibleDocument"); + + const FileType CommentsIds (L"", L"commentsIds.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml", + L"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds"); + + const FileType DocumentCommentsIds (L"", L"commentsIdsDocument.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml", + L"http://schemas.onlyoffice.com/commentsIdsDocument"); + + const FileType CommentsUserData (L"", L"commentsUserData.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml", + L"http://schemas.onlyoffice.com/commentsUserData"); + + const FileType People (L"", L"people.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", + L"http://schemas.microsoft.com/office/2011/relationships/people"); + + const FileType DocumentPeople (L"", L"peopleDocument.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", + L"http://schemas.onlyoffice.com/peopleDocument"); + + const FileType CustomXml (L"customXml", L"item.xml", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", + L"customXml/item", true, true); + + const FileType CustomXmlProps (L"", L"itemProps.xml", + L"application/vnd.openxmlformats-officedocument.customXmlProperties+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", + L"customXml/itemProps", true, true); + + const FileType HyperLink (L"", L"", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"); + + const FileType Image (L"media", L"image", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", L"image", true, true); + + const FileType Audio (L"media", L"audio", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio", L"audio", true, true); + + const FileType Video (L"media", L"video", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", L"video", true, true); + + const FileType Media (L"media", L"media", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/media", L"media", true, true); + + const FileType DiagramData (L"diagrams", L"data.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData", + L"diagrams/data", true, true); + + const FileType DiagramQuickStyle(L"diagrams", L"quickStyle.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.diagramQuickStyle+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle", + L"diagrams/quickStyle", true, true); + + const FileType DiagramLayout (L"diagrams", L"layout.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout", + L"diagrams/layout", true, true); + + const FileType DiagramColors (L"diagrams", L"colors.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors", + L"diagrams/colors", true, true); + + const FileType DiagramDrawing (L"diagrams", L"drawing.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.diagramDrawing+xml", + L"http://schemas.microsoft.com/office/2007/relationships/diagramDrawing", + L"diagrams/drawing", true, true); + + const FileType ChartDrawing (L"drawings", L"drawing.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes", + L"drawings/drawing", true, true); + + const FileType Layout (L"diagrams", L"layout.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout", + L"diagrams/layout", true, true); + + const FileType Colors (L"diagrams", L"colors.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors", + L"diagrams/colors", true, true); + + const FileType QuickStyle (L"diagrams", L"quickStyle.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle", + L"diagrams/quickStyle", true, true); + + const FileType Chart (L"charts", L"chart.xml", + L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", + L"charts/chart", true, true); + + const FileType ChartEx (L"charts", L"chartEx.xml", + L"application/vnd.ms-office.chartex+xml", + L"http://schemas.microsoft.com/office/2014/relationships/chartEx", + L"charts/chartEx", true, true); + + const FileType ChartStyle (L"", L"style.xml", + L"application/vnd.ms-office.chartstyle+xml", + L"http://schemas.microsoft.com/office/2011/relationships/chartStyle", + L"charts/style", true, true); + + const FileType ChartColors (L"", L"colors.xml", + L"application/vnd.ms-office.chartcolorstyle+xml", + L"http://schemas.microsoft.com/office/2011/relationships/chartColorStyle", + L"charts/colors", true, true); + + const FileType ActiveX_xml (L"activeX", L"activeX.xml", + L"application/vnd.ms-office.activeX+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/control", + L"activeX/activeX_xml", true, true); + + const FileType ActiveX_bin (L"", L"activeX.bin", + L"application/vnd.ms-office.activeX", + L"http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary", + L"activeX/activeX_bin", true, true); + + const FileType VbaProject (L"", L"vbaProject.bin", + L"application/vnd.ms-office.vbaProject", + L"http://schemas.microsoft.com/office/2006/relationships/vbaProject"); + + const FileType VbaData (L"", L"vbaData.xml", + L"application/vnd.ms-word.vbaData+xml", + L"http://schemas.microsoft.com/office/2006/relationships/wordVbaData"); + + const FileType JsaProject (L"", L"jsaProject.bin", + L"", + L"http://schemas.onlyoffice.com/jsaProject"); + + const FileType ImportedExternalContent(L"embeddings", L"", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk"); + + const FileType MicrosoftOfficeUnknown(L"embeddings", L"", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + const FileType MicrosoftOfficeExcelWorksheet(L"embeddings", L"Microsoft_Office_Excel_Worksheet.xlsx", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + const FileType MicrosoftOfficeExcel_97_2003_Worksheet(L"embeddings", L"Microsoft_Office_Excel_97-2003_Worksheet.xls", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); + + const FileType MicrosoftOfficeExcelBinaryWorksheet(L"embeddings", L"Microsoft_Office_Excel_Binary_Worksheet.xlsb", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + const FileType MicrosoftOfficeExcelMacro_EnabledWorksheet + (L"embeddings", L"Microsoft_Office_Excel_Macro-Enabled_Worksheet.xlsm", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + const FileType MicrosoftOfficeExcelChart + (L"embeddings", L"Microsoft_Office_Excel_Chart.xlsx", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); + + + const FileType MicrosoftOfficeWordDocument + (L"embeddings", L"Microsoft_Office_Word_Document.docx", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + const FileType MicrosoftOfficeWord_97_2003_Document(L"embeddings", L"Microsoft_Office_Word_97_-_2003_Document.doc", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); + + const FileType MicrosoftOfficeWordMacro_EnabledDocument + (L"embeddings", L"Microsoft_Office_Word_Macro-Enabled_Document.docm", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + + const FileType MicrosoftOfficePowerPointPresentation(L"embeddings", L"Microsoft_Office_PowerPoint_Presentation.pptx", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + const FileType MicrosoftOfficePowerPoint_97_2003_Presentation + (L"embeddings", L"Microsoft_Office_PowerPoint_97-2003_Presentation.xlsx", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); + + const FileType MicrosoftOfficePowerPointMacro_EnabledPresentation + (L"embeddings", L"Microsoft_Office_PowerPoint_Macro-Enabled_Presentation.pptm", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + + const FileType MicrosoftOfficePowerPointSlide + (L"embeddings", L"Microsoft_Office_PowerPoint_Slide.sldx", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + const FileType MicrosoftOfficePowerPointMacro_EnabledSlide + (L"embeddings", L"Microsoft_Office_PowerPoint_Macro-Enabled_Slide.sldm", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); + + const FileType OleObject (L"embeddings", L"oleObject.bin", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); + + const FileType VmlDrawing (L"drawings", L"vmlDrawing.vml", + L"application/vnd.openxmlformats-officedocument.vmlDrawing", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing", + L"drawings/vmlDrawing", true, true); + + const FileType ExternalLinkPath (L"", L"", + L"", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath"); + + const FileType ExternalLinkLibrary (L"", L"", + L"", + L"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlLibrary"); + + const FileType ExternalLinkPathMissing(L"", L"", + L"", + L"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing"); + + const FileType ExternalLinkPathStartup(L"", L"", + L"", + L"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlStartup"); + + const FileType ExternalLinkPathAlternateStartup(L"", L"", + L"", + L"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlAlternateStartup"); + + const FileType LegacyDiagramText (L"", L"legacyDiagramText.bin", + L"", + L"http://schemas.microsoft.com/office/2006/relationships/legacyDiagramText"); + + const FileType GlossaryDocument (L"glossary", L"document.xml", + L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"); + + const FileType Unknow (L"", L"", L"", L""); + + } // namespace FileTypes +} // namespace OOX + diff --git a/Common/DocxFormat/Source/DocxFormat/FileTypes.h b/Common/DocxFormat/Source/DocxFormat/FileTypes.h index 4f82d9c3d5..16db4d240d 100644 --- a/Common/DocxFormat/Source/DocxFormat/FileTypes.h +++ b/Common/DocxFormat/Source/DocxFormat/FileTypes.h @@ -35,353 +35,167 @@ #include "FileType.h" - namespace OOX { namespace FileTypes { - const FileType App (L"docProps", L"app.xml", - L"application/vnd.openxmlformats-officedocument.extended-properties+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"); - - const FileType Core (L"docProps", L"core.xml", - L"application/vnd.openxmlformats-package.core-properties+xml", - L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"); - - const FileType CustomProperties (L"docProps", L"custom.xml", - L"application/vnd.openxmlformats-officedocument.custom-properties+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"); - - const FileType Document (L"word", L"document.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); - - const FileType DocumentMacro (L"word", L"document.xml", - L"application/vnd.ms-word.document.macroEnabled.main+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); - - const FileType DocumentFlat (L"", L"", L"", L""); - - const FileType Theme (L"theme", L"theme.xml", - L"application/vnd.openxmlformats-officedocument.theme+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", - L"theme", true); - - const FileType ThemeOverride (L"themeOverride", L"themeOverride.xml", - L"application/vnd.openxmlformats-officedocument.theme+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride", - L"themeOverride", true); - - const FileType Setting (L"", L"settings.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"); - - const FileType FontTable (L"", L"fontTable.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"); - - const FileType Style (L"", L"styles.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"); - - const FileType Bibliography (L"customXml", L"item.xml", - L"WARNING not implement", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography"); - - const FileType FootNote (L"", L"footnotes.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"); - - const FileType EndNote (L"", L"endnotes.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"); - - const FileType WebSetting (L"", L"webSettings.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"); - - const FileType Header (L"", L"header.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", L"header", true); - - const FileType Footer (L"", L"footer.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", L"footer", true); - - const FileType Numbering (L"", L"numbering.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"); - - const FileType Comments (L"", L"comments.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"); - - const FileType DocumentComments (L"", L"commentsDocument.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", - L"http://schemas.onlyoffice.com/commentsDocument"); - - const FileType CommentsExt (L"", L"commentsExtended.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", - L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended"); - - const FileType DocumentCommentsExt (L"", L"commentsExtendedDocument.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", - L"http://schemas.onlyoffice.com/commentsExtendedDocument"); - - const FileType CommentsExtensible (L"", L"commentsExtensible.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml", - L"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"); - - const FileType DocumentCommentsExtensible (L"", L"commentsExtensibleDocument.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml", - L"http://schemas.onlyoffice.com/commentsExtensibleDocument"); - - const FileType CommentsIds (L"", L"commentsIds.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml", - L"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds"); - - const FileType DocumentCommentsIds (L"", L"commentsIdsDocument.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml", - L"http://schemas.onlyoffice.com/commentsIdsDocument"); - - const FileType CommentsUserData (L"", L"commentsUserData.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml", - L"http://schemas.onlyoffice.com/commentsUserData"); - - const FileType People (L"", L"people.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", - L"http://schemas.microsoft.com/office/2011/relationships/people"); - - const FileType DocumentPeople (L"", L"peopleDocument.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", - L"http://schemas.onlyoffice.com/peopleDocument"); - - const FileType CustomXml (L"customXml", L"item.xml", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", - L"customXml/item", true, true); - - const FileType CustomXmlProps (L"", L"itemProps.xml", - L"application/vnd.openxmlformats-officedocument.customXmlProperties+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", - L"customXml/itemProps", true, true); - - const FileType HyperLink (L"", L"", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"); - - const FileType Image (L"media", L"image", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", L"image", true, true); - - const FileType Audio (L"media", L"audio", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio", L"audio", true, true); - - const FileType Video (L"media", L"video", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", L"video", true, true); - - const FileType Media (L"media", L"media", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/media", L"media", true, true); - - const FileType DiagramData (L"diagrams", L"data.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData", - L"diagrams/data", true, true); - - const FileType DiagramQuickStyle(L"diagrams", L"quickStyle.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.diagramQuickStyle+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle", - L"diagrams/quickStyle", true, true); - - const FileType DiagramLayout (L"diagrams", L"layout.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout", - L"diagrams/layout", true, true); - - const FileType DiagramColors (L"diagrams", L"colors.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors", - L"diagrams/colors", true, true); - - const FileType DiagramDrawing (L"diagrams", L"drawing.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.diagramDrawing+xml", - L"http://schemas.microsoft.com/office/2007/relationships/diagramDrawing", - L"diagrams/drawing", true, true); - - const FileType ChartDrawing (L"drawings", L"drawing.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes", - L"drawings/drawing", true, true); - - const FileType Layout (L"diagrams", L"layout.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout", - L"diagrams/layout", true, true); - - const FileType Colors (L"diagrams", L"colors.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors", - L"diagrams/colors", true, true); - - const FileType QuickStyle (L"diagrams", L"quickStyle.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle", - L"diagrams/quickStyle", true, true); - - const FileType Chart (L"charts", L"chart.xml", - L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", - L"charts/chart", true, true); - - const FileType ChartEx (L"charts", L"chartEx.xml", - L"application/vnd.ms-office.chartex+xml", - L"http://schemas.microsoft.com/office/2014/relationships/chartEx", - L"charts/chartEx", true, true); - - const FileType ChartStyle (L"", L"style.xml", - L"application/vnd.ms-office.chartstyle+xml", - L"http://schemas.microsoft.com/office/2011/relationships/chartStyle", - L"charts/style", true, true); - - const FileType ChartColors (L"", L"colors.xml", - L"application/vnd.ms-office.chartcolorstyle+xml", - L"http://schemas.microsoft.com/office/2011/relationships/chartColorStyle", - L"charts/colors", true, true); - - const FileType ActiveX_xml (L"activeX", L"activeX.xml", - L"application/vnd.ms-office.activeX+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/control", - L"activeX/activeX_xml", true, true); - - const FileType ActiveX_bin (L"", L"activeX.bin", - L"application/vnd.ms-office.activeX", - L"http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary", - L"activeX/activeX_bin", true, true); - - const FileType VbaProject (L"", L"vbaProject.bin", - L"application/vnd.ms-office.vbaProject", - L"http://schemas.microsoft.com/office/2006/relationships/vbaProject"); - - const FileType VbaData (L"", L"vbaData.xml", - L"application/vnd.ms-word.vbaData+xml", - L"http://schemas.microsoft.com/office/2006/relationships/wordVbaData"); - - const FileType JsaProject (L"", L"jsaProject.bin", - L"", - L"http://schemas.onlyoffice.com/jsaProject"); - - const FileType ImportedExternalContent(L"embeddings", L"", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk"); - - const FileType MicrosoftOfficeUnknown(L"embeddings", L"", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - const FileType MicrosoftOfficeExcelWorksheet(L"embeddings", L"Microsoft_Office_Excel_Worksheet.xlsx", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - const FileType MicrosoftOfficeExcel_97_2003_Worksheet(L"embeddings", L"Microsoft_Office_Excel_97-2003_Worksheet.xls", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); - - const FileType MicrosoftOfficeExcelBinaryWorksheet(L"embeddings", L"Microsoft_Office_Excel_Binary_Worksheet.xlsb", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - const FileType MicrosoftOfficeExcelMacro_EnabledWorksheet - (L"embeddings", L"Microsoft_Office_Excel_Macro-Enabled_Worksheet.xlsm", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - const FileType MicrosoftOfficeExcelChart - (L"embeddings", L"Microsoft_Office_Excel_Chart.xlsx", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); - - - const FileType MicrosoftOfficeWordDocument - (L"embeddings", L"Microsoft_Office_Word_Document.docx", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - const FileType MicrosoftOfficeWord_97_2003_Document(L"embeddings", L"Microsoft_Office_Word_97_-_2003_Document.doc", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); - - const FileType MicrosoftOfficeWordMacro_EnabledDocument - (L"embeddings", L"Microsoft_Office_Word_Macro-Enabled_Document.docm", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - - const FileType MicrosoftOfficePowerPointPresentation(L"embeddings", L"Microsoft_Office_PowerPoint_Presentation.pptx", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - const FileType MicrosoftOfficePowerPoint_97_2003_Presentation - (L"embeddings", L"Microsoft_Office_PowerPoint_97-2003_Presentation.xlsx", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); - - const FileType MicrosoftOfficePowerPointMacro_EnabledPresentation - (L"embeddings", L"Microsoft_Office_PowerPoint_Macro-Enabled_Presentation.pptm", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - - const FileType MicrosoftOfficePowerPointSlide - (L"embeddings", L"Microsoft_Office_PowerPoint_Slide.sldx", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - const FileType MicrosoftOfficePowerPointMacro_EnabledSlide - (L"embeddings", L"Microsoft_Office_PowerPoint_Macro-Enabled_Slide.sldm", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"); - - const FileType OleObject (L"embeddings", L"oleObject.bin", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); - - const FileType VmlDrawing (L"drawings", L"vmlDrawing.vml", - L"application/vnd.openxmlformats-officedocument.vmlDrawing", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing", - L"drawings/vmlDrawing", true, true); - - const FileType ExternalLinkPath (L"", L"", - L"", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath"); - - const FileType ExternalLinkLibrary (L"", L"", - L"", - L"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlLibrary"); - - const FileType ExternalLinkPathMissing(L"", L"", - L"", - L"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing"); - - const FileType ExternalLinkPathStartup(L"", L"", - L"", - L"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlStartup"); - - const FileType ExternalLinkPathAlternateStartup(L"", L"", - L"", - L"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlAlternateStartup"); - - const FileType LegacyDiagramText (L"", L"legacyDiagramText.bin", - L"", - L"http://schemas.microsoft.com/office/2006/relationships/legacyDiagramText"); - - const FileType GlossaryDocument (L"glossary", L"document.xml", - L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"); - - const FileType Unknow (L"", L"", L"", L""); + extern const FileType App; + + extern const FileType Core; + + extern const FileType CustomProperties; + + extern const FileType Document; + + extern const FileType DocumentMacro; + + extern const FileType DocumentFlat; + + extern const FileType Theme; + + extern const FileType ThemeOverride; + + extern const FileType Setting; + + extern const FileType FontTable; + + extern const FileType Style; + + extern const FileType Bibliography; + + extern const FileType FootNote; + + extern const FileType EndNote; + + extern const FileType WebSetting; + + extern const FileType Header; + + extern const FileType Footer; + + extern const FileType Numbering; + + extern const FileType Comments; + + extern const FileType DocumentComments; + + extern const FileType CommentsExt; + + extern const FileType DocumentCommentsExt; + + extern const FileType CommentsExtensible; + + extern const FileType DocumentCommentsExtensible; + + extern const FileType CommentsIds; + + extern const FileType DocumentCommentsIds; + + extern const FileType CommentsUserData; + + extern const FileType People; + + extern const FileType DocumentPeople; + + extern const FileType CustomXml; + + extern const FileType CustomXmlProps; + + extern const FileType HyperLink; + + extern const FileType Image; + + extern const FileType Audio; + + extern const FileType Video; + + extern const FileType Media; + + extern const FileType DiagramData; + + extern const FileType DiagramQuickStyle; + + extern const FileType DiagramLayout; + + extern const FileType DiagramColors; + + extern const FileType DiagramDrawing; + + extern const FileType ChartDrawing; + + extern const FileType Layout; + + extern const FileType Colors; + + extern const FileType QuickStyle; + + extern const FileType Chart; + + extern const FileType ChartEx; + + extern const FileType ChartStyle; + + extern const FileType ChartColors; + + extern const FileType ActiveX_xml; + + extern const FileType ActiveX_bin; + + extern const FileType VbaProject; + + extern const FileType VbaData; + + extern const FileType JsaProject; + + extern const FileType ImportedExternalContent; + + extern const FileType MicrosoftOfficeUnknown; + + extern const FileType MicrosoftOfficeExcelWorksheet; + + extern const FileType MicrosoftOfficeExcel_97_2003_Worksheet; + + extern const FileType MicrosoftOfficeExcelBinaryWorksheet; + + extern const FileType MicrosoftOfficeExcelMacro_EnabledWorksheet; + + extern const FileType MicrosoftOfficeExcelChart; + + extern const FileType MicrosoftOfficeWordDocument; + + extern const FileType MicrosoftOfficeWord_97_2003_Document; + + extern const FileType MicrosoftOfficeWordMacro_EnabledDocument; + + extern const FileType MicrosoftOfficePowerPointPresentation; + + extern const FileType MicrosoftOfficePowerPoint_97_2003_Presentation; + + extern const FileType MicrosoftOfficePowerPointMacro_EnabledPresentation; + + extern const FileType MicrosoftOfficePowerPointSlide; + + extern const FileType MicrosoftOfficePowerPointMacro_EnabledSlide; + + extern const FileType OleObject; + + extern const FileType VmlDrawing; + + extern const FileType ExternalLinkPath; + + extern const FileType ExternalLinkLibrary; + + extern const FileType ExternalLinkPathMissing; + + extern const FileType ExternalLinkPathStartup; + + extern const FileType ExternalLinkPathAlternateStartup; + + extern const FileType LegacyDiagramText; + + extern const FileType GlossaryDocument; + + extern const FileType Unknow; } // namespace FileTypes } // namespace OOX diff --git a/Common/DocxFormat/Source/DocxFormat/Font.h b/Common/DocxFormat/Source/DocxFormat/Font.h index 13163314bf..fb062bfc14 100644 --- a/Common/DocxFormat/Source/DocxFormat/Font.h +++ b/Common/DocxFormat/Source/DocxFormat/Font.h @@ -241,21 +241,21 @@ namespace OOX public: - std::wstring m_sName; - nullable> m_oCharset; - nullable> m_oFamily; - nullable> m_oPitch; + std::wstring m_sName; + nullable m_oCharset; + nullable m_oFamily; + nullable m_oPitch; - nullable m_oAltName; - nullable> m_oNotTrueType; - nullable m_oPanose; + nullable m_oAltName; + nullable m_oNotTrueType; + nullable m_oPanose; - nullable> m_oCsb0; - nullable> m_oCsb1; - nullable> m_oUsb0; - nullable> m_oUsb1; - nullable> m_oUsb2; - nullable> m_oUsb3; + nullable m_oCsb0; + nullable m_oCsb1; + nullable m_oUsb0; + nullable m_oUsb1; + nullable m_oUsb2; + nullable m_oUsb3; }; } diff --git a/Common/DocxFormat/Source/DocxFormat/FtnEdn.h b/Common/DocxFormat/Source/DocxFormat/FtnEdn.h index 876fbf512d..c6706eba02 100644 --- a/Common/DocxFormat/Source/DocxFormat/FtnEdn.h +++ b/Common/DocxFormat/Source/DocxFormat/FtnEdn.h @@ -299,8 +299,8 @@ namespace OOX } OOX::EElementType m_eType; // или - nullable > m_oId; - nullable > m_oType; + nullable m_oId; + nullable m_oType; }; //-------------------------------------------------------------------------------- @@ -410,7 +410,7 @@ namespace OOX public: OOX::EElementType m_eType; // или - nullable > m_oId; + nullable m_oId; }; } // namespace OOX diff --git a/Common/DocxFormat/Source/DocxFormat/HeaderFooter.h b/Common/DocxFormat/Source/DocxFormat/HeaderFooter.h index 0359e7812c..dec9d19e7c 100644 --- a/Common/DocxFormat/Source/DocxFormat/HeaderFooter.h +++ b/Common/DocxFormat/Source/DocxFormat/HeaderFooter.h @@ -293,13 +293,13 @@ mc:Ignorable=\"w14 w15 wp14\">"); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:type"), m_oType ) + WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:type"), m_oType ) WritingElement_ReadAttributes_End( oReader ) } //-------------------------------------------------------------------------- CPath m_oReadPath; OOX::EElementType m_eType; - nullable>m_oType; + nullable m_oType; std::vector m_arrItems; }; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Annotations.h b/Common/DocxFormat/Source/DocxFormat/Logic/Annotations.h index aff9300414..fe64497275 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Annotations.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Annotations.h @@ -109,8 +109,8 @@ namespace OOX public: - nullable> m_oDisplacedByCustomXml; - nullable> m_oId; + nullable m_oDisplacedByCustomXml; + nullable m_oId; }; //-------------------------------------------------------------------------------- @@ -169,8 +169,8 @@ namespace OOX public: - nullable> m_oDisplacedByCustomXml; - nullable> m_oId; + nullable m_oDisplacedByCustomXml; + nullable m_oId; }; @@ -230,7 +230,7 @@ namespace OOX public: - nullable> m_oId; + nullable m_oId; }; //-------------------------------------------------------------------------------- @@ -316,7 +316,7 @@ namespace OOX public: nullable m_sAuthor; nullable m_oDate; - nullable> m_oID; + nullable m_oID; nullable m_sUserId; }; @@ -371,7 +371,7 @@ namespace OOX public: - nullable> m_oId; + nullable m_oId; }; //-------------------------------------------------------------------------------- @@ -457,7 +457,7 @@ namespace OOX public: nullable m_sAuthor; nullable m_oDate; - nullable> m_oID; + nullable m_oID; nullable m_sUserId; }; //-------------------------------------------------------------------------------- @@ -509,7 +509,7 @@ namespace OOX } public: - nullable> m_oId; + nullable m_oId; }; //-------------------------------------------------------------------------------- @@ -596,7 +596,7 @@ namespace OOX nullable m_sAuthor; nullable m_oDate; - nullable> m_oID; + nullable m_oID; nullable m_sUserId; }; @@ -649,7 +649,7 @@ namespace OOX } public: - nullable> m_oId; + nullable m_oId; }; //-------------------------------------------------------------------------------- @@ -737,7 +737,7 @@ namespace OOX nullable m_sAuthor; nullable m_oDate; - nullable> m_oID; + nullable m_oID; nullable m_sUserId; }; @@ -795,8 +795,8 @@ namespace OOX public: - nullable> m_oDisplacedByCustomXml; - nullable> m_oId; + nullable m_oDisplacedByCustomXml; + nullable m_oId; }; //-------------------------------------------------------------------------------- @@ -891,14 +891,14 @@ namespace OOX public: - nullable m_sAuthor; - nullable> m_oColFirst; - nullable> m_oColLast; - nullable m_oDate; - nullable> m_oDisplacedByCustomXml; - nullable> m_oId; - nullable m_sName; - nullable m_sUserId; + nullable m_sAuthor; + nullable m_oColFirst; + nullable m_oColLast; + nullable m_oDate; + nullable m_oDisplacedByCustomXml; + nullable m_oId; + nullable m_sName; + nullable m_sUserId; }; //-------------------------------------------------------------------------------- @@ -955,8 +955,8 @@ namespace OOX } public: - nullable> m_oDisplacedByCustomXml; - nullable> m_oId; + nullable m_oDisplacedByCustomXml; + nullable m_oId; }; //-------------------------------------------------------------------------------- @@ -1051,11 +1051,11 @@ namespace OOX public: nullable m_sAuthor; - nullable> m_oColFirst; - nullable> m_oColLast; + nullable m_oColFirst; + nullable m_oColLast; nullable m_oDate; - nullable> m_oDisplacedByCustomXml; - nullable> m_oId; + nullable m_oDisplacedByCustomXml; + nullable m_oId; nullable m_sName; nullable m_sUserId; }; @@ -1100,7 +1100,7 @@ namespace OOX public: nullable m_sAuthor; nullable m_oDate; - nullable> m_oId; + nullable m_oId; nullable m_sUserId; }; @@ -1145,7 +1145,7 @@ namespace OOX nullable m_sAuthor; nullable m_oDate; - nullable> m_oId; + nullable m_oId; nullable m_sUserId; // Childs @@ -1212,8 +1212,8 @@ namespace OOX } public: - nullable> m_oDisplacedByCustomXml; - nullable> m_oId; + nullable m_oDisplacedByCustomXml; + nullable m_oId; }; //-------------------------------------------------------------------------------- @@ -1291,10 +1291,10 @@ namespace OOX } public: - nullable> m_oColFirst; - nullable> m_oColLast; - nullable> m_oDisplacedByCustomXml; - nullable> m_oId; + nullable m_oColFirst; + nullable m_oColLast; + nullable m_oDisplacedByCustomXml; + nullable m_oId; nullable m_sName; }; @@ -1362,7 +1362,7 @@ namespace OOX public: - nullable> m_oDisplacedByCustomXml; + nullable m_oDisplacedByCustomXml; nullable m_sId; }; @@ -1432,11 +1432,11 @@ namespace OOX public: - nullable> m_oColFirst; - nullable> m_oColLast; - nullable> m_oDisplacedByCustomXml; + nullable m_oColFirst; + nullable m_oColLast; + nullable m_oDisplacedByCustomXml; nullable m_sEd; - nullable> m_oEdGrp; + nullable m_oEdGrp; nullable m_sId; }; @@ -1499,7 +1499,7 @@ namespace OOX public: - nullable> m_oType; + nullable m_oType; }; class CIns : public WritingElementWithChilds<> @@ -1545,7 +1545,7 @@ namespace OOX // Attributes nullable m_sAuthor; nullable m_oDate; - nullable> m_oId; + nullable m_oId; nullable m_sUserId; // Childs @@ -1594,7 +1594,7 @@ namespace OOX // Attributes nullable m_sAuthor; nullable m_oDate; - nullable> m_oId; + nullable m_oId; nullable m_sUserId; // Childs diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Bdo.h b/Common/DocxFormat/Source/DocxFormat/Logic/Bdo.h index 56826bb7cf..303fc9bfb0 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Bdo.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Bdo.h @@ -98,7 +98,7 @@ namespace OOX public: // Attributes - SimpleTypes::CDirection m_oVal; + SimpleTypes::CDirection m_oVal; // Childs }; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Dir.h b/Common/DocxFormat/Source/DocxFormat/Logic/Dir.h index 7bff20b163..9965b54856 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Dir.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Dir.h @@ -87,11 +87,11 @@ namespace OOX { // Читаем атрибуты WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), m_oVal ) - WritingElement_ReadAttributes_End( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), m_oVal ) + WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oVal; + nullable m_oVal; // Childs }; } // namespace Logic diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/FldChar.h b/Common/DocxFormat/Source/DocxFormat/Logic/FldChar.h index fddaf7e027..0d76cb2b5c 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/FldChar.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/FldChar.h @@ -149,8 +149,8 @@ namespace ComplexTypes public: - nullable > m_oType; - nullable m_oVal; + nullable m_oType; + nullable m_oVal; }; //-------------------------------------------------------------------------------- @@ -263,8 +263,8 @@ namespace ComplexTypes public: - nullable > m_oType; - nullable m_oVal; + nullable m_oType; + nullable m_oVal; }; //-------------------------------------------------------------------------------- @@ -316,7 +316,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; } // Word @@ -402,10 +402,10 @@ namespace OOX } public: - nullable > m_oChecked; - nullable > m_oDefault; + nullable m_oChecked; + nullable m_oDefault; nullable m_oSize; - nullable > m_oSizeAuto; + nullable m_oSizeAuto; }; @@ -701,10 +701,10 @@ namespace OOX public: - nullable> m_oCalcOnExit; + nullable m_oCalcOnExit; nullable m_oCheckBox; nullable m_oDDList; - nullable> m_oEnabled; + nullable m_oEnabled; nullable m_oEntryMacro; nullable m_oExitMacro; nullable m_oHelpText; @@ -801,18 +801,18 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:dirty", m_oDirty ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:fldCharType", m_oFldCharType ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:fldLock", m_oFldLock ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:dirty", m_oDirty ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:fldCharType", m_oFldCharType ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:fldLock", m_oFldLock ) WritingElement_ReadAttributes_End( oReader ) } public: - nullable > m_oDirty; - nullable > m_oFldCharType; - nullable > m_oFldLock; + nullable m_oDirty; + nullable m_oFldCharType; + nullable m_oFldLock; nullable m_oFFData; }; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/FldSimple.h b/Common/DocxFormat/Source/DocxFormat/Logic/FldSimple.h index 825a8688f3..5d7b7784df 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/FldSimple.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/FldSimple.h @@ -104,11 +104,11 @@ namespace OOX public: - SimpleTypes::COnOff m_oDirty; - SimpleTypes::COnOff m_oFldLock; + SimpleTypes::COnOff m_oDirty; + SimpleTypes::COnOff m_oFldLock; nullable m_sInstr; - nullable m_oFFData; + nullable m_oFFData; }; } // namespace Logic diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Hyperlink.h b/Common/DocxFormat/Source/DocxFormat/Logic/Hyperlink.h index 8df065cce2..b03c9199d6 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Hyperlink.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Hyperlink.h @@ -102,7 +102,7 @@ namespace OOX nullable_string m_sAnchor; nullable_string m_sDestinition; nullable_string m_sDocLocation; - nullable> m_oHistory; + nullable m_oHistory; nullable m_oId; nullable_string m_sTgtFrame; nullable_string m_sTooltip; 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/Paragraph.h b/Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.h index f9f345b96b..53081b0169 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.h @@ -123,14 +123,14 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable > m_oParaId; - nullable > m_oTextId; + nullable m_oParaId; + nullable m_oTextId; - nullable > m_oRsidDel; - nullable > m_oRsidP; - nullable > m_oRsidR; - nullable > m_oRsidRDefault; - nullable > m_oRsidRPr; + nullable m_oRsidDel; + nullable m_oRsidP; + nullable m_oRsidR; + nullable m_oRsidRDefault; + nullable m_oRsidRPr; CParagraphProperty *m_oParagraphProperty; // копия того что в m_arrItems... - для быстрого доступа/анализа // по идее нужно сделать как в Drawing::Paragraph - то есть единственные подобъекты вынести отдельно diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/ParagraphProperty.h b/Common/DocxFormat/Source/DocxFormat/Logic/ParagraphProperty.h index 7b72e91a5c..6efcf4049a 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/ParagraphProperty.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/ParagraphProperty.h @@ -318,12 +318,12 @@ namespace OOX public: - nullable m_sAuthor; - nullable m_oDate; - nullable > m_oId; - nullable m_sUserId; + nullable m_sAuthor; + nullable m_oDate; + nullable m_oId; + nullable m_sUserId; - nullable m_pParPr; + nullable m_pParPr; }; //-------------------------------------------------------------------------------- @@ -472,42 +472,42 @@ namespace OOX //-------------------------------------------------------------------------------------------------------- bool m_bPPrChange; - nullable> m_oAdjustRightInd; - nullable> m_oAutoSpaceDE; - nullable> m_oAutoSpaceDN; - nullable> m_oBidi; + nullable m_oAdjustRightInd; + nullable m_oAutoSpaceDE; + nullable m_oAutoSpaceDN; + nullable m_oBidi; nullable m_oCnfStyle; - nullable> m_oContextualSpacing; + nullable m_oContextualSpacing; nullable m_oDivID; nullable m_oFramePr; nullable m_oInd; nullable m_oJc; - nullable> m_oKeepLines; - nullable> m_oKeepNext; - nullable> m_oKinsoku; - nullable> m_oMirrorIndents; + nullable m_oKeepLines; + nullable m_oKeepNext; + nullable m_oKinsoku; + nullable m_oMirrorIndents; nullable m_oNumPr; nullable m_oOutlineLvl; - nullable> m_oOverflowPunct; - nullable> m_oPageBreakBefore; + nullable m_oOverflowPunct; + nullable m_oPageBreakBefore; nullable m_oPBdr; nullable m_oPPrChange; nullable m_oPStyle; nullable m_oRPr; nullable m_oSectPr; nullable m_oShd; - nullable> m_oSnapToGrid; + nullable m_oSnapToGrid; nullable m_oSpacing; - nullable> m_oSuppressAutoHyphens; - nullable> m_oSuppressLineNumbers; - nullable> m_oSuppressOverlap; + nullable m_oSuppressAutoHyphens; + nullable m_oSuppressLineNumbers; + nullable m_oSuppressOverlap; nullable m_oTabs; nullable m_oTextAlignment; nullable m_oTextboxTightWrap; nullable m_oTextDirection; - nullable> m_oTopLinePunct; - nullable> m_oWidowControl; - nullable> m_oWordWrap; + nullable m_oTopLinePunct; + nullable m_oWidowControl; + nullable m_oWordWrap; }; } // namespace Logic 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/Logic/Run.h b/Common/DocxFormat/Source/DocxFormat/Logic/Run.h index 532f775f3b..8a3ec6afb8 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Run.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Run.h @@ -103,9 +103,9 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable > m_oRsidDel; - nullable > m_oRsidR; - nullable > m_oRsidRPr; + nullable m_oRsidDel; + nullable m_oRsidR; + nullable m_oRsidRPr; OOX::Logic::CRunProperty *m_oRunProperty; // копия того что в m_arrItems... - для быстрого доступа/анализа // по идее нужно сделать как в Drawing::Run - то есть единственные подобъекты вынести отдельно }; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/RunContent.h b/Common/DocxFormat/Source/DocxFormat/Logic/RunContent.h index 4826378194..1acd490cf4 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/RunContent.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/RunContent.h @@ -94,6 +94,9 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { + m_oClear.SetValue(SimpleTypes::brclearNone); + m_oType.SetValue(SimpleTypes::brtypeTextWrapping); + if ( oReader.GetAttributesCount() <= 0 ) return; @@ -119,8 +122,8 @@ namespace OOX public: - SimpleTypes::CBrClear m_oClear; - SimpleTypes::CBrType m_oType; + SimpleTypes::CBrClear m_oClear; + SimpleTypes::CBrType m_oType; }; @@ -348,7 +351,7 @@ namespace OOX public: // Attributes - nullable > m_oSpace; + nullable m_oSpace; // Value std::wstring m_sText; @@ -576,9 +579,9 @@ namespace OOX public: - nullable > m_oAlignment; - nullable > m_oLeader; - nullable> m_oRelativeTo; + nullable m_oAlignment; + nullable m_oLeader; + nullable m_oRelativeTo; }; //-------------------------------------------------------------------------------- @@ -719,8 +722,8 @@ namespace OOX public: - nullable > m_oChar; - nullable m_oFont; + nullable m_oChar; + nullable m_oFont; }; @@ -769,7 +772,7 @@ namespace OOX { return et_w_t; } - static void ReadAttributes(XmlUtils::CXmlLiteReader& oReader, nullable >& oSpace) + static void ReadAttributes(XmlUtils::CXmlLiteReader& oReader, nullable& oSpace) { if ( oReader.GetAttributesCount() <= 0 ) return; @@ -804,7 +807,7 @@ namespace OOX public: // Attributes - nullable > m_oSpace; + nullable m_oSpace; // Value std::wstring m_sText; @@ -1002,7 +1005,7 @@ namespace OOX public: - nullable > m_oId; + nullable m_oId; }; @@ -1113,7 +1116,7 @@ namespace OOX public: // Attributes - nullable > m_oSpace; + nullable m_oSpace; // Value std::wstring m_sText; @@ -1223,8 +1226,8 @@ namespace OOX public: - nullable > m_oCustomMarkFollows; - nullable> m_oId; + nullable m_oCustomMarkFollows; + nullable m_oId; }; @@ -1332,8 +1335,8 @@ namespace OOX public: - nullable > m_oCustomMarkFollows; - nullable> m_oId; + nullable m_oCustomMarkFollows; + nullable m_oId; }; @@ -1414,7 +1417,7 @@ namespace OOX public: // Attributes - nullable > m_oSpace; + nullable m_oSpace; // Value std::wstring m_sText; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/RunProperty.h b/Common/DocxFormat/Source/DocxFormat/Logic/RunProperty.h index ed77e1cfa1..e1e2a46345 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/RunProperty.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/RunProperty.h @@ -92,7 +92,7 @@ namespace OOX nullable m_sAuthor; nullable m_oDate; - nullable> m_oId; + nullable m_oId; nullable m_sUserId; nullable m_pRunPr; @@ -161,50 +161,50 @@ namespace OOX bool m_bRPRChange = false; // Является ли данный w:rPr дочерним по отношению к w:rPrChange - nullable> m_oBold; - nullable> m_oBoldCs; + nullable m_oBold; + nullable m_oBoldCs; nullable m_oBdr; - nullable> m_oCaps; + nullable m_oCaps; nullable m_oColor; - nullable> m_oCs; + nullable m_oCs; nullable m_oDel; - nullable> m_oDStrike; + nullable m_oDStrike; nullable m_oEastAsianLayout; nullable m_oEffect; nullable m_oEm; - nullable> m_oEmboss; + nullable m_oEmboss; nullable m_oFitText; nullable m_oHighlight; nullable m_oIns; - nullable> m_oItalic; - nullable> m_oItalicCs; - nullable> m_oImprint; + nullable m_oItalic; + nullable m_oItalicCs; + nullable m_oImprint; nullable m_oKern; nullable m_oLang; - nullable> m_oNoProof; - nullable> m_oMath; + nullable m_oNoProof; + nullable m_oMath; nullable m_oMoveFrom; nullable m_oMoveTo; - nullable> m_oOutline; + nullable m_oOutline; nullable m_oPosition; nullable m_oRFonts; nullable m_oRPrChange; nullable m_oRStyle; - nullable> m_oRtL; - nullable> m_oShadow; + nullable m_oRtL; + nullable m_oShadow; nullable m_oShd; - nullable> m_oSmallCaps; - nullable> m_oSnapToGrid; + nullable m_oSmallCaps; + nullable m_oSnapToGrid; nullable m_oSpacing; - nullable> m_oSpecVanish; - nullable> m_oStrike; + nullable m_oSpecVanish; + nullable m_oStrike; nullable m_oSz; nullable m_oSzCs; nullable m_oU; - nullable> m_oVanish; + nullable m_oVanish; nullable m_oVertAlign; nullable m_oW; - nullable> m_oWebHidden; + nullable m_oWebHidden; //ext PPTX::Logic::UniFill m_oTextFill; nullable m_oTextOutline; @@ -212,7 +212,7 @@ namespace OOX nullable m_oNumSpacing; nullable m_oNumForm; nullable m_oStylisticSets; - nullable> m_oCntxtAlts; + nullable m_oCntxtAlts; nullable m_oReflection; nullable m_oGlow; nullable m_oShadowExt; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Sdt.h b/Common/DocxFormat/Source/DocxFormat/Logic/Sdt.h index 6006f87347..6478e82aac 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Sdt.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Sdt.h @@ -208,6 +208,8 @@ namespace ComplexTypes void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { + m_oVal.SetValue(SimpleTypes::calendartypeGregorian); + WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) WritingElement_ReadAttributes_End( oReader ) @@ -215,7 +217,7 @@ namespace ComplexTypes public: - SimpleTypes::CCalendarType m_oVal; + SimpleTypes::CCalendarType m_oVal; }; //-------------------------------------------------------------------------------- @@ -259,7 +261,7 @@ namespace ComplexTypes public: - SimpleTypes::CSdtDateMappingType m_oVal; + SimpleTypes::CSdtDateMappingType m_oVal; }; //-------------------------------------------------------------------------------- @@ -304,7 +306,7 @@ namespace ComplexTypes public: - SimpleTypes::CLock m_oVal; + SimpleTypes::CLock m_oVal; }; //-------------------------------------------------------------------------------- @@ -353,7 +355,7 @@ namespace ComplexTypes public: - nullable> m_oMultiLine; + nullable m_oMultiLine; }; //-------------------------------------------------------------------------------- // SdtAppearance 2.5.4.2 ([MS-DOCX]) @@ -401,7 +403,7 @@ namespace ComplexTypes public: - nullable> m_oVal; + nullable m_oVal; }; //Not from specification @@ -424,7 +426,7 @@ namespace ComplexTypes void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oWRule; + nullable m_oWRule; nullable_int m_oWidth; nullable_string m_oSym; nullable_string m_oFont; @@ -449,7 +451,7 @@ namespace ComplexTypes void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oType; + nullable m_oType; nullable_string m_oVal; nullable_string m_oSymbols; }; @@ -531,7 +533,7 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oType; + nullable m_oType; }; //-------------------------------------------------------------------------------- @@ -808,7 +810,7 @@ namespace OOX nullable m_oDocPartCategory; nullable m_oDocPartGallery; - nullable> m_oDocPartUnique; + nullable m_oDocPartUnique; }; //-------------------------------------------------------------------------------- @@ -1076,8 +1078,8 @@ namespace OOX } public: - nullable > m_oVal; - nullable m_oFont; + nullable m_oVal; + nullable m_oFont; }; class CSdtCheckBox : public WritingElement @@ -1100,7 +1102,7 @@ namespace OOX } public: - nullable> m_oChecked; + nullable m_oChecked; nullable m_oCheckedState; nullable m_oUncheckedState; @@ -1200,10 +1202,10 @@ namespace OOX nullable m_oLock; nullable m_oPlaceHolder; nullable m_oRPr; - nullable> m_oShowingPlcHdr; + nullable m_oShowingPlcHdr; nullable m_oTabIndex; nullable m_oTag; - nullable> m_oTemporary; + nullable m_oTemporary; nullable m_oText; nullable m_oCheckbox; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h b/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h index 425c52c3c0..353e38837a 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h @@ -157,9 +157,9 @@ namespace ComplexTypes WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oCharSpace; - nullable> m_oLinePitch; - nullable> m_oType; + nullable m_oCharSpace; + nullable m_oLinePitch; + nullable m_oType; }; //-------------------------------------------------------------------------------- @@ -219,8 +219,8 @@ namespace ComplexTypes public: - nullable m_oId; - nullable> m_oType; + nullable m_oId; + nullable m_oType; }; @@ -301,10 +301,10 @@ namespace ComplexTypes public: - nullable > m_oCountBy; + nullable m_oCountBy; nullable m_oDistance; - nullable> m_oRestart; - nullable > m_oStart; + nullable m_oRestart; + nullable m_oStart; }; @@ -367,8 +367,8 @@ namespace ComplexTypes public: - nullable > m_oFirst; - nullable > m_oOther; + nullable m_oFirst; + nullable m_oOther; }; @@ -507,16 +507,16 @@ namespace ComplexTypes public: - nullable > m_oColor; - nullable > m_oFrame; + nullable m_oColor; + nullable m_oFrame; nullable m_oId; - nullable > m_oShadow; - nullable > m_oSpace; - nullable > m_oSz; - nullable > m_oThemeColor; - nullable > m_oThemeShade; - nullable > m_oThemeTint; - nullable > m_oVal; + nullable m_oShadow; + nullable m_oSpace; + nullable m_oSz; + nullable m_oThemeColor; + nullable m_oThemeShade; + nullable m_oThemeTint; + nullable m_oVal; }; //-------------------------------------------------------------------------------- @@ -1000,10 +1000,10 @@ namespace ComplexTypes public: - nullable > m_oChapSep; - nullable > m_oChapStyle; - nullable > m_oFmt; - nullable > m_oStart; + nullable m_oChapSep; + nullable m_oChapStyle; + nullable m_oFmt; + nullable m_oStart; }; @@ -1083,9 +1083,9 @@ namespace ComplexTypes public: - nullable > m_oCode; + nullable m_oCode; nullable m_oH; - nullable > m_oOrient; + nullable m_oOrient; nullable m_oW; }; @@ -1141,7 +1141,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; @@ -1279,9 +1279,9 @@ namespace OOX public: - nullable > m_oEqualWidth; - nullable > m_oNum; - nullable > m_oSep; + nullable m_oEqualWidth; + nullable m_oNum; + nullable m_oSep; nullable m_oSpace; std::vector m_arrColumns; @@ -1622,9 +1622,9 @@ namespace OOX public: // Attributes - nullable > m_oDisplay; - nullable > m_oOffsetFrom; - nullable > m_oZOrder; + nullable m_oDisplay; + nullable m_oOffsetFrom; + nullable m_oZOrder; // Childs nullable m_oBottom; @@ -1657,10 +1657,10 @@ namespace OOX public: // Attributes - nullable m_sAuthor; + nullable m_sAuthor; nullable m_oDate; - nullable > m_oId; - nullable m_sUserId; + nullable m_oId; + nullable m_sUserId; // Childs nullable m_pSecPr; @@ -1738,31 +1738,31 @@ namespace OOX public: bool m_bSectPrChange; - nullable > m_oRsidDel; - nullable > m_oRsidR; - nullable > m_oRsidRPr; - nullable > m_oRsidSect; + nullable m_oRsidDel; + nullable m_oRsidR; + nullable m_oRsidRPr; + nullable m_oRsidSect; - nullable> m_oBidi; + nullable m_oBidi; nullable m_oCols; nullable m_oDocGrid; nullable m_oEndnotePr; std::vector m_arrFooterReference; nullable m_oFootnotePr; - nullable> m_oFormProt; + nullable m_oFormProt; std::vector m_arrHeaderReference; nullable m_oLnNumType; - nullable> m_oNoEndnote; + nullable m_oNoEndnote; nullable m_oPaperSrc; nullable m_oPgBorders; nullable m_oPgMar; nullable m_oPgNumType; nullable m_oPgSz; nullable m_oPrinterSettings; - nullable> m_oRtlGutter; + nullable m_oRtlGutter; nullable m_oSectPrChange; nullable m_oTextDirection; - nullable > m_oTitlePg; + nullable m_oTitlePg; nullable m_oType; nullable m_oVAlign; }; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Table.h b/Common/DocxFormat/Source/DocxFormat/Logic/Table.h index ff66ea49a6..08074a5c73 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Table.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Table.h @@ -130,9 +130,9 @@ namespace OOX public: - nullable > m_oId; + nullable m_oId; - CTblGrid *m_pTblGrid; + CTblGrid *m_pTblGrid; }; //-------------------------------------------------------------------------------- // CTblGrid 17.4.49 (Part 1) @@ -273,13 +273,13 @@ namespace OOX public: // Attributes - nullable m_sAuthor; - nullable m_oDate; - nullable > m_oId; - nullable m_sUserId; + nullable m_sAuthor; + nullable m_oDate; + nullable m_oId; + nullable m_sUserId; // Childs - nullable m_pTblPrEx; + nullable m_pTblPrEx; }; //-------------------------------------------------------------------------------- // CTblPrEx 17.4.61 (Part 1) @@ -527,10 +527,10 @@ namespace OOX public: int m_nCountCell; - nullable > m_oRsidDel; - nullable > m_oRsidR; - nullable > m_oRsidRPr; - nullable > m_oRsidTr; + nullable m_oRsidDel; + nullable m_oRsidR; + nullable m_oRsidRPr; + nullable m_oRsidTr; // Childs OOX::Logic::CTableRowProperties* m_pTableRowProperties; //todooo - выкинуть из m_arrItems, переделать на nullable<> diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h b/Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h index 6a8557d950..bc8707712a 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/TableProperty.h @@ -92,7 +92,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // TblLayoutType 17.4.54 (Part 1) @@ -144,7 +144,7 @@ namespace ComplexTypes public: - nullable > m_oType; + nullable m_oType; }; //-------------------------------------------------------------------------------- // TblLook 17.4.56 (Part 1) + 9.3.11 (Part 4) @@ -362,13 +362,13 @@ namespace ComplexTypes } public: - nullable > m_oFirstColumn; - nullable > m_oFirstRow; - nullable > m_oLastColumn; - nullable > m_oLastRow; - nullable > m_oNoHBand; - nullable > m_oNoVBand; - nullable > m_oVal; + nullable m_oFirstColumn; + nullable m_oFirstRow; + nullable m_oLastColumn; + nullable m_oLastRow; + nullable m_oNoHBand; + nullable m_oNoVBand; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // TblOverlap 17.4.56 (Part 1) @@ -411,7 +411,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // TblPPr 17.4.58 (Part 1) @@ -582,15 +582,15 @@ namespace ComplexTypes public: nullable m_oBottomFromText; - nullable > m_oHorzAnchor; + nullable m_oHorzAnchor; nullable m_oLeftFromText; nullable m_oRightFromText; nullable m_oTblpX; - nullable > m_oTblpXSpec; + nullable m_oTblpXSpec; nullable m_oTblpY; - nullable > m_oTblpYSpec; + nullable m_oTblpYSpec; nullable m_oTopFromText; - nullable > m_oVertAnchor; + nullable m_oVertAnchor; }; } // Word @@ -917,12 +917,12 @@ namespace OOX public: - nullable m_sAuthor; - nullable m_oDate; - nullable > m_oId; - nullable m_sUserId; + nullable m_sAuthor; + nullable m_oDate; + nullable m_oId; + nullable m_sUserId; - nullable m_pTblPr; + nullable m_pTblPr; }; //-------------------------------------------------------------------------------- // CTableProperty @@ -1108,7 +1108,7 @@ namespace OOX bool m_bTblPrChange; - nullable > m_oBidiVisual; + nullable m_oBidiVisual; nullable m_oJc; nullable m_oShade; nullable m_oTblBorders; @@ -1184,8 +1184,8 @@ namespace ComplexTypes public: - nullable > m_oHRule; - nullable m_oVal; + nullable m_oHRule; + nullable m_oVal; }; } // Word @@ -1222,13 +1222,13 @@ namespace OOX public: // Attributes - nullable m_sAuthor; - nullable m_oDate; - nullable > m_oId; - nullable m_sUserId; + nullable m_sAuthor; + nullable m_oDate; + nullable m_oId; + nullable m_sUserId; // Childs - nullable m_pTrPr; + nullable m_pTrPr; }; //-------------------------------------------------------------------------------- // CTableRowProperties @@ -1393,17 +1393,17 @@ namespace OOX bool m_bTrPrChange; - nullable > m_oCantSplit; + nullable m_oCantSplit; nullable m_oCnfStyle; nullable m_oDel; nullable m_oDivId; nullable m_oGridAfter; nullable m_oGridBefore; - nullable > m_oHidden; + nullable m_oHidden; nullable m_oIns; nullable m_oJc; nullable m_oTblCellSpacing; - nullable > m_oTblHeader; + nullable m_oTblHeader; nullable m_oTblHeight; nullable m_oTrPrChange; nullable m_oWAfter; @@ -1489,12 +1489,12 @@ namespace ComplexTypes public: - nullable m_sAuthor; + nullable m_sAuthor; nullable m_oDate; - nullable > m_oId; - nullable > m_oVMerge; - nullable > m_oVMergeOrig; - nullable m_sUserId; + nullable m_oId; + nullable m_oVMerge; + nullable m_oVMergeOrig; + nullable m_sUserId; }; //-------------------------------------------------------------------------------- @@ -1542,7 +1542,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; @@ -1591,7 +1591,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; @@ -1925,8 +1925,8 @@ namespace OOX nullable m_sAuthor; nullable m_oDate; - nullable > m_oId; - nullable m_sUserId; + nullable m_oId; + nullable m_sUserId; nullable m_pTcPr; }; @@ -2133,12 +2133,12 @@ namespace OOX nullable m_oCnfStyle; nullable m_oGridSpan; nullable m_oHeaders; - nullable > m_oHideMark; + nullable m_oHideMark; nullable m_oHMerge; - nullable > m_oNoWrap; + nullable m_oNoWrap; nullable m_oShd; nullable m_oTcBorders; - nullable > m_oTcFitText; + nullable m_oTcFitText; nullable m_oTcMar; nullable m_oTcPrChange; nullable m_oTcW; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp b/Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp index 44602117c5..5d2e8f5235 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp @@ -1211,6 +1211,7 @@ namespace OOX void CFill::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { std::wstring sColors; + // Читаем атрибуты if ( oReader.GetAttributesCount() <= 0 ) return; @@ -1363,8 +1364,9 @@ namespace OOX return sResult; } + void CStroke::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { + { if ( oReader.GetAttributesCount() <= 0 ) return; @@ -2047,7 +2049,7 @@ namespace OOX } } void CShapeDefaults::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { + { if ( oReader.GetAttributesCount() <= 0 ) return; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Vml.h b/Common/DocxFormat/Source/DocxFormat/Logic/Vml.h index b23c0578fd..81ec393d78 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Vml.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Vml.h @@ -103,34 +103,34 @@ namespace OOX nullable_bool m_oHrStd; nullable_bool m_oHrNoShade; nullable_double m_oHrPct; - nullable> m_oHrAlign; + nullable m_oHrAlign; nullable_bool m_oAllowInCell; nullable_bool m_oAllowOverlap; nullable_bool m_oUserDrawn; - nullable> m_oBorderTopColor; - nullable> m_oBorderLeftColor; - nullable> m_oBorderBottomColor; - nullable> m_oBorderRightColor; - nullable> m_oDgmLayout; + nullable m_oBorderTopColor; + nullable m_oBorderLeftColor; + nullable m_oBorderBottomColor; + nullable m_oBorderRightColor; + nullable m_oDgmLayout; nullable_string m_oDgmNodeKind; - nullable> m_oDgmLayoutMru; - nullable> m_oInsetMode; + nullable m_oDgmLayoutMru; + nullable m_oInsetMode; // 2 AG_AllShapeAttributes // 2.1 AG_ShapeAttributes - nullable> m_oChromaKey; - nullable> m_oFilled; - nullable> m_oFillColor; + nullable m_oChromaKey; + nullable m_oFilled; + nullable m_oFillColor; nullable m_oOpacity; - nullable> m_oStroked; - nullable> m_oStrokeColor; + nullable m_oStroked; + nullable m_oStrokeColor; nullable m_oStrokeWeight; - nullable> m_oInsetPen; + nullable m_oInsetPen; // 2.2 AG_OfficeShapeAttributes - nullable> m_oSpt; - nullable> m_oConnectorType; - nullable> m_oBwMode; - nullable> m_oBwPure; - nullable> m_oBwNormal; + nullable m_oSpt; + nullable m_oConnectorType; + nullable m_oBwMode; + nullable m_oBwPure; + nullable m_oBwNormal; nullable_bool m_oForceDash; nullable_bool m_oOleIcon; nullable_bool m_oOle; @@ -226,8 +226,8 @@ namespace OOX } public: - SimpleTypes::CDecimalNumber<90> m_oEndAngle; - SimpleTypes::CDecimalNumber<0> m_oStartAngle; + SimpleTypes::CDecimalNumber m_oEndAngle = 90; + SimpleTypes::CDecimalNumber m_oStartAngle; }; //-------------------------------------------------------------------------------- // CCurve 14.1.2.3 (Part4) @@ -430,41 +430,42 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: typedef struct TIntermediateColor { - double dValue; - SimpleTypes::CColorType<> oColor; + double dValue; + SimpleTypes::CColorType oColor; }TIntermediateColor; - nullable> m_oAlignShape; + nullable m_oAlignShape; nullable_string m_sAltHref; - nullable> m_oAngle; - nullable> m_oAspect; - nullable> m_oColor; - nullable> m_oColor2; + nullable m_oAngle; + nullable m_oAspect; + nullable m_oColor; + nullable m_oColor2; std::vector m_arrColors; - nullable> m_oDetectMouseClick; + nullable m_oDetectMouseClick; nullable m_oFocus; nullable m_oFocusPosition; nullable m_oFocusSize; nullable_string m_sHref; nullable m_rId; nullable_string m_sId; - nullable> m_oMethod; - nullable> m_oOn; + nullable m_oMethod; + nullable m_oOn; nullable m_oOpacity; nullable m_oOpacity2; nullable m_oOrigin; nullable m_oPosition; - nullable> m_oRecolor; + nullable m_oRecolor; nullable m_oRelId; - nullable> m_oRotate; + nullable m_oRotate; nullable m_oSize; nullable_string m_sSrc; nullable_string m_sTitle; - SimpleTypes::CFillType m_oType; + SimpleTypes::CFillType m_oType; nullable m_oFill; @@ -527,7 +528,7 @@ namespace OOX public: // Attributes - nullable> m_oTargetScreenSize; + nullable m_oTargetScreenSize; }; //-------------------------------------------------------------------------------- @@ -626,18 +627,18 @@ namespace OOX } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: // Attributes - SimpleTypes::CTrueFalse m_oInvX; - SimpleTypes::CTrueFalse m_oInvY; + SimpleTypes::CTrueFalse m_oInvX; + SimpleTypes::CTrueFalse m_oInvY; SimpleTypes::Vml::CVml_Vector2D m_oMap; nullable m_oPolar; SimpleTypes::Vml::CVml_Vector2D_Position m_oPosition; SimpleTypes::Vml::CVml_Vector2D m_oRadiusRange; - SimpleTypes::CTrueFalse m_oSwitch; + SimpleTypes::CTrueFalse m_oSwitch; SimpleTypes::Vml::CVml_Vector2D m_oXRange; SimpleTypes::Vml::CVml_Vector2D m_oYRange; }; @@ -738,8 +739,8 @@ namespace OOX nullable_double m_pGain; nullable_double m_pBlackLevel; nullable_double m_pGamma; - nullable> m_pGrayscale; - nullable> m_pBiLevel; + nullable m_pGrayscale; + nullable m_pBiLevel; }; //-------------------------------------------------------------------------------- // CImageData 14.1.2.11 (Part4) @@ -775,19 +776,19 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable_string m_sAltHref; - nullable> m_oBiLevel; - nullable_double m_oBlackLevel; - nullable> m_oChromaKey; + nullable_string m_sAltHref; + nullable m_oBiLevel; + nullable_double m_oBlackLevel; + nullable m_oChromaKey; nullable m_oCropLeft; nullable m_oCropTop; nullable m_oCropRight; nullable m_oCropBottom; - nullable> m_oDetectMouseClick; - nullable> m_oEmbossColor; + nullable m_oDetectMouseClick; + nullable m_oEmbossColor; nullable_double m_oGain; nullable_double m_oGamma; - nullable> m_oGrayscale; + nullable m_oGrayscale; nullable m_rHref; nullable_string m_oHref; nullable m_rId; @@ -795,7 +796,7 @@ namespace OOX nullable_double m_oMovie; nullable_string m_oOleId; nullable m_rPict; - nullable> m_oRecolorTarget; + nullable m_oRecolorTarget; nullable m_oRelId; nullable_string m_sSrc; nullable_string m_sTitle; @@ -959,23 +960,23 @@ namespace OOX } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - nullable> m_oArrowOk; + nullable m_oArrowOk; nullable_string m_oConnectAngles; nullable_string m_oConnectLocs; - nullable>m_oConnectType; - nullable> m_oExtrusionOk; - nullable> m_oFillOk; - nullable> m_oGradientShapeOk; + nullable m_oConnectType; + nullable m_oExtrusionOk; + nullable m_oFillOk; + nullable m_oGradientShapeOk; nullable_string m_oId; - nullable> m_oInsetPenOk; + nullable m_oInsetPenOk; nullable m_oLimo; - nullable> m_oShadowOk; - nullable> m_oStrokeOk; + nullable m_oShadowOk; + nullable m_oStrokeOk; nullable m_oTextBoxRect; - nullable> m_oTextPathOk; + nullable m_oTextPathOk; nullable m_oV; }; //-------------------------------------------------------------------------------- @@ -1295,17 +1296,17 @@ namespace OOX } public: - SimpleTypes::CColorType m_oColor; - SimpleTypes::CColorType m_oColor2; + SimpleTypes::CColorType m_oColor = SimpleTypes::colortypeRGB; + SimpleTypes::CColorType m_oColor2 = SimpleTypes::colortypeRGB; nullable_string m_oId; nullable m_oMatrix; - SimpleTypes::CTrueFalse m_oObscured; + SimpleTypes::CTrueFalse m_oObscured; SimpleTypes::Vml::CVml_Vector2D_Units_Or_Percentage m_oOffset; SimpleTypes::Vml::CVml_Vector2D_Units_Or_Percentage m_oOffset2; - SimpleTypes::CTrueFalse m_oOn; + SimpleTypes::CTrueFalse m_oOn = SimpleTypes::booleanTrue; nullable m_oOpacity; SimpleTypes::Vml::CVml_Vector2D_Percentage m_oOrigin; - SimpleTypes::CShadowType m_oType; + SimpleTypes::CShadowType m_oType; }; //-------------------------------------------------------------------------------- // CShapeType 14.1.2.20 (Part4) @@ -1491,22 +1492,22 @@ namespace OOX } - nullable> m_oObjectType; + nullable m_oObjectType; nullable_bool m_oMoveWithCells; nullable_bool m_oSizeWithCells; nullable_string m_oAnchor; - nullable> m_oRow; - nullable> m_oColumn; - nullable> m_oMin; - nullable> m_oMax; - nullable> m_oInc; - nullable> m_oDx; - nullable> m_oPage; - nullable> m_oDropLines; - nullable> m_oSel; - nullable> m_oWidthMin; - nullable> m_oDropStyle; + nullable m_oRow; + nullable m_oColumn; + nullable m_oMin; + nullable m_oMax; + nullable m_oInc; + nullable m_oDx; + nullable m_oPage; + nullable m_oDropLines; + nullable m_oSel; + nullable m_oWidthMin; + nullable m_oDropStyle; nullable_bool m_oFirstButton; nullable_bool m_oDefaultSize; nullable_bool m_oAutoFill; @@ -1528,12 +1529,12 @@ namespace OOX nullable_string m_oFmlaTxbx; nullable_string m_oFmlaGroup; nullable_string m_oCf; - nullable> m_oChecked; + nullable m_oChecked; nullable_string m_oMultiSel; - nullable> m_oSelType; + nullable m_oSelType; nullable_int m_oVal; - nullable> m_oTextHAlign; - nullable>m_oTextVAlign; + nullablem_oTextHAlign; + nullable m_oTextVAlign; nullable_bool m_oVisible; //x:Accel @@ -1613,34 +1614,35 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable_string m_oId; nullable_string m_sAltHref; - nullable> m_oColor; - nullable> m_oColor2; - nullable>m_oDahsStyle; - nullable> m_oEndArrow; - nullable>m_oEndArrowLength; - nullable>m_oEndArrowWidth; - nullable> m_oEndCap; - nullable> m_oFillType; - nullable> m_oForceDash; + nullable m_oColor; + nullable m_oColor2; + nullable m_oDahsStyle; + nullable m_oEndArrow; + nullable m_oEndArrowLength; + nullable m_oEndArrowWidth; + nullable m_oEndCap; + nullable m_oFillType; + nullable m_oForceDash; nullable_string m_sHref; nullable m_rId; - nullable> m_oImageAlignShape; - nullable> m_oImageAspect; + nullable m_oImageAlignShape; + nullable m_oImageAspect; nullable m_oImageSize; - nullable> m_oInsetPen; - nullable> m_oJoinStyle; - nullable> m_oLineStyle; - nullable> m_oMiterLimit; - nullable> m_oOn; + nullable m_oInsetPen; + nullable m_oJoinStyle; + nullable m_oLineStyle; + nullable m_oMiterLimit; + nullable m_oOn; nullable_double m_oOpacity; nullable m_oRelId; nullable_string m_sSrc; - nullable> m_oStartArrow; - nullable> m_oStartArrowLength; - nullable>m_oStartArrowWidth; + nullable m_oStartArrow; + nullable m_oStartArrowLength; + nullable m_oStartArrowWidth; nullable_string m_sTitle; nullable_double m_oWeight; @@ -1677,12 +1679,13 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable_string m_oId; nullable m_oStyle; nullable m_oInset; - SimpleTypes::CTrueFalse m_oSingleClick; - SimpleTypes::CInsetMode m_oInsetMode; + SimpleTypes::CTrueFalse m_oSingleClick; + SimpleTypes::CInsetMode m_oInsetMode = SimpleTypes::insetmodeCustom; nullable m_oTxtbxContent; nullable_string m_oText; //m_arDivs; @@ -1792,14 +1795,14 @@ namespace OOX } public: - nullable> m_oFitPath; - nullable> m_oFitShape; + nullable m_oFitPath; + nullable m_oFitShape; nullable_string m_oId; - nullable> m_oOn; + nullable m_oOn; nullable_string m_sString; nullable m_oStyle; - nullable> m_oTrim; - nullable> m_oXScale; + nullable m_oTrim; + nullable m_oXScale; nullable_string m_sStringOriginal; }; @@ -1831,9 +1834,9 @@ namespace OOX std::vector m_arrShapeTypes; std::vector m_arrElements; - nullable> m_oEditAs; + nullable m_oEditAs; nullable m_oTableLimits; - SimpleTypes::Vml::CVml_TableProperties<0> m_oTableProperties; + SimpleTypes::Vml::CVml_TableProperties m_oTableProperties; }; } // namespace Vml } // namespace OOX @@ -1869,27 +1872,28 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: - SimpleTypes::CTrueFalse m_oAllowInCell; - nullable> m_oExt; - SimpleTypes::CTrueFalse m_oFill; - nullable> m_oFillColor; - SimpleTypes::CDecimalNumber<0> m_oSpIdMax; - SimpleTypes::CTrueFalse m_oStroke; - SimpleTypes::CColorType m_oStrokeColor; - nullable m_oStyle; + SimpleTypes::CTrueFalse m_oAllowInCell; + nullable m_oExt; + SimpleTypes::CTrueFalse m_oFill = SimpleTypes::booleanTrue; + nullable m_oFillColor; + SimpleTypes::CDecimalNumber m_oSpIdMax; + SimpleTypes::CTrueFalse m_oStroke = SimpleTypes::booleanTrue; + SimpleTypes::CColorType m_oStrokeColor; + nullable m_oStyle; - nullable m_oVmlFill; - nullable m_oVmlStroke; - nullable m_oVmlTextbox; - nullable m_oVmlShadow; + nullable m_oVmlFill; + nullable m_oVmlStroke; + nullable m_oVmlTextbox; + nullable m_oVmlShadow; - nullable m_oSkew; - nullable m_oExtrusion; - nullable m_oCallout; - nullable m_oLock; - nullable m_oColorMru; - nullable m_oColorMenu; + nullable m_oSkew; + nullable m_oExtrusion; + nullable m_oCallout; + nullable m_oLock; + nullable m_oColorMru; + nullable m_oColorMenu; }; } // VmlOffice } // namespace OOX diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/VmlOfficeDrawing.h b/Common/DocxFormat/Source/DocxFormat/Logic/VmlOfficeDrawing.h index 6e89d33cc8..025b028bc5 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/VmlOfficeDrawing.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/VmlOfficeDrawing.h @@ -183,30 +183,30 @@ namespace OOX EElementType m_eType; nullable m_sAlthref; - nullable> m_oColor; - nullable> m_oColor2; - nullable> m_oDashStyle; - nullable> m_oEndArrow; - nullable> m_oEndArrowLength; - nullable> m_oEndArrowWidth; - nullable> m_oEndCap; - nullable> m_oExt; - nullable> m_oFillType; - nullable> m_oForceDash; + nullable m_oColor; + nullable m_oColor2; + nullable m_oDashStyle; + nullable m_oEndArrow; + nullable m_oEndArrowLength; + nullable m_oEndArrowWidth; + nullable m_oEndCap; + nullable m_oExt; + nullable m_oFillType; + nullable m_oForceDash; nullable m_sHref; - nullable> m_oImageAlignShape; - nullable> m_oImageAspect; + nullable m_oImageAlignShape; + nullable m_oImageAspect; nullable m_sImageSize; - nullable> m_oInsetPen; - nullable> m_oJoinStyle; - nullable> m_oLineStyle; - nullable> m_oMiterLimit; - nullable> m_oOn; + nullable m_oInsetPen; + nullable m_oJoinStyle; + nullable m_oLineStyle; + nullable m_oMiterLimit; + nullable m_oOn; nullable m_sOpacity; nullable m_sSrc; - nullable> m_oStartArrow; - nullable> m_oStartArrowLength; - nullable> m_oStartArrowWidth; + nullable m_oStartArrow; + nullable m_oStartArrowLength; + nullable m_oStartArrowWidth; nullable m_sTitle; nullable m_sWeight; @@ -287,20 +287,20 @@ namespace OOX } public: - nullable> m_oAccentbar; - nullable> m_oAngle; + nullable m_oAccentbar; + nullable m_oAngle; nullable m_oDistance; nullable m_oDrop; - nullable> m_oDropAuto; - nullable> m_oExt; + nullable m_oDropAuto; + nullable m_oExt; nullable m_oGap; nullable m_oLength; - nullable> m_oLengthSpecified; - nullable> m_oMinusX; - nullable> m_oMinusY; - nullable> m_oOn; - nullable> m_oTextBorder; - nullable> m_oType; + nullable m_oLengthSpecified; + nullable m_oMinusX; + nullable m_oMinusY; + nullable m_oOn; + nullable m_oTextBorder; + nullable m_oType; }; //-------------------------------------------------------------------------------- // CClipPath 14.2.2.3 (Part 4) @@ -410,11 +410,11 @@ namespace OOX } public: - nullable> m_oExt; - SimpleTypes::CColorType m_oExtrusionColor; - SimpleTypes::CColorType m_oFillColor; - SimpleTypes::CColorType m_oShadowColor; - SimpleTypes::CColorType m_oStrokeColor; + nullable m_oExt; + SimpleTypes::CColorType m_oExtrusionColor = SimpleTypes::colortypeRGB; + SimpleTypes::CColorType m_oFillColor = SimpleTypes::colortypeRGB; + SimpleTypes::CColorType m_oShadowColor = SimpleTypes::colortypeRGB; + SimpleTypes::CColorType m_oStrokeColor = SimpleTypes::colortypeRGB; }; //-------------------------------------------------------------------------------- // CColorMru 14.2.2.5 (Part 4) @@ -491,7 +491,7 @@ namespace OOX while ( -1 != ( nEndPos =(int)sColors.find( L",", nStartPos ) ) ) { sColor = sColors.substr( nStartPos, nEndPos - nStartPos ); - SimpleTypes::CColorType* oColor = new SimpleTypes::CColorType(); + SimpleTypes::CColorType* oColor = new SimpleTypes::CColorType(); if (oColor) { oColor->FromString(sColor); @@ -502,7 +502,7 @@ namespace OOX nEndPos = (int)sColors.length(); sColor = sColors.substr( nStartPos, nEndPos - nStartPos ); - SimpleTypes::CColorType* oColor = new SimpleTypes::CColorType(); + SimpleTypes::CColorType* oColor = new SimpleTypes::CColorType(); if (oColor ) { oColor->FromString(sColor); @@ -512,8 +512,8 @@ namespace OOX } public: - std::vector*> m_arrColors; - nullable> m_oExt; + std::vector m_arrColors; + nullable m_oExt; }; //-------------------------------------------------------------------------------- // CComplex 14.2.2.7 (Part 4) @@ -561,7 +561,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oExt; + nullable m_oExt; }; //-------------------------------------------------------------------------------- // CRelation 14.2.2.24 (Part 4) @@ -619,7 +619,7 @@ namespace OOX } public: - nullable> m_oExt; + nullable m_oExt; nullable m_sIdCntr; nullable m_sIdDest; nullable m_sIdSrc; @@ -698,8 +698,8 @@ namespace OOX } public: - nullable> m_oExt; - std::vector m_arrRel; + nullable m_oExt; + std::vector m_arrRel; }; @@ -783,16 +783,16 @@ namespace OOX } public: - nullable> m_oAutoFormat; - nullable> m_oAutoLayout; + nullable m_oAutoFormat; + nullable m_oAutoLayout; nullable m_sConstrainbounds; - nullable> m_oDmgBaseTextScale; - nullable> m_oDmgFontSize; - nullable> m_oDmgScaleX; - nullable> m_oDmgScaleY; - nullable> m_oDmgStyle; - nullable> m_oExt; - nullable> m_oReverse; + nullable m_oDmgBaseTextScale; + nullable m_oDmgFontSize; + nullable m_oDmgScaleX; + nullable m_oDmgScaleY; + nullable m_oDmgStyle; + nullable m_oExt; + nullable m_oReverse; nullable m_oRelationTable; }; @@ -849,8 +849,8 @@ namespace OOX } public: - nullable> m_oNew; - nullable> m_oOld; + nullable m_oNew; + nullable m_oOld; }; //-------------------------------------------------------------------------------- // CEquationXml 14.2.2.10 (Part 4) @@ -909,7 +909,7 @@ namespace OOX } public: - nullable> m_oContentType; + nullable m_oContentType; }; //-------------------------------------------------------------------------------- // CExtrusion 14.2.2.11 (Part 4) @@ -1051,6 +1051,7 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { // Устанавливаем значения по умолчанию + m_oBackDepth.SetValue( 36 ); m_oBrightness.SetValue( 0.3 ); m_oDiffusity.SetValue( (double)1.0 ); @@ -1066,7 +1067,7 @@ namespace OOX m_oSkewAmt.SetValue( 50 ); m_oSpecularity.SetValue( 0 ); m_oViewPoint.SetValue( 0, 0, 0 ); - m_oViewPointOrigin.SetValue( 0.5, -0.5 ); + m_oViewPointOrigin.SetValue( 0.5, -0.5 ); WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Read_if ( oReader, L"autorotationcenter", m_oAutoRotationCenter ) @@ -1106,37 +1107,37 @@ namespace OOX } public: - SimpleTypes::CTrueFalse m_oAutoRotationCenter; + SimpleTypes::CTrueFalse m_oAutoRotationCenter; SimpleTypes::CPoint m_oBackDepth; SimpleTypes::Vml::CVml_1_65536 m_oBrightness; - nullable> m_oColor; - SimpleTypes::CColorMode m_oColorMode; + nullable m_oColor; + SimpleTypes::CColorMode m_oColorMode; SimpleTypes::Vml::CVml_1_65536 m_oDiffusity; SimpleTypes::CPoint m_oEdge; - nullable> m_oExt; - SimpleTypes::CDecimalNumber<30000> m_oFacet; + nullable m_oExt; + SimpleTypes::CDecimalNumber m_oFacet = 30000; SimpleTypes::CPoint m_oForeDepth; - SimpleTypes::CTrueFalse m_oLightFace; - SimpleTypes::CTrueFalse m_oLightHarsh; - SimpleTypes::CTrueFalse m_oLightHarsh2; + SimpleTypes::CTrueFalse m_oLightFace = SimpleTypes::booleanTrue; + SimpleTypes::CTrueFalse m_oLightHarsh = SimpleTypes::booleanTrue; + SimpleTypes::CTrueFalse m_oLightHarsh2; SimpleTypes::Vml::CVml_1_65536 m_oLightLevel; SimpleTypes::Vml::CVml_1_65536 m_oLightLevel2; SimpleTypes::Vml::CVml_Vector3D_65536 m_oLightPosition; SimpleTypes::Vml::CVml_Vector3D_65536 m_oLightPosition2; - SimpleTypes::CTrueFalse m_oLockRotationCenter; - SimpleTypes::CTrueFalse m_oMetal; - SimpleTypes::CTrueFalse m_oOn; + SimpleTypes::CTrueFalse m_oLockRotationCenter = SimpleTypes::booleanTrue; + SimpleTypes::CTrueFalse m_oMetal; + SimpleTypes::CTrueFalse m_oOn; SimpleTypes::Vml::CVml_Vector3D m_oOrientation; - SimpleTypes::CDecimalNumber<0> m_oOrientationAngle; - SimpleTypes::CExtrusionPlane m_oPlane; - SimpleTypes::CExtrusionRender m_oRender; + SimpleTypes::CDecimalNumber m_oOrientationAngle; + SimpleTypes::CExtrusionPlane m_oPlane; + SimpleTypes::CExtrusionRender m_oRender; SimpleTypes::Vml::CVml_Vector2D m_oRotationAngle; SimpleTypes::Vml::CVml_Vector3D m_oRotationCenter; - SimpleTypes::CDecimalNumber<5> m_oShininess; + SimpleTypes::CDecimalNumber m_oShininess = 5; SimpleTypes::CPositiveFixedPercentage m_oSkewAmt; - SimpleTypes::CDecimalNumber<225> m_oSkewAngle; + SimpleTypes::CDecimalNumber m_oSkewAngle = 225; SimpleTypes::Vml::CVml_1_65536 m_oSpecularity; - SimpleTypes::CExtrusionType m_oType; + SimpleTypes::CExtrusionType m_oType; SimpleTypes::Vml::CVml_Vector3D m_oViewPoint; SimpleTypes::Vml::CVml_Vector2D_F m_oViewPointOrigin; }; @@ -1228,8 +1229,8 @@ namespace OOX } public: - nullable> m_oExt; - nullable> m_oType; + nullable m_oExt; + nullable m_oType; }; //-------------------------------------------------------------------------------- // CIdMap 14.2.2.14 (Part 4) @@ -1283,7 +1284,7 @@ namespace OOX public: nullable_string m_sData; - nullable> m_oExt; + nullable m_oExt; }; //-------------------------------------------------------------------------------- // CInk 14.2.2.15 (Part 4) @@ -1338,8 +1339,8 @@ namespace OOX } public: - nullable> m_oAnnotation; - nullable m_oContentType; + nullable m_oAnnotation; + nullable m_oContentType; nullable m_sI; }; //-------------------------------------------------------------------------------- @@ -1377,7 +1378,7 @@ namespace OOX return OOX::et_o_LinkType; } // Text - SimpleTypes::COLELinkType<> m_oValue; + SimpleTypes::COLELinkType m_oValue; }; //-------------------------------------------------------------------------------- // CLock 14.2.2.18 (Part 4) @@ -1474,18 +1475,18 @@ namespace OOX public: // Attributes - SimpleTypes::CTrueFalse m_oAdjustHandles; - SimpleTypes::CTrueFalse m_oAspectRatio; - SimpleTypes::CTrueFalse m_oCropping; - nullable> m_oExt; - SimpleTypes::CTrueFalse m_oGrouping; - SimpleTypes::CTrueFalse m_oPosition; - SimpleTypes::CTrueFalse m_oRotation; - SimpleTypes::CTrueFalse m_oSelection; - SimpleTypes::CTrueFalse m_oShapeType; - SimpleTypes::CTrueFalse m_oText; - SimpleTypes::CTrueFalse m_oUnGrouping; - SimpleTypes::CTrueFalse m_oVerticies; + SimpleTypes::CTrueFalse m_oAdjustHandles; + SimpleTypes::CTrueFalse m_oAspectRatio; + SimpleTypes::CTrueFalse m_oCropping; + nullable m_oExt; + SimpleTypes::CTrueFalse m_oGrouping; + SimpleTypes::CTrueFalse m_oPosition; + SimpleTypes::CTrueFalse m_oRotation; + SimpleTypes::CTrueFalse m_oSelection; + SimpleTypes::CTrueFalse m_oShapeType; + SimpleTypes::CTrueFalse m_oText; + SimpleTypes::CTrueFalse m_oUnGrouping; + SimpleTypes::CTrueFalse m_oVerticies; }; //-------------------------------------------------------------------------------- // CLockedField 14.2.2.19 (Part 4) @@ -1522,7 +1523,7 @@ namespace OOX return OOX::et_o_LockedField; } - SimpleTypes::CTrueFalse<> m_oValue; + SimpleTypes::CTrueFalse m_oValue; }; //-------------------------------------------------------------------------------- @@ -1631,13 +1632,13 @@ namespace OOX public: - nullable> m_oDrawAspect; + nullable m_oDrawAspect; nullable m_oId; nullable_string m_sObjectId; nullable_string m_sProgId; nullable_string m_sShapeId; - nullable> m_oType; - nullable> m_oUpdateMode; + nullable m_oType; + nullable m_oUpdateMode; nullable_string m_oFieldCodes2; nullable m_oFieldCodes; @@ -1699,10 +1700,10 @@ namespace OOX public: - SimpleTypes::CDecimalNumber<0> m_oConnectLoc; - SimpleTypes::CTrueFalse m_oEnd; + SimpleTypes::CDecimalNumber m_oConnectLoc; + SimpleTypes::CTrueFalse m_oEnd; std::wstring m_sIdRef; - SimpleTypes::CTrueFalse m_oStart; + SimpleTypes::CTrueFalse m_oStart; }; //-------------------------------------------------------------------------------- // CR 14.2.2.22 (Part 4) @@ -1786,10 +1787,10 @@ namespace OOX public: // Attributes - nullable> m_oHow; + nullable m_oHow; std::wstring m_sId; nullable m_sIdRef; - nullable> m_oType; + nullable m_oType; // Childs std::vector m_arrProxy; @@ -1874,10 +1875,10 @@ namespace OOX public: // Attributes - nullable> m_oExt; + nullable m_oExt; // Childs - std::vector m_arrEntry; + std::vector m_arrEntry; }; //-------------------------------------------------------------------------------- // CRules 14.2.2.27 (Part 4) @@ -1959,10 +1960,10 @@ namespace OOX public: // Attributes - nullable> m_oExt; + nullable m_oExt; // Childs - std::vector m_arrR; + std::vector m_arrR; }; //-------------------------------------------------------------------------------- // CShapeLayout 14.2.2.29 (Part 4) @@ -2039,12 +2040,12 @@ namespace OOX public: // Attributes - nullable> m_oExt; + nullable m_oExt; // Childs - nullable m_oIdMap; - nullable m_oRegroupTable; - nullable m_oRules; + nullable m_oIdMap; + nullable m_oRegroupTable; + nullable m_oRules; }; //-------------------------------------------------------------------------------- // CSignatureLine 14.2.2.30 (Part 4) @@ -2274,14 +2275,14 @@ namespace OOX // Attributes nullable m_sAddXml; - nullable> m_oAllowComments; - nullable> m_oExt; + nullable m_oAllowComments; + nullable m_oExt; nullable m_oId; - nullable> m_oIsSignatureLine; + nullable m_oIsSignatureLine; nullable m_oProvId; - nullable> m_oShowSignDate; + nullable m_oShowSignDate; nullable m_sSigningInstructions; - nullable> m_oSigningInstructionsSet; + nullable m_oSigningInstructionsSet; nullable m_sSigProvUrl; nullable m_sSuggestedSigner; nullable m_sSuggestedSigner2; @@ -2354,11 +2355,11 @@ namespace OOX public: // Attributes - nullable> m_oExt; + nullable m_oExt; nullable m_sId; nullable m_sMatrix; nullable m_sOffset; - SimpleTypes::CTrueFalse m_oOn; + SimpleTypes::CTrueFalse m_oOn; nullable m_sOrigin; }; } // namespace Vml diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/VmlWord.h b/Common/DocxFormat/Source/DocxFormat/Logic/VmlWord.h index a5d6f9ec23..cf3e35e2ec 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/VmlWord.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/VmlWord.h @@ -157,9 +157,9 @@ namespace OOX EElementType m_eType; - nullable > m_oShadow; - nullable > m_oType; - nullable> m_oWidth; + nullable m_oShadow; + nullable m_oType; + nullable m_oWidth; }; //-------------------------------------------------------------------------------- // CWrap 14.3.2.6 (Part 4) @@ -221,12 +221,12 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable > m_oAnchorX; - nullable > m_oAnchorY; - nullable > m_oSide; - nullable > m_oType; + nullable m_oAnchorX; + nullable m_oAnchorY; + nullable m_oSide; + nullable m_oType; }; } // namespace Vml } // namespace OOX -#endif // OOX_VML_WORD_INCLUDE_H_ \ No newline at end of file +#endif // OOX_VML_WORD_INCLUDE_H_ diff --git a/Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h b/Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h index 3ae36d859d..180686ebae 100644 --- a/Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h +++ b/Common/DocxFormat/Source/DocxFormat/Math/oMathBottomNodes.h @@ -322,7 +322,7 @@ namespace OOX v.fromXML( oNode ); } template - inline void CMathBottomNodesExFromXML(CMathBottomNodes>& v, NodeType& oNode) + inline void CMathBottomNodesExFromXML(CMathBottomNodes& v, NodeType& oNode) { v.m_val.Init(); v.m_val->FromBool(true); @@ -351,69 +351,69 @@ namespace OOX } }; - typedef CMathBottomNodesEx, OOX::et_m_aln> CAln; - typedef CMathBottomNodesEx, OOX::et_m_alnScr> CAlnScr; - typedef CMathBottomNodesEx, OOX::et_m_argSz> CArgSz; - typedef CMathBottomNodesEx, OOX::et_m_baseJc> CBaseJc; + typedef CMathBottomNodesEx CAln; + typedef CMathBottomNodesEx CAlnScr; + typedef CMathBottomNodesEx CArgSz; + typedef CMathBottomNodesEx CBaseJc; typedef CMathBottomNodesEx CBegChr; - typedef CMathBottomNodesEx, OOX::et_m_brkBin> CBrkBin; - typedef CMathBottomNodesEx, OOX::et_m_brkBinSub>CBrkBinSub; - typedef CMathBottomNodesEx, OOX::et_m_cGp> CCGp; - typedef CMathBottomNodesEx, OOX::et_m_cGpRule> CCGpRule; + typedef CMathBottomNodesEx CBrkBin; + typedef CMathBottomNodesExCBrkBinSub; + typedef CMathBottomNodesEx CCGp; + typedef CMathBottomNodesEx CCGpRule; typedef CMathBottomNodesEx CChr; - typedef CMathBottomNodesEx, OOX::et_m_count> CCount; - typedef CMathBottomNodesEx, OOX::et_m_cSp> CCSp; - typedef CMathBottomNodesEx, OOX::et_m_defJc> CDefJc; - typedef CMathBottomNodesEx, OOX::et_m_degHide> CDegHide; - typedef CMathBottomNodesEx, OOX::et_m_diff> CDiff; - typedef CMathBottomNodesEx, OOX::et_m_dispDef> CDispDef; + typedef CMathBottomNodesEx CCount; + typedef CMathBottomNodesEx CCSp; + typedef CMathBottomNodesEx CDefJc; + typedef CMathBottomNodesEx CDegHide; + typedef CMathBottomNodesEx CDiff; + typedef CMathBottomNodesEx CDispDef; typedef CMathBottomNodesEx CEndChr; - typedef CMathBottomNodesEx, OOX::et_m_grow> CGrow; - typedef CMathBottomNodesEx, OOX::et_m_hideBot> CHideBot; - typedef CMathBottomNodesEx, OOX::et_m_hideLeft> CHideLeft; - typedef CMathBottomNodesEx, OOX::et_m_hideRight>CHideRight; - typedef CMathBottomNodesEx, OOX::et_m_hideTop> CHideTop; + typedef CMathBottomNodesEx CGrow; + typedef CMathBottomNodesEx CHideBot; + typedef CMathBottomNodesEx CHideLeft; + typedef CMathBottomNodesExCHideRight; + typedef CMathBottomNodesEx CHideTop; typedef CMathBottomNodesEx CInterSp; - typedef CMathBottomNodesEx, OOX::et_m_intLim> CIntLim; + typedef CMathBottomNodesEx CIntLim; typedef CMathBottomNodesEx CIntraSp; - typedef CMathBottomNodesEx, OOX::et_m_jc> CMJc; - typedef CMathBottomNodesEx, OOX::et_m_limLoc> CLimLoc; - typedef CMathBottomNodesEx, OOX::et_m_lit> CLit; + typedef CMathBottomNodesEx CMJc; + typedef CMathBottomNodesEx CLimLoc; + typedef CMathBottomNodesEx CLit; typedef CMathBottomNodesEx CLMargin; - typedef CMathBottomNodesEx, OOX::et_m_maxDist> CMaxDist; - typedef CMathBottomNodesEx, OOX::et_m_mcJc> CMcJc; - typedef CMathBottomNodesEx, OOX::et_m_naryLim> CNaryLim; - typedef CMathBottomNodesEx, OOX::et_m_noBreak> CNoBreak; - typedef CMathBottomNodesEx, OOX::et_m_nor> CNor; - typedef CMathBottomNodesEx, OOX::et_m_objDist> CObjDist; - typedef CMathBottomNodesEx, OOX::et_m_opEmu> COpEmu; - typedef CMathBottomNodesEx, OOX::et_m_plcHide> CPlcHide; - typedef CMathBottomNodesEx, OOX::et_m_pos> CPos; + typedef CMathBottomNodesEx CMaxDist; + typedef CMathBottomNodesEx CMcJc; + typedef CMathBottomNodesEx CNaryLim; + typedef CMathBottomNodesEx CNoBreak; + typedef CMathBottomNodesEx CNor; + typedef CMathBottomNodesEx CObjDist; + typedef CMathBottomNodesEx COpEmu; + typedef CMathBottomNodesEx CPlcHide; + typedef CMathBottomNodesEx CPos; typedef CMathBottomNodesEx CPostSp; typedef CMathBottomNodesEx CPreSp; typedef CMathBottomNodesEx CRMargin; - typedef CMathBottomNodesEx, OOX::et_m_rSp> CRSp; - typedef CMathBottomNodesEx, OOX::et_m_rSpRule> CRSpRule; - typedef CMathBottomNodesEx, OOX::et_m_scr> CScr; + typedef CMathBottomNodesEx CRSp; + typedef CMathBottomNodesEx CRSpRule; + typedef CMathBottomNodesEx CScr; typedef CMathBottomNodesEx CSepChr; - typedef CMathBottomNodesEx, OOX::et_m_show> CShow; - typedef CMathBottomNodesEx, OOX::et_m_shp> CShp; - typedef CMathBottomNodesEx, OOX::et_m_smallFrac>CSmallFrac; - typedef CMathBottomNodesEx, OOX::et_m_strikeBLTR>CStrikeBLTR; - typedef CMathBottomNodesEx, OOX::et_m_strikeH> CStrikeH; - typedef CMathBottomNodesEx, OOX::et_m_strikeTLBR>CStrikeTLBR; - typedef CMathBottomNodesEx, OOX::et_m_strikeV> CStrikeV; - typedef CMathBottomNodesEx, OOX::et_m_sty> CSty; - typedef CMathBottomNodesEx, OOX::et_m_subHide> CSubHide; - typedef CMathBottomNodesEx, OOX::et_m_supHide> CSupHide; - typedef CMathBottomNodesEx, OOX::et_m_transp> CTransp; - typedef CMathBottomNodesEx, OOX::et_m_type> CType; - typedef CMathBottomNodesEx, OOX::et_m_vertJc> CVertJc; + typedef CMathBottomNodesEx CShow; + typedef CMathBottomNodesEx CShp; + typedef CMathBottomNodesExCSmallFrac; + typedef CMathBottomNodesExCStrikeBLTR; + typedef CMathBottomNodesEx CStrikeH; + typedef CMathBottomNodesExCStrikeTLBR; + typedef CMathBottomNodesEx CStrikeV; + typedef CMathBottomNodesEx CSty; + typedef CMathBottomNodesEx CSubHide; + typedef CMathBottomNodesEx CSupHide; + typedef CMathBottomNodesEx CTransp; + typedef CMathBottomNodesEx CType; + typedef CMathBottomNodesEx CVertJc; typedef CMathBottomNodesExCWrapIndent; - typedef CMathBottomNodesEx, OOX::et_m_wrapRight>CWrapRight; - typedef CMathBottomNodesEx, OOX::et_m_zeroAsc> CZeroAsc; - typedef CMathBottomNodesEx, OOX::et_m_zeroDesc> CZeroDesc; - typedef CMathBottomNodesEx, OOX::et_m_zeroWid> CZeroWid; + typedef CMathBottomNodesExCWrapRight; + typedef CMathBottomNodesEx CZeroAsc; + typedef CMathBottomNodesEx CZeroDesc; + typedef CMathBottomNodesEx CZeroWid; }// Logic }//OOX diff --git a/Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h b/Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h index a5601713ef..a9a6b0add5 100644 --- a/Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h +++ b/Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h @@ -605,7 +605,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_alnAt; + nullable m_alnAt; }; //-------------------------------------------------------------------------------- // CBoxPr 22.1.2.14 (Box Properties) @@ -2565,7 +2565,7 @@ namespace OOX oReader.MoveToElement(); } public: - nullable > m_oSpace; + nullable m_oSpace; std::wstring m_sText; }; //-------------------------------------------------------------------------------- @@ -2928,12 +2928,13 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable m_sAuthor; - nullable m_oDate; - nullable > m_oId; - nullable m_sUserId; - // Childs - nullable m_oRun; + nullable m_sAuthor; + nullable m_oDate; + nullable m_oId; + nullable m_sUserId; + + // Childs + nullable m_oRun; }; class CMIns : public WritingElement { @@ -3022,8 +3023,9 @@ namespace OOX public: nullable m_sAuthor; nullable m_oDate; - nullable > m_oId; + nullable m_oId; nullable m_sUserId; + // Childs nullable m_oRun; }; diff --git a/Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h b/Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h index ed8da36be3..bcbbce7570 100644 --- a/Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h +++ b/Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h @@ -69,7 +69,7 @@ namespace OOX _GUID_ readGUID(MemoryStream *stream); void readStdFont(MemoryStream *stream); - nullable> m_oObjectType; + nullable m_oObjectType; nullable_uint m_oForeColor; nullable_uint m_oBackColor; @@ -85,7 +85,7 @@ namespace OOX nullable_int m_oDelay; nullable_string m_oValue; nullable_bool m_oPasswordEdit; - nullable> m_oSelType; + nullable m_oSelType; nullable_int m_oListRows; nullable_int m_oScrollBarsType; nullable_bool m_oLockText; diff --git a/Common/DocxFormat/Source/DocxFormat/Numbering.h b/Common/DocxFormat/Source/DocxFormat/Numbering.h index ff207ec802..ab979c1451 100644 --- a/Common/DocxFormat/Source/DocxFormat/Numbering.h +++ b/Common/DocxFormat/Source/DocxFormat/Numbering.h @@ -91,7 +91,7 @@ namespace ComplexTypes public: - nullable > m_oLegacy; + nullable m_oLegacy; nullable m_oLegacyIndent; nullable m_oLegacySpace; }; @@ -146,7 +146,7 @@ namespace ComplexTypes public: - nullable< SimpleTypes::COnOff<> > m_oNull; + nullable< SimpleTypes::COnOff> m_oNull; nullable_string m_sVal; }; @@ -194,7 +194,7 @@ namespace ComplexTypes public: - nullable> m_oVal; + nullable m_oVal; }; //-------------------------------------------------------------------------------- @@ -241,7 +241,7 @@ oReader.ReadTillEnd(); public: - nullable> m_oVal; + nullable m_oVal; }; } // Word @@ -417,10 +417,10 @@ namespace OOX public: nullable_int m_oIlvl; - nullable > m_oTentative; - nullable> m_oTplc; + nullable m_oTentative; + nullable m_oTplc; - nullable> m_oIsLgl; + nullable m_oIsLgl; nullable m_oLegacy; nullable m_oLvlJc; nullable m_oLvlPicBulletId; diff --git a/Common/DocxFormat/Source/DocxFormat/RId.h b/Common/DocxFormat/Source/DocxFormat/RId.h index 3ce83e965c..5d78b79f7c 100644 --- a/Common/DocxFormat/Source/DocxFormat/RId.h +++ b/Common/DocxFormat/Source/DocxFormat/RId.h @@ -34,7 +34,7 @@ #define OOX_RID_INCLUDE_H_ #include "../Base/Base.h" -#include "../XML/Utils.h" +#include "../Base/Unit.h" #include "../../../../DesktopEditor/xml/include/xmlutils.h" namespace OOX diff --git a/Common/DocxFormat/Source/DocxFormat/Settings/Settings.h b/Common/DocxFormat/Source/DocxFormat/Settings/Settings.h index 5535952398..e77726ea61 100644 --- a/Common/DocxFormat/Source/DocxFormat/Settings/Settings.h +++ b/Common/DocxFormat/Source/DocxFormat/Settings/Settings.h @@ -149,13 +149,13 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable_bool m_oChapNum; - nullable> m_oHeading; - std::wstring m_sName; - nullable_bool m_oNoLabel; - nullable> m_oNumFmt; - nullable> m_oPos; - nullable> m_oSep; + nullable_bool m_oChapNum; + nullable m_oHeading; + std::wstring m_sName; + nullable_bool m_oNoLabel; + nullable m_oNumFmt; + nullable m_oPos; + nullable m_oSep; }; //-------------------------------------------------------------------------------- // CCaptions 17.15.1.17 (Part 1) @@ -210,7 +210,7 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - SimpleTypes::CCharacterSpacing<> m_oVal; + SimpleTypes::CCharacterSpacing m_oVal; }; //-------------------------------------------------------------------------------- // CCompatSetting 17.15.3.4 (Part 1) @@ -268,71 +268,71 @@ namespace OOX // TO DO: Добавить аттрибуты из 9.7.3 Part4 - nullable> m_oUseSingleBorderforContiguousCells; - nullable> m_oWpJustification; - nullable> m_oNoTabHangInd; - nullable> m_oNoLeading; - nullable> m_oSpaceForUL; - nullable> m_oNoColumnBalance; - nullable> m_oBalanceSingleByteDoubleByteWidth; - nullable> m_oNoExtraLineSpacing; - nullable> m_oDoNotLeaveBackslashAlone; - nullable> m_oUlTrailSpace; - nullable> m_oDoNotExpandShiftReturn; - nullable> m_oSpacingInWholePoints; - nullable> m_oLineWrapLikeWord6; - nullable> m_oPrintBodyTextBeforeHeader; - nullable> m_oPrintColBlack; - nullable> m_oWpSpaceWidth; - nullable> m_oShowBreaksInFrames; - nullable> m_oSubFontBySize; - nullable> m_oSuppressBottomSpacing; - nullable> m_oSuppressTopSpacing; - nullable> m_oSuppressSpacingAtTopOfPage; - nullable> m_oSuppressTopSpacingWP; - nullable> m_oSuppressSpBfAfterPgBrk; - nullable> m_oSwapBordersFacingPages; - nullable> m_oConvMailMergeEsc; - nullable> m_oTruncateFontHeightsLikeWP6; - nullable> m_oMwSmallCaps; - nullable> m_oUsePrinterMetrics; - nullable> m_oDoNotSuppressParagraphBorders; - nullable> m_oWrapTrailSpaces; - nullable> m_oFootnoteLayoutLikeWW8; - nullable> m_oShapeLayoutLikeWW8; - nullable> m_oAlignTablesRowByRow; - nullable> m_oForgetLastTabAlignment; - nullable> m_oAdjustLineHeightInTable; - nullable> m_oAutoSpaceLikeWord95; - nullable> m_oNoSpaceRaiseLower; - nullable> m_oDoNotUseHTMLParagraphAutoSpacing; - nullable> m_oLayoutRawTableWidth; - nullable> m_oLayoutTableRowsApart; - nullable> m_oUseWord97LineBreakRules; - nullable> m_oDoNotBreakWrappedTables; - nullable> m_oDoNotSnapToGridInCell; - nullable> m_oSelectFldWithFirstOrLastChar; - nullable> m_oApplyBreakingRules; - nullable> m_oDoNotWrapTextWithPunct; - nullable> m_oDoNotUseEastAsianBreakRules; - nullable> m_oUseWord2002TableStyleRules; - nullable> m_oGrowAutofit; - nullable> m_oUseFELayout; - nullable> m_oUseNormalStyleForList; - nullable> m_oDoNotUseIndentAsNumberingTabStop; - nullable> m_oUseAltKinsokuLineBreakRules; - nullable> m_oAllowSpaceOfSameStyleInTable; - nullable> m_oDoNotSuppressIndentation; - nullable> m_oDoNotAutofitConstrainedTables; - nullable> m_oAutofitToFirstFixedWidthCell; - nullable> m_oUnderlineTabInNumList; - nullable> m_oDisplayHangulFixedWidth; - nullable> m_oSplitPgBreakAndParaMark; - nullable> m_oDoNotVertAlignCellWithSp; - nullable> m_oDoNotBreakConstrainedForcedTable; - nullable> m_oDoNotVertAlignInTxbx; - nullable> m_oUseAnsiKerningPairs; - nullable> m_oCachedColBalance; + nullable m_oUseSingleBorderforContiguousCells; + nullable m_oWpJustification; + nullable m_oNoTabHangInd; + nullable m_oNoLeading; + nullable m_oSpaceForUL; + nullable m_oNoColumnBalance; + nullable m_oBalanceSingleByteDoubleByteWidth; + nullable m_oNoExtraLineSpacing; + nullable m_oDoNotLeaveBackslashAlone; + nullable m_oUlTrailSpace; + nullable m_oDoNotExpandShiftReturn; + nullable m_oSpacingInWholePoints; + nullable m_oLineWrapLikeWord6; + nullable m_oPrintBodyTextBeforeHeader; + nullable m_oPrintColBlack; + nullable m_oWpSpaceWidth; + nullable m_oShowBreaksInFrames; + nullable m_oSubFontBySize; + nullable m_oSuppressBottomSpacing; + nullable m_oSuppressTopSpacing; + nullable m_oSuppressSpacingAtTopOfPage; + nullable m_oSuppressTopSpacingWP; + nullable m_oSuppressSpBfAfterPgBrk; + nullable m_oSwapBordersFacingPages; + nullable m_oConvMailMergeEsc; + nullable m_oTruncateFontHeightsLikeWP6; + nullable m_oMwSmallCaps; + nullable m_oUsePrinterMetrics; + nullable m_oDoNotSuppressParagraphBorders; + nullable m_oWrapTrailSpaces; + nullable m_oFootnoteLayoutLikeWW8; + nullable m_oShapeLayoutLikeWW8; + nullable m_oAlignTablesRowByRow; + nullable m_oForgetLastTabAlignment; + nullable m_oAdjustLineHeightInTable; + nullable m_oAutoSpaceLikeWord95; + nullable m_oNoSpaceRaiseLower; + nullable m_oDoNotUseHTMLParagraphAutoSpacing; + nullable m_oLayoutRawTableWidth; + nullable m_oLayoutTableRowsApart; + nullable m_oUseWord97LineBreakRules; + nullable m_oDoNotBreakWrappedTables; + nullable m_oDoNotSnapToGridInCell; + nullable m_oSelectFldWithFirstOrLastChar; + nullable m_oApplyBreakingRules; + nullable m_oDoNotWrapTextWithPunct; + nullable m_oDoNotUseEastAsianBreakRules; + nullable m_oUseWord2002TableStyleRules; + nullable m_oGrowAutofit; + nullable m_oUseFELayout; + nullable m_oUseNormalStyleForList; + nullable m_oDoNotUseIndentAsNumberingTabStop; + nullable m_oUseAltKinsokuLineBreakRules; + nullable m_oAllowSpaceOfSameStyleInTable; + nullable m_oDoNotSuppressIndentation; + nullable m_oDoNotAutofitConstrainedTables; + nullable m_oAutofitToFirstFixedWidthCell; + nullable m_oUnderlineTabInNumList; + nullable m_oDisplayHangulFixedWidth; + nullable m_oSplitPgBreakAndParaMark; + nullable m_oDoNotVertAlignCellWithSp; + nullable m_oDoNotBreakConstrainedForcedTable; + nullable m_oDoNotVertAlignInTxbx; + nullable m_oUseAnsiKerningPairs; + nullable m_oCachedColBalance; std::vector m_arrCompatSettings; }; @@ -359,8 +359,8 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oAlgorithmName; - nullable> m_oEdit; + nullable m_oAlgorithmName; + nullable m_oEdit; nullable_bool m_oEnforcment; nullable_bool m_oFormatting; nullable_string m_sHashValue; @@ -369,11 +369,11 @@ namespace OOX //ext nullable_string m_oAlgIdExt; //long hex nullable_string m_oAlgIdExtSource; - nullable> m_oCryptAlgorithmClass; + nullable m_oCryptAlgorithmClass; nullable_int m_oCryptAlgorithmSid; - nullable> m_oCryptAlgorithmType; + nullable m_oCryptAlgorithmType; nullable_string m_oCryptProvider; - nullable> m_oCryptProviderType; + nullable m_oCryptProviderType; nullable_string m_oCryptProviderTypeExt; //long hex nullable_string m_oCryptProviderTypeExtSource; }; @@ -446,7 +446,7 @@ namespace OOX public: // Attributes - SimpleTypes::CDocType<> m_oVal; + SimpleTypes::CDocType m_oVal; }; //-------------------------------------------------------------------------------- // CDocVar 17.15.1.31 (Part 1) @@ -751,8 +751,8 @@ namespace OOX oReader.MoveToElement(); } public: - nullable> m_oGrammar; - nullable> m_oSpelling; + nullable m_oGrammar; + nullable m_oSpelling; }; //-------------------------------------------------------------------------------- // CReadingModeInkLockDown 17.15.1.66 (Part 1) @@ -789,10 +789,10 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - SimpleTypes::COnOff m_oActualPg; - SimpleTypes::CDecimalNumberOrPercent m_oFontSz; - SimpleTypes::CPixelsMeasure<> m_oH; - SimpleTypes::CPixelsMeasure<> m_oW; + SimpleTypes::COnOff m_oActualPg; + SimpleTypes::CDecimalNumberOrPercent m_oFontSz; + SimpleTypes::CPixelsMeasure m_oH; + SimpleTypes::CPixelsMeasure m_oW; }; //-------------------------------------------------------------------------------- // CTrackChangesView 17.15.1.69 (Part 1) @@ -1131,7 +1131,7 @@ namespace OOX oReader.MoveToElement(); } public: - SimpleTypes::CStyleSort<> m_oVal; + SimpleTypes::CStyleSort m_oVal; }; //-------------------------------------------------------------------------------- // CView 17.15.1.92 (Part 1) @@ -1189,7 +1189,7 @@ namespace OOX oReader.MoveToElement(); } public: - SimpleTypes::CView<> m_oVal; + SimpleTypes::CView m_oVal; }; //-------------------------------------------------------------------------------- // CWriteProtection 17.15.1.93 (Part 1) @@ -1223,7 +1223,7 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable> m_oAlgorithmName; + nullable m_oAlgorithmName; nullable_string m_sHashValue; nullable_bool m_oRecommended; nullable_string m_sSaltValue; @@ -1231,11 +1231,11 @@ namespace OOX //ext nullable_string m_oAlgIdExt; //long hex nullable_string m_oAlgIdExtSource; - nullable> m_oCryptAlgorithmClass; + nullable m_oCryptAlgorithmClass; nullable_int m_oCryptAlgorithmSid; - nullable> m_oCryptAlgorithmType; + nullable m_oCryptAlgorithmType; nullable_string m_oCryptProvider; - nullable> m_oCryptProviderType; + nullable m_oCryptProviderType; nullable_string m_oCryptProviderTypeExt; //long hex nullable_string m_oCryptProviderTypeExtSource; }; @@ -1315,8 +1315,8 @@ namespace OOX } public: - SimpleTypes::CDecimalNumberOrPercent m_oPercent; - nullable> m_oVal; + SimpleTypes::CDecimalNumberOrPercent m_oPercent; + nullable m_oVal; }; //-------------------------------------------------------------------------------- // CEdnDocProps 17.11.4 (Part 1) @@ -1752,18 +1752,18 @@ namespace OOX void SetDefaults(); //------------------------------------------------------------------------------------------------------------------ nullable m_oActiveWritingStyle; - nullable> m_oAlignBordersAndEdges; - nullable> m_oAlwaysMergeEmptyNamespace; - nullable> m_oAlwaysShowPlaceholderText; + nullable m_oAlignBordersAndEdges; + nullable m_oAlwaysMergeEmptyNamespace; + nullable m_oAlwaysShowPlaceholderText; nullable m_oAttachedSchema; nullable m_oAttachedTemplate; - nullable> m_oAutoFormatOverride; - nullable> m_oAutoHyphenation; - nullable> m_oBookFoldPrinting; + nullable m_oAutoFormatOverride; + nullable m_oAutoHyphenation; + nullable m_oBookFoldPrinting; nullable m_oBookFoldPrintingSheets; - nullable> m_oBookFoldRevPrinting; - nullable> m_oBordersDoNotSurroundFooter; - nullable> m_oBordersDoNotSurroundHeader; + nullable m_oBookFoldRevPrinting; + nullable m_oBordersDoNotSurroundFooter; + nullable m_oBordersDoNotSurroundHeader; nullable m_oCaptions; nullable m_oCharacterSpacingControl; nullable m_oClickAndTypeStyle; @@ -1773,79 +1773,79 @@ namespace OOX nullable m_oDecimalSymbol; nullable m_oDefaultTableStyle; nullable m_oDefaultTabStop; - nullable> m_oDisplayBackgroundShape; + nullable m_oDisplayBackgroundShape; nullable m_oDisplayHorizontalDrawingGridEvery; nullable m_oDisplayVerticalDrawingGridEvery; nullable m_oDocumentProtection; nullable m_oDocumentType; nullable m_oDocVars; - nullable> m_oDoNotAutoCompressPictures; - nullable> m_oDoNotDemarcateInvalidXml; - nullable> m_oDoNotDisplayPageBoundaries; - nullable> m_oDoNotEmbedSmartTags; - nullable> m_oDoNotHyphenateCaps; - nullable> m_oDoNotIncludeSubdocsInStats; - nullable> m_oDoNotShadeFormData; - nullable> m_oDoNotTrackFormatting; - nullable> m_oDoNotTrackMoves; - nullable> m_oDoNotUseMarginsForDrawingGridOrigin; - nullable> m_oDoNotValidateAgainstSchema; + nullable m_oDoNotAutoCompressPictures; + nullable m_oDoNotDemarcateInvalidXml; + nullable m_oDoNotDisplayPageBoundaries; + nullable m_oDoNotEmbedSmartTags; + nullable m_oDoNotHyphenateCaps; + nullable m_oDoNotIncludeSubdocsInStats; + nullable m_oDoNotShadeFormData; + nullable m_oDoNotTrackFormatting; + nullable m_oDoNotTrackMoves; + nullable m_oDoNotUseMarginsForDrawingGridOrigin; + nullable m_oDoNotValidateAgainstSchema; nullable m_oDrawingGridHorizontalOrigin; nullable m_oDrawingGridHorizontalSpacing; nullable m_oDrawingGridVerticalOrigin; nullable m_oDrawingGridVerticalSpacing; - nullable> m_oEmbedSystemFonts; - nullable> m_oEmbedTrueTypeFonts; + nullable m_oEmbedSystemFonts; + nullable m_oEmbedTrueTypeFonts; nullable m_oEndnotePr; - nullable> m_oEvenAndOddHeaders; + nullable m_oEvenAndOddHeaders; nullable m_oFootnotePr; nullable m_oForceUpgrade; - nullable> m_oFormsDesign; - nullable> m_oGutterAtTop; + nullable m_oFormsDesign; + nullable m_oGutterAtTop; nullable m_oHdrShapeDefaults; - nullable> m_oHideGrammaticalErrors; - nullable> m_oHideSpellingErrors; + nullable m_oHideGrammaticalErrors; + nullable m_oHideSpellingErrors; nullable m_oHyphenationZone; - nullable> m_oIgnoreMixedContent; - nullable> m_oLinkStyles; + nullable m_oIgnoreMixedContent; + nullable m_oLinkStyles; nullable m_oListSeparator; // TO DO: Settings::mailMerge nullable m_oMathPr; - nullable> m_oMirrorMargins; + nullable m_oMirrorMargins; nullable m_oNoLineBreaksAfter; nullable m_oNoLineBreaksBefore; - nullable> m_oNoPunctuationKerning; - nullable> m_oPrintFormsData; - nullable> m_oPrintFractionalCharacterWidth; - nullable> m_oPrintPostScriptOverText; - nullable> m_oPrintTwoOnOne; + nullable m_oNoPunctuationKerning; + nullable m_oPrintFormsData; + nullable m_oPrintFractionalCharacterWidth; + nullable m_oPrintPostScriptOverText; + nullable m_oPrintTwoOnOne; nullable m_oProofState; nullable m_oReadModeInkLockDown; - nullable> m_oRemoveDateAndTime; - nullable> m_oRemovePersonalInformation; + nullable m_oRemoveDateAndTime; + nullable m_oRemovePersonalInformation; nullable m_oRevisionView; nullable m_oRsids; - nullable> m_oSaveFormsData; - nullable> m_oSaveInvalidXml; - nullable> m_oSavePreviewPicture; - nullable> m_oSaveSubsetFonts; + nullable m_oSaveFormsData; + nullable m_oSaveInvalidXml; + nullable m_oSavePreviewPicture; + nullable m_oSaveSubsetFonts; nullable m_oSaveThroughtXslt; - nullable> m_oSaveXmlDataOnly; + nullable m_oSaveXmlDataOnly; nullable m_oSchemaLibrary; nullable m_oShapeDefaults; - nullable> m_oShowEnvelope; - nullable> m_oShowXMLTags; + nullable m_oShowEnvelope; + nullable m_oShowXMLTags; std::vector m_arrSmartTagType; - nullable> m_oStrictFirstAndLastChars; - nullable> m_oStyleLockQFSet; - nullable> m_oStyleLockTheme; + nullable m_oStrictFirstAndLastChars; + nullable m_oStyleLockQFSet; + nullable m_oStyleLockTheme; nullable m_oStylePaneFormatFilter; nullable m_oStylePaneSortMethod; nullable m_oSummaryLength; nullable m_oThemeFontLang; - nullable> m_oTrackRevisions; - nullable> m_oUpdateFields; - nullable> m_oUseXSLTWhenSaving; + nullable m_oTrackRevisions; + nullable m_oUpdateFields; + nullable m_oUseXSLTWhenSaving; nullable m_oView; nullable m_oWriteProtection; nullable m_oZoom; @@ -1865,7 +1865,7 @@ namespace OOX } nullable m_oSdtGlobalColor; - nullable> m_oSdtGlobalShowHighlight; + nullable m_oSdtGlobalShowHighlight; nullable m_oSpecialFormsHighlight; }; } // namespace OOX diff --git a/Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h b/Common/DocxFormat/Source/DocxFormat/Settings/WebSettings.h index 790854f394..7f2a328d4e 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 @@ -224,7 +175,7 @@ namespace OOX public: // Childs - nullable > m_oAllowPNG; + nullable m_oAllowPNG; nullable m_oOptimizeForBrowser; }; } // namespace OOX diff --git a/Common/DocxFormat/Source/DocxFormat/Styles.h b/Common/DocxFormat/Source/DocxFormat/Styles.h index 9c656bbb70..a7e4a13dc5 100644 --- a/Common/DocxFormat/Source/DocxFormat/Styles.h +++ b/Common/DocxFormat/Source/DocxFormat/Styles.h @@ -109,12 +109,12 @@ namespace ComplexTypes public: - nullable > m_oLocked; - nullable m_sName; - nullable > m_oQFormat; - nullable > m_oSemiHidden; - nullable > m_oUiPriority; - nullable > m_oUnhideWhenUsed; + nullable m_oLocked; + nullable m_sName; + nullable m_oQFormat; + nullable m_oSemiHidden; + nullable m_oUiPriority; + nullable m_oUnhideWhenUsed; }; } // Word @@ -250,7 +250,7 @@ namespace OOX public: - nullable> m_oType; + nullable m_oType; nullable m_oParPr; nullable m_oRunPr; @@ -486,6 +486,8 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { + m_oDefUiPriority.SetValue(99); + WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Read_if ( oReader, L"w:count", m_oCount ) WritingElement_ReadAttributes_Read_else_if( oReader, L"w:defLockedState", m_oDefLockedState ) @@ -496,12 +498,12 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - SimpleTypes::CDecimalNumber<0> m_oCount; - SimpleTypes::COnOff m_oDefLockedState; - SimpleTypes::COnOff m_oDefQFormat; - SimpleTypes::COnOff m_oDefSemiHidden; - SimpleTypes::CDecimalNumber<99> m_oDefUiPriority; - SimpleTypes::COnOff m_oDefUnhideWhenUsed; + SimpleTypes::CDecimalNumber m_oCount; + SimpleTypes::COnOff m_oDefLockedState; + SimpleTypes::COnOff m_oDefQFormat; + SimpleTypes::COnOff m_oDefSemiHidden; + SimpleTypes::CDecimalNumber m_oDefUiPriority; + SimpleTypes::COnOff m_oDefUnhideWhenUsed; std::vector m_arrLsdException; }; @@ -704,33 +706,33 @@ namespace OOX public: - nullable> m_oCustomStyle; - nullable> m_oDefault; + nullable m_oCustomStyle; + nullable m_oDefault; nullable_string m_sStyleId; - nullable> m_oType; + nullable m_oType; nullable m_oAliases; - nullable> m_oAutoRedefine; + nullable m_oAutoRedefine; nullable m_oBasedOn; - nullable> m_oHidden; + nullable m_oHidden; nullable m_oLink; - nullable> m_oLocked; + nullable m_oLocked; nullable m_oName; nullable m_oNext; - nullable> m_oPersonal; - nullable> m_oPersonalCompose; - nullable> m_oPersonalReply; + nullable m_oPersonal; + nullable m_oPersonalCompose; + nullable m_oPersonalReply; nullable m_oParPr; - nullable> m_oQFormat; + nullable m_oQFormat; nullable m_oRunPr; nullable m_oRsid; - nullable> m_oSemiHidden; + nullable m_oSemiHidden; nullable m_oTblPr; std::vector m_arrTblStylePr; nullable m_oTcPr; nullable m_oTrPr; nullable m_oUiPriority; - nullable> m_oUnhideWhenUsed; + nullable m_oUnhideWhenUsed; }; //-------------------------------------------------------------------------------- @@ -894,4 +896,4 @@ namespace OOX std::map m_mapStyleNames; std::vector> m_mapEmbeddedStyleNames; }; -} // namespace OOX \ No newline at end of file +} // namespace OOX 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/DocxFormat/WritingElement.h b/Common/DocxFormat/Source/DocxFormat/WritingElement.h index 2bf2634147..67fe79013a 100644 --- a/Common/DocxFormat/Source/DocxFormat/WritingElement.h +++ b/Common/DocxFormat/Source/DocxFormat/WritingElement.h @@ -46,186 +46,186 @@ namespace OOX #define WritingElement_AdditionConstructors(Class) \ explicit Class(XmlUtils::CXmlNode& oNode)\ {\ - m_pMainDocument = NULL;\ - fromXML( oNode );\ - }\ + m_pMainDocument = NULL;\ + fromXML( oNode );\ +}\ explicit Class(const XmlUtils::CXmlNode& node)\ {\ - m_pMainDocument = NULL;\ - fromXML(const_cast (node));\ - }\ + m_pMainDocument = NULL;\ + fromXML(const_cast (node));\ +}\ Class(XmlUtils::CXmlLiteReader& oReader)\ {\ - m_pMainDocument = NULL;\ - fromXML( oReader );\ - }\ + m_pMainDocument = NULL;\ + fromXML( oReader );\ +}\ const Class& operator =(const XmlUtils::CXmlNode &oNode)\ {\ - m_pMainDocument = NULL;\ - fromXML( (XmlUtils::CXmlNode &)oNode );\ - return *this;\ - }\ + m_pMainDocument = NULL;\ + fromXML( (XmlUtils::CXmlNode &)oNode );\ + return *this;\ +}\ const Class& operator =(const XmlUtils::CXmlLiteReader& oReader)\ {\ - m_pMainDocument = NULL;\ - fromXML( (XmlUtils::CXmlLiteReader&)oReader );\ - return *this;\ - }\ - const Class& operator =(XmlUtils::CXmlNode& node) \ + m_pMainDocument = NULL;\ + fromXML( (XmlUtils::CXmlLiteReader&)oReader );\ + return *this;\ +}\ + const Class& operator =(XmlUtils::CXmlNode& node) \ { \ - m_pMainDocument = NULL;\ - fromXML(node); \ - return *this; \ - } \ + m_pMainDocument = NULL;\ + fromXML(node); \ + return *this; \ +} \ #define WritingElement_XlsbConstructors(Class) \ - explicit Class(XLS::BaseObjectPtr& obj)\ - {\ - m_pMainDocument = NULL;\ - fromBin(obj);\ - }\ - const Class& operator =(XLS::BaseObjectPtr& obj)\ - {\ - m_pMainDocument = NULL;\ - fromBin(obj);\ - return *this;\ - }\ + explicit Class(XLS::BaseObjectPtr& obj)\ + {\ + m_pMainDocument = NULL;\ + fromBin(obj);\ +}\ + const Class& operator =(XLS::BaseObjectPtr& obj)\ + {\ + m_pMainDocument = NULL;\ + fromBin(obj);\ + return *this;\ +}\ #define WritingElement_XlsbVectorConstructors(Class) \ - explicit Class(std::vector& obj)\ - {\ - m_pMainDocument = NULL;\ - fromBin(obj);\ - }\ - const Class& operator =(std::vector& obj)\ - {\ - m_pMainDocument = NULL;\ - fromBin(obj);\ - return *this;\ - }\ + explicit Class(std::vector& obj)\ + {\ + m_pMainDocument = NULL;\ + fromBin(obj);\ +}\ + const Class& operator =(std::vector& obj)\ + {\ + m_pMainDocument = NULL;\ + fromBin(obj);\ + return *this;\ +}\ #define WritingElement_ReadNode( oRootNode, oChildNode, sNodeName, oValue ) \ if ( oRootNode.GetNode( sNodeName, oChildNode ) )\ - oValue = oChildNode; + oValue = oChildNode; #define WritingElement_WriteNode_1( sStartNodeString, oValue ) \ if ( oValue.IsInit() )\ {\ - sResult += sStartNodeString;\ - sResult += oValue->ToString();\ - sResult += _T("/>");\ - } + sResult += sStartNodeString;\ + sResult += oValue->ToString();\ + sResult += _T("/>");\ +} #define WritingElement_WriteNode_2( oValue ) \ if ( oValue.IsInit() )\ - sResult += oValue->toXML(); -//----------------------------------------------------------------------------------------------- + sResult += oValue->toXML(); + //----------------------------------------------------------------------------------------------- #define WritingElement_ReadAttributes_ReadSingle2(Reader, AttrName, Value) \ if ( Reader.GetAttributesCount() > 0 ){\ if ( Reader.MoveToFirstAttribute() ){\ std::wstring wsName = Reader.GetName();\ - while( !wsName.empty() )\ + while( !wsName.empty() )\ {\ - if ( AttrName == wsName )\ - {\ - Value = Reader.GetText();\ - break;\ - }\ - if ( !Reader.MoveToNextAttribute() ) \ - break;\ - wsName = Reader.GetName();\ - }\ + if ( AttrName == wsName )\ + {\ + Value = Reader.GetText();\ + break;\ +}\ + if ( !Reader.MoveToNextAttribute() ) \ + break;\ + wsName = Reader.GetName();\ +}\ Reader.MoveToElement();}} -// Следующие 3 define используются для чтения аттрибутов через CXmlLiteReader + // Следующие 3 define используются для чтения аттрибутов через CXmlLiteReader #define WritingElement_ReadAttributes_Start(Reader) \ if ( Reader.GetAttributesCount() <= 0 )\ - return;\ + return;\ if ( !Reader.MoveToFirstAttribute() )\ - return;\ + return;\ std::wstring wsName = Reader.GetName();\ - while( !wsName.empty() )\ + while( !wsName.empty() )\ { #define WritingElement_ReadAttributes_StartChar(Reader) \ if ( Reader.GetAttributesCount() <= 0 )\ - return;\ + return;\ if ( !Reader.MoveToFirstAttribute() )\ - return;\ + return;\ const char* wsName = Reader.GetNameChar();\ while( strlen(wsName) != 0 )\ { #define WritingElement_ReadAttributes_StartChar_No_NS(Reader) \ if ( Reader.GetAttributesCount() <= 0 )\ - return;\ + return;\ if ( !Reader.MoveToFirstAttribute() )\ - return;\ + return;\ const char* wsName = XmlUtils::GetNameNoNS(Reader.GetNameChar());\ while( strlen(wsName) != 0 )\ { #define WritingElement_ReadAttributes_Start_No_NS(Reader) \ if ( Reader.GetAttributesCount() <= 0 )\ - return;\ + return;\ if ( !Reader.MoveToFirstAttribute() )\ - return;\ + return;\ std::wstring wsName = XmlUtils::GetNameNoNS(Reader.GetName());\ while( !wsName.empty() )\ { #define WritingElement_ReadAttributes_Read_if(Reader, AttrName, Value) \ - if ( AttrName == wsName )\ - {\ - Value = Reader.GetText();\ - } + if ( AttrName == wsName )\ + {\ + Value = Reader.GetText();\ +} #define WritingElement_ReadAttributes_Read_ifChar(Reader, AttrName, Value) \ - if ( strcmp(AttrName, wsName) == 0 )\ - {\ - Value = Reader.GetText();\ - } + if ( strcmp(AttrName, wsName) == 0 )\ + {\ + Value = Reader.GetText();\ +} #define WritingElement_ReadAttributes_Read_else_if(Reader, AttrName, Value) \ - else if ( AttrName == wsName )\ - Value = Reader.GetText(); + else if ( AttrName == wsName )\ + Value = Reader.GetText(); #define WritingElement_ReadAttributes_Read_else_ifChar(Reader, AttrName, Value) \ - else if ( strcmp(AttrName, wsName) == 0 )\ - Value = Reader.GetText(); + else if ( strcmp(AttrName, wsName) == 0 )\ + Value = Reader.GetText(); #define WritingElement_ReadAttributes_ReadSingle(Reader, AttrName, Value) \ - if ( AttrName == wsName )\ - {\ - Value = Reader.GetText();\ - break;\ - } + if ( AttrName == wsName )\ + {\ + Value = Reader.GetText();\ + break;\ +} #define WritingElement_ReadAttributes_End(Reader) \ - if ( !Reader.MoveToNextAttribute() ) \ - break;\ - wsName = Reader.GetName();\ - }\ + if ( !Reader.MoveToNextAttribute() ) \ + break;\ + wsName = Reader.GetName();\ +}\ Reader.MoveToElement(); #define WritingElement_ReadAttributes_EndChar(Reader) \ - if ( !Reader.MoveToNextAttribute() ) \ - break;\ - wsName = Reader.GetNameChar();\ - }\ + if ( !Reader.MoveToNextAttribute() ) \ + break;\ + wsName = Reader.GetNameChar();\ +}\ Reader.MoveToElement(); #define WritingElement_ReadAttributes_EndChar_No_NS(Reader) \ - if ( !Reader.MoveToNextAttribute() ) \ - break;\ - wsName = XmlUtils::GetNameNoNS(Reader.GetNameChar());\ - }\ + if ( !Reader.MoveToNextAttribute() ) \ + break;\ + wsName = XmlUtils::GetNameNoNS(Reader.GetNameChar());\ +}\ Reader.MoveToElement(); #define WritingElement_ReadAttributes_End_No_NS(Reader) \ - if ( !Reader.MoveToNextAttribute() ) \ - break;\ - wsName = XmlUtils::GetNameNoNS(Reader.GetName());\ - }\ + if ( !Reader.MoveToNextAttribute() ) \ + break;\ + wsName = XmlUtils::GetNameNoNS(Reader.GetName());\ +}\ Reader.MoveToElement(); enum EElementType @@ -430,24 +430,24 @@ namespace OOX et_a_xfrm, // et_a_uFillTx, et_a_highlight, - + et_a_groupSpPr, // et_a_Shape, // et_a_GroupShape, // et_a_TextShape, // et_a_TextShapeBody, // et_a_LockedCanvas, // - et_a_GroupShapeNonVisual, + et_a_GroupShapeNonVisual, et_a_ConnectionNonVisualShapeProps, et_a_ShapeNonVisual, et_a_Slicer, - et_dgm_DiagrammParts, // - et_dgm_ptLst, // - et_dgm_pt, // - et_dgm_prSet, // - et_dgm_spPr, // - et_dgm_t, // + et_dgm_DiagrammParts, // + et_dgm_ptLst, // + et_dgm_pt, // + et_dgm_prSet, // + et_dgm_spPr, // + et_dgm_t, // et_dgm_cxnLst, et_dgm_cxn, et_dgm_VariableList, @@ -496,26 +496,26 @@ namespace OOX et_dsp_txXfrm, - et_lc_LockedCanvas, // + et_lc_LockedCanvas, // et_graphicFrame, // <...:graphicFrame> et_pic, // <...:pic> et_cxnSp, // <...:cxnSp> - et_p_cNvPicPr, // - et_p_cNvPr, // - et_p_pic, // - et_p_Shape, // - et_p_ShapeTree, // - et_p_spPr, // - et_p_style, // - et_p_groupSpPr, // - et_p_NvGrpSpPr, - et_p_xfrm, - et_p_r, - et_p_fld, - et_p_br, - et_p_MathPara, + et_p_cNvPicPr, // + et_p_cNvPr, // + et_p_pic, // + et_p_Shape, // + et_p_ShapeTree, // + et_p_spPr, // + et_p_style, // + et_p_groupSpPr, // + et_p_NvGrpSpPr, + et_p_xfrm, + et_p_r, + et_p_fld, + et_p_br, + et_p_MathPara, et_p_EmptyTransition, et_p_OrientationTransition, @@ -546,44 +546,44 @@ namespace OOX et_p_bldGraphic, et_p_bldOleChart, - et_a_textFit, - et_a_hyperlink, - et_a_fld, - et_a_p, // - et_a_pPr, // - et_a_r, // - et_a_rPr, // - et_a_t, // - et_a_br, // - et_a_spcPts, // - et_a_spcPct, // - et_a_spcAft, // - et_a_spcBef, // - et_a_lnSpc, // - et_a_tab, - et_a_rtl, + et_a_textFit, + et_a_hyperlink, + et_a_fld, + et_a_p, // + et_a_pPr, // + et_a_r, // + et_a_rPr, // + et_a_t, // + et_a_br, // + et_a_spcPts, // + et_a_spcPct, // + et_a_spcAft, // + et_a_spcBef, // + et_a_lnSpc, // + et_a_tab, + et_a_rtl, - et_a_buNone, - et_a_buChar, - et_a_buAutoNum, - et_a_buClr, - et_a_buClrTx, - et_a_buFontTx, - et_a_buBlip, - et_a_buSzPct, - et_a_buSzPts, - et_a_buSzTx, + et_a_buNone, + et_a_buChar, + et_a_buAutoNum, + et_a_buClr, + et_a_buClrTx, + et_a_buFontTx, + et_a_buBlip, + et_a_buSzPct, + et_a_buSzPts, + et_a_buSzTx, et_ds_customXmlProps, et_ds_schemaRefs, // - et_ds_schemaRef, // + et_ds_schemaRef, // et_m_acc, //m:acc et_m_accPr, //m:accPr et_m_aln, //m:aln et_m_alnScr, //m:alnScr et_m_argPr, //m:argPr - et_m_argSz, //m:argSz + et_m_argSz, //m:argSz et_m_bar, //m:bar et_m_barPr, //m:barPr et_m_baseJc, //m:baseJc @@ -598,8 +598,8 @@ namespace OOX et_m_cGp, //m:cGp et_m_cGpRule, //m:cGpRule et_m_chr, //m:chr - et_m_count, //m:count - et_m_cSp, //m:cSp + et_m_count, //m:count + et_m_cSp, //m:cSp et_m_ctrlPr, //m:ctrlPr et_m_d, //m:d et_m_defJc, //m:defJc @@ -626,7 +626,7 @@ namespace OOX et_m_hideRight, //m:hideRight et_m_hideTop, //m:hideTop et_m_interSp, //m:interSp - et_m_intLim, //m:intLim + et_m_intLim, //m:intLim et_m_intraSp, //m:intraSp et_m_jc, //m:jc et_m_lim, //m:lim @@ -699,7 +699,7 @@ namespace OOX et_m_vertJc, //m:vertJc et_m_wrapIndent, //m:wrapIndent et_m_wrapRight, //m:wrapRight - et_m_zeroAsc, //m:zeroAsc + et_m_zeroAsc, //m:zeroAsc et_m_zeroDesc, //m:zeroDesc et_m_zeroWid, //m:zeroWid @@ -970,7 +970,7 @@ namespace OOX et_wp_anchor, // et_wp_cNvGraphicFramePr, // et_wp_docPr, // - et_wp_effectExtent, // + et_wp_effectExtent, // et_wp_extent, // et_wp_inline, // et_wp_positionH, // @@ -978,7 +978,7 @@ namespace OOX et_wp_sizeRelH, // et_wp_sizeRelV, // et_wp_wrapNone, // - et_wp_wrapPolygon, // + et_wp_wrapPolygon, // et_wp_wrapSquare, // et_wp_wrapThrough, // et_wp_wrapTight, // @@ -1307,7 +1307,7 @@ namespace OOX et_x_Controls, et_x_Control, et_x_ControlPr, - et_x_OcxPr, + et_x_OcxPr, et_x_QueryTable, et_x_QueryTableField, et_x_QueryTableFields, @@ -1403,7 +1403,7 @@ namespace OOX et_x_PivotTableDefinition, et_x_PivotCacheDefinition, - et_x_PivotCacheDefinitionExt, + et_x_PivotCacheDefinitionExt, et_x_PivotCacheRecords, et_x_ColumnRowFields, et_x_ColumnRowItems, @@ -1502,7 +1502,6 @@ namespace OOX virtual ~Document() {} std::wstring m_sDocumentPath; - std::map> m_mapContent; }; @@ -1513,25 +1512,23 @@ namespace OOX virtual ~WritingElement() {} virtual void fromXML(XmlUtils::CXmlNode& node) = 0; - virtual std::wstring toXML() const = 0; - virtual EElementType getType() const - { - return OOX::et_Unknown; - } + virtual std::wstring toXML() const = 0; + virtual EElementType getType() const { return OOX::et_Unknown; } virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) {} - - OOX::Document *m_pMainDocument; virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const; virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; + + public: + OOX::Document *m_pMainDocument; }; template class WritingElementWithChilds : public WritingElement { public: - std::vector m_arrItems; + std::vector m_arrItems; WritingElementWithChilds(OOX::Document *pMain = NULL) : WritingElement(pMain){} diff --git a/Common/DocxFormat/Source/MathEquation/Types.h b/Common/DocxFormat/Source/MathEquation/Types.h index 026dae0b26..5fb419ac16 100644 --- a/Common/DocxFormat/Source/MathEquation/Types.h +++ b/Common/DocxFormat/Source/MathEquation/Types.h @@ -34,7 +34,7 @@ #include #include "../../../../DesktopEditor/common/Types.h" -#include "../../../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../../../Common/DocxFormat/Source/Base/Base.h" namespace MathEquation { diff --git a/Common/DocxFormat/Source/SystemUtility/File.cpp b/Common/DocxFormat/Source/SystemUtility/File.cpp new file mode 100644 index 0000000000..fe5968eb5b --- /dev/null +++ b/Common/DocxFormat/Source/SystemUtility/File.cpp @@ -0,0 +1,302 @@ +/* + * (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 +#include +#include + +#include "../../../3dParty/pole/pole.h" +#include "../Base/unicode_util.h" +#include "./File.h" + +namespace StreamUtils +{ + std::string md5(const BYTE* pData, const ULONG dataLen) + { + std::string strHash; + boost::uuids::detail::md5 hash; + boost::uuids::detail::md5::digest_type digest; + + hash.process_bytes(pData, dataLen); + hash.get_digest(digest); + + const auto charDigest = reinterpret_cast(&digest); + boost::algorithm::hex(charDigest, charDigest + sizeof(boost::uuids::detail::md5::digest_type), + std::back_inserter(strHash)); + + return strHash; + } + + BYTE ReadBYTE(POLE::Stream* pStream) + { + if (pStream == NULL) return 0; + + BYTE lMem = 0; + ULONG lReadByte = 0; + + lReadByte = (ULONG)pStream->read(&lMem, 1); + if (lReadByte < 1) + { + lMem = 0; + } + return lMem; + } + WORD ReadWORD(POLE::Stream* pStream) + { + if (pStream == NULL) return 0; + + WORD lWord = 0; + BYTE pMem[2]; + ULONG lReadByte = 0; + + lReadByte = (ULONG)pStream->read(pMem, 2); + if (lReadByte == 2) + { + lWord = ((pMem[1] << 8) | pMem[0]); + } + return lWord; + } + DWORD ReadDWORD(POLE::Stream* pStream) + { + if (pStream == NULL) return 0; + + DWORD lDWord = 0; + BYTE pMem[4]; + ULONG lReadByte = 0; + lReadByte = (ULONG)pStream->read(pMem, 4); + + //#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64)) + // ATLASSERT(4 == lReadByte); + //#endif + + if (lReadByte == 4) + { + lDWord = ((pMem[3] << 24) | (pMem[2] << 16) | (pMem[1] << 8) | pMem[0]); + } + return 0xFFFFFFFF & lDWord; + } + SHORT ReadSHORT(POLE::Stream* pStream) + { + return (short)ReadWORD(pStream); + } + LONG ReadLONG(POLE::Stream* pStream) + { + return (LONG)ReadDWORD(pStream); + } + FLOAT ReadFLOAT( POLE::Stream* pStream) + { + if (pStream == NULL) return 0; + + FLOAT Value = 0.0f; + pStream->read ((unsigned char*) &Value, sizeof (FLOAT)); + return Value; + } + + std::string ReadStringA(POLE::Stream* pStream, LONG lLen) + { + if (pStream == NULL) return (""); + + char* pData = new char[lLen + 1]; + ULONG lReadByte = (ULONG)pStream->read((unsigned char*)pData, lLen); + + pData[lLen] = 0; + + std::string str(pData, lLen); + + delete[] pData; + return str; + } + std::wstring ReadStringW(POLE::Stream* pStream, LONG lLen) + { + if (pStream == NULL) return (L""); + + unsigned char* pData = new unsigned char[2 * (lLen + 1)]; + memset (pData, 0, 2 * (lLen + 1)); + + ULONG lReadByte = (ULONG)pStream->read(pData, 2 * lLen); + + if (sizeof(wchar_t) == 4) + { + ConversionResult eUnicodeConversionResult; + UTF32 *pStrUtf32 = new UTF32 [lLen + 1]; + pStrUtf32[lLen] = 0 ; + + const UTF16 *pStrUtf16_Conv = (const UTF16 *) pData; + UTF32 *pStrUtf32_Conv = pStrUtf32; + + eUnicodeConversionResult = ConvertUTF16toUTF32 ( &pStrUtf16_Conv + , &pStrUtf16_Conv[lLen] + , &pStrUtf32_Conv + , &pStrUtf32 [lLen] + , strictConversion); + + if (conversionOK != eUnicodeConversionResult) + { + delete [] pStrUtf32; + return (L""); + } + std::wstring res((wchar_t*)pStrUtf32, lLen); + if (pStrUtf32) delete [] pStrUtf32; + return res; + } + else + { + std::wstring str((wchar_t*)pData); + delete[] pData; + return str; + } + + } + + void StreamSeek(long lOffset, POLE::Stream* pStream) + { + if (pStream == NULL) return; + + pStream->seek(lOffset); + } + void StreamPosition(long& lPosition, POLE::Stream* pStream) + { + if (pStream == NULL) return ; + + lPosition = (LONG)pStream->tell(); + } + void StreamSkip(long lCount, POLE::Stream* pStream) + { + if (pStream == NULL) return; + + pStream->seek(pStream->tell() + lCount); + } + void StreamSkipBack(long lCount, POLE::Stream* pStream) + { + if (pStream == NULL) return; + + pStream->seek(pStream->tell()-lCount); + } +} + +#ifdef CopyFile +#undef CopyFile +#endif + +namespace CDirectory +{ + void SaveToFile(const std::wstring& strFileName, const std::wstring& strXml) + { + NSFile::CFileBinary file; + file.CreateFileW(strFileName); + file.WriteStringUTF8(strXml); + file.CloseFile(); + } + bool DeleteFile (const std::wstring& strFileName) + { + return NSFile::CFileBinary::Remove(strFileName); + } + bool CopyFile(const std::wstring& strExists, const std::wstring& strNew) + { + return NSFile::CFileBinary::Copy(strExists, strNew); + } + + void WriteValueToNode(std::wstring strName, DWORD value, XmlUtils::CXmlWriter* pWriter) + { + pWriter->WriteNodeBegin(strName); + pWriter->WriteString(boost::lexical_cast(value)); + pWriter->WriteNodeEnd(strName); + } + + void WriteValueToNode(std::wstring strName, LONG value, XmlUtils::CXmlWriter* pWriter) + { + pWriter->WriteNodeBegin(strName); + pWriter->WriteString(boost::lexical_cast(value)); + pWriter->WriteNodeEnd(strName); + } + void WriteValueToNode(std::wstring strName, std::wstring value, XmlUtils::CXmlWriter* pWriter) + { + pWriter->WriteNodeBegin(strName); + pWriter->WriteString(value); + pWriter->WriteNodeEnd(strName); + } + void WriteValueToNode(std::wstring strName, WCHAR value, XmlUtils::CXmlWriter* pWriter) + { + wchar_t str_arr[2]={}; + str_arr[0] = value; + std::wstring str(str_arr); + + pWriter->WriteNodeBegin(strName); + pWriter->WriteString(str); + pWriter->WriteNodeEnd(strName); + } + void WriteValueToNode(std::wstring strName, bool value, XmlUtils::CXmlWriter* pWriter) + { + pWriter->WriteNodeBegin(strName); + std::wstring str = (true == value) ? (L"1") : (L"0"); + pWriter->WriteString(str); + pWriter->WriteNodeEnd(strName); + } + + double FixedPointToDouble(DWORD point) + { + double dVal = (double)(point % 65536) / 65536; + dVal += (point / 65536); + return dVal; + } + LONG NormFixedPoint(DWORD point, LONG base) + { + return (LONG)(FixedPointToDouble(point) * base); + } + + std::wstring BYTEArrayToString(BYTE* arr, size_t nCount) + { + std::wstring str; + for (size_t index = 0; index < nCount; ++index) + { + if ('\0' != (char)(arr[index])) + str += (char)(arr[index]); + } + if (str.length() == 0) + str = (L"0"); + return str; + } + + std::wstring BYTEArrayToStringW(BYTE* arr, size_t nCount) + { + std::wstring str; + wchar_t* pArr = (wchar_t*)arr; + size_t nCountNew = nCount / 2; + for (size_t index = 0; index < nCountNew; ++index) + { + str += pArr[index]; + } + if (str.length() == 0) + str = (L"0"); + return str; + } +} diff --git a/Common/DocxFormat/Source/SystemUtility/File.h b/Common/DocxFormat/Source/SystemUtility/File.h index fa4283843c..7889760128 100644 --- a/Common/DocxFormat/Source/SystemUtility/File.h +++ b/Common/DocxFormat/Source/SystemUtility/File.h @@ -30,562 +30,45 @@ * */ #pragma once -#include -#include -#include - #include "../../../3dParty/pole/pole.h" -#include "../Base/unicode_util.h" -#include "../Base/Types_32.h" - -#include "../../../../DesktopEditor/xml/include/xmlutils.h" #include "../../../../DesktopEditor/common/File.h" - -class CFile -{ -private: - HRESULT _Open(const std::wstring& strFileName, bool bOpen = false, bool bCreate = false, bool bReadWrite = false) - { - HRESULT hRes = S_OK; - CloseFile(); - -#if defined(_WIN32) || defined(_WIN32_WCE) ||defined(_WIN64) - wchar_t* pModeOpen; - wchar_t* pModeCreate; - if(bReadWrite) - { - pModeOpen = L"rb+"; - pModeCreate = L"wb+"; - } - else - { - pModeOpen = L"rb"; - pModeCreate = L"wb"; - } - if(NULL == m_pFile && bOpen) - _wfopen_s(&m_pFile, strFileName.c_str(), pModeOpen); - if(NULL == m_pFile && bCreate) - _wfopen_s(&m_pFile, strFileName.c_str(), pModeCreate); -#else - BYTE* pUtf8 = NULL; - LONG lLen = 0; - NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false); - char* pModeOpen; - char* pModeCreate; - if(bReadWrite) - { - pModeOpen = "rb+"; - pModeCreate = "wb+"; - } - else - { - pModeOpen = "rb"; - pModeCreate = "wb"; - } - if(NULL == m_pFile && bOpen) - m_pFile = fopen((char*)pUtf8, pModeOpen); - if(NULL == m_pFile && bCreate) - m_pFile = fopen((char*)pUtf8, pModeCreate); - RELEASEARRAYOBJECTS(pUtf8); -#endif - if (NULL == m_pFile) - return S_FALSE; - - fseek(m_pFile, 0, SEEK_END); - m_lFileSize = ftell(m_pFile); - fseek(m_pFile, 0, SEEK_SET); - - m_lFilePosition = 0; - - if (0 < strFileName.length()) - { - if (((wchar_t)'/') == strFileName[strFileName.length() - 1]) - m_lFileSize = 0x7FFFFFFF; - } - - unsigned int err = 0x7FFFFFFF; - unsigned int cur = (unsigned int)m_lFileSize; - if (err == cur) - { - CloseFile(); - return S_FALSE; - } - - return hRes; - } - - // Todo for windows =) - HRESULT _Remove(const std::wstring& strFileName) - { - BYTE* pUtf8 = NULL; - LONG lLen = 0; - NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false); - auto err = remove((char*)pUtf8); - - return S_OK; - } - -public: - CFile() - { - m_pFile = NULL; - m_lFilePosition = 0; - m_lFileSize = 0; - } - - virtual ~CFile() - { - CloseFile(); - } - - HRESULT OpenOrCreate(std::wstring strFileName, bool bOnlyOpen = false, bool bReadWrite = false) - { - return _Open(strFileName, true, true, true); - } - virtual HRESULT OpenFile(std::wstring FileName) - { - return _Open(FileName, true, false, false); - } - - virtual HRESULT OpenFileRW(std::wstring FileName) - { - return _Open(FileName, true, false, true); - } - - HRESULT ReadFile(BYTE* pData, DWORD nBytesToRead) - { - if (!m_pFile) - return S_FALSE; - - SetPosition(m_lFilePosition); - DWORD dwSizeRead = (DWORD)fread((void*)pData, 1, nBytesToRead, m_pFile); - m_lFilePosition += dwSizeRead; - return S_OK; - } - - HRESULT ReadFile2(BYTE* pData, DWORD nBytesToRead) - { - HRESULT hRes = ReadFile(pData, nBytesToRead); - //reverse bytes - for (size_t index = 0; index < nBytesToRead / 2; ++index) - { - BYTE temp = pData[index]; - pData[index] = pData[nBytesToRead - index - 1]; - pData[nBytesToRead - index - 1] = temp; - } - return S_OK; - } - HRESULT ReadFile3(void* pData, DWORD nBytesToRead) - { - return ReadFile((BYTE*)pData, nBytesToRead); - } - - HRESULT WriteFile(void* pData, DWORD nBytesToWrite) - { - if (!m_pFile) - return S_FALSE; - - size_t nCountWrite = fwrite((void*)pData, 1, nBytesToWrite, m_pFile); - m_lFilePosition += nBytesToWrite; - return S_OK; - } - - HRESULT WriteFile2(void* pData, DWORD nBytesToWrite) - { - if (!m_pFile) - return S_FALSE; - - BYTE* mem = new BYTE[nBytesToWrite]; - memcpy(mem, pData, nBytesToWrite); - - for (size_t index = 0; index < nBytesToWrite / 2; ++index) - { - BYTE temp = mem[index]; - mem[index] = mem[nBytesToWrite - index - 1]; - mem[nBytesToWrite - index - 1] = temp; - } - - return WriteFile(mem, nBytesToWrite); - } - - HRESULT CreateFile(std::wstring strFileName) - { - return _Open(strFileName, false, true, true); - } - HRESULT RemoveFile(const std::wstring& strFileName) - { - return _Remove(strFileName); - } - HRESULT SetPosition( ULONG nPos ) - { - if (m_pFile && nPos <= (ULONG)m_lFileSize) - { - m_lFilePosition = (long)nPos; - fseek(m_pFile, m_lFilePosition, SEEK_SET); - return S_OK; - } - else - { - return !m_pFile ? S_FALSE : S_OK; - } - } - ULONG GetPosition() - { - return (ULONG)m_lFilePosition; - } - HRESULT SkipBytes(ULONG nCount) - { - return SetPosition(m_lFilePosition + nCount); - } - - HRESULT CloseFile() - { - m_lFilePosition = 0; - m_lFileSize = 0; - - if (m_pFile != NULL) - { - fclose(m_pFile); - m_pFile = NULL; - } - return S_OK; - } - - ULONG GetFileSize() - { - return m_lFileSize; - } - - HRESULT WriteReserved(DWORD dwCount) - { - BYTE* buf = new BYTE[dwCount]; - memset(buf, 0, (size_t)dwCount); - HRESULT hr = WriteFile(buf, dwCount); - RELEASEARRAYOBJECTS(buf); - return hr; - } - HRESULT WriteReserved2(DWORD dwCount) - { - BYTE* buf = new BYTE[dwCount]; - memset(buf, 0xFF, (size_t)dwCount); - HRESULT hr = WriteFile(buf, dwCount); - RELEASEARRAYOBJECTS(buf); - return hr; - } - HRESULT WriteReservedTo(DWORD dwPoint) - { - if ((DWORD)m_lFilePosition >= dwPoint) - return S_OK; - - DWORD dwCount = dwPoint - (DWORD)m_lFilePosition; - BYTE* buf = new BYTE[dwCount]; - memset(buf, 0, (size_t)dwCount); - HRESULT hr = WriteFile(buf, dwCount); - RELEASEARRAYOBJECTS(buf); - return hr; - } - HRESULT SkipReservedTo(DWORD dwPoint) - { - if ((DWORD)m_lFilePosition >= dwPoint) - return S_OK; - - DWORD dwCount = dwPoint - (DWORD)m_lFilePosition; - return SkipBytes(dwCount); - } - - LONG GetProgress() - { - if (0 >= m_lFileSize) - return -1; - - double dVal = (double)(100 * m_lFilePosition); - LONG lProgress = (LONG)(dVal / m_lFileSize); - return lProgress; - } - - void WriteStringUTF8(const std::wstring& strXml) - { - BYTE* pData = NULL; - LONG lLen = 0; - - NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strXml.c_str(), (LONG)strXml.length(), pData, lLen, false); - - WriteFile(pData, lLen); - - RELEASEARRAYOBJECTS(pData); - } - - static std::string md5(const BYTE* pData, const ULONG dataLen) - { - std::string strHash; - boost::uuids::detail::md5 hash; - boost::uuids::detail::md5::digest_type digest; - - hash.process_bytes(pData, dataLen); - hash.get_digest(digest); - - const auto charDigest = reinterpret_cast(&digest); - boost::algorithm::hex(charDigest, charDigest + sizeof(boost::uuids::detail::md5::digest_type), - std::back_inserter(strHash)); - - return strHash; - } - -protected: - FILE* m_pFile; - - long m_lFilePosition; - long m_lFileSize; -}; +#include "../../../../DesktopEditor/xml/include/xmlwriter.h" namespace StreamUtils { -static BYTE ReadBYTE(POLE::Stream* pStream) -{ - if (pStream == NULL) return 0; + std::string md5(const BYTE* pData, const ULONG dataLen); - BYTE lMem = 0; - ULONG lReadByte = 0; + BYTE ReadBYTE(POLE::Stream* pStream); + WORD ReadWORD(POLE::Stream* pStream); + DWORD ReadDWORD(POLE::Stream* pStream); + SHORT ReadSHORT(POLE::Stream* pStream); + LONG ReadLONG(POLE::Stream* pStream); + FLOAT ReadFLOAT(POLE::Stream* pStream); - lReadByte = (ULONG)pStream->read(&lMem, 1); - if (lReadByte < 1) - { - lMem = 0; - } - return lMem; -} -static WORD ReadWORD(POLE::Stream* pStream) -{ - if (pStream == NULL) return 0; + std::string ReadStringA(POLE::Stream* pStream, LONG lLen); + std::wstring ReadStringW(POLE::Stream* pStream, LONG lLen); - WORD lWord = 0; - BYTE pMem[2]; - ULONG lReadByte = 0; - - lReadByte = (ULONG)pStream->read(pMem, 2); - if (lReadByte == 2) - { - lWord = ((pMem[1] << 8) | pMem[0]); - } - return lWord; -} -static DWORD ReadDWORD(POLE::Stream* pStream) -{ - if (pStream == NULL) return 0; - - DWORD lDWord = 0; - BYTE pMem[4]; - ULONG lReadByte = 0; - lReadByte = (ULONG)pStream->read(pMem, 4); - - //#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64)) - // ATLASSERT(4 == lReadByte); - //#endif - - if (lReadByte == 4) - { - lDWord = ((pMem[3] << 24) | (pMem[2] << 16) | (pMem[1] << 8) | pMem[0]); - } - return 0xFFFFFFFF & lDWord; -} -static SHORT ReadSHORT(POLE::Stream* pStream) -{ - return (short)ReadWORD(pStream); -} -static LONG ReadLONG(POLE::Stream* pStream) -{ - return (_INT32)ReadDWORD(pStream); -} - -static FLOAT ReadFLOAT( POLE::Stream* pStream) -{ - if (pStream == NULL) return 0; - - FLOAT Value = 0.0f; - pStream->read ((unsigned char*) &Value, sizeof (FLOAT)); - return Value; -} - -static std::string ReadStringA(POLE::Stream* pStream, LONG lLen) -{ - if (pStream == NULL) return (""); - - char* pData = new char[lLen + 1]; - ULONG lReadByte = 0; - - lReadByte = (ULONG)pStream->read((unsigned char*)pData, lLen); - - pData[lLen] = 0; - - std::string str(pData, lLen); - - delete[] pData; - return str; -} -static std::wstring ReadStringW(POLE::Stream* pStream, LONG lLen) -{ - if (pStream == NULL) return (L""); - - unsigned char* pData = new unsigned char[2 * (lLen + 1)]; - memset (pData, 0, 2 * (lLen + 1)); - - ULONG lReadByte = 0; - lReadByte = (ULONG)pStream->read(pData, 2 * lLen); - - if (sizeof(wchar_t) == 4) - { - ConversionResult eUnicodeConversionResult; - UTF32 *pStrUtf32 = new UTF32 [lLen + 1]; - pStrUtf32[lLen] = 0 ; - - const UTF16 *pStrUtf16_Conv = (const UTF16 *) pData; - UTF32 *pStrUtf32_Conv = pStrUtf32; - - eUnicodeConversionResult = ConvertUTF16toUTF32 ( &pStrUtf16_Conv - , &pStrUtf16_Conv[lLen] - , &pStrUtf32_Conv - , &pStrUtf32 [lLen] - , strictConversion); - - if (conversionOK != eUnicodeConversionResult) - { - delete [] pStrUtf32; - return (L""); - } - std::wstring res((wchar_t*)pStrUtf32, lLen); - if (pStrUtf32) delete [] pStrUtf32; - return res; - } - else - { - std::wstring str((wchar_t*)pData); - delete[] pData; - return str; - } - -} -static std::string ConvertCStringWToCStringA(std::wstring& strW) -{ - std::string str_a(strW.begin(), strW.end()); - - return str_a; -} -static void StreamSeek(long lOffset, POLE::Stream* pStream) -{ - if (pStream == NULL) return; - - pStream->seek(lOffset); -} -static void StreamPosition(long& lPosition, POLE::Stream* pStream) -{ - if (pStream == NULL) return ; - - lPosition = (LONG)pStream->tell(); -} -static void StreamSkip(long lCount, POLE::Stream* pStream) -{ - if (pStream == NULL) return; - - pStream->seek(pStream->tell() + lCount); -} -static void StreamSkipBack(long lCount, POLE::Stream* pStream) -{ - if (pStream == NULL) return; - - pStream->seek(pStream->tell()-lCount); -} + void StreamSeek(long lOffset, POLE::Stream* pStream); + void StreamPosition(long& lPosition, POLE::Stream* pStream); + void StreamSkip(long lCount, POLE::Stream* pStream); + void StreamSkipBack(long lCount, POLE::Stream* pStream); } namespace CDirectory { -static void SaveToFile(std::wstring strFileName, std::wstring strXml) -{ - NSFile::CFileBinary file; - file.CreateFileW(strFileName); - file.WriteStringUTF8(strXml); - file.CloseFile(); -} + void SaveToFile(const std::wstring& strFileName, const std::wstring& strXml); + bool DeleteFile(const std::wstring& strFileName); + bool CopyFile(const std::wstring& strExists, const std::wstring& strNew); -static bool DeleteFile (std::wstring strFileName) -{ - return NSFile::CFileBinary::Remove(strFileName); -} -static bool CopyFile (const std::wstring& strExists, const std::wstring& strNew) -{ - return NSFile::CFileBinary::Copy(strExists, strNew); -} -static void WriteValueToNode(std::wstring strName, DWORD value, XmlUtils::CXmlWriter* pWriter) -{ - pWriter->WriteNodeBegin(strName); - pWriter->WriteString(boost::lexical_cast(value)); - pWriter->WriteNodeEnd(strName); -} + void WriteValueToNode(std::wstring strName, DWORD value, XmlUtils::CXmlWriter* pWriter); + void WriteValueToNode(std::wstring strName, LONG value, XmlUtils::CXmlWriter* pWriter); + void WriteValueToNode(std::wstring strName, std::wstring value, XmlUtils::CXmlWriter* pWriter); + void WriteValueToNode(std::wstring strName, WCHAR value, XmlUtils::CXmlWriter* pWriter); + void WriteValueToNode(std::wstring strName, bool value, XmlUtils::CXmlWriter* pWriter); -static void WriteValueToNode(std::wstring strName, LONG value, XmlUtils::CXmlWriter* pWriter) -{ - pWriter->WriteNodeBegin(strName); - pWriter->WriteString(boost::lexical_cast(value)); - pWriter->WriteNodeEnd(strName); -} -static void WriteValueToNode(std::wstring strName, std::wstring value, XmlUtils::CXmlWriter* pWriter) -{ - pWriter->WriteNodeBegin(strName); - pWriter->WriteString(value); - pWriter->WriteNodeEnd(strName); -} -static void WriteValueToNode(std::wstring strName, WCHAR value, XmlUtils::CXmlWriter* pWriter) -{ - wchar_t str_arr[2]={}; - str_arr[0] = value; - std::wstring str(str_arr); + double FixedPointToDouble(DWORD point); + LONG NormFixedPoint(DWORD point, LONG base); - pWriter->WriteNodeBegin(strName); - pWriter->WriteString(str); - pWriter->WriteNodeEnd(strName); -} -static void WriteValueToNode(std::wstring strName, bool value, XmlUtils::CXmlWriter* pWriter) -{ - pWriter->WriteNodeBegin(strName); - std::wstring str = (true == value) ? (L"1") : (L"0"); - pWriter->WriteString(str); - pWriter->WriteNodeEnd(strName); -} - -static double FixedPointToDouble(DWORD point) -{ - double dVal = (double)(point % 65536) / 65536; - dVal += (point / 65536); - return dVal; -} -static LONG NormFixedPoint(DWORD point, LONG base) -{ - return (LONG)(FixedPointToDouble(point) * base); -} - -static std::wstring BYTEArrayToString(BYTE* arr, size_t nCount) -{ - std::wstring str; - for (size_t index = 0; index < nCount; ++index) - { - if ('\0' != (char)(arr[index])) - str += (char)(arr[index]); - } - if (str.length() == 0) - str = (L"0"); - return str; -} - -static std::wstring BYTEArrayToStringW(BYTE* arr, size_t nCount) -{ - std::wstring str; - wchar_t* pArr = (wchar_t*)arr; - size_t nCountNew = nCount / 2; - for (size_t index = 0; index < nCountNew; ++index) - { - str += pArr[index]; - } - if (str.length() == 0) - str = (L"0"); - return str; -} + std::wstring BYTEArrayToString(BYTE* arr, size_t nCount); + std::wstring BYTEArrayToStringW(BYTE* arr, size_t nCount); } diff --git a/Common/DocxFormat/Source/SystemUtility/SystemUtility.cpp b/Common/DocxFormat/Source/SystemUtility/SystemUtility.cpp index 6a85a31d95..286d12e431 100644 --- a/Common/DocxFormat/Source/SystemUtility/SystemUtility.cpp +++ b/Common/DocxFormat/Source/SystemUtility/SystemUtility.cpp @@ -29,99 +29,95 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -#include "SystemUtility.h" - -#if defined(_WIN32) || defined (_WIN64) - #include -#endif +#include "../Base/Base.h" +#include "../Base/Unit.h" #include "../../../../DesktopEditor/common/File.h" #include "../../../../DesktopEditor/common/Directory.h" - -#include "../XML/Utils.h" +#include "SystemUtility.h" namespace OOX { - CPath::CPath() : m_strFilename(L"") - { + CPath::CPath() : m_strFilename(L"") + { CheckIsRoot(); - } + } CPath::CPath(const std::wstring& sName, bool bIsNorm) : m_strFilename(sName) - { + { CheckIsRoot(); if (bIsNorm) Normalize(); - } - CPath::CPath(const char*& sName, bool bIsNorm) - { + } + CPath::CPath(const char*& sName, bool bIsNorm) + { std::string s(sName); m_strFilename = std::wstring(s.begin(), s.end()); CheckIsRoot(); if (bIsNorm) Normalize(); - } - CPath::CPath(const wchar_t*& sName, bool bIsNorm) : m_strFilename(sName) - { + } + CPath::CPath(const wchar_t*& sName, bool bIsNorm) : m_strFilename(sName) + { CheckIsRoot(); if (bIsNorm) Normalize(); - } + } - CPath::CPath(const CPath& oSrc) - { - *this = oSrc; + CPath::CPath(const CPath& oSrc) + { + *this = oSrc; //считаем вызывать ли Normalize решает oSrc //Normalize(); - } + } - CPath& CPath::operator=(const CPath& oSrc) - { - m_strFilename = oSrc.m_strFilename; + CPath& CPath::operator=(const CPath& oSrc) + { + m_strFilename = oSrc.m_strFilename; m_bIsRoot = oSrc.m_bIsRoot; //считаем вызывать ли Normalize решает oSrc //Normalize(); - return *this; - } + return *this; + } CPath& CPath::operator=(const std::wstring& oSrc) - { - m_strFilename = oSrc; + { + m_strFilename = oSrc; Normalize(); - return *this; - } - CPath& CPath::operator=(const char* oSrc) - { + return *this; + } + CPath& CPath::operator=(const char* oSrc) + { std::string s(oSrc); m_strFilename = std::wstring(s.begin(), s.end()); - Normalize(); - return *this; - } - CPath& CPath::operator=(const wchar_t* oSrc) - { - m_strFilename = oSrc; - Normalize(); - return *this; - } + Normalize(); + return *this; + } + CPath& CPath::operator=(const wchar_t* oSrc) + { + m_strFilename = oSrc; + Normalize(); + return *this; + } void CPath::Normalize() { if (0 == m_strFilename.length()) return; - //todooo оптимизировать + //todooo оптимизировать XmlUtils::replace_all(m_strFilename, L"/", FILE_SEPARATOR_STR); XmlUtils::replace_all(m_strFilename, L"\\", FILE_SEPARATOR_STR); const wchar_t* pData = m_strFilename.c_str(); - int nLen = (int) m_strFilename.length(); + int nLen = (int) m_strFilename.length(); - wchar_t* pDataNorm = new wchar_t [nLen + 1]; - int* pSlashPoints = new int [nLen + 1]; + wchar_t* pDataNorm = new wchar_t [nLen + 1]; + int* pSlashPoints = new int [nLen + 1]; - int nStart = 0; - int nCurrent = 0; - int nCurrentSlash = -1; - int nCurrentW = 0; - bool bIsUp = false; + int nStart = 0; + int nCurrent = 0; + int nCurrentSlash = -1; + int nCurrentW = 0; + bool bIsUp = false; #if defined(_WIN32) || defined (_WIN64) std::wstring prepending = std::wstring(FILE_SEPARATOR_STR) + FILE_SEPARATOR_STR + L"?"; @@ -135,12 +131,12 @@ namespace OOX nStart = nCurrent = 3; } #else - if (pData[nCurrent] == FILE_SEPARATOR_CHAR) - pDataNorm[nCurrentW++] = pData[nCurrent]; + if (pData[nCurrent] == FILE_SEPARATOR_CHAR) + pDataNorm[nCurrentW++] = pData[nCurrent]; #endif while (nCurrent < nLen) { - if (pData[nCurrent] == FILE_SEPARATOR_CHAR) + if (pData[nCurrent] == FILE_SEPARATOR_CHAR) { if (nStart < nCurrent) { @@ -159,12 +155,12 @@ namespace OOX } if (!bIsUp) { - pDataNorm[nCurrentW++] = (wchar_t) FILE_SEPARATOR_CHAR; + pDataNorm[nCurrentW++] = (wchar_t) FILE_SEPARATOR_CHAR; ++nCurrentSlash; pSlashPoints[nCurrentSlash] = nCurrentW; } } - nStart = nCurrent + 1; + nStart = nCurrent + 1; ++nCurrent; continue; } @@ -177,7 +173,7 @@ namespace OOX m_strFilename = std::wstring(pDataNorm, nCurrentW); delete []pSlashPoints; - delete []pDataNorm; + delete []pDataNorm; } @@ -185,15 +181,15 @@ namespace OOX { std::wstring fileDirectory = GetDirectory(false); - std::wstring lowerFileName = XmlUtils::GetLower(m_strFilename); + std::wstring lowerFileName = XmlUtils::GetLower(m_strFilename); - std::vector trueArray; + std::vector trueArray; NSDirectory::GetFiles2(fileDirectory, trueArray); - for (size_t i = 0; i < trueArray.size(); i++) + for (size_t i = 0; i < trueArray.size(); i++) { - std::wstring lowerTest = XmlUtils::GetLower(trueArray[i]); + std::wstring lowerTest = XmlUtils::GetLower(trueArray[i]); if (lowerTest == lowerFileName) { @@ -203,43 +199,147 @@ namespace OOX } return false; } + + CPath operator/(const CPath& path1, const CPath& path2) + { + CPath path(path1.m_strFilename + FILE_SEPARATOR_STR + path2.m_strFilename); + path.Normalize(); + + return path; + } + CPath operator/(const CPath& path1, const std::wstring& path2) + { + CPath path(path1.m_strFilename + FILE_SEPARATOR_STR + path2); + path.Normalize(); + + return path; + } + + CPath operator+(const CPath& path1, const CPath& path2) + { + CPath path(path1.m_strFilename + path2.m_strFilename); + path.Normalize(); + return path; + } + CPath operator+(const CPath& path1, const std::wstring& path2) + { + CPath path(path1.m_strFilename + path2); + path.Normalize(); + return path; + } + CPath operator+(const std::wstring& path1, const CPath& path2) + { + CPath path(path1 + path2.m_strFilename); + path.Normalize(); + return path; + } + + std::wstring CPath::GetBasename() const + { + std::wstring sFilename = GetFilename(); + std::wstring sExt = GetExtention(); + return sFilename.substr(0, sFilename.length() - sExt.length()); + } + std::wstring CPath::GetExtention(bool bIsPoint) const + { + int nFind = (int)m_strFilename.rfind('.'); + if (-1 == nFind) + return L""; + + if (!bIsPoint) + ++nFind; + + return m_strFilename.substr(nFind); + } + std::wstring CPath::GetDirectory(bool bIsSlash) const + { + int nPos = (int)m_strFilename.rfind(FILE_SEPARATOR_CHAR); + if (-1 == nPos) + { + return m_strFilename; + } + else + { + if (bIsSlash) + ++nPos; + return m_strFilename.substr(0, nPos); + } + } + std::wstring CPath::GetPath() const + { + return m_strFilename; + } + std::wstring CPath::GetFilename() const + { + int nPos = (int)m_strFilename.rfind(FILE_SEPARATOR_CHAR); + if (-1 == nPos) + { + return m_strFilename; + } + else + { + int nLast = (int) m_strFilename.length(); + return m_strFilename.substr(nPos + 1, nLast); + } + } + + void CPath::CheckIsRoot() + { + if(m_strFilename.length() > 0 && ( '/' == m_strFilename[0] )) + m_bIsRoot = true; + else + m_bIsRoot = false; + } + + void CPath::SetName(std::wstring sName, bool bNormalize) + { + m_strFilename = sName; + CheckIsRoot(); + if(bNormalize) + Normalize(); + } + + bool CPath::GetIsRoot() + { + return m_bIsRoot; + } } namespace OOX { - bool CSystemUtility::IsFileExist(const std::wstring& strFileName) - { - return NSFile::CFileBinary::Exists(strFileName); - } - bool CSystemUtility::IsFileExist(const CPath& oPath) - { - return IsFileExist(oPath.GetPath()); - } + bool CSystemUtility::IsFileExist(const std::wstring& strFileName) + { + return NSFile::CFileBinary::Exists(strFileName); + } + bool CSystemUtility::IsFileExist(const CPath& oPath) + { + return IsFileExist(oPath.GetPath()); + } - std::wstring CSystemUtility::GetDirectoryName(const std::wstring& strFileName) - { - CPath oPath(strFileName); - return oPath.GetDirectory(); - } + std::wstring CSystemUtility::GetDirectoryName(const std::wstring& strFileName) + { + CPath oPath(strFileName); + return oPath.GetDirectory(); + } - int CSystemUtility::GetFilesCount(const std::wstring& strDirPath, const bool& bRecursive) - { - return NSDirectory::GetFilesCount(strDirPath, bRecursive); - } + int CSystemUtility::GetFilesCount(const std::wstring& strDirPath, const bool& bRecursive) + { + return NSDirectory::GetFilesCount(strDirPath, bRecursive); + } - std::wstring CSystemUtility::GetFileExtention(const std::wstring& strFileName) - { - CPath oPath(strFileName); - return oPath.GetExtention(); - } + std::wstring CSystemUtility::GetFileExtention(const std::wstring& strFileName) + { + CPath oPath(strFileName); + return oPath.GetExtention(); + } - bool CSystemUtility::CreateDirectories(const CPath& oPath) - { - return NSDirectory::CreateDirectory(oPath.GetPath()); - } + bool CSystemUtility::CreateDirectories(const CPath& oPath) + { + return NSDirectory::CreateDirectory(oPath.GetPath()); + } - void CSystemUtility::ReplaceExtention(std::wstring& strName, std::wstring& str1, std::wstring& str2) - { - return; - } + void CSystemUtility::ReplaceExtention(std::wstring& strName, std::wstring& str1, std::wstring& str2) + { + return; + } } diff --git a/Common/DocxFormat/Source/SystemUtility/SystemUtility.h b/Common/DocxFormat/Source/SystemUtility/SystemUtility.h index 1311953ed7..e85e841906 100644 --- a/Common/DocxFormat/Source/SystemUtility/SystemUtility.h +++ b/Common/DocxFormat/Source/SystemUtility/SystemUtility.h @@ -45,123 +45,37 @@ namespace OOX public: CPath(); CPath(const std::wstring& sName, bool bIsNorm = true); - CPath(const char*& sName, bool bIsNorm = true); - CPath(const wchar_t*& sName, bool bIsNorm = true); + CPath(const char*& sName, bool bIsNorm = true); + CPath(const wchar_t*& sName, bool bIsNorm = true); CPath(const CPath& oSrc); CPath& operator=(const CPath& oSrc); CPath& operator=(const std::wstring& oSrc); - CPath& operator=(const char* oSrc); - CPath& operator=(const wchar_t* oSrc); + CPath& operator=(const char* oSrc); + CPath& operator=(const wchar_t* oSrc); - friend CPath operator/(const CPath& path1, const CPath& path2) - { - CPath path(path1.m_strFilename + FILE_SEPARATOR_STR + path2.m_strFilename); - path.Normalize(); + friend CPath operator/(const CPath& path1, const CPath& path2); + friend CPath operator/(const CPath& path1, const std::wstring& path2); - return path; - } - friend CPath operator/(const CPath& path1, const std::wstring& path2) - { - CPath path(path1.m_strFilename + FILE_SEPARATOR_STR + path2); - path.Normalize(); - - return path; - } - - friend CPath operator+(const CPath& path1, const CPath& path2) - { - CPath path(path1.m_strFilename + path2.m_strFilename); - path.Normalize(); - return path; - } - friend CPath operator+(const CPath& path1, const std::wstring& path2) - { - CPath path(path1.m_strFilename + path2); - path.Normalize(); - return path; - } - friend CPath operator+(const std::wstring& path1, const CPath& path2) - { - CPath path(path1 + path2.m_strFilename); - path.Normalize(); - return path; - } + friend CPath operator+(const CPath& path1, const CPath& path2); + friend CPath operator+(const CPath& path1, const std::wstring& path2); + friend CPath operator+(const std::wstring& path1, const CPath& path2); bool FileInDirectoryCorrect(); - AVSINLINE std::wstring GetBasename() const - { - std::wstring sFilename = GetFilename(); - std::wstring sExt = GetExtention(); - return sFilename.substr(0, sFilename.length() - sExt.length()); - } - AVSINLINE std::wstring GetExtention(bool bIsPoint = true) const - { - int nFind = (int)m_strFilename.rfind('.'); - if (-1 == nFind) - return L""; + std::wstring GetBasename() const; + std::wstring GetExtention(bool bIsPoint = true) const; + std::wstring GetDirectory(bool bIsSlash = true) const; + std::wstring GetPath() const; + std::wstring GetFilename() const; - if (!bIsPoint) - ++nFind; + void Normalize(); - return m_strFilename.substr(nFind); - } - AVSINLINE std::wstring GetDirectory(bool bIsSlash = true) const - { - int nPos = (int)m_strFilename.rfind(FILE_SEPARATOR_CHAR); - if (-1 == nPos) - { - return m_strFilename; - } - else - { - if (bIsSlash) - ++nPos; - return m_strFilename.substr(0, nPos); - } - } - AVSINLINE std::wstring GetPath() const - { - return m_strFilename; - } - AVSINLINE std::wstring GetFilename() const - { - int nPos = (int)m_strFilename.rfind(FILE_SEPARATOR_CHAR); - if (-1 == nPos) - { - return m_strFilename; - } - else - { - int nLast = (int) m_strFilename.length(); - return m_strFilename.substr(nPos + 1, nLast); - } - } + void SetName(std::wstring sName, bool bNormalize); - void Normalize(); - - void CheckIsRoot() - { - if(m_strFilename.length() > 0 && ( '/' == m_strFilename[0] )) - m_bIsRoot = true; - else - m_bIsRoot = false; - } - - void SetName(std::wstring sName, bool bNormalize) - { - m_strFilename = sName; - CheckIsRoot(); - if(bNormalize) - Normalize(); - } - - bool GetIsRoot() - { - return m_bIsRoot; - } + void CheckIsRoot(); + bool GetIsRoot(); }; class CSystemUtility @@ -170,7 +84,7 @@ namespace OOX static bool IsFileExist (const std::wstring& strFileName); static bool IsFileExist (const CPath& sPath); static std::wstring GetDirectoryName (const std::wstring& strFileName); - static int GetFilesCount (const std::wstring& strDirPath, const bool& bRecursive = false); + static int GetFilesCount (const std::wstring& strDirPath, const bool& bRecursive = false); static std::wstring GetFileExtention (const std::wstring& strFileName); static bool CreateDirectories (const CPath& oPath); static void ReplaceExtention ( std::wstring& strName, std::wstring& str1, std::wstring& str2); diff --git a/Common/DocxFormat/Source/Utility/TxtFile.cpp b/Common/DocxFormat/Source/Utility/TxtFile.cpp deleted file mode 100644 index 46174e35c4..0000000000 --- a/Common/DocxFormat/Source/Utility/TxtFile.cpp +++ /dev/null @@ -1,375 +0,0 @@ -/* - * (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 - * - */ -#ifdef _HTML_FILE - -#include "TxtFile.h" -#include "Encoding.h" -#include "Utility.h" -#include -#include "codecvt.h" -#include -#include - -static const std::string BadSymbols = "\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19"; - -TxtFile::TxtFile(const boost::filesystem::wpath& path) - : m_path(path) -{ -} - - -const std::vector TxtFile::readAnsi() const -{ - std::ifstream file(m_path.string().c_str()); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - std::vector result; - while (!file.eof()) - { - std::string str; - std::getline(file, str); - - size_t pos = str.find_first_of(BadSymbols); - while(pos != str.npos) - { - str.erase(pos, 1); - pos = str.find_first_of(BadSymbols, pos); - } - -/* - boost::erase_all(str, "\x0A"); - boost::erase_all(str, "\x0B"); - boost::erase_all(str, "\x0C"); - boost::erase_all(str, "\x0D"); - boost::erase_all(str, "\x0E"); - boost::erase_all(str, "\x0F"); - boost::erase_all(str, "\x10"); - boost::erase_all(str, "\x11"); - boost::erase_all(str, "\x12"); - boost::erase_all(str, "\x13"); - boost::erase_all(str, "\x14"); - boost::erase_all(str, "\x15"); - boost::erase_all(str, "\x16"); - boost::erase_all(str, "\x17"); - boost::erase_all(str, "\x18"); - boost::erase_all(str, "\x19"); -*/ - result.push_back(str); - } - return result; -} - - -const std::vector TxtFile::readUnicode() const -{ - std::wifstream file(m_path.string().c_str(), std::ios_base::binary); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - file.imbue(std::locale(std::locale(), new ucs2_conversion())); - std::vector result; - - while (!file.eof()) - { - std::wstring str; - file.ignore(); - std::getline(file, str, L'\x0D'); - result.push_back(str); - } - return result; -} - - -const std::vector TxtFile::readUnicodeWithOutBOM() const -{ - std::wifstream file(m_path.string().c_str(), std::ios_base::binary); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - file.imbue(std::locale(std::locale(), new ucs2_conversion())); - std::vector result; - - while (!file.eof()) - { - std::wstring str; - std::getline(file, str, L'\x0D'); - file.ignore(); - result.push_back(str); - } - return result; -} - - -const std::vector TxtFile::readBigEndian() const -{ - std::wifstream file(m_path.string().c_str(), std::ios_base::binary); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - file.imbue(std::locale(std::locale(), new ube_conversion())); - std::vector result; - - while (!file.eof()) - { - std::wstring str; - file.ignore(); - std::getline(file, str, L'\x0D'); - result.push_back(str); - } - return result; -} - - -const std::vector TxtFile::readUtf8() const -{ - std::ifstream file(m_path.string().c_str()); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - std::vector result; - file.ignore(3); - - while (!file.eof()) - { - std::string str; - std::getline(file, str); - result.push_back(str); - } - return result; -} - - -const std::vector TxtFile::readUtf8withoutPref() const -{ - std::ifstream file(m_path.string().c_str()); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - std::vector result; - - while (!file.eof()) - { - std::string str; - std::getline(file, str); - result.push_back(str); - } - return result; -} - - -void TxtFile::writeAnsi(const std::vector& content) const -{ - setAnsiStamp(); - std::ofstream file(m_path.string().c_str()); - - if (file.bad()) - throw log_runtime_error("can't create text file"); - - BOOST_FOREACH(const std::string& line, content) - { - file << line << std::endl; - } -} - - -void TxtFile::writeUnicode(const std::vector& content) const -{ - setUnicodeStamp(); - std::wofstream file(m_path.string().c_str(), std::ios_base::binary | std::ios_base::app); - - if (file.bad()) - throw log_runtime_error("can't create text file"); - - file.imbue(std::locale(std::locale(), new ucs2_conversion())); - BOOST_FOREACH(const std::wstring& line, content) - { - file << line << L'\x0D' << L'\x0A'; - } -} - - -void TxtFile::writeBigEndian(const std::vector& content) const -{ - setBigEndianStamp(); - std::wofstream file(m_path.string().c_str(), std::ios_base::binary | std::ios_base::app); - - if (file.bad()) - throw log_runtime_error("can't create text file"); - - file.imbue(std::locale(std::locale(), new ube_conversion())); - BOOST_FOREACH(const std::wstring& line, content) - { - file << line << L'\x0D' << L'\x0A'; - } -} - - -void TxtFile::writeUtf8(const std::vector& content) const -{ - setUtf8Stamp(); - std::ofstream file(m_path.string().c_str(), std::ios_base::app); - - if (file.bad()) - throw log_runtime_error("can't create text file"); - - BOOST_FOREACH(const std::string& line, content) - { - file << line << std::endl; - } -} - - -void TxtFile::writeUtf8withoutPref(const std::vector& content) const -{ - std::ofstream file(m_path.string().c_str()); - - if (file.bad()) - throw log_runtime_error("can't create text file"); - - BOOST_FOREACH(const std::string& line, content) - { - file << line << std::endl; - } -} - - -const bool TxtFile::isAnsi() const -{ - return true; -} - - -const bool TxtFile::isUnicode() const -{ - std::ifstream file(m_path.string().c_str(), std::ios_base::binary); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - char symbol; - - file >> symbol; - if (symbol != '\xFF') - return false; - - file >> symbol; - if (symbol != '\xFE') - return false; - - return true; -} - - -const bool TxtFile::isUnicodeWithOutBOM() const -{ - std::ifstream file(m_path.string().c_str(), std::ios_base::binary); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - std::string str; - std::getline(file, str, '\x0A'); - bool bUnicode = (str.find('\x0') != str.npos); - - return bUnicode; -} - - -const bool TxtFile::isBigEndian() const -{ - std::ifstream file(m_path.string().c_str(), std::ios_base::binary); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - char symbol; - - file >> symbol; - if (symbol != '\xFE') - return false; - - file >> symbol; - if (symbol != '\xFF') - return false; - - return true; -} - - -const bool TxtFile::isUtf8() const -{ - std::ifstream file(m_path.string().c_str(), std::ios_base::binary); - if (file.bad()) - throw log_runtime_error("can't open text file"); - - char symbol; - - file >> symbol; - if (symbol != '\xEF') - return false; - - file >> symbol; - if (symbol != '\xBB') - return false; - - file >> symbol; - if (symbol != '\xBF') - return false; - - return true; -} - - -void TxtFile::setAnsiStamp() const -{ -} - - -void TxtFile::setUnicodeStamp() const -{ - std::wofstream file(m_path.string().c_str(), std::ios_base::binary); - file << '\xFF' << '\xFE'; -} - - -void TxtFile::setBigEndianStamp() const -{ - std::wofstream file(m_path.string().c_str(), std::ios_base::binary); - file << '\xFE' << '\xFF'; -} - - -void TxtFile::setUtf8Stamp() const -{ - std::wofstream file(m_path.string().c_str(), std::ios_base::binary); - file << '\xEF' << '\xBB' << '\xBF'; -} - -#endif diff --git a/Common/DocxFormat/Source/Utility/TxtFile.h b/Common/DocxFormat/Source/Utility/TxtFile.h deleted file mode 100644 index 08b98155a2..0000000000 --- a/Common/DocxFormat/Source/Utility/TxtFile.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * (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 -#ifndef UTILITY_TXT_FILE_INCLUDE_H_ -#define UTILITY_TXT_FILE_INCLUDE_H_ - -#ifdef _HTML_FILE - -#include -#include -#include - - -class TxtFile -{ -public: - TxtFile(const boost::filesystem::wpath& path); - -public: - const std::vector readAnsi() const; - const std::vector readUnicode() const; - const std::vector readUnicodeWithOutBOM() const; - const std::vector readBigEndian() const; - const std::vector readUtf8() const; - const std::vector readUtf8withoutPref() const; - -public: - void writeAnsi(const std::vector& content) const; - void writeUnicode(const std::vector& content) const; - void writeBigEndian(const std::vector& content) const; - void writeUtf8(const std::vector& content) const; - void writeUtf8withoutPref(const std::vector& content) const; - -public: - const bool isAnsi() const; - const bool isUnicode() const; - const bool isUnicodeWithOutBOM() const; - const bool isBigEndian() const; - const bool isUtf8() const; - -private: - void setAnsiStamp() const; - void setUnicodeStamp() const; - void setBigEndianStamp() const; - void setUtf8Stamp() const; - -private: - boost::filesystem::wpath m_path; -}; - -#endif // _HTML_FILE - -#endif // UTILITY_TXT_FILE_INCLUDE_H_ diff --git a/Common/DocxFormat/Source/Utility/Unit.h b/Common/DocxFormat/Source/Utility/Unit.h deleted file mode 100644 index 1cf481b7c2..0000000000 --- a/Common/DocxFormat/Source/Utility/Unit.h +++ /dev/null @@ -1,388 +0,0 @@ -/* - * (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 -#ifndef _UNIT_INCLUDE_H_ -#define _UNIT_INCLUDE_H_ - -AVSINLINE double Cm_To_Mm (const double &dValue) -{ - return dValue * 10; -} - -AVSINLINE double Cm_To_Pt (const double &dValue) -{ - return dValue * 72 / 2.54; -} - -AVSINLINE double Cm_To_Px (const double &dValue) -{ - return dValue * 72 * 4 / 3 / 2.54; -} - -AVSINLINE double Cm_To_Inch (const double &dValue) -{ - return dValue / 2.54; -} - - - -AVSINLINE double Cm_To_Dx (const double &dValue) -{ - return dValue * 72 * 20 / 2.54; -} - -AVSINLINE double Cm_To_Sx (const double &dValue) -{ - return dValue * 72 * 100 * 1000 / 20; -} -AVSINLINE double Cm_To_Multi (const double &dValue) -{ - return dValue * 72 * 20 / 2.54; -} - - - -AVSINLINE double Cm_To_Emu (const double &dValue) -{ - return dValue * 360000; -} - - - -AVSINLINE double Mm_To_Cm (const double &dValue) -{ - return dValue / 10; -} - -AVSINLINE double Mm_To_Pt (const double &dValue) -{ - return dValue * 72 / 10 / 2.54; -} - -AVSINLINE double Mm_To_Px (const double &dValue) -{ - return dValue * 72 * 4 / 3 / 10 / 2.54; -} - -AVSINLINE double Mm_To_Inch (const double &dValue) -{ - return dValue / 2.54 / 10; -} - -AVSINLINE double Mm_To_Dx (const double &dValue) -{ - return dValue * 72 * 20 / 10 / 2.54; -} -AVSINLINE double Mm_To_Sx (const double &dValue) -{ - return dValue * 72 * 100 * 1000 / 10 / 20; -} -AVSINLINE double Mm_To_Multi (const double &dValue) -{ - return dValue * 72 * 20 / 10 / 2.54; -} -AVSINLINE double Mm_To_Emu (const double &dValue) -{ - return dValue * 36000; -} -AVSINLINE double Pt_To_Cm (const double &dValue) -{ - return dValue * 2.54 / 72; -} - -AVSINLINE double Pt_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10 / 72; -} - -AVSINLINE double Pt_To_Px (const double &dValue) -{ - return dValue * 4 / 3; -} - -AVSINLINE double Pt_To_Inch (const double &dValue) -{ - return dValue / 72; -} - -AVSINLINE double Pt_To_Dx (const double &dValue) -{ - return dValue * 20; -} - -AVSINLINE double Pt_To_Sx (const double &dValue) -{ - return dValue * 2.54 * 100 * 1000 / 20; -} - -AVSINLINE double Pt_To_Multi (const double &dValue) -{ - return dValue * 20; -} -AVSINLINE double Pt_To_Emu (const double &dValue) -{ - return dValue * 12700; -} -AVSINLINE double Px_To_Cm (const double &dValue) -{ - return dValue * 2.54 * 3/ 72 / 4; -} -AVSINLINE double Px_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10 * 3/ 72 /4; -} -AVSINLINE double Px_To_Pt (const double &dValue) -{ - return dValue * 3 / 4; -} -AVSINLINE double Px_To_Inch (const double &dValue) -{ - return dValue * 3 / 72 / 4; -} - -AVSINLINE double Px_To_Dx (const double &dValue) -{ - return dValue * 20 * 3 / 4; -} -AVSINLINE double Px_To_Sx (const double &dValue) -{ - return dValue * 2.54 * 100 * 1000 * 3/ 20 / 4; -} - -AVSINLINE double Px_To_Multi (const double &dValue) -{ - return dValue * 20 * 3 / 4; -} - -AVSINLINE double Px_To_Emu (const double &dValue) -{ - return dValue * 9525; -} - -AVSINLINE double Inch_To_Cm (const double &dValue) -{ - return dValue * 2.54; -} -AVSINLINE double Inch_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10; -} -AVSINLINE double Inch_To_Pt (const double &dValue) -{ - return dValue * 72; -} - -AVSINLINE double Inch_To_Px (const double &dValue) -{ - return dValue * 72 * 4 / 3; -} - -AVSINLINE double Inch_To_Dx (const double &dValue) -{ - return dValue * 72 * 20; -} - -AVSINLINE double Inch_To_Sx (const double &dValue) -{ - return dValue * 1000 * 100 * 2.54 * 72 / 20; -} - -AVSINLINE double Inch_To_Multi(const double &dValue) -{ - return dValue * 72 * 20; -} -AVSINLINE double Inch_To_Emu (const double &dValue) -{ - return dValue * 914400; -} -AVSINLINE double Dx_To_Cm (const double &dValue) -{ - return dValue * 2.54 / 72 / 20; -} -AVSINLINE double Dx_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10 / 72 / 20; -} -AVSINLINE double Dx_To_Pt (const double &dValue) -{ - return dValue / 20; -} - -AVSINLINE double Dx_To_Px (const double &dValue) -{ - return dValue * 4 / 3 / 20; -} - -AVSINLINE double Dx_To_Inch (const double &dValue) -{ - return dValue / 20 / 72; -} - -AVSINLINE double Dx_To_Sx (const double &dValue) -{ - return dValue * 635; -} - -AVSINLINE double Dx_To_Multi (const double &dValue) -{ - return dValue; -} - -AVSINLINE double Dx_To_Emu (const double &dValue) -{ - return dValue * 635; -} - -AVSINLINE double Sx_To_Cm (const double &dValue) -{ - return dValue * 20 / 72 / 100 / 1000; -} -AVSINLINE double Sx_To_Mm (const double &dValue) -{ - return dValue * 20 / 72 / 100 / 1000 * 10; -} -AVSINLINE double Sx_To_Pt (const double &dValue) -{ - return dValue * 20 / 100 / 1000 / 2.54; -} - -AVSINLINE double Sx_To_Px (const double &dValue) -{ - return dValue * 20 * 4 / 3 / 100 / 1000 / 2.54; -} - -AVSINLINE double Sx_To_Inch (const double &dValue) -{ - return dValue * 20 / 2.54 / 72 / 100 / 1000; -} - -AVSINLINE double Sx_To_Dx (const double &dValue) -{ - return dValue * 20 * 20 / 2.54 / 100 / 1000; -} - -AVSINLINE double Sx_To_Multi (const double &dValue) -{ - return dValue * 20 * 20 / 2.54 / 100 / 1000; -} - -AVSINLINE double Sx_To_Emu (const double &dValue) -{ - return dValue; -} - -AVSINLINE double Multi_To_Cm (const double &dValue) -{ - return dValue * 2.54 / 72 / 20; -} -AVSINLINE double Multi_To_Mm (const double &dValue) -{ - return dValue * 2.54 * 10 / 72 / 20; -} -AVSINLINE double Multi_To_Pt (const double &dValue) -{ - return dValue / 20; -} - -AVSINLINE double Multi_To_Px (const double &dValue) -{ - return dValue * 4 / 3 / 20; -} - -AVSINLINE double Multi_To_Inch(const double &dValue) -{ - return dValue / 20 / 72; -} - -AVSINLINE double Multi_To_Sx (const double &dValue) -{ - return dValue * 635; -} - -AVSINLINE double Multi_To_Dx (const double &dValue) -{ - return dValue; -} - - - - -AVSINLINE double Multi_To_Emu (const double &dValue) -{ - return dValue * 635; -} - - - - -AVSINLINE double Emu_To_Cm (const double &dValue) -{ - return dValue / 360000; -} -AVSINLINE double Emu_To_Mm (const double &dValue) -{ - return dValue / 36000; -} -AVSINLINE double Emu_To_Pt (const double &dValue) -{ - return dValue / 12700; -} - -AVSINLINE double Emu_To_Px (const double &dValue) -{ - return dValue / 9525; -} - -AVSINLINE double Emu_To_Inch (const double &dValue) -{ - return dValue / 914400; -} - -AVSINLINE double Emu_To_Sx (const double &dValue) -{ - return dValue; -} - -AVSINLINE double Emu_To_Dx (const double &dValue) -{ - return dValue / 635; -} -AVSINLINE double Emu_To_Multi (const double &dValue) -{ - return dValue / 635; -} - - - - - -#endif // _UNIT_INCLUDE_H_ \ No newline at end of file diff --git a/Common/DocxFormat/Source/Utility/Utility.h b/Common/DocxFormat/Source/Utility/Utility.h deleted file mode 100644 index 61c278fd37..0000000000 --- a/Common/DocxFormat/Source/Utility/Utility.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (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 -#ifndef UTILITY_UTILITY_INCLUDE_H_ -#define UTILITY_UTILITY_INCLUDE_H_ - -#include "DateTime.h" -#include "Unit.h" - -#ifdef _HTML_FILE - -#include "TxtFile.h" -#include -#include -#include -#include - -template -static const std::vector transform(const std::vector& lines, const Out(*func)(const In&)) -{ - std::vector result; - BOOST_FOREACH(const In& line, lines) - { - result.push_back(func(line)); - } - return result; -} - - -template -static const std::vector transform(const std::vector& lines, const Out(*func)(const In&)) -{ - std::vector result; - BOOST_FOREACH(const In& line, lines) - { - result.push_back(func(line)); - } - return result; -} - -#endif // _HTML_FILE - -#endif // UTILITY_UTILITY_INCLUDE_H_ diff --git a/Common/DocxFormat/Source/XML/XmlSimple.cpp b/Common/DocxFormat/Source/XML/XmlSimple.cpp new file mode 100644 index 0000000000..b1e7a689c1 --- /dev/null +++ b/Common/DocxFormat/Source/XML/XmlSimple.cpp @@ -0,0 +1,223 @@ +/* + * (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 "../Base/Nullable.h" +#include "../../../../DesktopEditor/common/File.h" +#include "XmlSimple.h" + +namespace XmlUtils +{ + CAttribute::CAttribute() + { + m_strValue = L""; + } + void CAttribute::Write(const std::wstring& strName, const int& value) + { + m_strValue += L" " + strName + L"=\"" + std::to_wstring(value) + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const size_t& value) + { + m_strValue += L" " + strName + L"=\"" + std::to_wstring((unsigned int)value) + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const double& value) + { + m_strValue += L" " + strName + L"=\"" + XmlUtils::ToString(value) + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const std::wstring& value) + { + m_strValue += (L" ") + strName + L"=\"" + value + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const bool& value) + { + if (value) + m_strValue += (L" ") + strName + L"=\"true\""; + else + m_strValue += (L" ") + strName + L"=\"false\""; + } + + void CAttribute::Write(const std::wstring& strName, const nullable_int& value) + { + if (!value.IsInit()) + return; + m_strValue += L" " + strName + L"=\"" + std::to_wstring(*value) + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const nullable_uint& value) + { + if (!value.IsInit()) + return; + m_strValue += L" " + strName + L"=\"" + std::to_wstring(*value) + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const nullable_sizet& value) + { + if (!value.IsInit()) + return; + m_strValue += L" " + strName + L"=\"" + std::to_wstring((unsigned int)*value) + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const nullable_double& value) + { + if (!value.IsInit()) + return; + m_strValue += L" " + strName + L"=\"" + XmlUtils::ToString(*value) + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const nullable_string& value) + { + if (!value.IsInit()) + return; + m_strValue += (L" ") + strName + L"=\"" + *value + L"\""; + } + void CAttribute::Write(const std::wstring& strName, const nullable_bool& value) + { + if (!value.IsInit()) + return; + + m_strValue += (L" ") + strName + ((*value) ? L"=\"1\"" : L"=\"0\""); + } + void CAttribute::Write2(const std::wstring& strName, const nullable_bool& value) + { + if (!value.IsInit()) + return; + m_strValue += (L" ") + strName + ((*value) ? L"=\"true\"" : L"=\"false\""); + } + + CAttribute::CAttribute(const CAttribute& oSrc) + { + *this = oSrc; + } + CAttribute& CAttribute::operator=(const CAttribute& oSrc) + { + m_strValue = oSrc.m_strValue; + return (*this); + } + + CNodeValue::CNodeValue() + { + m_strValue = L""; + } + + // --------------------------------------------------------------- // + void CNodeValue::Write2(const std::wstring& strName, const int& value) + { + Write2(strName, std::to_wstring(value)); + } + void CNodeValue::Write2(const std::wstring& strName, const size_t& value) + { + std::wstring s = L"=\"" + std::to_wstring((unsigned int)value) + L"\""; + Write2(strName, s); + } + void CNodeValue::Write2(const std::wstring& strName, const double& value) + { + std::wstring s = L"=\"" + XmlUtils::ToString(value) + L"\""; + Write2(strName, s); + } + void CNodeValue::Write2(const std::wstring& strName, const std::wstring& value) + { + m_strValue += (L"<") + strName + L">" + value + L""; + } + void CNodeValue::Write2(const std::wstring& strName, const bool& value) + { + if (value) + m_strValue += (L"<") + strName + L">true"; + else + m_strValue += (L"<") + strName + L">false"; + } + + // ---------------------------------------------------------------- // + void CNodeValue::Write2(const std::wstring& strName, const nullable_int& value) + { + if (value.IsInit()) + Write2(strName, *value); + } + void CNodeValue::Write2(const std::wstring& strName, const nullable_sizet& value) + { + if (value.IsInit()) + Write2(strName, *value); + } + void CNodeValue::Write2(const std::wstring& strName, const nullable_double& value) + { + if (value.IsInit()) + Write2(strName, *value); + } + void CNodeValue::Write2(const std::wstring& strName, const nullable_string& value) + { + if (value.IsInit()) + Write2(strName, *value); + } + void CNodeValue::Write2(const std::wstring& strName, const nullable_bool& value) + { + if (value.IsInit()) + Write2(strName, *value); + } + + std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr) + { + if (strName.empty()) return L""; + + return L"<" + strName + (oAttr.m_strValue.empty() ? L"" : L" " + oAttr.m_strValue) + L"/>"; + } + std::wstring CreateNode(const std::wstring& strName, const CNodeValue& oNode) + { + if (strName.empty()) return L""; + + if (oNode.m_strValue.empty()) + return L"<" + strName + L"/>"; + + return L"<" + strName + L">" + oNode.m_strValue + L""; + } + std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr, const CNodeValue& oNode) + { + if (strName.empty()) return L""; + + if ( oNode.m_strValue.empty()) + return CreateNode(strName, oAttr); + + return L"<" + strName + (oAttr.m_strValue.empty() ? L"" : L" " + oAttr.m_strValue) + L">" + oNode.m_strValue + L""; + } + std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr, const std::wstring& strXml) + { + if (strName.empty()) return L""; + + if (strXml.empty()) return L"<" + strName + (oAttr.m_strValue.empty() ? L"" : L" " + oAttr.m_strValue) + L"/>"; + else return L"<" + strName + (oAttr.m_strValue.empty() ? L"" : L" " + oAttr.m_strValue) + L">" + strXml + L""; + + } + std::wstring CreateNode(const std::wstring& strName, const std::wstring& strXml) + { + if (strName.empty()) return L""; + + if (strXml.empty()) return L"<" + strName + L"/>"; + else return L"<" + strName + L">" + strXml + L""; + } + + void SaveToFile(const std::wstring& strFile, const std::wstring& strXml) + { + NSFile::CFileBinary::SaveToFile(strFile, strXml); + } +} diff --git a/Common/DocxFormat/Source/XML/XmlSimple.h b/Common/DocxFormat/Source/XML/XmlSimple.h index 6817798e82..3f228cd217 100644 --- a/Common/DocxFormat/Source/XML/XmlSimple.h +++ b/Common/DocxFormat/Source/XML/XmlSimple.h @@ -31,48 +31,23 @@ */ #pragma once -#include "../../../../DesktopEditor/xml/include/xmlutils.h" #include "../Base/Nullable.h" -#include "../XML/Utils.h" - -#include "../../../../DesktopEditor/common/File.h" -#include "../../../../DesktopEditor/common/Directory.h" -#include "../SystemUtility/SystemUtility.h" namespace XmlUtils { + using namespace NSCommon; class CAttribute { public: std::wstring m_strValue; - CAttribute() - { - m_strValue = L""; - } - AVSINLINE void Write(const std::wstring& strName, const int& value) - { - m_strValue += L" " + strName + L"=\"" + std::to_wstring(value) + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const size_t& value) - { - m_strValue += L" " + strName + L"=\"" + std::to_wstring((unsigned int)value) + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const double& value) - { - m_strValue += L" " + strName + L"=\"" + XmlUtils::DoubleToString(value) + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const std::wstring& value) - { - m_strValue += (L" ") + strName + L"=\"" + value + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const bool& value) - { - if (value) - m_strValue += (L" ") + strName + L"=\"true\""; - else - m_strValue += (L" ") + strName + L"=\"false\""; - } + CAttribute(); + void Write(const std::wstring& strName, const int& value); + void Write(const std::wstring& strName, const size_t& value); + void Write(const std::wstring& strName, const double& value); + void Write(const std::wstring& strName, const std::wstring& value); + void Write(const std::wstring& strName, const bool& value); + template AVSINLINE void WriteLimit(const std::wstring& strName, const T& value) { @@ -94,51 +69,6 @@ namespace XmlUtils { Write(strName, value.ToString()); } - - public: - AVSINLINE void Write(const std::wstring& strName, const nullable_int& value) - { - if (!value.IsInit()) - return; - m_strValue += L" " + strName + L"=\"" + std::to_wstring(*value) + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const nullable_uint& value) - { - if (!value.IsInit()) - return; - m_strValue += L" " + strName + L"=\"" + std::to_wstring(*value) + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const nullable_sizet& value) - { - if (!value.IsInit()) - return; - m_strValue += L" " + strName + L"=\"" + std::to_wstring((unsigned int)*value) + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const nullable_double& value) - { - if (!value.IsInit()) - return; - m_strValue += L" " + strName + L"=\"" + XmlUtils::DoubleToString(*value) + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const nullable_string& value) - { - if (!value.IsInit()) - return; - m_strValue += (L" ") + strName + L"=\"" + *value + L"\""; - } - AVSINLINE void Write(const std::wstring& strName, const nullable_bool& value) - { - if (!value.IsInit()) - return; - - m_strValue += (L" ") + strName + ((*value) ? L"=\"1\"" : L"=\"0\""); - } - AVSINLINE void Write2(const std::wstring& strName, const nullable_bool& value) - { - if (!value.IsInit()) - return; - m_strValue += (L" ") + strName + ((*value) ? L"=\"true\"" : L"=\"false\""); - } template AVSINLINE void WriteLimitNullable(const std::wstring& strName, const nullable_limit& value) { @@ -146,17 +76,19 @@ namespace XmlUtils return; Write(strName, value->get()); } + + public: + void Write(const std::wstring& strName, const nullable_int& value); + void Write(const std::wstring& strName, const nullable_uint& value); + void Write(const std::wstring& strName, const nullable_sizet& value); + void Write(const std::wstring& strName, const nullable_double& value); + void Write(const std::wstring& strName, const nullable_string& value); + void Write(const std::wstring& strName, const nullable_bool& value); + void Write2(const std::wstring& strName, const nullable_bool& value); public: - CAttribute(const CAttribute& oSrc) - { - *this = oSrc; - } - CAttribute& operator=(const CAttribute& oSrc) - { - m_strValue = oSrc.m_strValue; - return (*this); - } + CAttribute(const CAttribute& oSrc); + CAttribute& operator=(const CAttribute& oSrc); }; class CNodeValue @@ -165,10 +97,8 @@ namespace XmlUtils std::wstring m_strValue; public: - CNodeValue() - { - m_strValue = L""; - } + CNodeValue(); + template AVSINLINE void Write(T& value) { @@ -197,111 +127,33 @@ namespace XmlUtils m_strValue += (L""; } - template - AVSINLINE void WriteArray(const std::vector& oArray) - { - size_t count = oArray.size(); - for (size_t i = 0; i < count; ++i) - m_strValue += oArray[i].toXML(); - } + template + AVSINLINE void WriteArray(const std::vector& oArray) + { + size_t count = oArray.size(); + for (size_t i = 0; i < count; ++i) + m_strValue += oArray[i].toXML(); + } // --------------------------------------------------------------- // - AVSINLINE void Write2(const std::wstring& strName, const int& value) - { - Write2(strName, std::to_wstring(value)); - } - AVSINLINE void Write2(const std::wstring& strName, const size_t& value) - { - std::wstring s = L"=\"" + std::to_wstring((unsigned int)value) + L"\""; - Write2(strName, s); - } - AVSINLINE void Write2(const std::wstring& strName, const double& value) - { - std::wstring s = L"=\"" + XmlUtils::DoubleToString(value) + L"\""; - Write2(strName, s); - } - AVSINLINE void Write2(const std::wstring& strName, const std::wstring& value) - { - m_strValue += (L"<") + strName + L">" + value + L""; - } - AVSINLINE void Write2(const std::wstring& strName, const bool& value) - { - if (value) - m_strValue += (L"<") + strName + L">true"; - else - m_strValue += (L"<") + strName + L">false"; - } + void Write2(const std::wstring& strName, const int& value); + void Write2(const std::wstring& strName, const size_t& value); + void Write2(const std::wstring& strName, const double& value); + void Write2(const std::wstring& strName, const std::wstring& value); + void Write2(const std::wstring& strName, const bool& value); // ---------------------------------------------------------------- // - AVSINLINE void Write2(const std::wstring& strName, const nullable_int& value) - { - if (value.IsInit()) - Write2(strName, *value); - } - AVSINLINE void Write2(const std::wstring& strName, const nullable_sizet& value) - { - if (value.IsInit()) - Write2(strName, *value); - } - AVSINLINE void Write2(const std::wstring& strName, const nullable_double& value) - { - if (value.IsInit()) - Write2(strName, *value); - } - AVSINLINE void Write2(const std::wstring& strName, const nullable_string& value) - { - if (value.IsInit()) - Write2(strName, *value); - } - AVSINLINE void Write2(const std::wstring& strName, const nullable_bool& value) - { - if (value.IsInit()) - Write2(strName, *value); - } + void Write2(const std::wstring& strName, const nullable_int& value); + void Write2(const std::wstring& strName, const nullable_sizet& value); + void Write2(const std::wstring& strName, const nullable_double& value); + void Write2(const std::wstring& strName, const nullable_string& value); + void Write2(const std::wstring& strName, const nullable_bool& value); }; - AVSINLINE std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr) - { - if (strName.empty()) return L""; + std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr); + std::wstring CreateNode(const std::wstring& strName, const CNodeValue& oNode); + std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr, const CNodeValue& oNode); + std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr, const std::wstring& strXml); + std::wstring CreateNode(const std::wstring& strName, const std::wstring& strXml); - return L"<" + strName + (oAttr.m_strValue.empty() ? L"" : L" " + oAttr.m_strValue) + L"/>"; - } - AVSINLINE std::wstring CreateNode(const std::wstring& strName, const CNodeValue& oNode) - { - if (strName.empty()) return L""; - - if (oNode.m_strValue.empty()) - return L"<" + strName + L"/>"; - - return L"<" + strName + L">" + oNode.m_strValue + L""; - } - AVSINLINE std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr, const CNodeValue& oNode) - { - if (strName.empty()) return L""; - - if ( oNode.m_strValue.empty()) - return CreateNode(strName, oAttr); - - return L"<" + strName + (oAttr.m_strValue.empty() ? L"" : L" " + oAttr.m_strValue) + L">" + oNode.m_strValue + L""; - } - AVSINLINE std::wstring CreateNode(const std::wstring& strName, const CAttribute& oAttr, const std::wstring& strXml) - { - if (strName.empty()) return L""; - - if (strXml.empty()) return L"<" + strName + (oAttr.m_strValue.empty() ? L"" : L" " + oAttr.m_strValue) + L"/>"; - else return L"<" + strName + (oAttr.m_strValue.empty() ? L"" : L" " + oAttr.m_strValue) + L">" + strXml + L""; - - - } - AVSINLINE std::wstring CreateNode(const std::wstring& strName, const std::wstring& strXml) - { - if (strName.empty()) return L""; - - if (strXml.empty()) return L"<" + strName + L"/>"; - else return L"<" + strName + L">" + strXml + L""; - } - - AVSINLINE void SaveToFile(const std::wstring& strFile, const std::wstring& strXml) - { - NSFile::CFileBinary::SaveToFile(strFile, strXml); - } + void SaveToFile(const std::wstring& strFile, const std::wstring& strXml); } diff --git a/Common/DocxFormat/Source/XlsbFormat/ChartSheetStream.h b/Common/DocxFormat/Source/XlsbFormat/ChartSheetStream.h index a3b1168583..c94d37b051 100644 --- a/Common/DocxFormat/Source/XlsbFormat/ChartSheetStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/ChartSheetStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/CommentsStream.h b/Common/DocxFormat/Source/XlsbFormat/CommentsStream.h index 24e9ccf240..7906dc42f5 100644 --- a/Common/DocxFormat/Source/XlsbFormat/CommentsStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/CommentsStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/ConnectionsStream.h b/Common/DocxFormat/Source/XlsbFormat/ConnectionsStream.h index fdb491ea69..3b298e4bdf 100644 --- a/Common/DocxFormat/Source/XlsbFormat/ConnectionsStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/ConnectionsStream.h @@ -34,7 +34,7 @@ #define CONNECTIONSTREAM_H #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/ExternalLinkStream.h b/Common/DocxFormat/Source/XlsbFormat/ExternalLinkStream.h index 7bb8013b4c..2028507cef 100644 --- a/Common/DocxFormat/Source/XlsbFormat/ExternalLinkStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/ExternalLinkStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/PivotCacheDefStream.h b/Common/DocxFormat/Source/XlsbFormat/PivotCacheDefStream.h index 692ddf2f6a..a02a0b53de 100644 --- a/Common/DocxFormat/Source/XlsbFormat/PivotCacheDefStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/PivotCacheDefStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/PivotCacheRecordsStream.h b/Common/DocxFormat/Source/XlsbFormat/PivotCacheRecordsStream.h index b1740c2ecd..87e8d59a29 100644 --- a/Common/DocxFormat/Source/XlsbFormat/PivotCacheRecordsStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/PivotCacheRecordsStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/PivotTableStream.h b/Common/DocxFormat/Source/XlsbFormat/PivotTableStream.h index 448f047d8a..fdaf75a9f7 100644 --- a/Common/DocxFormat/Source/XlsbFormat/PivotTableStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/PivotTableStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/QueryTableStream.h b/Common/DocxFormat/Source/XlsbFormat/QueryTableStream.h index 898f0ef1d9..5d2d18e284 100644 --- a/Common/DocxFormat/Source/XlsbFormat/QueryTableStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/QueryTableStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/SharedStringsStream.h b/Common/DocxFormat/Source/XlsbFormat/SharedStringsStream.h index baea659025..8869502c98 100644 --- a/Common/DocxFormat/Source/XlsbFormat/SharedStringsStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/SharedStringsStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/SlicerCachesStream.h b/Common/DocxFormat/Source/XlsbFormat/SlicerCachesStream.h index d286436e6f..fbda865cce 100644 --- a/Common/DocxFormat/Source/XlsbFormat/SlicerCachesStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/SlicerCachesStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/SlicersStream.h b/Common/DocxFormat/Source/XlsbFormat/SlicersStream.h index def3ad8022..3c0bfd2efe 100644 --- a/Common/DocxFormat/Source/XlsbFormat/SlicersStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/SlicersStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/StylesStream.h b/Common/DocxFormat/Source/XlsbFormat/StylesStream.h index 17a3dd1b4e..2dba88d97d 100644 --- a/Common/DocxFormat/Source/XlsbFormat/StylesStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/StylesStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/TableStream.h b/Common/DocxFormat/Source/XlsbFormat/TableStream.h index 46bda153df..a621e35296 100644 --- a/Common/DocxFormat/Source/XlsbFormat/TableStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/TableStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/WorkBookStream.h b/Common/DocxFormat/Source/XlsbFormat/WorkBookStream.h index 3a20ccd033..3bbaeec6b4 100644 --- a/Common/DocxFormat/Source/XlsbFormat/WorkBookStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/WorkBookStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsbFormat/WorkSheetStream.h b/Common/DocxFormat/Source/XlsbFormat/WorkSheetStream.h index 7a8eeb9c0a..36631e47e0 100644 --- a/Common/DocxFormat/Source/XlsbFormat/WorkSheetStream.h +++ b/Common/DocxFormat/Source/XlsbFormat/WorkSheetStream.h @@ -35,7 +35,7 @@ #include "../../../../DesktopEditor/common/Types.h" -#include "../Base/Types_32.h" +#include "../Base/Base.h" #include "../XlsxFormat/WritingElement.h" #include #include diff --git a/Common/DocxFormat/Source/XlsxFormat/CalcChain/CalcChain.h b/Common/DocxFormat/Source/XlsxFormat/CalcChain/CalcChain.h index b6902e5324..24e6894122 100644 --- a/Common/DocxFormat/Source/XlsxFormat/CalcChain/CalcChain.h +++ b/Common/DocxFormat/Source/XlsxFormat/CalcChain/CalcChain.h @@ -89,12 +89,12 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oArray; - nullable> m_oSheetId; - nullable> m_oDependencyLevel; + nullable m_oArray; + nullable m_oSheetId; + nullable m_oDependencyLevel; nullable m_oRef; - nullable> m_oChildChain; - nullable> m_oNewThread; + nullable m_oChildChain; + nullable m_oNewThread; }; //необработанные child: // diff --git a/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerialize.cpp b/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerialize.cpp index 07bb0149e1..51ab7a74f2 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerialize.cpp +++ b/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerialize.cpp @@ -1308,7 +1308,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_paperSize = new unsigned long; std::wstring s_m_paperSize("1"); { - *m_paperSize = _ttoi(s_m_paperSize); + *m_paperSize = XmlUtils::GetInteger(s_m_paperSize); }*/ m_paperSize = NULL; m_paperHeight = NULL; @@ -1316,7 +1316,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_firstPageNumber = new unsigned long; std::wstring s_m_firstPageNumber("1"); { - *m_firstPageNumber = _ttoi(s_m_firstPageNumber); + *m_firstPageNumber = XmlUtils::GetInteger(s_m_firstPageNumber); }*/ m_firstPageNumber = NULL; /*m_orientation = new ST_PageSetupOrientation; @@ -1355,19 +1355,19 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_horizontalDpi = new long; std::wstring s_m_horizontalDpi("600"); { - *m_horizontalDpi = _ttoi(s_m_horizontalDpi); + *m_horizontalDpi = XmlUtils::GetInteger(s_m_horizontalDpi); }*/ m_horizontalDpi = NULL; /*m_verticalDpi = new long; std::wstring s_m_verticalDpi("600"); { - *m_verticalDpi = _ttoi(s_m_verticalDpi); + *m_verticalDpi = XmlUtils::GetInteger(s_m_verticalDpi); }*/ m_verticalDpi = NULL; /*m_copies = new unsigned long; std::wstring s_m_copies("1"); { - *m_copies = _ttoi(s_m_copies); + *m_copies = XmlUtils::GetInteger(s_m_copies); }*/ m_copies = NULL; } @@ -1478,7 +1478,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_paperSize = pNewElem; } else if(_T("paperHeight") == wsName) @@ -1499,7 +1499,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_firstPageNumber = pNewElem; } else if(_T("orientation") == wsName) @@ -1552,21 +1552,21 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { long* pNewElem = new long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_horizontalDpi = pNewElem; } else if(_T("verticalDpi") == wsName) { long* pNewElem = new long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_verticalDpi = pNewElem; } else if(_T("copies") == wsName) { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_copies = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -1638,42 +1638,42 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_l = pNewElem; } else if(_T("r") == wsName) { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_r = pNewElem; } else if(_T("t") == wsName) { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_t = pNewElem; } else if(_T("b") == wsName) { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_b = pNewElem; } else if(_T("header") == wsName) { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_header = pNewElem; } else if(_T("footer") == wsName) { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_footer = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -2202,7 +2202,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -2780,7 +2780,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); *pNewElem = 0; try { - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); } catch(...) { @@ -3306,7 +3306,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -3777,7 +3777,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_idx = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -4010,7 +4010,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -4483,7 +4483,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -6035,7 +6035,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_val = new unsigned char; std::wstring s_m_val("5"); { - *m_val = _ttoi(s_m_val); + *m_val = XmlUtils::GetInteger(s_m_val); }*/ m_val = NULL; } @@ -6067,7 +6067,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned char* pNewElem = new unsigned char; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -6241,7 +6241,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { double* pNewElem = new double; std::wstring sVal = oReader.GetText(); - *pNewElem = _tstof(sVal.c_str()); + *pNewElem = std::stod(sVal.c_str()); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -7474,7 +7474,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_val = new unsigned char; std::wstring s_m_val("2"); { - *m_val = _ttoi(s_m_val); + *m_val = XmlUtils::GetInteger(s_m_val); }*/ m_val = NULL; } @@ -7506,7 +7506,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned char* pNewElem = new unsigned char; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -7516,7 +7516,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_val = new unsigned long; std::wstring s_m_val("2"); { - *m_val = _ttoi(s_m_val); + *m_val = XmlUtils::GetInteger(s_m_val); }*/ m_val = NULL; } @@ -7548,7 +7548,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -8134,7 +8134,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_idx = pNewElem; } else if(_T("formatCode") == wsName) @@ -10530,7 +10530,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_val = new unsigned long; std::wstring s_m_val("0"); { - *m_val = _ttoi(s_m_val); + *m_val = XmlUtils::GetInteger(s_m_val); }*/ m_val = NULL; } @@ -10562,7 +10562,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -13535,7 +13535,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_val = new unsigned char; std::wstring s_m_val("30"); { - *m_val = _ttoi(s_m_val); + *m_val = XmlUtils::GetInteger(s_m_val); }*/ m_val = NULL; } @@ -13567,7 +13567,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned char* pNewElem = new unsigned char; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -13619,7 +13619,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_val = new unsigned long; std::wstring s_m_val("0"); { - *m_val = _ttoi(s_m_val); + *m_val = XmlUtils::GetInteger(s_m_val); }*/ m_val = NULL; } @@ -13651,7 +13651,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned long* pNewElem = new unsigned long; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -13703,7 +13703,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); /*m_val = new char; std::wstring s_m_val("0"); { - *m_val = _ttoi(s_m_val); + *m_val = XmlUtils::GetInteger(s_m_val); }*/ m_val = NULL; } @@ -13735,7 +13735,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { signed char* pNewElem = new signed char; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) @@ -14408,7 +14408,7 @@ xmlns:c14=\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\""); { unsigned char* pNewElem = new unsigned char; std::wstring sVal = oReader.GetText(); - *pNewElem = _ttoi(sVal.c_str()); + *pNewElem = XmlUtils::GetInteger(sVal); m_val = pNewElem; } WritingElement_ReadAttributes_End_No_NS( oReader ) 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/Chart/ChartSerializeEx.h b/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerializeEx.h index 3692c05d0f..af40a8489b 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerializeEx.h +++ b/Common/DocxFormat/Source/XlsxFormat/Chart/ChartSerializeEx.h @@ -56,7 +56,7 @@ namespace ChartEx void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_dir; + nullable m_dir; std::wstring m_content; }; //------------------------------------------------------------------------------------------------------ @@ -115,8 +115,8 @@ namespace ChartEx nullable m_oExtLst; //for chart title only (but not axis title) - nullable> m_pos; - nullable> m_align; + nullable m_pos; + nullable m_align; nullable_bool m_overlay; }; //------------------------------------------------------------------------------------------------------ @@ -263,7 +263,7 @@ namespace ChartEx nullable_double m_binSize; nullable_int m_binCount; - nullable> m_intervalClosed; + nullable m_intervalClosed; nullable> m_underflow; nullable> m_overflow; }; @@ -283,7 +283,7 @@ namespace ChartEx void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_quartileMethod; + nullable m_quartileMethod; }; //------------------------------------------------------------------------------ class CSubtotals : public WritingElement @@ -387,7 +387,7 @@ namespace ChartEx nullable_string m_separator; //node nullable_int m_idx; - nullable> m_dataLabelPos; + nullable m_dataLabelPos; }; //------------------------------------------------------------------------------ class CDataLabels : public WritingElement @@ -415,7 +415,7 @@ namespace ChartEx std::vector m_arDataLabel; std::vector m_arDataLabelHidden; - nullable> m_pos; + nullable m_pos; }; //------------------------------------------------------------------------------ class CDataPoint : public WritingElement @@ -467,7 +467,7 @@ namespace ChartEx nullable m_oSpPr; nullable m_oExtLst; - nullable> m_oLayoutId; + nullable m_oLayoutId; nullable_bool m_bHidden; nullable_int m_nOwnerIdx; nullable_string m_sUniqueId; @@ -551,7 +551,7 @@ namespace ChartEx nullable m_oExtLst; nullable m_unitsLabel; - nullable> m_unit; + nullable m_unit; }; //------------------------------------------------------------------------------ class CGridlines : public WritingElement @@ -589,7 +589,7 @@ namespace ChartEx void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); nullable m_oExtLst; - nullable> m_type; + nullable m_type; std::wstring m_name; }; //------------------------------------------------------------------------------ @@ -705,8 +705,8 @@ namespace ChartEx nullable m_oTxPr; nullable m_oExtLst; - nullable> m_pos; - nullable> m_align; + nullable m_pos; + nullable m_align; nullable_bool m_overlay; }; //------------------------------------------------------------------------------ @@ -745,7 +745,7 @@ namespace ChartEx nullable m_f; nullable_string m_nf; - nullable> m_type; + nullable m_type; nullable m_oExtLst; }; //------------------------------------------------------------------------------ diff --git a/Common/DocxFormat/Source/XlsxFormat/Chart/ChartStyle.h b/Common/DocxFormat/Source/XlsxFormat/Chart/ChartStyle.h index af1bf5bdd2..dc7fd21d95 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Chart/ChartStyle.h +++ b/Common/DocxFormat/Source/XlsxFormat/Chart/ChartStyle.h @@ -34,7 +34,7 @@ #include "../../Base/Nullable.h" #include "../../DocxFormat/Drawing/DrawingExt.h" -#include "../SimpleTypes_Spreadsheet.h" +#include "../../Common/SimpleTypes_Spreadsheet.h" #include "../WritingElement.h" #include "../../../../../ASCOfficePPTXFile/PPTXFormat/Logic/StyleRef.h" #include "../../../../../ASCOfficePPTXFile/PPTXFormat/Logic/FontRef.h" @@ -254,7 +254,7 @@ namespace ChartEx WritingElement_ReadAttributes_Read_else_if(oReader, L"size", m_size) WritingElement_ReadAttributes_End_No_NS(oReader) } - nullable> m_symbol; + nullable m_symbol; nullable_uint m_size; }; diff --git a/Common/DocxFormat/Source/XlsxFormat/Comments/Comments.h b/Common/DocxFormat/Source/XlsxFormat/Comments/Comments.h index 2912d66f64..f60b26ab4b 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Comments/Comments.h +++ b/Common/DocxFormat/Source/XlsxFormat/Comments/Comments.h @@ -264,7 +264,7 @@ namespace OOX } public: nullable m_oRef; - nullable > m_oAuthorId; + nullable m_oAuthorId; nullable m_oUid; nullable m_oText; diff --git a/Common/DocxFormat/Source/XlsxFormat/Comments/ThreadedComments.h b/Common/DocxFormat/Source/XlsxFormat/Comments/ThreadedComments.h index 14980c3f6e..d6656682e0 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Comments/ThreadedComments.h +++ b/Common/DocxFormat/Source/XlsxFormat/Comments/ThreadedComments.h @@ -307,8 +307,8 @@ namespace OOX public: nullable mentionpersonId; nullable mentionId; - nullable> startIndex; - nullable> length; + nullable startIndex; + nullable length; }; class CThreadedCommentMentions : public WritingElementWithChilds { diff --git a/Common/DocxFormat/Source/XlsxFormat/ComplexTypes_Spreadsheet.h b/Common/DocxFormat/Source/XlsxFormat/ComplexTypes_Spreadsheet.h index 1b6d181724..d0c4eab894 100644 --- a/Common/DocxFormat/Source/XlsxFormat/ComplexTypes_Spreadsheet.h +++ b/Common/DocxFormat/Source/XlsxFormat/ComplexTypes_Spreadsheet.h @@ -31,8 +31,7 @@ */ #pragma once #include "../Common/ComplexTypes.h" - -#include "SimpleTypes_Spreadsheet.h" +#include "../Common/SimpleTypes_Spreadsheet.h" namespace ComplexTypes { @@ -48,12 +47,12 @@ namespace ComplexTypes virtual std::wstring ToString() const = 0; }; - template class COnOff2 : public ComplexType { public: ComplexTypes_AdditionConstructors(COnOff2) - COnOff2() + + COnOff2() { } virtual ~COnOff2() @@ -80,17 +79,21 @@ namespace ComplexTypes return sResult; } + void FromBool(bool bVal) { m_oVal.FromBool(bVal); } + bool ToBool() { return m_oVal.ToBool(); } - SimpleTypes::COnOff m_oVal; + + SimpleTypes::COnOff m_oVal = SimpleTypes::onoffTrue; }; + class String : public ComplexType { public: @@ -242,7 +245,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; class CChartLayoutTarget : public ComplexType { @@ -289,7 +292,7 @@ namespace ComplexTypes } public: - nullable> m_oVal; + nullable m_oVal; }; class CChartHMode : public ComplexType { @@ -337,7 +340,7 @@ namespace ComplexTypes public: - nullable> m_oVal; + nullable m_oVal; }; class CChartAxPos : public ComplexType { @@ -385,7 +388,7 @@ namespace ComplexTypes public: - nullable> m_oVal; + nullable m_oVal; }; class CChartBarGrouping : public ComplexType { @@ -434,7 +437,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; class CChartBarDerection : public ComplexType { @@ -482,7 +485,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; class CChartSymbol : public ComplexType { @@ -525,7 +528,7 @@ namespace ComplexTypes public: - nullable > m_oVal; + nullable m_oVal; }; class CRegionLabelLayout : public ComplexType @@ -568,7 +571,7 @@ namespace ComplexTypes } public: - nullable> m_oVal; + nullable m_oVal; }; class CParentLabelLayout : public ComplexType { @@ -610,7 +613,7 @@ namespace ComplexTypes } public: - nullable> m_oVal; + nullable m_oVal; }; } } // ComplexTypes diff --git a/Common/DocxFormat/Source/XlsxFormat/Controls/Controls.h b/Common/DocxFormat/Source/XlsxFormat/Controls/Controls.h index 3de8527e12..446a414456 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Controls/Controls.h +++ b/Common/DocxFormat/Source/XlsxFormat/Controls/Controls.h @@ -119,22 +119,22 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oDropLines; - nullable> m_oObjectType; - nullable> m_oChecked; - nullable> m_oDropStyle; - nullable> m_oDx; - nullable> m_oInc; - nullable> m_oMin; - nullable> m_oMax; - nullable> m_oPage; - nullable> m_oSel; - nullable> m_oSelType; - nullable> m_oTextHAlign; - nullable> m_oTextVAlign; + nullable m_oDropLines; + nullable m_oObjectType; + nullable m_oChecked; + nullable m_oDropStyle; + nullable m_oDx; + nullable m_oInc; + nullable m_oMin; + nullable m_oMax; + nullable m_oPage; + nullable m_oSel; + nullable m_oSelType; + nullable m_oTextHAlign; + nullable m_oTextVAlign; nullable_int m_oVal; - nullable> m_oWidthMin; - nullable> m_oEditVal; + nullable m_oWidthMin; + nullable m_oEditVal; nullable_string m_oFmlaGroup; nullable_string m_oFmlaLink; nullable_string m_oFmlaRange; @@ -155,8 +155,8 @@ namespace OOX nullable m_oExtLst; //--------------------- nullable_string m_oText; - nullable> m_oFillColor; - nullable> m_oBorderColor; + nullable m_oFillColor; + nullable m_oBorderColor; }; //------------------------------------------------------------------------------------ class CControlPr : public WritingElement @@ -242,11 +242,11 @@ namespace OOX public: nullable_string m_oName; nullable_string m_oProgId; - nullable> m_oDvAspect; + nullable m_oDvAspect; nullable_string m_oLink; - nullable> m_oOleUpdate; + nullable m_oOleUpdate; nullable_bool m_oAutoLoad; - nullable> m_oShapeId; + nullable m_oShapeId; nullable m_oRid; nullable m_oControlPr; //--for-write-from-bin-------------- diff --git a/Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h b/Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h index e075ed62e9..844fb1e80d 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h +++ b/Common/DocxFormat/Source/XlsxFormat/Drawing/CellAnchor.h @@ -101,7 +101,7 @@ namespace OOX m_bShapeOle(false), m_bShapeControl(false) { } - CCellAnchor(const SimpleTypes::Spreadsheet::CCellAnchorType<>& oAnchorType) : m_oAnchorType(oAnchorType), + CCellAnchor(const SimpleTypes::Spreadsheet::CCellAnchorType& oAnchorType) : m_oAnchorType(oAnchorType), m_bShapeOle(false), m_bShapeControl(false) { } @@ -297,8 +297,8 @@ namespace OOX bool m_bShapeOle; bool m_bShapeControl; - SimpleTypes::Spreadsheet::CCellAnchorType<> m_oAnchorType; - nullable> m_oEditAs; + SimpleTypes::Spreadsheet::CCellAnchorType m_oAnchorType; + nullable m_oEditAs; nullable m_oFrom; nullable m_oTo; nullable m_oPos; diff --git a/Common/DocxFormat/Source/XlsxFormat/Drawing/FromTo.h b/Common/DocxFormat/Source/XlsxFormat/Drawing/FromTo.h index 406290517d..f5f0e34fa0 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Drawing/FromTo.h +++ b/Common/DocxFormat/Source/XlsxFormat/Drawing/FromTo.h @@ -115,9 +115,9 @@ namespace OOX { } public: - nullable> m_oCol; + nullable m_oCol; nullable m_oColOff; - nullable> m_oRow; + nullable m_oRow; nullable m_oRowOff; }; class CExt : public WritingElement diff --git a/Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinks.h b/Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinks.h index 22c0b86110..3f186d2db8 100644 --- a/Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinks.h +++ b/Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinks.h @@ -223,7 +223,7 @@ namespace OOX public: nullable m_oName; nullable m_oRefersTo; - nullable> m_oSheetId; + nullable m_oSheetId; }; class CExternalDefinedNames : public WritingElementWithChilds @@ -438,8 +438,8 @@ namespace OOX } public: nullable m_oRef; - nullable> m_oType; - nullable> m_oValueMetadata; + nullable m_oType; + nullable m_oValueMetadata; nullable m_oValue; }; @@ -531,7 +531,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oR; + nullable m_oR; }; class CExternalSheetData : public WritingElementWithChilds @@ -623,9 +623,10 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if( oReader, (L"refreshError"), m_oRefreshError ) WritingElement_ReadAttributes_End( oReader ) } + public: - nullable> m_oSheetId; - nullable> m_oRefreshError; + nullable m_oSheetId; + nullable m_oRefreshError; }; class CExternalSheetDataSet : public WritingElementWithChilds @@ -962,7 +963,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable > m_oType; + nullable m_oType; }; class CDdeValues : public WritingElementWithChilds @@ -1055,8 +1056,8 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oRows; - nullable> m_oCols; + nullable m_oRows; + nullable m_oCols; }; class CDdeItem : public WritingElement @@ -1156,11 +1157,12 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if( oReader, (L"preferPic"), m_oPreferPic ) WritingElement_ReadAttributes_End( oReader ) } + public: nullable m_oName; - nullable> m_oOle; - nullable> m_oAdvise; - nullable> m_oPreferPic; + nullable m_oOle; + nullable m_oAdvise; + nullable m_oPreferPic; nullable m_oDdeValues; }; @@ -1402,11 +1404,12 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if( oReader, (L"preferPic"), m_oPreferPic ) WritingElement_ReadAttributes_End( oReader ) } + public: nullable m_oName; - nullable> m_oIcon; - nullable> m_oAdvise; - nullable> m_oPreferPic; + nullable m_oIcon; + nullable m_oAdvise; + nullable m_oPreferPic; }; class COleItems : public WritingElementWithChilds diff --git a/Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.cpp b/Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.cpp new file mode 100644 index 0000000000..f9ed14dfb7 --- /dev/null +++ b/Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.cpp @@ -0,0 +1,158 @@ +/* + * (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 "./FileTypes_Spreadsheet.h" + +namespace OOX +{ + namespace Spreadsheet + { + namespace FileTypes + { + const FileType Workbook (L"xl", L"workbook.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + + const FileType WorkbookMacro (L"xl", L"workbook.xml", + L"application/vnd.ms-excel.sheet.macroEnabled.main+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + + const FileType SharedStrings (L"", L"sharedStrings.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"); + + const FileType Styles (L"", L"styles.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"); + + const FileType Worksheet (L"worksheets", L"sheet.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", + L"worksheets/sheet", true); + + const FileType Chartsheets (L"chartsheets", L"sheet.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet", + L"chartsheets/sheet", true); + + const FileType CalcChain (L"", L"calcChain.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain"); + + const FileType ThreadedComments (L"../threadedComments", L"threadedComment.xml", + L"application/vnd.ms-excel.threadedcomments+xml", + L"http://schemas.microsoft.com/office/2017/10/relationships/threadedComment", + L"threadedComments/threadedComment", true, true); + + const FileType Persons (L"persons", L"person.xml", + L"application/vnd.ms-excel.person+xml", + L"http://schemas.microsoft.com/office/2017/10/relationships/person"); + + const FileType Comments (L"../", L"comments.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", + L"comments", true, true); + + const FileType Table (L"../tables", L"table.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table", + L"tables/table", true, true); + + const FileType QueryTable (L"../queryTables", L"queryTable.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable", + L"queryTables/queryTable", true, true); + + const FileType Connections (L"", L"connections.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections"); + + const FileType CtrlProp (L"../ctrlProps", L"ctrlProp.xml", + L"application/vnd.ms-excel.controlproperties+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp", + L"ctrlProps/ctrlProp", true, true); + + const FileType Drawings (L"../drawings", L"drawing.xml", + L"application/vnd.openxmlformats-officedocument.drawing+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing", + L"drawings/drawing", true, true); + + const FileType ExternalLinks (L"externalLinks", L"externalLink.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink", + L"externalLinks/externalLink", true, true); + + const FileType PivotTable (L"../pivotTables", L"pivotTable.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable", + L"pivotTables/pivotTable", true, true); + + const FileType PivotCacheDefinition(L"pivotCache", L"pivotCacheDefinition.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition", + L"pivotCache/pivotCacheDefinition", true, true); + + const FileType PivotCacheRecords(L"", L"pivotCacheRecords.xml", + L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml", + L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords", + L"pivotCache/pivotCacheRecords", true, true); + + const FileType SlicerCache (L"slicerCaches", L"slicerCache.xml", + L"application/vnd.ms-excel.slicerCache+xml", + L"http://schemas.microsoft.com/office/2007/relationships/slicerCache", + L"slicerCaches/slicerCache", true, true); + + const FileType Slicer (L"../slicers", L"slicer.xml", + L"application/vnd.ms-excel.slicer+xml", + L"http://schemas.microsoft.com/office/2007/relationships/slicer", + L"slicers/slicer", true, true); + + const FileType NamedSheetView (L"../namedSheetViews", L"namedSheetView.xml", + L"application/vnd.ms-excel.namedsheetviews+xml", + L"http://schemas.microsoft.com/office/2019/04/relationships/namedSheetView", + L"namedSheetViews/namedSheetView", true, true); + + const FileType XlBinaryIndex (L"worksheets", L"binaryIndex.bin", + L"application/vnd.ms-excel.binIndexW", + L"http://schemas.microsoft.com/office/2006/relationships/xlBinaryIndex", + L"worksheets/binaryIndex", true); + + //onlyoffice workbook comments + const FileType WorkbookComments(L"", L"workbookComments.bin", + L"", + L"http://schemas.onlyoffice.com/workbookComments"); + + + const FileType SpreadsheetFlat(L"", L"", L"", L""); + + } // namespace FileTypes + } +} // namespace OOX diff --git a/Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.h b/Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.h index 54d6d20834..76edde97a3 100644 --- a/Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.h +++ b/Common/DocxFormat/Source/XlsxFormat/FileTypes_Spreadsheet.h @@ -30,132 +30,64 @@ * */ #pragma once - #include "../DocxFormat/FileType.h" - namespace OOX { namespace Spreadsheet { namespace FileTypes { - const FileType Workbook (L"xl", L"workbook.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + extern const FileType Workbook; - const FileType WorkbookMacro (L"xl", L"workbook.xml", - L"application/vnd.ms-excel.sheet.macroEnabled.main+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"); + extern const FileType WorkbookMacro; - const FileType SharedStrings (L"", L"sharedStrings.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"); + extern const FileType SharedStrings; - const FileType Styles (L"", L"styles.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"); + extern const FileType Styles; - const FileType Worksheet (L"worksheets", L"sheet.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", - L"worksheets/sheet", true); + extern const FileType Worksheet; - const FileType Chartsheets (L"chartsheets", L"sheet.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet", - L"chartsheets/sheet", true); + extern const FileType Chartsheets; - const FileType CalcChain (L"", L"calcChain.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain"); + extern const FileType CalcChain; - const FileType ThreadedComments (L"../threadedComments", L"threadedComment.xml", - L"application/vnd.ms-excel.threadedcomments+xml", - L"http://schemas.microsoft.com/office/2017/10/relationships/threadedComment", - L"threadedComments/threadedComment", true, true); + extern const FileType ThreadedComments; - const FileType Persons (L"persons", L"person.xml", - L"application/vnd.ms-excel.person+xml", - L"http://schemas.microsoft.com/office/2017/10/relationships/person"); + extern const FileType Persons; - const FileType Comments (L"../", L"comments.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", - L"comments", true, true); + extern const FileType Comments; - const FileType Table (L"../tables", L"table.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table", - L"tables/table", true, true); + extern const FileType Table; - const FileType QueryTable (L"../queryTables", L"queryTable.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable", - L"queryTables/queryTable", true, true); + extern const FileType QueryTable; - const FileType Connections (L"", L"connections.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections"); + extern const FileType Connections; - const FileType CtrlProp (L"../ctrlProps", L"ctrlProp.xml", - L"application/vnd.ms-excel.controlproperties+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp", - L"ctrlProps/ctrlProp", true, true); + extern const FileType CtrlProp; - const FileType Drawings (L"../drawings", L"drawing.xml", - L"application/vnd.openxmlformats-officedocument.drawing+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing", - L"drawings/drawing", true, true); + extern const FileType Drawings; - const FileType ExternalLinks (L"externalLinks", L"externalLink.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink", - L"externalLinks/externalLink", true, true); + extern const FileType ExternalLinks; - const FileType PivotTable (L"../pivotTables", L"pivotTable.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable", - L"pivotTables/pivotTable", true, true); + extern const FileType PivotTable; - const FileType PivotCacheDefinition(L"pivotCache", L"pivotCacheDefinition.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition", - L"pivotCache/pivotCacheDefinition", true, true); + extern const FileType PivotCacheDefinition; - const FileType PivotCacheRecords(L"", L"pivotCacheRecords.xml", - L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml", - L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords", - L"pivotCache/pivotCacheRecords", true, true); + extern const FileType PivotCacheRecords; - const FileType SlicerCache (L"slicerCaches", L"slicerCache.xml", - L"application/vnd.ms-excel.slicerCache+xml", - L"http://schemas.microsoft.com/office/2007/relationships/slicerCache", - L"slicerCaches/slicerCache", true, true); + extern const FileType SlicerCache; - const FileType Slicer (L"../slicers", L"slicer.xml", - L"application/vnd.ms-excel.slicer+xml", - L"http://schemas.microsoft.com/office/2007/relationships/slicer", - L"slicers/slicer", true, true); + extern const FileType Slicer; - const FileType NamedSheetView (L"../namedSheetViews", L"namedSheetView.xml", - L"application/vnd.ms-excel.namedsheetviews+xml", - L"http://schemas.microsoft.com/office/2019/04/relationships/namedSheetView", - L"namedSheetViews/namedSheetView", true, true); + extern const FileType NamedSheetView; - const FileType XlBinaryIndex (L"worksheets", L"binaryIndex.bin", - L"application/vnd.ms-excel.binIndexW", - L"http://schemas.microsoft.com/office/2006/relationships/xlBinaryIndex", - L"worksheets/binaryIndex", true); + extern const FileType XlBinaryIndex; //onlyoffice workbook comments - const FileType WorkbookComments(L"", L"workbookComments.bin", - L"", - L"http://schemas.onlyoffice.com/workbookComments"); + extern const FileType WorkbookComments; - - const FileType SpreadsheetFlat(L"", L"", L"", L""); - + extern const FileType SpreadsheetFlat; } // namespace FileTypes } 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/Ole/OleObjects.h b/Common/DocxFormat/Source/XlsxFormat/Ole/OleObjects.h index 23afd0f21d..6ad47d8d40 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Ole/OleObjects.h +++ b/Common/DocxFormat/Source/XlsxFormat/Ole/OleObjects.h @@ -117,7 +117,7 @@ namespace OOX public: nullable_bool m_oMoveWithCells; nullable_bool m_oSizeWithCells; - nullable> m_oZOrder; + nullable m_oZOrder; nullable m_oFrom; nullable m_oTo; @@ -207,17 +207,17 @@ namespace OOX } public: nullable m_oAltText; - nullable> m_oAutoFill; - nullable> m_oAutoLine; - nullable> m_oAutoPict; - nullable> m_oDde; - nullable> m_oDefaultSize; - nullable> m_oDisabled; + nullable m_oAutoFill; + nullable m_oAutoLine; + nullable m_oAutoPict; + nullable m_oDde; + nullable m_oDefaultSize; + nullable m_oDisabled; nullable m_oRid; - nullable> m_oLocked; + nullable m_oLocked; nullable m_oMacro; - nullable> m_oPrint; - nullable> m_oUiObject; + nullable m_oPrint; + nullable m_oUiObject; nullable m_oAnchor; }; @@ -386,11 +386,11 @@ namespace OOX } public: nullable m_oProgId; - nullable> m_oDvAspect; + nullable m_oDvAspect; nullable m_oLink; - nullable> m_oOleUpdate; - nullable> m_oAutoLoad; - nullable> m_oShapeId; + nullable m_oOleUpdate; + nullable m_oAutoLoad; + nullable m_oShapeId; nullable m_oRid; nullable m_oObjectPr; //internal diff --git a/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheDefinition.h b/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheDefinition.h index 1db574ff98..f97ca7b276 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheDefinition.h +++ b/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheDefinition.h @@ -76,7 +76,7 @@ namespace OOX nullable_double m_oMaxValue; nullable m_oMinDate; nullable m_oMaxDate; - nullable> m_oCount; + nullable m_oCount; }; class COLAPGroupItems : public WritingElementWithChilds { @@ -102,7 +102,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CDiscreteGroupingProperties : public WritingElementWithChilds { @@ -128,7 +128,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CRangeGroupingProperties : public WritingElement { @@ -155,7 +155,7 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oGroupBy; + nullable m_oGroupBy; nullable_bool m_oAutoStart; nullable_bool m_oAutoEnd; @@ -193,8 +193,8 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oBase; - nullable> m_oPar; + nullable m_oBase; + nullable m_oPar; nullable m_oDiscretePr; nullable m_oRangePr; @@ -236,9 +236,9 @@ namespace OOX nullable_int m_oSqlType; nullable_bool m_oUniqueList; - nullable> m_oLevel; - nullable> m_oMappingCount; - nullable> m_oNumFmtId; + nullable m_oLevel; + nullable m_oMappingCount; + nullable m_oNumFmtId; nullable m_oSharedItems; //nullable m_oMpMap; @@ -269,7 +269,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CRangeSet : public WritingElement { @@ -300,10 +300,10 @@ namespace OOX nullable_string m_oRef; nullable_string m_oName; nullable m_oRid; - nullable> m_oI1; - nullable> m_oI2; - nullable> m_oI3; - nullable> m_oI4; + nullable m_oI1; + nullable m_oI2; + nullable m_oI3; + nullable m_oI4; }; class CRangeSets : public WritingElementWithChilds { @@ -329,7 +329,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CPageItem : public WritingElement { @@ -382,7 +382,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CPageItemValues : public WritingElementWithChilds { @@ -409,7 +409,7 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CConsolidationSource : public WritingElement @@ -505,8 +505,8 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); //---------- - nullable> m_oConnectionId; - nullable> m_oType; + nullable m_oConnectionId; + nullable m_oType; nullable m_oConsolidation; nullable m_oWorksheetSource; @@ -545,14 +545,14 @@ namespace OOX nullable_bool m_oEnableRefresh; nullable m_oRid; nullable_bool m_oInvalid; - nullable> m_oCreatedVersion; - nullable> m_oMinRefreshableVersion; - nullable> m_oMissingItemsLimit; + nullable m_oCreatedVersion; + nullable m_oMinRefreshableVersion; + nullable m_oMissingItemsLimit; nullable_bool m_oOptimizeMemory; - nullable> m_oRecordCount; + nullable m_oRecordCount; nullable_string m_oRefreshedBy; nullable m_oRefreshedDateIso; - nullable> m_oRefreshedVersion; + nullable m_oRefreshedVersion; nullable_bool m_oRefreshOnLoad; nullable_bool m_oSaveData; nullable_bool m_oSupportAdvancedDrill; @@ -687,15 +687,15 @@ namespace OOX nullable_string m_oCaption; nullable_bool m_oCalculated; nullable_bool m_oUnused; - nullable> m_oCount; + nullable m_oCount; nullable_bool m_oBold; nullable_bool m_oItalic; nullable_bool m_oStrike; nullable_bool m_oUnderline; - nullable> m_oBackColor; - nullable> m_oForeColor; - nullable> m_oFormatIndex; + nullable m_oBackColor; + nullable m_oForeColor; + nullable m_oFormatIndex; //tpls }; @@ -728,7 +728,7 @@ namespace OOX nullable_string m_oCaption; nullable_bool m_oCalculated; nullable_bool m_oUnused; - nullable> m_oCount; + nullable m_oCount; }; class CPivotNumericValue : public WritingElementWithChilds { @@ -759,15 +759,15 @@ namespace OOX nullable_string m_oCaption; nullable_bool m_oCalculated; nullable_bool m_oUnused; - nullable> m_oCount; + nullable m_oCount; nullable_bool m_oBold; nullable_bool m_oItalic; nullable_bool m_oStrike; nullable_bool m_oUnderline; - nullable> m_oBackColor; - nullable> m_oForeColor; - nullable> m_oFormatIndex; + nullable m_oBackColor; + nullable m_oForeColor; + nullable m_oFormatIndex; //tpls }; @@ -800,7 +800,7 @@ namespace OOX nullable_string m_oCaption; nullable_bool m_oCalculated; nullable_bool m_oUnused; - nullable> m_oCount; + nullable m_oCount; }; class CPivotErrorValue : public WritingElementWithChilds { @@ -831,15 +831,15 @@ namespace OOX nullable_string m_oCaption; nullable_bool m_oCalculated; nullable_bool m_oUnused; - nullable> m_oCount; + nullable m_oCount; nullable_bool m_oBold; nullable_bool m_oItalic; nullable_bool m_oStrike; nullable_bool m_oUnderline; - nullable> m_oBackColor; - nullable> m_oForeColor; - nullable> m_oFormatIndex; + nullable m_oBackColor; + nullable m_oForeColor; + nullable m_oFormatIndex; //tpls }; @@ -871,15 +871,15 @@ namespace OOX nullable_string m_oCaption; nullable_bool m_oCalculated; nullable_bool m_oUnused; - nullable> m_oCount; + nullable m_oCount; nullable_bool m_oBold; nullable_bool m_oItalic; nullable_bool m_oStrike; nullable_bool m_oUnderline; - nullable> m_oBackColor; - nullable> m_oForeColor; - nullable> m_oFormatIndex; + nullable m_oBackColor; + nullable m_oForeColor; + nullable m_oFormatIndex; //tpls }; diff --git a/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheRecords.h b/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheRecords.h index 35df7c6bec..a739787c13 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheRecords.h +++ b/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotCacheRecords.h @@ -89,7 +89,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; nullable m_oExtLst; std::wstring m_strOutputXml; diff --git a/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotTable.h b/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotTable.h index f4a01b189d..65343cb0df 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotTable.h +++ b/Common/DocxFormat/Source/XlsxFormat/Pivot/PivotTable.h @@ -91,7 +91,7 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: - nullable > m_oV; + nullable m_oV; }; class CMemberPropertyIndex : public WritingElement @@ -207,7 +207,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable > m_oCount; + nullable m_oCount; }; class CDataField : public WritingElement { @@ -235,12 +235,12 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); nullable_int m_oBaseField; - nullable> m_oBaseItem; - nullable> m_oFld; + nullable m_oBaseItem; + nullable m_oFld; nullable_string m_oName; - nullable> m_oNumFmtId; - nullable> m_oShowDataAs; - nullable> m_oSubtotal; + nullable m_oNumFmtId; + nullable m_oShowDataAs; + nullable m_oSubtotal; nullable m_oExtLst; }; @@ -268,7 +268,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CPageField : public WritingElement { @@ -297,7 +297,7 @@ namespace OOX nullable_int m_oFld; nullable_int m_oHier; - nullable> m_oItem; + nullable m_oItem; nullable_string m_oCap; nullable_string m_oName; @@ -327,7 +327,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CFieldItem : public WritingElement { @@ -363,8 +363,8 @@ namespace OOX nullable_string m_oUserCaption; nullable_bool m_oCharacter; nullable_bool m_oHideDetails; - nullable>m_oItemType; - nullable> m_oItemIndex; + nullable m_oItemType; + nullable m_oItemIndex; }; class CFieldItems : public WritingElementWithChilds @@ -391,7 +391,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CReference : public WritingElement { @@ -433,8 +433,8 @@ namespace OOX nullable_bool m_oSumSubtotal; nullable_bool m_oVarPSubtotal; nullable_bool m_oVarSubtotal; - nullable> m_oField; - nullable> m_oCount; + nullable m_oField; + nullable m_oCount; nullable m_oX; nullable m_oExtLst; @@ -463,7 +463,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CPivotArea : public WritingElement { @@ -490,18 +490,18 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oAxis; + nullable m_oAxis; nullable_bool m_oCacheIndex; nullable_bool m_oCollapsedLevelsAreSubtotals; nullable_bool m_oDataOnly; nullable_int m_oField; - nullable> m_oFieldPosition; + nullable m_oFieldPosition; nullable_bool m_oGrandCol; nullable_bool m_oGrandRow; nullable_bool m_oLabelOnly; nullable_string m_oOffsetRef; nullable_bool m_oOutline; - nullable> m_oType; + nullable m_oType; nullable m_oReferences; nullable m_oExtLst; @@ -560,7 +560,7 @@ namespace OOX nullable_bool m_oAllDrilled; nullable_bool m_oAutoShow; nullable_bool m_oAvgSubtotal; - nullable> m_oAxis; + nullable m_oAxis; nullable_bool m_oCompact; nullable_bool m_oCountASubtotal; nullable_bool m_oCountSubtotal; @@ -578,24 +578,24 @@ namespace OOX nullable_bool m_oIncludeNewItemsInFilter; nullable_bool m_oInsertBlankRow; nullable_bool m_oInsertPageBreak; - nullable> m_oItemPageCount; + nullable m_oItemPageCount; nullable_bool m_oMaxSubtotal; nullable_bool m_oMeasureFilter; nullable_bool m_oMinSubtotal; nullable_bool m_oMultipleItemSelectionAllowed; nullable_string m_oName; nullable_bool m_oNonAutoSortDefault; - nullable> m_oNumFmtId; + nullable m_oNumFmtId; nullable_bool m_oOutline; nullable_bool m_oProductSubtotal; - nullable> m_oRankBy; + nullable m_oRankBy; nullable_bool m_oServerField; nullable_bool m_oShowAll; nullable_bool m_oShowDropDowns; nullable_bool m_oShowPropAsCaption; nullable_bool m_oShowPropCell; nullable_bool m_oShowPropTip; - nullable> m_oSortType; + nullable m_oSortType; nullable_bool m_oStdDevPSubtotal; nullable_bool m_oStdDevSubtotal; nullable_string m_oSubtotalCaption; @@ -634,7 +634,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CColumnRowItem : public WritingElementWithChilds { @@ -661,9 +661,9 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oI; - nullable> m_oR; - nullable> m_oT; + nullable m_oI; + nullable m_oR; + nullable m_oT; }; class CColumnRowItems : public WritingElementWithChilds { @@ -690,7 +690,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CPivotTableFormat : public WritingElement { @@ -717,11 +717,11 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oAction; - nullable> m_oDxfId; + nullable m_oAction; + nullable m_oDxfId; - nullable m_oPivotArea; - nullable m_oExtLst; + nullable m_oPivotArea; + nullable m_oExtLst; }; class CPivotTableFormats : public WritingElementWithChilds { @@ -747,7 +747,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable> m_oCount; + nullable m_oCount; }; class CPivotTableStyleInfo : public WritingElement { @@ -822,11 +822,11 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); void ReadAttributes(XLS::BaseObjectPtr& obj); - nullable> m_oColPageCount; - nullable> m_oFirstDataCol; - nullable> m_oFirstDataRow; - nullable> m_oFirstHeaderRow; - nullable> m_oRowPageCount; + nullable m_oColPageCount; + nullable m_oFirstDataCol; + nullable m_oFirstDataRow; + nullable m_oFirstHeaderRow; + nullable m_oRowPageCount; nullable_string m_oRef; }; class CPivotTableDefinition : public WritingElement @@ -937,16 +937,16 @@ namespace OOX nullable_string m_oVacatedStyle; nullable_bool m_oVisualTotals; - nullable> m_oCreatedVersion; - nullable> m_oMinRefreshableVersion; - nullable> m_oUpdatedVersion; + nullable m_oCreatedVersion; + nullable m_oMinRefreshableVersion; + nullable m_oUpdatedVersion; - nullable> m_oDataPosition; - nullable> m_oAutoFormatId; - nullable> m_oCacheId; - nullable> m_oChartFormat; - nullable> m_oIndent; - nullable> m_oPageWrap; + nullable m_oDataPosition; + nullable m_oAutoFormatId; + nullable m_oCacheId; + nullable m_oChartFormat; + nullable m_oIndent; + nullable m_oPageWrap; }; class CPivotTableFile : public OOX::FileGlobalEnumerated, public OOX::IFileContainer diff --git a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/PhoneticPr.h b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/PhoneticPr.h index 6e352c3bd7..01c002544a 100644 --- a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/PhoneticPr.h +++ b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/PhoneticPr.h @@ -135,9 +135,9 @@ namespace OOX } } public: - nullable> m_oAlignment; - nullable> m_oFontId; - nullable> m_oType; + nullable m_oAlignment; + nullable m_oFontId; + nullable m_oType; }; class CRPh : public WritingElementWithChilds @@ -213,8 +213,8 @@ namespace OOX } } public: - nullable> m_oEb; - nullable> m_oSb; + nullable m_oEb; + nullable m_oSb; }; } //Spreadsheet } // namespace OOX diff --git a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h index 39c746d184..827c3ea011 100644 --- a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h +++ b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h @@ -245,8 +245,8 @@ namespace OOX } public: - nullable> m_oCount; - nullable> m_oUniqueCount; + nullable m_oCount; + nullable m_oUniqueCount; std::vector m_arrItems; int m_nCount; 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/SharedStrings/Text.h b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/Text.h index 80d0c99d84..8e267899b5 100644 --- a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/Text.h +++ b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/Text.h @@ -65,7 +65,7 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: bool m_bIsInit; - SimpleTypes::CXmlSpace<> m_oSpace; + SimpleTypes::CXmlSpace m_oSpace; double m_dValue; _UINT32 m_nValue; @@ -178,7 +178,7 @@ namespace OOX public: // Attributes - nullable > m_oSpace; + nullable m_oSpace; // Value std::wstring m_sText; diff --git a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/rPr.h b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/rPr.h index 38d09cb612..1fc9b53421 100644 --- a/Common/DocxFormat/Source/XlsxFormat/SharedStrings/rPr.h +++ b/Common/DocxFormat/Source/XlsxFormat/SharedStrings/rPr.h @@ -36,7 +36,7 @@ #include "../../Common/SimpleTypes_Shared.h" #include "../../Common/ComplexTypes.h" -#include "../SimpleTypes_Spreadsheet.h" +#include "../../Common/SimpleTypes_Spreadsheet.h" namespace OOX { @@ -73,9 +73,9 @@ namespace OOX } public: nullable> m_oAuto; - nullable> m_oIndexed; + nullable m_oIndexed; nullable_string m_oRgb; - nullable> m_oTheme; + nullable m_oTheme; nullable m_oTint; }; //необработано: @@ -147,18 +147,18 @@ namespace OOX { } public: - nullable > m_oBold; - nullable > m_oCharset; + nullable m_oBold; + nullable m_oCharset; nullable m_oColor; - nullable > m_oCondense; - nullable > m_oExtend; + nullable m_oCondense; + nullable m_oExtend; //nullable > m_oFamily; - nullable > m_oItalic; - nullable > m_oOutline; + nullable m_oItalic; + nullable m_oOutline; nullable m_oRFont; //nullable > m_oScheme; - nullable > m_oShadow; - nullable > m_oStrike; + nullable m_oShadow; + nullable m_oStrike; nullable m_oSz; nullable > m_oUnderline; nullable > m_oVertAlign; diff --git a/Common/DocxFormat/Source/XlsxFormat/SimpleTypes_Spreadsheet.h b/Common/DocxFormat/Source/XlsxFormat/SimpleTypes_Spreadsheet.h deleted file mode 100644 index 3eaf3d15e6..0000000000 --- a/Common/DocxFormat/Source/XlsxFormat/SimpleTypes_Spreadsheet.h +++ /dev/null @@ -1,5127 +0,0 @@ -/* - * (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 "../Common/SimpleTypes_Base.h" - -namespace SimpleTypes -{ - namespace Spreadsheet - { - template - class CSimpleType - { - public: - CSimpleType() - { - m_eValue = DefValue; - } - CSimpleType(const E& val) - { - m_eValue = val; - } - virtual ~CSimpleType() {} - - virtual E GetValue() const - { - return m_eValue; - } - virtual void SetValue(E eValue) - { - m_eValue = eValue; - } - virtual E FromString(std::wstring &sValue) = 0; - virtual std::wstring ToString() const = 0; - protected: - E m_eValue; - }; - - enum ETableType - { - typeQueryTable = 0, - typeWorksheet = 1, - typeXml = 2, - }; - template - class CTableType : public CSimpleType - { - public: - CTableType() {} - CTableType(const ETableType & val) { this->m_eValue = val; } - - virtual ETableType FromString(std::wstring &sValue) - { - if ( L"queryTable" == sValue ) this->m_eValue = typeQueryTable; - else if ( L"worksheet" == sValue ) this->m_eValue = typeWorksheet; - else if ( L"xml" == sValue ) this->m_eValue = typeXml; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case typeQueryTable : return L"queryTable"; - case typeXml : return L"xml"; - case typeWorksheet : - default : return L"worksheet"; - - } - } - - SimpleType_FromString (ETableType) - SimpleType_Operator_Equal (CTableType) - }; - enum EDatabaseSourceType - { - typeODBCBasedSource = 1, - typeDAOBasedSource = 2, - typeFileBasedDatabaseSource = 3, - typeWebQuery = 4, - typeOLEDBBasedSource = 5, - typeTextBasedSource = 6, - typeADORecordSet = 7, - typeDSP - }; - - enum EExternalConnectionType - { - extConnTypeGeneral = 0, - extConnTypeText = 1, - extConnTypeMDY = 2, - extConnTypeDMY = 3, - extConnTypeYMD = 4, - extConnTypeMYD = 5, - extConnTypeDYM = 6, - extConnTypeYDM = 7, - extConnTypeSkip = 8, - extConnTypeEMD = 9 - }; - template - class CExternalConnectionType : public CSimpleType - { - public: - CExternalConnectionType() {} - CExternalConnectionType(const EExternalConnectionType & val) { this->m_eValue = val; } - - virtual EExternalConnectionType FromString(std::wstring &sValue) - { - if ( L"general" == sValue ) this->m_eValue = extConnTypeGeneral; - else if ( L"text" == sValue ) this->m_eValue = extConnTypeText; - else if ( L"MDY" == sValue ) this->m_eValue = extConnTypeMDY; - else if ( L"DMY" == sValue ) this->m_eValue = extConnTypeDMY; - else if ( L"YMD" == sValue ) this->m_eValue = extConnTypeYMD; - else if ( L"MYD" == sValue ) this->m_eValue = extConnTypeMYD; - else if ( L"DYM" == sValue ) this->m_eValue = extConnTypeDYM; - else if ( L"YDM" == sValue ) this->m_eValue = extConnTypeYDM; - else if ( L"skip" == sValue ) this->m_eValue = extConnTypeSkip; - else if ( L"EMD" == sValue ) this->m_eValue = extConnTypeEMD; - else this->m_eValue = extConnTypeGeneral; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case extConnTypeText: return L"text"; - case extConnTypeMDY: return L"MDY"; - case extConnTypeDMY: return L"DMY"; - case extConnTypeYMD: return L"YMD"; - case extConnTypeMYD: return L"MYD"; - case extConnTypeDYM: return L"DYM"; - case extConnTypeYDM: return L"YDM"; - case extConnTypeSkip: return L"stored"; - case extConnTypeGeneral: - default : return L"general"; - - } - } - SimpleType_FromString (EExternalConnectionType) - SimpleType_Operator_Equal (CExternalConnectionType) - }; - enum ECredMethod - { - integrated_method = 0, - none_method = 1, - prompt_method = 2, - stored_method = 3 - }; - template - class CCredMethod : public CSimpleType - { - public: - CCredMethod() {} - CCredMethod(const ECredMethod & val) { this->m_eValue = val; } - - virtual ECredMethod FromString(std::wstring &sValue) - { - if ( L"integrated" == sValue ) this->m_eValue = integrated_method; - else if ( L"none" == sValue ) this->m_eValue = none_method; - else if ( L"prompt" == sValue ) this->m_eValue = prompt_method; - else if ( L"stored" == sValue ) this->m_eValue = stored_method; - else this->m_eValue = integrated_method; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case none_method: return L"none"; - case prompt_method: return L"prompt"; - case stored_method: return L"stored"; - case integrated_method: - default : return L"integrated"; - - } - } - SimpleType_FromString (ECredMethod) - SimpleType_Operator_Equal (CCredMethod) - }; - - enum EVisibleType - { - visibleHidden = 0, - visibleVeryHidden = 1, - visibleVisible = 2, - }; - template - class CVisibleType : public CSimpleType - { - public: - CVisibleType() {} - CVisibleType(const EVisibleType & val) - { - this->m_eValue = val; - } - - virtual EVisibleType FromString(std::wstring &sValue) - { - if ( L"hidden" == sValue ) this->m_eValue = visibleHidden; - else if ( L"veryHidden" == sValue ) this->m_eValue = visibleVeryHidden; - else if ( L"visible" == sValue ) this->m_eValue = visibleVisible; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case visibleHidden : return L"hidden"; - case visibleVeryHidden : return L"veryHidden"; - case visibleVisible : - default : return L"visible"; - } - } - SimpleType_FromString (EVisibleType) - SimpleType_Operator_Equal (CVisibleType) - }; - enum EHtmlFormat - { - htmlNone = 0, - htmlRtf = 1, - htmlAll = 2 - }; - template - class CHtmlFormat : public CSimpleType - { - public: - CHtmlFormat() {} - CHtmlFormat(const EHtmlFormat & val) { this->m_eValue = val; } - - virtual EHtmlFormat FromString(std::wstring &sValue) - { - if ( L"none" == sValue ) this->m_eValue = htmlNone; - else if ( L"veryHidden" == sValue ) this->m_eValue = htmlRtf; - else if ( L"visible" == sValue ) this->m_eValue = htmlAll; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case htmlNone : return L"none"; - case htmlRtf : return L"rtf"; - case htmlAll : return L"all"; - default : return L"none"; - } - } - SimpleType_FromString (EHtmlFormat) - SimpleType_Operator_Equal (CHtmlFormat) - }; - enum EParameterType - { - parameterPrompt = 0, - parameterValue = 1, - parameterCell = 2 - }; - template - class CParameterType : public CSimpleType - { - public: - CParameterType() {} - CParameterType(const EParameterType & val) { this->m_eValue = val; } - - virtual EParameterType FromString(std::wstring &sValue) - { - if ( L"promt" == sValue ) this->m_eValue = parameterPrompt; - else if ( L"value" == sValue ) this->m_eValue = parameterValue; - else if ( L"cell" == sValue ) this->m_eValue = parameterCell; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case parameterValue : return L"value"; - case parameterCell : return L"cell"; - case parameterPrompt : - default : return L"promt"; - } - } - SimpleType_FromString (EParameterType) - SimpleType_Operator_Equal (CParameterType) - }; - enum EQualifier - { - doubleQuote = 0, - singleQuote = 1, - noneQuote = 2 - }; - template - class CQualifier : public CSimpleType - { - public: - CQualifier() {} - CQualifier(const EQualifier & val) { this->m_eValue = val; } - - virtual EQualifier FromString(std::wstring &sValue) - { - if ( L"doubleQuote" == sValue ) this->m_eValue = doubleQuote; - else if ( L"singleQuote" == sValue ) this->m_eValue = singleQuote; - else if ( L"none" == sValue ) this->m_eValue = noneQuote; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case noneQuote : return L"none"; - case singleQuote : return L"singleQuote"; - case doubleQuote : - default : return L"doubleQuote"; - } - } - SimpleType_FromString (EQualifier) - SimpleType_Operator_Equal (CQualifier) - }; - enum EFileType - { - fileTypeMac = 0, - fileTypeWin = 1, - fileTypeDos = 2, - fileTypeLin = 3, - fileTypeOther = 4 - }; - template - class CFileType : public CSimpleType - { - public: - CFileType() {} - CFileType(const EFileType & val) { this->m_eValue = val; } - - virtual EFileType FromString(std::wstring &sValue) - { - if ( L"win" == sValue ) this->m_eValue = fileTypeWin; - else if ( L"mac" == sValue ) this->m_eValue = fileTypeMac; - else if ( L"lin" == sValue ) this->m_eValue = fileTypeLin; - else if ( L"dos" == sValue ) this->m_eValue = fileTypeDos; - else if ( L"other" == sValue ) this->m_eValue = fileTypeOther; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case fileTypeMac : return L"mac"; - case fileTypeDos : return L"dos"; - case fileTypeLin : return L"lin"; - case fileTypeOther : return L"other"; - case fileTypeWin : - default : return L"win"; - } - } - SimpleType_FromString (EFileType) - SimpleType_Operator_Equal (CFileType) - }; - enum EPhoneticAlignmentType - { - phoneticalignmentCenter = 0, - phoneticalignmentDistributed = 1, - phoneticalignmentLeft = 2, - phoneticalignmentNoControl = 3, - }; - - template - class CPhoneticAlignment : public CSimpleType - { - public: - CPhoneticAlignment() {} - CPhoneticAlignment(const EPhoneticAlignmentType & val) { this->m_eValue = val; } - - virtual EPhoneticAlignmentType FromString(std::wstring &sValue) - { - if ( L"center" == sValue ) this->m_eValue = phoneticalignmentCenter; - else if ( L"distributed"== sValue ) this->m_eValue = phoneticalignmentDistributed; - else if ( L"left" == sValue ) this->m_eValue = phoneticalignmentLeft; - else if ( L"noControl" == sValue ) this->m_eValue = phoneticalignmentNoControl; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case phoneticalignmentCenter : return L"center"; - case phoneticalignmentDistributed : return L"distributed"; - case phoneticalignmentLeft : return L"left"; - case phoneticalignmentNoControl : - default : return L"noControl"; -} - } - - SimpleType_FromString (EPhoneticAlignmentType) - SimpleType_Operator_Equal (CPhoneticAlignment) - }; - - enum EPhoneticTypeType - { - phonetictypeFullwidthKatakana = 0, - phonetictypeHalfwidthKatakana = 1, - phonetictypeHiragana = 2, - phonetictypeNoConversion = 3, - }; - - template - class CPhoneticType : public CSimpleType - { - public: - CPhoneticType() {} - CPhoneticType(const EPhoneticTypeType & val) { this->m_eValue = val; } - - virtual EPhoneticTypeType FromString(std::wstring &sValue) - { - if ( L"fullwidthKatakana" == sValue ) this->m_eValue = phonetictypeFullwidthKatakana; - else if ( L"halfwidthKatakana" == sValue ) this->m_eValue = phonetictypeHalfwidthKatakana; - else if ( L"hiragana" == sValue ) this->m_eValue = phonetictypeHiragana; - else if ( L"noConversion" == sValue ) this->m_eValue = phonetictypeNoConversion; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case phonetictypeFullwidthKatakana : return L"fullwidthKatakana"; - case phonetictypeHalfwidthKatakana : return L"halfwidthKatakana"; - case phonetictypeHiragana : return L"hiragana"; - case phonetictypeNoConversion : - default : return L"noConversion"; - } - } - - SimpleType_FromString (EPhoneticTypeType) - SimpleType_Operator_Equal (CPhoneticType) - }; - - enum EFontCharset - { - fontcharsetANSI = 0, // 00 - fontcharsetDefault = 1, // 01 - fontcharsetSymbol = 2, // 02 - fontcharsetMacintosh = 77, // 4D - fontcharsetShitJIS = 128, // 80 - fontcharsetHangeul = 129, // 81 - fontcharsetJohab = 130, // 82 - fontcharsetGB2313 = 134, // 86 - fontcharsetChineseBig5 = 136, // 88 - fontcharsetGreek = 161, // A1 - fontcharsetTurkish = 162, // A2 - fontcharsetVietnamese = 163, // A3 - fontcharsetHebrew = 177, // B1 - fontcharsetArabic = 178, // B2 - fontcharsetBaltic = 186, // BA - fontcharsetRussian = 204, // CC - fontcharsetThai = 222, // DE - fontcharsetEastEurope = 238, // EE - fontcharsetOEM = 255, // FF - }; - - template - class CFontCharset : public CSimpleType - { - public: - CFontCharset() {} - CFontCharset(const EFontCharset & val) { this->m_eValue = val; } - - virtual EFontCharset FromString(std::wstring &sValue) - { - int nCharset = _wtoi(sValue.c_str()); - switch(nCharset) - { - case 0: this->m_eValue = fontcharsetANSI;break; - case 1: this->m_eValue = fontcharsetDefault;break; - case 2: this->m_eValue = fontcharsetSymbol;break; - case 77: this->m_eValue = fontcharsetMacintosh;break; - case 128: this->m_eValue = fontcharsetShitJIS;break; - case 129: this->m_eValue = fontcharsetHangeul;break; - case 130: this->m_eValue = fontcharsetJohab;break; - case 134: this->m_eValue = fontcharsetGB2313;break; - case 136: this->m_eValue = fontcharsetChineseBig5;break; - case 161: this->m_eValue = fontcharsetGreek;break; - case 162: this->m_eValue = fontcharsetTurkish;break; - case 163: this->m_eValue = fontcharsetVietnamese;break; - case 177: this->m_eValue = fontcharsetHebrew;break; - case 178: this->m_eValue = fontcharsetArabic;break; - case 186: this->m_eValue = fontcharsetBaltic;break; - case 204: this->m_eValue = fontcharsetRussian;break; - case 222: this->m_eValue = fontcharsetThai;break; - case 238: this->m_eValue = fontcharsetEastEurope;break; - case 255: this->m_eValue = fontcharsetOEM;break; - default:this->m_eValue = eDefValue; - } - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return std::to_wstring( this->m_eValue); - } - virtual std::wstring ToHexString () const - { - std::wstring sRes; - switch(this->m_eValue) - { - case fontcharsetANSI: sRes = L"00";break; - case fontcharsetDefault: sRes = L"01";break; - case fontcharsetSymbol: sRes = L"02";break; - case fontcharsetMacintosh: sRes = L"4D";break; - case fontcharsetShitJIS: sRes = L"80";break; - case fontcharsetHangeul: sRes = L"81";break; - case fontcharsetJohab: sRes = L"82";break; - case fontcharsetGB2313: sRes = L"86";break; - case fontcharsetChineseBig5: sRes = L"88";break; - case fontcharsetGreek: sRes = L"A1";break; - case fontcharsetTurkish: sRes = L"A2";break; - case fontcharsetVietnamese: sRes = L"A3";break; - case fontcharsetHebrew: sRes = L"B1";break; - case fontcharsetArabic: sRes = L"B2";break; - case fontcharsetBaltic: sRes = L"BA";break; - case fontcharsetRussian: sRes = L"CC";break; - case fontcharsetThai: sRes = L"DE";break; - case fontcharsetEastEurope: sRes = L"EE";break; - case fontcharsetOEM: sRes = L"FF";break; - } - return sRes; - } - - SimpleType_FromString (EFontCharset) - SimpleType_Operator_Equal (CFontCharset) - }; - - enum EThemeColor - { - themecolorLight1 = 0, - themecolorDark1 = 1, - themecolorLight2 = 2, - themecolorDark2 = 3, - themecolorAccent1 = 4, - themecolorAccent2 = 5, - themecolorAccent3 = 6, - themecolorAccent4 = 7, - themecolorAccent5 = 8, - themecolorAccent6 = 9, - themecolorHyperlink = 10, - themecolorFollowedHyperlink = 11 - }; - - template - class CThemeColor : public CSimpleType - { - public: - CThemeColor() {} - CThemeColor(const EThemeColor & val) { this->m_eValue = val; } - - virtual EThemeColor FromString(std::wstring &sValue) - { - int nThemeColor = _wtoi(sValue.c_str()); - switch(nThemeColor) - { - case 0:this->m_eValue = themecolorLight1;break; - case 1:this->m_eValue = themecolorDark1;break; - case 2:this->m_eValue = themecolorLight2;break; - case 3:this->m_eValue = themecolorDark2;break; - case 4:this->m_eValue = themecolorAccent1;break; - case 5:this->m_eValue = themecolorAccent2;break; - case 6:this->m_eValue = themecolorAccent3;break; - case 7:this->m_eValue = themecolorAccent4;break; - case 8:this->m_eValue = themecolorAccent5;break; - case 9:this->m_eValue = themecolorAccent6;break; - case 10:this->m_eValue = themecolorHyperlink;break; - case 11:this->m_eValue = themecolorFollowedHyperlink;break; - default:this->m_eValue = eDefValue; - } - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case themecolorLight1: return L"lt1"; - case themecolorDark1: return L"dk1"; - case themecolorLight2: return L"lt2"; - case themecolorDark2: return L"dk2"; - case themecolorAccent1: return L"accent1"; - case themecolorAccent2: return L"accent2"; - case themecolorAccent3: return L"accent3"; - case themecolorAccent4: return L"accent4"; - case themecolorAccent5: return L"accent5"; - case themecolorAccent6: return L"accent6"; - case themecolorHyperlink: return L"hlink"; - case themecolorFollowedHyperlink: return L"folHlink"; - default: - return L""; - } - return L""; - } - - SimpleType_FromString (EThemeColor) - SimpleType_Operator_Equal (CThemeColor) - }; - - class CHexColor - { - public: - CHexColor() - { - m_unA = 255; - m_unR = 0; - m_unG = 0; - m_unB = 0; - } - CHexColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255) - { - m_unA = a; - m_unR = r; - m_unG = g; - m_unB = b; - } - CHexColor(std::wstring & cwsValue) - { - FromString( cwsValue ); - } - - virtual void FromString(std::wstring &sValue) - { - Parse(sValue); - } - virtual void FromString(const std::wstring &sValue) - { - Parse(sValue); - } - CHexColor(const std::wstring& wsStr) - { - FromString( wsStr); - } - const CHexColor &operator =(std::wstring &sValue) - { - FromString( sValue ); - return *this; - } - const CHexColor &operator =(const std::wstring& wsStr) - { - FromString( wsStr); - return *this; - } - virtual std::wstring ToString () const - { - std::wstring sResult; - sResult += XmlUtils::IntToString(m_unA, L"%02X"); - sResult += XmlUtils::IntToString(m_unR, L"%02X"); - sResult += XmlUtils::IntToString(m_unG, L"%02X"); - sResult += XmlUtils::IntToString(m_unB, L"%02X"); - - return sResult; - } - void Set_R(unsigned char R) - { - m_unR = R; - } - void Set_G(unsigned char G) - { - m_unG = G; - } - void Set_B(unsigned char B) - { - m_unB = B; - } - void Set_A(unsigned char A) - { - m_unA = A; - } - unsigned char Get_R() const - { - return m_unR; - } - unsigned char Get_G() const - { - return m_unG; - } - - unsigned char Get_B() const - { - return m_unB; - } - unsigned char Get_A() const - { - return 255; - } - int ToInt() const - { - int nRes = m_unB; - nRes += m_unG << 8; - nRes += m_unR << 16; - nRes += m_unA << 24; - return nRes; - } - void FromInt(int nColor) - { - m_unB = static_cast(nColor & 0xFF); - m_unG = static_cast((nColor & 0xFF00)>>8); - m_unR = static_cast((nColor & 0xFF0000)>>16); - m_unA = 255; - } - private: - - void Parse(std::wstring sValue) - { - if (0 == sValue.find(L"#")) - { - sValue = sValue.substr(1); - } - int nValueLength = (int)sValue.length(); - - if(3 == nValueLength) - { - int nTempR = HexToInt( (int)sValue[0] ); - int nTempG = HexToInt( (int)sValue[1] ); - int nTempB = HexToInt( (int)sValue[2] ); - - m_unR = nTempR + (unsigned char)(nTempR << 4); - m_unG = nTempG + (unsigned char)(nTempG << 4); - m_unB = nTempB + (unsigned char)(nTempB << 4); - } - else if(6 == nValueLength) - { - m_unR = HexToInt( (int)sValue[1] ) + (unsigned char)(HexToInt( (int)sValue[0] ) << 4); - m_unG = HexToInt( (int)sValue[3] ) + (unsigned char)(HexToInt( (int)sValue[2] ) << 4); - m_unB = HexToInt( (int)sValue[5] ) + (unsigned char)(HexToInt( (int)sValue[4] ) << 4); - } - else if(8 == nValueLength) - { - m_unA = HexToInt( (int)sValue[1] ) + (unsigned char)(HexToInt( (int)sValue[0] ) << 4); - m_unR = HexToInt( (int)sValue[3] ) + (unsigned char)(HexToInt( (int)sValue[2] ) << 4); - m_unG = HexToInt( (int)sValue[5] ) + (unsigned char)(HexToInt( (int)sValue[4] ) << 4); - m_unB = HexToInt( (int)sValue[7] ) + (unsigned char)(HexToInt( (int)sValue[6] ) << 4); - } - } - - int HexToInt(int nHex) - { - if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0'); - if ( nHex >= 'a' && nHex <= 'f' ) return (nHex - 'a' + 10); - if ( nHex >= 'A' && nHex <= 'F' ) return (nHex - 'A' + 10); - - return 0; - } - private: - unsigned char m_unA; - unsigned char m_unR; - unsigned char m_unG; - unsigned char m_unB; - }; - - - enum EFontFamily - { - fontfamilyNotApplicable = 0, - fontfamilyRoman = 1, - fontfamilySwiss = 2, - fontfamilyModern = 3, - fontfamilyScript = 4, - fontfamilyDecorative = 5, - }; - template - class CFontFamily : public CSimpleType - { - public: - CFontFamily() {} - CFontFamily(const EFontFamily & val) { this->m_eValue = val; } - - virtual EFontFamily FromString(std::wstring &sValue) - { - int nFontFamily = _wtoi(sValue.c_str()); - switch(nFontFamily) - { - case 0:this->m_eValue = fontfamilyNotApplicable;break; - case 1:this->m_eValue = fontfamilyRoman;break; - case 2:this->m_eValue = fontfamilySwiss;break; - case 3:this->m_eValue = fontfamilyModern;break; - case 4:this->m_eValue = fontfamilyScript;break; - case 5:this->m_eValue = fontfamilyDecorative;break; - default:this->m_eValue = eDefValue; - } - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return std::to_wstring(this->m_eValue); - } - std::wstring ToStringWord() const - { - std::wstring sRes; - switch(this->m_eValue) - { - case fontfamilyNotApplicable:sRes = L"auto";break; - case fontfamilyRoman:sRes = L"roman";break; - case fontfamilySwiss:sRes = L"swiss";break; - case fontfamilyModern:sRes = L"modern";break; - case fontfamilyScript:sRes = L"script";break; - case fontfamilyDecorative:sRes = L"decorative";break; - default:sRes = L"auto"; - } - return sRes; - } - - SimpleType_FromString (EFontFamily) - SimpleType_Operator_Equal (CFontFamily) - }; - - enum EFontScheme - { - fontschemeMajor = 0, - fontschemeMinor = 1, - fontschemeNone = 2 - }; - template - class CFontScheme : public CSimpleType - { - public: - CFontScheme() {} - CFontScheme(const EFontScheme & val) { this->m_eValue = val; } - - virtual EFontScheme FromString(std::wstring &sValue) - { - if(L"major" == sValue) - this->m_eValue = fontschemeMajor; - else if(L"minor" == sValue) - this->m_eValue = fontschemeMinor; - else if(L"none" == sValue) - this->m_eValue = fontschemeNone; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sRes; - switch(this->m_eValue) - { - case fontschemeMajor: sRes = L"major";break; - case fontschemeMinor: sRes = L"minor";break; - case fontschemeNone: sRes = L"none";break; - } - return sRes; - } - - SimpleType_FromString (EFontScheme) - SimpleType_Operator_Equal (CFontScheme) - }; - enum EUnderline - { - underlineDouble = 0, - underlineDoubleAccounting = 1, - underlineNone = 2, - underlineSingle = 3, - underlineSingleAccounting = 4 - }; - template - class CUnderline : public CSimpleType - { - public: - CUnderline() {} - CUnderline(const EUnderline & val) { this->m_eValue = val; } - - virtual EUnderline FromString(std::wstring &sValue) - { - if(L"double" == sValue) - this->m_eValue = underlineDouble; - else if(L"doubleAccounting" == sValue) - this->m_eValue = underlineDoubleAccounting; - else if(L"none" == sValue) - this->m_eValue = underlineNone; - else if(L"single" == sValue) - this->m_eValue = underlineSingle; - else if(L"singleAccounting" == sValue) - this->m_eValue = underlineSingleAccounting; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case underlineDouble: return L"double";break; - case underlineDoubleAccounting: return L"doubleAccounting";break; - case underlineNone: return L"none";break; - case underlineSingle: return L"single";break; - case underlineSingleAccounting: return L"singleAccounting";break; - default: return L"none"; - } - } - - SimpleType_FromString (EUnderline) - SimpleType_Operator_Equal (CUnderline) - }; - - enum EBorderStyle - { - borderstyleDashDot = 0, - borderstyleDashDotDot = 1, - borderstyleDashed = 2, - borderstyleDotted = 3, - borderstyleDouble = 4, - borderstyleHair = 5, - borderstyleMedium = 6, - borderstyleMediumDashDot = 7, - borderstyleMediumDashDotDot = 8, - borderstyleMediumDashed = 9, - borderstyleNone = 10, - borderstyleSlantDashDot = 11, - borderstyleThick = 12, - borderstyleThin = 13 - }; - template - class CBorderStyle : public CSimpleType - { - public: - CBorderStyle() {} - CBorderStyle(const EBorderStyle & val) { this->m_eValue = val; } - - virtual EBorderStyle FromString(std::wstring &sValue) - { - if(L"dashDot" == sValue) - this->m_eValue = borderstyleDashDot; - else if(L"dashDotDot" == sValue) - this->m_eValue = borderstyleDashDotDot; - else if(L"dashed" == sValue) - this->m_eValue = borderstyleDashed; - else if(L"dotted" == sValue) - this->m_eValue = borderstyleDotted; - else if(L"double" == sValue) - this->m_eValue = borderstyleDouble; - else if(L"hair" == sValue) - this->m_eValue = borderstyleHair; - else if(L"medium" == sValue) - this->m_eValue = borderstyleMedium; - else if(L"mediumDashDot" == sValue) - this->m_eValue = borderstyleMediumDashDot; - else if(L"mediumDashDotDot" == sValue) - this->m_eValue = borderstyleMediumDashDotDot; - else if(L"mediumDashed" == sValue) - this->m_eValue = borderstyleMediumDashed; - else if(L"none" == sValue) - this->m_eValue = borderstyleNone; - else if(L"slantDashDot" == sValue) - this->m_eValue = borderstyleSlantDashDot; - else if(L"thick" == sValue) - this->m_eValue = borderstyleThick; - else if(L"thin" == sValue) - this->m_eValue = borderstyleThin; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case borderstyleDashDot : return L"dashDot";break; - case borderstyleDashDotDot : return L"dashDotDot";break; - case borderstyleDashed : return L"dashed";break; - case borderstyleDotted : return L"dotted";break; - case borderstyleDouble : return L"double";break; - case borderstyleHair : return L"hair";break; - case borderstyleMedium : return L"medium";break; - case borderstyleMediumDashDot : return L"mediumDashDot";break; - case borderstyleMediumDashDotDot : return L"mediumDashDotDot";break; - case borderstyleMediumDashed : return L"mediumDashed";break; - case borderstyleNone : return L"none";break; - case borderstyleSlantDashDot : return L"slantDashDot";break; - case borderstyleThick : return L"thick";break; - case borderstyleThin : return L"thin";break; - default:return L"none"; - } - } - - SimpleType_FromString (EBorderStyle) - SimpleType_Operator_Equal (CBorderStyle) - }; - - enum EHorizontalAlignment - { - horizontalalignmentCenter = 0, - horizontalalignmentContinuous = 1, - horizontalalignmentDistributed = 2, - horizontalalignmentFill = 3, - horizontalalignmentGeneral = 4, - horizontalalignmentJustify = 5, - horizontalalignmentLeft = 6, - horizontalalignmentRight = 7, - horizontalalignmentCenterContinuous = 8 - }; - template - class CHorizontalAlignment : public CSimpleType - { - public: - CHorizontalAlignment() {} - CHorizontalAlignment(const EHorizontalAlignment & val) { this->m_eValue = val; } - - virtual EHorizontalAlignment FromString(std::wstring &sValue) - { - // JustifyDistributed - std::wstring sValueL = XmlUtils::GetLower(sValue); - - if(L"center" == sValueL) this->m_eValue = horizontalalignmentCenter; - else if (L"centercontinuous" == sValueL) this->m_eValue = horizontalalignmentCenterContinuous; - else if(L"continuous" == sValueL) this->m_eValue = horizontalalignmentContinuous; - else if(L"distributed" == sValueL) this->m_eValue = horizontalalignmentDistributed; - else if(L"fill" == sValueL) this->m_eValue = horizontalalignmentFill; - else if(L"general" == sValueL) this->m_eValue = horizontalalignmentGeneral; - else if(L"justify" == sValueL) this->m_eValue = horizontalalignmentJustify; - else if(L"left" == sValueL) this->m_eValue = horizontalalignmentLeft; - else if(L"right" == sValueL) this->m_eValue = horizontalalignmentRight; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToVmlString() const - { - switch (this->m_eValue) - { - case horizontalalignmentCenter: return L"Center"; break; - case horizontalalignmentContinuous: return L"Continuous"; break; - case horizontalalignmentDistributed: return L"Distributed"; break; - case horizontalalignmentFill: return L"Fill"; break; - case horizontalalignmentGeneral: return L"Gneral"; break; - case horizontalalignmentJustify: return L"Justify"; break; - case horizontalalignmentLeft: return L"Left"; break; - case horizontalalignmentRight: return L"Right"; break; - case horizontalalignmentCenterContinuous: return L"CenterContinuous"; break; - default: return L"general"; - } - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case horizontalalignmentCenter : return L"center"; break; - case horizontalalignmentContinuous : return L"continuous"; break; - case horizontalalignmentDistributed : return L"distributed"; break; - case horizontalalignmentFill : return L"fill"; break; - case horizontalalignmentGeneral : return L"general"; break; - case horizontalalignmentJustify : return L"justify"; break; - case horizontalalignmentLeft : return L"left"; break; - case horizontalalignmentRight : return L"right"; break; - case horizontalalignmentCenterContinuous: return L"centerContinuous"; break; - default : return L"general"; - } - } - SimpleType_FromString (EHorizontalAlignment) - SimpleType_Operator_Equal (CHorizontalAlignment) - }; - enum EVerticalAlignment - { - verticalalignmentBottom = 0, - verticalalignmentCenter = 1, - verticalalignmentDistributed = 2, - verticalalignmentJustify = 3, - verticalalignmentTop = 4 - }; - template - class CVerticalAlignment : public CSimpleType - { - public: - CVerticalAlignment() {} - CVerticalAlignment(const EVerticalAlignment & val) { this->m_eValue = val; } - - virtual EVerticalAlignment FromString(std::wstring &sValue) - { - std::wstring sValueL = XmlUtils::GetLower(sValue); - //Automatic, JustifyDistributed - if(L"bottom" == sValueL) this->m_eValue = verticalalignmentBottom; - else if(L"center" == sValueL) this->m_eValue = verticalalignmentCenter; - else if(L"distributed" == sValueL) this->m_eValue = verticalalignmentDistributed; - else if(L"justify" == sValueL) this->m_eValue = verticalalignmentJustify; - else if(L"top" == sValueL) this->m_eValue = verticalalignmentTop; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToVmlString() const - { - switch (this->m_eValue) - { - case verticalalignmentBottom: return L"Bottom"; break; - case verticalalignmentCenter: return L"Center"; break; - case verticalalignmentDistributed: return L"Distributed"; break; - case verticalalignmentJustify: return L"Justify"; break; - case verticalalignmentTop: return L"Top"; break; - default:return L"Bottom"; - } - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case verticalalignmentBottom : return L"bottom"; break; - case verticalalignmentCenter : return L"center"; break; - case verticalalignmentDistributed : return L"distributed"; break; - case verticalalignmentJustify : return L"justify"; break; - case verticalalignmentTop : return L"top"; break; - default:return L"bottom"; - } - } - SimpleType_FromString (EVerticalAlignment) - SimpleType_Operator_Equal (CVerticalAlignment) - }; - enum EGradientType - { - gradienttypeLine = 0, - gradienttypePath = 1 - }; - template - class CGradientType : public CSimpleType - { - public: - CGradientType() {} - CGradientType(const EGradientType & val) { this->m_eValue = val; } - - virtual EGradientType FromString(std::wstring &sValue) - { - if(L"line" == sValue) - this->m_eValue = gradienttypeLine; - else if(L"path" == sValue) - this->m_eValue = gradienttypePath; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case gradienttypeLine : return L"line"; break; - case gradienttypePath : return L"path"; break; - default:return L"line"; - } - } - - SimpleType_FromString (EGradientType) - SimpleType_Operator_Equal (CGradientType) - }; - enum EPatternType - { - patterntypeDarkDown = 0, - patterntypeDarkGray = 1, - patterntypeDarkGrid = 2, - patterntypeDarkHorizontal = 3, - patterntypeDarkTrellis = 4, - patterntypeDarkUp = 5, - patterntypeDarkVertical = 6, - patterntypeGray0625 = 7, - patterntypeGray125 = 8, - patterntypeLightDown = 9, - patterntypeLightGray = 10, - patterntypeLightGrid = 11, - patterntypeLightHorizontal = 12, - patterntypeLightTrellis = 13, - patterntypeLightUp = 14, - patterntypeLightVertical = 15, - patterntypeMediumGray = 16, - patterntypeNone = 17, - patterntypeSolid = 18 - }; - template - class CPatternType : public CSimpleType - { - public: - CPatternType() {} - CPatternType(const EPatternType & val) { this->m_eValue = val; } - - virtual EPatternType FromString(std::wstring &sValue) - { - if(L"darkDown" == sValue) - this->m_eValue = patterntypeDarkDown; - else if(L"darkGray" == sValue) - this->m_eValue = patterntypeDarkGray; - else if(L"darkGrid" == sValue) - this->m_eValue = patterntypeDarkGrid; - else if(L"darkHorizontal" == sValue) - this->m_eValue = patterntypeDarkHorizontal; - else if(L"darkTrellis" == sValue) - this->m_eValue = patterntypeDarkTrellis; - else if(L"darkUp" == sValue) - this->m_eValue = patterntypeDarkUp; - else if(L"darkVertical" == sValue || L"VertStripe" == sValue) - this->m_eValue = patterntypeDarkVertical; - else if(L"gray0625" == sValue || L"Gray0625" == sValue ) - this->m_eValue = patterntypeGray0625; - else if(L"gray125" == sValue || L"Gray125" == sValue) - this->m_eValue = patterntypeGray125; - else if(L"lightDown" == sValue) - this->m_eValue = patterntypeLightDown; - else if(L"lightGray" == sValue) - this->m_eValue = patterntypeLightGray; - else if(L"lightGrid" == sValue || L"ThinHorzCross" == sValue) - this->m_eValue = patterntypeLightGrid; - else if(L"lightHorizontal" == sValue || L"HorzStripe" == sValue) - this->m_eValue = patterntypeLightHorizontal; - else if(L"lightTrellis" == sValue) - this->m_eValue = patterntypeLightTrellis; - else if(L"lightUp" == sValue) - this->m_eValue = patterntypeLightUp; - else if(L"lightVertical" == sValue) - this->m_eValue = patterntypeLightVertical; - else if(L"mediumGray" == sValue || L"Gray50" == sValue) - this->m_eValue = patterntypeMediumGray; - else if(L"none" == sValue || L"None" == sValue) - this->m_eValue = patterntypeNone; - else if(L"solid" == sValue || L"Solid" == sValue) - this->m_eValue = patterntypeSolid; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case patterntypeDarkDown:return L"darkDown";break; - case patterntypeDarkGray:return L"darkGray";break; - case patterntypeDarkGrid:return L"darkGrid";break; - case patterntypeDarkHorizontal:return L"darkHorizontal";break; - case patterntypeDarkTrellis:return L"darkTrellis";break; - case patterntypeDarkUp:return L"darkUp";break; - case patterntypeDarkVertical:return L"darkVertical";break; - case patterntypeGray0625:return L"gray0625";break; - case patterntypeGray125:return L"gray125";break; - case patterntypeLightDown:return L"lightDown";break; - case patterntypeLightGray:return L"lightGray";break; - case patterntypeLightGrid:return L"lightGrid";break; - case patterntypeLightHorizontal:return L"lightHorizontal";break; - case patterntypeLightTrellis:return L"lightTrellis";break; - case patterntypeLightUp:return L"lightUp";break; - case patterntypeLightVertical:return L"lightVertical";break; - case patterntypeMediumGray:return L"mediumGray";break; - case patterntypeNone:return L"none";break; - case patterntypeSolid:return L"solid";break; - default: return L"none"; - } - - return L"none"; - } - - SimpleType_FromString (EPatternType) - SimpleType_Operator_Equal (CPatternType) - }; - - enum ETableStyleType - { - tablestyletypeBlankRow = 0, - tablestyletypeFirstColumn = 1, - tablestyletypeFirstColumnStripe = 2, - tablestyletypeFirstColumnSubheading = 3, - tablestyletypeFirstHeaderCell = 4, - tablestyletypeFirstRowStripe = 5, - tablestyletypeFirstRowSubheading = 6, - tablestyletypeFirstSubtotalColumn = 7, - tablestyletypeFirstSubtotalRow = 8, - tablestyletypeFirstTotalCell = 9, - tablestyletypeHeaderRow = 10, - tablestyletypeLastColumn = 11, - tablestyletypeLastHeaderCell = 12, - tablestyletypeLastTotalCell = 13, - tablestyletypePageFieldLabels = 14, - tablestyletypePageFieldValues = 15, - tablestyletypeSecondColumnStripe = 16, - tablestyletypeSecondColumnSubheading = 17, - tablestyletypeSecondRowStripe = 18, - tablestyletypeSecondRowSubheading = 19, - tablestyletypeSecondSubtotalColumn = 20, - tablestyletypeSecondSubtotalRow = 21, - tablestyletypeThirdColumnSubheading = 22, - tablestyletypeThirdRowSubheading = 23, - tablestyletypeThirdSubtotalColumn = 24, - tablestyletypeThirdSubtotalRow = 25, - tablestyletypeTotalRow = 26, - tablestyletypeWholeTable = 27 - }; - template - class CTableStyleType : public CSimpleType - { - public: - CTableStyleType() {} - CTableStyleType(const ETableStyleType & val) { this->m_eValue = val; } - - virtual ETableStyleType FromString(std::wstring &sValue) - { - if(L"blankRow" == sValue) - this->m_eValue = tablestyletypeBlankRow; - else if(L"firstColumn" == sValue) - this->m_eValue = tablestyletypeFirstColumn; - else if(L"firstColumnStripe" == sValue) - this->m_eValue = tablestyletypeFirstColumnStripe; - else if(L"firstColumnSubheading" == sValue) - this->m_eValue = tablestyletypeFirstColumnSubheading; - else if(L"firstHeaderCell" == sValue) - this->m_eValue = tablestyletypeFirstHeaderCell; - else if(L"firstRowStripe" == sValue) - this->m_eValue = tablestyletypeFirstRowStripe; - else if(L"firstRowSubheading" == sValue) - this->m_eValue = tablestyletypeFirstRowSubheading; - else if(L"firstSubtotalColumn" == sValue) - this->m_eValue = tablestyletypeFirstSubtotalColumn; - else if(L"firstSubtotalRow" == sValue) - this->m_eValue = tablestyletypeFirstSubtotalRow; - else if(L"firstTotalCell" == sValue) - this->m_eValue = tablestyletypeFirstTotalCell; - else if(L"headerRow" == sValue) - this->m_eValue = tablestyletypeHeaderRow; - else if(L"lastColumn" == sValue) - this->m_eValue = tablestyletypeLastColumn; - else if(L"lastHeaderCell" == sValue) - this->m_eValue = tablestyletypeLastHeaderCell; - else if(L"lastTotalCell" == sValue) - this->m_eValue = tablestyletypeLastTotalCell; - else if(L"pageFieldLabels" == sValue) - this->m_eValue = tablestyletypePageFieldLabels; - else if(L"pageFieldValues" == sValue) - this->m_eValue = tablestyletypePageFieldValues; - else if(L"secondColumnStripe" == sValue) - this->m_eValue = tablestyletypeSecondColumnStripe; - else if(L"secondColumnSubheading" == sValue) - this->m_eValue = tablestyletypeSecondColumnSubheading; - else if(L"secondRowStripe" == sValue) - this->m_eValue = tablestyletypeSecondRowStripe; - else if(L"secondRowSubheading" == sValue) - this->m_eValue = tablestyletypeSecondRowSubheading; - else if(L"secondSubtotalColumn" == sValue) - this->m_eValue = tablestyletypeSecondSubtotalColumn; - else if(L"secondSubtotalRow" == sValue) - this->m_eValue = tablestyletypeSecondSubtotalRow; - else if(L"thirdColumnSubheading" == sValue) - this->m_eValue = tablestyletypeThirdColumnSubheading; - else if(L"thirdRowSubheading" == sValue) - this->m_eValue = tablestyletypeThirdRowSubheading; - else if(L"thirdSubtotalColumn" == sValue) - this->m_eValue = tablestyletypeThirdSubtotalColumn; - else if(L"thirdSubtotalRow" == sValue) - this->m_eValue = tablestyletypeThirdSubtotalRow; - else if(L"totalRow" == sValue) - this->m_eValue = tablestyletypeTotalRow; - else if(L"wholeTable" == sValue) - this->m_eValue = tablestyletypeWholeTable; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case tablestyletypeBlankRow: return L"blankRow";break; - case tablestyletypeFirstColumn: return L"firstColumn";break; - case tablestyletypeFirstColumnStripe: return L"firstColumnStripe";break; - case tablestyletypeFirstColumnSubheading: return L"firstColumnSubheading";break; - case tablestyletypeFirstHeaderCell: return L"firstHeaderCell";break; - case tablestyletypeFirstRowStripe: return L"firstRowStripe";break; - case tablestyletypeFirstRowSubheading: return L"firstRowSubheading";break; - case tablestyletypeFirstSubtotalColumn: return L"firstSubtotalColumn";break; - case tablestyletypeFirstSubtotalRow: return L"firstSubtotalRow";break; - case tablestyletypeFirstTotalCell: return L"firstTotalCell";break; - case tablestyletypeHeaderRow: return L"headerRow";break; - case tablestyletypeLastColumn: return L"lastColumn";break; - case tablestyletypeLastHeaderCell: return L"lastHeaderCell";break; - case tablestyletypeLastTotalCell: return L"lastTotalCell";break; - case tablestyletypePageFieldLabels: return L"pageFieldLabels";break; - case tablestyletypePageFieldValues: return L"pageFieldValues";break; - case tablestyletypeSecondColumnStripe: return L"secondColumnStripe";break; - case tablestyletypeSecondColumnSubheading: return L"secondColumnSubheading";break; - case tablestyletypeSecondRowStripe: return L"secondRowStripe";break; - case tablestyletypeSecondRowSubheading: return L"secondRowSubheading";break; - case tablestyletypeSecondSubtotalColumn: return L"secondSubtotalColumn";break; - case tablestyletypeSecondSubtotalRow: return L"secondSubtotalRow";break; - case tablestyletypeThirdColumnSubheading: return L"thirdColumnSubheading";break; - case tablestyletypeThirdRowSubheading: return L"thirdRowSubheading";break; - case tablestyletypeThirdSubtotalColumn: return L"thirdSubtotalColumn";break; - case tablestyletypeThirdSubtotalRow: return L"thirdSubtotalRow";break; - case tablestyletypeTotalRow: return L"totalRow";break; - case tablestyletypeWholeTable: return L"wholeTable";break; - default : return L"blankRow";break; - } - return L"blankRow"; - } - - SimpleType_FromString (ETableStyleType) - SimpleType_Operator_Equal (CTableStyleType) - }; - enum ECellFormulaType - { - cellformulatypeArray = 0, - cellformulatypeDataTable = 1, - cellformulatypeNormal = 2, - cellformulatypeShared = 3 - }; - template - class CCellFormulaType : public CSimpleType - { - public: - CCellFormulaType() {} - CCellFormulaType(const ECellFormulaType & val) { this->m_eValue = val; } - - virtual ECellFormulaType FromString(std::wstring &sValue) - { - if(L"array" == sValue) - this->m_eValue = cellformulatypeArray; - else if(L"dataTable" == sValue) - this->m_eValue = cellformulatypeDataTable; - else if(L"normal" == sValue) - this->m_eValue = cellformulatypeNormal; - else if(L"shared" == sValue) - this->m_eValue = cellformulatypeShared; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - ECellFormulaType FromStringA(const char* sValue) - { - if(strcmp("array", sValue) == 0) - this->m_eValue = cellformulatypeArray; - else if(strcmp("dataTable", sValue) == 0) - this->m_eValue = cellformulatypeDataTable; - else if(strcmp("normal", sValue) == 0) - this->m_eValue = cellformulatypeNormal; - else if(strcmp("shared", sValue) == 0) - this->m_eValue = cellformulatypeShared; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case cellformulatypeArray : return L"array";break; - case cellformulatypeDataTable : return L"dataTable";break; - case cellformulatypeNormal : return L"normal";break; - case cellformulatypeShared : return L"shared";break; - default: return L"normal"; - } - } - - SimpleType_FromString (ECellFormulaType) - SimpleType_Operator_Equal (CCellFormulaType) - }; - enum EUpdateLinksType - { - updatelinksAlways = 0, - updatelinksNever = 1, - updatelinksUserSet = 2 - }; - template - class CUpdateLinksType : public CSimpleType - { - public: - CUpdateLinksType() {} - CUpdateLinksType(const EUpdateLinksType & val) { this->m_eValue = val; } - - virtual EUpdateLinksType FromString(std::wstring &sValue) - { - if(L"always" == sValue) - this->m_eValue = updatelinksAlways; - else if(L"never" == sValue) - this->m_eValue = updatelinksNever; - else if(L"userSet" == sValue) - this->m_eValue = updatelinksUserSet; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case updatelinksAlways: return L"always";break; - case updatelinksNever: return L"never";break; - case updatelinksUserSet: return L"userSet";break; - default: return L"always"; - } - } - - SimpleType_FromString (EUpdateLinksType) - SimpleType_Operator_Equal (CUpdateLinksType) - }; - enum ECellTypeType - { - celltypeBool = 0, - celltypeDate = 1, - celltypeError = 2, - celltypeInlineStr = 3, - celltypeNumber = 4, - celltypeSharedString = 5, - celltypeStr = 6, -//--------------- for our using - celltypePercentage = 7, - celltypeScientific = 8, - celltypeFraction = 9, - celltypeTime = 10, - celltypeCurrency = 11, - celltypeDateTime = 12 - }; - template - class CCellTypeType : public CSimpleType - { - public: - CCellTypeType() {} - CCellTypeType(const ECellTypeType & val) { this->m_eValue = val; } - - virtual ECellTypeType FromString(std::wstring &sValue) - { - if(L"b" == sValue) - this->m_eValue = celltypeBool; - else if(L"d" == sValue || L"DateTime" == sValue) - this->m_eValue = celltypeDate; - else if(L"e" == sValue) - this->m_eValue = celltypeError; - else if(L"inlineStr" == sValue) - this->m_eValue = celltypeInlineStr; - else if(L"n" == sValue || L"Number" == sValue) - this->m_eValue = celltypeNumber; - else if(L"s" == sValue) - this->m_eValue = celltypeSharedString; - else if(L"str" == sValue || L"String" == sValue) - this->m_eValue = celltypeStr; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - ECellTypeType FromStringA(const char* sValue) - { - if(strcmp("s", sValue) == 0) - this->m_eValue = celltypeSharedString; - else if(strcmp("str", sValue) == 0) - this->m_eValue = celltypeStr; - else if(strcmp("n", sValue) == 0) - this->m_eValue = celltypeNumber; - else if(strcmp("e", sValue) == 0) - this->m_eValue = celltypeError; - else if(strcmp("b", sValue) == 0) - this->m_eValue = celltypeBool; - else if(strcmp("inlineStr", sValue) == 0) - this->m_eValue = celltypeInlineStr; - else if(strcmp("d", sValue) == 0) - this->m_eValue = celltypeDate; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case celltypeBool: return L"b";break; - case celltypeDate: return L"d";break; - case celltypeError: return L"e";break; - case celltypeInlineStr: return L"inlineStr";break; - case celltypeNumber: return L"n";break; - case celltypeSharedString: return L"s";break; - case celltypeStr: return L"str";break; - default: return L"n"; - } - } - - SimpleType_FromString (ECellTypeType) - SimpleType_Operator_Equal (CCellTypeType) - }; - enum ECellAnchorType - { - cellanchorAbsolute = 0, - cellanchorOneCell = 1, - cellanchorTwoCell = 2 - }; - template - class CCellAnchorType : public CSimpleType - { - public: - CCellAnchorType() {} - CCellAnchorType(const ECellAnchorType & val) { this->m_eValue = val; } - - virtual ECellAnchorType FromString(std::wstring &sValue) - { - if(L"absolute" == sValue) - this->m_eValue = cellanchorAbsolute; - else if(L"oneCell" == sValue) - this->m_eValue = cellanchorOneCell; - else if(L"twoCell" == sValue) - this->m_eValue = cellanchorTwoCell; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case cellanchorAbsolute: return L"absolute"; break; - case cellanchorOneCell: return L"oneCell"; break; - case cellanchorTwoCell: return L"twoCell"; break; - default: return L"twoCell"; - } - } - - SimpleType_FromString (ECellAnchorType) - SimpleType_Operator_Equal (CCellAnchorType) - }; - - enum ESheetViewType - { - sheetviewNormal = 0, - sheetviewPageBreakPreview = 1, - sheetviewPageLayout = 2 - }; - template - class CSheetViewType : public CSimpleType - { - public: - CSheetViewType() {} - CSheetViewType(const ESheetViewType & val) { this->m_eValue = val; } - - virtual ESheetViewType FromString(std::wstring &sValue) - { - if(L"normal" == sValue) - this->m_eValue = sheetviewNormal; - else if(L"pageBreakPreview" == sValue) - this->m_eValue = sheetviewPageBreakPreview; - else if(L"pageLayout" == sValue) - this->m_eValue = sheetviewPageLayout; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case sheetviewNormal: return L"normal"; break; - case sheetviewPageBreakPreview: return L"pageBreakPreview"; break; - case sheetviewPageLayout: return L"pageLayout"; break; - default: return L"normal"; - } - } - - SimpleType_FromString (ESheetViewType) - SimpleType_Operator_Equal (CSheetViewType) - }; - enum EChartLegendPos - { - chartlegendposLeft = 0, - chartlegendposTop = 1, - chartlegendposRight = 2, - chartlegendposBottom = 3, - chartlegendposRightTop = 4 - }; - template - class CChartLegendPos : public CSimpleType - { - public: - CChartLegendPos() {} - CChartLegendPos(const EChartLegendPos & val) { this->m_eValue = val; } - - virtual EChartLegendPos FromString(std::wstring &sValue) - { - if(L"l" == sValue) - this->m_eValue = chartlegendposLeft; - else if(L"t" == sValue) - this->m_eValue = chartlegendposTop; - else if(L"r" == sValue) - this->m_eValue = chartlegendposRight; - else if(L"b" == sValue) - this->m_eValue = chartlegendposBottom; - else if(L"tr" == sValue) - this->m_eValue = chartlegendposRightTop; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case chartlegendposLeft: return L"l"; break; - case chartlegendposTop: return L"t"; break; - case chartlegendposRight: return L"r"; break; - case chartlegendposBottom: return L"b"; break; - case chartlegendposRightTop: return L"tr"; break; - default: return L"t"; - } - } - - SimpleType_FromString (EChartLegendPos) - SimpleType_Operator_Equal (CChartLegendPos) - }; - enum EChartHMode - { - charthmodeFactor = 0, - charthmodeEdge = 1 - }; - template - class CChartHMode : public CSimpleType - { - public: - CChartHMode() {} - CChartHMode(const EChartHMode & val) { this->m_eValue = val; } - - virtual EChartHMode FromString(std::wstring &sValue) - { - if(L"factor" == sValue) - this->m_eValue = charthmodeFactor; - else if(L"edge" == sValue) - this->m_eValue = charthmodeEdge; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case charthmodeFactor: return L"factor"; break; - case charthmodeEdge: return L"edge"; break; - default: return L"factor"; - } - } - - SimpleType_FromString (EChartHMode) - SimpleType_Operator_Equal (CChartHMode) - }; - enum EChartLayoutTarget - { - chartlayouttargetInner = 0, - chartlayouttargetOuter = 1 - }; - template - class CChartLayoutTarget : public CSimpleType - { - public: - CChartLayoutTarget() {} - CChartLayoutTarget(const EChartLayoutTarget & val) { this->m_eValue = val; } - - virtual EChartLayoutTarget FromString(std::wstring &sValue) - { - if(L"inner" == sValue) - this->m_eValue = chartlayouttargetInner; - else if(L"outer" == sValue) - this->m_eValue = chartlayouttargetOuter; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case chartlayouttargetInner: return L"inner"; break; - case chartlayouttargetOuter: return L"outer"; break; - default: return L"inner"; - } - } - - SimpleType_FromString (EChartLayoutTarget) - SimpleType_Operator_Equal (CChartLayoutTarget) - }; - enum EChartAxPos - { - chartaxposLeft = 0, - chartaxposTop = 1, - chartaxposRight = 2, - chartaxposBottom= 3 - }; - template - class CChartAxPos : public CSimpleType - { - public: - CChartAxPos() {} - CChartAxPos(const EChartAxPos & val) { this->m_eValue = val; } - - virtual EChartAxPos FromString(std::wstring &sValue) - { - if(L"l" == sValue) - this->m_eValue = chartaxposLeft; - else if(L"t" == sValue) - this->m_eValue = chartaxposTop; - else if(L"r" == sValue) - this->m_eValue = chartaxposRight; - else if(L"b" == sValue) - this->m_eValue = chartaxposBottom; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case chartaxposLeft: return L"l"; break; - case chartaxposTop: return L"t"; break; - case chartaxposRight: return L"r"; break; - case chartaxposBottom: return L"b"; break; - default: return L"l"; - } - } - - SimpleType_FromString (EChartAxPos) - SimpleType_Operator_Equal (CChartAxPos) - }; - enum EChartBarGrouping - { - chartbargroupingClustered = 0, - chartbargroupingPercentStacked = 1, - chartbargroupingStacked = 2, - chartbargroupingStandard= 3 - }; - template - class CChartBarGrouping : public CSimpleType - { - public: - CChartBarGrouping() {} - CChartBarGrouping(const EChartBarGrouping & val) { this->m_eValue = val; } - - virtual EChartBarGrouping FromString(std::wstring &sValue) - { - if(L"clustered" == sValue) - this->m_eValue = chartbargroupingClustered; - else if(L"percentStacked" == sValue) - this->m_eValue = chartbargroupingPercentStacked; - else if(L"stacked" == sValue) - this->m_eValue = chartbargroupingStacked; - else if(L"standard" == sValue) - this->m_eValue = chartbargroupingStandard; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case chartbargroupingClustered: return L"clustered"; break; - case chartbargroupingPercentStacked: return L"percentStacked"; break; - case chartbargroupingStacked: return L"stacked"; break; - case chartbargroupingStandard: return L"standard"; break; - default: return L"clustered"; - } - } - - SimpleType_FromString (EChartBarGrouping) - SimpleType_Operator_Equal (CChartBarGrouping) - }; - enum EChartBarDirection - { - chartbardirectionBar = 0, - chartbardirectionCol = 1 - }; - template - class CChartBarDirection : public CSimpleType - { - public: - CChartBarDirection() {} - CChartBarDirection(const EChartBarDirection & val) { this->m_eValue = val; } - - virtual EChartBarDirection FromString(std::wstring &sValue) - { - if(L"bar" == sValue) - this->m_eValue = chartbardirectionBar; - else if(L"col" == sValue) - this->m_eValue = chartbardirectionCol; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case chartbardirectionBar: return L"bar"; break; - case chartbardirectionCol: return L"col"; break; - default: return L"bar"; - } - } - - SimpleType_FromString (EChartBarDirection) - SimpleType_Operator_Equal (CChartBarDirection) - }; - enum EChartSymbol - { - chartsymbolCircle = 0, - chartsymbolDash = 1, - chartsymbolDiamond = 2, - chartsymbolDot = 3, - chartsymbolNone = 4, - chartsymbolPicture = 5, - chartsymbolPlus = 6, - chartsymbolSquare = 7, - chartsymbolStare = 8, - chartsymbolStar = 9, - chartsymbolTriangle = 10, - chartsymbolX = 11 - }; - template - class CChartSymbol : public CSimpleType - { - public: - CChartSymbol() {} - CChartSymbol(const EChartSymbol & val) { this->m_eValue = val; } - - virtual EChartSymbol FromString(std::wstring &sValue) - { - if(L"circle" == sValue) - this->m_eValue = chartsymbolCircle; - else if(L"dash" == sValue) - this->m_eValue = chartsymbolDash; - else if(L"diamond" == sValue) - this->m_eValue = chartsymbolDiamond; - else if(L"dot" == sValue) - this->m_eValue = chartsymbolDot; - else if(L"none" == sValue) - this->m_eValue = chartsymbolNone; - else if(L"picture" == sValue) - this->m_eValue = chartsymbolPicture; - else if(L"plus" == sValue) - this->m_eValue = chartsymbolPlus; - else if(L"square" == sValue) - this->m_eValue = chartsymbolSquare; - else if(L"star" == sValue) - this->m_eValue = chartsymbolStare; - else if(L"triangle" == sValue) - this->m_eValue = chartsymbolTriangle; - else if(L"x" == sValue) - this->m_eValue = chartsymbolX; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case chartsymbolCircle: return L"circle"; break; - case chartsymbolDash: return L"dash"; break; - case chartsymbolDiamond: return L"diamond"; break; - case chartsymbolDot: return L"dot"; break; - case chartsymbolNone: return L"none"; break; - case chartsymbolPicture: return L"picture"; break; - case chartsymbolPlus: return L"plus"; break; - case chartsymbolSquare: return L"square"; break; - case chartsymbolStare: return L"star"; break; - case chartsymbolTriangle: return L"triangle"; break; - case chartsymbolX: return L"x"; break; - default: return L"none"; - } - } - - SimpleType_FromString (EChartSymbol) - SimpleType_Operator_Equal (CChartSymbol) - }; - enum EPageSize - { - pagesizeLetterPaper = 1, - pagesizeLetterSmall = 2, - pagesizeTabloidPaper = 3, - pagesizeLedgerPaper = 4, - pagesizeLegalPaper = 5, - pagesizeStatementPaper = 6, - pagesizeExecutivePaper = 7, - pagesizeA3Paper = 8, - pagesizeA4Paper = 9, - pagesizeA4SmallPaper = 10, - pagesizeA5Paper = 11, - pagesizeB4Paper = 12, - pagesizeB5Paper = 13, - pagesizeFolioPaper = 14, - pagesizeQuartoPaper = 15, - pagesizeStandardPaper1 = 16, - pagesizeStandardPaper2 = 17, - pagesizeNotePaper = 18, - pagesize9Envelope = 19, - pagesize10Envelope = 20, - pagesize11Envelope = 21, - pagesize12Envelope = 22, - pagesize14Envelope = 23, - pagesizeCPaper = 24, - pagesizeDPaper = 25, - pagesizeEPaper = 26, - pagesizeDLEnvelope = 27, - pagesizeC5Envelope = 28, - pagesizeC3Envelope = 29, - pagesizeC4Envelope = 30, - pagesizeC6Envelope = 31, - pagesizeC65Envelope = 32, - pagesizeB4Envelope = 33, - pagesizeB5Envelope = 34, - pagesizeB6Envelope = 35, - pagesizeItalyEnvelope = 36, - pagesizeMonarchEnvelope = 37, - pagesize6_3_4Envelope = 38, - pagesizeUSStandardFanfold = 39, - pagesizeGermanStandardFanfold = 40, - pagesizeGermanLegalFanfold = 41, - pagesizeISOB4 = 42, - pagesizeJapaneseDoublePostcard = 43, - pagesizeStandardPaper3 = 44, - pagesizeStandardPaper4 = 45, - pagesizeStandardPaper5 = 46, - pagesizeInviteEnvelope = 47, - pagesizeLetterExtraPaper = 50, - pagesizeLegalExtraPaper = 51, - pagesizeTabloidExtraPaper = 52, - pagesizeA4ExtraPaper = 53, - pagesizeLetterTransversePaper = 54, - pagesizeA4TransversePaper = 55, - pagesizeLetterExtraTransversePaper = 56, - pagesizeSuperA_SuperA_A4Paper = 57, - pagesizeSuperB_SuperB_A3Paper = 58, - pagesizeLetterPlusPaper = 59, - pagesizeA4PlusPaper = 60, - pagesizeA5TransversePaper = 61, - pagesizeJISB5TransversePaper = 62, - pagesizeA3ExtraPaper = 63, - pagesizeA5ExtraPaper = 64, - pagesizeISOB5ExtraPaper = 65, - pagesizeA2Paper = 66, - pagesizeA3TransversePaper = 67, - pagesizeA3ExtraTransversePaper = 68 - }; - template - class CPageSize : public CSimpleType - { - public: - CPageSize() {} - CPageSize(const EPageSize & val) { this->m_eValue = val; } - - virtual EPageSize FromString(std::wstring &sValue) - { - int nCharset = _wtoi(sValue.c_str()); - this->m_eValue = (EPageSize)nCharset; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - return std::to_wstring(this->m_eValue ); - } - - SimpleType_FromString (EPageSize) - SimpleType_Operator_Equal (CPageSize) - }; - - enum EPageUnits - { - mm = 0, - cm = 1, - inch = 2, - pt = 3, - px = 4, - emu = 5 - - }; - template - class CPageUnits : public CSimpleType - { - public: - CPageUnits() {} - CPageUnits(const EPageUnits & val) { this->m_eValue = val; } - - virtual EPageUnits FromString(std::wstring &sValue) - { - if (sValue == L"in") this->m_eValue = inch; - else if (sValue == L"mm") this->m_eValue = mm; - else if (sValue == L"cm") this->m_eValue = cm; - else if (sValue == L"pt") this->m_eValue = pt; - else if (sValue == L"px") this->m_eValue = px; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - switch(this->m_eValue) - { - case mm: sResult = L"mm";break; - case cm: sResult = L"cm";break; - case pt: sResult = L"pt";break; - case px: sResult = L"px";break; - case inch: sResult = L"in";break; - } - return sResult; - } - - SimpleType_FromString (EPageUnits) - SimpleType_Operator_Equal (CPageUnits) - }; - - enum ECellComments - { - cellcommentsNone = 0, - cellcommentsAsDisplayed = 1, - cellcommentsAtEnd = 2 - }; - - template - class CCellComments : public CSimpleType - { - public: - CCellComments() {} - CCellComments(const ECellComments & val) { this->m_eValue = val; } - virtual ECellComments FromString(std::wstring &sValue) - { - if (L"asDisplayed" == sValue ) this->m_eValue = cellcommentsAsDisplayed; - else if (L"atEnd" == sValue ) this->m_eValue = cellcommentsAtEnd; - else if (L"none" == sValue ) this->m_eValue = cellcommentsNone; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case cellcommentsAsDisplayed : return L"asDisplayed"; - case cellcommentsAtEnd : return L"atEnd"; - case cellcommentsNone : return L"none"; - default : return L"none"; - } - } - - SimpleType_FromString (ECellComments) - SimpleType_Operator_Equal (CCellComments) - }; - - enum EPrintError - { - printerrorDisplayed = 0, - printerrorBlank = 1, - printerrorDash = 2, - printerrorNA = 3 - }; - - template - class CPrintError : public CSimpleType - { - public: - CPrintError() {} - CPrintError(const EPrintError & val) { this->m_eValue = val; } - virtual EPrintError FromString(std::wstring &sValue) - { - if (L"blank" == sValue ) this->m_eValue = printerrorBlank; - else if (L"dash" == sValue ) this->m_eValue = printerrorDash; - else if (L"displayed" == sValue ) this->m_eValue = printerrorDisplayed; - else if (L"NA" == sValue ) this->m_eValue = printerrorNA; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case printerrorBlank: return L"blank"; - case printerrorDash: return L"dash"; - case printerrorDisplayed: return L"displayed"; - case printerrorNA: return L"NA"; - default: return L"displayed"; - } - } - - SimpleType_FromString (EPrintError) - SimpleType_Operator_Equal (CPrintError) - }; - - enum EPageOrder - { - pageorderDownThenOver = 0, - pageorderOverThenDown = 1 - }; - - template - class CPageOrder : public CSimpleType - { - public: - CPageOrder() {} - CPageOrder(const EPageOrder & val) { this->m_eValue = val; } - virtual EPageOrder FromString(std::wstring &sValue) - { - if (L"downThenOver" == sValue ) this->m_eValue = pageorderDownThenOver; - else if (L"overThenDown" == sValue ) this->m_eValue = pageorderOverThenDown; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case pageorderDownThenOver : return L"downThenOver"; - case pageorderOverThenDown : return L"overThenDown"; - default : return L"downThenOver"; - } - } - - SimpleType_FromString (EPageOrder) - SimpleType_Operator_Equal (CPageOrder) - }; - enum ETotalsRowFunction - { - totalrowfunctionAverage = 1, - totalrowfunctionCount = 2, - totalrowfunctionCountNums = 3, - totalrowfunctionCustom = 4, - totalrowfunctionMax = 5, - totalrowfunctionMin = 6, - totalrowfunctionNone = 7, - totalrowfunctionStdDev = 8, - totalrowfunctionSum = 9, - totalrowfunctionVar = 10 - }; - - template - class CTotalsRowFunction : public CSimpleType - { - public: - CTotalsRowFunction() {} - CTotalsRowFunction(const ETotalsRowFunction & val) { this->m_eValue = val; } - - virtual ETotalsRowFunction FromString(std::wstring &sValue) - { - if(L"average" == sValue) - this->m_eValue = totalrowfunctionAverage; - else if(L"count" == sValue) - this->m_eValue = totalrowfunctionCount; - else if(L"countNums" == sValue) - this->m_eValue = totalrowfunctionCountNums; - else if(L"custom" == sValue) - this->m_eValue = totalrowfunctionCustom; - else if(L"max" == sValue) - this->m_eValue = totalrowfunctionMax; - else if(L"min" == sValue) - this->m_eValue = totalrowfunctionMin; - else if(L"none" == sValue) - this->m_eValue = totalrowfunctionNone; - else if(L"stdDev" == sValue) - this->m_eValue = totalrowfunctionStdDev; - else if(L"sum" == sValue) - this->m_eValue = totalrowfunctionSum; - else if(L"var" == sValue) - this->m_eValue = totalrowfunctionVar; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - switch(this->m_eValue) - { - case totalrowfunctionAverage: sResult = L"average";break; - case totalrowfunctionCount: sResult = L"count";break; - case totalrowfunctionCountNums: sResult = L"countNums";break; - case totalrowfunctionCustom: sResult = L"custom";break; - case totalrowfunctionMax: sResult = L"max";break; - case totalrowfunctionMin: sResult = L"min";break; - case totalrowfunctionNone: sResult = L"none";break; - case totalrowfunctionStdDev: sResult = L"stdDev";break; - case totalrowfunctionSum: sResult = L"sum";break; - case totalrowfunctionVar: sResult = L"var";break; - } - return sResult; - } - - SimpleType_FromString (ETotalsRowFunction) - SimpleType_Operator_Equal (CTotalsRowFunction) - }; - enum ESortBy - { - sortbyCellColor = 1, - sortbyFontColor = 2, - sortbyIcon = 3, - sortbyValue = 4 - }; - template - class CSortBy : public CSimpleType - { - public: - CSortBy() {} - CSortBy(const ESortBy & val) { this->m_eValue = val; } - - virtual ESortBy FromString(std::wstring &sValue) - { - if(L"cellColor" == sValue) - this->m_eValue = sortbyCellColor; - else if(L"fontColor" == sValue) - this->m_eValue = sortbyFontColor; - else if(L"icon" == sValue) - this->m_eValue = sortbyIcon; - else if(L"value" == sValue) - this->m_eValue = sortbyValue; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - switch(this->m_eValue) - { - case sortbyCellColor: sResult = L"cellColor"; break; - case sortbyFontColor: sResult = L"fontColor"; break; - case sortbyIcon: sResult = L"icon"; break; - case sortbyValue: sResult = L"value"; break; - } - return sResult; - } - - SimpleType_FromString (ESortBy) - SimpleType_Operator_Equal (CSortBy) - }; - enum ECustomFilter - { - customfilterEqual = 1, - customfilterGreaterThan = 2, - customfilterGreaterThanOrEqual = 3, - customfilterLessThan = 4, - customfilterLessThanOrEqual = 5, - customfilterNotEqual = 6 - }; - template - class CCustomFilter : public CSimpleType - { - public: - CCustomFilter() {} - CCustomFilter(const ECustomFilter & val) { this->m_eValue = val; } - - virtual ECustomFilter FromString(std::wstring &sValue) - { - if(L"equal" == sValue) - this->m_eValue = customfilterEqual; - else if(L"greaterThan" == sValue) - this->m_eValue = customfilterGreaterThan; - else if(L"greaterThanOrEqual" == sValue) - this->m_eValue = customfilterGreaterThanOrEqual; - else if(L"lessThan" == sValue) - this->m_eValue = customfilterLessThan; - else if(L"lessThanOrEqual" == sValue) - this->m_eValue = customfilterLessThanOrEqual; - else if(L"notEqual" == sValue) - this->m_eValue = customfilterNotEqual; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - switch(this->m_eValue) - { - case customfilterEqual: sResult = L"equal";break; - case customfilterGreaterThan: sResult = L"greaterThan";break; - case customfilterGreaterThanOrEqual: sResult = L"greaterThanOrEqual";break; - case customfilterLessThan: sResult = L"lessThan";break; - case customfilterLessThanOrEqual: sResult = L"lessThanOrEqual";break; - case customfilterNotEqual: sResult = L"notEqual";break; - } - return sResult; - } - - SimpleType_FromString (ECustomFilter) - SimpleType_Operator_Equal (CCustomFilter) - }; - enum EDateTimeGroup - { - datetimegroupDay = 1, - datetimegroupHour = 2, - datetimegroupMinute = 3, - datetimegroupMonth = 4, - datetimegroupSecond = 5, - datetimegroupYear = 6 - }; - template - class CDateTimeGroup : public CSimpleType - { - public: - CDateTimeGroup() {} - CDateTimeGroup(const EDateTimeGroup & val) { this->m_eValue = val; } - - virtual EDateTimeGroup FromString(std::wstring &sValue) - { - if(L"day" == sValue) - this->m_eValue = datetimegroupDay; - else if(L"hour" == sValue) - this->m_eValue = datetimegroupHour; - else if(L"minute" == sValue) - this->m_eValue = datetimegroupMinute; - else if(L"month" == sValue) - this->m_eValue = datetimegroupMonth; - else if(L"second" == sValue) - this->m_eValue = datetimegroupSecond; - else if(L"year" == sValue) - this->m_eValue = datetimegroupYear; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - switch(this->m_eValue) - { - case datetimegroupDay: sResult = L"day"; break; - case datetimegroupHour: sResult = L"hour"; break; - case datetimegroupMinute: sResult = L"minute"; break; - case datetimegroupMonth: sResult = L"month"; break; - case datetimegroupSecond: sResult = L"second"; break; - case datetimegroupYear: sResult = L"year"; break; - } - return sResult; - } - - SimpleType_FromString (EDateTimeGroup) - SimpleType_Operator_Equal (CDateTimeGroup) - }; - enum ESortMethod - { - sortmethodNone = 1, - sortmethodPinYin = 2, - sortmethodStroke = 3, - }; - template - class CSortMethod : public CSimpleType - { - public: - CSortMethod() {} - CSortMethod(const ESortMethod & val) { this->m_eValue = val; } - - virtual ESortMethod FromString(std::wstring &sValue) - { - if(L"none" == sValue) - this->m_eValue = sortmethodNone; - else if(L"pinYin" == sValue) - this->m_eValue = sortmethodPinYin; - else if(L"stroke" == sValue) - this->m_eValue = sortmethodStroke; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - switch(this->m_eValue) - { - case sortmethodNone: sResult = L"none";break; - case sortmethodPinYin: sResult = L"pinYin";break; - case sortmethodStroke: sResult = L"stroke";break; - } - return sResult; - } - - SimpleType_FromString (ESortMethod) - SimpleType_Operator_Equal (CSortMethod) - }; - enum EDynamicFilterType - { - dynamicfiltertypeAboveAverage = 1, - dynamicfiltertypeBelowAverage = 2, - dynamicfiltertypeLastMonth = 3, - dynamicfiltertypeLastQuarter = 4, - dynamicfiltertypeLastWeek = 5, - dynamicfiltertypeLastYear = 6, - dynamicfiltertypeM1 = 7, - dynamicfiltertypeM10 = 8, - dynamicfiltertypeM11 = 9, - dynamicfiltertypeM12 = 10, - dynamicfiltertypeM2 = 11, - dynamicfiltertypeM3 = 12, - dynamicfiltertypeM4 = 13, - dynamicfiltertypeM5 = 14, - dynamicfiltertypeM6 = 15, - dynamicfiltertypeM7 = 16, - dynamicfiltertypeM8 = 17, - dynamicfiltertypeM9 = 18, - dynamicfiltertypeNextMonth = 19, - dynamicfiltertypeNextQuarter = 20, - dynamicfiltertypeNextWeek = 21, - dynamicfiltertypeNextYear = 22, - dynamicfiltertypeNull = 23, - dynamicfiltertypeQ1 = 24, - dynamicfiltertypeQ2 = 25, - dynamicfiltertypeQ3 = 26, - dynamicfiltertypeQ4 = 27, - dynamicfiltertypeThisMonth = 28, - dynamicfiltertypeThisQuarter = 29, - dynamicfiltertypeThisWeek = 30, - dynamicfiltertypeThisYear = 31, - dynamicfiltertypeToday = 32, - dynamicfiltertypeTomorrow = 33, - dynamicfiltertypeYearToDate = 34, - dynamicfiltertypeYesterday = 35 - }; - template - class CDynamicFilterType : public CSimpleType - { - public: - CDynamicFilterType() {} - CDynamicFilterType(const EDynamicFilterType & val) { this->m_eValue = val; } - - virtual EDynamicFilterType FromString(std::wstring &sValue) - { - if(L"aboveAverage" == sValue) - this->m_eValue = dynamicfiltertypeAboveAverage; - else if(L"belowAverage" == sValue) - this->m_eValue = dynamicfiltertypeBelowAverage; - else if(L"lastMonth" == sValue) - this->m_eValue = dynamicfiltertypeLastMonth; - else if(L"lastQuarter" == sValue) - this->m_eValue = dynamicfiltertypeLastQuarter; - else if(L"lastWeek" == sValue) - this->m_eValue = dynamicfiltertypeLastWeek; - else if(L"lastYear" == sValue) - this->m_eValue = dynamicfiltertypeLastYear; - else if(L"M1" == sValue) - this->m_eValue = dynamicfiltertypeM1; - else if(L"M10" == sValue) - this->m_eValue = dynamicfiltertypeM10; - else if(L"M11" == sValue) - this->m_eValue = dynamicfiltertypeM11; - else if(L"M12" == sValue) - this->m_eValue = dynamicfiltertypeM12; - else if(L"M2" == sValue) - this->m_eValue = dynamicfiltertypeM2; - else if(L"M3" == sValue) - this->m_eValue = dynamicfiltertypeM3; - else if(L"M4" == sValue) - this->m_eValue = dynamicfiltertypeM4; - else if(L"M5" == sValue) - this->m_eValue = dynamicfiltertypeM5; - else if(L"M6" == sValue) - this->m_eValue = dynamicfiltertypeM6; - else if(L"M7" == sValue) - this->m_eValue = dynamicfiltertypeM7; - else if(L"M8" == sValue) - this->m_eValue = dynamicfiltertypeM8; - else if(L"M9" == sValue) - this->m_eValue = dynamicfiltertypeM9; - else if(L"nextMonth" == sValue) - this->m_eValue = dynamicfiltertypeNextMonth; - else if(L"nextQuarter" == sValue) - this->m_eValue = dynamicfiltertypeNextQuarter; - else if(L"nextWeek" == sValue) - this->m_eValue = dynamicfiltertypeNextWeek; - else if(L"nextYear" == sValue) - this->m_eValue = dynamicfiltertypeNextYear; - else if(L"null" == sValue) - this->m_eValue = dynamicfiltertypeNull; - else if(L"Q1" == sValue) - this->m_eValue = dynamicfiltertypeQ1; - else if(L"Q2" == sValue) - this->m_eValue = dynamicfiltertypeQ2; - else if(L"Q3" == sValue) - this->m_eValue = dynamicfiltertypeQ3; - else if(L"Q4" == sValue) - this->m_eValue = dynamicfiltertypeQ4; - else if(L"thisMonth" == sValue) - this->m_eValue = dynamicfiltertypeThisMonth; - else if(L"thisQuarter" == sValue) - this->m_eValue = dynamicfiltertypeThisQuarter; - else if(L"thisWeek" == sValue) - this->m_eValue = dynamicfiltertypeThisWeek; - else if(L"thisYear" == sValue) - this->m_eValue = dynamicfiltertypeThisYear; - else if(L"today" == sValue) - this->m_eValue = dynamicfiltertypeToday; - else if(L"tomorrow" == sValue) - this->m_eValue = dynamicfiltertypeTomorrow; - else if(L"yearToDate" == sValue) - this->m_eValue = dynamicfiltertypeYearToDate; - else if(L"yesterday" == sValue) - this->m_eValue = dynamicfiltertypeYesterday; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - std::wstring sResult; - switch(this->m_eValue) - { - case dynamicfiltertypeAboveAverage: sResult = L"aboveAverage";break; - case dynamicfiltertypeBelowAverage: sResult = L"belowAverage";break; - case dynamicfiltertypeLastMonth: sResult = L"lastMonth";break; - case dynamicfiltertypeLastQuarter: sResult = L"lastQuarter";break; - case dynamicfiltertypeLastWeek: sResult = L"lastWeek";break; - case dynamicfiltertypeLastYear: sResult = L"lastYear";break; - case dynamicfiltertypeM1: sResult = L"M1";break; - case dynamicfiltertypeM10: sResult = L"M10";break; - case dynamicfiltertypeM11: sResult = L"M11";break; - case dynamicfiltertypeM12: sResult = L"M12";break; - case dynamicfiltertypeM2: sResult = L"M2";break; - case dynamicfiltertypeM3: sResult = L"M3";break; - case dynamicfiltertypeM4: sResult = L"M4";break; - case dynamicfiltertypeM5: sResult = L"M5";break; - case dynamicfiltertypeM6: sResult = L"M6";break; - case dynamicfiltertypeM7: sResult = L"M7";break; - case dynamicfiltertypeM8: sResult = L"M8";break; - case dynamicfiltertypeM9: sResult = L"M9";break; - case dynamicfiltertypeNextMonth: sResult = L"nextMonth";break; - case dynamicfiltertypeNextQuarter: sResult = L"nextQuarter";break; - case dynamicfiltertypeNextWeek: sResult = L"nextWeek";break; - case dynamicfiltertypeNextYear: sResult = L"nextYear";break; - case dynamicfiltertypeNull: sResult = L"null";break; - case dynamicfiltertypeQ1: sResult = L"Q1";break; - case dynamicfiltertypeQ2: sResult = L"Q2";break; - case dynamicfiltertypeQ3: sResult = L"Q3";break; - case dynamicfiltertypeQ4: sResult = L"Q4";break; - case dynamicfiltertypeThisMonth: sResult = L"thisMonth";break; - case dynamicfiltertypeThisQuarter: sResult = L"thisQuarter";break; - case dynamicfiltertypeThisWeek: sResult = L"thisWeek";break; - case dynamicfiltertypeThisYear: sResult = L"thisYear";break; - case dynamicfiltertypeToday: sResult = L"today";break; - case dynamicfiltertypeTomorrow: sResult = L"tomorrow";break; - case dynamicfiltertypeYearToDate: sResult = L"yearToDate";break; - case dynamicfiltertypeYesterday: sResult = L"yesterday";break; - } - return sResult; - } - - SimpleType_FromString (EDynamicFilterType) - SimpleType_Operator_Equal (CDynamicFilterType) - }; - //-------------------------------------------------------- - // ST_IconSetType (18.18.42) - //-------------------------------------------------------- - enum EIconSetType - { - Arrows3 = 0, - Arrows3Gray = 1, - Flags3 = 2, - Signs3 = 3, - Symbols3 = 4, - Symbols3_2 = 5, - Traffic3Lights1 = 6, - Traffic3Lights2 = 7, - Arrows4 = 8, - Arrows4Gray = 9, - Rating4 = 10, - RedToBlack4 = 11, - Traffic4Lights = 12, - Arrows5 = 13, - Arrows5Gray = 14, - Quarters5 = 15, - Rating5 = 16, - Triangles3 = 17, - Stars3 = 18, - Boxes5 = 19, - NoIcons = 20 - - - }; - template - class ST_IconSetType : public CSimpleType - { - public: - ST_IconSetType() {} - ST_IconSetType(const EIconSetType & val) { this->m_eValue = val; } - - virtual EIconSetType FromString(std::wstring &sValue) - { - if(L"3Arrows" == sValue) this->m_eValue = Arrows3; - else if(L"3ArrowsGray" == sValue) this->m_eValue = Arrows3Gray; - else if(L"3Flags" == sValue) this->m_eValue = Flags3; - else if(L"3Signs" == sValue) this->m_eValue = Signs3; - else if(L"3Symbols" == sValue) this->m_eValue = Symbols3; - else if(L"3Symbols2" == sValue) this->m_eValue = Symbols3_2; - else if(L"3TrafficLights1" == sValue) this->m_eValue = Traffic3Lights1; - else if(L"3TrafficLights2" == sValue) this->m_eValue = Traffic3Lights2; - else if(L"4Arrows" == sValue) this->m_eValue = Arrows4; - else if(L"4ArrowsGray" == sValue) this->m_eValue = Arrows4Gray; - else if(L"4Rating" == sValue) this->m_eValue = Rating4; - else if(L"4RedToBlack" == sValue) this->m_eValue = RedToBlack4; - else if(L"4TrafficLights" == sValue) this->m_eValue = Traffic4Lights; - else if(L"5Arrows" == sValue) this->m_eValue = Arrows5; - else if(L"5ArrowsGray" == sValue) this->m_eValue = Arrows5Gray; - else if(L"5Quarters" == sValue) this->m_eValue = Quarters5; - //..ext.... - else if(L"5Rating" == sValue) this->m_eValue = Rating5; - else if(L"3Triangles" == sValue) this->m_eValue = Triangles3; - else if(L"3Stars" == sValue) this->m_eValue = Stars3; - else if(L"5Boxes" == sValue) this->m_eValue = Boxes5; - else if(L"NoIcons" == sValue) this->m_eValue = NoIcons; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case Arrows3 : return L"3Arrows"; break; - case Arrows3Gray : return L"3ArrowsGray"; break; - case Flags3 : return L"3Flags"; break; - case Signs3 : return L"3Signs"; break; - case Symbols3 : return L"3Symbols"; break; - case Symbols3_2 : return L"3Symbols2"; break; - case Traffic3Lights1: return L"3TrafficLights1"; break; - case Traffic3Lights2: return L"3TrafficLights2"; break; - case Arrows4 : return L"4Arrows"; break; - case Arrows4Gray : return L"4ArrowsGray"; break; - case Rating4 : return L"4Rating"; break; - case RedToBlack4 : return L"4RedToBlack"; break; - case Traffic4Lights : return L"4TrafficLights"; break; - case Arrows5 : return L"5Arrows"; break; - case Arrows5Gray : return L"5ArrowsGray"; break; - case Quarters5 : return L"5Quarters"; break; - case Rating5 : return L"5Rating"; break; - case Triangles3 : return L"3Triangles"; break; - case Stars3 : return L"3Stars"; break; - case Boxes5 : return L"5Boxes"; break; - case NoIcons : return L"NoIcons"; break; - default : return L"3Arrows"; - } - } - - SimpleType_FromString (EIconSetType) - SimpleType_Operator_Equal (ST_IconSetType) - }; - - //-------------------------------------------------------- - // ST_DataBarAxisPosition - //-------------------------------------------------------- - enum EDataBarAxisPosition - { - automatic_pos = 0, - middle_pos = 1, - none_pos = 2 - }; - template - class ST_DataBarAxisPosition : public CSimpleType - { - public: - ST_DataBarAxisPosition() {} - ST_DataBarAxisPosition(const EDataBarAxisPosition & val) { this->m_eValue = val; } - - virtual EDataBarAxisPosition FromString(std::wstring &sValue) - { - if(L"automatic" == sValue) this->m_eValue = automatic_pos; - else if(L"middle" == sValue) this->m_eValue = middle_pos; - else if(L"none" == sValue) this->m_eValue = none_pos; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case automatic_pos : return L"automatic";break; - case middle_pos : return L"middle"; break; - case none_pos : return L"none"; break; - default : return L"automatic"; - } - } - - SimpleType_FromString (EDataBarAxisPosition) - SimpleType_Operator_Equal (ST_DataBarAxisPosition) - }; - - //-------------------------------------------------------- - // ST_DataBarDirection - //-------------------------------------------------------- - enum EDataBarDirection - { - context_direction = 0, - leftToRight = 1, - rightToLeft = 2 - }; - template - class ST_DataBarDirection : public CSimpleType - { - public: - ST_DataBarDirection() {} - ST_DataBarDirection(const EDataBarDirection & val) { this->m_eValue = val; } - - virtual EDataBarDirection FromString(std::wstring &sValue) - { - if(L"context" == sValue) this->m_eValue = context_direction; - else if(L"leftToRight" == sValue) this->m_eValue = leftToRight; - else if(L"rightToLeft" == sValue) this->m_eValue = rightToLeft; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case context_direction : return L"context"; - case leftToRight : return L"leftToRight"; - case rightToLeft : return L"rightToLeft"; - default : return L"automatic"; - } - } - - SimpleType_FromString (EDataBarDirection) - SimpleType_Operator_Equal (ST_DataBarDirection) - }; - //---------------------------------------------------- - // 18.18.15 ST_CfOperator (Conditional Format Operators) - //---------------------------------------------------- - enum ECfOperator - { - Operator_beginsWith = 0, - Operator_between = 1, - Operator_containsText = 2, - Operator_endsWith = 3, - Operator_equal = 4, - Operator_greaterThan = 5, - Operator_greaterThanOrEqual = 6, - Operator_lessThan = 7, - Operator_lessThanOrEqual = 8, - Operator_notBetween = 9, - Operator_notContains = 10, - Operator_notEqual = 11 - }; - template - class ST_CfOperator : public CSimpleType - { - public: - ST_CfOperator() {} - ST_CfOperator(const ECfOperator & val) { this->m_eValue = val; } - - virtual ECfOperator FromString(std::wstring &sValue) - { - if(L"beginsWith" == sValue) this->m_eValue = Operator_beginsWith; - else if(L"between" == sValue) this->m_eValue = Operator_between; - else if(L"containsText" == sValue) this->m_eValue = Operator_containsText; - else if(L"endsWith" == sValue) this->m_eValue = Operator_endsWith; - else if(L"equal" == sValue) this->m_eValue = Operator_equal; - else if(L"greaterThan" == sValue) this->m_eValue = Operator_greaterThan; - else if(L"greaterThanOrEqual" == sValue) this->m_eValue = Operator_greaterThanOrEqual; - else if(L"lessThan" == sValue) this->m_eValue = Operator_lessThan; - else if(L"lessThanOrEqual" == sValue) this->m_eValue = Operator_lessThanOrEqual; - else if(L"notBetween" == sValue) this->m_eValue = Operator_notBetween; - else if(L"notContains" == sValue) this->m_eValue = Operator_notContains; - else if(L"notEqual" == sValue) this->m_eValue = Operator_notEqual; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case Operator_beginsWith : return L"beginsWith"; break; - case Operator_between : return L"between"; break; - case Operator_containsText : return L"containsText"; break; - case Operator_endsWith : return L"endsWith"; break; - case Operator_equal : return L"equal"; break; - case Operator_greaterThan : return L"greaterThan"; break; - case Operator_greaterThanOrEqual: return L"greaterThanOrEqual";break; - case Operator_lessThan : return L"lessThan"; break; - case Operator_lessThanOrEqual : return L"lessThanOrEqual"; break; - case Operator_notBetween : return L"notBetween"; break; - case Operator_notContains : return L"notContains"; break; - case Operator_notEqual : return L"notEqual"; break; - default : return L"equal"; - } - } - - SimpleType_FromString (ECfOperator) - SimpleType_Operator_Equal (ST_CfOperator) - }; - - //---------------------------------------------------- - // 18.18.82 ST_TimePeriod (Conditional Format Value Object Type) - //---------------------------------------------------- - enum ETimePeriod - { - last7Days = 0, - lastMonth = 1, - lastWeek = 2, - nextMonth = 3, - nextWeek = 4, - thisMonth = 5, - thisWeek = 6, - today = 7, - tomorrow = 8, - yesterday = 9 - }; - template - class ST_TimePeriod : public CSimpleType - { - public: - ST_TimePeriod() {} - ST_TimePeriod(const ETimePeriod & val) { this->m_eValue = val; } - - virtual ETimePeriod FromString(std::wstring &sValue) - { - if(_T("last7Days") == sValue) this->m_eValue = last7Days; - else if(_T("lastMonth") == sValue) this->m_eValue = lastMonth; - else if(_T("lastWeek") == sValue) this->m_eValue = lastWeek; - else if(_T("nextMonth") == sValue) this->m_eValue = nextMonth; - else if(_T("nextWeek") == sValue) this->m_eValue = nextWeek; - else if(_T("thisMonth") == sValue) this->m_eValue = thisMonth; - else if(_T("thisWeek") == sValue) this->m_eValue = thisWeek; - else if(_T("today") == sValue) this->m_eValue = today; - else if(_T("tomorrow") == sValue) this->m_eValue = tomorrow; - else if(_T("yesterday") == sValue) this->m_eValue = yesterday; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case last7Days: return _T("last7Days"); - case lastMonth: return _T("lastMonth"); - case lastWeek: return _T("lastWeek"); - case nextMonth: return _T("nextMonth"); - case nextWeek: return _T("nextWeek"); - case thisMonth: return _T("thisMonth"); - case thisWeek: return _T("thisWeek"); - case today: return _T("today"); - case tomorrow: return _T("tomorrow"); - case yesterday: return _T("yesterday"); - default : return _T("num"); - } - } - - SimpleType_FromString (ETimePeriod) - SimpleType_Operator_Equal (ST_TimePeriod) - }; - - //---------------------------------------------------- - // 18.18.12 ST_CfType (Conditional Format Type) - //---------------------------------------------------- - enum ECfType - { - aboveAverage = 0, - beginsWith = 1, - cellIs = 2, - colorScale = 3, - containsBlanks = 4, - containsErrors = 5, - containsText = 6, - dataBar = 7, - duplicateValues = 8, - expression = 9, - iconSet = 10, - notContainsBlanks = 11, - notContainsErrors = 12, - notContainsText = 13, - timePeriod = 14, - top10 = 15, - uniqueValues = 16, - endsWith = 17 - }; - template - class ST_CfType : public CSimpleType - { - public: - ST_CfType() {} - ST_CfType(const ECfType & val) { this->m_eValue = val; } - - virtual ECfType FromString(std::wstring &sValue) - { - if(L"aboveAverage" == sValue) this->m_eValue = aboveAverage; - else if(L"beginsWith" == sValue) this->m_eValue = beginsWith; - else if(L"cellIs" == sValue) this->m_eValue = cellIs; - else if(L"colorScale" == sValue) this->m_eValue = colorScale; - else if(L"containsBlanks" == sValue) this->m_eValue = containsBlanks; - else if(L"containsText" == sValue) this->m_eValue = containsText; - else if(L"containsErrors" == sValue) this->m_eValue = containsErrors; - else if(L"dataBar" == sValue) this->m_eValue = dataBar; - else if(L"duplicateValues" == sValue) this->m_eValue = duplicateValues; - else if(L"expression" == sValue) this->m_eValue = expression; - else if(L"iconSet" == sValue) this->m_eValue = iconSet; - else if(L"notContainsBlanks" == sValue) this->m_eValue = notContainsBlanks; - else if(L"notContainsErrors" == sValue) this->m_eValue = notContainsErrors; - else if(L"notContainsText" == sValue) this->m_eValue = notContainsText; - else if(L"timePeriod" == sValue) this->m_eValue = timePeriod; - else if(L"top10" == sValue) this->m_eValue = top10; - else if(L"uniqueValues" == sValue) this->m_eValue = uniqueValues; - else if(L"endsWith" == sValue) this->m_eValue = endsWith; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case aboveAverage : return L"aboveAverage"; break; - case beginsWith : return L"beginsWith"; break; - case cellIs : return L"cellIs"; break; - case colorScale : return L"colorScale"; break; - case containsBlanks : return L"containsBlanks"; break; - case containsErrors : return L"containsErrors"; break; - case containsText : return L"containsText"; break; - case dataBar : return L"dataBar"; break; - case duplicateValues : return L"duplicateValues"; break; - case expression : return L"expression"; break; - case iconSet : return L"iconSet"; break; - case notContainsBlanks : return L"notContainsBlanks";break; - case notContainsErrors : return L"notContainsErrors";break; - case notContainsText : return L"notContainsText"; break; - case timePeriod : return L"timePeriod"; break; - case top10 : return L"top10"; break; - case uniqueValues : return L"uniqueValues"; break; - case endsWith : return L"endsWith"; break; - default : return L"dataBar"; - } - } - - SimpleType_FromString (ECfType) - SimpleType_Operator_Equal (ST_CfType) - }; - - //---------------------------------------------------- - // 18.18.13 ST_CfvoType (Conditional Format Value Object Type) - //---------------------------------------------------- - enum ECfvoType - { - Formula = 0, - Maximum = 1, - Minimum = 2, - Number = 3, - Percent = 4, - Percentile = 5, - autoMin = 6, - autoMax = 7 - }; - template - class ST_CfvoType : public CSimpleType - { - public: - ST_CfvoType() {} - ST_CfvoType(const ECfvoType & val) { this->m_eValue = val; } - - virtual ECfvoType FromString(std::wstring &sValue) - { - if(L"formula" == sValue) this->m_eValue = Formula; - else if(L"max" == sValue) this->m_eValue = Maximum; - else if(L"min" == sValue) this->m_eValue = Minimum; - else if(L"num" == sValue) this->m_eValue = Number; - else if(L"percent" == sValue) this->m_eValue = Percent; - else if(L"percentile" == sValue)this->m_eValue = Percentile; - else if(L"autoMin" == sValue) this->m_eValue = autoMin; - else if(L"autoMax" == sValue) this->m_eValue = autoMax; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case Formula: return L"formula"; - case Maximum: return L"max"; - case Minimum: return L"min"; - case Number: return L"num"; - case Percent: return L"percent"; - case Percentile:return L"percentile"; - case autoMin: return L"autoMin"; - case autoMax: return L"autoMax"; - default : return L"num"; - } - } - - SimpleType_FromString (ECfvoType) - SimpleType_Operator_Equal (ST_CfvoType) - }; - - enum ESparklineType - { - Line = 0, - Column = 1, - Stacked = 2 - }; - template - class ST_SparklineType : public CSimpleType - { - public: - ST_SparklineType() {} - ST_SparklineType(const ESparklineType & val) { this->m_eValue = val; } - - virtual ESparklineType FromString(std::wstring &sValue) - { - if(L"line" == sValue) this->m_eValue = Line; - else if(L"column" == sValue) this->m_eValue = Column; - else if(L"stacked" == sValue) this->m_eValue = Stacked; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case Line: return L"line"; break; - case Column: return L"column"; break; - case Stacked: return L"stacked"; break; - default : return L"line"; - } - } - - SimpleType_FromString (ESparklineType) - SimpleType_Operator_Equal (ST_SparklineType) - }; - - enum ESparklineAxisMinMax - { - Individual = 0, - Group = 1, - Custom = 2 - }; - template - class ST_SparklineAxisMinMax : public CSimpleType - { - public: - ST_SparklineAxisMinMax() {} - ST_SparklineAxisMinMax(const ESparklineAxisMinMax & val) { this->m_eValue = val; } - - virtual ESparklineAxisMinMax FromString(std::wstring &sValue) - { - if(L"individual" == sValue) this->m_eValue = Individual; - else if(L"group" == sValue) this->m_eValue = Group; - else if(L"custom" == sValue) this->m_eValue = Custom; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case Individual: return L"individual"; break; - case Group: return L"group"; break; - case Custom: return L"custom"; break; - default: return L"individual"; - } - } - - SimpleType_FromString (ESparklineAxisMinMax) - SimpleType_Operator_Equal (ST_SparklineAxisMinMax) - }; - enum EDvAspect - { - Content = 0, - Icon = 1 - }; - template - class ST_DvAspect : public CSimpleType - { - public: - ST_DvAspect() {} - ST_DvAspect(const EDvAspect & val) { this->m_eValue = val; } - - virtual EDvAspect FromString(std::wstring &sValue) - { - if(L"DVASPECT_CONTENT" == sValue) this->m_eValue = Content; - else if(L"DVASPECT_ICON" == sValue) this->m_eValue = Icon; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case Content: return L"DVASPECT_CONTENT"; break; - case Icon: return L"DVASPECT_ICON"; break; - default: return L"DVASPECT_CONTENT"; - } - } - - SimpleType_FromString (EDvAspect) - SimpleType_Operator_Equal (ST_DvAspect) - }; - enum EOleUpdate - { - Always = 0, - OnCall = 1 - }; - template - class ST_OleUpdate : public CSimpleType - { - public: - ST_OleUpdate() {} - ST_OleUpdate(const EOleUpdate & val) { this->m_eValue = val; } - - virtual EOleUpdate FromString(std::wstring &sValue) - { - if(L"OLEUPDATE_ALWAYS" == sValue) this->m_eValue = Always; - else if(L"OLEUPDATE_ONCALL" == sValue) this->m_eValue = OnCall; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case Always: return L"OLEUPDATE_ALWAYS"; break; - case OnCall: return L"OLEUPDATE_ONCALL"; break; - default: return L"OLEUPDATE_ALWAYS"; - } - } - - SimpleType_FromString (EOleUpdate) - SimpleType_Operator_Equal (ST_OleUpdate) - }; - - enum EActivePane - { - activepaneBottomLeft = 0, - activepaneBottomRight = 1, - activepaneTopLeft = 2, - activepaneTopRight = 3 - }; - - template - class CActivePane : public CSimpleType - { - public: - CActivePane() {} - CActivePane(const EActivePane & val) { this->m_eValue = val; } - - virtual EActivePane FromString(std::wstring &sValue) - { - if ( L"bottomLeft" == sValue ) this->m_eValue = activepaneBottomLeft; - else if ( L"bottomRight" == sValue ) this->m_eValue = activepaneBottomRight; - else if ( L"topLeft" == sValue ) this->m_eValue = activepaneTopLeft; - else if ( L"topRight" == sValue ) this->m_eValue = activepaneTopRight; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case activepaneBottomLeft : return L"bottomLeft"; - case activepaneBottomRight : return L"bottomRight"; - case activepaneTopLeft : return L"topLeft"; - case activepaneTopRight : return L"topRight"; - default : return L"topLeft"; - } - } - - SimpleType_FromString (EActivePane) - SimpleType_Operator_Equal (CActivePane) - }; - - enum EPaneState - { - panestateFrozen = 0, - panestateFrozenSplit = 1, - panestateSplit = 2 - }; - - template - class CPaneState : public CSimpleType - { - public: - CPaneState() {} - CPaneState(const EPaneState & val) { this->m_eValue = val; } - - virtual EPaneState FromString(std::wstring &sValue) - { - if ( L"frozen" == sValue ) this->m_eValue = panestateFrozen; - else if ( L"frozenSplit" == sValue ) this->m_eValue = panestateFrozenSplit; - else if ( L"split" == sValue ) this->m_eValue = panestateSplit; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case panestateFrozen : return L"frozen"; - case panestateFrozenSplit : return L"frozenSplit"; - case panestateSplit : return L"split"; - default : return L"frozen"; - } - } - - SimpleType_FromString (EPaneState) - SimpleType_Operator_Equal (CPaneState) - }; - - enum EDdeValueType - { - ddevaluetypeNil = 0, - ddevaluetypeB = 1, - ddevaluetypeN = 2, - ddevaluetypeE = 3, - ddevaluetypeStr = 4 - }; - - template - class CDdeValueType : public CSimpleType - { - public: - CDdeValueType() {} - CDdeValueType(const EDdeValueType & val) { this->m_eValue = val; } - - virtual EDdeValueType FromString(std::wstring &sValue) - { - if ( L"nil" == sValue ) this->m_eValue = ddevaluetypeNil; - else if ( L"b" == sValue ) this->m_eValue = ddevaluetypeB; - else if ( L"n" == sValue ) this->m_eValue = ddevaluetypeN; - else if ( L"e" == sValue ) this->m_eValue = ddevaluetypeE; - else if ( L"str" == sValue ) this->m_eValue = ddevaluetypeStr; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case ddevaluetypeNil : return L"nil"; - case ddevaluetypeB : return L"b"; - case ddevaluetypeN : return L"n"; - case ddevaluetypeE : return L"e"; - case ddevaluetypeStr : return L"str"; - default : return L"nil"; - } - } - - SimpleType_FromString (EDdeValueType) - SimpleType_Operator_Equal (CDdeValueType) - }; - - enum ECalcMode - { - calcmodeAuto = 0, - calcmodeAutoNoTable = 1, - calcmodeManual = 2, - }; - - template - class CCalcMode : public CSimpleType - { - public: - CCalcMode() {} - CCalcMode(const ECalcMode & val) { this->m_eValue = val; } - - virtual ECalcMode FromString(std::wstring &sValue) - { - if ( L"auto" == sValue ) this->m_eValue = calcmodeAuto; - else if ( L"autoNoTable" == sValue ) this->m_eValue = calcmodeAutoNoTable; - else if ( L"manual" == sValue ) this->m_eValue = calcmodeManual; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case calcmodeAuto : return L"auto";break; - case calcmodeAutoNoTable : return L"autoNoTable";break; - case calcmodeManual : return L"manual";break; - default : return L"auto"; - - } - } - - SimpleType_FromString (ECalcMode) - SimpleType_Operator_Equal (CCalcMode) - }; - - enum ERefMode - { - refmodeA1 = 0, - refmodeR1C1 = 1 - }; - - template - class CRefMode : public CSimpleType - { - public: - CRefMode() {} - CRefMode(const ERefMode & val) { this->m_eValue = val; } - - virtual ERefMode FromString(std::wstring &sValue) - { - if ( L"A1" == sValue ) this->m_eValue = refmodeA1; - else if ( L"R1C1" == sValue ) this->m_eValue = refmodeR1C1; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case refmodeA1 : return L"A1";break; - case refmodeR1C1 : return L"R1C1";break; - default : return L"A1"; - - } - } - - SimpleType_FromString (ERefMode) - SimpleType_Operator_Equal (CRefMode) - }; - - enum EDoubleOrAutomatic - { - typeAuto = 0, - typeDouble = 1 - }; - template - class CDoubleOrAutomatic : public CSimpleType - { - public: - double m_dValue; - CDoubleOrAutomatic() : m_dValue(0){} - - CDoubleOrAutomatic(const double & val) { m_dValue = val; this->m_eValue = typeDouble; } - CDoubleOrAutomatic(const EDoubleOrAutomatic & val) { this->m_eValue = val; m_dValue = 0; } - - virtual EDoubleOrAutomatic FromString(std::wstring &sValue) - { - if(L"auto" == sValue) - { - this->m_eValue = typeAuto; - m_dValue = 0; - } - else - { - this->m_eValue = typeDouble; - m_dValue = XmlUtils::GetDouble(sValue); - } - return this->m_eValue; - } - double GetDoubleValue() const - { - return m_dValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case typeAuto : return L"auto";break; - case typeDouble : - default: - { - return XmlUtils::DoubleToString(m_dValue); - }break; - } - } - - SimpleType_FromString (EDoubleOrAutomatic) - SimpleType_Operator_Equal (CDoubleOrAutomatic) - }; - - enum ESeriesLayout - { - typeSeriesLayoutBoxWhisker = 0, - typeSeriesLayoutClusteredColumn = 1, - typeSeriesLayoutFunnel = 2, - typeSeriesLayoutParetoLine = 3, - typeSeriesLayoutRegionMap = 4, - typeSeriesLayoutSunburst = 5, - typeSeriesLayoutTreemap = 6, - typeSeriesLayoutWaterfall = 7, - }; - template - class CSeriesLayout : public CSimpleType - { - public: - CSeriesLayout() {} - CSeriesLayout(const ESeriesLayout & val) { this->m_eValue = val; } - - virtual ESeriesLayout FromString(std::wstring &sValue) - { - if ( L"boxWhisker" == sValue ) this->m_eValue = typeSeriesLayoutBoxWhisker; - else if ( L"clusteredColumn" == sValue ) this->m_eValue = typeSeriesLayoutClusteredColumn; - else if ( L"funnel" == sValue ) this->m_eValue = typeSeriesLayoutFunnel; - else if ( L"paretoLine" == sValue ) this->m_eValue = typeSeriesLayoutParetoLine; - else if ( L"regionMap" == sValue ) this->m_eValue = typeSeriesLayoutRegionMap; - else if ( L"sunburst" == sValue ) this->m_eValue = typeSeriesLayoutSunburst; - else if ( L"treemap" == sValue ) this->m_eValue = typeSeriesLayoutTreemap; - else if ( L"waterfall" == sValue ) this->m_eValue = typeSeriesLayoutWaterfall; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case typeSeriesLayoutBoxWhisker : return L"boxWhisker";break; - case typeSeriesLayoutClusteredColumn : return L"clusteredColumn";break; - case typeSeriesLayoutFunnel: return L"funnel"; break; - case typeSeriesLayoutParetoLine : return L"paretoLine";break; - case typeSeriesLayoutRegionMap : return L"regionMap"; break; - case typeSeriesLayoutSunburst : return L"sunburst"; break; - case typeSeriesLayoutTreemap : return L"treemap"; break; - case typeSeriesLayoutWaterfall : return L"waterfall"; break; - default : return L"auto"; - } - } - - SimpleType_FromString (ESeriesLayout) - SimpleType_Operator_Equal (CSeriesLayout) - }; - - enum EAxisUnit - { - unitHundreds = 0, - unitThousands = 1, - unitTenThousands = 2, - unitHundredThousands = 3, - unitMillions = 4, - unitTenMillions = 5, - unitHundredMillions = 6, - unitBillions = 7, - unitTrillions = 8, - unitPercentage = 9 - - }; - template - class CAxisUnit : public CSimpleType - { - public: - CAxisUnit() {} - CAxisUnit(const EAxisUnit & val) { this->m_eValue = val; } - - virtual EAxisUnit FromString(std::wstring &sValue) - { - if ( L"hundreds" == sValue ) this->m_eValue = unitHundreds; - else if ( L"thousands" == sValue ) this->m_eValue = unitThousands; - else if ( L"tenThousands" == sValue ) this->m_eValue = unitTenThousands; - else if ( L"hundredThousands" == sValue ) this->m_eValue = unitHundredThousands; - else if ( L"millions" == sValue ) this->m_eValue = unitMillions; - else if ( L"tenMillions" == sValue ) this->m_eValue = unitTenMillions; - else if ( L"hundredMillions" == sValue ) this->m_eValue = unitHundredMillions; - else if ( L"billions" == sValue ) this->m_eValue = unitBillions; - else if ( L"trillions" == sValue ) this->m_eValue = unitTrillions; - else if ( L"percentage" == sValue ) this->m_eValue = unitPercentage; - else this->m_eValue = eDefValue; - - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case unitHundreds : return L"hundreds"; break; - case unitThousands : return L"thousands"; break; - case unitTenThousands: return L"tenThousands"; break; - case unitHundredThousands : return L"hundredThousands";break; - case unitMillions : return L"millions"; break; - case unitTenMillions : return L"tenMillions"; break; - case unitHundredMillions : return L"hundredMillions";break; - case unitBillions : return L"billions"; break; - case unitTrillions : return L"trillions"; break; - case unitPercentage : return L"percentage"; break; - default : return L""; - } - } - - SimpleType_FromString (EAxisUnit) - SimpleType_Operator_Equal (CAxisUnit) - }; - enum EDimensionType - { - typeDimensionVal = 0, - typeDimensionX = 1, - typeDimensionY = 2, - typeDimensionSize = 3, - typeDimensionColorVal = 4, - typeDimensionCat = 10, - typeDimensionColorStr = 11 - }; - template - class CDimensionType : public CSimpleType - { - public: - CDimensionType() {} - CDimensionType(const EDimensionType & val) { this->m_eValue = val; } - - virtual EDimensionType FromString(std::wstring &sValue) - { - if ( L"val" == sValue ) this->m_eValue = typeDimensionVal; - else if ( L"x" == sValue ) this->m_eValue = typeDimensionX; - else if ( L"y" == sValue ) this->m_eValue = typeDimensionY; - else if ( L"size" == sValue ) this->m_eValue = typeDimensionSize; - else if ( L"colorVal" == sValue ) this->m_eValue = typeDimensionColorVal; - else if ( L"cat" == sValue ) this->m_eValue = typeDimensionCat; - else if ( L"colorStr" == sValue ) this->m_eValue = typeDimensionColorStr; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case typeDimensionVal : return L"val"; - case typeDimensionX : return L"x"; - case typeDimensionY: return L"y"; - case typeDimensionSize : return L"size"; - case typeDimensionColorVal :return L"colorVal"; - case typeDimensionCat : return L"cat"; - case typeDimensionColorStr :return L"colorStr"; - default : return L""; - } - } - - SimpleType_FromString (EDimensionType) - SimpleType_Operator_Equal (CDimensionType) - }; - enum EFormulaDirection - { - directionCol = 0, - directionRow = 1 - }; - template - class CFormulaDirection : public CSimpleType - { - public: - CFormulaDirection() {} - CFormulaDirection(const EFormulaDirection & val) { this->m_eValue = val; } - - virtual EFormulaDirection FromString(std::wstring &sValue) - { - if(L"row" == sValue) this->m_eValue = directionRow; - else this->m_eValue = directionCol; - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case directionRow : return L"row"; - case directionCol : - default: - { - return L"col"; - }break; - } - } - - SimpleType_FromString (EFormulaDirection) - SimpleType_Operator_Equal (CFormulaDirection) - }; - enum ESidePos - { - sideLeft = 0, - sideRight = 1, - sideTop = 2, - sideBottom = 3 - }; - template - class CSidePos : public CSimpleType - { - public: - CSidePos() {} - CSidePos(const ESidePos & val) { this->m_eValue = val; } - - virtual ESidePos FromString(std::wstring &sValue) - { - if ( L"t" == sValue ) this->m_eValue = sideTop; - else if ( L"l" == sValue ) this->m_eValue = sideLeft; - else if ( L"r" == sValue ) this->m_eValue = sideRight; - else if ( L"b" == sValue ) this->m_eValue = sideBottom; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case sideLeft : return L"l"; - case sideRight: return L"r"; - case sideBottom : return L"b"; - case sideTop : - default : return L"t"; - } - } - - SimpleType_FromString (ESidePos) - SimpleType_Operator_Equal (CSidePos) - }; - enum EPosAlign - { - posAlignMin = 0, - posAlignCtr = 1, - posAlignMax = 2 - }; - template - class CPosAlign : public CSimpleType - { - public: - CPosAlign() {} - CPosAlign(const EPosAlign & val) { this->m_eValue = val; } - - virtual EPosAlign FromString(std::wstring &sValue) - { - if ( L"min" == sValue ) this->m_eValue = posAlignMin; - else if ( L"max" == sValue ) this->m_eValue = posAlignMax; - else if ( L"ctr" == sValue ) this->m_eValue = posAlignCtr; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case posAlignMax : return L"max"; - case posAlignMin: return L"min"; - case posAlignCtr : - default : return L"ctr"; - } - } - - SimpleType_FromString (EPosAlign) - SimpleType_Operator_Equal (CPosAlign) - }; - enum ERegionLabelLayout - { - layoutNone = 0, - layoutBestFitOnly = 1, - layoutShowAll = 2 - }; - template - class CRegionLabelLayout : public CSimpleType - { - public: - CRegionLabelLayout() {} - CRegionLabelLayout(const ERegionLabelLayout & val) { this->m_eValue = val; } - - virtual ERegionLabelLayout FromString(std::wstring &sValue) - { - if ( L"none" == sValue ) this->m_eValue = layoutNone; - else if ( L"bestFitOnly" == sValue ) this->m_eValue = layoutBestFitOnly; - else if ( L"showAll" == sValue ) this->m_eValue = layoutShowAll; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case layoutNone : return L"none"; - case layoutBestFitOnly: return L"bestFitOnly"; - case layoutShowAll : - default : return L"showAll"; - } - } - - SimpleType_FromString (ERegionLabelLayout) - SimpleType_Operator_Equal (CRegionLabelLayout) - }; - enum EParentLabelLayout - { - layoutNone_ = 0, - layoutBanner = 1, - layoutOverlapping = 2 - }; - template - class CParentLabelLayout : public CSimpleType - { - public: - CParentLabelLayout() {} - CParentLabelLayout(const EParentLabelLayout & val) { this->m_eValue = val; } - - virtual EParentLabelLayout FromString(std::wstring &sValue) - { - if ( L"none" == sValue ) this->m_eValue = layoutNone_; - else if ( L"banner" == sValue ) this->m_eValue = layoutBanner; - else if ( L"overlapping" == sValue ) this->m_eValue = layoutOverlapping; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case layoutNone_ : return L"none"; - case layoutOverlapping: return L"banner"; - case layoutBanner : - default : return L"overlapping"; - } - } - - SimpleType_FromString (EParentLabelLayout) - SimpleType_Operator_Equal (CParentLabelLayout) - }; - - enum EQuartileMethod - { - methodInclusive = 0, - methodExclusive = 1, - }; - template - class CQuartileMethod : public CSimpleType - { - public: - CQuartileMethod() {} - CQuartileMethod(const EQuartileMethod & val) { this->m_eValue = val; } - - virtual EQuartileMethod FromString(std::wstring &sValue) - { - if ( L"inclusive" == sValue ) this->m_eValue = methodInclusive; - else if ( L"exclusive" == sValue ) this->m_eValue = methodExclusive; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case methodInclusive : return L"inclusive"; - case methodExclusive: - default : return L"exclusive"; - } - } - - SimpleType_FromString (EQuartileMethod) - SimpleType_Operator_Equal (CQuartileMethod) - }; - - enum EDataLabelPos - { - posBestFit = 0, - posBottom = 1, - posCtr = 2, - posInBase = 3, - posInEnd = 4, - posLeft = 5, - posOutEnd = 6, - posRight = 7, - posTop = 8 - - }; - template - class CDataLabelPos : public CSimpleType - { - public: - CDataLabelPos() {} - CDataLabelPos(const EDataLabelPos & val) { this->m_eValue = val; } - - virtual EDataLabelPos FromString(std::wstring &sValue) - { - if ( L"bestFit" == sValue ) this->m_eValue = posBestFit; - else if ( L"b" == sValue ) this->m_eValue = posBottom; - else if ( L"ctr" == sValue ) this->m_eValue = posCtr; - else if ( L"inBase" == sValue ) this->m_eValue = posInBase; - else if ( L"inEnd" == sValue ) this->m_eValue = posInEnd; - else if ( L"l" == sValue ) this->m_eValue = posLeft; - else if ( L"outEnd" == sValue ) this->m_eValue = posOutEnd; - else if ( L"r" == sValue ) this->m_eValue = posRight; - else if ( L"t" == sValue ) this->m_eValue = posTop; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case posBottom : return L"b"; - case posCtr : return L"ctr"; - case posInBase : return L"inBase"; - case posInEnd : return L"inEnd"; - case posLeft : return L"l"; - case posOutEnd : return L"outEnd"; - case posRight : return L"r"; - case posTop : return L"t"; - case posBestFit: - default : return L"bestFit"; - } - } - - SimpleType_FromString (EDataLabelPos) - SimpleType_Operator_Equal (CDataLabelPos) - }; - - template - class CIntervalClosedSide : public CSimpleType - { - public: - CIntervalClosedSide() {} - CIntervalClosedSide(const ESidePos & val) { this->m_eValue = val; } - - virtual ESidePos FromString(std::wstring &sValue) - { - if ( L"l" == sValue ) this->m_eValue = sideLeft; - else if ( L"r" == sValue ) this->m_eValue = sideRight; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case sideRight: return L"r"; - case sideLeft : - default : return L"l"; - } - } - - SimpleType_FromString (ESidePos) - SimpleType_Operator_Equal (CIntervalClosedSide) - }; - - enum ETickMarksType - { - marksTypeIn = 0, - marksTypeOut = 1, - marksTypeCross = 2, - marksTypeNone = 3 - - }; - template - class CTickMarksType : public CSimpleType - { - public: - CTickMarksType() {} - CTickMarksType(const ETickMarksType & val) { this->m_eValue = val; } - - virtual ETickMarksType FromString(std::wstring &sValue) - { - if ( L"none" == sValue ) this->m_eValue = marksTypeNone; - else if ( L"out" == sValue ) this->m_eValue = marksTypeOut; - else if ( L"in" == sValue ) this->m_eValue = marksTypeIn; - else if ( L"cross" == sValue ) this->m_eValue = marksTypeCross; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case marksTypeIn : return L"in"; - case marksTypeOut : return L"out"; - case marksTypeCross : return L"cross"; - case marksTypeNone: - default : return L"none"; - } - } - - SimpleType_FromString (ETickMarksType) - SimpleType_Operator_Equal (CTickMarksType) - }; - enum ESourceCacheType - { - typeSourceConsolidation = 0, - typeSourceExternal = 1, - typeSourceScenario = 2, - typeSourceWorksheet = 3, - }; - template - class CSourceCacheType : public CSimpleType - { - public: - CSourceCacheType() {} - CSourceCacheType(const ESourceCacheType & val) { this->m_eValue = val; } - - virtual ESourceCacheType FromString(std::wstring &sValue) - { - if ( L"consolidation" == sValue ) this->m_eValue = typeSourceConsolidation; - else if ( L"external" == sValue ) this->m_eValue = typeSourceExternal; - else if ( L"scenario" == sValue ) this->m_eValue = typeSourceScenario; - else if ( L"worksheet" == sValue ) this->m_eValue = typeSourceWorksheet; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case typeSourceConsolidation: return L"consolidation"; - case typeSourceExternal: return L"external"; - case typeSourceScenario: return L"scenario"; - case typeSourceWorksheet: return L"worksheet"; - default : return L"worksheet"; - } - } - SimpleType_FromString (ESourceCacheType) - SimpleType_Operator_Equal (CSourceCacheType) - }; - enum EValuesGroupBy - { - groupByDays = 0, - groupByHours = 1, - groupByMinutes = 2, - groupByMonths = 3, - groupByQuarters = 4, - groupByNumericRanges = 5, - groupBySeconds = 6, - groupByYears = 7 - }; - template - class CValuesGroupBy : public CSimpleType - { - public: - CValuesGroupBy() {} - CValuesGroupBy(const EValuesGroupBy & val) { this->m_eValue = val; } - - virtual EValuesGroupBy FromString(std::wstring &sValue) - { - if ( L"days" == sValue ) this->m_eValue = groupByDays; - else if ( L"hours" == sValue ) this->m_eValue = groupByHours; - else if ( L"minutes" == sValue ) this->m_eValue = groupByMinutes; - else if ( L"months" == sValue ) this->m_eValue = groupByMonths; - else if ( L"quarters" == sValue ) this->m_eValue = groupByQuarters; - else if ( L"range" == sValue ) this->m_eValue = groupByNumericRanges; - else if ( L"seconds" == sValue ) this->m_eValue = groupBySeconds; - else if ( L"years" == sValue ) this->m_eValue = groupByYears; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case groupByDays: return L"days"; - case groupByHours: return L"hours"; - case groupByMinutes: return L"minutes"; - case groupByMonths: return L"months"; - case groupByQuarters: return L"quarters"; - case groupByNumericRanges: return L"range"; - case groupBySeconds: return L"seconds"; - case groupByYears: return L"years"; - default : return L""; - } - } - SimpleType_FromString (EValuesGroupBy) - SimpleType_Operator_Equal (CValuesGroupBy) - }; - enum EPivotItemType - { - typeAverage = 0, - typeBlank = 1, - typeCount = 2, - typeCountA = 3, - typeData = 4, - typeDefault = 5, - typeGrandTotalt = 6, - typeMin = 7, - typeMax = 8, - typeProduct = 9, - typeStdDev = 10, - typeStdDevP = 11, - typeSum = 12, - typeVar = 13, - typeVarP = 14 - }; - template - class CPivotItemType : public CSimpleType - { - public: - CPivotItemType() {} - CPivotItemType(const EPivotItemType & val) { this->m_eValue = val; } - - virtual EPivotItemType FromString(std::wstring &sValue) - { - if ( L"avg" == sValue ) this->m_eValue = typeAverage; - else if ( L"blank" == sValue ) this->m_eValue = typeBlank; - else if ( L"count" == sValue ) this->m_eValue = typeCount; - else if ( L"countA" == sValue ) this->m_eValue = typeCountA; - else if ( L"data" == sValue ) this->m_eValue = typeData; - else if ( L"default" == sValue ) this->m_eValue = typeDefault; - else if ( L"grand" == sValue ) this->m_eValue = typeGrandTotalt; - else if ( L"min" == sValue ) this->m_eValue = typeMin; - else if ( L"max" == sValue ) this->m_eValue = typeMax; - else if ( L"product" == sValue ) this->m_eValue = typeProduct; - else if ( L"stdDev" == sValue ) this->m_eValue = typeStdDev; - else if ( L"stdDevP" == sValue ) this->m_eValue = typeStdDevP; - else if ( L"sum" == sValue ) this->m_eValue = typeSum; - else if ( L"var" == sValue ) this->m_eValue = typeVar; - else if ( L"varP" == sValue ) this->m_eValue = typeVarP; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case typeAverage: return L"avg"; - case typeBlank: return L"blank"; - case typeCount: return L"count"; - case typeCountA: return L"countA"; - case typeData: return L"data"; - case typeDefault: return L"default"; - case typeGrandTotalt:return L"grand"; - case typeMin: return L"min"; - case typeMax: return L"max"; - case typeProduct: return L"product"; - case typeStdDev: return L"stdDev"; - case typeStdDevP: return L"stdDevP"; - case typeSum: return L"sum"; - case typeVar: return L"var"; - case typeVarP: return L"varP"; - default : return L""; - } - } - SimpleType_FromString (EPivotItemType) - SimpleType_Operator_Equal (CPivotItemType) - }; - enum EFieldSortType - { - sortManual = 0, - sortAscending = 1, - sortDescending = 2 - }; - template - class CFieldSortType : public CSimpleType - { - public: - CFieldSortType() {} - CFieldSortType(const EFieldSortType & val) { this->m_eValue = val; } - - virtual EFieldSortType FromString(std::wstring &sValue) - { - if ( L"manual" == sValue ) this->m_eValue = sortManual; - else if ( L"ascending" == sValue ) this->m_eValue = sortAscending; - else if ( L"descending" == sValue ) this->m_eValue = sortDescending; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case sortManual: return L"manual"; - case sortAscending: return L"ascending"; - case sortDescending: return L"descending"; - default : return L""; - } - } - SimpleType_FromString (EFieldSortType) - SimpleType_Operator_Equal (CFieldSortType) - }; - - enum EPivotAreaType - { - areaAll = 0, - areaFieldButton = 1, - areaData = 2, - areaNone = 3, - areaNormal = 4, - areaOrigin = 5, - areaTopEnd = 6 - }; - template - class CPivotAreaType : public CSimpleType - { - public: - CPivotAreaType() {} - CPivotAreaType(const EPivotAreaType & val) { this->m_eValue = val; } - - virtual EPivotAreaType FromString(std::wstring &sValue) - { - if ( L"all" == sValue ) this->m_eValue = areaAll; - else if ( L"button" == sValue ) this->m_eValue = areaFieldButton; - else if ( L"data" == sValue ) this->m_eValue = areaData; - else if ( L"none" == sValue ) this->m_eValue = areaNone; - else if ( L"normal" == sValue ) this->m_eValue = areaNormal; - else if ( L"origin" == sValue ) this->m_eValue = areaOrigin; - else if ( L"topEnd" == sValue ) this->m_eValue = areaTopEnd; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case areaAll: return L"all"; - case areaFieldButton: return L"button"; - case areaData: return L"data"; - case areaNone: return L"none"; - case areaNormal: return L"normal"; - case areaOrigin: return L"origin"; - case areaTopEnd: return L"topEnd"; - default : return L""; - } - } - SimpleType_FromString (EPivotAreaType) - SimpleType_Operator_Equal (CPivotAreaType) - }; - enum EPivotAxisType - { - axisCol = 0, - axisPage = 1, - axisRow = 2, - axisValues = 3 - }; - template - class CPivotAxisType : public CSimpleType - { - public: - CPivotAxisType() {} - CPivotAxisType(const EPivotAxisType & val) { this->m_eValue = val; } - - virtual EPivotAxisType FromString(std::wstring &sValue) - { - if ( L"axisCol" == sValue ) this->m_eValue = axisCol; - else if ( L"axisPage" == sValue ) this->m_eValue = axisPage; - else if ( L"axisRow" == sValue ) this->m_eValue = axisRow; - else if ( L"axisValues" == sValue ) this->m_eValue = axisValues; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case axisCol: return L"axisCol"; - case axisPage: return L"axisPage"; - case axisRow: return L"axisRow"; - case axisValues: return L"countNums"; - default : return L""; - } - } - SimpleType_FromString (EPivotAxisType) - SimpleType_Operator_Equal (CPivotAxisType) - }; - enum EFormatAction - { - actionBlank = 0, - actionDrill = 1, - actionFormatting= 2, - actionFormula = 3 - }; - template - class CFormatAction : public CSimpleType - { - public: - CFormatAction() {} - CFormatAction(const EFormatAction & val) { this->m_eValue = val; } - - virtual EFormatAction FromString(std::wstring &sValue) - { - if ( L"blank" == sValue ) this->m_eValue = actionBlank; - else if ( L"drill" == sValue ) this->m_eValue = actionDrill; - else if ( L"formatting" == sValue ) this->m_eValue = actionFormatting; - else if ( L"formula" == sValue ) this->m_eValue = actionFormula; - - return this->m_eValue; - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case actionBlank: return L"blank"; - case actionDrill: return L"drill"; - case actionFormatting: return L"formatting"; - case actionFormula: return L"formula"; - default : return L""; - } - } - SimpleType_FromString (EFormatAction) - SimpleType_Operator_Equal (CFormatAction) - }; - enum EShowDataAs - { - dataAsDifference = 0, - dataAsIndex = 1, - dataAsNormal = 2, - dataAsPercentOff = 3, - dataAsPercentDiff = 4, - dataAsPercentOfCol = 5, - dataAsPercentOfRow = 6, - dataAsPercentOfTotal = 7, - dataAsRunTotal = 8 - }; - template - class CShowDataAs : public CSimpleType - { - public: - CShowDataAs() {} - CShowDataAs(const EShowDataAs & val) { this->m_eValue = val; } - - virtual EShowDataAs FromString(std::wstring &sValue) - { - if ( L"difference" == sValue ) this->m_eValue = dataAsDifference; - else if ( L"index" == sValue ) this->m_eValue = dataAsIndex; - else if ( L"normal" == sValue ) this->m_eValue = dataAsNormal; - else if ( L"percent" == sValue ) this->m_eValue = dataAsPercentOff; - else if ( L"percentDiff" == sValue ) this->m_eValue = dataAsPercentDiff; - else if ( L"percentOfCol" == sValue ) this->m_eValue = dataAsPercentOfCol; - else if ( L"percentOfRow" == sValue ) this->m_eValue = dataAsPercentOfRow; - else if ( L"percentOfTotal" == sValue ) this->m_eValue = dataAsPercentOfTotal; - else if ( L"runTotal" == sValue ) this->m_eValue = dataAsRunTotal; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case dataAsDifference: return L"difference"; - case dataAsIndex: return L"index"; - case dataAsNormal: return L"normal"; - case dataAsPercentOff: return L"percent"; - case dataAsPercentDiff: return L"percentDiff"; - case dataAsPercentOfCol: return L"percentOfCol"; - case dataAsPercentOfRow: return L"percentOfRow"; - case dataAsPercentOfTotal: return L"percentOfTotal"; - case dataAsRunTotal: return L"percentOfTotal"; - default : return L"runTotal"; - } - } - - SimpleType_FromString (EShowDataAs) - SimpleType_Operator_Equal (CShowDataAs) - }; - enum EDataConsolidateFunction - { - functionAverage = 0, - functionCount = 1, - functionCountNums = 2, - functionMaximum = 3, - functionMinimum = 4, - functionProduct = 5, - functionStdDev = 6, - functionStdDevP = 7, - functionSum = 8, - functionVariance = 9, - functionVarP = 10 - }; - template - class CDataConsolidateFunction : public CSimpleType - { - public: - CDataConsolidateFunction() {} - CDataConsolidateFunction(const EDataConsolidateFunction & val) { this->m_eValue = val; } - - virtual EDataConsolidateFunction FromString(std::wstring &sValue) - { - if ( L"average" == sValue ) this->m_eValue = functionAverage; - else if ( L"count" == sValue ) this->m_eValue = functionCount; - else if ( L"countNums" == sValue ) this->m_eValue = functionCountNums; - else if ( L"max" == sValue ) this->m_eValue = functionMaximum; - else if ( L"min" == sValue ) this->m_eValue = functionMinimum; - else if ( L"product" == sValue ) this->m_eValue = functionProduct; - else if ( L"stdDev" == sValue ) this->m_eValue = functionStdDev; - else if ( L"stdDevp" == sValue ) this->m_eValue = functionStdDevP; - else if ( L"sum" == sValue ) this->m_eValue = functionSum; - else if ( L"var" == sValue ) this->m_eValue = functionVariance; - else if ( L"varp" == sValue ) this->m_eValue = functionVarP; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case functionAverage: return L"average"; - case functionCount: return L"count"; - case functionCountNums: return L"countNums"; - case functionMaximum: return L"max"; - case functionMinimum: return L"min"; - case functionProduct: return L"product"; - case functionStdDev: return L"stdDev"; - case functionStdDevP: return L"stdDevp"; - case functionSum: return L"sum"; - case functionVariance: return L"var"; - case functionVarP: return L"varp"; - default : return L"sum"; - } - } - - SimpleType_FromString (EDataConsolidateFunction) - SimpleType_Operator_Equal (CDataConsolidateFunction) - }; - enum EDataValidationType - { - validationTypeNone = 0, - validationTypeCustom = 1, - validationTypeDate = 2, - validationTypeDecimal = 3, - validationTypeList = 4, - validationTypeTextLength= 5, - validationTypeTime = 6, - validationTypeWhole = 7 - }; - template - class CDataValidationType : public CSimpleType - { - public: - CDataValidationType() {} - CDataValidationType(const EDataValidationType & val) { this->m_eValue = val; } - - virtual EDataValidationType FromString(std::wstring &sValue) - { - if ( L"custom" == sValue ) this->m_eValue = validationTypeCustom; - else if ( L"date" == sValue ) this->m_eValue = validationTypeDate; - else if ( L"decimal" == sValue ) this->m_eValue = validationTypeDecimal; - else if ( L"list" == sValue || - L"List" == sValue) this->m_eValue = validationTypeList; - else if ( L"none" == sValue ) this->m_eValue = validationTypeNone; - else if ( L"textLength" == sValue ) this->m_eValue = validationTypeTextLength; - else if ( L"time" == sValue ) this->m_eValue = validationTypeTime; - else if ( L"whole" == sValue ) this->m_eValue = validationTypeWhole; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case validationTypeCustom : return L"custom"; - case validationTypeDate : return L"date"; - case validationTypeDecimal : return L"decimal"; - case validationTypeList : return L"list"; - case validationTypeNone : return L"none"; - case validationTypeTextLength : return L"textLength"; - case validationTypeTime: return L"time"; - case validationTypeWhole: return L"whole"; - default : return L"none"; - } - } - - SimpleType_FromString (EDataValidationType) - SimpleType_Operator_Equal (CDataValidationType) - }; - enum EDataValidationErrorStyle - { - errorStyleStop = 0, - errorStyleWarning = 1, - errorStyleInformation = 2 - }; - template - class CDataValidationErrorStyle : public CSimpleType - { - public: - CDataValidationErrorStyle() {} - CDataValidationErrorStyle(const EDataValidationErrorStyle & val) { this->m_eValue = val; } - - virtual EDataValidationErrorStyle FromString(std::wstring &sValue) - { - if ( L"stop" == sValue ) this->m_eValue = errorStyleStop; - else if ( L"warning" == sValue ) this->m_eValue = errorStyleWarning; - else if ( L"information" == sValue ) this->m_eValue = errorStyleInformation; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case errorStyleInformation : return L"information"; - case errorStyleWarning : return L"warning"; - case errorStyleStop: - default : return L"stop"; - } - } - - SimpleType_FromString (EDataValidationErrorStyle) - SimpleType_Operator_Equal (CDataValidationErrorStyle) - }; - enum EDataValidationOperator - { - operatorBetween = 0, - operatorNotBetween = 1, - operatorEqual = 2, - operatorNotEqual = 3, - operatorLessThan = 4, - operatorLessThanOrEqual = 5, - operatorGreaterThan = 6, - operatorGreaterThanOrEqual = 7 - }; - template - class CDataValidationOperator : public CSimpleType - { - public: - CDataValidationOperator() {} - CDataValidationOperator(const EDataValidationOperator & val) { this->m_eValue = val; } - - virtual EDataValidationOperator FromString(std::wstring &sValue) - { - if ( L"between" == sValue ) this->m_eValue = operatorBetween; - else if ( L"notBetween" == sValue ) this->m_eValue = operatorNotBetween; - else if ( L"equal" == sValue ) this->m_eValue = operatorEqual; - else if ( L"notEqual" == sValue ) this->m_eValue = operatorNotEqual; - else if ( L"lessThan" == sValue ) this->m_eValue = operatorLessThan; - else if ( L"lessThanOrEqual" == sValue ) this->m_eValue = operatorLessThanOrEqual; - else if ( L"greaterThan" == sValue ) this->m_eValue = operatorGreaterThan; - else if ( L"greaterThanOrEqual" == sValue ) this->m_eValue = operatorGreaterThanOrEqual; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case operatorBetween : return L"between"; - case operatorNotBetween : return L"notBetween"; - case operatorEqual : return L"equal"; - case operatorNotEqual : return L"notEqual"; - case operatorLessThan : return L"lessThan"; - case operatorLessThanOrEqual : return L"lessThanOrEqual"; - case operatorGreaterThan: return L"greaterThan"; - case operatorGreaterThanOrEqual:return L"greaterThanOrEqual"; - default : return L"between"; - } - } - - SimpleType_FromString (EDataValidationOperator) - SimpleType_Operator_Equal (CDataValidationOperator) - }; - enum EDataValidationImeMode - { - imeModeNoControl = 0, - imeModeOff = 1, - imeModeOn = 2, - imeModeDisabled = 3, - imeModeHiragana = 4, - imeModeFullKatakana = 5, - imeModeHalfKatakana = 6, - imeModeFullAlpha = 7, - imeModeHalfAlpha = 8, - imeModeFullHangul = 9, - imeModeHalfHangul = 10 - }; - template - class CDataValidationImeMode : public CSimpleType - { - public: - CDataValidationImeMode() {} - CDataValidationImeMode(const EDataValidationImeMode & val) { this->m_eValue = val; } - - virtual EDataValidationImeMode FromString(std::wstring &sValue) - { - if ( L"noControl" == sValue ) this->m_eValue = imeModeNoControl; - else if ( L"off" == sValue ) this->m_eValue = imeModeOff; - else if ( L"on" == sValue ) this->m_eValue = imeModeOn; - else if ( L"disabled" == sValue ) this->m_eValue = imeModeDisabled; - else if ( L"hiragana" == sValue ) this->m_eValue = imeModeHiragana; - else if ( L"fullKatakana" == sValue ) this->m_eValue = imeModeFullKatakana; - else if ( L"halfKatakana" == sValue ) this->m_eValue = imeModeHalfKatakana; - else if ( L"fullAlpha" == sValue ) this->m_eValue = imeModeFullAlpha; - else if ( L"halfAlpha" == sValue ) this->m_eValue = imeModeHalfAlpha; - else if ( L"fullHangul" == sValue ) this->m_eValue = imeModeFullHangul; - else if ( L"halfHangul" == sValue ) this->m_eValue = imeModeHalfHangul; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case imeModeNoControl : return L"noControl"; - case imeModeOff : return L"off"; - case imeModeOn : return L"on"; - case imeModeDisabled : return L"disabled"; - case imeModeHiragana : return L"hiragana"; - case imeModeFullKatakana : return L"fullKatakana"; - case imeModeHalfKatakana: return L"halfKatakana"; - case imeModeFullAlpha: return L"fullAlpha"; - case imeModeHalfAlpha: return L"halfAlpha"; - case imeModeFullHangul: return L"fullHangul"; - case imeModeHalfHangul: return L"halfHangul"; - default : return L"noControl"; - } - } - - SimpleType_FromString (EDataValidationImeMode) - SimpleType_Operator_Equal (CDataValidationImeMode) - }; - enum EObjectType - { - objectButton = 0, - objectCheckBox = 1, - objectDrop = 2, - objectGBox = 3, - objectLabel = 4, - objectList = 5, - objectRadio = 6, - objectScroll = 7, - objectSpin = 8, - objectEditBox = 9, - objectDialog = 10, - objectToggleButton = 11, - objectTabStrip = 12, - objectImage = 13 - }; - template - class CObjectType : public CSimpleType - { - public: - CObjectType() {} - CObjectType(const EObjectType & val) { this->m_eValue = val; } - - virtual EObjectType FromString(std::wstring &sValue) - { - if ( L"Button" == sValue ) this->m_eValue = objectButton; - else if ( L"CheckBox" == sValue ) this->m_eValue = objectCheckBox; - else if ( L"Drop" == sValue ) this->m_eValue = objectDrop; - else if ( L"GBox" == sValue ) this->m_eValue = objectGBox; - else if ( L"Label" == sValue ) this->m_eValue = objectLabel; - else if ( L"List" == sValue ) this->m_eValue = objectList; - else if ( L"Radio" == sValue ) this->m_eValue = objectRadio; - else if ( L"Scroll" == sValue ) this->m_eValue = objectScroll; - else if ( L"Spin" == sValue ) this->m_eValue = objectSpin; - else if ( L"EditBox" == sValue ) this->m_eValue = objectEditBox; - else if ( L"Dialog" == sValue ) this->m_eValue = objectDialog; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case objectButton : return L"Button"; - case objectCheckBox : return L"CheckBox"; - case objectDrop : return L"Drop"; - case objectGBox : return L"GBox"; - case objectLabel : return L"Label"; - case objectList : return L"List"; - case objectRadio: return L"Radio"; - case objectScroll: return L"Scroll"; - case objectSpin: return L"Spin"; - case objectEditBox: return L"EditBox"; - case objectDialog: return L"Dialog"; - case objectToggleButton:return L"ToggleButton"; - case objectTabStrip: return L"TabStrip"; - default : return L"Button"; - } - } - SimpleType_FromString (EObjectType) - SimpleType_Operator_Equal (CObjectType) - }; - enum EChecked - { - valUnchecked = 0, - valChecked = 1, - valMixed = 2 - }; - template - class CChecked : public CSimpleType - { - public: - CChecked() {} - CChecked(const EChecked & val) { this->m_eValue = val; } - - virtual EChecked FromString(std::wstring &sValue) - { - if ( L"Mixed" == sValue ) this->m_eValue = valMixed; - else if ( L"Checked" == sValue ) this->m_eValue = valChecked; - else if ( L"Unchecked" == sValue ) this->m_eValue = valUnchecked; - else if ( L"1" == sValue ) this->m_eValue = valChecked; - else if ( L"0" == sValue ) this->m_eValue = valUnchecked; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case valMixed : return L"Mixed"; - case valChecked : return L"Checked"; - case valUnchecked: - default : return L"Unchecked"; - } - } - - SimpleType_FromString (EChecked) - SimpleType_Operator_Equal (CChecked) - }; - enum EDropStyle - { - valCombo = 0, - valComboedit = 1, - valSimple = 2 - }; - template - class CDropStyle : public CSimpleType - { - public: - CDropStyle() {} - CDropStyle(const EDropStyle & val) { this->m_eValue = val; } - - virtual EDropStyle FromString(std::wstring &sValue) - { - std::wstring sValueL = XmlUtils::GetLower(sValue); - - if ( L"combo" == sValueL) this->m_eValue = valCombo; - else if ( L"comboedit" == sValueL) this->m_eValue = valComboedit; - else if ( L"simple" == sValueL) this->m_eValue = valSimple; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - std::wstring ToVmlString() const - { - switch (this->m_eValue) - { - case valCombo: return L"Combo"; - case valComboedit: return L"ComboEdit"; - case valSimple: - default: return L"Simple"; - } - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case valCombo: return L"combo"; - case valComboedit: return L"comboedit"; - case valSimple: - default : return L"simple"; - } - } - - SimpleType_FromString (EDropStyle) - SimpleType_Operator_Equal (CDropStyle) - }; - enum ESelType - { - valSingle = 0, - valMulti = 1, - valExtended = 2 - }; - template - class CSelType : public CSimpleType - { - public: - CSelType() {} - CSelType(const ESelType & val) { this->m_eValue = val; } - - virtual ESelType FromString(std::wstring &sValue) - { - std::wstring sValueL = XmlUtils::GetLower(sValue); - - if ( L"extended" == sValueL) this->m_eValue = valExtended; - else if ( L"multi" == sValueL) this->m_eValue = valMulti; - else if ( L"single" == sValueL) this->m_eValue = valSingle; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - std::wstring ToVmlString() const - { - switch (this->m_eValue) - { - case valExtended: return L"Extended"; - case valMulti: return L"Multi"; - case valSingle: - default: return L"Single"; - } - } - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case valExtended: return L"extended"; - case valMulti : return L"multi"; - case valSingle: - default : return L"single"; - } - } - - SimpleType_FromString (ESelType) - SimpleType_Operator_Equal (CSelType) - }; - enum EEditValidation - { - editText = 0, - editInteger = 1, - editNumber = 2, - editReference = 3, - editFormula = 4 - }; - template - class CEditValidation : public CSimpleType - { - public: - CEditValidation() {} - CEditValidation(const EEditValidation & val) { this->m_eValue = val; } - - virtual EEditValidation FromString(std::wstring &sValue) - { - if ( L"text" == sValue ) this->m_eValue = editText; - else if ( L"integer" == sValue ) this->m_eValue = editInteger; - else if ( L"number" == sValue ) this->m_eValue = editNumber; - else if ( L"reference" == sValue ) this->m_eValue = editReference; - else if ( L"formula" == sValue ) this->m_eValue = editFormula; - else this->m_eValue = eDefValue; - return this->m_eValue; - } - - virtual std::wstring ToString () const - { - switch(this->m_eValue) - { - case editInteger: return L"integer"; - case editNumber : return L"number"; - case editReference : return L"reference"; - case editFormula : return L"formula"; - case editText: - default : return L"text"; - } - } - - SimpleType_FromString (EEditValidation) - SimpleType_Operator_Equal (CEditValidation) - }; - - enum ETabularSlicerCacheSortOrder - { - ctabularslicercachesortorderAscending = 0, - ctabularslicercachesortorderDescending = 1 - }; - - template - class CTabularSlicerCacheSortOrder : public CSimpleType - { - public: - CTabularSlicerCacheSortOrder(){} - CTabularSlicerCacheSortOrder(const ETabularSlicerCacheSortOrder & val) { this->m_eValue = val; } - virtual ETabularSlicerCacheSortOrder FromString(std::wstring &sValue) - { - if(L"ascending" == sValue) - this->m_eValue = ctabularslicercachesortorderAscending; - else if(L"descending" == sValue) - this->m_eValue = ctabularslicercachesortorderDescending; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - ETabularSlicerCacheSortOrder FromStringA(const char* sValue) - { - if(strcmp("ascending", sValue) == 0) - this->m_eValue = ctabularslicercachesortorderAscending; - else if(strcmp("descending", sValue) == 0) - this->m_eValue = ctabularslicercachesortorderDescending; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case ctabularslicercachesortorderAscending : return L"ascending";break; - case ctabularslicercachesortorderDescending : return L"descending";break; - } - return L"ascending"; - } - SimpleType_FromString(ETabularSlicerCacheSortOrder) - SimpleType_Operator_Equal(CTabularSlicerCacheSortOrder) - }; - enum ESlicerCacheCrossFilter - { - cslicercachecrossfilterNone = 0, - cslicercachecrossfilterShowItemsWithDataAtTop = 1, - cslicercachecrossfilterShowItemsWithNoData = 2 - }; - - template - class CSlicerCacheCrossFilter : public CSimpleType - { - public: - CSlicerCacheCrossFilter(){} - CSlicerCacheCrossFilter(const ESlicerCacheCrossFilter & val) { this->m_eValue = val; } - virtual ESlicerCacheCrossFilter FromString(std::wstring &sValue) - { - if(L"none" == sValue) - this->m_eValue = cslicercachecrossfilterNone; - else if(L"showItemsWithDataAtTop" == sValue) - this->m_eValue = cslicercachecrossfilterShowItemsWithDataAtTop; - else if(L"showItemsWithNoData" == sValue) - this->m_eValue = cslicercachecrossfilterShowItemsWithNoData; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - ESlicerCacheCrossFilter FromStringA(const char* sValue) - { - if(strcmp("none", sValue) == 0) - this->m_eValue = cslicercachecrossfilterNone; - else if(strcmp("showItemsWithDataAtTop", sValue) == 0) - this->m_eValue = cslicercachecrossfilterShowItemsWithDataAtTop; - else if(strcmp("showItemsWithNoData", sValue) == 0) - this->m_eValue = cslicercachecrossfilterShowItemsWithNoData; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case cslicercachecrossfilterNone : return L"none";break; - case cslicercachecrossfilterShowItemsWithDataAtTop : return L"showItemsWithDataAtTop";break; - case cslicercachecrossfilterShowItemsWithNoData : return L"showItemsWithNoData";break; - } - return L"none"; - } - SimpleType_FromString(ESlicerCacheCrossFilter) - SimpleType_Operator_Equal(CSlicerCacheCrossFilter) - }; - enum EOlapSlicerCacheSortOrder - { - colapslicercachesortorderNatural = 0, - colapslicercachesortorderAscending = 1, - colapslicercachesortorderDescending = 2 - }; - - template - class COlapSlicerCacheSortOrder : public CSimpleType - { - public: - COlapSlicerCacheSortOrder(){} - COlapSlicerCacheSortOrder(const EOlapSlicerCacheSortOrder & val) { this->m_eValue = val; } - virtual EOlapSlicerCacheSortOrder FromString(std::wstring &sValue) - { - if(L"natural" == sValue) - this->m_eValue = colapslicercachesortorderNatural; - else if(L"ascending" == sValue) - this->m_eValue = colapslicercachesortorderAscending; - else if(L"descending" == sValue) - this->m_eValue = colapslicercachesortorderDescending; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - EOlapSlicerCacheSortOrder FromStringA(const char* sValue) - { - if(strcmp("natural", sValue) == 0) - this->m_eValue = colapslicercachesortorderNatural; - else if(strcmp("ascending", sValue) == 0) - this->m_eValue = colapslicercachesortorderAscending; - else if(strcmp("descending", sValue) == 0) - this->m_eValue = colapslicercachesortorderDescending; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case colapslicercachesortorderNatural : return L"natural";break; - case colapslicercachesortorderAscending : return L"ascending";break; - case colapslicercachesortorderDescending : return L"descending";break; - } - return L"natural"; - } - SimpleType_FromString(EOlapSlicerCacheSortOrder) - SimpleType_Operator_Equal(COlapSlicerCacheSortOrder) - }; - - enum ESlicerStyleType - { - cslicerstyletypeUnselectedItemWithData = 0, - cslicerstyletypeSelectedItemWithData = 1, - cslicerstyletypeUnselectedItemWithNoData = 2, - cslicerstyletypeSelectedItemWithNoData = 3, - cslicerstyletypeHoveredUnselectedItemWithData = 4, - cslicerstyletypeHoveredSelectedItemWithData = 5, - cslicerstyletypeHoveredUnselectedItemWithNoData = 6, - cslicerstyletypeHoveredSelectedItemWithNoData = 7 - }; - - template - class CSlicerStyleType : public CSimpleType - { - public: - CSlicerStyleType(){} - virtual ESlicerStyleType FromString(std::wstring &sValue) - { - if(L"unselectedItemWithData" == sValue) - this->m_eValue = cslicerstyletypeUnselectedItemWithData; - else if(L"selectedItemWithData" == sValue) - this->m_eValue = cslicerstyletypeSelectedItemWithData; - else if(L"unselectedItemWithNoData" == sValue) - this->m_eValue = cslicerstyletypeUnselectedItemWithNoData; - else if(L"selectedItemWithNoData" == sValue) - this->m_eValue = cslicerstyletypeSelectedItemWithNoData; - else if(L"hoveredUnselectedItemWithData" == sValue) - this->m_eValue = cslicerstyletypeHoveredUnselectedItemWithData; - else if(L"hoveredSelectedItemWithData" == sValue) - this->m_eValue = cslicerstyletypeHoveredSelectedItemWithData; - else if(L"hoveredUnselectedItemWithNoData" == sValue) - this->m_eValue = cslicerstyletypeHoveredUnselectedItemWithNoData; - else if(L"hoveredSelectedItemWithNoData" == sValue) - this->m_eValue = cslicerstyletypeHoveredSelectedItemWithNoData; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - ESlicerStyleType FromStringA(const char* sValue) - { - if(strcmp("unselectedItemWithData", sValue) == 0) - this->m_eValue = cslicerstyletypeUnselectedItemWithData; - else if(strcmp("selectedItemWithData", sValue) == 0) - this->m_eValue = cslicerstyletypeSelectedItemWithData; - else if(strcmp("unselectedItemWithNoData", sValue) == 0) - this->m_eValue = cslicerstyletypeUnselectedItemWithNoData; - else if(strcmp("selectedItemWithNoData", sValue) == 0) - this->m_eValue = cslicerstyletypeSelectedItemWithNoData; - else if(strcmp("hoveredUnselectedItemWithData", sValue) == 0) - this->m_eValue = cslicerstyletypeHoveredUnselectedItemWithData; - else if(strcmp("hoveredSelectedItemWithData", sValue) == 0) - this->m_eValue = cslicerstyletypeHoveredSelectedItemWithData; - else if(strcmp("hoveredUnselectedItemWithNoData", sValue) == 0) - this->m_eValue = cslicerstyletypeHoveredUnselectedItemWithNoData; - else if(strcmp("hoveredSelectedItemWithNoData", sValue) == 0) - this->m_eValue = cslicerstyletypeHoveredSelectedItemWithNoData; - else - this->m_eValue = eDefValue; - return this->m_eValue; - } - virtual std::wstring ToString() const - { - switch(this->m_eValue) - { - case cslicerstyletypeUnselectedItemWithData : return L"unselectedItemWithData";break; - case cslicerstyletypeSelectedItemWithData : return L"selectedItemWithData";break; - case cslicerstyletypeUnselectedItemWithNoData : return L"unselectedItemWithNoData";break; - case cslicerstyletypeSelectedItemWithNoData : return L"selectedItemWithNoData";break; - case cslicerstyletypeHoveredUnselectedItemWithData : return L"hoveredUnselectedItemWithData";break; - case cslicerstyletypeHoveredSelectedItemWithData : return L"hoveredSelectedItemWithData";break; - case cslicerstyletypeHoveredUnselectedItemWithNoData : return L"hoveredUnselectedItemWithNoData";break; - case cslicerstyletypeHoveredSelectedItemWithNoData : return L"hoveredSelectedItemWithNoData";break; - } - return L"unselectedItemWithData"; - } - SimpleType_FromString(ESlicerStyleType) - SimpleType_Operator_Equal(CSlicerStyleType) - }; - - }// Spreadsheet -} // SimpleTypes 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/Slicer/SlicerCacheExt.h b/Common/DocxFormat/Source/XlsxFormat/Slicer/SlicerCacheExt.h index ddad6d2548..153de1c02b 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Slicer/SlicerCacheExt.h +++ b/Common/DocxFormat/Source/XlsxFormat/Slicer/SlicerCacheExt.h @@ -110,9 +110,9 @@ namespace OOX //Attributes nullable_uint m_oTableId; nullable_uint m_oColumn; - nullable> m_oSortOrder;//ascending + nullable m_oSortOrder;//ascending nullable_bool m_oCustomListSort;//True - nullable> m_oCrossFilter;//showItemsWithDataAtTop + nullable m_oCrossFilter;//showItemsWithDataAtTop //Members nullable m_oExtLst; }; @@ -138,7 +138,7 @@ namespace OOX return et_x_SlicerStyleElement; } //Attributes - nullable> m_oType; + nullable m_oType; nullable_uint m_oDxfId; }; class CSlicerCache : public WritingElement diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/Borders.h b/Common/DocxFormat/Source/XlsxFormat/Styles/Borders.h index e988237eb5..cc12fdbe73 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/Borders.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/Borders.h @@ -164,14 +164,14 @@ namespace OOX if (sLineStyle.IsInit()) { if (*sLineStyle == L"Dot") - m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle<>(SimpleTypes::Spreadsheet::borderstyleDotted)); + m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle(SimpleTypes::Spreadsheet::borderstyleDotted)); else if (*sLineStyle == L"Dash") - m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle<>(SimpleTypes::Spreadsheet::borderstyleDashed)); + m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle(SimpleTypes::Spreadsheet::borderstyleDashed)); else if (*sLineStyle == L"Double") - m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle<>(SimpleTypes::Spreadsheet::borderstyleDouble)); + m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle(SimpleTypes::Spreadsheet::borderstyleDouble)); else if (*sLineStyle == L"Continuous") { - m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle<>(SimpleTypes::Spreadsheet::borderstyleThin)); + m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle(SimpleTypes::Spreadsheet::borderstyleThin)); bBorderContinuous = true; } } @@ -181,11 +181,11 @@ namespace OOX { case 1: //Thin { - m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle<>(SimpleTypes::Spreadsheet::borderstyleThin)); + m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle(SimpleTypes::Spreadsheet::borderstyleThin)); }break; case 3: //Thick { - m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle<>(SimpleTypes::Spreadsheet::borderstyleThick)); + m_oStyle.reset(new SimpleTypes::Spreadsheet::CBorderStyle(SimpleTypes::Spreadsheet::borderstyleThick)); }break; default://2: //Medium { @@ -194,7 +194,7 @@ namespace OOX } } public: - nullable> m_oStyle; + nullable m_oStyle; nullable m_oColor; nullable_string m_oType; @@ -352,9 +352,9 @@ namespace OOX public: - nullable> m_oDiagonalDown; - nullable> m_oDiagonalUp; - nullable> m_oOutline; + nullable m_oDiagonalDown; + nullable m_oDiagonalUp; + nullable m_oOutline; nullable m_oBottom; nullable m_oDiagonal; @@ -453,7 +453,7 @@ namespace OOX m_oCount = (_UINT32)obj.size(); } public: - nullable> m_oCount; + nullable m_oCount; std::map m_mapBorders; }; } //Spreadsheet diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/CellStyles.h b/Common/DocxFormat/Source/XlsxFormat/Styles/CellStyles.h index be5e6ec349..e4f98eb497 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/CellStyles.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/CellStyles.h @@ -112,12 +112,12 @@ namespace OOX } } public: - nullable> m_oBuiltinId; - nullable> m_oCustomBuiltin; - nullable> m_oHidden; - nullable> m_oILevel; + nullable m_oBuiltinId; + nullable m_oCustomBuiltin; + nullable m_oHidden; + nullable m_oILevel; nullable_string m_oName; - nullable> m_oXfId; + nullable m_oXfId; }; class CCellStyles : public WritingElementWithChilds @@ -199,7 +199,7 @@ namespace OOX m_oCount = (_UINT32)obj.size(); } public: - nullable> m_oCount; + nullable m_oCount; }; } //Spreadsheet } // namespace OOX diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/Colors.h b/Common/DocxFormat/Source/XlsxFormat/Styles/Colors.h index 1e7523b1d8..beae78fbe2 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/Colors.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/Colors.h @@ -122,7 +122,7 @@ namespace OOX public: - nullable> m_oCount; + nullable m_oCount; nullable m_oIndexedColors; nullable m_oMruColors; diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/Fills.h b/Common/DocxFormat/Source/XlsxFormat/Styles/Fills.h index 3fd54b0f72..3128d2211a 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/Fills.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/Fills.h @@ -185,7 +185,7 @@ namespace OOX } public: - nullable> m_oPatternType; + nullable m_oPatternType; nullable m_oBgColor; nullable m_oFgColor; }; @@ -374,7 +374,7 @@ namespace OOX nullable m_oLeft; nullable m_oRight; nullable m_oTop; - nullable> m_oType; + nullable m_oType; }; class CFill : public WritingElement { @@ -567,7 +567,7 @@ namespace OOX } public: - nullable> m_oCount; + nullable m_oCount; std::map m_mapFills; }; } //Spreadsheet diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/Fonts.h b/Common/DocxFormat/Source/XlsxFormat/Styles/Fonts.h index e4e6b7ee97..c8d8c45f51 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/Fonts.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/Fonts.h @@ -198,10 +198,10 @@ namespace OOX nullable_bool bItalic, bBold; nullable_string sColor, sFamily, sFont; - nullable> oFamily; - nullable> oUnderline; - nullable> oCharset; - nullable> oVerticalAlignment; + nullable oFamily; + nullable oUnderline; + nullable oCharset; + nullable oVerticalAlignment; nullable_double dSz; WritingElement_ReadAttributes_Start( oReader ) @@ -352,18 +352,18 @@ namespace OOX } public: - nullable > m_oBold; + nullable m_oBold; nullable m_oCharset; nullable m_oColor; - nullable > m_oCondense; - nullable > m_oExtend; + nullable m_oCondense; + nullable m_oExtend; nullable m_oFamily; - nullable > m_oItalic; - nullable > m_oOutline; + nullable m_oItalic; + nullable m_oOutline; nullable m_oRFont; nullable m_oScheme; - nullable > m_oShadow; - nullable > m_oStrike; + nullable m_oShadow; + nullable m_oStrike; nullable m_oSz; nullable m_oUnderline; nullable m_oVertAlign; @@ -462,7 +462,7 @@ namespace OOX m_oCount = (_UINT32)obj.size(); } public: - nullable> m_oCount; + nullable m_oCount; std::map m_mapFonts; }; } //Spreadsheet diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/NumFmts.h b/Common/DocxFormat/Source/XlsxFormat/Styles/NumFmts.h index 9e68840399..04e41f0414 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/NumFmts.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/NumFmts.h @@ -120,8 +120,8 @@ namespace OOX public: nullable_string m_oFormatCode; nullable_string m_oFormatCode16; - nullable> m_oNumFmtId; - nullable> m_oSourceLinked; + nullable m_oNumFmtId; + nullable m_oSourceLinked; }; class CNumFmts : public WritingElementWithChilds { @@ -224,7 +224,7 @@ namespace OOX m_oCount = (_INT32)obj.size(); } public: - nullable> m_oCount; + nullable m_oCount; std::map m_mapNumFmtIndex; std::map m_mapFormatCode; diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/TableStyles.h b/Common/DocxFormat/Source/XlsxFormat/Styles/TableStyles.h index 37e19418bb..9447e8c7af 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/TableStyles.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/TableStyles.h @@ -178,9 +178,9 @@ namespace OOX } public: - nullable> m_oDxfId; - nullable> m_oSize; - nullable> m_oType; + nullable m_oDxfId; + nullable m_oSize; + nullable m_oType; }; class CTableStyle : public WritingElementWithChilds { @@ -285,10 +285,10 @@ namespace OOX } public: - nullable> m_oCount; + nullable m_oCount; nullable m_oName; - nullable> m_oPivot; - nullable> m_oTable; + nullable m_oPivot; + nullable m_oTable; nullable m_oDisplayName; // Используется только для дефалтовых стилей }; class CTableStyles : public WritingElementWithChilds @@ -392,7 +392,7 @@ namespace OOX } public: - nullable> m_oCount; + nullable m_oCount; nullable m_oDefaultPivotStyle; nullable m_oDefaultTableStyle; }; diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/Xfs.h b/Common/DocxFormat/Source/XlsxFormat/Styles/Xfs.h index 509a10f2da..f772aa32cd 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/Xfs.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/Xfs.h @@ -193,15 +193,15 @@ namespace OOX } public: - nullable> m_oHorizontal; + nullable m_oHorizontal; nullable_uint m_oIndent; - nullable> m_oJustifyLastLine; + nullable m_oJustifyLastLine; nullable_uint m_oReadingOrder; //todooo to simple nullable_int m_oRelativeIndent; - nullable> m_oShrinkToFit; + nullable m_oShrinkToFit; nullable_uint m_oTextRotation; - nullable> m_oVertical; - nullable> m_oWrapText; + nullable m_oVertical; + nullable m_oWrapText; }; class CProtection : public WritingElement { @@ -269,8 +269,8 @@ namespace OOX } public: - nullable> m_oHidden; - nullable> m_oLocked; + nullable m_oHidden; + nullable m_oLocked; }; //нереализован: // @@ -396,20 +396,20 @@ namespace OOX } public: - nullable> m_oApplyAlignment; - nullable> m_oApplyBorder; - nullable> m_oApplyFill; - nullable> m_oApplyFont; - nullable> m_oApplyNumberFormat; - nullable> m_oApplyProtection; + nullable m_oApplyAlignment; + nullable m_oApplyBorder; + nullable m_oApplyFill; + nullable m_oApplyFont; + nullable m_oApplyNumberFormat; + nullable m_oApplyProtection; - nullable> m_oBorderId; - nullable> m_oFillId; - nullable> m_oFontId; - nullable> m_oNumFmtId; - nullable> m_oPivotButton; - nullable> m_oQuotePrefix; - nullable> m_oXfId; + nullable m_oBorderId; + nullable m_oFillId; + nullable m_oFontId; + nullable m_oNumFmtId; + nullable m_oPivotButton; + nullable m_oQuotePrefix; + nullable m_oXfId; nullable m_oAligment; nullable m_oProtection; @@ -497,7 +497,7 @@ namespace OOX m_oCount = (_UINT32)obj.size(); } public: - nullable> m_oCount; + nullable m_oCount; }; class CCellStyleXfs : public WritingElementWithChilds { @@ -578,7 +578,7 @@ namespace OOX m_oCount = (_UINT32)obj.size(); } public: - nullable> m_oCount; + nullable m_oCount; }; } //Spreadsheet } // namespace OOX diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/dxf.h b/Common/DocxFormat/Source/XlsxFormat/Styles/dxf.h index 5481ec579c..ae043fa8e4 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/dxf.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/dxf.h @@ -329,7 +329,7 @@ namespace OOX } public: - nullable> m_oCount; + nullable m_oCount; }; } //Spreadsheet } // namespace OOX diff --git a/Common/DocxFormat/Source/XlsxFormat/Styles/rPr.h b/Common/DocxFormat/Source/XlsxFormat/Styles/rPr.h index 839d536f44..20716ae7ef 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Styles/rPr.h +++ b/Common/DocxFormat/Source/XlsxFormat/Styles/rPr.h @@ -549,10 +549,10 @@ namespace OOX } } public: - nullable> m_oAuto; - nullable> m_oIndexed; + nullable m_oAuto; + nullable m_oIndexed; nullable m_oRgb; - nullable> m_oThemeColor; + nullable m_oThemeColor; nullable m_oTint; }; @@ -645,7 +645,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oCharset; + nullable m_oCharset; }; class CVerticalAlign : public WritingElement { @@ -680,7 +680,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oVerticalAlign; + nullable m_oVerticalAlign; }; class CFontFamily : public WritingElement { @@ -715,7 +715,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oFontFamily; + nullable m_oFontFamily; }; class CFontScheme : public WritingElement { @@ -752,7 +752,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oFontScheme; + nullable m_oFontScheme; }; class CUnderline : public WritingElement { @@ -787,7 +787,7 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } public: - nullable> m_oUnderline; + nullable m_oUnderline; }; //необработано: class CRPr : public WritingElement @@ -961,24 +961,24 @@ namespace OOX { } public: - nullable > m_oBold; + nullable m_oBold; nullable m_oCharset; nullable m_oColor; - nullable > m_oCondense; - nullable > m_oExtend; + nullable m_oCondense; + nullable m_oExtend; nullable m_oFamily; - nullable > m_oItalic; - nullable > m_oOutline; + nullable m_oItalic; + nullable m_oOutline; nullable m_oRFont; nullable m_oScheme; - nullable > m_oShadow; - nullable > m_oStrike; + nullable m_oShadow; + nullable m_oStrike; nullable m_oSz; nullable m_oUnderline; nullable m_oVertAlign; ////// - nullable> m_nFontIndex; + nullable m_nFontIndex; }; } //Spreadsheet } // namespace OOX diff --git a/Common/DocxFormat/Source/XlsxFormat/Table/Autofilter.h b/Common/DocxFormat/Source/XlsxFormat/Table/Autofilter.h index 7fbf0301c0..9809cecbf5 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Table/Autofilter.h +++ b/Common/DocxFormat/Source/XlsxFormat/Table/Autofilter.h @@ -193,10 +193,10 @@ namespace OOX } public: - nullable > m_oDescending; - nullable m_oRef; - nullable > m_oSortBy; - nullable > m_oDxfId; + nullable m_oDescending; + nullable m_oRef; + nullable m_oSortBy; + nullable m_oDxfId; }; class CSortState : public WritingElementWithChilds { @@ -309,10 +309,10 @@ namespace OOX } } public: - nullable m_oRef; - nullable > m_oCaseSensitive; - nullable > m_oColumnSort; - nullable > m_oSortMethod; + nullable m_oRef; + nullable m_oCaseSensitive; + nullable m_oColumnSort; + nullable m_oSortMethod; }; //Filters @@ -388,8 +388,8 @@ namespace OOX } } public: - nullable > m_oCellColor; - nullable > m_oDxfId; + nullable m_oCellColor; + nullable m_oDxfId; }; class CDynamicFilter : public WritingElement { @@ -538,7 +538,7 @@ namespace OOX } public: - nullable > m_oType; + nullable m_oType; nullable m_oVal; nullable m_oMaxVal; }; @@ -634,7 +634,7 @@ namespace OOX } public: - nullable > m_oOperator; + nullable m_oOperator; nullable m_oVal; }; class CCustomFilters : public WritingElementWithChilds @@ -732,7 +732,7 @@ namespace OOX } } public: - nullable > m_oAnd; + nullable m_oAnd; }; class CFilter : public WritingElement { @@ -904,13 +904,13 @@ namespace OOX } } public: - nullable > m_oDateTimeGrouping; - nullable > m_oDay; - nullable > m_oHour; - nullable > m_oMinute; - nullable > m_oMonth; - nullable > m_oSecond; - nullable > m_oYear; + nullable m_oDateTimeGrouping; + nullable m_oDay; + nullable m_oHour; + nullable m_oMinute; + nullable m_oMonth; + nullable m_oSecond; + nullable m_oYear; }; class CFilters : public WritingElementWithChilds<> { @@ -1023,7 +1023,7 @@ namespace OOX } } public: - nullable > m_oBlank; + nullable m_oBlank; }; class CTop10 : public WritingElement { @@ -1105,10 +1105,10 @@ namespace OOX } } public: - nullable m_oFilterVal; - nullable > m_oPercent; - nullable > m_oTop; - nullable m_oVal; + nullable m_oFilterVal; + nullable m_oPercent; + nullable m_oTop; + nullable m_oVal; }; class CFilterColumn : public WritingElement { @@ -1231,9 +1231,9 @@ namespace OOX } } public: - nullable > m_oColId; - nullable > m_oHiddenButton; - nullable > m_oShowButton; + nullable m_oColId; + nullable m_oHiddenButton; + nullable m_oShowButton; nullable m_oColorFilter; nullable m_oDynamicFilter; diff --git a/Common/DocxFormat/Source/XlsxFormat/Table/Connections.h b/Common/DocxFormat/Source/XlsxFormat/Table/Connections.h index a95383ce13..c76c1048fa 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Table/Connections.h +++ b/Common/DocxFormat/Source/XlsxFormat/Table/Connections.h @@ -106,7 +106,7 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if(oReader, L"position", m_oPosition) WritingElement_ReadAttributes_End(oReader) } - nullable> m_oType; + nullable m_oType; nullable_int m_oPosition; }; class CTextFields : public WritingElementWithChilds @@ -232,7 +232,8 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if(oReader, L"double", m_oDouble) WritingElement_ReadAttributes_End(oReader) } - nullable> m_oParameterType; + + nullable m_oParameterType; nullable_string m_oName; nullable_string m_oPrompt; @@ -638,7 +639,7 @@ namespace OOX nullable_bool m_oTextDates; nullable_bool m_oXl2000; nullable_bool m_oHtmlTables; - nullable> m_oHtmlFormat; + nullable m_oHtmlFormat; //nullable m_oTables; }; @@ -774,8 +775,8 @@ namespace OOX nullable_int m_oCodePage; - nullable> m_oQualifier; - nullable> m_oFileType; + nullable m_oQualifier; + nullable m_oFileType; nullable_bool m_oPrompt; nullable_bool m_oDelimited; @@ -1001,7 +1002,7 @@ namespace OOX } nullable_int m_oType; //EDatabaseSourceType nullable_string m_oName; - nullable> m_oId; + nullable m_oId; nullable_string m_oIdExt; nullable_string m_oUId; @@ -1012,7 +1013,7 @@ namespace OOX nullable m_oRangePr; nullable m_oExtLst; - nullable> m_oCredentials; + nullable m_oCredentials; nullable_bool m_oBackground; nullable_bool m_oDeleted; nullable_string m_oDescription; diff --git a/Common/DocxFormat/Source/XlsxFormat/Table/QueryTable.h b/Common/DocxFormat/Source/XlsxFormat/Table/QueryTable.h index 94431e7221..f70f199c3a 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Table/QueryTable.h +++ b/Common/DocxFormat/Source/XlsxFormat/Table/QueryTable.h @@ -63,8 +63,8 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); void ReadAttributes(XLS::BaseObjectPtr& obj); - nullable> m_oId; - nullable> m_oTableColumnId; + nullable m_oId; + nullable m_oTableColumnId; nullable m_oName; nullable_bool m_oRowNumbers; @@ -97,7 +97,7 @@ namespace OOX return et_x_QueryTableFields; } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable > m_oCount; + nullable m_oCount; }; class CQueryTableDeletedField : public WritingElement @@ -151,7 +151,7 @@ namespace OOX } void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - nullable > m_oCount; + nullable m_oCount; }; class CQueryTableRefresh : public WritingElement { @@ -178,13 +178,13 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); void ReadAttributes(XLS::BaseObjectPtr& obj); - nullable> m_oNextId; - nullable> m_oMinimumVersion; + nullable m_oNextId; + nullable m_oMinimumVersion; nullable_bool m_FieldIdWrapped; nullable_bool m_HeadersInLastRefresh; nullable_bool m_PreserveSortFilterLayout; - nullable> m_UnboundColumnsLeft; - nullable> m_UnboundColumnsRight; + nullable m_UnboundColumnsLeft; + nullable m_UnboundColumnsRight; nullable m_oQueryTableFields; nullable m_oQueryTableDeletedFields; @@ -229,8 +229,8 @@ namespace OOX nullable_bool m_oApplyWidthHeightFormats; nullable_bool m_oBackgroundRefresh; - nullable> m_oAutoFormatId; - nullable> m_oConnectionId; + nullable m_oAutoFormatId; + nullable m_oConnectionId; nullable_bool m_oDisableEdit; nullable_bool m_oDisableRefresh; diff --git a/Common/DocxFormat/Source/XlsxFormat/Table/Table.h b/Common/DocxFormat/Source/XlsxFormat/Table/Table.h index 0c56b2fb17..b31bfd3da7 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Table/Table.h +++ b/Common/DocxFormat/Source/XlsxFormat/Table/Table.h @@ -105,10 +105,10 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: nullable m_oName; - nullable > m_oShowColumnStripes; - nullable > m_oShowFirstColumn; - nullable > m_oShowLastColumn; - nullable > m_oShowRowStripes; + nullable m_oShowColumnStripes; + nullable m_oShowFirstColumn; + nullable m_oShowLastColumn; + nullable m_oShowRowStripes; }; class CTableColumn : public WritingElement { @@ -141,15 +141,15 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: nullable_string m_oDataCellStyle; - nullable> m_oDataDxfId; + nullable m_oDataDxfId; nullable_string m_oHeaderRowCellStyle; - nullable> m_oHeaderRowDxfId; - nullable> m_oId; + nullable m_oHeaderRowDxfId; + nullable m_oId; nullable_string m_oName; - nullable> m_oQueryTableFieldId; + nullable m_oQueryTableFieldId; nullable_string m_oTotalsRowCellStyle; - nullable> m_oTotalsRowDxfId; - nullable> m_oTotalsRowFunction; + nullable m_oTotalsRowDxfId; + nullable m_oTotalsRowFunction; nullable_string m_oTotalsRowLabel; nullable_string m_oUniqueName; nullable_string m_oUid; @@ -191,7 +191,7 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); void ReadAttributes(std::vector& obj); public: - nullable > m_oCount; + nullable m_oCount; }; class CTable : public WritingElement { @@ -226,26 +226,26 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: nullable_string m_oComment; - nullable> m_oConnectionId; + nullable m_oConnectionId; nullable_string m_oDataCellStyle; - nullable> m_oDataDxfId; + nullable m_oDataDxfId; nullable_string m_oDisplayName; - nullable> m_oHeaderRowBorderDxfId; + nullable m_oHeaderRowBorderDxfId; nullable_string m_oHeaderRowCellStyle; - nullable> m_oHeaderRowCount; - nullable> m_oHeaderRowDxfId; - nullable> m_oId; + nullable m_oHeaderRowCount; + nullable m_oHeaderRowDxfId; + nullable m_oId; nullable_bool m_oInsertRow; nullable_bool m_oInsertRowShift; nullable_string m_oName; nullable_bool m_oPublished; nullable m_oRef; - nullable> m_oTableBorderDxfId; - nullable> m_oTableType; - nullable> m_oTotalsRowBorderDxfId; + nullable m_oTableBorderDxfId; + nullable m_oTableType; + nullable m_oTotalsRowBorderDxfId; nullable_string m_oTotalsRowCellStyle; - nullable> m_oTotalsRowCount; - nullable> m_oTotalsRowDxfId; + nullable m_oTotalsRowCount; + nullable m_oTotalsRowDxfId; nullable_bool m_oTotalsRowShown; nullable m_oAutoFilter; @@ -318,7 +318,7 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); void ReadAttributes(XLS::BaseObjectPtr& obj); public: - nullable > m_oCount; + nullable m_oCount; }; //необработанные child: // diff --git a/Common/DocxFormat/Source/XlsxFormat/Workbook/BookViews.h b/Common/DocxFormat/Source/XlsxFormat/Workbook/BookViews.h index 7a4da0fc30..36b20e0425 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Workbook/BookViews.h +++ b/Common/DocxFormat/Source/XlsxFormat/Workbook/BookViews.h @@ -139,19 +139,19 @@ namespace OOX public: - nullable> m_oActiveTab; - nullable> m_oAutoFilterDateGrouping; - nullable> m_oFirstSheet; - nullable> m_oMinimized; - nullable> m_oShowHorizontalScroll; - nullable> m_oShowSheetTabs; - nullable> m_oShowVerticalScroll; - nullable> m_oTabRatio; - nullable> m_oVisibility; - nullable> m_oWindowHeight; - nullable> m_oWindowWidth; - nullable> m_oXWindow; - nullable> m_oYWindow; + nullable m_oActiveTab; + nullable m_oAutoFilterDateGrouping; + nullable m_oFirstSheet; + nullable m_oMinimized; + nullable m_oShowHorizontalScroll; + nullable m_oShowSheetTabs; + nullable m_oShowVerticalScroll; + nullable m_oTabRatio; + nullable m_oVisibility; + nullable m_oWindowHeight; + nullable m_oWindowWidth; + nullable m_oXWindow; + nullable m_oYWindow; }; class CBookViews : public WritingElementWithChilds diff --git a/Common/DocxFormat/Source/XlsxFormat/Workbook/CalcPr.h b/Common/DocxFormat/Source/XlsxFormat/Workbook/CalcPr.h index 42edf85944..03ae1caaab 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Workbook/CalcPr.h +++ b/Common/DocxFormat/Source/XlsxFormat/Workbook/CalcPr.h @@ -138,19 +138,19 @@ namespace OOX } public: - nullable> m_oCalcId; - nullable> m_oCalcMode; - nullable> m_oFullCalcOnLoad; - nullable> m_oRefMode; - nullable> m_oIterate; - nullable> m_oIterateCount; + nullable m_oCalcId; + nullable m_oCalcMode; + nullable m_oFullCalcOnLoad; + nullable m_oRefMode; + nullable m_oIterate; + nullable m_oIterateCount; nullable m_oIterateDelta; - nullable> m_oFullPrecision; - nullable> m_oCalcCompleted; - nullable> m_oCalcOnSave; - nullable> m_oConcurrentCalc; - nullable> m_oConcurrentManualCount; - nullable> m_oForceFullCalc; + nullable m_oFullPrecision; + nullable m_oCalcCompleted; + nullable m_oCalcOnSave; + nullable m_oConcurrentCalc; + nullable m_oConcurrentManualCount; + nullable m_oForceFullCalc; }; } //Spreadsheet diff --git a/Common/DocxFormat/Source/XlsxFormat/Workbook/DefinedNames.h b/Common/DocxFormat/Source/XlsxFormat/Workbook/DefinedNames.h index 81ff83c920..675eac2b65 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Workbook/DefinedNames.h +++ b/Common/DocxFormat/Source/XlsxFormat/Workbook/DefinedNames.h @@ -119,18 +119,18 @@ namespace OOX nullable_string m_oComment; nullable_string m_oCustomMenu; nullable_string m_oDescription; - nullable> m_oFunction; - nullable> m_oFunctionGroupId; + nullable m_oFunction; + nullable m_oFunctionGroupId; nullable_string m_oHelp; - nullable> m_oHidden; - nullable> m_oLocalSheetId; + nullable m_oHidden; + nullable m_oLocalSheetId; nullable_string m_oName; - nullable> m_oPublishToServer; + nullable m_oPublishToServer; nullable_string m_oShortcutKey; nullable_string m_oStatusBar; - nullable> m_oVbProcedure; - nullable> m_oWorkbookParameter; - nullable> m_oXlm; + nullable m_oVbProcedure; + nullable m_oWorkbookParameter; + nullable m_oXlm; nullable_string m_oRef; }; diff --git a/Common/DocxFormat/Source/XlsxFormat/Workbook/Sheets.h b/Common/DocxFormat/Source/XlsxFormat/Workbook/Sheets.h index 44bffd5fde..431e2528e7 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Workbook/Sheets.h +++ b/Common/DocxFormat/Source/XlsxFormat/Workbook/Sheets.h @@ -125,8 +125,8 @@ namespace OOX public: nullable m_oRid; nullable_string m_oName; - nullable> m_oSheetId; - nullable> m_oState; + nullable m_oSheetId; + nullable m_oState; }; diff --git a/Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h b/Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h index ee19646697..e49ad02a19 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h +++ b/Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h @@ -132,7 +132,7 @@ namespace OOX } //---------- - nullable> m_oCacheId; + nullable m_oCacheId; nullable m_oRid; }; diff --git a/Common/DocxFormat/Source/XlsxFormat/Workbook/WorkbookPr.h b/Common/DocxFormat/Source/XlsxFormat/Workbook/WorkbookPr.h index 2a611ee52e..0fbe052ef5 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Workbook/WorkbookPr.h +++ b/Common/DocxFormat/Source/XlsxFormat/Workbook/WorkbookPr.h @@ -154,24 +154,24 @@ namespace OOX } public: - nullable> m_oAllowRefreshQuery; - nullable> m_oAutoCompressPictures; - nullable> m_oBackupFile; - nullable> m_oCheckCompatibility; - nullable> m_oCodeName; - nullable> m_oDate1904; - nullable> m_oDateCompatibility; - nullable> m_oDefaultThemeVersion; - nullable> m_oFilterPrivacy; - nullable> m_oHidePivotFieldList; - nullable> m_oPromptedSolutions; - nullable> m_oPublishItems; - nullable> m_oRefreshAllConnections; - nullable> m_oShowBorderUnselectedTables; - nullable> m_oShowInkAnnotation; - nullable> m_oShowObjects; - nullable> m_oShowPivotChartFilter; - nullable> m_oUpdateLinks; + nullable m_oAllowRefreshQuery; + nullable m_oAutoCompressPictures; + nullable m_oBackupFile; + nullable m_oCheckCompatibility; + nullable m_oCodeName; + nullable m_oDate1904; + nullable m_oDateCompatibility; + nullable m_oDefaultThemeVersion; + nullable m_oFilterPrivacy; + nullable m_oHidePivotFieldList; + nullable m_oPromptedSolutions; + nullable m_oPublishItems; + nullable m_oRefreshAllConnections; + nullable m_oShowBorderUnselectedTables; + nullable m_oShowInkAnnotation; + nullable m_oShowObjects; + nullable m_oShowPivotChartFilter; + nullable m_oUpdateLinks; }; class CWorkbookProtection : public WritingElement @@ -275,19 +275,19 @@ namespace OOX } - nullable> m_oLockRevision; - nullable> m_oLockStructure; - nullable> m_oLockWindows; + nullable m_oLockRevision; + nullable m_oLockStructure; + nullable m_oLockWindows; - nullable> m_oWorkbookAlgorithmName; - nullable> m_oWorkbookSpinCount; + nullable m_oWorkbookAlgorithmName; + nullable m_oWorkbookSpinCount; nullable_string m_oWorkbookHashValue; nullable_string m_oWorkbookSaltValue; nullable_string m_oPassword; //for old wrike protection - nullable> m_oRevisionsAlgorithmName; - nullable> m_oRevisionsSpinCount; + nullable m_oRevisionsAlgorithmName; + nullable m_oRevisionsSpinCount; nullable_string m_oRevisionsHashValue; nullable_string m_oRevisionsSaltValue; }; diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/Cols.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/Cols.h index 6cc15aece8..27055ef226 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/Cols.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/Cols.h @@ -116,15 +116,15 @@ namespace OOX } public: - nullable> m_oBestFit; - nullable> m_oCollapsed; - nullable> m_oCustomWidth; - nullable> m_oHidden; - nullable> m_oMax; - nullable> m_oMin; - nullable> m_oOutlineLevel; - nullable> m_oPhonetic; - nullable> m_oStyle; + nullable m_oBestFit; + nullable m_oCollapsed; + nullable m_oCustomWidth; + nullable m_oHidden; + nullable m_oMax; + nullable m_oMin; + nullable m_oOutlineLevel; + nullable m_oPhonetic; + nullable m_oStyle; nullable m_oWidth; }; diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h index ec51cffe3d..54252d990c 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/ConditionalFormatting.h @@ -120,8 +120,8 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: - nullable> m_oGte; - nullable> m_oType; + nullable m_oGte; + nullable m_oType; nullable m_oVal; nullable m_oFormula; @@ -159,8 +159,8 @@ namespace OOX return et_x_ConditionalFormatIconSet; } - nullable> m_oIconSet; - nullable> m_oIconId; + nullable m_oIconSet; + nullable m_oIconId; }; class CColorScale : public WritingElement @@ -242,21 +242,21 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: - nullable> m_oMaxLength; - nullable> m_oMinLength; - nullable> m_oShowValue; + nullable m_oMaxLength; + nullable m_oMinLength; + nullable m_oShowValue; nullable m_oColor; std::vector> m_arrValues; //---ext----------- - nullable> m_oAxisPosition; - nullable> m_oDirection; - nullable> m_oBorder; - nullable> m_oGradient; - nullable> m_oNegativeBarColorSameAsPositive; - nullable> m_oNegativeBarBorderColorSameAsPositive; + nullable m_oAxisPosition; + nullable m_oDirection; + nullable m_oBorder; + nullable m_oGradient; + nullable m_oNegativeBarColorSameAsPositive; + nullable m_oNegativeBarBorderColorSameAsPositive; nullable m_oAxisColor; nullable m_oBorderColor; @@ -304,15 +304,15 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: - nullable> m_oPercent; - nullable> m_oReverse; - nullable> m_oShowValue; - std::vector> m_arrValues; + nullable m_oPercent; + nullable m_oReverse; + nullable m_oShowValue; + std::vector> m_arrValues; - nullable>m_oIconSet; + nullable m_oIconSet; //---ext----------- - nullable> m_oCustom; - std::vector> m_arrIconSets; + nullable m_oCustom; + std::vector> m_arrIconSets; }; class CConditionalFormattingRule : public WritingElement @@ -359,20 +359,20 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: nullable m_oDxf; - nullable> m_oAboveAverage; - nullable> m_oBottom; - nullable> m_oDxfId; - nullable> m_oEqualAverage; - nullable> m_oOperator; - nullable> m_oPercent; - nullable> m_oPriority; - nullable> m_oRank; - nullable> m_oStdDev; - nullable> m_oStopIfTrue; + nullable m_oAboveAverage; + nullable m_oBottom; + nullable m_oDxfId; + nullable m_oEqualAverage; + nullable m_oOperator; + nullable m_oPercent; + nullable m_oPriority; + nullable m_oRank; + nullable m_oStdDev; + nullable m_oStopIfTrue; nullable m_oId; nullable m_oText; - nullable> m_oTimePeriod; - nullable> m_oType; + nullable m_oTimePeriod; + nullable m_oType; nullable m_oExtLst; nullable m_oExtId; @@ -426,7 +426,7 @@ namespace OOX mutable bool m_bIsValid; public: - nullable> m_oPivot; + nullable m_oPivot; nullable m_oSqRef; // ToDo переделать на тип "sqref" (18.18.76) - последовательность "ref", разделенные пробелом }; } //Spreadsheet diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/DataValidation.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/DataValidation.h index 89d2bf6d39..fdd1ecc885 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/DataValidation.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/DataValidation.h @@ -33,7 +33,7 @@ #include "../ComplexTypes_Spreadsheet.h" #include "../WritingElement.h" -#include "../SimpleTypes_Spreadsheet.h" +#include "../../Common/SimpleTypes_Spreadsheet.h" #include "../../Common/SimpleTypes_Shared.h" namespace OOX @@ -102,20 +102,20 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); void ReadAttributes(XLS::BaseObjectPtr& obj); - nullable> m_oSpinCount; + nullable m_oSpinCount; - nullable> m_oType; - nullable> m_oAllowBlank; + nullable m_oType; + nullable m_oAllowBlank; nullable_string m_oError; nullable_string m_oErrorTitle; - nullable> m_oErrorStyle; - nullable> m_oImeMode; - nullable> m_oOperator; + nullable m_oErrorStyle; + nullable m_oImeMode; + nullable m_oOperator; nullable_string m_oPrompt; nullable_string m_oPromptTitle; - nullable> m_oShowDropDown; - nullable> m_oShowErrorMessage; - nullable> m_oShowInputMessage; + nullable m_oShowDropDown; + nullable m_oShowErrorMessage; + nullable m_oShowInputMessage; nullable_string m_oSqRef; // ToDo переделать на тип "sqref" (18.18.76) - последовательность "ref", разделенные пробелом @@ -155,9 +155,9 @@ namespace OOX void ReadAttributes(XLS::BaseObjectPtr& obj); public: mutable nullable_int m_oCount; - nullable> m_oDisablePrompts; - nullable> m_oXWindow; - nullable> m_oYWindow; + nullable m_oDisablePrompts; + nullable m_oXWindow; + nullable m_oYWindow; }; } //Spreadsheet } // namespace OOX diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/MergeCells.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/MergeCells.h index 375fd315e4..c3146aa021 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/MergeCells.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/MergeCells.h @@ -188,7 +188,7 @@ namespace OOX m_oCount = (_UINT32)obj.size(); } public: - nullable> m_oCount; + nullable m_oCount; }; } //Spreadsheet } // namespace OOX 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/SheetData.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.h index 413fcdcac9..f1fcc3fec4 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/SheetData.h @@ -65,18 +65,18 @@ namespace OOX public: bool m_bIsInit; CStringXLSB m_oFormula; - SimpleTypes::Spreadsheet::CCellFormulaType m_oT; + SimpleTypes::Spreadsheet::CCellFormulaType m_oT; _INT32 m_nSi; CStringXLSB m_oRef; CStringXLSB m_oR1; CStringXLSB m_oR2; - SimpleTypes::COnOff<> m_oAca; - SimpleTypes::COnOff<> m_oBx; - SimpleTypes::COnOff<> m_oCa; - SimpleTypes::COnOff<> m_oDel1; - SimpleTypes::COnOff<> m_oDel2; - SimpleTypes::COnOff<> m_oDt2D; - SimpleTypes::COnOff<> m_oDtr; + SimpleTypes::COnOff m_oAca; + SimpleTypes::COnOff m_oBx; + SimpleTypes::COnOff m_oCa; + SimpleTypes::COnOff m_oDel1; + SimpleTypes::COnOff m_oDel2; + SimpleTypes::COnOff m_oDt2D; + SimpleTypes::COnOff m_oDtr; protected: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); }; @@ -90,8 +90,8 @@ namespace OOX _UINT32 m_nCol; _UINT32 m_nStyle; - SimpleTypes::Spreadsheet::CCellTypeType m_oType; - SimpleTypes::COnOff<> m_oShowPhonetic; + SimpleTypes::Spreadsheet::CCellTypeType m_oType; + SimpleTypes::COnOff m_oShowPhonetic; CTextXLSB m_oValue; CFormulaXLSB m_oFormula; @@ -109,15 +109,15 @@ namespace OOX public: _UINT32 m_nR; _UINT32 m_nS; - SimpleTypes::COnOff<> m_oCustomFormat; + SimpleTypes::COnOff m_oCustomFormat; double m_dHt; - SimpleTypes::COnOff<> m_oHidden; - SimpleTypes::COnOff<> m_oCustomHeight; + SimpleTypes::COnOff m_oHidden; + SimpleTypes::COnOff m_oCustomHeight; BYTE m_nOutlineLevel; - SimpleTypes::COnOff<> m_oCollapsed; - SimpleTypes::COnOff<> m_oThickBot; - SimpleTypes::COnOff<> m_oThickTop; - SimpleTypes::COnOff<> m_oPh; + SimpleTypes::COnOff m_oCollapsed; + SimpleTypes::COnOff m_oThickBot; + SimpleTypes::COnOff m_oThickTop; + SimpleTypes::COnOff m_oPh; protected: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); }; @@ -177,25 +177,26 @@ namespace OOX WritingElement_ReadAttributes_Read_else_ifChar ( oReader, "r2", m_oR2 ) WritingElement_ReadAttributes_Read_else_ifChar ( oReader, "ref", m_oRef ) - WritingElement_ReadAttributes_EndChar( oReader ) + WritingElement_ReadAttributes_EndChar( oReader ) } public: - nullable> m_oAca; - nullable> m_oBx; - nullable> m_oCa; - nullable> m_oDel1; - nullable> m_oDel2; - nullable> m_oDt2D; - nullable> m_oDtr; + nullable m_oAca; + nullable m_oBx; + nullable m_oCa; + nullable m_oDel1; + nullable m_oDel2; + nullable m_oDt2D; + nullable m_oDtr; nullable m_oR1; nullable m_oR2; nullable m_oRef; - nullable> m_oSi; - nullable> m_oT; + nullable m_oSi; + nullable m_oT; std::wstring m_sText; }; + class CData : public WritingElement { public: @@ -237,7 +238,7 @@ namespace OOX public: - nullable> m_oType; + nullable m_oType; nullable m_oRichText; nullable m_oValue; }; @@ -396,11 +397,11 @@ namespace OOX nullable_int iAcross; nullable_int iDown; public: - nullable> m_oCellMetadata; - nullable> m_oShowPhonetic; + nullable m_oCellMetadata; + nullable m_oShowPhonetic; nullable_uint m_oStyle; - nullable> m_oType; - nullable> m_oValueMetadata; + nullable m_oType; + nullable m_oValueMetadata; nullable m_oRef; nullable_uint m_oRow; @@ -465,17 +466,17 @@ namespace OOX void CheckIndex(); public: - nullable> m_oCollapsed; - nullable> m_oCustomFormat; - nullable> m_oCustomHeight; - nullable> m_oHidden; + nullable m_oCollapsed; + nullable m_oCustomFormat; + nullable m_oCustomHeight; + nullable m_oHidden; nullable m_oHt; - nullable> m_oOutlineLevel; - nullable> m_oPh; - nullable> m_oR; - nullable> m_oS; - nullable> m_oThickBot; - nullable> m_oThickTop; + nullable m_oOutlineLevel; + nullable m_oPh; + nullable m_oR; + nullable m_oS; + nullable m_oThickBot; + nullable m_oThickTop; nullable m_oDyDescent; }; @@ -527,7 +528,7 @@ namespace OOX return et_x_SheetData; } - nullable> m_oXlsbPos; + nullable m_oXlsbPos; std::map> m_mapStyleMerges2003; // map(row, map(col, style)) void StyleFromMapStyleMerges2003(std::map &mapStyleMerges); diff --git a/Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h index d86359ad2a..c78affe20a 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h @@ -533,23 +533,23 @@ namespace OOX public: - nullable m_oManualMax; - nullable m_oManualMin; - nullable m_oLineWeight; - nullable> m_oType; - nullable> m_oDateAxis; - nullable m_oDisplayEmptyCellsAs; - nullable> m_oMarkers; - nullable> m_oHigh; - nullable> m_oLow; - nullable> m_oFirst; - nullable> m_oLast; - nullable> m_oNegative; - nullable> m_oDisplayXAxis; - nullable> m_oDisplayHidden; - nullable> m_oMinAxisType; - nullable> m_oMaxAxisType; - nullable> m_oRightToLeft; + nullable m_oManualMax; + nullable m_oManualMin; + nullable m_oLineWeight; + nullable m_oType; + nullable m_oDateAxis; + nullable m_oDisplayEmptyCellsAs; + nullable m_oMarkers; + nullable m_oHigh; + nullable m_oLow; + nullable m_oFirst; + nullable m_oLast; + nullable m_oNegative; + nullable m_oDisplayXAxis; + nullable m_oDisplayHidden; + nullable m_oMinAxisType; + nullable m_oMaxAxisType; + nullable m_oRightToLeft; nullable m_oColorSeries; nullable m_oColorNegative; 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/Worksheets/WorksheetChildOther.h b/Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h index edc91040a1..7811902f8f 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h +++ b/Common/DocxFormat/Source/XlsxFormat/Worksheets/WorksheetChildOther.h @@ -190,8 +190,8 @@ namespace OOX if (desc.IsInit()) m_arSecurityDescriptors.push_back(*desc); } - nullable> m_oAlgorithmName; - nullable> m_oSpinCount; + nullable m_oAlgorithmName; + nullable m_oSpinCount; nullable_string m_oHashValue; nullable_string m_oSaltValue; nullable_string m_oName; @@ -624,26 +624,26 @@ namespace OOX } } } - nullable> m_oBlackAndWhite; - nullable> m_oCellComments; - nullable> m_oCopies; - nullable> m_oDraft; - nullable> m_oErrors; - nullable> m_oFirstPageNumber; - nullable> m_oFitToHeight; - nullable> m_oFitToWidth; - nullable> m_oHorizontalDpi; + nullable m_oBlackAndWhite; + nullable m_oCellComments; + nullable m_oCopies; + nullable m_oDraft; + nullable m_oErrors; + nullable m_oFirstPageNumber; + nullable m_oFitToHeight; + nullable m_oFitToWidth; + nullable m_oHorizontalDpi; nullable m_oRId; - nullable> m_oOrientation; - nullable> m_oPageOrder; + nullable m_oOrientation; + nullable m_oPageOrder; nullable m_oPaperHeight; - nullable> m_oPaperSize; + nullable m_oPaperSize; nullable m_oPaperWidth; - nullable> m_oPaperUnits; - nullable> m_oScale; - nullable> m_oUseFirstPageNumber; - nullable> m_oUsePrinterDefaults; - nullable> m_oVerticalDpi; + nullable m_oPaperUnits; + nullable m_oScale; + nullable m_oUseFirstPageNumber; + nullable m_oUsePrinterDefaults; + nullable m_oVerticalDpi; }; class CPrintOptions : public WritingElement { @@ -716,11 +716,11 @@ namespace OOX } public: - nullable> m_oGridLines; - nullable> m_oGridLinesSet; - nullable> m_oHeadings; - nullable> m_oHorizontalCentered; - nullable> m_oVerticalCentered; + nullable m_oGridLines; + nullable m_oGridLinesSet; + nullable m_oHeadings; + nullable m_oHorizontalCentered; + nullable m_oVerticalCentered; }; class CDimension : public WritingElement { @@ -964,11 +964,11 @@ namespace OOX public: - nullable> m_oActivePane; - nullable> m_oState; - nullable_string m_oTopLeftCell; - nullable m_oXSplit; - nullable m_oYSplit; + nullable m_oActivePane; + nullable m_oState; + nullable_string m_oTopLeftCell; + nullable m_oXSplit; + nullable m_oYSplit; }; class CSelection : public WritingElement { @@ -1045,9 +1045,9 @@ namespace OOX public: nullable_string m_oActiveCell; - nullable> m_oActiveCellId; + nullable m_oActiveCellId; nullable_string m_oSqref; - nullable> m_oPane; + nullable m_oPane; }; //необработано: @@ -1232,25 +1232,25 @@ namespace OOX public: nullable m_oPane; - nullable> m_oColorId; - nullable> m_oDefaultGridColor; - nullable> m_oRightToLeft; - nullable> m_oShowFormulas; - nullable> m_oShowGridLines; - nullable> m_oShowOutlineSymbols; - nullable> m_oShowRowColHeaders; - nullable> m_oShowRuler; - nullable> m_oShowWhiteSpace; - nullable> m_oShowZeros; - nullable> m_oTabSelected; + nullable m_oColorId; + nullable m_oDefaultGridColor; + nullable m_oRightToLeft; + nullable m_oShowFormulas; + nullable m_oShowGridLines; + nullable m_oShowOutlineSymbols; + nullable m_oShowRowColHeaders; + nullable m_oShowRuler; + nullable m_oShowWhiteSpace; + nullable m_oShowZeros; + nullable m_oTabSelected; nullable_string m_oTopLeftCell; - nullable>m_oView; - nullable> m_oWindowProtection; - nullable> m_oWorkbookViewId; - nullable> m_oZoomScale; - nullable> m_oZoomScaleNormal; - nullable> m_oZoomScalePageLayoutView; - nullable> m_oZoomScaleSheetLayoutView; + nullable m_oView; + nullable m_oWindowProtection; + nullable m_oWorkbookViewId; + nullable m_oZoomScale; + nullable m_oZoomScaleNormal; + nullable m_oZoomScalePageLayoutView; + nullable m_oZoomScaleSheetLayoutView; }; class CSheetViews : public WritingElementWithChilds { @@ -1390,8 +1390,8 @@ namespace OOX } public: - nullable> m_oAutoPageBreaks; - nullable> m_oFitToPage; + nullable m_oAutoPageBreaks; + nullable m_oFitToPage; }; class COutlinePr : public WritingElement { @@ -1460,10 +1460,10 @@ namespace OOX } public: - nullable> m_oApplyStyles; - nullable> m_oShowOutlineSymbols; - nullable> m_oSummaryBelow; - nullable> m_oSummaryRight; + nullable m_oApplyStyles; + nullable m_oShowOutlineSymbols; + nullable m_oSummaryBelow; + nullable m_oSummaryRight; }; class CSheetPr : public WritingElement { @@ -1609,14 +1609,14 @@ namespace OOX nullable m_oOutlinePr; nullable_string m_oCodeName; - nullable> m_oEnableFormatConditionsCalculation; - nullable> m_oFilterMode; - nullable> m_oPublished; - nullable> m_oSyncHorizontal; + nullable m_oEnableFormatConditionsCalculation; + nullable m_oFilterMode; + nullable m_oPublished; + nullable m_oSyncHorizontal; nullable_string m_oSyncRef; - nullable> m_oSyncVertical; - nullable> m_oTransitionEntry; - nullable> m_oTransitionEvaluation; + nullable m_oSyncVertical; + nullable m_oTransitionEntry; + nullable m_oTransitionEvaluation; }; class CHeaderFooterElement : public WritingElement { @@ -1833,10 +1833,10 @@ namespace OOX nullable m_oOddFooter; nullable m_oOddHeader; - nullable> m_oAlignWithMargins; - nullable> m_oDifferentFirst; - nullable> m_oDifferentOddEven; - nullable> m_oScaleWithDoc; + nullable m_oAlignWithMargins; + nullable m_oDifferentFirst; + nullable m_oDifferentOddEven; + nullable m_oScaleWithDoc; }; @@ -1935,24 +1935,24 @@ namespace OOX } public: nullable m_oId; - nullable> m_oCfe; - nullable> m_oCff; - nullable> m_oCfo; - nullable> m_oChe; - nullable> m_oChf; - nullable> m_oCho; - nullable> m_oLfe; - nullable> m_oLff; - nullable> m_oLfo; - nullable> m_oLhe; - nullable> m_oLhf; - nullable> m_oLho; - nullable> m_oRfe; - nullable> m_oRff; - nullable> m_oRfo; - nullable> m_oRhe; - nullable> m_oRhf; - nullable> m_oRho; + nullable m_oCfe; + nullable m_oCff; + nullable m_oCfo; + nullable m_oChe; + nullable m_oChf; + nullable m_oCho; + nullable m_oLfe; + nullable m_oLff; + nullable m_oLfo; + nullable m_oLhe; + nullable m_oLhf; + nullable m_oLho; + nullable m_oRfe; + nullable m_oRff; + nullable m_oRfo; + nullable m_oRhe; + nullable m_oRhf; + nullable m_oRho; }; class CPictureWorksheet : public WritingElement @@ -2091,11 +2091,11 @@ namespace OOX } public: - nullable> m_oId; - nullable> m_oMan; - nullable> m_oMax; - nullable> m_oMin; - nullable> m_oPt; + nullable m_oId; + nullable m_oMan; + nullable m_oMax; + nullable m_oMin; + nullable m_oPt; }; class CRowColBreaks : public WritingElementWithChilds @@ -2215,8 +2215,8 @@ namespace OOX } public: - nullable> m_oCount; - nullable> m_oManualBreakCount; + nullable m_oCount; + nullable m_oManualBreakCount; }; class CSheetProtection : public WritingElement { @@ -2393,29 +2393,29 @@ namespace OOX } - nullable> m_oAlgorithmName; - nullable> m_oSpinCount; + nullable m_oAlgorithmName; + nullable m_oSpinCount; nullable_string m_oHashValue; nullable_string m_oSaltValue; nullable_string m_oPassword; //for old wrike protection - nullable> m_oAutoFilter; - nullable> m_oContent; - nullable> m_oDeleteColumns; - nullable> m_oDeleteRows; - nullable> m_oFormatCells; - nullable> m_oFormatColumns; - nullable> m_oFormatRows; - nullable> m_oInsertColumns; - nullable> m_oInsertHyperlinks; - nullable> m_oInsertRows; - nullable> m_oObjects; - nullable> m_oPivotTables; - nullable> m_oScenarios; - nullable> m_oSelectLockedCells; - nullable> m_oSelectUnlockedCells; - nullable> m_oSheet; - nullable> m_oSort; + nullable m_oAutoFilter; + nullable m_oContent; + nullable m_oDeleteColumns; + nullable m_oDeleteRows; + nullable m_oFormatCells; + nullable m_oFormatColumns; + nullable m_oFormatRows; + nullable m_oInsertColumns; + nullable m_oInsertHyperlinks; + nullable m_oInsertRows; + nullable m_oObjects; + nullable m_oPivotTables; + nullable m_oScenarios; + nullable m_oSelectLockedCells; + nullable m_oSelectUnlockedCells; + nullable m_oSheet; + nullable m_oSort; }; class CDataRef : public WritingElement { @@ -2565,7 +2565,7 @@ namespace OOX } public: - nullable> m_oCount; + nullable m_oCount; }; class CDataConsolidate : public WritingElement { @@ -2646,10 +2646,10 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if ( oReader, (L"topLabels"), m_oTopLabels) WritingElement_ReadAttributes_End( oReader ) } - nullable> m_oFunction; - nullable> m_oLink; - nullable> m_oStartLabels; - nullable> m_oTopLabels; + nullable m_oFunction; + nullable m_oLink; + nullable m_oStartLabels; + nullable m_oTopLabels; nullable m_oDataRefs; 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/ASCVariant.h b/DesktopEditor/common/ASCVariant.h index 94d05dac82..88a4dde955 100644 --- a/DesktopEditor/common/ASCVariant.h +++ b/DesktopEditor/common/ASCVariant.h @@ -32,7 +32,7 @@ #pragma once #include "Types.h" -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include @@ -62,8 +62,8 @@ struct ASC_VARIANT ASC_VARTYPE vt; - _INT64 llVal; - _INT32 lVal; + _INT64 llVal; + _INT32 lVal; BYTE bVal; SHORT iVal; FLOAT fltVal; diff --git a/DesktopEditor/common/File.cpp b/DesktopEditor/common/File.cpp index 3e7be6cbf0..c2f58cd798 100644 --- a/DesktopEditor/common/File.cpp +++ b/DesktopEditor/common/File.cpp @@ -35,8 +35,8 @@ #include "errno.h" #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - #include - #include +#include +#include #endif #ifdef _LINUX @@ -46,7 +46,7 @@ #endif #ifdef _IOS - const char* fileSystemRepresentation(const std::wstring& sFileName); +const char* fileSystemRepresentation(const std::wstring& sFileName); #endif #ifdef _MAC @@ -54,7 +54,7 @@ #endif #ifndef MAX_PATH - #define MAX_PATH 1024 +#define MAX_PATH 1024 #endif #define READ_WRITE_FULL_BUFFER_SIZE 10000000 // 10mb @@ -79,1691 +79,1788 @@ std::wstring g_overrideTmpPath = L""; #include "File.h" #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - #include - #include +#include +#include - std::wstring CorrectPathW(const std::wstring& path) - { - int len = (int)path.length(); - if (2 > len) - return path; - - const wchar_t* path_str = path.c_str(); - if (path_str[0] == '\\' || path_str[1] == '/') - return path; - - // local files: '\\?\' prefix - // server files: '\\?\UNC\' prefix <== TODO! - int nLen = GetFullPathNameW(path_str, 0, 0, 0); - wchar_t* pBuf = new wchar_t[(4 + nLen) * sizeof(wchar_t)]; - - pBuf[0] = L'\\', pBuf[1] = L'\\', pBuf[2] = L'?', pBuf[3] = L'\\'; - GetFullPathNameW(path_str, nLen, pBuf + 4, NULL); - - std::wstring retPath(pBuf); - delete [] pBuf; - return retPath; - } -#else - std::wstring CorrectPathW(const std::wstring& path) - { +std::wstring CorrectPathW(const std::wstring& path) +{ + int len = (int)path.length(); + if (2 > len) return path; - } + + const wchar_t* path_str = path.c_str(); + if (path_str[0] == '\\' || path_str[1] == '/') + return path; + + // local files: '\\?\' prefix + // server files: '\\?\UNC\' prefix <== TODO! + int nLen = GetFullPathNameW(path_str, 0, 0, 0); + wchar_t* pBuf = new wchar_t[(4 + nLen) * sizeof(wchar_t)]; + + pBuf[0] = L'\\', pBuf[1] = L'\\', pBuf[2] = L'?', pBuf[3] = L'\\'; + GetFullPathNameW(path_str, nLen, pBuf + 4, NULL); + + std::wstring retPath(pBuf); + delete [] pBuf; + return retPath; +} +#else +std::wstring CorrectPathW(const std::wstring& path) +{ + return path; +} #endif namespace NSFile { - std::wstring CUtf8Converter::GetUnicodeFromCharPtr(const char* pData, LONG lCount, INT bIsUtf8) - { - if (bIsUtf8) - return GetUnicodeStringFromUTF8((BYTE*)pData, lCount); + std::wstring CUtf8Converter::GetUnicodeFromCharPtr(const char* pData, LONG lCount, INT bIsUtf8) + { + if (bIsUtf8) + return GetUnicodeStringFromUTF8((BYTE*)pData, lCount); - wchar_t* pUnicode = new wchar_t[lCount + 1]; - for (LONG i = 0; i < lCount; ++i) - pUnicode[i] = (wchar_t)(BYTE)pData[i]; + wchar_t* pUnicode = new wchar_t[lCount + 1]; + for (LONG i = 0; i < lCount; ++i) + pUnicode[i] = (wchar_t)(BYTE)pData[i]; - pUnicode[lCount] = 0; + pUnicode[lCount] = 0; - std::wstring s(pUnicode, lCount); - RELEASEARRAYOBJECTS(pUnicode); + std::wstring s(pUnicode, lCount); + RELEASEARRAYOBJECTS(pUnicode); - return s; - } - std::wstring CUtf8Converter::GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8) - { - return GetUnicodeFromCharPtr(sParam.c_str(), (LONG)sParam.length(), bIsUtf8); - } + return s; + } + std::wstring CUtf8Converter::GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8) + { + return GetUnicodeFromCharPtr(sParam.c_str(), (LONG)sParam.length(), bIsUtf8); + } LONG CUtf8Converter::GetUnicodeStringFromUTF8BufferSize(LONG lCount) - { - return lCount + 1; - } - std::wstring CUtf8Converter::GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount ) - { - std::wstring strRes; - GetUnicodeStringFromUTF8_4bytes(pBuffer, lCount, strRes); - return strRes; - } - std::wstring CUtf8Converter::GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount ) - { - std::wstring strRes; - GetUnicodeStringFromUTF8_2bytes(pBuffer, lCount, strRes); - return strRes; - } + { + return lCount + 1; + } + std::wstring CUtf8Converter::GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount ) + { + std::wstring strRes; + GetUnicodeStringFromUTF8_4bytes(pBuffer, lCount, strRes); + return strRes; + } + std::wstring CUtf8Converter::GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount ) + { + std::wstring strRes; + GetUnicodeStringFromUTF8_2bytes(pBuffer, lCount, strRes); + return strRes; + } - std::wstring CUtf8Converter::GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount ) - { - std::wstring strRes; - GetUnicodeStringFromUTF8(pBuffer, lCount, strRes); - return strRes; - } + std::wstring CUtf8Converter::GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount ) + { + std::wstring strRes; + GetUnicodeStringFromUTF8(pBuffer, lCount, strRes); + return strRes; + } - void CUtf8Converter::GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ) - { - WCHAR* pUnicodeString = new WCHAR[lCount + 1]; - LONG lIndexUnicode = 0; + void CUtf8Converter::GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ) + { + WCHAR* pUnicodeString = new WCHAR[lCount + 1]; + LONG lIndexUnicode = 0; - LONG lIndex = 0; - while (lIndex < lCount) - { - BYTE byteMain = pBuffer[lIndex]; - if (0x00 == (byteMain & 0x80)) - { - // 1 byte - pUnicodeString[lIndexUnicode++] = (WCHAR)byteMain; - ++lIndex; - } - else if (0x00 == (byteMain & 0x20)) - { - // 2 byte - int val = 0; - if ((lIndex + 1) < lCount) - { - val = (int)(((byteMain & 0x1F) << 6) | - (pBuffer[lIndex + 1] & 0x3F)); - } + LONG lIndex = 0; + while (lIndex < lCount) + { + BYTE byteMain = pBuffer[lIndex]; + if (0x00 == (byteMain & 0x80)) + { + // 1 byte + pUnicodeString[lIndexUnicode++] = (WCHAR)byteMain; + ++lIndex; + } + else if (0x00 == (byteMain & 0x20)) + { + // 2 byte + int val = 0; + if ((lIndex + 1) < lCount) + { + val = (int)(((byteMain & 0x1F) << 6) | + (pBuffer[lIndex + 1] & 0x3F)); + } - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 2; - } - else if (0x00 == (byteMain & 0x10)) - { - // 3 byte - int val = 0; - if ((lIndex + 2) < lCount) - { - val = (int)(((byteMain & 0x0F) << 12) | - ((pBuffer[lIndex + 1] & 0x3F) << 6) | - (pBuffer[lIndex + 2] & 0x3F)); - } + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 2; + } + else if (0x00 == (byteMain & 0x10)) + { + // 3 byte + int val = 0; + if ((lIndex + 2) < lCount) + { + val = (int)(((byteMain & 0x0F) << 12) | + ((pBuffer[lIndex + 1] & 0x3F) << 6) | + (pBuffer[lIndex + 2] & 0x3F)); + } - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 3; - } - else if (0x00 == (byteMain & 0x0F)) - { - // 4 byte - int val = 0; - if ((lIndex + 3) < lCount) - { - val = (int)(((byteMain & 0x07) << 18) | - ((pBuffer[lIndex + 1] & 0x3F) << 12) | - ((pBuffer[lIndex + 2] & 0x3F) << 6) | - (pBuffer[lIndex + 3] & 0x3F)); - } + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 3; + } + else if (0x00 == (byteMain & 0x0F)) + { + // 4 byte + int val = 0; + if ((lIndex + 3) < lCount) + { + val = (int)(((byteMain & 0x07) << 18) | + ((pBuffer[lIndex + 1] & 0x3F) << 12) | + ((pBuffer[lIndex + 2] & 0x3F) << 6) | + (pBuffer[lIndex + 3] & 0x3F)); + } - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 4; - } - else if (0x00 == (byteMain & 0x08)) - { - // 4 byte - int val = 0; - if ((lIndex + 3) < lCount) - { - val = (int)(((byteMain & 0x07) << 18) | - ((pBuffer[lIndex + 1] & 0x3F) << 12) | - ((pBuffer[lIndex + 2] & 0x3F) << 6) | - (pBuffer[lIndex + 3] & 0x3F)); - } + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 4; + } + else if (0x00 == (byteMain & 0x08)) + { + // 4 byte + int val = 0; + if ((lIndex + 3) < lCount) + { + val = (int)(((byteMain & 0x07) << 18) | + ((pBuffer[lIndex + 1] & 0x3F) << 12) | + ((pBuffer[lIndex + 2] & 0x3F) << 6) | + (pBuffer[lIndex + 3] & 0x3F)); + } - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 4; - } - else if (0x00 == (byteMain & 0x04)) - { - // 5 byte - int val = 0; - if ((lIndex + 4) < lCount) - { - val = (int)(((byteMain & 0x03) << 24) | - ((pBuffer[lIndex + 1] & 0x3F) << 18) | - ((pBuffer[lIndex + 2] & 0x3F) << 12) | - ((pBuffer[lIndex + 3] & 0x3F) << 6) | - (pBuffer[lIndex + 4] & 0x3F)); - } + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 4; + } + else if (0x00 == (byteMain & 0x04)) + { + // 5 byte + int val = 0; + if ((lIndex + 4) < lCount) + { + val = (int)(((byteMain & 0x03) << 24) | + ((pBuffer[lIndex + 1] & 0x3F) << 18) | + ((pBuffer[lIndex + 2] & 0x3F) << 12) | + ((pBuffer[lIndex + 3] & 0x3F) << 6) | + (pBuffer[lIndex + 4] & 0x3F)); + } - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 5; - } - else - { - // 6 byte - int val = 0; - if ((lIndex + 5) < lCount) - { - val = (int)(((byteMain & 0x01) << 30) | - ((pBuffer[lIndex + 1] & 0x3F) << 24) | - ((pBuffer[lIndex + 2] & 0x3F) << 18) | - ((pBuffer[lIndex + 3] & 0x3F) << 12) | - ((pBuffer[lIndex + 4] & 0x3F) << 6) | - (pBuffer[lIndex + 5] & 0x3F)); - } + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 5; + } + else + { + // 6 byte + int val = 0; + if ((lIndex + 5) < lCount) + { + val = (int)(((byteMain & 0x01) << 30) | + ((pBuffer[lIndex + 1] & 0x3F) << 24) | + ((pBuffer[lIndex + 2] & 0x3F) << 18) | + ((pBuffer[lIndex + 3] & 0x3F) << 12) | + ((pBuffer[lIndex + 4] & 0x3F) << 6) | + (pBuffer[lIndex + 5] & 0x3F)); + } - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 5; - } - } + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 5; + } + } - pUnicodeString[lIndexUnicode] = 0; + pUnicodeString[lIndexUnicode] = 0; - sOutput.append(pUnicodeString); + sOutput.append(pUnicodeString); - delete [] pUnicodeString; - } - void CUtf8Converter::GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ) - { - WCHAR* pUnicodeString = new WCHAR[lCount + 1]; - WCHAR* pStart = pUnicodeString; + delete [] pUnicodeString; + } + void CUtf8Converter::GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ) + { + WCHAR* pUnicodeString = new WCHAR[lCount + 1]; + WCHAR* pStart = pUnicodeString; - LONG lIndex = 0; - while (lIndex < lCount) - { - BYTE byteMain = pBuffer[lIndex]; - if (0x00 == (byteMain & 0x80)) - { - // 1 byte - *pUnicodeString++ = (WCHAR)byteMain; - ++lIndex; - } - else if (0x00 == (byteMain & 0x20)) - { - // 2 byte - int val = 0; - if ((lIndex + 1) < lCount) - { - val = (int)(((byteMain & 0x1F) << 6) | - (pBuffer[lIndex + 1] & 0x3F)); - } + LONG lIndex = 0; + while (lIndex < lCount) + { + BYTE byteMain = pBuffer[lIndex]; + if (0x00 == (byteMain & 0x80)) + { + // 1 byte + *pUnicodeString++ = (WCHAR)byteMain; + ++lIndex; + } + else if (0x00 == (byteMain & 0x20)) + { + // 2 byte + int val = 0; + if ((lIndex + 1) < lCount) + { + val = (int)(((byteMain & 0x1F) << 6) | + (pBuffer[lIndex + 1] & 0x3F)); + } - *pUnicodeString++ = (WCHAR)(val); - lIndex += 2; - } - else if (0x00 == (byteMain & 0x10)) - { - // 3 byte - int val = 0; - if ((lIndex + 2) < lCount) - { - val = (int)(((byteMain & 0x0F) << 12) | - ((pBuffer[lIndex + 1] & 0x3F) << 6) | - (pBuffer[lIndex + 2] & 0x3F)); - } + *pUnicodeString++ = (WCHAR)(val); + lIndex += 2; + } + else if (0x00 == (byteMain & 0x10)) + { + // 3 byte + int val = 0; + if ((lIndex + 2) < lCount) + { + val = (int)(((byteMain & 0x0F) << 12) | + ((pBuffer[lIndex + 1] & 0x3F) << 6) | + (pBuffer[lIndex + 2] & 0x3F)); + } - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 3; - } - else if (0x00 == (byteMain & 0x0F)) - { - // 4 byte - int val = 0; - if ((lIndex + 3) < lCount) - { - val = (int)(((byteMain & 0x07) << 18) | - ((pBuffer[lIndex + 1] & 0x3F) << 12) | - ((pBuffer[lIndex + 2] & 0x3F) << 6) | - (pBuffer[lIndex + 3] & 0x3F)); - } + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 3; + } + else if (0x00 == (byteMain & 0x0F)) + { + // 4 byte + int val = 0; + if ((lIndex + 3) < lCount) + { + val = (int)(((byteMain & 0x07) << 18) | + ((pBuffer[lIndex + 1] & 0x3F) << 12) | + ((pBuffer[lIndex + 2] & 0x3F) << 6) | + (pBuffer[lIndex + 3] & 0x3F)); + } - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 4; - } - else if (0x00 == (byteMain & 0x08)) - { - // 4 byte - int val = 0; - if ((lIndex + 3) < lCount) - { - val = (int)(((byteMain & 0x07) << 18) | - ((pBuffer[lIndex + 1] & 0x3F) << 12) | - ((pBuffer[lIndex + 2] & 0x3F) << 6) | - (pBuffer[lIndex + 3] & 0x3F)); - } + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 4; + } + else if (0x00 == (byteMain & 0x08)) + { + // 4 byte + int val = 0; + if ((lIndex + 3) < lCount) + { + val = (int)(((byteMain & 0x07) << 18) | + ((pBuffer[lIndex + 1] & 0x3F) << 12) | + ((pBuffer[lIndex + 2] & 0x3F) << 6) | + (pBuffer[lIndex + 3] & 0x3F)); + } - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 4; - } - else if (0x00 == (byteMain & 0x04)) - { - // 5 byte - int val = 0; - if ((lIndex + 4) < lCount) - { - val = (int)(((byteMain & 0x03) << 24) | - ((pBuffer[lIndex + 1] & 0x3F) << 18) | - ((pBuffer[lIndex + 2] & 0x3F) << 12) | - ((pBuffer[lIndex + 3] & 0x3F) << 6) | - (pBuffer[lIndex + 4] & 0x3F)); - } + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 4; + } + else if (0x00 == (byteMain & 0x04)) + { + // 5 byte + int val = 0; + if ((lIndex + 4) < lCount) + { + val = (int)(((byteMain & 0x03) << 24) | + ((pBuffer[lIndex + 1] & 0x3F) << 18) | + ((pBuffer[lIndex + 2] & 0x3F) << 12) | + ((pBuffer[lIndex + 3] & 0x3F) << 6) | + (pBuffer[lIndex + 4] & 0x3F)); + } - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 5; - } - else - { - // 6 byte - int val = 0; - if ((lIndex + 5) < lCount) - { - val = (int)(((byteMain & 0x01) << 30) | - ((pBuffer[lIndex + 1] & 0x3F) << 24) | - ((pBuffer[lIndex + 2] & 0x3F) << 18) | - ((pBuffer[lIndex + 3] & 0x3F) << 12) | - ((pBuffer[lIndex + 4] & 0x3F) << 6) | - (pBuffer[lIndex + 5] & 0x3F)); - } + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 5; + } + else + { + // 6 byte + int val = 0; + if ((lIndex + 5) < lCount) + { + val = (int)(((byteMain & 0x01) << 30) | + ((pBuffer[lIndex + 1] & 0x3F) << 24) | + ((pBuffer[lIndex + 2] & 0x3F) << 18) | + ((pBuffer[lIndex + 3] & 0x3F) << 12) | + ((pBuffer[lIndex + 4] & 0x3F) << 6) | + (pBuffer[lIndex + 5] & 0x3F)); + } - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 5; - } - } + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 5; + } + } - *pUnicodeString++ = 0; + *pUnicodeString++ = 0; - sOutput.append(pStart); + sOutput.append(pStart); - delete [] pStart; - } - void CUtf8Converter::GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ) - { - if (sizeof(WCHAR) == 2) - GetUnicodeStringFromUTF8_2bytes(pBuffer, lCount, sOutput); - else - GetUnicodeStringFromUTF8_4bytes(pBuffer, lCount, sOutput); - } + delete [] pStart; + } + void CUtf8Converter::GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ) + { + if (sizeof(WCHAR) == 2) + GetUnicodeStringFromUTF8_2bytes(pBuffer, lCount, sOutput); + else + GetUnicodeStringFromUTF8_4bytes(pBuffer, lCount, sOutput); + } #define CHECK_HHHH(pBuffer) \ - wchar_t code = 0; \ - if('_' == pBuffer[0] && 'x' == pBuffer[1] && 0 != pBuffer[2] && 0 != pBuffer[3] && 0 != pBuffer[4] && 0 != pBuffer[5] && '_' == pBuffer[6]) \ - { \ - int i = 2; \ - for(; i < 6; ++i) \ - { \ - code *= 16; \ - if('0' <= pBuffer[i] && pBuffer[i] <= '9') \ - { \ - code += pBuffer[i] - '0'; \ - } \ - else if('A' <= pBuffer[i] && pBuffer[i] <= 'F') \ - { \ - code += pBuffer[i] - 'A' + 10; \ - } \ - else if('a' <= pBuffer[i] && pBuffer[i] <= 'f') \ - { \ - code += pBuffer[i] - 'a' + 10; \ - } \ - else \ - { \ - break; \ - } \ - } \ - if(i == 6) \ - { \ - if(0x005F == code) \ - { \ - code = '_'; \ - } \ - return code; \ - } \ - } \ - return -1; + wchar_t code = 0; \ + if('_' == pBuffer[0] && 'x' == pBuffer[1] && 0 != pBuffer[2] && 0 != pBuffer[3] && 0 != pBuffer[4] && 0 != pBuffer[5] && '_' == pBuffer[6]) \ + { \ + int i = 2; \ + for(; i < 6; ++i) \ + { \ + code *= 16; \ + if('0' <= pBuffer[i] && pBuffer[i] <= '9') \ + { \ + code += pBuffer[i] - '0'; \ +} \ + else if('A' <= pBuffer[i] && pBuffer[i] <= 'F') \ + { \ + code += pBuffer[i] - 'A' + 10; \ +} \ + else if('a' <= pBuffer[i] && pBuffer[i] <= 'f') \ + { \ + code += pBuffer[i] - 'a' + 10; \ +} \ + else \ + { \ + break; \ +} \ +} \ + if(i == 6) \ + { \ + if(0x005F == code) \ + { \ + code = '_'; \ +} \ + return code; \ +} \ +} \ + return -1; - long CUtf8Converter::CheckHHHHChar(const BYTE* pBuffer) + long CUtf8Converter::CheckHHHHChar(const BYTE* pBuffer) { - CHECK_HHHH(pBuffer); + CHECK_HHHH(pBuffer); } - long CUtf8Converter::CheckHHHHChar(const wchar_t* pBuffer) + long CUtf8Converter::CheckHHHHChar(const wchar_t* pBuffer) { - CHECK_HHHH(pBuffer); + CHECK_HHHH(pBuffer); } - void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ) - { - if (NULL == pUnicodes) - { - pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)]; - } - WCHAR* pUnicodeString = pUnicodes; - LONG lIndexUnicode = 0; + void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ) + { + if (NULL == pUnicodes) + { + pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)]; + } + WCHAR* pUnicodeString = pUnicodes; + LONG lIndexUnicode = 0; - LONG lIndex = 0; - while (lIndex < lCount) - { - BYTE byteMain = pBuffer[lIndex]; - if (0x00 == (byteMain & 0x80)) - { + LONG lIndex = 0; + while (lIndex < lCount) + { + BYTE byteMain = pBuffer[lIndex]; + if (0x00 == (byteMain & 0x80)) + { // 1 byte - long code = CheckHHHHChar(pBuffer + lIndex); - if(code < 0) - { + long code = CheckHHHHChar(pBuffer + lIndex); + if(code < 0) + { pUnicodeString[lIndexUnicode++] = (WCHAR)byteMain; ++lIndex; } - else - { - pUnicodeString[lIndexUnicode++] = (WCHAR)code; - lIndex += 7; - } - } - else if (0x00 == (byteMain & 0x20)) - { - // 2 byte - int val = (int)(((byteMain & 0x1F) << 6) | - (pBuffer[lIndex + 1] & 0x3F)); - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 2; - } - else if (0x00 == (byteMain & 0x10)) - { - // 3 byte - int val = (int)(((byteMain & 0x0F) << 12) | - ((pBuffer[lIndex + 1] & 0x3F) << 6) | - (pBuffer[lIndex + 2] & 0x3F)); - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 3; - } - else if (0x00 == (byteMain & 0x0F)) - { - // 4 byte - int val = (int)(((byteMain & 0x07) << 18) | - ((pBuffer[lIndex + 1] & 0x3F) << 12) | - ((pBuffer[lIndex + 2] & 0x3F) << 6) | - (pBuffer[lIndex + 3] & 0x3F)); - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 4; - } - else if (0x00 == (byteMain & 0x08)) - { - // 4 byte - int val = (int)(((byteMain & 0x07) << 18) | - ((pBuffer[lIndex + 1] & 0x3F) << 12) | - ((pBuffer[lIndex + 2] & 0x3F) << 6) | - (pBuffer[lIndex + 3] & 0x3F)); - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 4; - } - else if (0x00 == (byteMain & 0x04)) - { - // 5 byte - int val = (int)(((byteMain & 0x03) << 24) | - ((pBuffer[lIndex + 1] & 0x3F) << 18) | - ((pBuffer[lIndex + 2] & 0x3F) << 12) | - ((pBuffer[lIndex + 3] & 0x3F) << 6) | - (pBuffer[lIndex + 4] & 0x3F)); - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 5; - } - else - { - // 6 byte - int val = (int)(((byteMain & 0x01) << 30) | - ((pBuffer[lIndex + 1] & 0x3F) << 24) | - ((pBuffer[lIndex + 2] & 0x3F) << 18) | - ((pBuffer[lIndex + 3] & 0x3F) << 12) | - ((pBuffer[lIndex + 4] & 0x3F) << 6) | - (pBuffer[lIndex + 5] & 0x3F)); - pUnicodeString[lIndexUnicode++] = (WCHAR)(val); - lIndex += 5; - } - } + else + { + pUnicodeString[lIndexUnicode++] = (WCHAR)code; + lIndex += 7; + } + } + else if (0x00 == (byteMain & 0x20)) + { + // 2 byte + int val = (int)(((byteMain & 0x1F) << 6) | + (pBuffer[lIndex + 1] & 0x3F)); + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 2; + } + else if (0x00 == (byteMain & 0x10)) + { + // 3 byte + int val = (int)(((byteMain & 0x0F) << 12) | + ((pBuffer[lIndex + 1] & 0x3F) << 6) | + (pBuffer[lIndex + 2] & 0x3F)); + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 3; + } + else if (0x00 == (byteMain & 0x0F)) + { + // 4 byte + int val = (int)(((byteMain & 0x07) << 18) | + ((pBuffer[lIndex + 1] & 0x3F) << 12) | + ((pBuffer[lIndex + 2] & 0x3F) << 6) | + (pBuffer[lIndex + 3] & 0x3F)); + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 4; + } + else if (0x00 == (byteMain & 0x08)) + { + // 4 byte + int val = (int)(((byteMain & 0x07) << 18) | + ((pBuffer[lIndex + 1] & 0x3F) << 12) | + ((pBuffer[lIndex + 2] & 0x3F) << 6) | + (pBuffer[lIndex + 3] & 0x3F)); + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 4; + } + else if (0x00 == (byteMain & 0x04)) + { + // 5 byte + int val = (int)(((byteMain & 0x03) << 24) | + ((pBuffer[lIndex + 1] & 0x3F) << 18) | + ((pBuffer[lIndex + 2] & 0x3F) << 12) | + ((pBuffer[lIndex + 3] & 0x3F) << 6) | + (pBuffer[lIndex + 4] & 0x3F)); + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 5; + } + else + { + // 6 byte + int val = (int)(((byteMain & 0x01) << 30) | + ((pBuffer[lIndex + 1] & 0x3F) << 24) | + ((pBuffer[lIndex + 2] & 0x3F) << 18) | + ((pBuffer[lIndex + 3] & 0x3F) << 12) | + ((pBuffer[lIndex + 4] & 0x3F) << 6) | + (pBuffer[lIndex + 5] & 0x3F)); + pUnicodeString[lIndexUnicode++] = (WCHAR)(val); + lIndex += 5; + } + } - pUnicodeString[lIndexUnicode] = 0; + pUnicodeString[lIndexUnicode] = 0; lOutputCount = lIndexUnicode; - } - void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ) - { - if (NULL == pUnicodes) - { - pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)]; - } - WCHAR* pUnicodeString = pUnicodes; - WCHAR* pStart = pUnicodeString; - LONG lIndex = 0; - while (lIndex < lCount) - { - BYTE byteMain = pBuffer[lIndex]; - if (0x00 == (byteMain & 0x80)) - { - // 1 byte - long code = CheckHHHHChar(pBuffer + lIndex); - if(code < 0) - { - *pUnicodeString++ = (WCHAR)byteMain; - ++lIndex; - } - else - { - *pUnicodeString++ = (WCHAR)code; - lIndex += 7; - } + } + void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ) + { + if (NULL == pUnicodes) + { + pUnicodes = new wchar_t[GetUnicodeStringFromUTF8BufferSize(lCount)]; + } + WCHAR* pUnicodeString = pUnicodes; + WCHAR* pStart = pUnicodeString; + LONG lIndex = 0; + while (lIndex < lCount) + { + BYTE byteMain = pBuffer[lIndex]; + if (0x00 == (byteMain & 0x80)) + { + // 1 byte + long code = CheckHHHHChar(pBuffer + lIndex); + if(code < 0) + { + *pUnicodeString++ = (WCHAR)byteMain; + ++lIndex; + } + else + { + *pUnicodeString++ = (WCHAR)code; + lIndex += 7; + } - } - else if (0x00 == (byteMain & 0x20)) - { - // 2 byte - int val = (int)(((byteMain & 0x1F) << 6) | - (pBuffer[lIndex + 1] & 0x3F)); - *pUnicodeString++ = (WCHAR)(val); - lIndex += 2; - } - else if (0x00 == (byteMain & 0x10)) - { - // 3 byte - int val = (int)(((byteMain & 0x0F) << 12) | - ((pBuffer[lIndex + 1] & 0x3F) << 6) | - (pBuffer[lIndex + 2] & 0x3F)); + } + else if (0x00 == (byteMain & 0x20)) + { + // 2 byte + int val = (int)(((byteMain & 0x1F) << 6) | + (pBuffer[lIndex + 1] & 0x3F)); + *pUnicodeString++ = (WCHAR)(val); + lIndex += 2; + } + else if (0x00 == (byteMain & 0x10)) + { + // 3 byte + int val = (int)(((byteMain & 0x0F) << 12) | + ((pBuffer[lIndex + 1] & 0x3F) << 6) | + (pBuffer[lIndex + 2] & 0x3F)); - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 3; - } - else if (0x00 == (byteMain & 0x0F)) - { - // 4 byte - int val = (int)(((byteMain & 0x07) << 18) | - ((pBuffer[lIndex + 1] & 0x3F) << 12) | - ((pBuffer[lIndex + 2] & 0x3F) << 6) | - (pBuffer[lIndex + 3] & 0x3F)); + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 3; + } + else if (0x00 == (byteMain & 0x0F)) + { + // 4 byte + int val = (int)(((byteMain & 0x07) << 18) | + ((pBuffer[lIndex + 1] & 0x3F) << 12) | + ((pBuffer[lIndex + 2] & 0x3F) << 6) | + (pBuffer[lIndex + 3] & 0x3F)); - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 4; - } - else if (0x00 == (byteMain & 0x08)) - { - // 4 byte - int val = (int)(((byteMain & 0x07) << 18) | - ((pBuffer[lIndex + 1] & 0x3F) << 12) | - ((pBuffer[lIndex + 2] & 0x3F) << 6) | - (pBuffer[lIndex + 3] & 0x3F)); + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 4; + } + else if (0x00 == (byteMain & 0x08)) + { + // 4 byte + int val = (int)(((byteMain & 0x07) << 18) | + ((pBuffer[lIndex + 1] & 0x3F) << 12) | + ((pBuffer[lIndex + 2] & 0x3F) << 6) | + (pBuffer[lIndex + 3] & 0x3F)); - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 4; - } - else if (0x00 == (byteMain & 0x04)) - { - // 5 byte - int val = (int)(((byteMain & 0x03) << 24) | - ((pBuffer[lIndex + 1] & 0x3F) << 18) | - ((pBuffer[lIndex + 2] & 0x3F) << 12) | - ((pBuffer[lIndex + 3] & 0x3F) << 6) | - (pBuffer[lIndex + 4] & 0x3F)); + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 4; + } + else if (0x00 == (byteMain & 0x04)) + { + // 5 byte + int val = (int)(((byteMain & 0x03) << 24) | + ((pBuffer[lIndex + 1] & 0x3F) << 18) | + ((pBuffer[lIndex + 2] & 0x3F) << 12) | + ((pBuffer[lIndex + 3] & 0x3F) << 6) | + (pBuffer[lIndex + 4] & 0x3F)); - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 5; - } - else - { - // 6 byte - int val = (int)(((byteMain & 0x01) << 30) | - ((pBuffer[lIndex + 1] & 0x3F) << 24) | - ((pBuffer[lIndex + 2] & 0x3F) << 18) | - ((pBuffer[lIndex + 3] & 0x3F) << 12) | - ((pBuffer[lIndex + 4] & 0x3F) << 6) | - (pBuffer[lIndex + 5] & 0x3F)); + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 5; + } + else + { + // 6 byte + int val = (int)(((byteMain & 0x01) << 30) | + ((pBuffer[lIndex + 1] & 0x3F) << 24) | + ((pBuffer[lIndex + 2] & 0x3F) << 18) | + ((pBuffer[lIndex + 3] & 0x3F) << 12) | + ((pBuffer[lIndex + 4] & 0x3F) << 6) | + (pBuffer[lIndex + 5] & 0x3F)); - WriteUtf16_WCHAR(val, pUnicodeString); - lIndex += 5; - } - } + WriteUtf16_WCHAR(val, pUnicodeString); + lIndex += 5; + } + } lOutputCount = pUnicodeString - pStart; - *pUnicodeString++ = 0; - } - void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ) - { - if (sizeof(WCHAR) == 2) - return GetUnicodeStringFromUTF8WithHHHH_2bytes(pBuffer, lCount, pUnicodes, lOutputCount); - return GetUnicodeStringFromUTF8WithHHHH_4bytes(pBuffer, lCount, pUnicodes, lOutputCount); - } + *pUnicodeString++ = 0; + } + void CUtf8Converter::GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ) + { + if (sizeof(WCHAR) == 2) + return GetUnicodeStringFromUTF8WithHHHH_2bytes(pBuffer, lCount, pUnicodes, lOutputCount); + return GetUnicodeStringFromUTF8WithHHHH_4bytes(pBuffer, lCount, pUnicodes, lOutputCount); + } - void CUtf8Converter::GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM) - { - if (NULL == pData) - { - pData = new BYTE[6 * lCount + 3 + 1 ]; - } + void CUtf8Converter::GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM) + { + if (NULL == pData) + { + pData = new BYTE[6 * lCount + 3 + 1 ]; + } - BYTE* pCodesCur = pData; - if (bIsBOM) - { - pCodesCur[0] = 0xEF; - pCodesCur[1] = 0xBB; - pCodesCur[2] = 0xBF; - pCodesCur += 3; - } + BYTE* pCodesCur = pData; + if (bIsBOM) + { + pCodesCur[0] = 0xEF; + pCodesCur[1] = 0xBB; + pCodesCur[2] = 0xBF; + pCodesCur += 3; + } - const wchar_t* pEnd = pUnicodes + lCount; - const wchar_t* pCur = pUnicodes; + const wchar_t* pEnd = pUnicodes + lCount; + const wchar_t* pCur = pUnicodes; - while (pCur < pEnd) - { - unsigned int code = (unsigned int)*pCur++; + while (pCur < pEnd) + { + unsigned int code = (unsigned int)*pCur++; - if (code < 0x80) - { - *pCodesCur++ = (BYTE)code; - } - else if (code < 0x0800) - { - *pCodesCur++ = 0xC0 | (code >> 6); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - else if (code < 0x10000) - { - *pCodesCur++ = 0xE0 | (code >> 12); - *pCodesCur++ = 0x80 | (code >> 6 & 0x3F); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - else if (code < 0x1FFFFF) - { - *pCodesCur++ = 0xF0 | (code >> 18); - *pCodesCur++ = 0x80 | (code >> 12 & 0x3F); - *pCodesCur++ = 0x80 | (code >> 6 & 0x3F); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - else if (code < 0x3FFFFFF) - { - *pCodesCur++ = 0xF8 | (code >> 24); - *pCodesCur++ = 0x80 | (code >> 18 & 0x3F); - *pCodesCur++ = 0x80 | (code >> 12 & 0x3F); - *pCodesCur++ = 0x80 | (code >> 6 & 0x3F); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - else if (code < 0x7FFFFFFF) - { - *pCodesCur++ = 0xFC | (code >> 30); - *pCodesCur++ = 0x80 | (code >> 24 & 0x3F); - *pCodesCur++ = 0x80 | (code >> 18 & 0x3F); - *pCodesCur++ = 0x80 | (code >> 12 & 0x3F); - *pCodesCur++ = 0x80 | (code >> 6 & 0x3F); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - } + if (code < 0x80) + { + *pCodesCur++ = (BYTE)code; + } + else if (code < 0x0800) + { + *pCodesCur++ = 0xC0 | (code >> 6); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + else if (code < 0x10000) + { + *pCodesCur++ = 0xE0 | (code >> 12); + *pCodesCur++ = 0x80 | (code >> 6 & 0x3F); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + else if (code < 0x1FFFFF) + { + *pCodesCur++ = 0xF0 | (code >> 18); + *pCodesCur++ = 0x80 | (code >> 12 & 0x3F); + *pCodesCur++ = 0x80 | (code >> 6 & 0x3F); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + else if (code < 0x3FFFFFF) + { + *pCodesCur++ = 0xF8 | (code >> 24); + *pCodesCur++ = 0x80 | (code >> 18 & 0x3F); + *pCodesCur++ = 0x80 | (code >> 12 & 0x3F); + *pCodesCur++ = 0x80 | (code >> 6 & 0x3F); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + else if (code < 0x7FFFFFFF) + { + *pCodesCur++ = 0xFC | (code >> 30); + *pCodesCur++ = 0x80 | (code >> 24 & 0x3F); + *pCodesCur++ = 0x80 | (code >> 18 & 0x3F); + *pCodesCur++ = 0x80 | (code >> 12 & 0x3F); + *pCodesCur++ = 0x80 | (code >> 6 & 0x3F); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + } - lOutputCount = (LONG)(pCodesCur - pData); - *pCodesCur++ = 0; - } + lOutputCount = (LONG)(pCodesCur - pData); + *pCodesCur++ = 0; + } - void CUtf8Converter::GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM) - { - if (NULL == pData) - { - pData = new BYTE[6 * lCount + 3 + 1]; - } + void CUtf8Converter::GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM) + { + if (NULL == pData) + { + pData = new BYTE[6 * lCount + 3 + 1]; + } - BYTE* pCodesCur = pData; - if (bIsBOM) - { - pCodesCur[0] = 0xEF; - pCodesCur[1] = 0xBB; - pCodesCur[2] = 0xBF; - pCodesCur += 3; - } + BYTE* pCodesCur = pData; + if (bIsBOM) + { + pCodesCur[0] = 0xEF; + pCodesCur[1] = 0xBB; + pCodesCur[2] = 0xBF; + pCodesCur += 3; + } - const wchar_t* pEnd = pUnicodes + lCount; - const wchar_t* pCur = pUnicodes; + const wchar_t* pEnd = pUnicodes + lCount; + const wchar_t* pCur = pUnicodes; - while (pCur < pEnd) - { - unsigned int code = (unsigned int)*pCur++; - if (code >= 0xD800 && code <= 0xDFFF && pCur < pEnd) - { - code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & *pCur++)); - } + while (pCur < pEnd) + { + unsigned int code = (unsigned int)*pCur++; + if (code >= 0xD800 && code <= 0xDFFF && pCur < pEnd) + { + code = 0x10000 + (((code & 0x3FF) << 10) | (0x03FF & *pCur++)); + } - if (code < 0x80) - { - *pCodesCur++ = (BYTE)code; - } - else if (code < 0x0800) - { - *pCodesCur++ = 0xC0 | (code >> 6); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - else if (code < 0x10000) - { - *pCodesCur++ = 0xE0 | (code >> 12); - *pCodesCur++ = 0x80 | ((code >> 6) & 0x3F); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - else if (code < 0x1FFFFF) - { - *pCodesCur++ = 0xF0 | (code >> 18); - *pCodesCur++ = 0x80 | ((code >> 12) & 0x3F); - *pCodesCur++ = 0x80 | ((code >> 6) & 0x3F); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - else if (code < 0x3FFFFFF) - { - *pCodesCur++ = 0xF8 | (code >> 24); - *pCodesCur++ = 0x80 | ((code >> 18) & 0x3F); - *pCodesCur++ = 0x80 | ((code >> 12) & 0x3F); - *pCodesCur++ = 0x80 | ((code >> 6) & 0x3F); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - else if (code < 0x7FFFFFFF) - { - *pCodesCur++ = 0xFC | (code >> 30); - *pCodesCur++ = 0x80 | ((code >> 24) & 0x3F); - *pCodesCur++ = 0x80 | ((code >> 18) & 0x3F); - *pCodesCur++ = 0x80 | ((code >> 12) & 0x3F); - *pCodesCur++ = 0x80 | ((code >> 6) & 0x3F); - *pCodesCur++ = 0x80 | (code & 0x3F); - } - } + if (code < 0x80) + { + *pCodesCur++ = (BYTE)code; + } + else if (code < 0x0800) + { + *pCodesCur++ = 0xC0 | (code >> 6); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + else if (code < 0x10000) + { + *pCodesCur++ = 0xE0 | (code >> 12); + *pCodesCur++ = 0x80 | ((code >> 6) & 0x3F); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + else if (code < 0x1FFFFF) + { + *pCodesCur++ = 0xF0 | (code >> 18); + *pCodesCur++ = 0x80 | ((code >> 12) & 0x3F); + *pCodesCur++ = 0x80 | ((code >> 6) & 0x3F); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + else if (code < 0x3FFFFFF) + { + *pCodesCur++ = 0xF8 | (code >> 24); + *pCodesCur++ = 0x80 | ((code >> 18) & 0x3F); + *pCodesCur++ = 0x80 | ((code >> 12) & 0x3F); + *pCodesCur++ = 0x80 | ((code >> 6) & 0x3F); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + else if (code < 0x7FFFFFFF) + { + *pCodesCur++ = 0xFC | (code >> 30); + *pCodesCur++ = 0x80 | ((code >> 24) & 0x3F); + *pCodesCur++ = 0x80 | ((code >> 18) & 0x3F); + *pCodesCur++ = 0x80 | ((code >> 12) & 0x3F); + *pCodesCur++ = 0x80 | ((code >> 6) & 0x3F); + *pCodesCur++ = 0x80 | (code & 0x3F); + } + } - lOutputCount = (LONG)(pCodesCur - pData); - *pCodesCur++ = 0; - } + lOutputCount = (LONG)(pCodesCur - pData); + *pCodesCur++ = 0; + } - void CUtf8Converter::GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM) - { - if (NULL == pUnicodes || 0 == lCount) - { - pData = NULL; - lOutputCount = 0; - return; - } + void CUtf8Converter::GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM) + { + if (NULL == pUnicodes || 0 == lCount) + { + pData = NULL; + lOutputCount = 0; + return; + } - if (sizeof(WCHAR) == 2) - return GetUtf8StringFromUnicode_2bytes(pUnicodes, lCount, pData, lOutputCount, bIsBOM); - return GetUtf8StringFromUnicode_4bytes(pUnicodes, lCount, pData, lOutputCount, bIsBOM); - } + if (sizeof(WCHAR) == 2) + return GetUtf8StringFromUnicode_2bytes(pUnicodes, lCount, pData, lOutputCount, bIsBOM); + return GetUtf8StringFromUnicode_4bytes(pUnicodes, lCount, pData, lOutputCount, bIsBOM); + } - std::string CUtf8Converter::GetUtf8StringFromUnicode2(const wchar_t* pUnicodes, LONG lCount, bool bIsBOM) - { - if (NULL == pUnicodes || 0 == lCount) - return ""; + std::string CUtf8Converter::GetUtf8StringFromUnicode2(const wchar_t* pUnicodes, LONG lCount, bool bIsBOM) + { + if (NULL == pUnicodes || 0 == lCount) + return ""; - BYTE* pData = NULL; - LONG lLen = 0; + BYTE* pData = NULL; + LONG lLen = 0; - GetUtf8StringFromUnicode(pUnicodes, lCount, pData, lLen, bIsBOM); + GetUtf8StringFromUnicode(pUnicodes, lCount, pData, lLen, bIsBOM); - std::string s((char*)pData, lLen); + std::string s((char*)pData, lLen); - RELEASEARRAYOBJECTS(pData); - return s; - } + RELEASEARRAYOBJECTS(pData); + return s; + } - std::string CUtf8Converter::GetUtf8StringFromUnicode(const std::wstring& sData) - { - return GetUtf8StringFromUnicode2(sData.c_str(), (LONG)sData.length()); - } + std::string CUtf8Converter::GetUtf8StringFromUnicode(const std::wstring& sData) + { + return GetUtf8StringFromUnicode2(sData.c_str(), (LONG)sData.length()); + } - // utf16 - void CUtf8Converter::GetUtf16StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, int& lOutputCount, bool bIsBOM) - { - if (NULL == pData) - { - pData = new BYTE[4 * lCount + 3 + 2]; - } + // utf16 + void CUtf8Converter::GetUtf16StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, int& lOutputCount, bool bIsBOM) + { + if (NULL == pData) + { + pData = new BYTE[4 * lCount + 3 + 2]; + } - BYTE* pCodesCur = pData; - if (bIsBOM) - { - pCodesCur[0] = 0xEF; - pCodesCur[1] = 0xBB; - pCodesCur[2] = 0xBF; - pCodesCur += 3; - } + BYTE* pCodesCur = pData; + if (bIsBOM) + { + pCodesCur[0] = 0xEF; + pCodesCur[1] = 0xBB; + pCodesCur[2] = 0xBF; + pCodesCur += 3; + } - const wchar_t* pEnd = pUnicodes + lCount; - const wchar_t* pCur = pUnicodes; + const wchar_t* pEnd = pUnicodes + lCount; + const wchar_t* pCur = pUnicodes; - while (pCur < pEnd) - { - unsigned int code = (unsigned int)*pCur++; + while (pCur < pEnd) + { + unsigned int code = (unsigned int)*pCur++; - if (code <= 0xFFFF) - { - USHORT usCode = (USHORT)(code & 0xFFFF); - memcpy(pCodesCur, &usCode, 2); - pCodesCur += 2; - } - else - { - code -= 0x10000; - code &= 0xFFFFF; + if (code <= 0xFFFF) + { + USHORT usCode = (USHORT)(code & 0xFFFF); + memcpy(pCodesCur, &usCode, 2); + pCodesCur += 2; + } + else + { + code -= 0x10000; + code &= 0xFFFFF; - USHORT us1 = 0xD800 | ((code >> 10) & 0x03FF); - USHORT us2 = 0xDC00 | (code & 0x03FF); + USHORT us1 = 0xD800 | ((code >> 10) & 0x03FF); + USHORT us2 = 0xDC00 | (code & 0x03FF); - memcpy(pCodesCur, &us1, 2); - pCodesCur += 2; + memcpy(pCodesCur, &us1, 2); + pCodesCur += 2; - memcpy(pCodesCur, &us2, 2); - pCodesCur += 2; - } - } + memcpy(pCodesCur, &us2, 2); + pCodesCur += 2; + } + } - lOutputCount = (LONG)(pCodesCur - pData); - *pCodesCur++ = 0; - *pCodesCur++ = 0; - } + lOutputCount = (LONG)(pCodesCur - pData); + *pCodesCur++ = 0; + *pCodesCur++ = 0; + } - void CUtf8Converter::GetUtf16StringFromUnicode_4bytes2(const wchar_t* pUnicodes, LONG lCount, CStringUtf16& data) - { - GetUtf16StringFromUnicode_4bytes(pUnicodes, lCount, data.Data, data.Length); - } + void CUtf8Converter::GetUtf16StringFromUnicode_4bytes2(const wchar_t* pUnicodes, LONG lCount, CStringUtf16& data) + { + GetUtf16StringFromUnicode_4bytes(pUnicodes, lCount, data.Data, data.Length); + } - std::wstring CUtf8Converter::GetWStringFromUTF16(const CStringUtf16& data) - { - if (0 == data.Length) - return L""; + std::wstring CUtf8Converter::GetWStringFromUTF16(const CStringUtf16& data) + { + if (0 == data.Length) + return L""; - if (sizeof(wchar_t) == 2) - return std::wstring((wchar_t*)data.Data, data.Length / 2); + if (sizeof(wchar_t) == 2) + return std::wstring((wchar_t*)data.Data, data.Length / 2); - int nCount = data.Length / 2; - USHORT* pShort = (USHORT*)data.Data; + int nCount = data.Length / 2; + USHORT* pShort = (USHORT*)data.Data; - wchar_t* pWChar = new wchar_t[nCount + 1]; - wchar_t* pWCurrent = pWChar; + wchar_t* pWChar = new wchar_t[nCount + 1]; + wchar_t* pWCurrent = pWChar; - int nCurrent = 0; - while (nCurrent < nCount) - { - if (*pShort < 0xD800 || *pShort > 0xDBFF) - { - *pWCurrent = (wchar_t)(*pShort); - ++pShort; - ++nCurrent; - } - else - { - *pWCurrent = (wchar_t)(((((pShort[0] - 0xD800) & 0x03FF) << 10) | ((pShort[1] - 0xDC00) & 0x03FF)) + 0x10000); - pShort += 2; - nCurrent += 2; - } - ++pWCurrent; - } + int nCurrent = 0; + while (nCurrent < nCount) + { + if (*pShort < 0xD800 || *pShort > 0xDBFF) + { + *pWCurrent = (wchar_t)(*pShort); + ++pShort; + ++nCurrent; + } + else + { + *pWCurrent = (wchar_t)(((((pShort[0] - 0xD800) & 0x03FF) << 10) | ((pShort[1] - 0xDC00) & 0x03FF)) + 0x10000); + pShort += 2; + nCurrent += 2; + } + ++pWCurrent; + } - std::wstring sRet(pWChar, pWCurrent - pWChar); + std::wstring sRet(pWChar, pWCurrent - pWChar); - RELEASEARRAYOBJECTS(pWChar); - return sRet; - } - std::wstring CUtf8Converter::GetWStringFromUTF16(const unsigned short* pUtf16, LONG lCount) - { - CStringUtf16 oString; - oString.Data = (BYTE*)pUtf16; - oString.Length = lCount * 2; - std::wstring wsResult = GetWStringFromUTF16(oString); - oString.Data = NULL; - return wsResult; - } + RELEASEARRAYOBJECTS(pWChar); + return sRet; + } + std::wstring CUtf8Converter::GetWStringFromUTF16(const unsigned short* pUtf16, LONG lCount) + { + CStringUtf16 oString; + oString.Data = (BYTE*)pUtf16; + oString.Length = lCount * 2; + std::wstring wsResult = GetWStringFromUTF16(oString); + oString.Data = NULL; + return wsResult; + } } namespace NSFile { - CFileBinary::CFileBinary() - { - m_pFile = NULL; - m_lFilePosition = 0; - m_lFileSize = 0; - } - CFileBinary::~CFileBinary() - { - CloseFile(); - } + CFileBinary::CFileBinary() + { + m_pFile = NULL; + m_lFilePosition = 0; + m_lFileSize = 0; + } + CFileBinary::~CFileBinary() + { + CloseFile(); + } - void CFileBinary::CloseFile() - { - m_lFilePosition = 0; - m_lFileSize = 0; + void CFileBinary::CloseFile() + { + m_lFilePosition = 0; + m_lFileSize = 0; - if (m_pFile != NULL) - { - fclose(m_pFile); - m_pFile = NULL; - } - } + if (m_pFile != NULL) + { + fclose(m_pFile); + m_pFile = NULL; + } + } - FILE* CFileBinary::GetFileNative() - { - return m_pFile; - } - long CFileBinary::GetFileSize() - { - return m_lFileSize; - } - long CFileBinary::GetFilePosition() - { - return m_lFilePosition; - } + FILE* CFileBinary::GetFileNative() + { + return m_pFile; + } + long CFileBinary::GetFileSize() + { + return m_lFileSize; + } + long CFileBinary::GetFilePosition() + { + return m_lFilePosition; + } + unsigned long CFileBinary::GetPosition() + { + return (unsigned long)m_lFilePosition; + } #ifdef _IOS - - bool CFileBinary::OpenFile(const std::wstring& sFileName, bool bRewrite) - { - m_pFile = fopen(fileSystemRepresentation(sFileName), bRewrite ? "rb+" : "rb"); - - if (NULL == m_pFile) { + + bool CFileBinary::OpenFile(const std::wstring& sFileName, bool bRewrite) + { + m_pFile = fopen(fileSystemRepresentation(sFileName), bRewrite ? "rb+" : "rb"); + + if (NULL == m_pFile) { #if DEBUG - // printf ("NSFile::OpenFile - error open file : %s\n",strerror(errno)); + // printf ("NSFile::OpenFile - error open file : %s\n",strerror(errno)); #endif - return false; - } - - fseek(m_pFile, 0, SEEK_END); - m_lFileSize = ftell(m_pFile); - fseek(m_pFile, 0, SEEK_SET); - - m_lFilePosition = 0; - - if (0 < sFileName.length()) - { - if (((wchar_t)'/') == sFileName.c_str()[sFileName.length() - 1]) - m_lFileSize = 0x7FFFFFFF; - } - - unsigned int err = 0x7FFFFFFF; - unsigned int cur = (unsigned int)m_lFileSize; - if (err == cur) - { - CloseFile(); - return false; - } - - return true; - } + return false; + } - bool CFileBinary::CreateFileW(const std::wstring& sFileName) - { - m_pFile = fopen(fileSystemRepresentation(sFileName), "wb"); + fseek(m_pFile, 0, SEEK_END); + m_lFileSize = ftell(m_pFile); + fseek(m_pFile, 0, SEEK_SET); - if (NULL == m_pFile) { + m_lFilePosition = 0; + + if (0 < sFileName.length()) + { + if (((wchar_t)'/') == sFileName.c_str()[sFileName.length() - 1]) + m_lFileSize = 0x7FFFFFFF; + } + + unsigned int err = 0x7FFFFFFF; + unsigned int cur = (unsigned int)m_lFileSize; + if (err == cur) + { + CloseFile(); + return false; + } + + return true; + } + + bool CFileBinary::CreateFileW(const std::wstring& sFileName) + { + m_pFile = fopen(fileSystemRepresentation(sFileName), "wb"); + + if (NULL == m_pFile) { #if DEBUG - // printf ("NSFile::CreateFileW - error create file : %s\n",strerror(errno)); + // printf ("NSFile::CreateFileW - error create file : %s\n",strerror(errno)); #endif - return false; - } + return false; + } - m_lFilePosition = 0; - return true; - } + m_lFilePosition = 0; + return true; + } #else - bool CFileBinary::OpenFile(const std::wstring& sFileName, bool bRewrite) - { + bool CFileBinary::OpenFile(const std::wstring& sFileName, bool bRewrite) + { #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - if ( NULL == (m_pFile = _wfsopen( sFileName.c_str(), bRewrite ? L"rb+" : L"rb", _SH_DENYNO))) - return false; + if ( NULL == (m_pFile = _wfsopen( sFileName.c_str(), bRewrite ? L"rb+" : L"rb", _SH_DENYNO))) + return false; #else - BYTE* pUtf8 = NULL; - LONG lLen = 0; - CUtf8Converter::GetUtf8StringFromUnicode(sFileName.c_str(), sFileName.length(), pUtf8, lLen, false); + BYTE* pUtf8 = NULL; + LONG lLen = 0; + CUtf8Converter::GetUtf8StringFromUnicode(sFileName.c_str(), sFileName.length(), pUtf8, lLen, false); - struct stat st; - if ((0 == stat((char*)pUtf8, &st)) && S_ISDIR(st.st_mode)) - return false; + struct stat st; + if ((0 == stat((char*)pUtf8, &st)) && S_ISDIR(st.st_mode)) + return false; - m_pFile = fopen((char*)pUtf8, bRewrite ? "rb+" : "rb"); + m_pFile = fopen((char*)pUtf8, bRewrite ? "rb+" : "rb"); - delete [] pUtf8; + delete [] pUtf8; #endif - if (NULL == m_pFile) - return false; + if (NULL == m_pFile) + return false; - fseek(m_pFile, 0, SEEK_END); - m_lFileSize = ftell(m_pFile); - fseek(m_pFile, 0, SEEK_SET); + fseek(m_pFile, 0, SEEK_END); + m_lFileSize = ftell(m_pFile); + fseek(m_pFile, 0, SEEK_SET); - m_lFilePosition = 0; + m_lFilePosition = 0; - if (0 < sFileName.length()) - { - if (((wchar_t)'/') == sFileName.c_str()[sFileName.length() - 1]) - m_lFileSize = 0x7FFFFFFF; - } + if (0 < sFileName.length()) + { + if (((wchar_t)'/') == sFileName.c_str()[sFileName.length() - 1]) + m_lFileSize = 0x7FFFFFFF; + } - unsigned int err = 0x7FFFFFFF; - unsigned int cur = (unsigned int)m_lFileSize; - if (err == cur) - { - CloseFile(); - return false; - } + unsigned int err = 0x7FFFFFFF; + unsigned int cur = (unsigned int)m_lFileSize; + if (err == cur) + { + CloseFile(); + return false; + } - return true; - } + return true; + } - bool CFileBinary::CreateFileW(const std::wstring& sFileName) - { + bool CFileBinary::CreateFileW(const std::wstring& sFileName) + { #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - if ( 0 != _wfopen_s(&m_pFile, sFileName.c_str(), L"wb")) - return false; + if ( 0 != _wfopen_s(&m_pFile, sFileName.c_str(), L"wb")) + return false; #else - BYTE* pUtf8 = NULL; - LONG lLen = 0; - CUtf8Converter::GetUtf8StringFromUnicode(sFileName.c_str(), sFileName.length(), pUtf8, lLen, false); - m_pFile = fopen((char*)pUtf8, "wb"); - delete [] pUtf8; + BYTE* pUtf8 = NULL; + LONG lLen = 0; + CUtf8Converter::GetUtf8StringFromUnicode(sFileName.c_str(), sFileName.length(), pUtf8, lLen, false); + m_pFile = fopen((char*)pUtf8, "wb"); + delete [] pUtf8; #endif - if (NULL == m_pFile) - return false; + if (NULL == m_pFile) + return false; - m_lFilePosition = 0; - return true; - } + m_lFilePosition = 0; + return true; + } + + bool CFileBinary::CreateFile(const std::wstring& sFileName) + { + return CreateFileW(sFileName); + } #endif - bool CFileBinary::CreateTempFile() - { + bool CFileBinary::CreateTempFile() + { #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - if (0 != tmpfile_s(&m_pFile)) - return false; + if (0 != tmpfile_s(&m_pFile)) + return false; #else - m_pFile = tmpfile(); - if (NULL == m_pFile) - return false; + m_pFile = tmpfile(); + if (NULL == m_pFile) + return false; #endif - m_lFilePosition = 0; - return true; - } - bool CFileBinary::SeekFile(int lFilePosition, int nSeekMode) - { - if (!m_pFile) - return false; + m_lFilePosition = 0; + return true; + } + bool CFileBinary::SeekFile(int lFilePosition, int nSeekMode) + { + if (!m_pFile) + return false; - m_lFilePosition = fseek(m_pFile, lFilePosition, nSeekMode); - return true; - } - bool CFileBinary::ReadFile(BYTE* pData, DWORD nBytesToRead, DWORD& dwSizeRead) - { - if (!m_pFile) - return false; + m_lFilePosition = fseek(m_pFile, lFilePosition, nSeekMode); + return true; + } + bool CFileBinary::SetPosition(int lFilePosition) + { + return SeekFile(lFilePosition, SEEK_SET); + } + bool CFileBinary::ReadFile(BYTE* pData, DWORD nBytesToRead) + { + if (!m_pFile) + return false; - dwSizeRead = (DWORD)fread((void*)pData, 1, nBytesToRead, m_pFile); - return true; - } - bool CFileBinary::WriteFile(const BYTE* pData, DWORD nBytesCount) - { - if (!m_pFile) - return false; + DWORD dwSizeRead = (DWORD)fread((void*)pData, 1, nBytesToRead, m_pFile); + return (dwSizeRead == nBytesToRead) ? true : false; + } + bool CFileBinary::ReadFile(BYTE* pData, DWORD nBytesToRead, DWORD& dwSizeRead) + { + if (!m_pFile) + return false; - size_t nCountWrite = fwrite((const void*)pData, 1, nBytesCount, m_pFile); - return true; - } - long CFileBinary::TellFile() - { - if (!m_pFile) - return 0; + dwSizeRead = (DWORD)fread((void*)pData, 1, nBytesToRead, m_pFile); + return true; + } + bool CFileBinary::WriteFile(const void* pData, DWORD nBytesCount) + { + if (!m_pFile) + return false; - return ftell(m_pFile); - } - long CFileBinary::SizeFile() - { - if (!m_pFile) - return 0; + 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) + return false; - long lPos = TellFile(); - fseek(m_pFile, 0, SEEK_END); - m_lFileSize = ftell(m_pFile); - fseek(m_pFile, lPos, SEEK_SET); + BYTE* mem = new BYTE[nBytesToWrite]; + memcpy(mem, pData, nBytesToWrite); - return m_lFileSize; - } - void CFileBinary::WriteStringUTF8(const std::wstring& strXml, bool bIsBOM) - { - BYTE* pData = NULL; - LONG lLen = 0; + for (size_t index = 0; index < nBytesToWrite / 2; ++index) + { + BYTE temp = mem[index]; + mem[index] = mem[nBytesToWrite - index - 1]; + mem[nBytesToWrite - index - 1] = temp; + } - CUtf8Converter::GetUtf8StringFromUnicode(strXml.c_str(), (LONG)strXml.length(), pData, lLen, bIsBOM); + bool bRes = WriteFile(mem, nBytesToWrite); + RELEASEARRAYOBJECTS(mem); + return bRes; + } + long CFileBinary::TellFile() + { + if (!m_pFile) + return 0; - WriteFile(pData, lLen); + return ftell(m_pFile); + } + long CFileBinary::SizeFile() + { + if (!m_pFile) + return 0; - RELEASEARRAYOBJECTS(pData); - } - bool CFileBinary::ReadAllBytes(const std::wstring& strFileName, BYTE** ppData, DWORD& nBytesCount) - { - *ppData = NULL; - nBytesCount = 0; - bool bRes = false; - CFileBinary oFileBinary; - if (oFileBinary.OpenFile(strFileName)) - { - long nFileSize = oFileBinary.GetFileSize(); - BYTE* pData = new BYTE[nFileSize]; - DWORD dwSizeRead; - if (oFileBinary.ReadFile(pData, nFileSize, dwSizeRead)) - { - oFileBinary.CloseFile(); - *ppData = pData; - nBytesCount = dwSizeRead; - bRes = true; - } - else - RELEASEARRAYOBJECTS(pData); - } - return bRes; - } - bool CFileBinary::ReadAllTextUtf8(const std::wstring& strFileName, std::wstring& sData) - { - bool bRes = false; - BYTE* pData = NULL; - DWORD nDataSize; - if (CFileBinary::ReadAllBytes(strFileName, &pData, nDataSize)) - { - //remove BOM if exist - BYTE* pDataStart = pData; - DWORD nBOMSize = 3; - if (nDataSize > nBOMSize && 0xef == pDataStart[0] && 0xbb == pDataStart[1] && 0xbf == pDataStart[2]) - { - pDataStart += nBOMSize; - nDataSize -= nBOMSize; - } - sData = CUtf8Converter::GetUnicodeStringFromUTF8(pDataStart, nDataSize); - RELEASEARRAYOBJECTS(pData); - bRes = true; - } - return bRes; - } - bool CFileBinary::ReadAllTextUtf8A(const std::wstring& strFileName, std::string& sData) - { - bool bRes = false; - BYTE* pData = NULL; - DWORD nDataSize; - if (CFileBinary::ReadAllBytes(strFileName, &pData, nDataSize)) - { - //remove BOM if exist - BYTE* pDataStart = pData; - DWORD nBOMSize = 3; - if (nDataSize > nBOMSize && 0xef == pDataStart[0] && 0xbb == pDataStart[1] && 0xbf == pDataStart[2]) - { - pDataStart += nBOMSize; - nDataSize -= nBOMSize; - } - sData = std::string((char*)pDataStart, nDataSize); - RELEASEARRAYOBJECTS(pData); - bRes = true; - } - return bRes; - } - bool CFileBinary::SaveToFile(const std::wstring& strFileName, const std::wstring& strXml, bool bIsBOM) - { - CFileBinary oFile; - oFile.CreateFileW(strFileName); - oFile.WriteStringUTF8(strXml, bIsBOM); - oFile.CloseFile(); - return true; - } - bool CFileBinary::Exists(const std::wstring& strFileName) - { + long lPos = TellFile(); + fseek(m_pFile, 0, SEEK_END); + m_lFileSize = ftell(m_pFile); + fseek(m_pFile, lPos, SEEK_SET); + + return m_lFileSize; + } + void CFileBinary::WriteStringUTF8(const std::wstring& strXml, bool bIsBOM) + { + BYTE* pData = NULL; + LONG lLen = 0; + + CUtf8Converter::GetUtf8StringFromUnicode(strXml.c_str(), (LONG)strXml.length(), pData, lLen, bIsBOM); + + WriteFile(pData, lLen); + + RELEASEARRAYOBJECTS(pData); + } + + bool CFileBinary::WriteReserved(DWORD dwCount) + { + BYTE* buf = new BYTE[dwCount]; + memset(buf, 0, (size_t)dwCount); + bool hr = WriteFile(buf, dwCount); + RELEASEARRAYOBJECTS(buf); + return hr; + } + bool CFileBinary::WriteReserved2(DWORD dwCount) + { + BYTE* buf = new BYTE[dwCount]; + memset(buf, 0xFF, (size_t)dwCount); + bool hr = WriteFile(buf, dwCount); + RELEASEARRAYOBJECTS(buf); + return hr; + } + bool CFileBinary::WriteReservedTo(DWORD dwPoint) + { + if ((DWORD)m_lFilePosition >= dwPoint) + return S_OK; + + DWORD dwCount = dwPoint - (DWORD)m_lFilePosition; + BYTE* buf = new BYTE[dwCount]; + memset(buf, 0, (size_t)dwCount); + bool hr = WriteFile(buf, dwCount); + RELEASEARRAYOBJECTS(buf); + return hr; + } + bool CFileBinary::SkipReservedTo(DWORD dwPoint) + { + if ((DWORD)m_lFilePosition >= dwPoint) + return S_OK; + + DWORD dwCount = dwPoint - (DWORD)m_lFilePosition; + return SkipBytes(dwCount); + } + + LONG CFileBinary::GetProgress() + { + if (0 >= m_lFileSize) + return -1; + + double dVal = (double)(100 * m_lFilePosition); + LONG lProgress = (LONG)(dVal / m_lFileSize); + return lProgress; + } + + bool CFileBinary::SkipBytes(ULONG nCount) + { + return SeekFile(m_lFilePosition + nCount); + } + + bool CFileBinary::ReadAllBytes(const std::wstring& strFileName, BYTE** ppData, DWORD& nBytesCount) + { + *ppData = NULL; + nBytesCount = 0; + bool bRes = false; + CFileBinary oFileBinary; + if (oFileBinary.OpenFile(strFileName)) + { + long nFileSize = oFileBinary.GetFileSize(); + BYTE* pData = new BYTE[nFileSize]; + DWORD dwSizeRead; + if (oFileBinary.ReadFile(pData, nFileSize, dwSizeRead)) + { + oFileBinary.CloseFile(); + *ppData = pData; + nBytesCount = dwSizeRead; + bRes = true; + } + else + RELEASEARRAYOBJECTS(pData); + } + return bRes; + } + bool CFileBinary::ReadAllTextUtf8(const std::wstring& strFileName, std::wstring& sData) + { + bool bRes = false; + BYTE* pData = NULL; + DWORD nDataSize; + if (CFileBinary::ReadAllBytes(strFileName, &pData, nDataSize)) + { + //remove BOM if exist + BYTE* pDataStart = pData; + DWORD nBOMSize = 3; + if (nDataSize > nBOMSize && 0xef == pDataStart[0] && 0xbb == pDataStart[1] && 0xbf == pDataStart[2]) + { + pDataStart += nBOMSize; + nDataSize -= nBOMSize; + } + sData = CUtf8Converter::GetUnicodeStringFromUTF8(pDataStart, nDataSize); + RELEASEARRAYOBJECTS(pData); + bRes = true; + } + return bRes; + } + bool CFileBinary::ReadAllTextUtf8A(const std::wstring& strFileName, std::string& sData) + { + bool bRes = false; + BYTE* pData = NULL; + DWORD nDataSize; + if (CFileBinary::ReadAllBytes(strFileName, &pData, nDataSize)) + { + //remove BOM if exist + BYTE* pDataStart = pData; + DWORD nBOMSize = 3; + if (nDataSize > nBOMSize && 0xef == pDataStart[0] && 0xbb == pDataStart[1] && 0xbf == pDataStart[2]) + { + pDataStart += nBOMSize; + nDataSize -= nBOMSize; + } + sData = std::string((char*)pDataStart, nDataSize); + RELEASEARRAYOBJECTS(pData); + bRes = true; + } + return bRes; + } + bool CFileBinary::SaveToFile(const std::wstring& strFileName, const std::wstring& strXml, bool bIsBOM) + { + CFileBinary oFile; + oFile.CreateFileW(strFileName); + oFile.WriteStringUTF8(strXml, bIsBOM); + oFile.CloseFile(); + return true; + } + bool CFileBinary::Exists(const std::wstring& strFileName) + { #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - FILE* pFile = NULL; - if ( NULL == (pFile = _wfsopen( strFileName.c_str(), L"rb", _SH_DENYNO))) - return false; + FILE* pFile = NULL; + if ( NULL == (pFile = _wfsopen( strFileName.c_str(), L"rb", _SH_DENYNO))) + return false; #else - BYTE* pUtf8 = NULL; - LONG lLen = 0; - CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false); - FILE* pFile = fopen((char*)pUtf8, "rb"); - delete [] pUtf8; + BYTE* pUtf8 = NULL; + LONG lLen = 0; + CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false); + FILE* pFile = fopen((char*)pUtf8, "rb"); + delete [] pUtf8; #endif - if (NULL != pFile) - { - fclose(pFile); - return true; - } - else - return false; - } - bool CFileBinary::Copy(const std::wstring& strSrc, const std::wstring& strDst) - { - if (strSrc == strDst) - return true; + if (NULL != pFile) + { + fclose(pFile); + return true; + } + else + return false; + } + bool CFileBinary::Copy(const std::wstring& strSrc, const std::wstring& strDst) + { + if (strSrc == strDst) + return true; #ifdef READ_WRITE_FULL - BYTE* pFileData = NULL; - DWORD dwChunkSize = READ_WRITE_FULL_BUFFER_SIZE; - CFileBinary oFileSrc; - CFileBinary oFileDst; - if (oFileSrc.OpenFile(strSrc) && oFileDst.CreateFileW(strDst)) - { - DWORD dwFileSrcSize = (DWORD)oFileSrc.GetFileSize(); - if (dwChunkSize > dwFileSrcSize) - dwChunkSize = dwFileSrcSize; + BYTE* pFileData = NULL; + DWORD dwChunkSize = READ_WRITE_FULL_BUFFER_SIZE; + CFileBinary oFileSrc; + CFileBinary oFileDst; + if (oFileSrc.OpenFile(strSrc) && oFileDst.CreateFileW(strDst)) + { + DWORD dwFileSrcSize = (DWORD)oFileSrc.GetFileSize(); + if (dwChunkSize > dwFileSrcSize) + dwChunkSize = dwFileSrcSize; - BYTE* pTempBuffer = new BYTE[dwChunkSize]; - DWORD dwProcessedBytes = 0; - while (dwFileSrcSize != 0) - { - oFileSrc.ReadFile(pTempBuffer, dwChunkSize, dwProcessedBytes); - if (dwProcessedBytes != dwChunkSize) - break; + BYTE* pTempBuffer = new BYTE[dwChunkSize]; + DWORD dwProcessedBytes = 0; + while (dwFileSrcSize != 0) + { + oFileSrc.ReadFile(pTempBuffer, dwChunkSize, dwProcessedBytes); + if (dwProcessedBytes != dwChunkSize) + break; - if (!oFileDst.WriteFile(pTempBuffer, dwChunkSize)) - break; + if (!oFileDst.WriteFile(pTempBuffer, dwChunkSize)) + break; - dwFileSrcSize -= dwChunkSize; - if (dwChunkSize > dwFileSrcSize) - dwChunkSize = dwFileSrcSize; - } + dwFileSrcSize -= dwChunkSize; + if (dwChunkSize > dwFileSrcSize) + dwChunkSize = dwFileSrcSize; + } - oFileSrc.CloseFile(); - oFileDst.CloseFile(); + oFileSrc.CloseFile(); + oFileDst.CloseFile(); - RELEASEARRAYOBJECTS(pTempBuffer); + RELEASEARRAYOBJECTS(pTempBuffer); - if (0 != dwFileSrcSize) - Remove(strDst); - else - return true; - } + if (0 != dwFileSrcSize) + Remove(strDst); + else + return true; + } #endif #if !defined(_WIN32) && !defined(_WIN32_WCE) && !defined(_WIN64) - std::string strSrcA = U_TO_UTF8(strSrc); - std::string strDstA = U_TO_UTF8(strDst); + std::string strSrcA = U_TO_UTF8(strSrc); + std::string strDstA = U_TO_UTF8(strDst); #endif #ifdef USE_LINUX_SENDFILE_INSTEAD_STREAMS - int src = open(strSrcA.c_str(), O_RDONLY); - int dst = open(strDstA.c_str(), O_WRONLY | O_CREAT); + int src = open(strSrcA.c_str(), O_RDONLY); + int dst = open(strDstA.c_str(), O_WRONLY | O_CREAT); - // struct required, rationale: function stat() exists also - struct stat stat_source; - fstat(src, &stat_source); + // struct required, rationale: function stat() exists also + struct stat stat_source; + fstat(src, &stat_source); - if (stat_source.st_size > 0x7FFFFFFF) - return false; + if (stat_source.st_size > 0x7FFFFFFF) + return false; - off_t offset = 0; - long long file_size = stat_source.st_size; - long long file_size_tmp = file_size; - long long read_size = 0; - long long read_size_marker = (long long)sendfile(dst, src, &offset, file_size_tmp); - while (-1 != read_size_marker) - { - if (read_size == file_size) - break; + off_t offset = 0; + long long file_size = stat_source.st_size; + long long file_size_tmp = file_size; + long long read_size = 0; + long long read_size_marker = (long long)sendfile(dst, src, &offset, file_size_tmp); + while (-1 != read_size_marker) + { + if (read_size == file_size) + break; - file_size_tmp -= read_size_marker; - read_size += read_size_marker; + file_size_tmp -= read_size_marker; + read_size += read_size_marker; - if (read_size != file_size) - read_size_marker = (long long)sendfile(dst, src, &offset, file_size_tmp); - } + if (read_size != file_size) + read_size_marker = (long long)sendfile(dst, src, &offset, file_size_tmp); + } - close(src); - close(dst); - return (-1 != read_size_marker) ? true : false; + close(src); + close(dst); + return (-1 != read_size_marker) ? true : false; #else - std::ifstream src; - std::ofstream dst; + std::ifstream src; + std::ofstream dst; - int nLenBuffer = 1024 * 1024; // 10 - CFileBinary oFile; - if (oFile.OpenFile(strSrc)) - { - int nFileSize = (int)oFile.GetFileSize(); - if (nFileSize < nLenBuffer) - nLenBuffer = nFileSize; + int nLenBuffer = 1024 * 1024; // 10 + CFileBinary oFile; + if (oFile.OpenFile(strSrc)) + { + int nFileSize = (int)oFile.GetFileSize(); + if (nFileSize < nLenBuffer) + nLenBuffer = nFileSize; - oFile.CloseFile(); - } - else - { + oFile.CloseFile(); + } + else + { #ifdef _WIN32 - return (0 != ::CopyFileW(strSrc.c_str(), strDst.c_str(), 1)); + return (0 != ::CopyFileW(strSrc.c_str(), strDst.c_str(), 1)); #endif - } + } - char* pBuffer_in = NULL; - char* pBuffer_out = NULL; + char* pBuffer_in = NULL; + char* pBuffer_out = NULL; - if (nLenBuffer > 0) - { - pBuffer_in = new char[nLenBuffer]; - pBuffer_out = new char[nLenBuffer]; + if (nLenBuffer > 0) + { + pBuffer_in = new char[nLenBuffer]; + pBuffer_out = new char[nLenBuffer]; - src.rdbuf()->pubsetbuf(pBuffer_in, nLenBuffer); - dst.rdbuf()->pubsetbuf(pBuffer_out, nLenBuffer); - } + src.rdbuf()->pubsetbuf(pBuffer_in, nLenBuffer); + dst.rdbuf()->pubsetbuf(pBuffer_out, nLenBuffer); + } #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - src.open(strSrc.c_str(), std::ios::binary); - dst.open(strDst.c_str(), std::ios::binary); + src.open(strSrc.c_str(), std::ios::binary); + dst.open(strDst.c_str(), std::ios::binary); #else - src.open(strSrcA.c_str(), std::ios::binary); - dst.open(strDstA.c_str(), std::ios::binary); + src.open(strSrcA.c_str(), std::ios::binary); + dst.open(strDstA.c_str(), std::ios::binary); #endif - bool bRet = false; + bool bRet = false; - if (src.is_open() && dst.is_open()) - { - dst << src.rdbuf(); - src.close(); - dst.close(); + if (src.is_open() && dst.is_open()) + { + dst << src.rdbuf(); + src.close(); + dst.close(); - bRet = true; - } - RELEASEARRAYOBJECTS(pBuffer_in); - RELEASEARRAYOBJECTS(pBuffer_out); - return bRet; + bRet = true; + } + RELEASEARRAYOBJECTS(pBuffer_in); + RELEASEARRAYOBJECTS(pBuffer_out); + return bRet; #endif - } - bool CFileBinary::Remove(const std::wstring& strFileName) - { + } + bool CFileBinary::Remove(const std::wstring& strFileName) + { #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - int nRes = _wremove(strFileName.c_str()); + int nRes = _wremove(strFileName.c_str()); #else - BYTE* pUtf8 = NULL; - LONG lLen = 0; - CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false); - int nRes = std::remove((char*)pUtf8); - delete [] pUtf8; + BYTE* pUtf8 = NULL; + LONG lLen = 0; + CUtf8Converter::GetUtf8StringFromUnicode(strFileName.c_str(), strFileName.length(), pUtf8, lLen, false); + int nRes = std::remove((char*)pUtf8); + delete [] pUtf8; #endif - return 0 == nRes; - } - bool CFileBinary::Move(const std::wstring& strSrc, const std::wstring& strDst) - { - if (strSrc == strDst) - return true; - if (Copy(strSrc, strDst)) - if (Remove(strSrc)) - return true; - return false; - } + return 0 == nRes; + } + bool CFileBinary::Move(const std::wstring& strSrc, const std::wstring& strDst) + { + if (strSrc == strDst) + return true; + if (Copy(strSrc, strDst)) + if (Remove(strSrc)) + return true; + return false; + } - bool CFileBinary::Truncate(const std::wstring& sPath, size_t nNewSize) - { - bool bIsSuccess = false; + bool CFileBinary::Truncate(const std::wstring& sPath, size_t nNewSize) + { + bool bIsSuccess = false; #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - HANDLE hFile = ::CreateFileW( sPath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, - NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL ); - if ( hFile == INVALID_HANDLE_VALUE ) - { - return bIsSuccess; - } + HANDLE hFile = ::CreateFileW( sPath.c_str(), GENERIC_WRITE, FILE_SHARE_READ, + NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL ); + if ( hFile == INVALID_HANDLE_VALUE ) + { + return bIsSuccess; + } - LARGE_INTEGER Size = { 0 }; + LARGE_INTEGER Size = { 0 }; - if ( GetFileSizeEx( hFile, &Size ) ) - { - LARGE_INTEGER Distance = { 0 }; - // Negative values move the pointer backward in the file - Distance.QuadPart = (LONGLONG)nNewSize - Size.QuadPart; - bIsSuccess = (SetFilePointerEx(hFile, Distance, NULL, FILE_END) && SetEndOfFile(hFile)); - } + if ( GetFileSizeEx( hFile, &Size ) ) + { + LARGE_INTEGER Distance = { 0 }; + // Negative values move the pointer backward in the file + Distance.QuadPart = (LONGLONG)nNewSize - Size.QuadPart; + bIsSuccess = (SetFilePointerEx(hFile, Distance, NULL, FILE_END) && SetEndOfFile(hFile)); + } - CloseHandle( hFile ); + CloseHandle( hFile ); #else - std::string sFileUTF8 = U_TO_UTF8(sPath); - bIsSuccess = (0 == truncate(sFileUTF8.c_str(), nNewSize)); + std::string sFileUTF8 = U_TO_UTF8(sPath); + bIsSuccess = (0 == truncate(sFileUTF8.c_str(), nNewSize)); #endif - return bIsSuccess; - } + return bIsSuccess; + } - std::wstring CFileBinary::GetTempPath() - { - if (!g_overrideTmpPath.empty()) - return g_overrideTmpPath; + std::wstring CFileBinary::GetTempPath() + { + if (!g_overrideTmpPath.empty()) + return g_overrideTmpPath; #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - wchar_t pBuffer[MAX_PATH + 1]; - memset(pBuffer, 0, sizeof(wchar_t) * (MAX_PATH + 1)); - ::GetTempPathW(MAX_PATH, pBuffer); + wchar_t pBuffer[MAX_PATH + 1]; + memset(pBuffer, 0, sizeof(wchar_t) * (MAX_PATH + 1)); + ::GetTempPathW(MAX_PATH, pBuffer); - std::wstring sRet(pBuffer); + std::wstring sRet(pBuffer); - size_t nSeparatorPos = sRet.find_last_of(wchar_t('/')); - if (std::wstring::npos == nSeparatorPos) - { - nSeparatorPos = sRet.find_last_of(wchar_t('\\')); - } + size_t nSeparatorPos = sRet.find_last_of(wchar_t('/')); + if (std::wstring::npos == nSeparatorPos) + { + nSeparatorPos = sRet.find_last_of(wchar_t('\\')); + } - if (std::wstring::npos == nSeparatorPos) - return L""; + if (std::wstring::npos == nSeparatorPos) + return L""; - return sRet.substr(0, nSeparatorPos); + return sRet.substr(0, nSeparatorPos); #else - char *folder = getenv("TEMP"); + char *folder = getenv("TEMP"); - if (NULL == folder) - folder = getenv("TMP"); - if (NULL == folder) - folder = getenv("TMPDIR"); - if (NULL == folder) - folder = "/tmp"; + if (NULL == folder) + folder = getenv("TMP"); + if (NULL == folder) + folder = getenv("TMPDIR"); + if (NULL == folder) + folder = "/tmp"; - return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)folder, strlen(folder)); + return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)folder, strlen(folder)); #endif - } - std::wstring CFileBinary::CreateTempFileWithUniqueName(const std::wstring& strFolderPathRoot, const std::wstring& Prefix) - { + } + std::wstring CFileBinary::CreateTempFileWithUniqueName(const std::wstring& strFolderPathRoot, const std::wstring& Prefix) + { #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - wchar_t pBuffer[MAX_PATH + 1]; - ::GetTempFileNameW(strFolderPathRoot.c_str(), Prefix.c_str(), 0, pBuffer); - std::wstring sRet(pBuffer); - return sRet; + wchar_t pBuffer[MAX_PATH + 1]; + ::GetTempFileNameW(strFolderPathRoot.c_str(), Prefix.c_str(), 0, pBuffer); + std::wstring sRet(pBuffer); + return sRet; #else - char pcRes[MAX_PATH]; - BYTE* pData = (BYTE*)pcRes; + char pcRes[MAX_PATH]; + BYTE* pData = (BYTE*)pcRes; - std::wstring sPrefix = strFolderPathRoot + L"/" + Prefix + L"_XXXXXX"; - LONG lLen = 0; - NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sPrefix.c_str(), (LONG)sPrefix.length(), pData, lLen); - pcRes[lLen] = '\0'; + std::wstring sPrefix = strFolderPathRoot + L"/" + Prefix + L"_XXXXXX"; + LONG lLen = 0; + NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sPrefix.c_str(), (LONG)sPrefix.length(), pData, lLen); + pcRes[lLen] = '\0'; - int res = mkstemp(pcRes); - if (-1 != res) - close(res); + int res = mkstemp(pcRes); + if (-1 != res) + close(res); - std::string sRes = pcRes; - return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sRes.c_str(), sRes.length()); + std::string sRes = pcRes; + return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sRes.c_str(), sRes.length()); #endif - } - bool CFileBinary::OpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder, wchar_t* wsName) - { - // TODO: Реализовать когда wsName != NULL + } + bool CFileBinary::OpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder, wchar_t* wsName) + { + // TODO: Реализовать когда wsName != NULL - std::wstring wsTemp, wsFileName; - FILE *pTempFile = NULL; + std::wstring wsTemp, wsFileName; + FILE *pTempFile = NULL; #if defined(_WIN32) || defined (_WIN64) - wchar_t *wsTempDir = NULL; - size_t sz = 0; - if ( (0 == _wdupenv_s(&wsTempDir, &sz, L"TEMP")) && (wsFolder == NULL)) - { - wsTemp = std::wstring(wsTempDir, sz-1); + wchar_t *wsTempDir = NULL; + size_t sz = 0; + if ( (0 == _wdupenv_s(&wsTempDir, &sz, L"TEMP")) && (wsFolder == NULL)) + { + wsTemp = std::wstring(wsTempDir, sz-1); #else - char *wsTempDirA; - if ((wsTempDirA = getenv("TEMP")) && (wsFolder == NULL)) - { - std::wstring wsTempDir = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)wsTempDirA, strlen(wsTempDirA)); - wsTemp = wsTempDir.c_str(); + char *wsTempDirA; + if ((wsTempDirA = getenv("TEMP")) && (wsFolder == NULL)) + { + std::wstring wsTempDir = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)wsTempDirA, strlen(wsTempDirA)); + wsTemp = wsTempDir.c_str(); #endif - wsTemp += L"/"; - } - else if (wsFolder != NULL) - { - wsTemp = std::wstring(wsFolder); - wsTemp += L"/"; - } - else - { - wsTemp = L""; - } - wsTemp += L"x"; - int nTime = (int)time(NULL); - for (int nIndex = 0; nIndex < 1000; ++nIndex) - { - wsFileName = wsTemp; - wsFileName.append(std::to_wstring(nTime + nIndex)); + wsTemp += L"/"; + } + else if (wsFolder != NULL) + { + wsTemp = std::wstring(wsFolder); + wsTemp += L"/"; + } + else + { + wsTemp = L""; + } + wsTemp += L"x"; + int nTime = (int)time(NULL); + for (int nIndex = 0; nIndex < 1000; ++nIndex) + { + wsFileName = wsTemp; + wsFileName.append(std::to_wstring(nTime + nIndex)); - if (wsExt) - { - wsFileName.append(wsExt); - } + if (wsExt) + { + wsFileName.append(wsExt); + } #if defined (_WIN32) || defined (_WIN64) - if ( 0 != _wfopen_s(&pTempFile, wsFileName.c_str(), L"r") ) - { - if (0 != _wfopen_s(&pTempFile, wsFileName.c_str(), wsMode)) + if ( 0 != _wfopen_s(&pTempFile, wsFileName.c_str(), L"r") ) + { + if (0 != _wfopen_s(&pTempFile, wsFileName.c_str(), wsMode)) #else - std::string sFileName = U_TO_UTF8(wsFileName); - if (!(pTempFile = fopen(sFileName.c_str(), "r"))) - { - std::wstring strMode(wsMode); - std::string sMode = U_TO_UTF8(strMode); - if (!(pTempFile = fopen(sFileName.c_str(), sMode.c_str()))) + std::string sFileName = U_TO_UTF8(wsFileName); + if (!(pTempFile = fopen(sFileName.c_str(), "r"))) + { + std::wstring strMode(wsMode); + std::string sMode = U_TO_UTF8(strMode); + if (!(pTempFile = fopen(sFileName.c_str(), sMode.c_str()))) #endif - { - return FALSE; - } - *pwsName = wsFileName; - *ppFile = pTempFile; - return TRUE; - } + { + return FALSE; + } + *pwsName = wsFileName; + *ppFile = pTempFile; + return TRUE; + } - fclose(pTempFile); - } + fclose(pTempFile); + } - return FALSE; - } - FILE* CFileBinary::OpenFileNative(const std::wstring& sFileName, const std::wstring& sMode) - { + return FALSE; + } + FILE* CFileBinary::OpenFileNative(const std::wstring& sFileName, const std::wstring& sMode) + { #if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64) - FILE* pFile = NULL; - _wfopen_s(&pFile, sFileName.c_str(), sMode.c_str()); + FILE* pFile = NULL; + _wfopen_s(&pFile, sFileName.c_str(), sMode.c_str()); - return pFile; + return pFile; #else - BYTE* pUtf8 = NULL; - LONG lLen = 0; - CUtf8Converter::GetUtf8StringFromUnicode(sFileName.c_str(), sFileName.length(), pUtf8, lLen, false); + BYTE* pUtf8 = NULL; + LONG lLen = 0; + CUtf8Converter::GetUtf8StringFromUnicode(sFileName.c_str(), sFileName.length(), pUtf8, lLen, false); - BYTE* pMode = NULL; - LONG lLenMode; - CUtf8Converter::GetUtf8StringFromUnicode(sMode.c_str(), sMode.length(), pMode, lLenMode, false); + BYTE* pMode = NULL; + LONG lLenMode; + CUtf8Converter::GetUtf8StringFromUnicode(sMode.c_str(), sMode.length(), pMode, lLenMode, false); - struct stat st; - if ((0 == stat((char*)pUtf8, &st)) && S_ISDIR(st.st_mode)) - { - delete [] pUtf8; - delete [] pMode; - return NULL; - } + struct stat st; + if ((0 == stat((char*)pUtf8, &st)) && S_ISDIR(st.st_mode)) + { + delete [] pUtf8; + delete [] pMode; + return NULL; + } - FILE* pFile = fopen((char*)pUtf8, (char*)pMode); + FILE* pFile = fopen((char*)pUtf8, (char*)pMode); - delete [] pUtf8; - delete [] pMode; + delete [] pUtf8; + delete [] pMode; - return pFile; + return pFile; #endif - } + } - void CFileBinary::SetTempPath(const std::wstring& strTempPath) - { - g_overrideTmpPath = strTempPath; - } + void CFileBinary::SetTempPath(const std::wstring& strTempPath) + { + g_overrideTmpPath = strTempPath; + } - unsigned long CFileBinary::GetDateTime(const std::wstring & inputFile) - { - unsigned long result = 0; + unsigned long CFileBinary::GetDateTime(const std::wstring & inputFile) + { + unsigned long result = 0; #if defined(_WIN32) || defined (_WIN64) - HANDLE hFile; - hFile = ::CreateFileW(inputFile.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile; + hFile = ::CreateFileW(inputFile.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile) - { - FILETIME ft; ft.dwLowDateTime = ft.dwHighDateTime = 0; - if (GetFileTime(hFile, NULL, NULL, &ft)) - { - WORD fatDate = 0, fatTime = 0; - if (FileTimeToDosDateTime(&ft, &fatDate, &fatTime)) - { - result = (fatDate << 16) + fatTime; - } - } - CloseHandle(hFile); - } + if (hFile) + { + FILETIME ft; ft.dwLowDateTime = ft.dwHighDateTime = 0; + if (GetFileTime(hFile, NULL, NULL, &ft)) + { + WORD fatDate = 0, fatTime = 0; + if (FileTimeToDosDateTime(&ft, &fatDate, &fatTime)) + { + result = (fatDate << 16) + fatTime; + } + } + CloseHandle(hFile); + } #else - std::string inputFileA = U_TO_UTF8(inputFile); + std::string inputFileA = U_TO_UTF8(inputFile); #if defined(__linux__) && !defined(_MAC) - struct stat attrib; - stat(inputFileA.c_str(), &attrib); - result = attrib.st_mtim.tv_nsec; + struct stat attrib; + stat(inputFileA.c_str(), &attrib); + result = attrib.st_mtim.tv_nsec; #else - struct stat attrib; - stat(inputFileA.c_str(), &attrib); - result = (unsigned long)attrib.st_mtimespec.tv_nsec; + struct stat attrib; + stat(inputFileA.c_str(), &attrib); + result = (unsigned long)attrib.st_mtimespec.tv_nsec; #endif #endif - return result; - } + return result; + } } namespace NSFile { - bool CBase64Converter::Encode(BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags) - { - if (!pDataSrc || nLenSrc < 1) - return false; + bool CBase64Converter::Encode(BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags) + { + if (!pDataSrc || nLenSrc < 1) + return false; - nLenDst = NSBase64::Base64EncodeGetRequiredLength(nLenSrc, dwFlags); - pDataDst = new char[nLenDst]; + nLenDst = NSBase64::Base64EncodeGetRequiredLength(nLenSrc, dwFlags); + pDataDst = new char[nLenDst]; - if (FALSE == NSBase64::Base64Encode(pDataSrc, nLenSrc, (BYTE*)pDataDst, &nLenDst, dwFlags)) - { - RELEASEARRAYOBJECTS(pDataDst); - return false; - } - return true; - } - bool CBase64Converter::Decode(const char* pDataSrc, int nLenSrc, BYTE*& pDataDst, int& nLenDst) - { - if (!pDataSrc || nLenSrc < 1) - return false; + if (FALSE == NSBase64::Base64Encode(pDataSrc, nLenSrc, (BYTE*)pDataDst, &nLenDst, dwFlags)) + { + RELEASEARRAYOBJECTS(pDataDst); + return false; + } + return true; + } + bool CBase64Converter::Decode(const char* pDataSrc, int nLenSrc, BYTE*& pDataDst, int& nLenDst) + { + if (!pDataSrc || nLenSrc < 1) + return false; - nLenDst = NSBase64::Base64DecodeGetRequiredLength(nLenSrc); - pDataDst = new BYTE[nLenDst]; + nLenDst = NSBase64::Base64DecodeGetRequiredLength(nLenSrc); + pDataDst = new BYTE[nLenDst]; - if (FALSE == NSBase64::Base64Decode(pDataSrc, nLenSrc, pDataDst, &nLenDst)) - { - RELEASEARRAYOBJECTS(pDataDst); - return false; - } - return true; - } + if (FALSE == NSBase64::Base64Decode(pDataSrc, nLenSrc, pDataDst, &nLenDst)) + { + RELEASEARRAYOBJECTS(pDataDst); + return false; + } + return true; + } } namespace NSFile { - std::wstring GetProcessPath() - { + std::wstring GetProcessPath() + { #if defined (_WIN64) || defined(_WIN32) - wchar_t buf [NS_FILE_MAX_PATH]; - GetModuleFileNameW(GetModuleHandle(NULL), buf, NS_FILE_MAX_PATH); - return std::wstring(buf); + wchar_t buf [NS_FILE_MAX_PATH]; + GetModuleFileNameW(GetModuleHandle(NULL), buf, NS_FILE_MAX_PATH); + return std::wstring(buf); #endif #if defined(__linux__) || defined(_MAC) && !defined(_IOS) - char buf[NS_FILE_MAX_PATH]; - memset(buf, 0, NS_FILE_MAX_PATH); - if (readlink ("/proc/self/exe", buf, NS_FILE_MAX_PATH) <= 0) - { + char buf[NS_FILE_MAX_PATH]; + memset(buf, 0, NS_FILE_MAX_PATH); + if (readlink ("/proc/self/exe", buf, NS_FILE_MAX_PATH) <= 0) + { #ifdef _MAC - uint32_t _size = NS_FILE_MAX_PATH; - _NSGetExecutablePath(buf, &_size); - std::string sUTF8(buf); - std::wstring sRet = CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sUTF8.c_str(), sUTF8.length()); - return sRet; + uint32_t _size = NS_FILE_MAX_PATH; + _NSGetExecutablePath(buf, &_size); + std::string sUTF8(buf); + std::wstring sRet = CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sUTF8.c_str(), sUTF8.length()); + return sRet; #endif - return L""; - } + return L""; + } - std::string sUTF8(buf); - std::wstring sRet = CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sUTF8.c_str(), sUTF8.length()); - return sRet; + std::string sUTF8(buf); + std::wstring sRet = CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sUTF8.c_str(), sUTF8.length()); + return sRet; #endif - return L""; - } + return L""; + } - std::wstring GetProcessDirectory() - { - std::wstring sPath = GetProcessPath(); + std::wstring GetProcessDirectory() + { + std::wstring sPath = GetProcessPath(); - size_t pos1 = sPath.find_last_of(wchar_t('/')); - size_t pos2 = sPath.find_last_of(wchar_t('\\')); + size_t pos1 = sPath.find_last_of(wchar_t('/')); + size_t pos2 = sPath.find_last_of(wchar_t('\\')); - size_t pos = std::wstring::npos; - if (pos1 != std::wstring::npos) - pos = pos1; + size_t pos = std::wstring::npos; + if (pos1 != std::wstring::npos) + pos = pos1; - if (pos2 != std::wstring::npos) - { - if (pos == std::wstring::npos) - pos = pos2; - else if (pos2 > pos) - pos = pos2; - } + if (pos2 != std::wstring::npos) + { + if (pos == std::wstring::npos) + pos = pos2; + else if (pos2 > pos) + pos = pos2; + } - if (pos != std::wstring::npos) - { - sPath = sPath.substr(0, pos); - } - return sPath; - } + if (pos != std::wstring::npos) + { + sPath = sPath.substr(0, pos); + } + return sPath; + } - // CommonFunctions - std::wstring GetFileExtention(const std::wstring& sPath) - { - std::wstring::size_type nPos = sPath.rfind('.'); - if (nPos != std::wstring::npos) - return sPath.substr(nPos + 1); - return sPath; - } - std::wstring GetFileName(const std::wstring& sPath) - { + // CommonFunctions + std::wstring GetFileExtention(const std::wstring& sPath) + { + std::wstring::size_type nPos = sPath.rfind('.'); + if (nPos != std::wstring::npos) + return sPath.substr(nPos + 1); + return sPath; + } + std::wstring GetFileName(const std::wstring& sPath) + { #ifdef _WIN32 - std::wstring::size_type nPos1 = sPath.rfind('\\'); + std::wstring::size_type nPos1 = sPath.rfind('\\'); #else - std::wstring::size_type nPos1 = std::wstring::npos; + std::wstring::size_type nPos1 = std::wstring::npos; #endif - std::wstring::size_type nPos2 = sPath.rfind('/'); - std::wstring::size_type nPos = std::wstring::npos; + std::wstring::size_type nPos2 = sPath.rfind('/'); + std::wstring::size_type nPos = std::wstring::npos; - if (nPos1 != std::wstring::npos) - { - nPos = nPos1; - if (nPos2 != std::wstring::npos && nPos2 > nPos) - nPos = nPos2; - } - else - nPos = nPos2; + if (nPos1 != std::wstring::npos) + { + nPos = nPos1; + if (nPos2 != std::wstring::npos && nPos2 > nPos) + nPos = nPos2; + } + else + nPos = nPos2; - if (nPos == std::wstring::npos) - return sPath; - return sPath.substr(nPos + 1); - } - std::wstring GetDirectoryName(const std::wstring& sPath) - { + if (nPos == std::wstring::npos) + return sPath; + return sPath.substr(nPos + 1); + } + std::wstring GetDirectoryName(const std::wstring& sPath) + { #ifdef _WIN32 - std::wstring::size_type nPos1 = sPath.rfind('\\'); + std::wstring::size_type nPos1 = sPath.rfind('\\'); #else - std::wstring::size_type nPos1 = std::wstring::npos; + std::wstring::size_type nPos1 = std::wstring::npos; #endif - std::wstring::size_type nPos2 = sPath.rfind('/'); - std::wstring::size_type nPos = std::wstring::npos; + std::wstring::size_type nPos2 = sPath.rfind('/'); + std::wstring::size_type nPos = std::wstring::npos; - if (nPos1 != std::wstring::npos) - { - nPos = nPos1; - if (nPos2 != std::wstring::npos && nPos2 > nPos) - nPos = nPos2; - } - else - nPos = nPos2; + if (nPos1 != std::wstring::npos) + { + nPos = nPos1; + if (nPos2 != std::wstring::npos && nPos2 > nPos) + nPos = nPos2; + } + else + nPos = nPos2; - if (nPos == std::wstring::npos) - return sPath; - return sPath.substr(0, nPos); - } + if (nPos == std::wstring::npos) + return sPath; + return sPath.substr(0, nPos); + } } diff --git a/DesktopEditor/common/File.h b/DesktopEditor/common/File.h index ec86528787..f7fc427151 100644 --- a/DesktopEditor/common/File.h +++ b/DesktopEditor/common/File.h @@ -59,22 +59,22 @@ #define UTF8_TO_U(val) NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)val.c_str(), (LONG)val.length()) #ifndef MAX_PATH - #define MAX_PATH 1024 +#define MAX_PATH 1024 #endif std::wstring KERNEL_DECL CorrectPathW(const std::wstring& path); namespace NSFile { - #define WriteUtf16_WCHAR(code, p) \ +#define WriteUtf16_WCHAR(code, p) \ if (code < 0x10000) \ - *p++ = code; \ + *p++ = code; \ else \ { \ - code -= 0x10000; \ - *p++ = 0xD800 | ((code >> 10) & 0x03FF); \ - *p++ = 0xDC00 | (code & 0x03FF); \ - } + code -= 0x10000; \ + *p++ = 0xD800 | ((code >> 10) & 0x03FF); \ + *p++ = 0xDC00 | (code & 0x03FF); \ +} class CStringUtf16 { @@ -83,57 +83,57 @@ namespace NSFile int Length; public: - CStringUtf16() - { - Data = NULL; - Length = 0; - } - ~CStringUtf16() - { - RELEASEARRAYOBJECTS(Data); - } - }; + CStringUtf16() + { + Data = NULL; + Length = 0; + } + ~CStringUtf16() + { + RELEASEARRAYOBJECTS(Data); + } + }; - class KERNEL_DECL CUtf8Converter + class KERNEL_DECL CUtf8Converter { public: - static std::wstring GetUnicodeFromCharPtr(const char* pData, LONG lCount, INT bIsUtf8 = FALSE); - static std::wstring GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8 = FALSE); + static std::wstring GetUnicodeFromCharPtr(const char* pData, LONG lCount, INT bIsUtf8 = FALSE); + static std::wstring GetUnicodeFromCharPtr(const std::string& sParam, INT bIsUtf8 = FALSE); - static std::wstring GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount ); - static std::wstring GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount ); - static std::wstring GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount ); + static std::wstring GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount ); + static std::wstring GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount ); + static std::wstring GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount ); static void GetUnicodeStringFromUTF8_4bytes( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ); static void GetUnicodeStringFromUTF8_2bytes( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ); static void GetUnicodeStringFromUTF8( BYTE* pBuffer, LONG lCount, std::wstring& sOutput ); - static void GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ); - static void GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ); - static void GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ); + static void GetUnicodeStringFromUTF8WithHHHH_4bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ); + static void GetUnicodeStringFromUTF8WithHHHH_2bytes( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ); + static void GetUnicodeStringFromUTF8WithHHHH( const BYTE* pBuffer, LONG lCount, wchar_t*& pUnicodes, LONG& lOutputCount ); - static LONG GetUnicodeStringFromUTF8BufferSize( LONG lCount ); + static LONG GetUnicodeStringFromUTF8BufferSize( LONG lCount ); - static void GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false); - static void GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false); - static void GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false); + static void GetUtf8StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false); + static void GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false); + static void GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false); - static std::string GetUtf8StringFromUnicode2(const wchar_t* pUnicodes, LONG lCount, bool bIsBOM = false); - static std::string GetUtf8StringFromUnicode(const std::wstring& sData); + static std::string GetUtf8StringFromUnicode2(const wchar_t* pUnicodes, LONG lCount, bool bIsBOM = false); + static std::string GetUtf8StringFromUnicode(const std::wstring& sData); // utf16 - static void GetUtf16StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, int& lOutputCount, bool bIsBOM = false); - static void GetUtf16StringFromUnicode_4bytes2(const wchar_t* pUnicodes, LONG lCount, CStringUtf16& data); - - static std::wstring GetWStringFromUTF16(const CStringUtf16& data); - static std::wstring GetWStringFromUTF16(const unsigned short* pUtf16, LONG lCount); + static void GetUtf16StringFromUnicode_4bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, int& lOutputCount, bool bIsBOM = false); + static void GetUtf16StringFromUnicode_4bytes2(const wchar_t* pUnicodes, LONG lCount, CStringUtf16& data); - static long CheckHHHHChar(const BYTE* pBuffer); - static long CheckHHHHChar(const wchar_t* pBuffer); + static std::wstring GetWStringFromUTF16(const CStringUtf16& data); + static std::wstring GetWStringFromUTF16(const unsigned short* pUtf16, LONG lCount); + + static long CheckHHHHChar(const BYTE* pBuffer); + static long CheckHHHHChar(const wchar_t* pBuffer); }; - class KERNEL_DECL CFileBinary + class KERNEL_DECL CFileBinary { protected: FILE* m_pFile; @@ -142,63 +142,77 @@ namespace NSFile long m_lFileSize; public: - CFileBinary(); - virtual ~CFileBinary(); + CFileBinary(); + virtual ~CFileBinary(); - virtual void CloseFile(); + virtual void CloseFile(); - FILE* GetFileNative(); - long GetFileSize(); - long GetFilePosition(); + 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 CreateTempFile(); - bool SeekFile(int lFilePosition, int nSeekMode = 0); - bool ReadFile(BYTE* pData, DWORD nBytesToRead, DWORD& dwSizeRead); - bool WriteFile(const BYTE* pData, DWORD nBytesCount); - long TellFile(); - long SizeFile(); - void WriteStringUTF8(const std::wstring& strXml, bool bIsBOM = false); - static bool ReadAllBytes(const std::wstring& strFileName, BYTE** ppData, DWORD& nBytesCount); - static bool ReadAllTextUtf8(const std::wstring& strFileName, std::wstring& sData); - static bool ReadAllTextUtf8A(const std::wstring& strFileName, std::string& sData); - static bool SaveToFile(const std::wstring& strFileName, const std::wstring& strXml, bool bIsBOM = false); - static bool Exists(const std::wstring& strFileName); - static bool Copy(const std::wstring& strSrc, const std::wstring& strDst); - static bool Remove(const std::wstring& strFileName); - static bool Move(const std::wstring& strSrc, const std::wstring& strDst); - static bool Truncate(const std::wstring& sPath, size_t nNewSize); + bool OpenFile(const std::wstring& sFileName, bool bRewrite = false); + bool CreateFileW(const std::wstring& sFileName); + bool CreateFile(const std::wstring& sFileName); - static void SetTempPath(const std::wstring& strTempPath); - static std::wstring GetTempPath(); + 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(); + long SizeFile(); + void WriteStringUTF8(const std::wstring& strXml, bool bIsBOM = false); - static std::wstring CreateTempFileWithUniqueName(const std::wstring& strFolderPathRoot, const std::wstring& Prefix); - static bool OpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder, wchar_t* wsName = NULL); - static FILE* OpenFileNative(const std::wstring& sFileName, const std::wstring& sMode); + bool WriteReserved(DWORD dwCount); + bool WriteReserved2(DWORD dwCount); + bool WriteReservedTo(DWORD dwPoint); + bool SkipReservedTo(DWORD dwPoint); + LONG GetProgress(); + bool SkipBytes(ULONG nCount); - static unsigned long GetDateTime(const std::wstring & strFileName); + static bool ReadAllBytes(const std::wstring& strFileName, BYTE** ppData, DWORD& nBytesCount); + static bool ReadAllTextUtf8(const std::wstring& strFileName, std::wstring& sData); + static bool ReadAllTextUtf8A(const std::wstring& strFileName, std::string& sData); + static bool SaveToFile(const std::wstring& strFileName, const std::wstring& strXml, bool bIsBOM = false); + static bool Exists(const std::wstring& strFileName); + static bool Copy(const std::wstring& strSrc, const std::wstring& strDst); + static bool Remove(const std::wstring& strFileName); + static bool Move(const std::wstring& strSrc, const std::wstring& strDst); + static bool Truncate(const std::wstring& sPath, size_t nNewSize); + + static void SetTempPath(const std::wstring& strTempPath); + static std::wstring GetTempPath(); + + static std::wstring CreateTempFileWithUniqueName(const std::wstring& strFolderPathRoot, const std::wstring& Prefix); + static bool OpenTempFile(std::wstring *pwsName, FILE **ppFile, wchar_t *wsMode, wchar_t *wsExt, wchar_t *wsFolder, wchar_t* wsName = NULL); + static FILE* OpenFileNative(const std::wstring& sFileName, const std::wstring& sMode); + + static unsigned long GetDateTime(const std::wstring & strFileName); }; - class KERNEL_DECL CBase64Converter + class KERNEL_DECL CBase64Converter { public: - static bool Encode(BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags = NSBase64::B64_BASE64_FLAG_NONE); - static bool Decode(const char* pDataSrc, int nLenSrc, BYTE*& pDataDst, int& nLenDst); + static bool Encode(BYTE* pDataSrc, int nLenSrc, char*& pDataDst, int& nLenDst, DWORD dwFlags = NSBase64::B64_BASE64_FLAG_NONE); + static bool Decode(const char* pDataSrc, int nLenSrc, BYTE*& pDataDst, int& nLenDst); }; } namespace NSFile { - #define NS_FILE_MAX_PATH 32768 - KERNEL_DECL std::wstring GetProcessPath(); - KERNEL_DECL std::wstring GetProcessDirectory(); +#define NS_FILE_MAX_PATH 32768 + KERNEL_DECL std::wstring GetProcessPath(); + KERNEL_DECL std::wstring GetProcessDirectory(); - // CommonFunctions - KERNEL_DECL std::wstring GetFileExtention(const std::wstring& sPath); - KERNEL_DECL std::wstring GetFileName(const std::wstring& sPath); - KERNEL_DECL std::wstring GetDirectoryName(const std::wstring& sPath); + // CommonFunctions + KERNEL_DECL std::wstring GetFileExtention(const std::wstring& sPath); + KERNEL_DECL std::wstring GetFileName(const std::wstring& sPath); + KERNEL_DECL std::wstring GetDirectoryName(const std::wstring& sPath); } #endif //_BUILD_FILE_CROSSPLATFORM_H_ 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/DesktopEditor/common/StringExt.h b/DesktopEditor/common/StringExt.h index 4dd0602203..c38b2211e1 100644 --- a/DesktopEditor/common/StringExt.h +++ b/DesktopEditor/common/StringExt.h @@ -364,7 +364,7 @@ namespace NSStringExt // Parse error on anything but a null terminator if (pos < wsString.length()) return false; - res = exp ? coeff * pow(unit, exp / 3) : coeff; + res = exp ? (long long)(coeff * pow(unit, exp / 3)) : coeff; return true; } } 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 c5b73ffc98..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/Types_32.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/OfficeCryptReader/source/ECMACryptFile.cpp b/OfficeCryptReader/source/ECMACryptFile.cpp index 61c1e78fcb..a285cd6281 100644 --- a/OfficeCryptReader/source/ECMACryptFile.cpp +++ b/OfficeCryptReader/source/ECMACryptFile.cpp @@ -34,7 +34,7 @@ #include "CryptTransform.h" #include "../../Common/3dParty/pole/pole.h" -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include "../../DesktopEditor/common/File.h" #include "../../DesktopEditor/common/SystemUtils.h" diff --git a/X2tConverter/src/ASCConverters.h b/X2tConverter/src/ASCConverters.h index 8fc7b2e196..82f5adf851 100644 --- a/X2tConverter/src/ASCConverters.h +++ b/X2tConverter/src/ASCConverters.h @@ -40,7 +40,7 @@ #endif #include -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" namespace NExtractTools { diff --git a/X2tConverter/src/cextracttools.cpp b/X2tConverter/src/cextracttools.cpp index 534142cb25..19e0c1dc97 100644 --- a/X2tConverter/src/cextracttools.cpp +++ b/X2tConverter/src/cextracttools.cpp @@ -505,7 +505,7 @@ namespace NExtractTools { nErrorIndexStart = sResult.find(_T("\""), nErrorIndexStart + 1); int nErrorIndexEnd = sResult.find(_T("\""), nErrorIndexStart + 1); - nErrorIndex = _wtoi(sResult.substr(nErrorIndexStart + 1, nErrorIndexEnd - nErrorIndexStart - 1).c_str()); + nErrorIndex = XmlUtils::GetInteger(sResult.substr(nErrorIndexStart + 1, nErrorIndexEnd - nErrorIndexStart - 1)); } if (nErrorIndex > 0 && nChangeIndex != nErrorIndex) { 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/X2tConverter/src/main.cpp b/X2tConverter/src/main.cpp index af10b06b67..3acc229ca5 100644 --- a/X2tConverter/src/main.cpp +++ b/X2tConverter/src/main.cpp @@ -46,36 +46,7 @@ using namespace NExtractTools; #if !defined(_WIN32) && !defined (_WIN64) static std::wstring utf8_to_unicode(const char *src) { - if (src == NULL) return _T(""); - std::string temp = src; - - unsigned int nLength = temp.length(); - - UTF32 *pStrUtf32 = new UTF32 [nLength+1]; - memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength+1)); - - - UTF8 *pStrUtf8 = (UTF8 *) src; - - // this values will be modificated - const UTF8 *pStrUtf8_Conv = pStrUtf8; - UTF32 *pStrUtf32_Conv = pStrUtf32; - - ConversionResult eUnicodeConversionResult = ConvertUTF8toUTF32 (&pStrUtf8_Conv, - &pStrUtf8[nLength] - , &pStrUtf32_Conv - , &pStrUtf32 [nLength] - , strictConversion); - - if (conversionOK != eUnicodeConversionResult) - { - delete [] pStrUtf32; - return L""; - } - std::wstring wsEntryName ((wchar_t *) pStrUtf32); - - delete [] pStrUtf32; - return wsEntryName; + return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)src, (LONG)strlen(src)); } #endif @@ -137,7 +108,7 @@ static std::wstring utf8_to_unicode(const char *src) #if !defined(_WIN32) && !defined (_WIN64) sExePath = utf8_to_unicode(argv [0]); sArg1 = utf8_to_unicode(argv [1]); - if (argc >= 3) sArg2 = utf8_to_unicode(argv [2]); + if (argc >= 3) sArg2 = utf8_to_unicode(argv [2]); #else sExePath = std::wstring(argv [0]); sArg1 = std::wstring(argv [1]); @@ -163,9 +134,9 @@ static std::wstring utf8_to_unicode(const char *src) std::wstring sArg3, sArg4, sArg5; #if !defined(_WIN32) && !defined (_WIN64) - if (argc >= 4) sArg3 = utf8_to_unicode(argv [3]); - if (argc >= 5) sArg4 = utf8_to_unicode(argv [4]); - if (argc >= 6) sArg5 = utf8_to_unicode(argv [5]); + if (argc >= 4) sArg3 = utf8_to_unicode(argv [3]); + if (argc >= 5) sArg4 = utf8_to_unicode(argv [4]); + if (argc >= 6) sArg5 = utf8_to_unicode(argv [5]); #else if (argc >= 4) sArg3 = std::wstring(argv [3]); if (argc >= 5) sArg4 = std::wstring(argv [4]); diff --git a/XlsxSerializerCom/Common/Common.cpp b/XlsxSerializerCom/Common/Common.cpp index 65998aeb1a..65ef840117 100644 --- a/XlsxSerializerCom/Common/Common.cpp +++ b/XlsxSerializerCom/Common/Common.cpp @@ -117,9 +117,9 @@ namespace SerializeCommon sDelimiter = L";"; // default cSaveFileType = BinXlsxRW::c_oFileTypes::XLSX;// default - nullable> fileType; - nullable> codePage; - nullable> saveFileType; + nullable fileType; + nullable codePage; + nullable saveFileType; nullable delimiter; // Read options diff --git a/XlsxSerializerCom/Common/Common.h b/XlsxSerializerCom/Common/Common.h index 2cc782050d..7c1f0cb786 100644 --- a/XlsxSerializerCom/Common/Common.h +++ b/XlsxSerializerCom/Common/Common.h @@ -31,8 +31,9 @@ */ #pragma once -#include "../../Common/DocxFormat/Source/XML/Utils.h" +#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/Reader/CSVReader.h b/XlsxSerializerCom/Reader/CSVReader.h index 7a927f43db..e7cd276414 100644 --- a/XlsxSerializerCom/Reader/CSVReader.h +++ b/XlsxSerializerCom/Reader/CSVReader.h @@ -33,7 +33,7 @@ #include #include -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include diff --git a/XlsxSerializerCom/Writer/BinaryReader.cpp b/XlsxSerializerCom/Writer/BinaryReader.cpp index b13f23955b..8bd39651be 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; @@ -5859,7 +5859,7 @@ int BinaryWorksheetsTableReader::ReadCells(BYTE type, long length, void* poResul } if(bMoveText) { - int nValue = _wtoi(oCell.m_oValue->ToString().c_str()); + int nValue = XmlUtils::GetInteger(oCell.m_oValue->ToString()); if (nValue >= 0 && nValue < (int)m_pSharedStrings->m_arrItems.size()) { @@ -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(); diff --git a/XlsxSerializerCom/Writer/CSVWriter.h b/XlsxSerializerCom/Writer/CSVWriter.h index f6b8b4e4f2..e780758467 100644 --- a/XlsxSerializerCom/Writer/CSVWriter.h +++ b/XlsxSerializerCom/Writer/CSVWriter.h @@ -32,7 +32,7 @@ #pragma once #include -#include "../../Common/DocxFormat/Source/Base/Types_32.h" +#include "../../Common/DocxFormat/Source/Base/Base.h" #include