From 5c44484c2414f7292ff63ff03deb573c7f63149a Mon Sep 17 00:00:00 2001 From: Elena Subbotina Date: Wed, 13 Jul 2022 12:21:31 +0300 Subject: [PATCH] fix images from word 2003 xml --- .../source/Oox2OdfConverter/ConvertVml.cpp | 70 +- .../source/Reader/OOXShapeReader.cpp | 4 +- .../DocxFormat/Source/Common/ComplexTypes.h | 20 +- .../Source/Common/SimpleTypes_Shared.h | 4 +- .../Source/Common/SimpleTypes_Word.h | 11 +- .../DocxFormat/Source/DocxFormat/DocxFlat.h | 2 +- Common/DocxFormat/Source/DocxFormat/FtnEdn.h | 201 ++-- .../Source/DocxFormat/Logic/Annotations.h | 142 +-- .../Source/DocxFormat/Logic/FldChar.h | 8 +- .../Source/DocxFormat/Logic/Paragraph.cpp | 188 ++-- .../Source/DocxFormat/Logic/Pict.cpp | 2 +- .../DocxFormat/Source/DocxFormat/Logic/Pict.h | 40 +- .../Source/DocxFormat/Logic/Run.cpp | 174 ++- .../DocxFormat/Logic/SectionProperty.cpp | 245 ++--- .../Source/DocxFormat/Logic/SectionProperty.h | 179 ++-- .../Source/DocxFormat/Logic/Vml.cpp | 999 +++++++++--------- .../DocxFormat/Source/DocxFormat/Logic/Vml.h | 102 +- .../Source/DocxFormat/Media/Media.cpp | 3 + .../Source/DocxFormat/Settings/Settings.cpp | 9 +- .../raster/ImageFileFormatChecker.cpp | 2 +- 20 files changed, 1137 insertions(+), 1268 deletions(-) diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp index 2c11275be3..20094b0094 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp @@ -448,7 +448,7 @@ namespace Oox2Odf odf_context()->drawing_context()->set_bitmap_link(pathImage); odf_context()->drawing_context()->set_image_style_repeat(1);//stretch - double gain = vml_image_data->m_oGain.GetValue(); + double gain = vml_image_data->m_oGain.get_value_or(0); if (gain > 1) odf_context()->drawing_context()->set_opacity(gain / 1000.); @@ -754,7 +754,7 @@ namespace Oox2Odf void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke) { if (vml_stroke == NULL) return; - if (vml_stroke->m_oOn.GetValue() == false) return; + if (vml_stroke->m_oOn.IsInit() && vml_stroke->m_oOn->GetBool() == false) return; if (vml_stroke->m_oColor.IsInit() == false) return; // ????? //nullable> m_oColor2; @@ -777,41 +777,47 @@ namespace Oox2Odf if (vml_stroke->m_oOpacity.IsInit()) { - odf_context()->drawing_context()->set_opacity(100 - vml_stroke->m_oOpacity->GetValue() * 100); + odf_context()->drawing_context()->set_opacity(100 - *vml_stroke->m_oOpacity * 100); } - odf_context()->drawing_context()->set_line_width(vml_stroke->m_oWeight.GetValue()); + odf_context()->drawing_context()->set_line_width(vml_stroke->m_oWeight.get_value_or(0)); - switch (vml_stroke->m_oStartArrow.GetValue()) + if (vml_stroke->m_oStartArrow.IsInit() && vml_stroke->m_oStartArrowLength.IsInit() && vml_stroke->m_oStartArrowWidth.IsInit()) { - case SimpleTypes::strokearrowtypeBlock: - odf_context()->drawing_context()->set_line_head(4, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeClassic: - odf_context()->drawing_context()->set_line_head(1, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeDiamond: - odf_context()->drawing_context()->set_line_head(2, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeOpen: - odf_context()->drawing_context()->set_line_head(5, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeOval: - odf_context()->drawing_context()->set_line_head(3, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeNone: - default: - break; + switch (vml_stroke->m_oStartArrow->GetValue()) + { + case SimpleTypes::strokearrowtypeBlock: + odf_context()->drawing_context()->set_line_head(4, vml_stroke->m_oStartArrowLength->GetValue(), vml_stroke->m_oStartArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeClassic: + odf_context()->drawing_context()->set_line_head(1, vml_stroke->m_oStartArrowLength->GetValue(), vml_stroke->m_oStartArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeDiamond: + odf_context()->drawing_context()->set_line_head(2, vml_stroke->m_oStartArrowLength->GetValue(), vml_stroke->m_oStartArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeOpen: + odf_context()->drawing_context()->set_line_head(5, vml_stroke->m_oStartArrowLength->GetValue(), vml_stroke->m_oStartArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeOval: + odf_context()->drawing_context()->set_line_head(3, vml_stroke->m_oStartArrowLength->GetValue(), vml_stroke->m_oStartArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeNone: + default: + break; + } } - switch (vml_stroke->m_oEndArrow.GetValue()) + if (vml_stroke->m_oEndArrow.IsInit() && vml_stroke->m_oEndArrowLength.IsInit() && vml_stroke->m_oEndArrowWidth.IsInit()) { - case SimpleTypes::strokearrowtypeBlock: - odf_context()->drawing_context()->set_line_tail(4, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeClassic: - odf_context()->drawing_context()->set_line_tail(1, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeDiamond: - odf_context()->drawing_context()->set_line_tail(2, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeOpen: - odf_context()->drawing_context()->set_line_tail(5, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeOval: - odf_context()->drawing_context()->set_line_tail(3, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break; - case SimpleTypes::strokearrowtypeNone: - default: - break; + switch (vml_stroke->m_oEndArrow->GetValue()) + { + case SimpleTypes::strokearrowtypeBlock: + odf_context()->drawing_context()->set_line_tail(4, vml_stroke->m_oEndArrowLength->GetValue(), vml_stroke->m_oEndArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeClassic: + odf_context()->drawing_context()->set_line_tail(1, vml_stroke->m_oEndArrowLength->GetValue(), vml_stroke->m_oEndArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeDiamond: + odf_context()->drawing_context()->set_line_tail(2, vml_stroke->m_oEndArrowLength->GetValue(), vml_stroke->m_oEndArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeOpen: + odf_context()->drawing_context()->set_line_tail(5, vml_stroke->m_oEndArrowLength->GetValue(), vml_stroke->m_oEndArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeOval: + odf_context()->drawing_context()->set_line_tail(3, vml_stroke->m_oEndArrowLength->GetValue(), vml_stroke->m_oEndArrowWidth->GetValue()); break; + case SimpleTypes::strokearrowtypeNone: + default: + break; + } } odf_context()->drawing_context()->end_line_properties(); } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp index 5f54065b18..518db74f33 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXShapeReader.cpp @@ -400,7 +400,9 @@ bool OOXShapeReader::ParseVmlChild( ReaderParameter oParam , RtfShapePtr& pOutpu { OOX::Vml::CStroke* stroke = dynamic_cast(m_arrElement->m_arrItems[i]); if (!stroke) break; - pOutput->m_nLineDashing = stroke->m_oDahsStyle.GetValue(); //совпадают значения + + if (stroke->m_oDahsStyle.IsInit()) + pOutput->m_nLineDashing = stroke->m_oDahsStyle->GetValue(); //совпадают значения if (stroke->m_oColor.IsInit()) pOutput->m_nLineColor = (stroke->m_oColor->Get_B() << 16) + (stroke->m_oColor->Get_G() << 8) + stroke->m_oColor->Get_R(); diff --git a/Common/DocxFormat/Source/Common/ComplexTypes.h b/Common/DocxFormat/Source/Common/ComplexTypes.h index 6de9e10f92..c0aba625f2 100644 --- a/Common/DocxFormat/Source/Common/ComplexTypes.h +++ b/Common/DocxFormat/Source/Common/ComplexTypes.h @@ -59,7 +59,17 @@ namespace ComplexTypes FromXML( (XmlUtils::CXmlLiteReader&)oReader );\ return *this;\ } - +#define ComplexTypes_WriteAttribute_( sStartString, oValue ) \ + if ( oValue.IsInit() )\ + {\ + sResult += sStartString + oValue->ToString() + L"\"";\ + } +#define ComplexTypes_WriteAttribute2_( sStartString, oValue ) \ + if ( oValue.IsInit() )\ + {\ + sResult += sStartString + oValue.get2() + L"\"";\ + } +//--------------------------------------------------------------------------------------------- #define ComplexTypes_WriteAttribute( sStartString, oValue ) \ if ( oValue.IsInit() )\ {\ @@ -2984,9 +2994,7 @@ namespace ComplexTypes if (m_oAfterAutospacing.IsInit()) { - sResult += L"w:afterAutospacing=\""; - sResult += m_oAfterAutospacing->ToString(); - sResult += L"\" "; + sResult += L"w:afterAutospacing=\"" + std::wstring(m_oAfterAutospacing->ToBool() ? L"1" : L"0") + L"\" "; } if (m_oAfterLines.IsInit()) @@ -3005,9 +3013,7 @@ namespace ComplexTypes if (m_oBeforeAutospacing.IsInit()) { - sResult += L"w:beforeAutospacing=\""; - sResult += m_oBeforeAutospacing->ToString(); - sResult += L"\" "; + sResult += L"w:beforeAutospacing=\"" + std::wstring(m_oBeforeAutospacing->ToBool() ? L"1" : L"0") + L"\" "; } if (m_oBeforeLines.IsInit()) diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Shared.h b/Common/DocxFormat/Source/Common/SimpleTypes_Shared.h index 6eb8c0bde5..472ca80927 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Shared.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Shared.h @@ -197,8 +197,8 @@ namespace SimpleTypes conformanceclassTransitional = 1 }; - template - class CConformanceClass : public CSimpleType + template + class CConformanceClass : public CSimpleType { public: CConformanceClass() {} diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Word.h b/Common/DocxFormat/Source/Common/SimpleTypes_Word.h index dc096c9a35..bdb6e381a0 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Word.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Word.h @@ -2345,11 +2345,12 @@ namespace SimpleTypes virtual EFtnEdn FromString(std::wstring &sValue) { - if ( (L"continuationNotice") == sValue ) this->m_eValue = ftnednContinuationNotice; - else if ( (L"continuationSeparator") == 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; + 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; } diff --git a/Common/DocxFormat/Source/DocxFormat/DocxFlat.h b/Common/DocxFormat/Source/DocxFormat/DocxFlat.h index 67e79a0162..a1921ec33f 100644 --- a/Common/DocxFormat/Source/DocxFormat/DocxFlat.h +++ b/Common/DocxFormat/Source/DocxFormat/DocxFlat.h @@ -129,7 +129,7 @@ namespace OOX nullable m_pApp; nullable m_pCore; //----------------------------------------------------------- - std::map m_mapImagesId; + std::map> m_mapImages; OOX::IFileContainer *m_currentContainer = NULL; }; diff --git a/Common/DocxFormat/Source/DocxFormat/FtnEdn.h b/Common/DocxFormat/Source/DocxFormat/FtnEdn.h index bc784d91ed..876fbf512d 100644 --- a/Common/DocxFormat/Source/DocxFormat/FtnEdn.h +++ b/Common/DocxFormat/Source/DocxFormat/FtnEdn.h @@ -30,8 +30,6 @@ * */ #pragma once -#ifndef OOX_FTNEDN_INCLUDE_H_ -#define OOX_FTNEDN_INCLUDE_H_ #include "../Base/Nullable.h" @@ -78,18 +76,18 @@ namespace OOX } virtual void fromXML(XmlUtils::CXmlNode& oNode) { - if ( _T("w:footnote") == oNode.GetName() ) + if ( L"w:footnote" == oNode.GetName() ) m_eType = et_w_footnote; - else if ( _T("w:endnote") == oNode.GetName() ) + else if ( L"w:endnote" == oNode.GetName() ) m_eType = et_w_endnote; else return; - XmlMacroReadAttributeBase( oNode, _T("w:id"), m_oId ); - XmlMacroReadAttributeBase( oNode, _T("w:type"), m_oType ); + XmlMacroReadAttributeBase( oNode, L"w:id", m_oId ); + XmlMacroReadAttributeBase( oNode, L"w:type", m_oType ); XmlUtils::CXmlNodes oChilds; - if ( oNode.GetNodes( _T("*"), oChilds ) ) + if ( oNode.GetNodes( L"*", oChilds ) ) { XmlUtils::CXmlNode oItem; for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ ) @@ -99,65 +97,65 @@ namespace OOX std::wstring sName = oItem.GetName(); WritingElement *pItem = NULL; - if ( _T("w:altChunk") == sName ) + if ( L"w:altChunk" == sName ) pItem = new Logic::CAltChunk( oItem ); - else if ( _T("w:bookmarkEnd") == sName ) + else if ( L"w:bookmarkEnd" == sName ) pItem = new Logic::CBookmarkEnd( oItem ); - else if ( _T("w:bookmarkStart") == sName ) + else if ( L"w:bookmarkStart" == sName ) pItem = new Logic::CBookmarkStart( oItem ); - else if ( _T("w:commentRangeEnd") == sName ) + else if ( L"w:commentRangeEnd" == sName ) pItem = new Logic::CCommentRangeEnd( oItem ); - else if ( _T("w:commentRangeStart") == sName ) + else if ( L"w:commentRangeStart" == sName ) pItem = new Logic::CCommentRangeStart( oItem ); - //else if ( _T("w:customXml") == sName ) + //else if ( L"w:customXml" == sName ) // pItem = new Logic::CCustomXml( oItem ); - else if ( _T("w:customXmlDelRangeEnd") == sName ) + else if ( L"w:customXmlDelRangeEnd" == sName ) pItem = new Logic::CCustomXmlDelRangeEnd( oItem ); - else if ( _T("w:customXmlDelRangeStart") == sName ) + else if ( L"w:customXmlDelRangeStart" == sName ) pItem = new Logic::CCustomXmlDelRangeStart( oItem ); - else if ( _T("w:customXmlInsRangeEnd") == sName ) + else if ( L"w:customXmlInsRangeEnd" == sName ) pItem = new Logic::CCustomXmlInsRangeEnd( oItem ); - else if ( _T("w:customXmlInsRangeStart") == sName ) + else if ( L"w:customXmlInsRangeStart" == sName ) pItem = new Logic::CCustomXmlInsRangeStart( oItem ); - else if ( _T("w:customXmlMoveFromRangeEnd") == sName ) + else if ( L"w:customXmlMoveFromRangeEnd" == sName ) pItem = new Logic::CCustomXmlMoveFromRangeEnd( oItem ); - else if ( _T("w:customXmlMoveFromRangeStart") == sName ) + else if ( L"w:customXmlMoveFromRangeStart" == sName ) pItem = new Logic::CCustomXmlMoveFromRangeStart( oItem ); - else if ( _T("w:customXmlMoveToRangeEnd") == sName ) + else if ( L"w:customXmlMoveToRangeEnd" == sName ) pItem = new Logic::CCustomXmlMoveToRangeEnd( oItem ); - else if ( _T("w:customXmlMoveToRangeStart") == sName ) + else if ( L"w:customXmlMoveToRangeStart" == sName ) pItem = new Logic::CCustomXmlMoveToRangeStart( oItem ); - //else if ( _T("w:del") == sName ) + //else if ( L"w:del" == sName ) // pItem = new Logic::CDel( oItem ); - //else if ( _T("w:ins") == sName ) + //else if ( L"w:ins" == sName ) // pItem = new Logic::CIns( oItem ); - //else if ( _T("w:moveFrom") == sName ) + //else if ( L"w:moveFrom" == sName ) // pItem = new Logic::CMoveFrom( oItem ); - else if ( _T("w:moveFromRangeEnd") == sName ) + else if ( L"w:moveFromRangeEnd" == sName ) pItem = new Logic::CMoveFromRangeEnd( oItem ); - else if ( _T("w:moveFromRangeStart") == sName ) + else if ( L"w:moveFromRangeStart" == sName ) pItem = new Logic::CMoveFromRangeStart( oItem ); - //else if ( _T("w:moveTo") == sName ) + //else if ( L"w:moveTo" == sName ) // pItem = new Logic::CMoveTo( oItem ); - else if ( _T("w:moveToRangeEnd") == sName ) + else if ( L"w:moveToRangeEnd" == sName ) pItem = new Logic::CMoveToRangeEnd( oItem ); - else if ( _T("w:moveToRangeStart") == sName ) + else if ( L"w:moveToRangeStart" == sName ) pItem = new Logic::CMoveToRangeStart( oItem ); - else if ( _T("m:oMath") == sName ) + else if ( L"m:oMath" == sName ) pItem = new Logic::COMath( oItem ); - else if ( _T("m:oMathPara") == sName ) + else if ( L"m:oMathPara" == sName ) pItem = new Logic::COMathPara( oItem ); - else if ( _T("w:p") == sName ) + else if ( L"w:p" == sName ) pItem = new Logic::CParagraph( oItem ); - else if ( _T("w:permEnd") == sName ) + else if ( L"w:permEnd" == sName ) pItem = new Logic::CPermEnd( oItem ); - else if ( _T("w:permStart") == sName ) + else if ( L"w:permStart" == sName ) pItem = new Logic::CPermStart( oItem ); - else if ( _T("w:proofErr") == sName ) + else if ( L"w:proofErr" == sName ) pItem = new Logic::CProofErr( oItem ); - else if ( _T("w:sdt") == sName ) + else if ( L"w:sdt" == sName ) pItem = new Logic::CSdt( oItem ); - else if ( _T("w:tbl") == sName ) + else if ( L"w:tbl" == sName ) pItem = new Logic::CTbl( oItem ); if ( pItem ) @@ -169,9 +167,9 @@ namespace OOX virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) { std::wstring sName = oReader.GetName(); - if ( _T("w:footnote") == sName ) + if ( L"w:footnote" == sName ) m_eType = et_w_footnote; - else if ( _T("w:endnote") == sName ) + else if ( L"w:endnote" == sName ) m_eType = et_w_endnote; else return; @@ -187,65 +185,65 @@ namespace OOX sName = oReader.GetName(); WritingElement *pItem = NULL; - if ( _T("w:altChunk") == sName ) + if ( L"w:altChunk" == sName ) pItem = new Logic::CAltChunk( oReader ); - else if ( _T("w:bookmarkEnd") == sName ) + else if ( L"w:bookmarkEnd" == sName ) pItem = new Logic::CBookmarkEnd( oReader ); - else if ( _T("w:bookmarkStart") == sName ) + else if ( L"w:bookmarkStart" == sName ) pItem = new Logic::CBookmarkStart( oReader ); - else if ( _T("w:commentRangeEnd") == sName ) + else if ( L"w:commentRangeEnd" == sName ) pItem = new Logic::CCommentRangeEnd( oReader ); - else if ( _T("w:commentRangeStart") == sName ) + else if ( L"w:commentRangeStart" == sName ) pItem = new Logic::CCommentRangeStart( oReader ); - //else if ( _T("w:customXml") == sName ) + //else if ( L"w:customXml" == sName ) // pItem = new Logic::CCustomXml( oReader ); - else if ( _T("w:customXmlDelRangeEnd") == sName ) + else if ( L"w:customXmlDelRangeEnd" == sName ) pItem = new Logic::CCustomXmlDelRangeEnd( oReader ); - else if ( _T("w:customXmlDelRangeStart") == sName ) + else if ( L"w:customXmlDelRangeStart" == sName ) pItem = new Logic::CCustomXmlDelRangeStart( oReader ); - else if ( _T("w:customXmlInsRangeEnd") == sName ) + else if ( L"w:customXmlInsRangeEnd" == sName ) pItem = new Logic::CCustomXmlInsRangeEnd( oReader ); - else if ( _T("w:customXmlInsRangeStart") == sName ) + else if ( L"w:customXmlInsRangeStart" == sName ) pItem = new Logic::CCustomXmlInsRangeStart( oReader ); - else if ( _T("w:customXmlMoveFromRangeEnd") == sName ) + else if ( L"w:customXmlMoveFromRangeEnd" == sName ) pItem = new Logic::CCustomXmlMoveFromRangeEnd( oReader ); - else if ( _T("w:customXmlMoveFromRangeStart") == sName ) + else if ( L"w:customXmlMoveFromRangeStart" == sName ) pItem = new Logic::CCustomXmlMoveFromRangeStart( oReader ); - else if ( _T("w:customXmlMoveToRangeEnd") == sName ) + else if ( L"w:customXmlMoveToRangeEnd" == sName ) pItem = new Logic::CCustomXmlMoveToRangeEnd( oReader ); - else if ( _T("w:customXmlMoveToRangeStart") == sName ) + else if ( L"w:customXmlMoveToRangeStart" == sName ) pItem = new Logic::CCustomXmlMoveToRangeStart( oReader ); - else if ( _T("w:del") == sName ) + else if ( L"w:del" == sName ) pItem = new Logic::CDel( oReader ); - else if ( _T("w:ins") == sName ) + else if ( L"w:ins" == sName ) pItem = new Logic::CIns( oReader ); - else if ( _T("w:moveFrom") == sName ) + else if ( L"w:moveFrom" == sName ) pItem = new Logic::CMoveFrom( oReader ); - else if ( _T("w:moveFromRangeEnd") == sName ) + else if ( L"w:moveFromRangeEnd" == sName ) pItem = new Logic::CMoveFromRangeEnd( oReader ); - else if ( _T("w:moveFromRangeStart") == sName ) + else if ( L"w:moveFromRangeStart" == sName ) pItem = new Logic::CMoveFromRangeStart( oReader ); - else if ( _T("w:moveTo") == sName ) + else if ( L"w:moveTo" == sName ) pItem = new Logic::CMoveTo( oReader ); - else if ( _T("w:moveToRangeEnd") == sName ) + else if ( L"w:moveToRangeEnd" == sName ) pItem = new Logic::CMoveToRangeEnd( oReader ); - else if ( _T("w:moveToRangeStart") == sName ) + else if ( L"w:moveToRangeStart" == sName ) pItem = new Logic::CMoveToRangeStart( oReader ); - else if ( _T("m:oMath") == sName ) + else if ( L"m:oMath" == sName ) pItem = new Logic::COMath( oReader ); - else if ( _T("m:oMathPara") == sName ) + else if ( L"m:oMathPara" == sName ) pItem = new Logic::COMathPara( oReader ); - else if ( _T("w:p") == sName ) + else if ( L"w:p" == sName ) pItem = new Logic::CParagraph( oReader ); - else if ( _T("w:permEnd") == sName ) + else if ( L"w:permEnd" == sName ) pItem = new Logic::CPermEnd( oReader ); - else if ( _T("w:permStart") == sName ) + else if ( L"w:permStart" == sName ) pItem = new Logic::CPermStart( oReader ); - else if ( _T("w:proofErr") == sName ) + else if ( L"w:proofErr" == sName ) pItem = new Logic::CProofErr( oReader ); - else if ( _T("w:sdt") == sName ) + else if ( L"w:sdt" == sName ) pItem = new Logic::CSdt( oReader ); - else if ( _T("w:tbl") == sName ) + else if ( L"w:tbl" == sName ) pItem = new Logic::CTbl( oReader ); if ( pItem ) @@ -256,8 +254,8 @@ namespace OOX { // Читаем атрибуты WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if( oReader, _T("w:id"), m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:type"), m_oType ) + WritingElement_ReadAttributes_Read_if( oReader, L"w:id", m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:type", m_oType ) WritingElement_ReadAttributes_End( oReader ) } virtual std::wstring toXML() const @@ -265,16 +263,16 @@ namespace OOX std::wstring sResult; if ( m_eType == et_w_footnote ) - sResult = _T(""); + sResult += L">"; for ( size_t i = 0; i < m_arrItems.size(); ++i) { @@ -285,9 +283,9 @@ namespace OOX } if ( m_eType == et_w_footnote ) - sResult += _T(""); + sResult += L""; else if ( m_eType == et_w_endnote ) - sResult += _T(""); + sResult += L""; return sResult; } @@ -301,11 +299,8 @@ namespace OOX } OOX::EElementType m_eType; // или - // Attributes nullable > m_oId; nullable > m_oType; - - // Childs }; //-------------------------------------------------------------------------------- @@ -331,39 +326,33 @@ namespace OOX virtual ~CFtnEdnSepRef() { } - public: - const CFtnEdnSepRef& operator =(const XmlUtils::CXmlNode& oNode) { fromXML( (XmlUtils::CXmlNode&)oNode ); return *this; } - const CFtnEdnSepRef& operator =(const XmlUtils::CXmlLiteReader& oReader) { fromXML( (XmlUtils::CXmlLiteReader&)oReader ); return *this; } - - public: - - virtual void fromXML(XmlUtils::CXmlNode& oNode) + virtual void fromXML(XmlUtils::CXmlNode& oNode) { - if ( _T("w:footnote") == oNode.GetName() ) + if ( L"w:footnote" == oNode.GetName() ) m_eType = et_w_footnote; - else if ( _T("w:endnote") == oNode.GetName() ) + else if ( L"w:endnote" == oNode.GetName() ) m_eType = et_w_endnote; else return; - XmlMacroReadAttributeBase( oNode, _T("w:id"), m_oId ); + XmlMacroReadAttributeBase( oNode, L"w:id", m_oId ); } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) { std::wstring sName = oReader.GetName(); - if ( _T("w:footnote") == sName ) + if ( L"w:footnote" == sName ) m_eType = et_w_footnote; - else if ( _T("w:endnote") == sName ) + else if ( L"w:endnote" == sName ) m_eType = et_w_endnote; else return; @@ -373,20 +362,20 @@ namespace OOX if ( !oReader.IsEmptyNode() ) oReader.ReadTillEnd(); } - virtual std::wstring toXML() const + virtual std::wstring toXML() const { std::wstring sResult; if ( m_eType == et_w_footnote ) - sResult = _T(""); + sResult += L"/>"; return sResult; } @@ -394,9 +383,7 @@ namespace OOX { return m_eType; } - private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { if ( oReader.GetAttributesCount() <= 0 ) @@ -408,7 +395,7 @@ namespace OOX std::wstring wsName = oReader.GetName(); while( !wsName.empty() ) { - if ( _T("w:id") == wsName ) + if ( L"w:id" == wsName ) m_oId = oReader.GetText(); if ( !oReader.MoveToNextAttribute() ) @@ -421,13 +408,9 @@ namespace OOX } public: + OOX::EElementType m_eType; // или - OOX::EElementType m_eType; // или - - // Attributes nullable > m_oId; }; } // namespace OOX - -#endif // OOX_FTNEDN_INCLUDE_H_ diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Annotations.h b/Common/DocxFormat/Source/DocxFormat/Logic/Annotations.h index 4dade1c3a1..aff9300414 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Annotations.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Annotations.h @@ -81,12 +81,12 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -143,10 +143,10 @@ namespace OOX { std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -205,11 +205,11 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -346,11 +346,11 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -486,11 +486,11 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -626,11 +626,11 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -768,12 +768,12 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -834,33 +834,33 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; @@ -930,12 +930,12 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -994,33 +994,33 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; @@ -1186,12 +1186,12 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; + sResult += L"/>"; return sResult; } @@ -1255,16 +1255,16 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; @@ -1329,15 +1329,15 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; @@ -1398,14 +1398,14 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/FldChar.h b/Common/DocxFormat/Source/DocxFormat/Logic/FldChar.h index 903a71c9c2..fddaf7e027 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/FldChar.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/FldChar.h @@ -773,11 +773,11 @@ namespace OOX } virtual std::wstring toXML() const { - std::wstring sResult = L""); + sResult += L">"; if (m_oParagraphProperty) { @@ -365,7 +365,7 @@ namespace OOX } } - sResult += _T(""); + sResult +=L""; return sResult; } @@ -374,13 +374,13 @@ namespace OOX { WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("w:rsidDel"), m_oRsidDel ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:rsidP"), m_oRsidP ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:rsidR"), m_oRsidR ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:rsidRDefault"), m_oRsidRDefault ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:rsidRPr"), m_oRsidRPr ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w14:paraId"), m_oParaId ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w14:textId"), m_oTextId ) + WritingElement_ReadAttributes_Read_if ( oReader,L"w:rsidDel", m_oRsidDel ) + WritingElement_ReadAttributes_Read_else_if( oReader,L"w:rsidP", m_oRsidP ) + WritingElement_ReadAttributes_Read_else_if( oReader,L"w:rsidR", m_oRsidR ) + WritingElement_ReadAttributes_Read_else_if( oReader,L"w:rsidRDefault", m_oRsidRDefault ) + WritingElement_ReadAttributes_Read_else_if( oReader,L"w:rsidRPr", m_oRsidRPr ) + WritingElement_ReadAttributes_Read_else_if( oReader,L"w14:paraId", m_oParaId ) + WritingElement_ReadAttributes_Read_else_if( oReader,L"w14:textId", m_oTextId ) WritingElement_ReadAttributes_End( oReader ) } diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Pict.cpp b/Common/DocxFormat/Source/DocxFormat/Logic/Pict.cpp index f045f2ecac..dbf440c303 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Pict.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Pict.cpp @@ -337,7 +337,7 @@ namespace OOX if (m_oBinData->m_sName.IsInit()) { - docx_flat->m_mapImagesId[*m_oBinData->m_sName] = rId.get(); + docx_flat->m_mapImages[*m_oBinData->m_sName] = file; } } } diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Pict.h b/Common/DocxFormat/Source/DocxFormat/Logic/Pict.h index 7aecb044e6..3691c59fa7 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Pict.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Pict.h @@ -64,16 +64,16 @@ namespace OOX virtual std::wstring toXML() const { - std::wstring sResult = _T(""); + sResult += L">"; if (m_sData.IsInit()) { } - sResult += _T(""); + sResult += L""; return sResult; } @@ -96,7 +96,7 @@ namespace OOX std::wstring wsName = oReader.GetName(); while( !wsName.empty() ) { - if ( _T("w:name") == wsName ) + if ( L"w:name" == wsName ) m_sName = oReader.GetText(); if ( !oReader.MoveToNextAttribute() ) @@ -126,13 +126,13 @@ namespace OOX virtual void fromXML(XmlUtils::CXmlNode &oNode) { - XmlMacroReadAttributeBase( oNode, _T("r:id"), m_rId ); - XmlMacroReadAttributeBase( oNode, _T("w:name"), m_sName ); - XmlMacroReadAttributeBase( oNode, _T("w:shapeid"), m_sShapeId ); + XmlMacroReadAttributeBase( oNode, L"r:id", m_rId ); + XmlMacroReadAttributeBase( oNode, L"w:name", m_sName ); + XmlMacroReadAttributeBase( oNode, L"w:shapeid", m_sShapeId ); if (false == m_rId.IsInit()) { - XmlMacroReadAttributeBase( oNode, _T("relationships:id"), m_rId ); + XmlMacroReadAttributeBase( oNode, L"relationships:id", m_rId ); } } @@ -146,13 +146,13 @@ namespace OOX virtual std::wstring toXML() const { - std::wstring sResult = _T(""); + sResult += L"/>"; return sResult; } @@ -167,10 +167,10 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_rId ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("relationships:id"), m_rId ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:name"), m_sName ) - WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:shapeid"), m_sShapeId ) + WritingElement_ReadAttributes_Read_if ( oReader, L"r:id", m_rId ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"relationships:id", m_rId ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:name", m_sName ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:shapeid", m_sShapeId ) WritingElement_ReadAttributes_End( oReader ) } @@ -256,8 +256,8 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("w:dxaOrig"), m_oDxaOrig ) - WritingElement_ReadAttributes_Read_else_if ( oReader, _T("w:dyaOrig"), m_oDyaOrig ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:dxaOrig", m_oDxaOrig ) + WritingElement_ReadAttributes_Read_else_if ( oReader, L"w:dyaOrig", m_oDyaOrig ) WritingElement_ReadAttributes_End( oReader ) } }; diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Run.cpp b/Common/DocxFormat/Source/DocxFormat/Logic/Run.cpp index d6172b5786..85045112ad 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Run.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Run.cpp @@ -77,12 +77,12 @@ namespace OOX { m_oRunProperty = NULL; - XmlMacroReadAttributeBase( oNode, _T("w:rsidDel"), m_oRsidDel ); - XmlMacroReadAttributeBase( oNode, _T("w:rsidR"), m_oRsidR ); - XmlMacroReadAttributeBase( oNode, _T("w:rsidRPr"), m_oRsidRPr ); + XmlMacroReadAttributeBase( oNode, L"w:rsidDel", m_oRsidDel ); + XmlMacroReadAttributeBase( oNode, L"w:rsidR", m_oRsidR ); + XmlMacroReadAttributeBase( oNode, L"w:rsidRPr", m_oRsidRPr ); XmlUtils::CXmlNodes oChilds; - if ( oNode.GetNodes( _T("*"), oChilds ) ) + if ( oNode.GetNodes( L"*", oChilds ) ) { XmlUtils::CXmlNode oItem; for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ ) @@ -92,57 +92,57 @@ namespace OOX std::wstring sName = oItem.GetName(); WritingElement *pItem = NULL; - if ( _T("w:annotationRef") == sName ) + if ( L"w:annotationRef" == sName ) pItem = new CAnnotationRef( oItem ); - else if ( _T("w:br") == sName ) + else if ( L"w:br" == sName ) pItem = new CBr( oItem ); - else if ( _T("w:commentReference") == sName ) + else if ( L"w:commentReference" == sName ) pItem = new CCommentReference( oItem ); - else if ( _T("w:contentPart") == sName ) + else if ( L"w:contentPart" == sName ) pItem = new CContentPart( oItem ); - else if ( _T("w:continuationSeparator") == sName ) + else if ( L"w:continuationSeparator" == sName ) pItem = new CContinuationSeparator( oItem ); - else if ( _T("w:cr") == sName ) + else if ( L"w:cr" == sName ) pItem = new CCr( oItem ); - else if ( _T("w:dayLong") == sName ) + else if ( L"w:dayLong" == sName ) pItem = new CDayLong( oItem ); - else if ( _T("w:dayShort") == sName ) + else if ( L"w:dayShort" == sName ) pItem = new CDayShort( oItem ); - else if ( _T("w:delInstrText") == sName ) + else if ( L"w:delInstrText" == sName ) pItem = new CDelInstrText( oItem ); - else if ( _T("w:delText") == sName ) + else if ( L"w:delText" == sName ) pItem = new CDelText( oItem ); - else if ( _T("w:drawing") == sName ) + else if ( L"w:drawing" == sName ) pItem = new CDrawing( oItem ); - else if ( _T("w:endnoteRef") == sName ) + else if ( L"w:endnoteRef" == sName ) pItem = new CEndnoteRef( oItem ); - else if ( _T("w:endnoteReference") == sName ) + else if ( L"w:endnoteReference" == sName ) pItem = new CEndnoteReference( oItem ); - else if ( _T("w:fldChar") == sName ) + else if ( L"w:fldChar" == sName ) pItem = new CFldChar( oItem ); - else if ( _T("w:footnoteRef") == sName ) + else if ( L"w:footnoteRef" == sName ) pItem = new CFootnoteRef( oItem ); - else if ( _T("w:footnoteReference") == sName ) + else if ( L"w:footnoteReference" == sName ) pItem = new CFootnoteReference( oItem ); - else if ( _T("w:instrText") == sName ) + else if ( L"w:instrText" == sName ) pItem = new CInstrText( oItem ); - else if ( _T("w:lastRenderedPageBreak") == sName ) + else if ( L"w:lastRenderedPageBreak" == sName ) pItem = new CLastRenderedPageBreak( oItem ); - else if ( _T("w:monthLong") == sName ) + else if ( L"w:monthLong" == sName ) pItem = new CMonthLong( oItem ); - else if ( _T("w:monthShort") == sName ) + else if ( L"w:monthShort" == sName ) pItem = new CMonthShort( oItem ); - else if ( _T("w:noBreakHyphen") == sName ) + else if ( L"w:noBreakHyphen" == sName ) pItem = new CNoBreakHyphen( oItem ); - else if ( _T("w:object") == sName ) + else if ( L"w:object" == sName ) pItem = new CObject( oItem ); - else if ( _T("w:pgNum") == sName ) + else if ( L"w:pgNum" == sName ) pItem = new CPgNum( oItem ); - else if ( _T("w:pict") == sName ) + else if ( L"w:pict" == sName ) pItem = new CPicture( oItem ); - else if ( _T("w:ptab") == sName ) + else if ( L"w:ptab" == sName ) pItem = new CPTab( oItem ); - else if ( _T("w:rPr") == sName ) + else if ( L"w:rPr" == sName ) { if (m_oRunProperty) { @@ -156,21 +156,21 @@ namespace OOX pItem = m_oRunProperty = new CRunProperty( oItem ); } } - else if ( _T("w:ruby") == sName ) + else if ( L"w:ruby" == sName ) pItem = new CRuby( oItem ); - else if ( _T("w:separator") == sName ) + else if ( L"w:separator" == sName ) pItem = new CSeparator( oItem ); - else if ( _T("w:softHyphen") == sName ) + else if ( L"w:softHyphen" == sName ) pItem = new CSoftHyphen( oItem ); - else if ( _T("w:sym") == sName ) + else if ( L"w:sym" == sName ) pItem = new CSym( oItem ); - else if ( _T("w:t") == sName ) + else if ( L"w:t" == sName ) pItem = new CText( oItem ); - else if ( _T("w:tab") == sName ) + else if ( L"w:tab" == sName ) pItem = new CTab( oItem ); - else if ( _T("w:yearLong") == sName ) + else if ( L"w:yearLong" == sName ) pItem = new CYearLong( oItem ); - else if ( _T("w:yearShort") == sName ) + else if ( L"w:yearShort" == sName ) pItem = new CYearShort( oItem ); if ( pItem ) @@ -220,31 +220,31 @@ namespace OOX OOX::Document* document = WritingElement::m_pMainDocument; - if ( _T("mc:AlternateContent") == sName ) + if ( L"mc:AlternateContent" == sName ) pItem = new CAlternateContent( document ); - else if ( _T("w:annotationRef") == sName ) + else if ( L"w:annotationRef" == sName ) pItem = new CAnnotationRef( document ); - else if ( _T("w:br") == sName ) + else if ( L"w:br" == sName ) pItem = new CBr( document ); - else if ( _T("w:commentReference") == sName ) + else if ( L"w:commentReference" == sName ) pItem = new CCommentReference( document ); - else if ( _T("w:contentPart") == sName ) + else if ( L"w:contentPart" == sName ) pItem = new CContentPart( document ); - else if ( _T("w:continuationSeparator") == sName ) + else if ( L"w:continuationSeparator" == sName ) pItem = new CContinuationSeparator( document ); - else if ( _T("w:cr") == sName ) + else if ( L"w:cr" == sName ) pItem = new CCr( document ); - else if ( _T("w:dayLong") == sName ) + else if ( L"w:dayLong" == sName ) pItem = new CDayLong( document ); - else if ( _T("w:dayShort") == sName ) + else if ( L"w:dayShort" == sName ) pItem = new CDayShort( document ); - else if ( _T("w:delInstrText") == sName ) + else if ( L"w:delInstrText" == sName ) pItem = new CDelInstrText( document ); - else if ( _T("w:delText") == sName ) + else if ( L"w:delText" == sName ) pItem = new CDelText( document ); - else if ( _T("w:drawing") == sName ) + else if ( L"w:drawing" == sName ) pItem = new CDrawing( document ); - else if ( _T("w:endnote") == sName ) + else if ( L"w:endnote" == sName ) { CEndnoteReference *pEndRef = new CEndnoteReference(document); CFtnEdn *pEndnote = new CFtnEdn( document ); @@ -263,20 +263,16 @@ namespace OOX if (!docx_flat->m_pSettings->m_oEndnotePr.Init()) docx_flat->m_pSettings->m_oEndnotePr.Init(); - - docx_flat->m_pSettings->m_oEndnotePr->m_arrEndnote.push_back(new CFtnEdnSepRef()); - docx_flat->m_pSettings->m_oEndnotePr->m_arrEndnote.back()->m_oId = pEndnote->m_oId; - docx_flat->m_pSettings->m_oEndnotePr->m_arrEndnote.back()->m_eType = OOX::et_w_endnote; } pItem = pEndRef; } - else if ( _T("w:endnoteRef") == sName ) + else if ( L"w:endnoteRef" == sName ) pItem = new CEndnoteRef( document ); - else if ( _T("w:endnoteReference") == sName ) + else if ( L"w:endnoteReference" == sName ) pItem = new CEndnoteReference( document ); - else if ( _T("w:fldChar") == sName ) + else if ( L"w:fldChar" == sName ) pItem = new CFldChar( document ); - else if ( _T("w:footnote") == sName ) + else if ( L"w:footnote" == sName ) { CFootnoteReference *pFootRef = new CFootnoteReference(document); CFtnEdn *pFootnote = new CFtnEdn( document ); @@ -293,36 +289,32 @@ namespace OOX docx_flat->m_pFootnotes->m_arrFootnote.push_back(pFootnote); docx_flat->m_pFootnotes->m_mapFootnote.insert(std::make_pair(pFootnote->m_oId->GetValue(), pFootnote)); - - docx_flat->m_pSettings->m_oFootnotePr->m_arrFootnote.push_back(new CFtnEdnSepRef()); - docx_flat->m_pSettings->m_oFootnotePr->m_arrFootnote.back()->m_oId = pFootnote->m_oId; - docx_flat->m_pSettings->m_oFootnotePr->m_arrFootnote.back()->m_eType = OOX::et_w_footnote; } pItem = pFootRef; } - else if ( _T("w:footnoteRef") == sName ) + else if ( L"w:footnoteRef" == sName ) pItem = new CFootnoteRef( document ); - else if ( _T("w:footnoteReference") == sName ) + else if ( L"w:footnoteReference" == sName ) pItem = new CFootnoteReference( document ); - else if ( _T("w:instrText") == sName ) + else if ( L"w:instrText" == sName ) pItem = new CInstrText( document ); - else if ( _T("w:lastRenderedPageBreak") == sName ) + else if ( L"w:lastRenderedPageBreak" == sName ) pItem = new CLastRenderedPageBreak( document ); - else if ( _T("w:monthLong") == sName ) + else if ( L"w:monthLong" == sName ) pItem = new CMonthLong( document ); - else if ( _T("w:monthShort") == sName ) + else if ( L"w:monthShort" == sName ) pItem = new CMonthShort( document ); - else if ( _T("w:noBreakHyphen") == sName ) + else if ( L"w:noBreakHyphen" == sName ) pItem = new CNoBreakHyphen( document ); - else if ( _T("w:object") == sName ) + else if ( L"w:object" == sName ) pItem = new CObject( document ); - else if ( _T("w:pgNum") == sName ) + else if ( L"w:pgNum" == sName ) pItem = new CPgNum( document ); - else if ( _T("w:pict") == sName ) + else if ( L"w:pict" == sName ) pItem = new CPicture( document ); - else if ( _T("w:ptab") == sName ) + else if ( L"w:ptab" == sName ) pItem = new CPTab( document ); - else if ( _T("w:rPr") == sName ) + else if ( L"w:rPr" == sName ) { if (m_oRunProperty) { @@ -339,21 +331,21 @@ namespace OOX } return pItem; } - else if ( _T("w:ruby") == sName ) + else if ( L"w:ruby" == sName ) pItem = new CRuby( document ); - else if ( _T("w:separator") == sName ) + else if ( L"w:separator" == sName ) pItem = new CSeparator( document ); - else if ( _T("w:softHyphen") == sName ) + else if ( L"w:softHyphen" == sName ) pItem = new CSoftHyphen( document ); - else if ( _T("w:sym") == sName ) + else if ( L"w:sym" == sName ) pItem = new CSym( document ); - else if ( _T("w:t") == sName ) + else if ( L"w:t" == sName ) { fromXMLText(oReader); } - else if ( _T("w:tab") == sName ) + else if ( L"w:tab" == sName ) pItem = new CTab( document ); - else if ( _T("w:yearLong") == sName ) + else if ( L"w:yearLong" == sName ) pItem = new CYearLong( document ); else if ( L"aml:annotation" == sName) //Bookmark { @@ -459,13 +451,13 @@ namespace OOX } std::wstring CRun::toXML() const { - std::wstring sResult = _T(""); + sResult += L">"; if (m_oRunProperty) sResult += m_oRunProperty->toXML(); @@ -479,7 +471,7 @@ namespace OOX } } - sResult += _T(""); + sResult += L""; return sResult; } @@ -494,11 +486,11 @@ namespace OOX std::wstring wsName = oReader.GetName(); while( !wsName.empty() ) { - if ( _T("w:rsidDel") == wsName ) + if ( L"w:rsidDel" == wsName ) m_oRsidDel = oReader.GetText(); - else if ( _T("w:rsidR") == wsName ) + else if ( L"w:rsidR" == wsName ) m_oRsidR = oReader.GetText(); - else if ( _T("w:rsidRPr") == wsName ) + else if ( L"w:rsidRPr" == wsName ) m_oRsidRPr = oReader.GetText(); if ( !oReader.MoveToNextAttribute() ) diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.cpp b/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.cpp index 5d5606cea9..30a4a606f8 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.cpp @@ -197,7 +197,7 @@ namespace OOX if ( !m_bSectPrChange ) { XmlUtils::CXmlNodes oNodes; - if ( oNode.GetNodes( (L"w:headerReference"), oNodes ) ) + if ( oNode.GetNodes( L"w:headerReference", oNodes ) ) { XmlUtils::CXmlNode oHeaderNode; for ( int nIndex = 0; nIndex < oNodes.GetCount(); nIndex++ ) @@ -370,185 +370,124 @@ namespace OOX } std::wstring CSectionProperty::toXML() const { - std::wstring sResult = (L"ToString(); - sResult += (L"\" "); - } - - if ( m_oRsidR.IsInit() ) - { - sResult += (L"w:rsidR=\""); - sResult += m_oRsidR->ToString(); - sResult += (L"\" "); - } - - if ( m_oRsidRPr.IsInit() ) - { - sResult += (L"w:rsidRPr=\""); - sResult += m_oRsidRPr->ToString(); - sResult += (L"\" "); - } - - if ( m_oRsidSect.IsInit() ) - { - sResult += (L"w:rsidSect=\""); - sResult += m_oRsidSect->ToString(); - sResult += (L"\" "); - } - - sResult += (L">"); - - if ( m_oBidi.IsInit() ) - { - sResult += (L"ToString(); - sResult += (L"/>"); - } - - if ( m_oCols.IsInit() ) - sResult += m_oCols->toXML(); - - if ( m_oDocGrid.IsInit() ) - { - sResult += (L"ToString(); - sResult += (L"/>"); - } - - if ( m_oEndnotePr.IsInit() ) - sResult += m_oEndnotePr->toXML(); - - if ( !m_bSectPrChange ) - { - for (unsigned int nIndex = 0; nIndex < m_arrFooterReference.size(); nIndex++ ) + std::wstring sResult = (L"ToString() + L"\""; + } + if (m_oRsidR.IsInit()) + { + sResult += L" w:rsidR=\"" + m_oRsidR->ToString() + L"\""; + } + if (m_oRsidRPr.IsInit()) + { + sResult += L" w:rsidRPr=\"" + m_oRsidRPr->ToString() + L"\""; + } + if (m_oRsidSect.IsInit()) + { + sResult += L" w:rsidSect=\"" + m_oRsidSect->ToString() + L"\""; + } + sResult += L">"; + + if (!m_bSectPrChange) + { + for (size_t nIndex = 0; nIndex < m_arrHeaderReference.size(); nIndex++) + { + sResult += (L"ToString(); + sResult += (L"/>"); + } + for (size_t nIndex = 0; nIndex < m_arrFooterReference.size(); nIndex++) + { + sResult += (L"ToString(); sResult += (L"/>"); } } - - if ( m_oFootnotePr.IsInit() ) + if (!m_bSectPrChange && m_oSectPrChange.IsInit()) + { + sResult += m_oSectPrChange->toXML(); + } + if (m_oFootnotePr.IsInit()) + { sResult += m_oFootnotePr->toXML(); - - if ( m_oFormProt.IsInit() ) + } + if (m_oEndnotePr.IsInit()) { - sResult += (L"ToString(); - sResult += (L"/>"); + sResult += m_oEndnotePr->toXML(); } - - if ( !m_bSectPrChange ) + if (m_oType.IsInit()) { - for (unsigned int nIndex = 0; nIndex < m_arrHeaderReference.size(); nIndex++ ) - { - sResult += (L"ToString(); - sResult += (L"/>"); - } + sResult += L"ToString() + L"/>"; } - - if ( m_oLnNumType.IsInit() ) + if (m_oPgSz.IsInit()) { - sResult += (L"ToString(); - sResult += (L"/>"); + sResult += L"ToString() + L"/>"; } - - if ( m_oNoEndnote.IsInit() ) + if (m_oPgMar.IsInit()) { - sResult += (L"ToString(); - sResult += (L"/>"); + sResult += L"ToString() + L"/>"; } - - if ( m_oPaperSrc.IsInit() ) + if (m_oPaperSrc.IsInit()) { - sResult += (L"ToString(); - sResult += (L"/>"); + sResult += L"ToString() + L"/>"; } - - if ( m_oPgBorders.IsInit() ) + if (m_oPgBorders.IsInit()) + { sResult += m_oPgBorders->toXML(); - - if ( m_oPgMar.IsInit() ) - { - sResult += (L"ToString(); - sResult += (L"/>"); } - - if ( m_oPgNumType.IsInit() ) + if (m_oLnNumType.IsInit()) { - sResult += (L"ToString(); - sResult += (L"/>"); + sResult += L"ToString() + L"/>"; } - - if ( m_oPgSz.IsInit() ) + if (m_oPgNumType.IsInit()) { - sResult += (L"ToString(); - sResult += (L"/>"); + sResult += L"ToString() + L"/>"; + } + if (m_oCols.IsInit()) + { + sResult += m_oCols->toXML(); + } + if (m_oFormProt.IsInit()) + { + sResult += L"ToString() + L"/>"; + } + if (m_oVAlign.IsInit()) + { + sResult += L"ToString() + L"/>"; + } + if (m_oNoEndnote.IsInit()) + { + sResult += L"ToString() + L"/>"; + } + if (m_oTitlePg.IsInit() && m_oTitlePg->m_oVal.ToBool()) + { + sResult += L""; + } + if (m_oTextDirection.IsInit()) + { + sResult += L"ToString() + L"/>"; + } + if ( m_oBidi.IsInit() ) + { + sResult += L"ToString() + L"/>"; + } + if (m_oRtlGutter.IsInit()) + { + sResult += m_oRtlGutter->m_oVal.ToBool() ? L"" : L""; + } + if ( m_oDocGrid.IsInit() ) + { + sResult += L"ToString() + L"/>"; } - if ( m_oPrinterSettings.IsInit() ) { - sResult += (L"ToString(); - sResult += (L"/>"); + sResult += L"ToString() + L"/>"; } - - if ( m_oRtlGutter.IsInit() ) - { - sResult += (L"ToString(); - sResult += (L"/>"); - } - - if ( !m_bSectPrChange && m_oSectPrChange.IsInit() ) - sResult += m_oSectPrChange->toXML(); - - if ( m_oTextDirection.IsInit() ) - { - sResult += (L"ToString(); - sResult += (L"/>"); - } - - if ( m_oTitlePg.IsInit() ) - { - sResult += (L"ToString(); - sResult += (L"/>"); - } - - if ( m_oType.IsInit() ) - { - sResult += (L"ToString(); - sResult += (L"/>"); - } - - if ( m_oVAlign.IsInit() ) - { - sResult += (L"ToString(); - sResult += (L"/>"); - } - - sResult += (L""); - + sResult += L""; return sResult; } - - } // Logic } diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h b/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h index 43338f9922..425c52c3c0 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h @@ -115,13 +115,13 @@ namespace ComplexTypes { } - virtual void FromXML(XmlUtils::CXmlNode& oNode) + virtual void FromXML(XmlUtils::CXmlNode& oNode) { XmlMacroReadAttributeBase( oNode, (L"w:charSpace"), m_oCharSpace ); XmlMacroReadAttributeBase( oNode, (L"w:linePitch"), m_oLinePitch ); XmlMacroReadAttributeBase( oNode, (L"w:type"), m_oType ); } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) { ReadAttributes(oReader); @@ -132,45 +132,34 @@ namespace ComplexTypes { std::wstring sResult; - if ( m_oCharSpace.IsInit() ) + if (m_oType.IsInit()) { - sResult += (L"w:charSpace=\""); - sResult += m_oCharSpace->ToString(); - sResult += (L"\" "); + sResult += L" w:type=\"" + m_oType->ToString() + L"\""; } - if ( m_oLinePitch.IsInit() ) { - sResult += (L"w:linePitch=\""); - sResult += m_oLinePitch->ToString(); - sResult += (L"\" "); - } - - if ( m_oType.IsInit() ) + sResult += L" w:linePitch=\"" + m_oLinePitch->ToString() + L"\""; + } + if (m_oCharSpace.IsInit()) { - sResult += (L"w:type=\""); - sResult += m_oType->ToString(); - sResult += (L"\" "); + sResult += L" w:charSpace=\"" + m_oCharSpace->ToString() + L"\""; } - return sResult; } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Read_if ( oReader, (L"w:charSpace"), m_oCharSpace ) WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:linePitch"), m_oLinePitch ) WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:type"), m_oType ) + WritingElement_ReadAttributes_Read_else_if(oReader, (L"w:line-pitch"), m_oLinePitch) //2003 xml WritingElement_ReadAttributes_End( oReader ) } - public: - - nullable > m_oCharSpace; - nullable > m_oLinePitch; - nullable > m_oType; + nullable> m_oCharSpace; + nullable> m_oLinePitch; + nullable> m_oType; }; //-------------------------------------------------------------------------------- @@ -208,20 +197,14 @@ namespace ComplexTypes { std::wstring sResult; - if ( m_oId.IsInit() ) - { - sResult += (L"r:id=\""); - sResult += m_oId->ToString(); - sResult += (L"\" "); - } - if ( m_oType.IsInit() ) { - sResult += (L"w:type=\""); - sResult += m_oType->ToString(); - sResult += (L"\" "); + sResult += L" w:type=\"" + m_oType->ToString() + L"\""; + } + if ( m_oId.IsInit() ) + { + sResult += L" r:id=\"" + m_oId->ToString() + L"\""; } - return sResult; } private: @@ -887,58 +870,37 @@ namespace ComplexTypes { std::wstring sResult; + if (m_oTop.IsInit()) + { + sResult += L" w:top=\"" + m_oTop->ToString() + L"\""; + } + if (m_oRight.IsInit()) + { + sResult += L" w:right=\"" + m_oRight->ToString() + L"\""; + } if ( m_oBottom.IsInit() ) { - sResult += (L"w:bottom=\""); - sResult += m_oBottom->ToString(); - sResult += (L"\" "); + sResult += L" w:bottom=\"" + m_oBottom->ToString() + L"\""; + } + if (m_oLeft.IsInit()) + { + sResult += L" w:left=\"" + m_oLeft->ToString() + L"\""; + } + if (m_oHeader.IsInit()) + { + sResult += L" w:header=\"" + m_oHeader->ToString() + L"\""; } - if ( m_oFooter.IsInit() ) { - sResult += (L"w:footer=\""); - sResult += m_oFooter->ToString(); - sResult += (L"\" "); + sResult += L" w:footer=\"" + m_oFooter->ToString() + L"\""; } if ( m_oGutter.IsInit() ) { - sResult += (L"w:gutter=\""); - sResult += m_oGutter->ToString(); - sResult += (L"\" "); + sResult += L" w:gutter=\"" + m_oGutter->ToString() + L"\""; } - - if ( m_oHeader.IsInit() ) - { - sResult += (L"w:header=\""); - sResult += m_oHeader->ToString(); - sResult += (L"\" "); - } - - if ( m_oLeft.IsInit() ) - { - sResult += (L"w:left=\""); - sResult += m_oLeft->ToString(); - sResult += (L"\" "); - } - - if ( m_oRight.IsInit() ) - { - sResult += (L"w:right=\""); - sResult += m_oRight->ToString(); - sResult += (L"\" "); - } - if ( m_oTop.IsInit() ) - { - sResult += (L"w:top=\""); - sResult += m_oTop->ToString(); - sResult += (L"\" "); - } - return sResult; } - private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) @@ -951,16 +913,14 @@ namespace ComplexTypes WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:top"), m_oTop ) WritingElement_ReadAttributes_End( oReader ) } - public: - - nullable m_oBottom; - nullable m_oFooter; - nullable m_oGutter; - nullable m_oHeader; - nullable m_oLeft; - nullable m_oRight; - nullable m_oTop; + nullable m_oBottom; + nullable m_oFooter; + nullable m_oGutter; + nullable m_oHeader; + nullable m_oLeft; + nullable m_oRight; + nullable m_oTop; }; @@ -1765,12 +1725,9 @@ namespace OOX { return et_w_sectPr; } - private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { - // Читаем атрибуты WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Read_if ( oReader, (L"w:rsidDel"), m_oRsidDel ) WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:rsidR"), m_oRsidR ) @@ -1778,40 +1735,36 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:rsidSect"), m_oRsidSect ) WritingElement_ReadAttributes_End( oReader ) } - public: + bool m_bSectPrChange; - bool m_bSectPrChange; - - // Attributes nullable > m_oRsidDel; nullable > m_oRsidR; nullable > m_oRsidRPr; nullable > m_oRsidSect; - // Child Elements - nullable > m_oBidi; - nullable m_oCols; - nullable m_oDocGrid; - nullable m_oEndnotePr; - std::vector m_arrFooterReference; - nullable m_oFootnotePr; - nullable > m_oFormProt; - std::vector m_arrHeaderReference; - nullable m_oLnNumType; - 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_oSectPrChange; - nullable m_oTextDirection; - nullable > m_oTitlePg; - nullable m_oType; - nullable m_oVAlign; + nullable> m_oBidi; + nullable m_oCols; + nullable m_oDocGrid; + nullable m_oEndnotePr; + std::vector m_arrFooterReference; + nullable m_oFootnotePr; + nullable> m_oFormProt; + std::vector m_arrHeaderReference; + nullable m_oLnNumType; + 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_oSectPrChange; + nullable m_oTextDirection; + nullable > m_oTitlePg; + nullable m_oType; + nullable m_oVAlign; }; } // namespace Logic diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp b/Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp index 504914a117..db0c043a9d 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Vml.cpp @@ -77,65 +77,65 @@ namespace OOX std::wstring sName = oReader.GetName(); WritingElement *pItem = NULL; - if ( (L"w:altChunk") == sName ) + if (L"w:altChunk" == sName ) pItem = new CAltChunk( document ); - else if ( (L"w:bookmarkEnd") == sName ) + else if (L"w:bookmarkEnd" == sName ) pItem = new CBookmarkEnd( document ); - else if ( (L"w:bookmarkStart") == sName ) + else if (L"w:bookmarkStart" == sName ) pItem = new CBookmarkStart( document ); - else if ( (L"w:commentRangeEnd") == sName ) + else if (L"w:commentRangeEnd" == sName ) pItem = new CCommentRangeEnd( document ); - else if ( (L"w:commentRangeStart") == sName ) + else if (L"w:commentRangeStart" == sName ) pItem = new CCommentRangeStart( document ); - //else if ( (L"w:customXml") == sName ) + //else if (L"w:customXml" == sName ) // pItem = new CCustomXml( document ); - else if ( (L"w:customXmlDelRangeEnd") == sName ) + else if (L"w:customXmlDelRangeEnd" == sName ) pItem = new CCustomXmlDelRangeEnd( document ); - else if ( (L"w:customXmlDelRangeStart") == sName ) + else if (L"w:customXmlDelRangeStart" == sName ) pItem = new CCustomXmlDelRangeStart( document ); - else if ( (L"w:customXmlInsRangeEnd") == sName ) + else if (L"w:customXmlInsRangeEnd" == sName ) pItem = new CCustomXmlInsRangeEnd( document ); - else if ( (L"w:customXmlInsRangeStart") == sName ) + else if (L"w:customXmlInsRangeStart" == sName ) pItem = new CCustomXmlInsRangeStart( document ); - else if ( (L"w:customXmlMoveFromRangeEnd") == sName ) + else if (L"w:customXmlMoveFromRangeEnd" == sName ) pItem = new CCustomXmlMoveFromRangeEnd( document ); - else if ( (L"w:customXmlMoveFromRangeStart") == sName ) + else if (L"w:customXmlMoveFromRangeStart" == sName ) pItem = new CCustomXmlMoveFromRangeStart( document ); - else if ( (L"w:customXmlMoveToRangeEnd") == sName ) + else if (L"w:customXmlMoveToRangeEnd" == sName ) pItem = new CCustomXmlMoveToRangeEnd( document ); - else if ( (L"w:customXmlMoveToRangeStart") == sName ) + else if (L"w:customXmlMoveToRangeStart" == sName ) pItem = new CCustomXmlMoveToRangeStart( document ); - else if ( (L"w:del") == sName ) + else if (L"w:del" == sName ) pItem = new CDel( document ); - else if ( (L"w:ins") == sName ) + else if (L"w:ins" == sName ) pItem = new CIns( document ); - else if ( (L"w:moveFrom") == sName ) + else if (L"w:moveFrom" == sName ) pItem = new CMoveFrom( document ); - else if ( (L"w:moveFromRangeEnd") == sName ) + else if (L"w:moveFromRangeEnd" == sName ) pItem = new CMoveFromRangeEnd( document ); - else if ( (L"w:moveFromRangeStart") == sName ) + else if (L"w:moveFromRangeStart" == sName ) pItem = new CMoveFromRangeStart( document ); - else if ( (L"w:moveTo") == sName ) + else if (L"w:moveTo" == sName ) pItem = new CMoveTo( document ); - else if ( (L"w:moveToRangeEnd") == sName ) + else if (L"w:moveToRangeEnd" == sName ) pItem = new CMoveToRangeEnd( document ); - else if ( (L"w:moveToRangeStart") == sName ) + else if (L"w:moveToRangeStart" == sName ) pItem = new CMoveToRangeStart( document ); - else if ( (L"m:oMath") == sName ) + else if (L"m:oMath" == sName ) pItem = new COMath( document ); - else if ( (L"m:oMathPara") == sName ) + else if (L"m:oMathPara" == sName ) pItem = new COMathPara( document ); - else if ( (L"w:p") == sName ) + else if (L"w:p" == sName ) pItem = new CParagraph( document ); - else if ( (L"w:permEnd") == sName ) + else if (L"w:permEnd" == sName ) pItem = new CPermEnd( document ); - else if ( (L"w:permStart") == sName ) + else if (L"w:permStart" == sName ) pItem = new CPermStart( document ); - else if ( (L"w:proofErr") == sName ) + else if (L"w:proofErr" == sName ) pItem = new CProofErr( document ); - else if ( (L"w:sdt") == sName ) + else if (L"w:sdt" == sName ) pItem = new CSdt( document ); - else if ( (L"w:tbl") == sName ) + else if (L"w:tbl" == sName ) pItem = new CTbl( document ); if ( pItem ) @@ -147,7 +147,7 @@ namespace OOX } std::wstring CTxbxContent::toXML() const { - std::wstring sResult = (L""); + std::wstring sResult = L""; for ( size_t i = 0; i < m_arrItems.size(); ++i) { @@ -157,7 +157,7 @@ namespace OOX } } - sResult += (L""); + sResult += L""; return sResult; } @@ -195,28 +195,28 @@ namespace OOX break; case 'e': - if ((L"o:extrusion") == sName) + if (L"o:extrusion" == sName) pItem = new OOX::VmlOffice::CExtrusion(document); break; case 'l': - if ((L"o:lock") == sName) + if (L"o:lock" == sName) pItem = new OOX::VmlOffice::CLock(document); break; case 's': - if ((L"o:signatureline") == sName) + if (L"o:signatureline" == sName) pItem = new OOX::VmlOffice::CSignatureLine(document); - else if ((L"o:skew") == sName) + else if (L"o:skew" == sName) pItem = new OOX::VmlOffice::CSkew(document); break; } break; case 'p': - //if ( (L"ppt:textdata") == sName ) + //if (L"ppt:textdata" == sName ) // pItem = new OOX::Vml::CTextData( oReader ); break; @@ -225,9 +225,9 @@ namespace OOX switch (wsChar3) { case 'f': - if ((L"v:fill") == sName) + if (L"v:fill" == sName) pItem = new OOX::Vml::CFill(document); - else if ((L"v:formulas") == sName) + else if (L"v:formulas" == sName) pItem = new OOX::Vml::CFormulas(document); break; @@ -268,19 +268,19 @@ namespace OOX break; case 'w': - if ((L"wd:anchorLock") == sName) + if (L"wd:anchorLock" == sName) pItem = new OOX::VmlWord::CAnchorLock(document); - else if ((L"wd:borderbottom") == sName) + else if (L"wd:borderbottom" == sName) pItem = new OOX::VmlWord::CBorder(document); - else if ((L"wd:borderleft") == sName) + else if (L"wd:borderleft" == sName) pItem = new OOX::VmlWord::CBorder(document); - else if ((L"wd:borderright") == sName) + else if (L"wd:borderright" == sName) pItem = new OOX::VmlWord::CBorder(document); - else if ((L"wd:bordertop") == sName) + else if (L"wd:bordertop" == sName) pItem = new OOX::VmlWord::CBorder(document); - else if ((L"wd:wrap") == sName) + else if (L"wd:wrap" == sName) pItem = new OOX::VmlWord::CWrap(document); - else if ((L"w10:wrap") == sName) + else if (L"w10:wrap" == sName) pItem = new OOX::VmlWord::CWrap(document); break; @@ -299,11 +299,11 @@ namespace OOX pItem->fromXML(oReader); } - if (((image_data) && (image_data->m_rId.IsInit()))) + if ((image_data) && (image_data->m_rId.IsInit())) { m_bImage = true; } - if (((client_data) && (client_data->m_oObjectType.IsInit())) + if ((client_data) && (client_data->m_oObjectType.IsInit()) && (client_data->m_oObjectType->GetValue() == SimpleTypes::Vml::vmlclientdataobjecttypeNote)) { m_bComment = true; @@ -336,28 +336,28 @@ namespace OOX switch ( wsChar ) { case 'a': - if ( (L"alt") == wsName ) m_sAlt = oReader.GetText(); + if (L"alt" == wsName ) m_sAlt = oReader.GetText(); break; case 'c': - if ( (L"chromakey") == wsName ) m_oChromaKey = oReader.GetText(); - else if ( (L"class") == wsName ) m_sClass = oReader.GetText(); - else if ( (L"coordorigin") == wsName ) m_oCoordOrigin = oReader.GetText(); - else if ( (L"coordsize") == wsName ) m_oCoordSize = oReader.GetText(); + if (L"chromakey" == wsName ) m_oChromaKey = oReader.GetText(); + else if (L"class" == wsName ) m_sClass = oReader.GetText(); + else if (L"coordorigin" == wsName ) m_oCoordOrigin = oReader.GetText(); + else if (L"coordsize" == wsName ) m_oCoordSize = oReader.GetText(); break; case 'f': - if ( (L"fillcolor") == wsName ) m_oFillColor = oReader.GetText(); - else if ( (L"filled") == wsName ) m_oFilled = oReader.GetText(); + if (L"fillcolor" == wsName ) m_oFillColor = oReader.GetText(); + else if (L"filled" == wsName ) m_oFilled = oReader.GetText(); break; case 'h': - if ( (L"href") == wsName ) m_sHref = oReader.GetText(); + if (L"href" == wsName ) m_sHref = oReader.GetText(); break; case 'i': - if ( (L"id") == wsName ) m_sId = oReader.GetText(); - else if ( (L"insetpen") == wsName ) m_oInsetPen = oReader.GetText(); + if (L"id" == wsName ) m_sId = oReader.GetText(); + else if (L"insetpen" == wsName ) m_oInsetPen = oReader.GetText(); break; case 'o': @@ -366,63 +366,63 @@ namespace OOX switch ( wsChar2 ) { case 'a': - if ( (L"o:allowincell") == wsName ) m_oAllowInCell = oReader.GetText(); - else if ( (L"o:allowoverlap") == wsName ) m_oAllowOverlap = oReader.GetText(); - else if ( (L"opacity") == wsName ) m_oOpacity = oReader.GetText(); + if (L"o:allowincell" == wsName ) m_oAllowInCell = oReader.GetText(); + else if (L"o:allowoverlap" == wsName ) m_oAllowOverlap = oReader.GetText(); + else if (L"opacity" == wsName ) m_oOpacity = oReader.GetText(); break; case 'b': - if ( (L"o:borderbottomcolor") == wsName ) m_oBorderBottomColor = oReader.GetText(); - else if ( (L"o:borderleftcolor") == wsName ) m_oBorderLeftColor = oReader.GetText(); - else if ( (L"o:borderrightcolor") == wsName ) m_oBorderRightColor = oReader.GetText(); - else if ( (L"o:bordertopcolor") == wsName ) m_oBorderTopColor = oReader.GetText(); - else if ( (L"o:bullet") == wsName ) m_oBullet = oReader.GetText(); - else if ( (L"o:button") == wsName ) m_oButton = oReader.GetText(); - else if ( (L"o:bwmode") == wsName ) m_oBwMode = oReader.GetText(); - else if ( (L"o:bwnormal") == wsName ) m_oBwNormal = oReader.GetText(); - else if ( (L"o:bwpure") == wsName ) m_oBwPure = oReader.GetText(); + if (L"o:borderbottomcolor" == wsName ) m_oBorderBottomColor = oReader.GetText(); + else if (L"o:borderleftcolor" == wsName ) m_oBorderLeftColor = oReader.GetText(); + else if (L"o:borderrightcolor" == wsName ) m_oBorderRightColor = oReader.GetText(); + else if (L"o:bordertopcolor" == wsName ) m_oBorderTopColor = oReader.GetText(); + else if (L"o:bullet" == wsName ) m_oBullet = oReader.GetText(); + else if (L"o:button" == wsName ) m_oButton = oReader.GetText(); + else if (L"o:bwmode" == wsName ) m_oBwMode = oReader.GetText(); + else if (L"o:bwnormal" == wsName ) m_oBwNormal = oReader.GetText(); + else if (L"o:bwpure" == wsName ) m_oBwPure = oReader.GetText(); break; case 'c': - if ( (L"o:clip") == wsName ) m_oClip = oReader.GetText(); - else if ( (L"o:cliptowrap") == wsName ) m_oClipToWrap = oReader.GetText(); - else if ( (L"o:connectortype") == wsName ) m_oConnectorType = oReader.GetText(); + if (L"o:clip" == wsName ) m_oClip = oReader.GetText(); + else if (L"o:cliptowrap" == wsName ) m_oClipToWrap = oReader.GetText(); + else if (L"o:connectortype" == wsName ) m_oConnectorType = oReader.GetText(); break; case 'd': - if ( (L"o:doubleclicknotify") == wsName ) m_oDoubleClickNotify = oReader.GetText(); - else if ( (L"o:dgmlayout") == wsName ) m_oDgmLayout = oReader.GetText(); - else if ( (L"o:dgmlayoutmru") == wsName ) m_oDgmLayoutMru = oReader.GetText(); - else if ( (L"o:dgmnodekind") == wsName ) m_oDgmNodeKind = oReader.GetText(); + if (L"o:doubleclicknotify" == wsName ) m_oDoubleClickNotify = oReader.GetText(); + else if (L"o:dgmlayout" == wsName ) m_oDgmLayout = oReader.GetText(); + else if (L"o:dgmlayoutmru" == wsName ) m_oDgmLayoutMru = oReader.GetText(); + else if (L"o:dgmnodekind" == wsName ) m_oDgmNodeKind = oReader.GetText(); break; case 'f': - if ( (L"o:forcedash") == wsName ) m_oForceDash = oReader.GetText(); + if (L"o:forcedash" == wsName ) m_oForceDash = oReader.GetText(); break; case 'h': - if ( (L"o:hr") == wsName ) m_oHr = oReader.GetText(); - else if ( (L"o:hralign") == wsName ) m_oHrAlign = oReader.GetText(); - else if ( (L"o:hrnoshade") == wsName ) m_oHrNoShade = oReader.GetText(); - else if ( (L"o:hrpct") == wsName ) m_oHrPct = oReader.GetText(); - else if ( (L"o:hrstd") == wsName ) m_oHrStd = oReader.GetText(); + if (L"o:hr" == wsName ) m_oHr = oReader.GetText(); + else if (L"o:hralign" == wsName ) m_oHrAlign = oReader.GetText(); + else if (L"o:hrnoshade" == wsName ) m_oHrNoShade = oReader.GetText(); + else if (L"o:hrpct" == wsName ) m_oHrPct = oReader.GetText(); + else if (L"o:hrstd" == wsName ) m_oHrStd = oReader.GetText(); break; case 'i': - if ( (L"o:insetmode") == wsName ) m_oInsetMode = oReader.GetText(); + if (L"o:insetmode" == wsName ) m_oInsetMode = oReader.GetText(); break; case 'o': - if ( (L"o:ole") == wsName ) m_oOle = oReader.GetText(); - else if ( (L"o:oleicon") == wsName ) m_oOleIcon = oReader.GetText(); - else if ( (L"o:oned") == wsName ) m_oOned = oReader.GetText(); + if (L"o:ole" == wsName ) m_oOle = oReader.GetText(); + else if (L"o:oleicon" == wsName ) m_oOleIcon = oReader.GetText(); + else if (L"o:oned" == wsName ) m_oOned = oReader.GetText(); break; case 'p': - if ( (L"o:preferrelative") == wsName ) m_oPreferRelative = oReader.GetText(); + if (L"o:preferrelative" == wsName ) m_oPreferRelative = oReader.GetText(); break; case 'r': - if ( (L"o:regroupid") == wsName ) m_oRegroupId = oReader.GetText(); + if (L"o:regroupid" == wsName ) m_oRegroupId = oReader.GetText(); break; case 's': - if ( (L"o:spid") == wsName ) m_sSpId = oReader.GetText(); - else if ( (L"o:spt") == wsName ) m_oSpt = oReader.GetText(); + if (L"o:spid" == wsName ) m_sSpId = oReader.GetText(); + else if (L"o:spt" == wsName ) m_oSpt = oReader.GetText(); break; case 'u': - if ( (L"o:userdrawn") == wsName ) m_oUserDrawn = oReader.GetText(); - else if ( (L"o:userhidden") == wsName ) m_oUserHidden = oReader.GetText(); + if (L"o:userdrawn" == wsName ) m_oUserDrawn = oReader.GetText(); + else if (L"o:userhidden" == wsName ) m_oUserHidden = oReader.GetText(); break; } @@ -430,20 +430,20 @@ namespace OOX } case 'p': - if ( (L"print") == wsName ) m_oPrint = oReader.GetText(); + if (L"print" == wsName ) m_oPrint = oReader.GetText(); break; case 's': - if ( (L"strokecolor") == wsName ) m_oStrokeColor = oReader.GetText(); - else if ( (L"stroked") == wsName ) m_oStroked = oReader.GetText(); - else if ( (L"strokeweight") == wsName ) m_oStrokeWeight = oReader.GetText(); - else if ( (L"style") == wsName ) m_oStyle = oReader.GetText(); + if (L"strokecolor" == wsName ) m_oStrokeColor = oReader.GetText(); + else if (L"stroked" == wsName ) m_oStroked = oReader.GetText(); + else if (L"strokeweight" == wsName ) m_oStrokeWeight = oReader.GetText(); + else if (L"style" == wsName ) m_oStyle = oReader.GetText(); break; case 't': - if ( (L"target") == wsName ) m_sTarget = oReader.GetText(); - else if ( (L"title") == wsName ) m_sTitle = oReader.GetText(); + if (L"target" == wsName ) m_sTarget = oReader.GetText(); + else if (L"title" == wsName ) m_sTitle = oReader.GetText(); break; case 'w': - if ( (L"wrapcoords") == wsName ) m_oWrapCoords = oReader.GetText(); + if (L"wrapcoords" == wsName ) m_oWrapCoords = oReader.GetText(); break; } @@ -549,50 +549,50 @@ namespace OOX ComplexTypes_WriteAttribute (L"wrapcoords=\"", m_oWrapCoords ); if (!m_oPrint.get_value_or(true)) - sResult += (L"print=\"false\" "); + sResult += L"print=\"f\" "; ComplexTypes_WriteAttribute3(L"o:spid=\"", m_sSpId ); if (m_oOned.get_value_or(false)) - sResult += (L"o:oned=\"true\" "); + sResult += L"o:oned=\"t\" "; if (m_oRegroupId.IsInit()) - sResult += L"o:regroupid=\"" + std::to_wstring(*m_oRegroupId) + (L"\" "); + sResult += L"o:regroupid=\"" + std::to_wstring(*m_oRegroupId) + L"\" "; if (m_oDoubleClickNotify.get_value_or(false)) - sResult += (L"o:doubleclicknotify=\"true\" "); + sResult += L"o:doubleclicknotify=\"t\" "; if (m_oButton.get_value_or(false)) - sResult += (L"o:button=\"true\" "); + sResult += L"o:button=\"t\" "; if (m_oUserHidden.get_value_or(false)) - sResult += (L"o:userhidden=\"true\" "); + sResult += L"o:userhidden=\"t\" "; if (m_oBullet.get_value_or(false)) - sResult += (L"o:bullet=\"true\" "); + sResult += L"o:bullet=\"t\" "; if (m_oHr.get_value_or(false)) - sResult += (L"o:hr=\"true\" "); + sResult += L"o:hr=\"t\" "; if (m_oHrStd.get_value_or(false)) - sResult += (L"o:hrstd=\"true\" "); + sResult += L"o:hrstd=\"t\" "; if (m_oHrNoShade.get_value_or(false)) - sResult += (L"o:hrnoshade=\"true\" "); + sResult += L"o:hrnoshade=\"t\" "; if (m_oHrPct.IsInit()) - sResult += L"o:hrpct=\"" + std::to_wstring(*m_oHrPct) + (L"\" "); + sResult += L"o:hrpct=\"" + std::to_wstring(*m_oHrPct) + L"\" "; ComplexTypes_WriteAttribute(L"o:hralign=\"", m_oHrAlign); if (m_oAllowInCell.get_value_or(false)) - sResult += (L"o:allowincell=\"true\" "); + sResult += L"o:allowincell=\"t\" "; if (m_oAllowOverlap.IsInit()) - sResult += L"o:allowoverlap=\"" + std::wstring(*m_oAllowOverlap ? L"true" : L"false") + (L"\" "); + sResult += L"o:allowoverlap=\"" + std::wstring(*m_oAllowOverlap ? L"t" : L"f") + L"\" "; if (m_oUserDrawn.get_value_or(false)) - sResult += (L"o:userdrawn=\"true\" "); + sResult += L"o:userdrawn=\"t\" "; ComplexTypes_WriteAttribute (L"o:bordertopcolor=\"", m_oBorderTopColor ); ComplexTypes_WriteAttribute (L"o:borderleftcolor=\"", m_oBorderLeftColor ); @@ -617,28 +617,28 @@ namespace OOX ComplexTypes_WriteAttribute (L"o:bwnormal=\"", m_oBwNormal ); if (m_oForceDash.get_value_or(false)) - sResult += (L"o:forcedash=\"true\" "); + sResult += L"o:forcedash=\"t\" "; if (m_oOleIcon.get_value_or(false)) - sResult += (L"o:oleicon=\"true\" "); + sResult += L"o:oleicon=\"t\" "; if (m_oOle.get_value_or(false)) - sResult += (L"o:ole=\"true\" "); + sResult += L"o:ole=\"t\" "; if (m_oPreferRelative.get_value_or(false)) - sResult += (L"o:preferrelative=\"true\" "); + sResult += L"o:preferrelative=\"t\" "; if (m_oClipToWrap.get_value_or(false)) - sResult += (L"o:cliptowrap=\"true\" "); + sResult += L"o:cliptowrap=\"t\" "; if (m_oClipToWrap.IsInit()) - sResult += L"o:clip=\"" + std::wstring(*m_oClip ? L"true" : L"false") + (L"\" "); + sResult += L"o:clip=\"" + std::wstring(*m_oClip ? L"t" : L"f") + L"\" "; return sResult; } std::wstring CVmlCommonElements::toXML() const { - return (L""); + return L""; } //-------------------------------------------------------------------------------- // CGroup 14.1.2.6 (Part4) @@ -700,9 +700,9 @@ namespace OOX void CGroup::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start(oReader) - WritingElement_ReadAttributes_Read_if(oReader, _T("o:tableproperties"), m_oTableProperties) - WritingElement_ReadAttributes_Read_else_if(oReader, _T("o:tablelimits"), m_oTableLimits) - WritingElement_ReadAttributes_Read_else_if(oReader, _T("w:editas"), m_oEditAs) + WritingElement_ReadAttributes_Read_if(oReader, L"o:tableproperties", m_oTableProperties) + WritingElement_ReadAttributes_Read_else_if(oReader, L"o:tablelimits", m_oTableLimits) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:editas", m_oEditAs) WritingElement_ReadAttributes_End(oReader) } @@ -712,12 +712,12 @@ namespace OOX std::wstring sResult = L""); + sResult += L">"; sResult += CVmlCommonElements::WriteElements(); @@ -730,15 +730,15 @@ namespace OOX //-------------------------------------------------------------------------------- std::wstring CPolyLine::toXML() const { - std::wstring sResult = (L""); + sResult += L"points=\"" + m_oPoints.ToString() + L"\">"; sResult += CVmlCommonElements::WriteElements(); - sResult += (L""); + sResult += L""; return sResult; } @@ -791,7 +791,7 @@ namespace OOX //-------------------------------------------------------------------------------- std::wstring CShapeType::toXML() const { - std::wstring sResult = (L"ToString() + (L"\" "); + sResult += L"path=\"" + m_oPath->ToString() + L"\" "; if ((m_oMaster.IsInit()) && (*m_oMaster)) - sResult += (L"o:master=\"true\" "); + sResult += L"o:master=\"t\" "; - sResult += (L">"); + sResult += L">"; sResult += CVmlCommonElements::WriteElements(); - sResult += (L""); + sResult += L""; return sResult; } @@ -969,27 +969,27 @@ namespace OOX } if (m_oChecked.IsInit()) { - sResult += (L"") + m_oChecked->ToString() + (L""); + sResult += L"" + m_oChecked->ToString() + L""; } if (m_oFmlaLink.IsInit()) { - sResult += (L"") + *m_oFmlaLink + (L""); + sResult += L"" + *m_oFmlaLink + L""; } if (m_oFmlaRange.IsInit()) { - sResult += (L"") + *m_oFmlaRange + (L""); + sResult += L"" + *m_oFmlaRange + L""; } if (m_oFmlaMacro.IsInit()) { - sResult += (L"") + *m_oFmlaMacro + (L""); + sResult += L"" + *m_oFmlaMacro + L""; } if (m_oFmlaTxbx.IsInit()) { - sResult += (L"") + *m_oFmlaTxbx + (L""); + sResult += L"" + *m_oFmlaTxbx + L""; } if (m_oFmlaGroup.IsInit()) { - sResult += (L"") + *m_oFmlaGroup + (L""); + sResult += L"" + *m_oFmlaGroup + L""; } if (m_oMin.IsInit()) { @@ -1017,7 +1017,7 @@ namespace OOX } if (m_oDropStyle.IsInit()) { - sResult += (L"") + m_oDropStyle->ToString() + (L""); + sResult += L"" + m_oDropStyle->ToString() + L""; } if (m_oDropLines.IsInit()) { @@ -1052,8 +1052,8 @@ namespace OOX if (!pCellAnchor) return false; std::vector sAnchors; - boost::algorithm::split(sAnchors, m_oAnchor.get(), boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on); - + boost::algorithm::split(sAnchors, *m_oAnchor, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on); + if (sAnchors.size() < 8) return false; pCellAnchor->m_oFrom.Init(); @@ -1189,15 +1189,15 @@ namespace OOX switch ( wsChar ) { case 'i': - if ( (L"id") == wsName ) m_oId = oReader.GetText(); - else if ( (L"inset") == wsName ) m_oInset = oReader.GetText(); - else if ( (L"insetmode") == wsName ) m_oInsetMode = oReader.GetText(); + if (L"id" == wsName ) m_oId = oReader.GetText(); + else if (L"inset" == wsName ) m_oInset = oReader.GetText(); + else if (L"insetmode" == wsName ) m_oInsetMode = oReader.GetText(); break; case 'o': - if ( (L"o:singleclick") == wsName ) m_oSingleClick = oReader.GetText(); + if (L"o:singleclick" == wsName ) m_oSingleClick = oReader.GetText(); break; case 's': - if ( (L"style") == wsName ) m_oStyle = oReader.GetText(); + if (L"style" == wsName ) m_oStyle = oReader.GetText(); break; } @@ -1210,11 +1210,6 @@ namespace OOX } void CFill::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { - // Выставляем значения по умолчанию - //m_oFocus.SetValue( 0 ); - //m_oFocusPosition.SetValue( 0.0, 0.0 ); - //m_oFocusSize.SetValue( 0.0, 0.0 ); - std::wstring sColors; // Читаем атрибуты if ( oReader.GetAttributesCount() <= 0 ) @@ -1230,61 +1225,61 @@ namespace OOX switch ( wsChar ) { case 'a': - if ( (L"aspect") == wsName ) m_oAspect = oReader.GetText(); - else if ( (L"angle") == wsName ) m_oAngle = oReader.GetText(); - else if ( (L"alignshape") == wsName ) m_oAlignShape = oReader.GetText(); + if (L"aspect" == wsName ) m_oAspect = oReader.GetText(); + else if (L"angle" == wsName ) m_oAngle = oReader.GetText(); + else if (L"alignshape" == wsName ) m_oAlignShape = oReader.GetText(); break; case 'c': - if ( (L"color") == wsName ) m_oColor = oReader.GetText(); - else if ( (L"color2") == wsName ) m_oColor2 = oReader.GetText(); - else if ( (L"colors") == wsName ) sColors = oReader.GetText(); + if (L"color" == wsName ) m_oColor = oReader.GetText(); + else if (L"color2" == wsName ) m_oColor2 = oReader.GetText(); + else if (L"colors" == wsName ) sColors = oReader.GetText(); break; case 'i': - if ( (L"id") == wsName ) m_sId = oReader.GetText(); + if (L"id" == wsName ) m_sId = oReader.GetText(); break; case 'm': - if ( (L"method") == wsName ) m_oMethod = oReader.GetText(); + if (L"method" == wsName ) m_oMethod = oReader.GetText(); break; case 'f': - if ( (L"focus") == wsName ) m_oFocus = oReader.GetText(); - else if ( (L"focussize") == wsName ) m_oFocusSize = oReader.GetText(); - else if ( (L"focusposition") == wsName ) m_oFocusPosition = oReader.GetText(); + if (L"focus" == wsName ) m_oFocus = oReader.GetText(); + else if (L"focussize" == wsName ) m_oFocusSize = oReader.GetText(); + else if (L"focusposition" == wsName ) m_oFocusPosition = oReader.GetText(); break; case 'o': - if ( (L"on") == wsName ) m_oOn = oReader.GetText(); - else if ( (L"opacity") == wsName ) m_oOpacity = oReader.GetText(); - else if ( (L"o:href") == wsName ) m_sHref = oReader.GetText(); - else if ( (L"o:althref") == wsName ) m_sAltHref = oReader.GetText(); - else if ( (L"origin") == wsName ) m_oOrigin = oReader.GetText(); - else if ( (L"o:detectmouseclick") == wsName ) m_oDetectMouseClick = oReader.GetText(); - else if ( (L"o:title") == wsName ) m_sTitle = oReader.GetText(); - else if ( (L"o:opacity2") == wsName ) m_oOpacity2 = oReader.GetText(); - else if ( (L"o:relid") == wsName ) m_oRelId = oReader.GetText(); + if (L"on" == wsName ) m_oOn = oReader.GetText(); + else if (L"opacity" == wsName ) m_oOpacity = oReader.GetText(); + else if (L"o:href" == wsName ) m_sHref = oReader.GetText(); + else if (L"o:althref" == wsName ) m_sAltHref = oReader.GetText(); + else if (L"origin" == wsName ) m_oOrigin = oReader.GetText(); + else if (L"o:detectmouseclick" == wsName ) m_oDetectMouseClick = oReader.GetText(); + else if (L"o:title" == wsName ) m_sTitle = oReader.GetText(); + else if (L"o:opacity2" == wsName ) m_oOpacity2 = oReader.GetText(); + else if (L"o:relid" == wsName ) m_oRelId = oReader.GetText(); break; case 'p': - if ( (L"position") == wsName ) m_oPosition = oReader.GetText(); + if (L"position" == wsName ) m_oPosition = oReader.GetText(); break; case 'r': - if ( (L"recolor") == wsName ) m_oRecolor = oReader.GetText(); - else if ( (L"rotate") == wsName ) m_oRotate = oReader.GetText(); - else if ( (L"r:id") == wsName ) m_rId = oReader.GetText(); - else if ( (L"relationships:id") == wsName ) m_rId = oReader.GetText(); + if (L"recolor" == wsName ) m_oRecolor = oReader.GetText(); + else if (L"rotate" == wsName ) m_oRotate = oReader.GetText(); + else if (L"r:id" == wsName ) m_rId = oReader.GetText(); + else if (L"relationships:id" == wsName ) m_rId = oReader.GetText(); break; case 's': - if ( (L"src") == wsName ) m_sSrc = oReader.GetText(); - else if ( (L"size") == wsName ) m_oSize = oReader.GetText(); + if (L"src" == wsName ) m_sSrc = oReader.GetText(); + else if (L"size" == wsName ) m_oSize = oReader.GetText(); break; case 't': - if ( (L"type") == wsName ) m_oType = oReader.GetText(); + if (L"type" == wsName ) m_oType = oReader.GetText(); break; } @@ -1302,69 +1297,69 @@ namespace OOX std::wstring CFill::toXML() const { - std::wstring sResult = (L"GetValue() )) - sResult += (L"on=\"false\" "); + if (m_oOn.IsInit() && ( SimpleTypes::booleanTrue != m_oOn->GetValue() )) + sResult += L"on=\"false\" "; if ( m_oOpacity.IsInit() ) - sResult += (L"opacity=\"") + m_oOpacity->ToString() + (L"\" "); + sResult += L"opacity=\"" + m_oOpacity->ToString() + L"\" "; - ComplexTypes_WriteAttribute ((L"color=\""), m_oColor); - ComplexTypes_WriteAttribute ((L"color2=\""), m_oColor2); - ComplexTypes_WriteAttribute3( (L"src=\""), m_sSrc ); - ComplexTypes_WriteAttribute3( (L"o:href=\""), m_sHref ); - ComplexTypes_WriteAttribute3( (L"o:althref=\""), m_sAltHref ); - ComplexTypes_WriteAttribute ( (L"size=\""), m_oSize ); - ComplexTypes_WriteAttribute ( (L"origin=\""), m_oOrigin ); - ComplexTypes_WriteAttribute ( (L"position=\""), m_oPosition ); + ComplexTypes_WriteAttribute (L"color=\"", m_oColor); + ComplexTypes_WriteAttribute (L"color2=\"", m_oColor2); + ComplexTypes_WriteAttribute3(L"src=\"", m_sSrc ); + ComplexTypes_WriteAttribute3(L"o:href=\"", m_sHref ); + ComplexTypes_WriteAttribute3(L"o:althref=\"", m_sAltHref ); + ComplexTypes_WriteAttribute (L"size=\"", m_oSize ); + ComplexTypes_WriteAttribute (L"origin=\"", m_oOrigin ); + ComplexTypes_WriteAttribute (L"position=\"", m_oPosition ); if ((m_oAspect.IsInit()) && (SimpleTypes::imageaspectIgnore != m_oAspect->GetValue() )) - sResult += (L"aspect=\"") + m_oAspect->ToString() + (L"\" "); + sResult += L"aspect=\"" + m_oAspect->ToString() + L"\" "; // TO DO: Сделать запись m_arrColors - ComplexTypes_WriteAttribute ( (L"angle=\""), m_oAngle ); + ComplexTypes_WriteAttribute (L"angle=\"", m_oAngle ); - if ( (m_oAlignShape.IsInit()) && (SimpleTypes::booleanTrue != m_oAlignShape->GetValue() )) - sResult += (L"alignshape=\"false\" "); + if (m_oAlignShape.IsInit() && (SimpleTypes::booleanTrue != m_oAlignShape->GetValue() )) + sResult += L"alignshape=\"false\" "; - if ( (m_oFocus.IsInit()) && (0 != m_oFocus->GetValue() )) - sResult += (L"focus=\"") + m_oFocus->ToString() + (L"\" "); + if (m_oFocus.IsInit() && (0 != m_oFocus->GetValue() )) + sResult += L"focus=\"" + m_oFocus->ToString() + L"\" "; if ( m_oFocusPosition.IsInit()) - sResult += (L"focusposition=\"") + m_oFocusPosition->ToString() + (L"\" "); + sResult += L"focusposition=\"" + m_oFocusPosition->ToString() + L"\" "; - if ( ( m_oFocusSize.IsInit() ) && (0 != m_oFocusSize->GetX() || 0 != m_oFocusSize->GetY() )) - sResult += (L"focussize=\"") + m_oFocusSize->ToString() + (L"\" "); + if ( m_oFocusSize.IsInit() && (0 != m_oFocusSize->GetX() || 0 != m_oFocusSize->GetY() )) + sResult += L"focussize=\"" + m_oFocusSize->ToString() + L"\" "; - if ( (m_oMethod.IsInit() ) && (SimpleTypes::fillmethodSigma != m_oMethod->GetValue() )) - sResult += (L"method=\"") + m_oMethod->ToString() + (L"\" "); + if (m_oMethod.IsInit() && (SimpleTypes::fillmethodSigma != m_oMethod->GetValue() )) + sResult += L"method=\"" + m_oMethod->ToString() + L"\" "; - ComplexTypes_WriteAttribute ( (L"o:detectmouseclick=\""), m_oDetectMouseClick ); - ComplexTypes_WriteAttribute3( (L"o:title=\""), m_sTitle ); + ComplexTypes_WriteAttribute (L"o:detectmouseclick=\"", m_oDetectMouseClick ); + ComplexTypes_WriteAttribute3(L"o:title=\"", m_sTitle ); if ( m_oOpacity2.IsInit() ) - sResult += (L"o:opacity2=\"") + m_oOpacity2->ToString() + (L"\" "); + sResult += L"o:opacity2=\"" + m_oOpacity2->ToString() + L"\" "; - if ( (m_oRecolor.IsInit()) && (SimpleTypes::booleanFalse != m_oRecolor->GetValue() )) - sResult += (L"recolor=\"true\" "); + if (m_oRecolor.IsInit() && m_oRecolor->GetBool()) + sResult += L"recolor=\"true\" "; - if (( m_oRotate.IsInit()) && (SimpleTypes::booleanFalse != m_oRotate->GetValue() )) - sResult += (L"rotate=\"true\" "); + if (( m_oRotate.IsInit()) && m_oRotate->GetBool()) + sResult += L"rotate=\"true\" "; - ComplexTypes_WriteAttribute ( (L"r:id=\""), m_rId ); - ComplexTypes_WriteAttribute ( (L"o:relid=\""), m_oRelId ); + ComplexTypes_WriteAttribute (L"r:id=\"", m_rId ); + ComplexTypes_WriteAttribute (L"o:relid=\"", m_oRelId ); - sResult += (L">"); + sResult += L">"; if ( m_oFill.IsInit() ) sResult += m_oFill->toXML(); - sResult += (L""); + sResult += L""; return sResult; } @@ -1383,58 +1378,58 @@ namespace OOX switch ( wsChar ) { case 'c': - if ( (L"color") == wsName ) m_oColor = oReader.GetText(); - else if ( (L"color2") == wsName ) m_oColor2 = oReader.GetText(); + if (L"color" == wsName ) m_oColor = oReader.GetText(); + else if (L"color2" == wsName ) m_oColor2 = oReader.GetText(); break; case 'd': - if ( (L"dashstyle") == wsName ) m_oDahsStyle = oReader.GetText(); + if (L"dashstyle" == wsName ) m_oDahsStyle = oReader.GetText(); break; case 'e': - if ( (L"endarrow") == wsName ) m_oEndArrow = oReader.GetText(); - else if ( (L"endarrowlength") == wsName ) m_oEndArrowLength = oReader.GetText(); - else if ( (L"endarrowwidth") == wsName ) m_oEndArrowWidth = oReader.GetText(); - else if ( (L"endcap") == wsName ) m_oEndCap = oReader.GetText(); + if (L"endarrow" == wsName ) m_oEndArrow = oReader.GetText(); + else if (L"endarrowlength" == wsName ) m_oEndArrowLength = oReader.GetText(); + else if (L"endarrowwidth" == wsName ) m_oEndArrowWidth = oReader.GetText(); + else if (L"endcap" == wsName ) m_oEndCap = oReader.GetText(); break; case 'f': - if ( (L"filltype") == wsName ) m_oFillType = oReader.GetText(); + if (L"filltype" == wsName ) m_oFillType = oReader.GetText(); break; case 'i': - if ( (L"id") == wsName ) m_oId = oReader.GetText(); - else if ( (L"imagealignshape") == wsName ) m_oImageAlignShape = oReader.GetText(); - else if ( (L"imageaspect") == wsName ) m_oImageAspect = oReader.GetText(); - else if ( (L"imagesize") == wsName ) m_oImageSize = oReader.GetText(); - else if ( (L"insetpen") == wsName ) m_oInsetPen = oReader.GetText(); + if (L"id" == wsName ) m_oId = oReader.GetText(); + else if (L"imagealignshape" == wsName ) m_oImageAlignShape = oReader.GetText(); + else if (L"imageaspect" == wsName ) m_oImageAspect = oReader.GetText(); + else if (L"imagesize" == wsName ) m_oImageSize = oReader.GetText(); + else if (L"insetpen" == wsName ) m_oInsetPen = oReader.GetText(); break; case 'j': - if ( (L"joinstyle") == wsName ) m_oJoinStyle = oReader.GetText(); + if (L"joinstyle" == wsName ) m_oJoinStyle = oReader.GetText(); break; case 'l': - if ( (L"linestyle") == wsName ) m_oLineStyle = oReader.GetText(); + if (L"linestyle" == wsName ) m_oLineStyle = oReader.GetText(); break; case 'm': - if ( (L"miterlimit") == wsName ) m_oMiterLimit = oReader.GetText(); + if (L"miterlimit" == wsName ) m_oMiterLimit = oReader.GetText(); break; case 'o': - if ( (L"o:althref") == wsName ) m_sAltHref = oReader.GetText(); - else if ( (L"o:forcedash") == wsName ) m_oForceDash = oReader.GetText(); - else if ( (L"o:href") == wsName ) m_sHref = oReader.GetText(); - else if ( (L"on") == wsName ) m_oOn = oReader.GetText(); - else if ( (L"opacity") == wsName ) m_oOpacity = oReader.GetText(); - else if ( (L"o:relid") == wsName ) m_oRelId = oReader.GetText(); - else if ( (L"o:title") == wsName ) m_sTitle = oReader.GetText(); + if (L"o:althref" == wsName ) m_sAltHref = oReader.GetText(); + else if (L"o:forcedash" == wsName ) m_oForceDash = oReader.GetText(); + else if (L"o:href" == wsName ) m_sHref = oReader.GetText(); + else if (L"on" == wsName ) m_oOn = oReader.GetText(); + else if (L"opacity" == wsName ) m_oOpacity = oReader.GetText(); + else if (L"o:relid" == wsName ) m_oRelId = oReader.GetText(); + else if (L"o:title" == wsName ) m_sTitle = oReader.GetText(); break; case 'r': - if ( (L"r:id") == wsName ) m_rId = oReader.GetText(); - else if ( (L"relationships:id") == wsName ) m_rId = oReader.GetText(); + if (L"r:id" == wsName ) m_rId = oReader.GetText(); + else if (L"relationships:id" == wsName ) m_rId = oReader.GetText(); break; case 's': - if ( (L"src") == wsName ) m_sSrc = oReader.GetText(); - else if ( (L"startarrow") == wsName ) m_oStartArrow = oReader.GetText(); - else if ( (L"startarrowlength") == wsName ) m_oStartArrowLength = oReader.GetText(); - else if ( (L"startarrowwidth") == wsName ) m_oStartArrowWidth = oReader.GetText(); + if (L"src" == wsName ) m_sSrc = oReader.GetText(); + else if (L"startarrow" == wsName ) m_oStartArrow = oReader.GetText(); + else if (L"startarrowlength" == wsName ) m_oStartArrowLength = oReader.GetText(); + else if (L"startarrowwidth" == wsName ) m_oStartArrowWidth = oReader.GetText(); break; case 'w': - if ( (L"weight") == wsName ) m_oWeight = oReader.GetText(); + if (L"weight" == wsName ) m_oWeight = oReader.GetText(); break; } @@ -1450,83 +1445,83 @@ namespace OOX std::wstring CStroke::toXML() const { - std::wstring sResult = (L"GetBool()) + sResult += L"on=\"false\" "; - if ( 1 != m_oWeight.GetValue() ) - sResult += (L"weight=\"") + m_oWeight.ToString() + (L"\" "); + if ( m_oWeight.IsInit() ) + sResult += L"weight=\"" + std::to_wstring(*m_oWeight) + L"\" "; //if ( SimpleTypes::colortypeBlack != m_oColor.GetValue() ) - // sResult += (L"color=\"") + m_oColor.ToString() + (L"\" "); - ComplexTypes_WriteAttribute ( (L"color=\""), m_oColor ); + // sResult += (L"color=\"" + m_oColor.ToString() + (L"\" "; + ComplexTypes_WriteAttribute (L"color=\"", m_oColor ); if (m_oOpacity.IsInit() ) - sResult += (L"opacity=\"") + m_oOpacity->ToString() + (L"\" "); + sResult += L"opacity=\"" + std::to_wstring(*m_oOpacity) + L"\" "; //if ( SimpleTypes::strokelinestyleSingle != m_oLineStyle.GetValue() ) - // sResult += (L"linestyle=\"") + m_oLineStyle.ToString() + (L"\" "); - ComplexTypes_WriteAttribute ( (L"linestyle=\""), m_oLineStyle ); + // sResult += L"linestyle=\"" + m_oLineStyle.ToString() + L"\" "; + ComplexTypes_WriteAttribute (L"linestyle=\"", m_oLineStyle ); - if ( 8 != m_oMiterLimit.GetValue() ) - sResult += (L"miterlimit=\"") + m_oMiterLimit.ToString() + (L"\" "); + if ( m_oMiterLimit.IsInit()) + sResult += L"miterlimit=\"" + m_oMiterLimit->ToString() + L"\" "; - if ( SimpleTypes::strokejoinstyleRound != m_oJoinStyle.GetValue() ) - sResult += (L"joinstyle=\"") + m_oJoinStyle.ToString() + (L"\" "); + if ( m_oJoinStyle.IsInit()) + sResult += L"joinstyle=\"" + m_oJoinStyle->ToString() + L"\" "; - if ( SimpleTypes::strokeendcapFlat != m_oEndCap.GetValue() ) - sResult += (L"endcap=\"") + m_oEndCap.ToString() + (L"\" "); + if ( m_oEndCap.IsInit()) + sResult += L"endcap=\"" + m_oEndCap->ToString() + L"\" "; - if ( SimpleTypes::Vml::vmldashstyleSolid != m_oDahsStyle.GetValue() ) - sResult += (L"dashstyle=\"") + m_oDahsStyle.ToString() + (L"\" "); + if ( m_oDahsStyle.IsInit()) + sResult += L"dashstyle=\"" + m_oDahsStyle->ToString() + L"\" "; - if ( SimpleTypes::filltypeSolid != m_oFillType.GetValue() ) - sResult += (L"filltype=\"") + m_oFillType.ToString() + (L"\" "); + if ( m_oFillType.IsInit()) + sResult += L"filltype=\"" + m_oFillType->ToString() + L"\" "; - ComplexTypes_WriteAttribute3( (L"src=\""), m_sSrc ); + ComplexTypes_WriteAttribute3(L"src=\"", m_sSrc ); - if ( SimpleTypes::imageaspectIgnore != m_oImageAspect.GetValue() ) - sResult += (L"imageaspect=\"") + m_oImageAspect.ToString() + (L"\" "); + if ( m_oImageAspect.IsInit()) + sResult += L"imageaspect=\"" + m_oImageAspect->ToString() + L"\" "; - ComplexTypes_WriteAttribute ( (L"imagesize=\""), m_oImageSize ); + ComplexTypes_WriteAttribute (L"imagesize=\"", m_oImageSize ); - if ( SimpleTypes::booleanTrue != m_oOn.GetValue() ) - sResult += (L"imagealignshape=\"false\" "); + if ( m_oOn.IsInit() && !m_oOn->GetBool()) + sResult += L"imagealignshape=\"false\" "; - ComplexTypes_WriteAttribute ( (L"color2=\""), m_oColor2 ); + ComplexTypes_WriteAttribute (L"color2=\"", m_oColor2 ); - if ( SimpleTypes::strokearrowtypeNone != m_oStartArrow.GetValue() ) - sResult += (L"startarrow=\"") + m_oStartArrow.ToString() + (L"\" "); + if ( m_oStartArrow.IsInit()) + sResult += L"startarrow=\"" + m_oStartArrow->ToString() + L"\" "; - if ( SimpleTypes::strokearrowwidthMedium != m_oStartArrowWidth.GetValue() ) - sResult += (L"startarrowwidth=\"") + m_oStartArrowWidth.ToString() + (L"\" "); + if ( m_oStartArrowWidth.IsInit()) + sResult += L"startarrowwidth=\"" + m_oStartArrowWidth->ToString() + L"\" "; - if ( SimpleTypes::strokearrowlengthMedium != m_oStartArrowLength.GetValue() ) - sResult += (L"startarrowlength=\"") + m_oStartArrowLength.ToString() + (L"\" "); + if ( m_oStartArrowLength.IsInit()) + sResult += L"startarrowlength=\"" + m_oStartArrowLength->ToString() + L"\" "; - if ( SimpleTypes::strokearrowtypeNone != m_oEndArrow.GetValue() ) - sResult += (L"endarrow=\"") + m_oEndArrow.ToString() + (L"\" "); + if ( m_oEndArrow.IsInit()) + sResult += L"endarrow=\"" + m_oEndArrow->ToString() + L"\" "; - if ( SimpleTypes::strokearrowwidthMedium != m_oEndArrowWidth.GetValue() ) - sResult += (L"endarrowwidth=\"") + m_oEndArrowWidth.ToString() + (L"\" "); + if ( m_oEndArrowWidth.IsInit()) + sResult += L"endarrowwidth=\"" + m_oEndArrowWidth->ToString() + L"\" "; - if ( SimpleTypes::strokearrowlengthMedium != m_oEndArrowLength.GetValue() ) - sResult += (L"endarrowlength=\"") + m_oEndArrowLength.ToString() + (L"\" "); + if ( m_oEndArrowLength.IsInit()) + sResult += L"endarrowlength=\"" + m_oEndArrowLength->ToString() + L"\" "; - ComplexTypes_WriteAttribute3( (L"o:href=\""), m_sHref ); - ComplexTypes_WriteAttribute3( (L"o:althref=\""), m_sAltHref ); - ComplexTypes_WriteAttribute3( (L"o:title=\""), m_sTitle ); + ComplexTypes_WriteAttribute3(L"o:href=\"", m_sHref ); + ComplexTypes_WriteAttribute3(L"o:althref=\"", m_sAltHref ); + ComplexTypes_WriteAttribute3(L"o:title=\"", m_sTitle ); - if ( SimpleTypes::booleanFalse != m_oForceDash.GetValue() ) - sResult += (L"o:forcedash=\"true\" "); + if ( m_oForceDash.IsInit() && m_oForceDash->GetBool()) + sResult += L"o:forcedash=\"true\" "; - ComplexTypes_WriteAttribute ( (L"r:id=\""), m_rId ); - ComplexTypes_WriteAttribute ( (L"insetpen=\""), m_oInsetPen ); - ComplexTypes_WriteAttribute ( (L"o:relid=\""), m_oRelId ); + ComplexTypes_WriteAttribute (L"r:id=\"", m_rId ); + ComplexTypes_WriteAttribute (L"insetpen=\"", m_oInsetPen ); + ComplexTypes_WriteAttribute (L"o:relid=\"", m_oRelId ); - sResult += (L">"); + sResult += L">"; if ( m_oLeft.IsInit() ) sResult += m_oLeft->toXML(); @@ -1543,15 +1538,12 @@ namespace OOX if ( m_oColumn.IsInit() ) sResult += m_oColumn->toXML(); - sResult += (L""); + sResult += L""; return sResult; } void CPath::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { - // Выставляем значения по умолчанию - m_oLimo.SetValue( 0, 0 ); - // Читаем атрибуты if ( oReader.GetAttributesCount() <= 0 ) return; @@ -1565,24 +1557,24 @@ namespace OOX switch ( wsChar ) { case 'a': - if ( (L"arrowok") == wsName ) m_oArrowOk = oReader.GetText(); + if (L"arrowok" == wsName ) m_oArrowOk = oReader.GetText(); break; case 'f': - if ( (L"fillok") == wsName ) m_oFillOk = oReader.GetText(); + if (L"fillok" == wsName ) m_oFillOk = oReader.GetText(); break; case 'g': - if ( (L"gradientshapeok") == wsName ) m_oGradientShapeOk = oReader.GetText(); + if (L"gradientshapeok" == wsName ) m_oGradientShapeOk = oReader.GetText(); break; case 'i': - if ( (L"id") == wsName ) m_oId = oReader.GetText(); - else if ( (L"insetpenok") == wsName ) m_oInsetPenOk = oReader.GetText(); + if (L"id" == wsName ) m_oId = oReader.GetText(); + else if (L"insetpenok" == wsName ) m_oInsetPenOk = oReader.GetText(); break; case 'l': - if ( (L"limo") == wsName ) m_oLimo = oReader.GetText(); + if (L"limo" == wsName ) m_oLimo = oReader.GetText(); break; case 'o': @@ -1591,12 +1583,12 @@ namespace OOX switch ( wsChar2 ) { case 'c': - if ( (L"o:connectangles") == wsName ) m_oConnectAngles = oReader.GetText(); - else if ( (L"o:connectlocs") == wsName ) m_oConnectLocs = oReader.GetText(); - else if ( (L"o:connecttype") == wsName ) m_oConnectType = oReader.GetText(); + if (L"o:connectangles" == wsName ) m_oConnectAngles = oReader.GetText(); + else if (L"o:connectlocs" == wsName ) m_oConnectLocs = oReader.GetText(); + else if (L"o:connecttype" == wsName ) m_oConnectType = oReader.GetText(); break; case 'e': - if ( (L"o:extrusionok") == wsName ) m_oExtrusionOk = oReader.GetText(); + if (L"o:extrusionok" == wsName ) m_oExtrusionOk = oReader.GetText(); break; } @@ -1604,17 +1596,17 @@ namespace OOX } case 's': - if ( (L"shadowok") == wsName ) m_oShadowOk = oReader.GetText(); - else if ( (L"strokeok") == wsName ) m_oStrokeOk = oReader.GetText(); + if (L"shadowok" == wsName ) m_oShadowOk = oReader.GetText(); + else if (L"strokeok" == wsName ) m_oStrokeOk = oReader.GetText(); break; case 't': - if ( (L"textboxrect") == wsName ) m_oTextBoxRect = oReader.GetText(); - else if ( (L"textpathok") == wsName ) m_oTextPathOk = oReader.GetText(); + if (L"textboxrect" == wsName ) m_oTextBoxRect = oReader.GetText(); + else if (L"textpathok" == wsName ) m_oTextPathOk = oReader.GetText(); break; case 'v': - if ( (L"v") == wsName ) m_oV = oReader.GetText(); + if (L"v" == wsName ) m_oV = oReader.GetText(); break; } @@ -1630,47 +1622,47 @@ namespace OOX std::wstring CPath::toXML() const { - std::wstring sResult = (L"ToString() + L"\" "; - ComplexTypes_WriteAttribute ( (L"textboxrect=\""), m_oTextBoxRect ); + ComplexTypes_WriteAttribute (L"textboxrect=\"", m_oTextBoxRect ); - if ( SimpleTypes::booleanTrue != m_oFillOk.GetValue() ) - sResult += (L"fillok=\"false\" "); + if (m_oFillOk.IsInit() && !m_oFillOk->GetBool()) + sResult += L"fillok=\"f\" "; - if ( SimpleTypes::booleanTrue != m_oStrokeOk.GetValue() ) - sResult += (L"strokeok=\"false\" "); + if ( m_oStrokeOk.IsInit() && !m_oStrokeOk->GetBool()) + sResult += L"strokeok=\"f\" "; - if ( SimpleTypes::booleanTrue != m_oShadowOk.GetValue() ) - sResult += (L"shadowok=\"false\" "); + if ( m_oShadowOk.IsInit() && !m_oShadowOk->GetBool()) + sResult += L"shadowok=\"f\" "; - if ( SimpleTypes::booleanFalse != m_oArrowOk.GetValue() ) - sResult += (L"arrowok=\"true\" "); + if (m_oArrowOk.IsInit() && m_oArrowOk->GetBool()) + sResult += L"arrowok=\"t\" "; - if ( SimpleTypes::booleanFalse != m_oGradientShapeOk.GetValue() ) - sResult += (L"gradientshapeok=\"true\" "); + if (m_oGradientShapeOk.IsInit() && m_oGradientShapeOk->GetBool()) + sResult += L"gradientshapeok=\"t\" "; - if ( SimpleTypes::booleanFalse != m_oTextPathOk.GetValue() ) - sResult += (L"textpathok=\"true\" "); + if (m_oTextPathOk.IsInit() && m_oTextPathOk->GetBool()) + sResult += L"textpathok=\"t\" "; - if ( SimpleTypes::booleanFalse != m_oInsetPenOk.GetValue() ) - sResult += (L"insetpenok=\"true\" "); + if (m_oInsetPenOk.IsInit() && m_oInsetPenOk->GetBool()) + sResult += L"insetpenok=\"t\" "; - if ( SimpleTypes::connecttypeNone != m_oConnectType.GetValue() ) - sResult += (L"o:connecttype=\"") + m_oConnectType.ToString() + (L"\" "); + if ( m_oConnectType.IsInit() ) + sResult += L"o:connecttype=\"" + m_oConnectType->ToString() + L"\" "; - ComplexTypes_WriteAttribute3( (L"o:connectlocs=\""), m_oConnectLocs ); - ComplexTypes_WriteAttribute3( (L"o:connectangles=\""), m_oConnectAngles ); + ComplexTypes_WriteAttribute3(L"o:connectlocs=\"", m_oConnectLocs ); + ComplexTypes_WriteAttribute3(L"o:connectangles=\"", m_oConnectAngles ); - if ( SimpleTypes::booleanTrue != m_oExtrusionOk.GetValue() ) - sResult += (L"extrusionok=\"false\" "); + if ( m_oExtrusionOk.IsInit() && !m_oExtrusionOk->GetBool()) + sResult += L"o:extrusionok=\"f\" "; - sResult += (L"/>"); + sResult += L"/>"; return sResult; } @@ -1689,33 +1681,33 @@ namespace OOX switch ( wsChar ) { case 'a': - if ( (L"althref") == wsName ) m_sAltHref = oReader.GetText(); + if (L"althref" == wsName ) m_sAltHref = oReader.GetText(); break; case 'b': - if ( (L"bilevel") == wsName ) m_oBiLevel = oReader.GetText(); - else if ( (L"blacklevel") == wsName ) m_oBlackLevel = oReader.GetText(); + if (L"bilevel" == wsName ) m_oBiLevel = oReader.GetText(); + else if (L"blacklevel" == wsName ) m_oBlackLevel = oReader.GetText(); break; case 'c': - if ( (L"cropleft") == wsName ) m_oCropLeft = oReader.GetText(); - else if ( (L"croptop") == wsName ) m_oCropTop = oReader.GetText(); - else if ( (L"cropright") == wsName ) m_oCropRight = oReader.GetText(); - else if ( (L"cropbottom") == wsName ) m_oCropBottom = oReader.GetText(); + if (L"cropleft" == wsName ) m_oCropLeft = oReader.GetText(); + else if (L"croptop" == wsName ) m_oCropTop = oReader.GetText(); + else if (L"cropright" == wsName ) m_oCropRight = oReader.GetText(); + else if (L"cropbottom" == wsName ) m_oCropBottom = oReader.GetText(); break; case 'e': - if ( (L"embosscolor")== wsName ) m_oEmbossColor= oReader.GetText(); + if (L"embosscolor"== wsName ) m_oEmbossColor= oReader.GetText(); break; case 'g': - if ( (L"gain") == wsName ) m_oGain = oReader.GetText(); - if ( (L"gamma") == wsName ) m_oGamma = oReader.GetText(); - if ( (L"grayscale") == wsName ) m_oGrayscale = oReader.GetText(); + if (L"gain" == wsName ) m_oGain = oReader.GetText(); + if (L"gamma" == wsName ) m_oGamma = oReader.GetText(); + if (L"grayscale" == wsName ) m_oGrayscale = oReader.GetText(); break; case 'i': - if ( (L"id") == wsName ) m_oId = oReader.GetText(); + if (L"id" == wsName ) m_oId = oReader.GetText(); break; case 'o': @@ -1724,22 +1716,22 @@ namespace OOX switch ( wsChar2 ) { case 'd': - if ( (L"o:detectmouseclick") == wsName ) m_oDetectMouseClick = oReader.GetText(); + if (L"o:detectmouseclick" == wsName ) m_oDetectMouseClick = oReader.GetText(); break; case 'h': - if ( (L"o:href") == wsName ) m_oHref = oReader.GetText(); + if (L"o:href" == wsName ) m_oHref = oReader.GetText(); break; case 'm': - if ( (L"o:movie") == wsName ) m_oMovie = oReader.GetText(); + if (L"o:movie" == wsName ) m_oMovie = oReader.GetText(); break; case 'o': - if ( (L"o:oleid") == wsName ) m_oOleId = oReader.GetText(); + if (L"o:oleid" == wsName ) m_oOleId = oReader.GetText(); break; case 'r': - if ( (L"o:relid") == wsName ) m_oRelId = oReader.GetText(); + if (L"o:relid" == wsName ) m_oRelId = oReader.GetText(); break; case 't': - if ( (L"title") == wsName ) m_sTitle = oReader.GetText(); + if (L"title" == wsName ) m_sTitle = oReader.GetText(); break; } @@ -1747,15 +1739,15 @@ namespace OOX } case 'r': - if ( (L"r:href") == wsName ) m_rHref = oReader.GetText(); - else if ( (L"r:id") == wsName ) m_rId = oReader.GetText(); - else if ( (L"relationships:id") == wsName ) m_rId = oReader.GetText(); - else if ( (L"r:pict") == wsName ) m_rPict = oReader.GetText(); - else if ( (L"recolortarget") == wsName ) m_oRecolorTarget = oReader.GetText(); + if (L"r:href" == wsName ) m_rHref = oReader.GetText(); + else if (L"r:id" == wsName ) m_rId = oReader.GetText(); + else if (L"relationships:id" == wsName ) m_rId = oReader.GetText(); + else if (L"r:pict" == wsName ) m_rPict = oReader.GetText(); + else if (L"recolortarget" == wsName ) m_oRecolorTarget = oReader.GetText(); break; case 's': - if ( (L"src") == wsName ) m_sSrc = oReader.GetText(); + if (L"src" == wsName ) m_sSrc = oReader.GetText(); break; } @@ -1766,20 +1758,30 @@ namespace OOX } oReader.MoveToElement(); - CDocxFlat* document = dynamic_cast(m_pMainDocument); - if (document && m_sSrc.IsInit() && !m_oId.IsInit() && !m_rId.IsInit()) + CDocxFlat* docx_flat = dynamic_cast(m_pMainDocument); + if (m_sSrc.IsInit()) { - std::map::iterator pFind = document->m_mapImagesId.find(*m_sSrc); - if (pFind != document->m_mapImagesId.end()) + if (false == m_sTitle.IsInit()) m_sTitle = m_sSrc; + if (docx_flat) { - m_oId = pFind->second; - m_rId = pFind->second; + OOX::RId rId; + std::map>::iterator pFind = docx_flat->m_mapImages.find(*m_sSrc); + if (pFind != docx_flat->m_mapImages.end()) + { + rId = docx_flat->m_currentContainer->Add(pFind->second); + } + else + { + smart_ptr oImageLinkFile = smart_ptr(new OOX::Image(m_pMainDocument, OOX::CPath(*m_sSrc, false), true)); + rId = docx_flat->m_currentContainer->Add(oImageLinkFile); + } + if (!m_rId.IsInit()) + m_rId = rId.get(); } + m_sSrc.reset(); } } - - std::wstring CImageData::toXML() const { std::wstring sResult = L"GetBool()) + sResult += L"grayscale=\"t\" "; - if ( SimpleTypes::booleanFalse != m_oBiLevel.GetValue() ) - sResult += (L"bilevel=\"true\" "); + if ( m_oBiLevel.IsInit() && m_oBiLevel->GetBool()) + sResult += L"bilevel=\"t\" "; - ComplexTypes_WriteAttribute ( (L"chromakey=\""), m_oChromaKey ); - ComplexTypes_WriteAttribute ( (L"embosscolor=\""), m_oEmbossColor ); + ComplexTypes_WriteAttribute (L"chromakey=\"", m_oChromaKey ); + ComplexTypes_WriteAttribute (L"embosscolor=\"", m_oEmbossColor ); - ComplexTypes_WriteAttribute3( (L"o:href=\""), m_oHref ); - ComplexTypes_WriteAttribute3( (L"o:althref=\""), m_sAltHref ); - ComplexTypes_WriteAttribute3( (L"o:title=\""), m_sTitle ); - ComplexTypes_WriteAttribute3( (L"o:oleid=\""), m_oOleId ); - ComplexTypes_WriteAttribute ( (L"o:detectmouseclick=\""), m_oDetectMouseClick ); - ComplexTypes_WriteAttribute ( (L"o:movie=\""), m_oMovie ); - ComplexTypes_WriteAttribute ( (L"o:relid=\""), m_oRelId ); + ComplexTypes_WriteAttribute3(L"o:href=\"", m_oHref ); + ComplexTypes_WriteAttribute3(L"o:althref=\"", m_sAltHref ); + ComplexTypes_WriteAttribute3(L"o:title=\"", m_sTitle ); + ComplexTypes_WriteAttribute3(L"o:oleid=\"", m_oOleId ); + ComplexTypes_WriteAttribute (L"o:detectmouseclick=\"", m_oDetectMouseClick ); + if (m_oMovie.IsInit()) + sResult += L"o:movie=\"" + std::to_wstring(*m_oMovie) + L"\" "; + ComplexTypes_WriteAttribute (L"o:relid=\"", m_oRelId ); - ComplexTypes_WriteAttribute ( (L"r:id=\""), m_rId ); - ComplexTypes_WriteAttribute ( (L"r:pict=\""), m_rPict ); - ComplexTypes_WriteAttribute ( (L"r:href=\""), m_rHref ); + ComplexTypes_WriteAttribute (L"r:id=\"", m_rId ); + ComplexTypes_WriteAttribute (L"r:pict=\"", m_rPict ); + ComplexTypes_WriteAttribute (L"r:href=\"", m_rHref ); - sResult += (L"/>"); + sResult += L"/>"; return sResult; } void CImage::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { - // Выставляем значения по умолчанию - m_oBlackLevel.SetValue( 0.0 ); - m_oCropLeft.SetValue( 0.0 ); - m_oCropRight.SetValue( 0.0 ); - m_oCropBottom.SetValue( 0.0 ); - m_oCropTop.SetValue( 0.0 ); - m_oGain.SetValue( 1.0 ); - m_oGamma.SetValue( 1.0 ); - - // Читаем атрибуты if ( oReader.GetAttributesCount() <= 0 ) return; @@ -1853,26 +1846,26 @@ namespace OOX switch ( wsChar ) { case 'b': - if ( (L"bilevel") == wsName ) m_oBiLevel = oReader.GetText(); - else if ( (L"blacklevel") == wsName ) m_oBlackLevel = oReader.GetText(); + if (L"bilevel" == wsName ) m_pBiLevel = oReader.GetText(); + else if (L"blacklevel" == wsName ) m_pBlackLevel = oReader.GetText(); break; case 'c': - if ( (L"chromakey") == wsName ) m_oChromaKey = oReader.GetText(); - else if ( (L"cropleft") == wsName ) m_oCropLeft = oReader.GetText(); - else if ( (L"croptop") == wsName ) m_oCropTop = oReader.GetText(); - else if ( (L"cropright") == wsName ) m_oCropRight = oReader.GetText(); - else if ( (L"cropbottom") == wsName ) m_oCropBottom = oReader.GetText(); + if (L"chromakey" == wsName ) m_oChromaKey = oReader.GetText(); + else if (L"cropleft" == wsName ) m_pCropLeft = oReader.GetText(); + else if (L"croptop" == wsName ) m_pCropTop = oReader.GetText(); + else if (L"cropright" == wsName ) m_pCropRight = oReader.GetText(); + else if (L"cropbottom" == wsName ) m_pCropBottom = oReader.GetText(); break; case 'g': - if ( (L"gain") == wsName ) m_oGain = oReader.GetText(); - if ( (L"gamma") == wsName ) m_oGamma = oReader.GetText(); - if ( (L"grayscale") == wsName ) m_oGrayscale = oReader.GetText(); + if (L"gain" == wsName ) m_pGain = oReader.GetText(); + if (L"gamma" == wsName ) m_pGamma = oReader.GetText(); + if (L"grayscale" == wsName ) m_pGrayscale = oReader.GetText(); break; case 's': - if ( (L"src") == wsName ) m_sSrc = oReader.GetText(); + if (L"src" == wsName ) m_pSrc = oReader.GetText(); break; } @@ -1886,59 +1879,50 @@ namespace OOX std::wstring CImage::toXML() const { - std::wstring sResult = (L"ToString() + L"\""; - if ( 0 != m_oCropTop.GetValue() ) - sResult += (L"croptop=\"") + m_oCropTop.ToString() + (L"\" "); + if ( m_pCropTop.IsInit()) + sResult += L" croptop=\"" + m_pCropTop->ToString() + L"\""; - if ( 0 != m_oCropRight.GetValue() ) - sResult += (L"cropright=\"") + m_oCropRight.ToString() + (L"\" "); + if ( m_pCropRight.IsInit()) + sResult += L"cropright=\"" + m_pCropRight->ToString() + L"\""; - if ( 0 != m_oCropBottom.GetValue() ) - sResult += (L"cropbottom=\"") + m_oCropBottom.ToString() + (L"\" "); + if ( m_pCropBottom.IsInit()) + sResult += L" cropbottom=\"" + m_pCropBottom->ToString() + L"\""; - if ( 1 != m_oGain.GetValue() ) - sResult += (L"gain=\"") + m_oGain.ToString() + (L"\" "); + if ( m_pGain.IsInit() ) + sResult += L" gain=\"" + std::to_wstring(*m_pGain) + L"\""; - if ( 0 != m_oBlackLevel.GetValue() ) - sResult += (L"blacklevel=\"") + m_oBlackLevel.ToString() + (L"\" "); + if ( m_pBlackLevel.IsInit() ) + sResult += L" blacklevel=\"" + std::to_wstring(*m_pBlackLevel) + L"\""; - if ( 1 != m_oGamma.GetValue() ) - sResult += (L"gamma=\"") + m_oGamma.ToString() + (L"\" "); + if ( m_pGamma.IsInit()) + sResult += L" gamma=\"" + std::to_wstring(*m_pGamma) + L"\""; - if ( SimpleTypes::booleanFalse != m_oGrayscale.GetValue() ) - sResult += (L"grayscale=\"true\" "); + if ( m_pGrayscale.IsInit() && m_pGrayscale->GetBool()) + sResult += L" grayscale=\"t\""; - if ( SimpleTypes::booleanFalse != m_oBiLevel.GetValue() ) - sResult += (L"bilevel=\"true\" "); + if (m_pBiLevel.IsInit() && m_pBiLevel->GetBool() ) + sResult += L" bilevel=\"t\""; - sResult += (L">"); + sResult += L">"; sResult += CVmlCommonElements::WriteElements(); - sResult += (L""); + sResult += L""; return sResult; } void CH::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { - // Выставляем значения по умолчанию - m_oMap.SetValue( 0, 1000 ); - m_oPosition.SetConstantX( 0 ); - m_oPosition.SetConstantY( 0 ); - m_oRadiusRange.SetValue( 0, 0 ); - m_oXRange.SetValue( 0, 0 ); - m_oYRange.SetValue( 0, 0 ); - - // Читаем атрибуты if ( oReader.GetAttributesCount() <= 0 ) return; @@ -1952,32 +1936,32 @@ namespace OOX switch ( wsChar ) { case 'i': - if ( (L"invx") == wsName ) m_oInvX = oReader.GetText(); - else if ( (L"invy") == wsName ) m_oInvY = oReader.GetText(); + if (L"invx" == wsName ) m_oInvX = oReader.GetText(); + else if (L"invy" == wsName ) m_oInvY = oReader.GetText(); break; case 'm': - if ( (L"map") == wsName ) m_oMap = oReader.GetText(); + if (L"map" == wsName ) m_oMap = oReader.GetText(); break; case 'p': - if ( (L"position") == wsName ) m_oPosition = oReader.GetText(); - else if ( (L"polar") == wsName ) m_oPolar = oReader.GetText(); + if (L"position" == wsName ) m_oPosition = oReader.GetText(); + else if (L"polar" == wsName ) m_oPolar = oReader.GetText(); break; case 'r': - if ( (L"radiusrange") == wsName ) m_oRadiusRange = oReader.GetText(); + if (L"radiusrange" == wsName ) m_oRadiusRange = oReader.GetText(); break; case 's': - if ( (L"switch") == wsName ) m_oSwitch = oReader.GetText(); + if (L"switch" == wsName ) m_oSwitch = oReader.GetText(); break; case 'x': - if ( (L"xrange") == wsName ) m_oXRange = oReader.GetText(); + if (L"xrange" == wsName ) m_oXRange = oReader.GetText(); break; case 'y': - if ( (L"yrange") == wsName ) m_oYRange = oReader.GetText(); + if (L"yrange" == wsName ) m_oYRange = oReader.GetText(); break; } @@ -1991,35 +1975,35 @@ namespace OOX std::wstring CH::toXML() const { - std::wstring sResult = (L""); + sResult += L"/>"; return sResult; } @@ -2040,31 +2024,30 @@ namespace OOX while ( oReader.ReadNextSiblingNode( nCurDepth ) ) { std::wstring sName = oReader.GetName(); - if ( (L"v:fill") == sName ) + if (L"v:fill" == sName ) m_oVmlFill = oReader; - else if ( (L"v:stroke") == sName ) + else if (L"v:stroke" == sName ) m_oVmlStroke = oReader; - else if ( (L"v:textbox") == sName ) + else if (L"v:textbox" == sName ) m_oVmlTextbox = oReader; - else if ( (L"v:shadow") == sName ) + else if (L"v:shadow" == sName ) m_oVmlShadow = oReader; - else if ( (L"o:skew") == sName ) + else if (L"o:skew" == sName ) m_oSkew = oReader; - else if ( (L"o:extrusion") == sName ) + else if (L"o:extrusion" == sName ) m_oExtrusion = oReader; - else if ( (L"o:callout") == sName ) + else if (L"o:callout" == sName ) m_oCallout = oReader; - else if ( (L"o:lock") == sName ) + else if (L"o:lock" == sName ) m_oLock = oReader; - else if ( (L"o:colormru") == sName ) + else if (L"o:colormru" == sName ) m_oColorMru = oReader; - else if ( (L"o:colormenu") == sName ) + else if (L"o:colormenu" == sName ) m_oColorMenu = oReader; } } void CShapeDefaults::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { - // Читаем атрибуты if ( oReader.GetAttributesCount() <= 0 ) return; @@ -2078,20 +2061,20 @@ namespace OOX switch ( wsChar ) { case 'f': - if ( (L"fill") == wsName ) m_oFill = oReader.GetText(); - else if ( (L"fillcolor") == wsName ) m_oFillColor = oReader.GetText(); + if (L"fill" == wsName ) m_oFill = oReader.GetText(); + else if (L"fillcolor" == wsName ) m_oFillColor = oReader.GetText(); break; case 'o': - if ( (L"o:allowincell") == wsName ) m_oAllowInCell = oReader.GetText(); + if (L"o:allowincell" == wsName ) m_oAllowInCell = oReader.GetText(); break; case 's': - if ( (L"spidmax") == wsName ) m_oSpIdMax = oReader.GetText(); - else if ( (L"style") == wsName ) m_oStyle = oReader.GetText(); - else if ( (L"stroke") == wsName ) m_oStroke = oReader.GetText(); - else if ( (L"strokecolor") == wsName ) m_oStrokeColor = oReader.GetText(); + if (L"spidmax" == wsName ) m_oSpIdMax = oReader.GetText(); + else if (L"style" == wsName ) m_oStyle = oReader.GetText(); + else if (L"stroke" == wsName ) m_oStroke = oReader.GetText(); + else if (L"strokecolor" == wsName ) m_oStrokeColor = oReader.GetText(); break; case 'v': - if ( (L"v:ext") == wsName ) m_oExt = oReader.GetText(); + if (L"v:ext" == wsName ) m_oExt = oReader.GetText(); break; } @@ -2107,30 +2090,30 @@ namespace OOX std::wstring CShapeDefaults::toXML() const { - std::wstring sResult = (L""); + sResult += L">"; if ( m_oVmlFill.IsInit() ) sResult += m_oVmlFill->toXML(); @@ -2162,7 +2145,7 @@ namespace OOX if ( m_oColorMenu.IsInit() ) sResult += m_oColorMenu->toXML(); - sResult += (L""); + sResult += L""; return sResult; } diff --git a/Common/DocxFormat/Source/DocxFormat/Logic/Vml.h b/Common/DocxFormat/Source/DocxFormat/Logic/Vml.h index 11b495ae82..b23c0578fd 100644 --- a/Common/DocxFormat/Source/DocxFormat/Logic/Vml.h +++ b/Common/DocxFormat/Source/DocxFormat/Logic/Vml.h @@ -730,16 +730,16 @@ namespace OOX private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - std::wstring m_sSrc; - SimpleTypes::Vml::CVml_1_65536 m_oCropLeft; - SimpleTypes::Vml::CVml_1_65536 m_oCropTop; - SimpleTypes::Vml::CVml_1_65536 m_oCropRight; - SimpleTypes::Vml::CVml_1_65536 m_oCropBottom; - SimpleTypes::CDouble m_oGain; - SimpleTypes::CDouble m_oBlackLevel; - SimpleTypes::CDouble m_oGamma; - SimpleTypes::CTrueFalse m_oGrayscale; - SimpleTypes::CTrueFalse m_oBiLevel; + nullable_string m_pSrc; + nullable m_pCropLeft; + nullable m_pCropTop; + nullable m_pCropRight; + nullable m_pCropBottom; + nullable_double m_pGain; + nullable_double m_pBlackLevel; + nullable_double m_pGamma; + nullable> m_pGrayscale; + nullable> m_pBiLevel; }; //-------------------------------------------------------------------------------- // CImageData 14.1.2.11 (Part4) @@ -775,9 +775,9 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable_string m_sAltHref; - SimpleTypes::CTrueFalse m_oBiLevel; - SimpleTypes::CDouble m_oBlackLevel; + nullable_string m_sAltHref; + nullable> m_oBiLevel; + nullable_double m_oBlackLevel; nullable> m_oChromaKey; nullable m_oCropLeft; nullable m_oCropTop; @@ -785,14 +785,14 @@ namespace OOX nullable m_oCropBottom; nullable> m_oDetectMouseClick; nullable> m_oEmbossColor; - SimpleTypes::CDouble m_oGain; - SimpleTypes::CDouble m_oGamma; - SimpleTypes::CTrueFalse m_oGrayscale; + nullable_double m_oGain; + nullable_double m_oGamma; + nullable> m_oGrayscale; nullable m_rHref; nullable_string m_oHref; nullable m_rId; nullable_string m_oId; - nullable m_oMovie; + nullable_double m_oMovie; nullable_string m_oOleId; nullable m_rPict; nullable> m_oRecolorTarget; @@ -962,23 +962,21 @@ namespace OOX void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - - // Attributes - SimpleTypes::CTrueFalse m_oArrowOk; - nullable_string m_oConnectAngles; - nullable_string m_oConnectLocs; - SimpleTypes::CConnectType m_oConnectType; - SimpleTypes::CTrueFalse m_oExtrusionOk; - SimpleTypes::CTrueFalse m_oFillOk; - SimpleTypes::CTrueFalse m_oGradientShapeOk; - nullable_string m_oId; - SimpleTypes::CTrueFalse m_oInsetPenOk; - SimpleTypes::Vml::CVml_Vector2D_Units m_oLimo; - SimpleTypes::CTrueFalse m_oShadowOk; - SimpleTypes::CTrueFalse m_oStrokeOk; - nullable m_oTextBoxRect; - SimpleTypes::CTrueFalse m_oTextPathOk; - nullable m_oV; + nullable> m_oArrowOk; + nullable_string m_oConnectAngles; + nullable_string m_oConnectLocs; + nullable>m_oConnectType; + nullable> m_oExtrusionOk; + nullable> m_oFillOk; + nullable> m_oGradientShapeOk; + nullable_string m_oId; + nullable> m_oInsetPenOk; + nullable m_oLimo; + nullable> m_oShadowOk; + nullable> m_oStrokeOk; + nullable m_oTextBoxRect; + nullable> m_oTextPathOk; + nullable m_oV; }; //-------------------------------------------------------------------------------- // CPolyLine 14.1.2.15 (Part4) @@ -1620,39 +1618,37 @@ namespace OOX nullable_string m_sAltHref; nullable> m_oColor; nullable> m_oColor2; - SimpleTypes::Vml::CVmlDashStyle m_oDahsStyle; - SimpleTypes::CStrokeArrowType m_oEndArrow; - SimpleTypes::CStrokeArrowLength m_oEndArrowLength; - SimpleTypes::CStrokeArrowWidth m_oEndArrowWidth; - SimpleTypes::CStrokeEndCap m_oEndCap; - SimpleTypes::CFillType m_oFillType; - SimpleTypes::CTrueFalse m_oForceDash; + 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; - SimpleTypes::CTrueFalse m_oImageAlignShape; - SimpleTypes::CImageAspect m_oImageAspect; + nullable> m_oImageAlignShape; + nullable> m_oImageAspect; nullable m_oImageSize; nullable> m_oInsetPen; - SimpleTypes::CStrokeJoinStyle m_oJoinStyle; + nullable> m_oJoinStyle; nullable> m_oLineStyle; - SimpleTypes::CDecimalNumber<8> m_oMiterLimit; - SimpleTypes::CTrueFalse m_oOn; - nullable m_oOpacity; + nullable> m_oMiterLimit; + nullable> m_oOn; + nullable_double m_oOpacity; nullable m_oRelId; nullable_string m_sSrc; - SimpleTypes::CStrokeArrowType m_oStartArrow; - SimpleTypes::CStrokeArrowLength m_oStartArrowLength; - SimpleTypes::CStrokeArrowWidth m_oStartArrowWidth; + nullable> m_oStartArrow; + nullable> m_oStartArrowLength; + nullable>m_oStartArrowWidth; nullable_string m_sTitle; - SimpleTypes::CDouble m_oWeight; + nullable_double m_oWeight; - // Childs nullable m_oLeft; nullable m_oTop; nullable m_oRight; nullable m_oBottom; nullable m_oColumn; - }; //-------------------------------------------------------------------------------- // CTextbox 14.1.2.22 (Part4) diff --git a/Common/DocxFormat/Source/DocxFormat/Media/Media.cpp b/Common/DocxFormat/Source/DocxFormat/Media/Media.cpp index 4901a32a78..7a13dae82d 100644 --- a/Common/DocxFormat/Source/DocxFormat/Media/Media.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Media/Media.cpp @@ -64,6 +64,9 @@ namespace OOX if (!CSystemUtility::IsFileExist(newFilePath / newFilename)) { + std::wstring ext = filename.GetExtention(); + if (false == ext.empty()) content.AddDefault(ext.substr(1)); + if (false == m_Data.empty()) { NSFile::CFileBinary file; diff --git a/Common/DocxFormat/Source/DocxFormat/Settings/Settings.cpp b/Common/DocxFormat/Source/DocxFormat/Settings/Settings.cpp index fe0010fac8..6d0aeb48cf 100644 --- a/Common/DocxFormat/Source/DocxFormat/Settings/Settings.cpp +++ b/Common/DocxFormat/Source/DocxFormat/Settings/Settings.cpp @@ -1111,11 +1111,14 @@ namespace Settings pEndnote->fromXML(oReader); pEndnote->m_oId.Init(); - pEndnote->m_oId->SetValue((int)(docx_flat->m_pEndnotes->m_arrEndnote.size() + 1)); + pEndnote->m_oId->SetValue((int)docx_flat->m_pEndnotes->m_arrEndnote.size() - 1); docx_flat->m_pSettings->m_oEndnotePr->m_arrEndnote.push_back(new CFtnEdnSepRef()); docx_flat->m_pSettings->m_oEndnotePr->m_arrEndnote.back()->m_oId = pEndnote->m_oId; docx_flat->m_pSettings->m_oEndnotePr->m_arrEndnote.back()->m_eType = OOX::et_w_endnote; + + docx_flat->m_pEndnotes->m_arrEndnote.push_back(pEndnote); + docx_flat->m_pEndnotes->m_mapEndnote.insert(std::make_pair(pEndnote->m_oId->GetValue(), pEndnote)); } else { @@ -1189,12 +1192,14 @@ namespace Settings pFootnote->fromXML(oReader); pFootnote->m_oId.Init(); - pFootnote->m_oId->SetValue((int)(docx_flat->m_pEndnotes->m_arrEndnote.size() + 1)); + pFootnote->m_oId->SetValue((int)docx_flat->m_pFootnotes->m_arrFootnote.size() - 1); docx_flat->m_pSettings->m_oFootnotePr->m_arrFootnote.push_back(new CFtnEdnSepRef()); docx_flat->m_pSettings->m_oFootnotePr->m_arrFootnote.back()->m_oId = pFootnote->m_oId; docx_flat->m_pSettings->m_oFootnotePr->m_arrFootnote.back()->m_eType = OOX::et_w_footnote; + docx_flat->m_pFootnotes->m_arrFootnote.push_back(pFootnote); + docx_flat->m_pFootnotes->m_mapFootnote.insert(std::make_pair(pFootnote->m_oId->GetValue(), pFootnote)); } else { diff --git a/DesktopEditor/raster/ImageFileFormatChecker.cpp b/DesktopEditor/raster/ImageFileFormatChecker.cpp index 1a664a03a5..44055e9338 100644 --- a/DesktopEditor/raster/ImageFileFormatChecker.cpp +++ b/DesktopEditor/raster/ImageFileFormatChecker.cpp @@ -771,7 +771,7 @@ std::wstring CImageFileFormatChecker::DetectFormatByData(BYTE *Data, int DataSiz else if (isEmfFile(Data,DataSize)) return L"emf"; else if (isGifFile(Data,DataSize)) return L"gif"; else if (isIcoFile(Data,DataSize)) return L"ico"; - else if (isJpgFile(Data,DataSize)) return L"jpg"; + else if (isJpgFile(Data,DataSize)) return L"jpeg"; else if (isPcxFile(Data,DataSize)) return L"pcx"; else if (isPngFile(Data,DataSize)) return L"png"; else if (isRasFile(Data,DataSize)) return L"ras";